All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/mce: Remove redundant irq work
@ 2019-07-30  6:15 Santosh Sivaraj
  2019-07-30  8:19 ` Peter Zijlstra
  2019-07-30  8:44 ` Thomas Gleixner
  0 siblings, 2 replies; 3+ messages in thread
From: Santosh Sivaraj @ 2019-07-30  6:15 UTC (permalink / raw)
  To: x86, Linux Kernel; +Cc: H. Peter Anvin, Aneesh Kumar K.V

IRQ work currently only does a schedule work to process the mce
events. Since irq work does no other function, remove it.

Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
---
 arch/x86/kernel/cpu/mce/core.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
index 743370ee4983..658da808c031 100644
--- a/arch/x86/kernel/cpu/mce/core.c
+++ b/arch/x86/kernel/cpu/mce/core.c
@@ -119,7 +119,7 @@ DEFINE_PER_CPU(mce_banks_t, mce_poll_banks) = {
 mce_banks_t mce_banks_ce_disabled;
 
 static struct work_struct mce_work;
-static struct irq_work mce_irq_work;
+static void mce_schedule_work(void);
 
 static void (*quirk_no_way_out)(int bank, struct mce *m, struct pt_regs *regs);
 
@@ -154,7 +154,7 @@ EXPORT_PER_CPU_SYMBOL_GPL(injectm);
 void mce_log(struct mce *m)
 {
 	if (!mce_gen_pool_add(m))
-		irq_work_queue(&mce_irq_work);
+		mce_schedule_work();
 }
 
 void mce_inject_log(struct mce *m)
@@ -472,11 +472,6 @@ static void mce_schedule_work(void)
 		schedule_work(&mce_work);
 }
 
-static void mce_irq_work_cb(struct irq_work *entry)
-{
-	mce_schedule_work();
-}
-
 /*
  * Check if the address reported by the CPU is in a format we can parse.
  * It would be possible to add code for most other cases, but all would
@@ -1333,7 +1328,7 @@ void do_machine_check(struct pt_regs *regs, long error_code)
 		mce_panic("Fatal machine check on current CPU", &m, msg);
 
 	if (worst > 0)
-		irq_work_queue(&mce_irq_work);
+		mce_schedule_work();
 
 	mce_wrmsrl(MSR_IA32_MCG_STATUS, 0);
 
@@ -1984,7 +1979,6 @@ int __init mcheck_init(void)
 	mcheck_vendor_init_severity();
 
 	INIT_WORK(&mce_work, mce_gen_pool_process);
-	init_irq_work(&mce_irq_work, mce_irq_work_cb);
 
 	return 0;
 }
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/mce: Remove redundant irq work
  2019-07-30  6:15 [PATCH] x86/mce: Remove redundant irq work Santosh Sivaraj
@ 2019-07-30  8:19 ` Peter Zijlstra
  2019-07-30  8:44 ` Thomas Gleixner
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Zijlstra @ 2019-07-30  8:19 UTC (permalink / raw)
  To: Santosh Sivaraj; +Cc: x86, Linux Kernel, H. Peter Anvin, Aneesh Kumar K.V

On Tue, Jul 30, 2019 at 11:45:20AM +0530, Santosh Sivaraj wrote:
> IRQ work currently only does a schedule work to process the mce
> events. Since irq work does no other function, remove it.
> 
> Signed-off-by: Santosh Sivaraj <santosh@fossix.org>

NAK this is broken. MCE is NMI like.

> ---
>  arch/x86/kernel/cpu/mce/core.c | 12 +++---------
>  1 file changed, 3 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
> index 743370ee4983..658da808c031 100644
> --- a/arch/x86/kernel/cpu/mce/core.c
> +++ b/arch/x86/kernel/cpu/mce/core.c
> @@ -119,7 +119,7 @@ DEFINE_PER_CPU(mce_banks_t, mce_poll_banks) = {
>  mce_banks_t mce_banks_ce_disabled;
>  
>  static struct work_struct mce_work;
> -static struct irq_work mce_irq_work;
> +static void mce_schedule_work(void);
>  
>  static void (*quirk_no_way_out)(int bank, struct mce *m, struct pt_regs *regs);
>  
> @@ -154,7 +154,7 @@ EXPORT_PER_CPU_SYMBOL_GPL(injectm);
>  void mce_log(struct mce *m)
>  {
>  	if (!mce_gen_pool_add(m))
> -		irq_work_queue(&mce_irq_work);
> +		mce_schedule_work();
>  }
>  
>  void mce_inject_log(struct mce *m)
> @@ -472,11 +472,6 @@ static void mce_schedule_work(void)
>  		schedule_work(&mce_work);
>  }
>  
> -static void mce_irq_work_cb(struct irq_work *entry)
> -{
> -	mce_schedule_work();
> -}
> -
>  /*
>   * Check if the address reported by the CPU is in a format we can parse.
>   * It would be possible to add code for most other cases, but all would
> @@ -1333,7 +1328,7 @@ void do_machine_check(struct pt_regs *regs, long error_code)
>  		mce_panic("Fatal machine check on current CPU", &m, msg);
>  
>  	if (worst > 0)
> -		irq_work_queue(&mce_irq_work);
> +		mce_schedule_work();
>  
>  	mce_wrmsrl(MSR_IA32_MCG_STATUS, 0);
>  
> @@ -1984,7 +1979,6 @@ int __init mcheck_init(void)
>  	mcheck_vendor_init_severity();
>  
>  	INIT_WORK(&mce_work, mce_gen_pool_process);
> -	init_irq_work(&mce_irq_work, mce_irq_work_cb);
>  
>  	return 0;
>  }
> -- 
> 2.20.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/mce: Remove redundant irq work
  2019-07-30  6:15 [PATCH] x86/mce: Remove redundant irq work Santosh Sivaraj
  2019-07-30  8:19 ` Peter Zijlstra
@ 2019-07-30  8:44 ` Thomas Gleixner
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Gleixner @ 2019-07-30  8:44 UTC (permalink / raw)
  To: Santosh Sivaraj; +Cc: x86, Linux Kernel, H. Peter Anvin, Aneesh Kumar K.V

On Tue, 30 Jul 2019, Santosh Sivaraj wrote:

> IRQ work currently only does a schedule work to process the mce
> events. Since irq work does no other function, remove it.

No. You _cannot call schedule_work() from MCE exception context as MCE can
interrupt even interrupt disabled context similar to NMI. irq work is
designed to work in those contexts.

Thanks,

	tglx

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-30  8:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-30  6:15 [PATCH] x86/mce: Remove redundant irq work Santosh Sivaraj
2019-07-30  8:19 ` Peter Zijlstra
2019-07-30  8:44 ` Thomas Gleixner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.