Re: [PATCH] printk: ignore recursion_bug flag when MCE in progress

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

+ Tony

On Wed, May 23, 2012 at 09:58:34AM +0800, ShuoX Liu wrote:
> From: ShuoX Liu <shuox.liu@xxxxxxxxx>
> When MCE happens in printk, we ignore recursion_bug to make sure
> some MCE logs printed out. Re-use mce_entry variable.
> Signed-off-by: Yanmin Zhang <yanmin_zhang@xxxxxxxxxxxxxxx>
> Signed-off-by: ShuoX Liu <shuox.liu@xxxxxxxxx>
> ---
> I found mce_entry was introduced by commit 553f265f, but it's not
> used now. Why not removed?
> ---
>  arch/x86/include/asm/mce.h       |    2 --
>  arch/x86/kernel/cpu/mcheck/mce.c |    2 --
>  include/linux/kernel.h           |    1 +
>  kernel/printk.c                  |    4 +++-
>  4 files changed, 4 insertions(+), 5 deletions(-)
> diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
> index 441520e..aeda4cc 100644
> --- a/arch/x86/include/asm/mce.h
> +++ b/arch/x86/include/asm/mce.h
> @@ -187,8 +187,6 @@ int mce_available(struct cpuinfo_x86 *c);
>  DECLARE_PER_CPU(unsigned, mce_exception_count);
>  DECLARE_PER_CPU(unsigned, mce_poll_count);
> -extern atomic_t mce_entry;
> -
>  typedef DECLARE_BITMAP(mce_banks_t, MAX_NR_BANKS);
>  DECLARE_PER_CPU(mce_banks_t, mce_poll_banks);
> diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
> index 11c9166..6073354 100644
> --- a/arch/x86/kernel/cpu/mcheck/mce.c
> +++ b/arch/x86/kernel/cpu/mcheck/mce.c
> @@ -61,8 +61,6 @@ int mce_disabled __read_mostly;
>  #define SPINUNIT 100	/* 100ns */
> -atomic_t mce_entry;
> -
>  DEFINE_PER_CPU(unsigned, mce_exception_count);
>  /*
> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> index 645231c..24af685 100644
> --- a/include/linux/kernel.h
> +++ b/include/linux/kernel.h
> @@ -354,6 +354,7 @@ unsigned long int_sqrt(unsigned long);
>  extern void bust_spinlocks(int yes);
>  extern void wake_up_klogd(void);
>  extern int oops_in_progress;		/* If set, an oops, panic(), BUG() or die() is in progress */
> +extern atomic_t mce_entry;
>  extern int panic_timeout;
>  extern int panic_on_oops;
>  extern int panic_on_unrecovered_nmi;
> diff --git a/kernel/printk.c b/kernel/printk.c
> index 473afdb..2bae087 100644
> --- a/kernel/printk.c
> +++ b/kernel/printk.c
> @@ -79,6 +79,7 @@ int console_printk[4] = {
>  int oops_in_progress;
>  EXPORT_SYMBOL(oops_in_progress);
> +atomic_t mce_entry;
>  /*
>   * console_sem protects the console_drivers list, and also
>   * provides serialisation for access to the entire console
> @@ -864,7 +865,8 @@ asmlinkage int vprintk(const char *fmt, va_list args)
>  		 * recursion and return - but flag the recursion so that
>  		 * it can be printed at the next appropriate moment:
>  		 */
> -		if (!oops_in_progress && !lockdep_recursing(current)) {
> +		if (!oops_in_progress && !atomic_read(&mce_entry)

This is leaking x86-specific (MCE) stuff in generic kernel code. I think
it would be more appropriate to add a in_hw_error() helper or similar
and define it on each arch. I can very well imagine other architectures
would like to print hw error info too...


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at

[Other Archives]     [Linux Kernel Newbies]     [Linux Driver Development]     [Fedora Kernel]     [Linux Kernel Testers]     [Linux SH]     [Linux Omap]     [Linux Kbuild]     [Linux Tape]     [Linux Input]     [Linux Kernel Janitors]     [Linux Kernel Packagers]     [Linux Doc]     [Linux Man Pages]     [Linux API]     [Linux Memory Management]     [Linux Modules]     [Linux Standards]     [Kernel Announce]     [Netdev]     [Git]     [Linux PCI]     Linux CAN Development     [Linux I2C]     [Linux RDMA]     [Linux NUMA]     [Netfilter]     [Netfilter Devel]     [SELinux]     [Bugtraq]     [FIO]     [Linux Perf Users]     [Linux Serial]     [Linux PPP]     [Linux ISDN]     [Linux Next]     [Kernel Stable Commits]     [Linux Tip Commits]     [Kernel MM Commits]     [Linux Security Module]     [AutoFS]     [Filesystem Development]     [Ext3 Filesystem]     [Linux bcache]     [Ext4 Filesystem]     [Linux BTRFS]     [Linux CEPH Filesystem]     [Linux XFS]     [XFS]     [Linux NFS]     [Linux CIFS]     [Ecryptfs]     [Linux NILFS]     [Linux Cachefs]     [Reiser FS]     [Initramfs]     [Linux FB Devel]     [Linux OpenGL]     [DRI Devel]     [Fastboot]     [Linux RT Users]     [Linux RT Stable]     [eCos]     [Corosync]     [Linux Clusters]     [LVS Devel]     [Hot Plug]     [Linux Virtualization]     [KVM]     [KVM PPC]     [KVM ia64]     [Linux Containers]     [Linux Hexagon]     [Linux Cgroups]     [Util Linux]     [Wireless]     [Linux Bluetooth]     [Bluez Devel]     [Ethernet Bridging]     [Embedded Linux]     [Barebox]     [Linux MMC]     [Linux IIO]     [Sparse]     [Smatch]     [Linux Arch]     [x86 Platform Driver]     [Linux ACPI]     [Linux IBM ACPI]     [LM Sensors]     [CPU Freq]     [Linux Power Management]     [Linmodems]     [Linux DCCP]     [Linux SCTP]     [ALSA Devel]     [Linux USB]     [Linux PA RISC]     [Linux Samsung SOC]     [MIPS Linux]     [IBM S/390 Linux]     [ARM Linux]     [ARM Kernel]     [ARM MSM]     [Tegra Devel]     [Sparc Linux]     [Linux Security]     [Linux Sound]     [Linux Media]     [Video 4 Linux]     [Linux IRDA Users]     [Linux for the blind]     [Linux RAID]     [Linux ATA RAID]     [Device Mapper]     [Linux SCSI]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Linux IDE]     [Linux SMP]     [Linux AXP]     [Linux Alpha]     [Linux M68K]     [Linux ia64]     [Linux 8086]     [Linux x86_64]     [Linux Config]     [Linux Apps]     [Linux MSDOS]     [Linux X.25]     [Linux Crypto]     [DM Crypt]     [Linux Trace Users]     [Linux Btrace]     [Linux Watchdog]     [Utrace Devel]     [Linux C Programming]     [Linux Assembly]     [Dash]     [DWARVES]     [Hail Devel]     [Linux Kernel Debugger]     [Linux gcc]     [Gcc Help]     [X.Org]     [Wine]

Add to Google Powered by Linux

[Older Kernel Discussion]     [Yosemite National Park Forum]     [Large Format Photos]     [Gimp]     [Yosemite Photos]     [Stuff]