From: "Ghannam, Yazen" <Yazen.Ghannam@amd.com>
To: Borislav Petkov <bp@alien8.de>,
Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Cc: Tony Luck <tony.luck@intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-edac@vger.kernel.org" <linux-edac@vger.kernel.org>,
"x86@kernel.org" <x86@kernel.org>
Subject: RE: [PATCH] x86/MCE/AMD: fix warning about sleep-in-atomic at early boot
Date: Thu, 31 Oct 2019 14:58:45 +0000 [thread overview]
Message-ID: <SN6PR12MB2639DBDA3897067733D6C669F8630@SN6PR12MB2639.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20191031142955.GA23693@nazgul.tnic>
> -----Original Message-----
> From: Borislav Petkov <bp@alien8.de>
> Sent: Thursday, October 31, 2019 10:30 AM
> To: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>; Ghannam, Yazen <Yazen.Ghannam@amd.com>
> Cc: Tony Luck <tony.luck@intel.com>; linux-kernel@vger.kernel.org; linux-edac@vger.kernel.org; x86@kernel.org
> Subject: Re: [PATCH] x86/MCE/AMD: fix warning about sleep-in-atomic at early boot
>
> On Thu, Oct 31, 2019 at 04:04:48PM +0300, Konstantin Khlebnikov wrote:
> > Function smca_configure() is called only for current cpu thus
> > rdmsr_safe_on_cpu() could be replaced with atomic rdmsr_safe().
> >
> > BUG: sleeping function called from invalid context at kernel/sched/completion.c:99
> > in_atomic(): 1, irqs_disabled(): 1, pid: 0, name: swapper/1
> > CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.19.79-16 #1
> ^^^^^^^^^^
>
> I'm assuming you hit this on latest upstream too?
>
> > Hardware name: GIGABYTE R181-Z90-00/MZ91-FS0-00, BIOS R11 10/25/2019
> > Call Trace:
> > dump_stack+0x5c/0x7b
> > ___might_sleep+0xec/0x110
> > wait_for_completion+0x39/0x160
> > ? __rdmsr_safe_on_cpu+0x45/0x60
> > rdmsr_safe_on_cpu+0xae/0xf0
> > ? wrmsr_on_cpus+0x20/0x20
> > ? machine_check_poll+0xfd/0x1f0
> > ? mce_amd_feature_init+0x190/0x2d0
> > mce_amd_feature_init+0x190/0x2d0
> > mcheck_cpu_init+0x11a/0x460
> > identify_cpu+0x3e2/0x560
> > identify_secondary_cpu+0x13/0x80
> > smp_store_cpu_info+0x45/0x50
> > start_secondary+0xaa/0x200
> > secondary_startup_64+0xa4/0xb0
> >
> > Except warning in kernel log everything works fine.
> >
> > Fixes: 5896820e0aa3 ("x86/mce/AMD, EDAC/mce_amd: Define and use tables for known SMCA IP types")
> > Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
> > ---
> > arch/x86/kernel/cpu/mce/amd.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arch/x86/kernel/cpu/mce/amd.c b/arch/x86/kernel/cpu/mce/amd.c
> > index 6ea7fdc82f3c..c7ab0d38af79 100644
> > --- a/arch/x86/kernel/cpu/mce/amd.c
> > +++ b/arch/x86/kernel/cpu/mce/amd.c
> > @@ -269,7 +269,7 @@ static void smca_configure(unsigned int bank, unsigned int cpu)
> > if (smca_banks[bank].hwid)
> > return;
> >
> > - if (rdmsr_safe_on_cpu(cpu, MSR_AMD64_SMCA_MCx_IPID(bank), &low, &high)) {
> > + if (rdmsr_safe(MSR_AMD64_SMCA_MCx_IPID(bank), &low, &high)) {
>
> Yazen, any objections?
>
This looks good to me.
We can go further and remove the "cpu" parameter from this entire function.
But that can be another patch.
Reviewed-by: Yazen Ghannam <yazen.ghannam@amd.com>
Thanks,
Yazen
next prev parent reply other threads:[~2019-10-31 14:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-31 13:04 [PATCH] x86/MCE/AMD: fix warning about sleep-in-atomic at early boot Konstantin Khlebnikov
2019-10-31 14:29 ` Borislav Petkov
2019-10-31 14:58 ` Ghannam, Yazen [this message]
2019-11-01 13:39 ` Konstantin Khlebnikov
2019-11-07 10:53 ` Borislav Petkov
2019-12-17 7:53 ` Borislav Petkov
2019-12-10 10:07 ` [tip: ras/core] x86/MCE/AMD: Do not use rdmsr_safe_on_cpu() in smca_configure() tip-bot2 for Konstantin Khlebnikov
2019-12-17 10:01 ` [tip: ras/urgent] " tip-bot2 for Konstantin Khlebnikov
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=SN6PR12MB2639DBDA3897067733D6C669F8630@SN6PR12MB2639.namprd12.prod.outlook.com \
--to=yazen.ghannam@amd.com \
--cc=bp@alien8.de \
--cc=khlebnikov@yandex-team.ru \
--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;
as well as URLs for NNTP newsgroup(s).