mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nikolay Borisov <nik.borisov@suse.com>
To: Borislav Petkov <bp@alien8.de>
Cc: linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org,
	x86@kernel.org, tony.luck@intel.com
Subject: Re: [PATCH v2 1/3] x86/mce/inject: Remove call to mce_notify_irq()
Date: Mon, 17 Feb 2025 13:20:55 +0200	[thread overview]
Message-ID: <ff06575b-079b-4016-9a28-5b439beb0ff5@suse.com> (raw)
In-Reply-To: <8cce2725-9efe-44e8-b071-f921874d7649@suse.com>



On 17.02.25 г. 12:01 ч., Nikolay Borisov wrote:
> 
> 
> On 16.02.25 г. 18:10 ч., Borislav Petkov wrote:
>> On Mon, Feb 10, 2025 at 05:47:04PM +0200, Nikolay Borisov wrote:
>>> The call is actually a noop because when the MCE is raised the early
>>> notifier is the only call site that correctly calls mce_notify_irq()
>>> because it also sets mce_need_notify. Remove this call and as a result
>>> make mce_notify_irq() static
>>>
>>> Signed-off-by: Nikolay Borisov <nik.borisov@suse.com>
>>> ---
>>>   arch/x86/include/asm/mce.h       |  2 --
>>>   arch/x86/kernel/cpu/mce/core.c   | 44 ++++++++++++++++----------------
>>>   arch/x86/kernel/cpu/mce/inject.c |  1 -
>>>   3 files changed, 22 insertions(+), 25 deletions(-)
>>
>> So what you're looking at are the remnants of the old soft-inject of MCE
>> errors. And it seems that we lost some of that functionality along the 
>> way and
>> no one has noticed because, well, it seems no one uses it anymore.
>>
>> In order to understand how this thing was supposed to work, checkout
>>
>> ea149b36c7f5 ("x86, mce: add basic error injection infrastructure")
> 
> 
> The original code in  ea149b36c7f5 was setting the notify_user bit via
> 
> raise_mce()->machine_check_poll()->mce_log(),
>   mce_notify_user() - consumes notify_user set in mce_log above.
> 
> 
>   subsequently in 011d82611172 ("RAS: Add a Corrected Errors Collector") 
> you factored out the code from mce_log() mce_first_notifier, where the 
> bit setting remains to this day, but since it's been removed from 
> mce_log() it made the call in raise_local() defunct.
> 
> 
> Considering that no one complained about this after all these years and 
> that the dev-mcelog is deprecated I think it still makes sense to make 
> mce_notify_irq() private


Actually there is no loss of functionality since after an MCE is injected
the early notifier will correctly call the usermode helper. So I
think the following change log better reflects the situation:


     x86/mce/inject: Remove call to mce_notify_irq()
     
     The call to mce_notify_irq() has been there since the initial version of
     the soft inject mce machinery, introduced in ea149b36c7f5 ("x86,
     mce: add basic error injection infrastructure"). At that time it was
     functional since injecting an MCE resulted in the following call chain:
     
     raise_mce()
       ->machine_check_poll()
           ->mce_log() - sets notfiy_user_bit
     
     ->mce_notify_user() (current mce_notify_irq) consumed the bit and called the
     usermode helper.
     
     However, with the introduction of 011d82611172 ("RAS: Add a Corrected Errors Collector")
     the code got moved around and the user mode helper began to be called
     via the early notifier (mce_first_notifier()) rendering the remaining call
     in raise_local() defunct as the mce_need_notify bit (ex notify_user) is
     only being set from the early notifier.
     
     Remove the noop call and make mce_notify_irq static. No functional
     changes.

> 
>>
>> and follow what raise_mce() does and pay attention to notify_user 
>> which is
>> what mce_need_notify was called back then.
>>
>> Remember to have fun :-P
>>
> 


  reply	other threads:[~2025-02-17 11:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-10 15:47 [PATCH v2 0/3] Simpify mce code somewhat Nikolay Borisov
2025-02-10 15:47 ` [PATCH v2 1/3] x86/mce/inject: Remove call to mce_notify_irq() Nikolay Borisov
2025-02-11  7:03   ` Zhuo, Qiuxu
2025-02-11  8:49     ` Nikolay Borisov
2025-02-11 12:37       ` Zhuo, Qiuxu
2025-02-16 16:10   ` Borislav Petkov
2025-02-17 10:01     ` Nikolay Borisov
2025-02-17 11:20       ` Nikolay Borisov [this message]
2025-02-17 11:47         ` Borislav Petkov
2025-02-10 15:47 ` [PATCH v2 2/3] x86/mce: Move message printing from mce_notify_irq to mce_early_notifier() Nikolay Borisov
2025-02-11  7:10   ` Zhuo, Qiuxu
2025-02-25 13:10   ` Borislav Petkov
2025-02-10 15:47 ` [PATCH v2 3/3] x86/mce: Make mce_notify_irq() depend on CONFIG_X86_MCELOG_LEGACY Nikolay Borisov
2025-02-11  7:20   ` Zhuo, Qiuxu
2025-02-11 10:18     ` Nikolay Borisov
2025-02-25 13:12   ` Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ff06575b-079b-4016-9a28-5b439beb0ff5@suse.com \
    --to=nik.borisov@suse.com \
    --cc=bp@alien8.de \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®