mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-25 02:48:21 +00:00
73efe4a4dd
We currently have a global error message buffer in cmn_err that is protected by a spin lock that disables interrupts. Recently there have been reports of NMI timeouts occurring when the console is being flooded by SCSI error reports due to cmn_err() getting stuck trying to print to the console while holding this lock (i.e. with interrupts disabled). The NMI watchdog is seeing this CPU as non-responding and so is triggering a panic. While the trigger for the reported case is SCSI errors, pretty much anything that spams the kernel log could cause this to occur. Realistically the only reason that we have the intemediate message buffer is to prepend the correct kernel log level prefix to the log message. The only reason we have the lock is to protect the global message buffer and the only reason the message buffer is global is to keep it off the stack. Hence if we can avoid needing a global message buffer we avoid needing the lock, and we can do this with a small amount of cleanup and some preprocessor tricks: 1. clean up xfs_cmn_err() panic mask functionality to avoid needing debug code in xfs_cmn_err() 2. remove the couple of "!" message prefixes that still exist that the existing cmn_err() code steps over. 3. redefine CE_* levels directly to KERN_* 4. redefine cmn_err() and friends to use printk() directly via variable argument length macros. By doing this, we can completely remove the cmn_err() code and the lock that is causing the problems, and rely solely on printk() serialisation to ensure that we don't get garbled messages. A series of followup patches is really needed to clean up all the cmn_err() calls and related messages properly, but that results in a series that is not easily back portable to enterprise kernels. Hence this initial fix is only to address the direct problem in the lowest impact way possible. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
62 lines
1.8 KiB
C
62 lines
1.8 KiB
C
/*
|
|
* Copyright (c) 2000-2005 Silicon Graphics, Inc.
|
|
* All Rights Reserved.
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it would be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write the Free Software Foundation,
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
#ifndef __XFS_SUPPORT_DEBUG_H__
|
|
#define __XFS_SUPPORT_DEBUG_H__
|
|
|
|
#include <stdarg.h>
|
|
|
|
struct xfs_mount;
|
|
|
|
#define CE_DEBUG KERN_DEBUG
|
|
#define CE_CONT KERN_INFO
|
|
#define CE_NOTE KERN_NOTICE
|
|
#define CE_WARN KERN_WARNING
|
|
#define CE_ALERT KERN_ALERT
|
|
#define CE_PANIC KERN_EMERG
|
|
|
|
void cmn_err(const char *lvl, const char *fmt, ...)
|
|
__attribute__ ((format (printf, 2, 3)));
|
|
void xfs_fs_cmn_err( const char *lvl, struct xfs_mount *mp,
|
|
const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
|
|
void xfs_cmn_err( int panic_tag, const char *lvl, struct xfs_mount *mp,
|
|
const char *fmt, ...) __attribute__ ((format (printf, 4, 5)));
|
|
|
|
extern void assfail(char *expr, char *f, int l);
|
|
|
|
#define ASSERT_ALWAYS(expr) \
|
|
(unlikely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
|
|
|
|
#ifndef DEBUG
|
|
#define ASSERT(expr) ((void)0)
|
|
|
|
#ifndef STATIC
|
|
# define STATIC static noinline
|
|
#endif
|
|
|
|
#else /* DEBUG */
|
|
|
|
#define ASSERT(expr) \
|
|
(unlikely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
|
|
|
|
#ifndef STATIC
|
|
# define STATIC noinline
|
|
#endif
|
|
|
|
#endif /* DEBUG */
|
|
#endif /* __XFS_SUPPORT_DEBUG_H__ */
|