From a7be1a4bedbe1cc596934d0c7db09a2e895d6f10 Mon Sep 17 00:00:00 2001 From: Michal Suchanek Date: May 09 2023 08:22:35 +0000 Subject: cpuidle: powerpc: cpuidle set polling before enabling irqs (PED-3947 bsc#1210544 ltc#202303). - Refresh patches.suse/cpuidle-powernv-Fix-promotion-from-snooze-if-next-st.patch --- diff --git a/patches.suse/cpuidle-powernv-Fix-promotion-from-snooze-if-next-st.patch b/patches.suse/cpuidle-powernv-Fix-promotion-from-snooze-if-next-st.patch index c25bdc9..38ce05f 100644 --- a/patches.suse/cpuidle-powernv-Fix-promotion-from-snooze-if-next-st.patch +++ b/patches.suse/cpuidle-powernv-Fix-promotion-from-snooze-if-next-st.patch @@ -119,8 +119,8 @@ Acked-by: Giovanni Gherdovich struct cpuidle_driver *drv, int index) @@ -54,7 +76,7 @@ static int snooze_loop(struct cpuidle_de + local_irq_enable(); - set_thread_flag(TIF_POLLING_NRFLAG); - snooze_exit_time = get_tb() + snooze_timeout; + snooze_exit_time = get_tb() + get_snooze_timeout(dev, drv, index); diff --git a/patches.suse/cpuidle-powerpc-cpuidle-set-polling-before-enabling-.patch b/patches.suse/cpuidle-powerpc-cpuidle-set-polling-before-enabling-.patch new file mode 100644 index 0000000..5af7736 --- /dev/null +++ b/patches.suse/cpuidle-powerpc-cpuidle-set-polling-before-enabling-.patch @@ -0,0 +1,68 @@ +From 3fc5ee927ff4ffed6aa2fcd44d2fbf07ac893cdc Mon Sep 17 00:00:00 2001 +From: Nicholas Piggin +Date: Wed, 14 Jun 2017 23:02:39 +1000 +Subject: [PATCH] cpuidle: powerpc: cpuidle set polling before enabling irqs + +References: PED-3947 bsc#1210544 ltc#202303 +Patch-mainline: v4.13-rc1 +Git-commit: 3fc5ee927ff4ffed6aa2fcd44d2fbf07ac893cdc + +local_irq_enable can cause interrupts to be taken which could +take significant amount of processing time. The idle process +should set its polling flag before this, so another process that +wakes it during this time will not have to send an IPI. + +Expand the TIF_POLLING_NRFLAG coverage to as large as possible. + +Reviewed-by: Gautham R. Shenoy +Signed-off-by: Nicholas Piggin +Signed-off-by: Michael Ellerman +Acked-by: Michal Suchanek +--- + drivers/cpuidle/cpuidle-powernv.c | 4 +++- + drivers/cpuidle/cpuidle-pseries.c | 3 ++- + 2 files changed, 5 insertions(+), 2 deletions(-) + +diff --git a/drivers/cpuidle/cpuidle-powernv.c b/drivers/cpuidle/cpuidle-powernv.c +index 79152676f62b..50b3c2e0306f 100644 +--- a/drivers/cpuidle/cpuidle-powernv.c ++++ b/drivers/cpuidle/cpuidle-powernv.c +@@ -51,9 +51,10 @@ static int snooze_loop(struct cpuidle_device *dev, + { + u64 snooze_exit_time; + +- local_irq_enable(); + set_thread_flag(TIF_POLLING_NRFLAG); + ++ local_irq_enable(); ++ + snooze_exit_time = get_tb() + snooze_timeout; + ppc64_runlatch_off(); + HMT_very_low(); +@@ -66,6 +67,7 @@ static int snooze_loop(struct cpuidle_device *dev, + ppc64_runlatch_on(); + clear_thread_flag(TIF_POLLING_NRFLAG); + smp_mb(); ++ + return index; + } + +diff --git a/drivers/cpuidle/cpuidle-pseries.c b/drivers/cpuidle/cpuidle-pseries.c +index 166ccd711ec9..7b12bb2ea70f 100644 +--- a/drivers/cpuidle/cpuidle-pseries.c ++++ b/drivers/cpuidle/cpuidle-pseries.c +@@ -62,9 +62,10 @@ static int snooze_loop(struct cpuidle_device *dev, + unsigned long in_purr; + u64 snooze_exit_time; + ++ set_thread_flag(TIF_POLLING_NRFLAG); ++ + idle_loop_prolog(&in_purr); + local_irq_enable(); +- set_thread_flag(TIF_POLLING_NRFLAG); + snooze_exit_time = get_tb() + snooze_timeout; + + while (!need_resched()) { +-- +2.40.0 + diff --git a/series.conf b/series.conf index db6d05b..9bf7813 100644 --- a/series.conf +++ b/series.conf @@ -3848,6 +3848,7 @@ patches.suse/powerpc-fadump-avoid-holes-in-boot-memory-area-when-fadump-is-registered.patch patches.suse/powerpc-fadump-provide-a-helpful-error-message.patch patches.suse/powerpc-fadump-add-reschedule-point-while-releasing-memory.patch + patches.suse/cpuidle-powerpc-cpuidle-set-polling-before-enabling-.patch patches.suse/powerpc-powernv-idle-Clear-r12-on-wakeup-from-stop-lite.patch patches.suse/0001-spin-loop-primitives-for-busy-waiting.patch patches.suse/0001-powerpc-use-spin-loop-primitives-in-some-functions.patch