From: Khalid Ali <khaliidcaliy@gmail.com>
To: rafael@kernel.org, tglx@linutronix.de, mingo@redhat.com,
bp@alien8.de, dave.hansen@linux.intel.com
Cc: lenb@kernel.org, hpa@zytor.com, x86@kernel.org,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
Khalid Ali <khaliidcaliy@gmail.com>
Subject: [RESEND PATCH] x86/ACPI: invalidate all cache lines on ACPI C-state transitions
Date: Sun, 25 May 2025 18:10:24 +0000 [thread overview]
Message-ID: <20250525181025.1071-1-khaliidcaliy@gmail.com> (raw)
From: Khalid Ali <khaliidcaliy@gmail.com>
According to ACPI spec 6.4 and 6.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();
mwait_idle_with_hints(percpu_entry->states[cx->index].eax,
percpu_entry->states[cx->index].ecx);
}
--
2.49.0
next reply other threads:[~2025-05-25 18:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-25 18:10 Khalid Ali [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-05-30 17:54 [RESEND PATCH] x86/ACPI: invalidate all cache lines on ACPI C-state transitions Khalid Ali
2025-06-04 9:23 ` Rafael J. Wysocki
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=20250525181025.1071-1-khaliidcaliy@gmail.com \
--to=khaliidcaliy@gmail.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.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 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).