From: Peter Zijlstra <peterz@infradead.org>
To: Khalid Ali <khaliidcaliy@gmail.com>
Cc: rafael@kernel.org, tglx@linutronix.de, mingo@redhat.com,
bp@alien8.de, dave.hansen@linux.intel.com, lenb@kernel.org,
hpa@zytor.com, x86@kernel.org, linux-acpi@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/ACPI: invalidate all cache lines on ACPI C-state transitions
Date: Mon, 26 May 2025 14:00:29 +0200 [thread overview]
Message-ID: <20250526120029.GR39944@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20250525180052.1004-1-khaliidcaliy@gmail.com>
On Sun, May 25, 2025 at 06:00:42PM +0000, Khalid Ali wrote:
> From: Khalid Ali <khaliidcaliy@gmail.com>
>
> According to ACPI spec 2.4 and 2.5, upon C-state
> transitions(specifically C2 and C3) it is required and explicitly
> mentioned to invalidate and writeback all modified cache line using
> WBINVD.
>
> However the current ACPI C-state entry using monitor/mwait instructions
> it have been used CLFLUSH by flushing the cache line associated by
> monitored address. That what all about this patch addresses,
> invalidating all cache lines instead of single cache line.
>
> Let me know if there any reason and decisions behind the current
> implementation.
>
> Signed-off-by: Khalid Ali <khaliidcaliy@gmail.com>
> ---
> arch/x86/kernel/acpi/cstate.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c
> index d5ac34186555..eb3d435e08ad 100644
> --- a/arch/x86/kernel/acpi/cstate.c
> +++ b/arch/x86/kernel/acpi/cstate.c
> @@ -222,6 +222,9 @@ void __cpuidle acpi_processor_ffh_cstate_enter(struct acpi_processor_cx *cx)
> struct cstate_entry *percpu_entry;
>
> percpu_entry = per_cpu_ptr(cpu_cstate_entry, cpu);
> + /* flush and invalidate all modified cache line on C3 and C2 state entry*/
> + if (cx->type == ACPI_STATE_C3 || cx->type == ACPI_STATE_C2)
> + wbinvd();
This is absolutely insane. This day and age, nobody should use WBINVD
ever. We've managed to not do this for decades, and I'm thinking that
either the SPEC is 'mistaken' or otherwise out of line with reality.
If you hate performance, and you want to break things like CAT, feel
free to put this in your own kernel.
> mwait_idle_with_hints(percpu_entry->states[cx->index].eax,
> percpu_entry->states[cx->index].ecx);
> }
> --
> 2.49.0
>
next prev parent reply other threads:[~2025-05-26 12:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-25 18:00 [PATCH] x86/ACPI: invalidate all cache lines on ACPI C-state transitions Khalid Ali
2025-05-26 12:00 ` Peter Zijlstra [this message]
2025-05-26 13:45 ` Khalid Ali
2025-05-26 16:07 ` Peter Zijlstra
2025-05-26 17:04 ` Khalid Ali
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=20250526120029.GR39944@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=khaliidcaliy@gmail.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rafael@kernel.org \
--cc=tglx@linutronix.de \
--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 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.