lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250526120029.GR39944@noisy.programming.kicks-ass.net>
Date: Mon, 26 May 2025 14:00:29 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Khalid Ali <khaliidcaliy@...il.com>
Cc: rafael@...nel.org, tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
	dave.hansen@...ux.intel.com, lenb@...nel.org, hpa@...or.com,
	x86@...nel.org, linux-acpi@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86/ACPI: invalidate all cache lines on ACPI C-state
 transitions

On Sun, May 25, 2025 at 06:00:42PM +0000, Khalid Ali wrote:
> From: Khalid Ali <khaliidcaliy@...il.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@...il.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
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ