From: Tom Lendacky <thomas.lendacky@amd.com>
To: Dave Hansen <dave.hansen@intel.com>,
Tony Battersby <tonyb@cybernetics.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org
Cc: "H. Peter Anvin" <hpa@zytor.com>,
Mario Limonciello <mario.limonciello@amd.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH RFC] x86/cpu: fix intermittent lockup on poweroff
Date: Wed, 26 Apr 2023 14:18:34 -0500 [thread overview]
Message-ID: <469754ab-d8ec-168a-15c7-61045a880792@amd.com> (raw)
In-Reply-To: <25dd25d3-2db1-acf6-0814-9bb5bcd65bb9@intel.com>
On 4/26/23 13:15, Dave Hansen wrote:
> On 4/26/23 10:51, Tom Lendacky wrote:
>>>> + /*
>>>> + * native_stop_other_cpus() will write to @stop_cpus_count after
>>>> + * observing that it went down to zero, which will invalidate the
>>>> + * cacheline on this CPU.
>>>> + */
>>>> + atomic_dec(&stop_cpus_count);
>>
>> This is probably going to pull in a cache line and cause the problem the
>> native_wbinvd() is trying to avoid.
>
> Is one _more_ cacheline really the problem?
The answer is it depends. If the cacheline ends up modified/dirty, then it
can be a problem.
>
> Or is having _any_ cacheline pulled in a problem? What about the text
> page containing the WBINVD? How about all the page table pages that are
> needed to resolve %RIP to a physical address?
It's been a while since I looked into all this, but text and page table
pages didn't present any problems because they weren't modified, but stack
memory was. Doing a plain wbinvd() resulted in calls to the paravirt
support and stack data from the call to wbinvd() ended up in some page
structs in the kexec kernel (applicable to zen1 and zen2). Using
native_wbinvd() eliminated the stack data changes after the WBINVD and
didn't end up with any corruption following a kexec.
>
> What about the mds_idle_clear_cpu_buffers() code that snuck into
> native_halt()?
Luckily that is all inline and using a static branch which isn't enabled
for AMD and should just jmp to the hlt, so no modified cache lines.
Thanks,
Tom
>
>> ffffffff810ede4c: 0f 09 wbinvd
>> ffffffff810ede4e: 8b 05 e4 3b a7 02 mov 0x2a73be4(%rip),%eax # ffffffff83b61a38 <mds_idle_clear>
>> ffffffff810ede54: 85 c0 test %eax,%eax
>> ffffffff810ede56: 7e 07 jle ffffffff810ede5f <stop_this_cpu+0x9f>
>> ffffffff810ede58: 0f 00 2d b1 75 13 01 verw 0x11375b1(%rip) # ffffffff82225410 <ds.6688>
>> ffffffff810ede5f: f4 hlt
>> ffffffff810ede60: eb ec jmp ffffffff810ede4e <stop_this_cpu+0x8e>
>> ffffffff810ede62: e8 59 40 1a 00 callq ffffffff81291ec0 <trace_hardirqs_off>
>> ffffffff810ede67: eb 85 jmp ffffffff810eddee <stop_this_cpu+0x2e>
>> ffffffff810ede69: 0f 1f 80 00 00 00 00 nopl 0x0(%rax)
>
next prev parent reply other threads:[~2023-04-26 19:18 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-25 19:26 Tony Battersby
2023-04-25 19:39 ` Borislav Petkov
2023-04-25 19:58 ` Tony Battersby
2023-04-25 20:03 ` Dave Hansen
2023-04-25 20:34 ` Dave Hansen
2023-04-25 21:06 ` Borislav Petkov
2023-04-25 21:05 ` Thomas Gleixner
2023-04-25 22:29 ` Dave Hansen
2023-04-25 23:00 ` Thomas Gleixner
2023-04-26 0:10 ` H. Peter Anvin
2023-04-26 14:45 ` Tony Battersby
2023-04-26 16:37 ` Thomas Gleixner
2023-04-26 17:37 ` Tony Battersby
2023-04-26 17:41 ` [PATCH v2] x86/cpu: fix SME test in stop_this_cpu() Tony Battersby
2023-05-22 14:07 ` [PATCH v2 RESEND] " Tony Battersby
2023-04-26 17:51 ` [PATCH RFC] x86/cpu: fix intermittent lockup on poweroff Tom Lendacky
2023-04-26 18:15 ` Dave Hansen
2023-04-26 19:18 ` Tom Lendacky [this message]
2023-04-26 22:02 ` Andi Kleen
2023-04-26 23:20 ` Thomas Gleixner
2023-04-26 20:00 ` Thomas Gleixner
2023-06-20 13:00 ` [tip: x86/core] x86/smp: Make stop_other_cpus() more robust tip-bot2 for Thomas Gleixner
2023-06-20 13:00 ` [tip: x86/core] x86/smp: Dont access non-existing CPUID leaf tip-bot2 for Tony Battersby
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=469754ab-d8ec-168a-15c7-61045a880792@amd.com \
--to=thomas.lendacky@amd.com \
--cc=ak@linux.intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=tonyb@cybernetics.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®