--- /dev/null
+From dfbba2518aac4204203b0697a894d3b2f80134d3 Mon Sep 17 00:00:00 2001
+From: Akihiko Odaki <akihiko.odaki@gmail.com>
+Date: Sun, 3 Apr 2022 15:23:22 +0900
+Subject: Revert "ACPI: processor: idle: Only flush cache on entering C3"
+
+From: Akihiko Odaki <akihiko.odaki@gmail.com>
+
+commit dfbba2518aac4204203b0697a894d3b2f80134d3 upstream.
+
+Revert commit 87ebbb8c612b ("ACPI: processor: idle: Only flush cache
+on entering C3") that broke the assumptions of the acpi_idle_play_dead()
+callers.
+
+Namely, the CPU cache must always be flushed in acpi_idle_play_dead(),
+regardless of the target C-state that is going to be requested, because
+this is likely to be part of a CPU offline procedure or preparation for
+entering a system-wide sleep state and the lack of synchronization
+between the CPU cache and RAM may lead to problems going forward, for
+example when the CPU is brought back online.
+
+In particular, it breaks resume from suspend-to-RAM on Lenovo ThinkPad
+C13 which fails occasionally until the problematic commit is reverted.
+
+Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
+[ rjw: Changelog ]
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Cc: Ketsui <esgwpl@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/acpi/processor_idle.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+--- a/drivers/acpi/processor_idle.c
++++ b/drivers/acpi/processor_idle.c
+@@ -570,8 +570,7 @@ static int acpi_idle_play_dead(struct cp
+ {
+ struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu);
+
+- if (cx->type == ACPI_STATE_C3)
+- ACPI_FLUSH_CPU_CACHE();
++ ACPI_FLUSH_CPU_CACHE();
+
+ while (1) {
+
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
- fs/file_table.c | 1 +
- include/trace/events/sunrpc.h | 1 -
- net/sunrpc/xprt.c | 7 +------
- net/sunrpc/xprtsock.c | 16 +++++++++++++---
+ fs/file_table.c | 1 +
+ include/trace/events/sunrpc.h | 1 -
+ net/sunrpc/xprt.c | 7 +------
+ net/sunrpc/xprtsock.c | 16 +++++++++++++---
4 files changed, 15 insertions(+), 10 deletions(-)
-diff --git a/fs/file_table.c b/fs/file_table.c
-index 7d2e692b66a9..ada8fe814db9 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -412,6 +412,7 @@ void __fput_sync(struct file *file)
void __init files_init(void)
{
-diff --git a/include/trace/events/sunrpc.h b/include/trace/events/sunrpc.h
-index ac33892da411..a4848c7bab80 100644
--- a/include/trace/events/sunrpc.h
+++ b/include/trace/events/sunrpc.h
-@@ -1004,7 +1004,6 @@ DEFINE_RPC_XPRT_LIFETIME_EVENT(connect);
+@@ -1005,7 +1005,6 @@ DEFINE_RPC_XPRT_LIFETIME_EVENT(connect);
DEFINE_RPC_XPRT_LIFETIME_EVENT(disconnect_auto);
DEFINE_RPC_XPRT_LIFETIME_EVENT(disconnect_done);
DEFINE_RPC_XPRT_LIFETIME_EVENT(disconnect_force);
DEFINE_RPC_XPRT_LIFETIME_EVENT(destroy);
DECLARE_EVENT_CLASS(rpc_xprt_event,
-diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
-index 73344ffb2692..ad62eba540a4 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
-@@ -930,12 +930,7 @@ void xprt_connect(struct rpc_task *task)
+@@ -929,12 +929,7 @@ void xprt_connect(struct rpc_task *task)
if (!xprt_lock_write(xprt, task))
return;
task->tk_rqstp->rq_connect_cookie = xprt->connect_cookie;
rpc_sleep_on_timeout(&xprt->pending, task, NULL,
xprt_request_timeout(task->tk_rqstp));
-diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
-index 9b75891b3cc0..c6a13893e308 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
-@@ -879,7 +879,7 @@ static int xs_local_send_request(struct rpc_rqst *req)
+@@ -880,7 +880,7 @@ static int xs_local_send_request(struct
/* Close the stream if the previous transmission was incomplete */
if (xs_send_request_was_aborted(transport, req)) {
return -ENOTCONN;
}
-@@ -915,7 +915,7 @@ static int xs_local_send_request(struct rpc_rqst *req)
+@@ -918,7 +918,7 @@ static int xs_local_send_request(struct
-status);
fallthrough;
case -EPIPE:
status = -ENOTCONN;
}
-@@ -1185,6 +1185,16 @@ static void xs_reset_transport(struct sock_xprt *transport)
+@@ -1203,6 +1203,16 @@ static void xs_reset_transport(struct so
if (sk == NULL)
return;
if (atomic_read(&transport->xprt.swapper))
sk_clear_memalloc(sk);
-@@ -1208,7 +1218,7 @@ static void xs_reset_transport(struct sock_xprt *transport)
+@@ -1226,7 +1236,7 @@ static void xs_reset_transport(struct so
mutex_unlock(&transport->recv_mutex);
trace_rpc_socket_close(xprt, sock);
xprt_disconnect_done(xprt);
}
---
-2.35.1
-