From: K Prateek Nayak <kprateek.nayak@amd.com> To: <linux-kernel@vger.kernel.org> Cc: "Gautham R. Shenoy" <gautham.shenoy@amd.com>, K Prateek Nayak <kprateek.nayak@amd.com>, Russell King <linux@armlinux.org.uk>, "Rafael J. Wysocki" <rafael@kernel.org>, Daniel Lezcano <daniel.lezcano@linaro.org>, Ingo Molnar <mingo@redhat.com>, Peter Zijlstra <peterz@infradead.org>, "Juri Lelli" <juri.lelli@redhat.com>, Vincent Guittot <vincent.guittot@linaro.org>, Dietmar Eggemann <dietmar.eggemann@arm.com>, Steven Rostedt <rostedt@goodmis.org>, Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>, Daniel Bristot de Oliveira <bristot@redhat.com>, "Valentin Schneider" <vschneid@redhat.com>, Linus Walleij <linus.walleij@linaro.org>, Ard Biesheuvel <ardb@kernel.org>, <linux-arm-kernel@lists.infradead.org>, <linux-pm@vger.kernel.org> Subject: [RFC PATCH 05/14] arm/thread_info: Introduce TIF_NOTIFY_IPI flag Date: Tue, 20 Feb 2024 22:44:48 +0530 [thread overview] Message-ID: <20240220171457.703-6-kprateek.nayak@amd.com> (raw) In-Reply-To: <20240220171457.703-1-kprateek.nayak@amd.com> Add support for TIF_NOTIFY_IPI on ARM. With TIF_NOTIFY_IPI, a sender sending an IPI to an idle CPU in TIF_POLLING mode will set the TIF_NOTIFY_IPI flag in the target's idle tasks's thread_info to pull the CPU out of idle, as opposed to setting TIF_NEED_RESCHED previously. This avoids spurious calls to schedule_idle() in cases where an IPI does not necessarily wake up a task on the idle CPU. IPI throughput measured using a modified version of Anton Blanchard's ipistorm benchmark [1], configured to measure time taken to perform a fixed number of smp_call_function_single() (with wait set to 1), improves significantly with TIF_NOTIFY_IPI on a dual socket Ampere Server (2 x 64C) with the benchmark time reducing to less than half for 100000 IPIs between two CPUs. (Note: Only WFI idle mode was left enabled during testing to reduce variance) cmdline: insmod ipistorm.ko numipi=100000 single=1 offset=8 cpulist=8 wait=1 ================================================================== Test : ipistorm (modified) Units : Normalized runtime Interpretation: Lower is better Statistic : AMean ================================================================== kernel: time [pct imp] tip:sched/core 1.00 [0.00] tip:sched/core + TIF_NOTIFY_IPI 0.41 [59.29] tip:sched/core was at tag "sched-core-2024-01-08" at the time of testing. Cc: Russell King <linux@armlinux.org.uk> Cc: "Rafael J. Wysocki" <rafael@kernel.org> Cc: Daniel Lezcano <daniel.lezcano@linaro.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Juri Lelli <juri.lelli@redhat.com> Cc: Vincent Guittot <vincent.guittot@linaro.org> Cc: Dietmar Eggemann <dietmar.eggemann@arm.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Ben Segall <bsegall@google.com> Cc: Mel Gorman <mgorman@suse.de> Cc: Daniel Bristot de Oliveira <bristot@redhat.com> Cc: Valentin Schneider <vschneid@redhat.com> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Ard Biesheuvel <ardb@kernel.org> Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: linux-pm@vger.kernel.org Link: https://github.com/antonblanchard/ipistorm [1] Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com> --- arch/arm/include/asm/thread_info.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h index 943ffcf069d2..324248d87c9e 100644 --- a/arch/arm/include/asm/thread_info.h +++ b/arch/arm/include/asm/thread_info.h @@ -136,6 +136,7 @@ extern int vfp_restore_user_hwstate(struct user_vfp *, * thread information flags: * TIF_USEDFPU - FPU was used by this task this quantum (SMP) * TIF_POLLING_NRFLAG - true if poll_idle() is polling TIF_NEED_RESCHED + * or TIF_NOTIFY_IPI * * Any bit in the range of 0..15 will cause do_work_pending() to be invoked. */ @@ -144,6 +145,7 @@ extern int vfp_restore_user_hwstate(struct user_vfp *, #define TIF_NOTIFY_RESUME 2 /* callback before returning to user */ #define TIF_UPROBE 3 /* breakpointed or singlestepping */ #define TIF_NOTIFY_SIGNAL 4 /* signal notifications exist */ +#define TIF_NOTIFY_IPI 5 /* pending IPI on TIF_POLLLING idle CPU */ #define TIF_USING_IWMMXT 17 #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ @@ -164,6 +166,7 @@ extern int vfp_restore_user_hwstate(struct user_vfp *, #define _TIF_SECCOMP (1 << TIF_SECCOMP) #define _TIF_NOTIFY_SIGNAL (1 << TIF_NOTIFY_SIGNAL) #define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT) +#define _TIF_NOTIFY_IPI (1 << TIF_NOTIFY_IPI) /* Checks for any syscall work in entry-common.S */ #define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \ -- 2.34.1
WARNING: multiple messages have this Message-ID (diff)
From: K Prateek Nayak <kprateek.nayak@amd.com> To: <linux-kernel@vger.kernel.org> Cc: "Gautham R. Shenoy" <gautham.shenoy@amd.com>, K Prateek Nayak <kprateek.nayak@amd.com>, Russell King <linux@armlinux.org.uk>, "Rafael J. Wysocki" <rafael@kernel.org>, Daniel Lezcano <daniel.lezcano@linaro.org>, Ingo Molnar <mingo@redhat.com>, Peter Zijlstra <peterz@infradead.org>, "Juri Lelli" <juri.lelli@redhat.com>, Vincent Guittot <vincent.guittot@linaro.org>, Dietmar Eggemann <dietmar.eggemann@arm.com>, Steven Rostedt <rostedt@goodmis.org>, Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>, Daniel Bristot de Oliveira <bristot@redhat.com>, "Valentin Schneider" <vschneid@redhat.com>, Linus Walleij <linus.walleij@linaro.org>, Ard Biesheuvel <ardb@kernel.org>, <linux-arm-kernel@lists.infradead.org>, <linux-pm@vger.kernel.org> Subject: [RFC PATCH 05/14] arm/thread_info: Introduce TIF_NOTIFY_IPI flag Date: Tue, 20 Feb 2024 22:44:48 +0530 [thread overview] Message-ID: <20240220171457.703-6-kprateek.nayak@amd.com> (raw) In-Reply-To: <20240220171457.703-1-kprateek.nayak@amd.com> Add support for TIF_NOTIFY_IPI on ARM. With TIF_NOTIFY_IPI, a sender sending an IPI to an idle CPU in TIF_POLLING mode will set the TIF_NOTIFY_IPI flag in the target's idle tasks's thread_info to pull the CPU out of idle, as opposed to setting TIF_NEED_RESCHED previously. This avoids spurious calls to schedule_idle() in cases where an IPI does not necessarily wake up a task on the idle CPU. IPI throughput measured using a modified version of Anton Blanchard's ipistorm benchmark [1], configured to measure time taken to perform a fixed number of smp_call_function_single() (with wait set to 1), improves significantly with TIF_NOTIFY_IPI on a dual socket Ampere Server (2 x 64C) with the benchmark time reducing to less than half for 100000 IPIs between two CPUs. (Note: Only WFI idle mode was left enabled during testing to reduce variance) cmdline: insmod ipistorm.ko numipi=100000 single=1 offset=8 cpulist=8 wait=1 ================================================================== Test : ipistorm (modified) Units : Normalized runtime Interpretation: Lower is better Statistic : AMean ================================================================== kernel: time [pct imp] tip:sched/core 1.00 [0.00] tip:sched/core + TIF_NOTIFY_IPI 0.41 [59.29] tip:sched/core was at tag "sched-core-2024-01-08" at the time of testing. Cc: Russell King <linux@armlinux.org.uk> Cc: "Rafael J. Wysocki" <rafael@kernel.org> Cc: Daniel Lezcano <daniel.lezcano@linaro.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Juri Lelli <juri.lelli@redhat.com> Cc: Vincent Guittot <vincent.guittot@linaro.org> Cc: Dietmar Eggemann <dietmar.eggemann@arm.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Ben Segall <bsegall@google.com> Cc: Mel Gorman <mgorman@suse.de> Cc: Daniel Bristot de Oliveira <bristot@redhat.com> Cc: Valentin Schneider <vschneid@redhat.com> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Ard Biesheuvel <ardb@kernel.org> Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: linux-pm@vger.kernel.org Link: https://github.com/antonblanchard/ipistorm [1] Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com> --- arch/arm/include/asm/thread_info.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h index 943ffcf069d2..324248d87c9e 100644 --- a/arch/arm/include/asm/thread_info.h +++ b/arch/arm/include/asm/thread_info.h @@ -136,6 +136,7 @@ extern int vfp_restore_user_hwstate(struct user_vfp *, * thread information flags: * TIF_USEDFPU - FPU was used by this task this quantum (SMP) * TIF_POLLING_NRFLAG - true if poll_idle() is polling TIF_NEED_RESCHED + * or TIF_NOTIFY_IPI * * Any bit in the range of 0..15 will cause do_work_pending() to be invoked. */ @@ -144,6 +145,7 @@ extern int vfp_restore_user_hwstate(struct user_vfp *, #define TIF_NOTIFY_RESUME 2 /* callback before returning to user */ #define TIF_UPROBE 3 /* breakpointed or singlestepping */ #define TIF_NOTIFY_SIGNAL 4 /* signal notifications exist */ +#define TIF_NOTIFY_IPI 5 /* pending IPI on TIF_POLLLING idle CPU */ #define TIF_USING_IWMMXT 17 #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ @@ -164,6 +166,7 @@ extern int vfp_restore_user_hwstate(struct user_vfp *, #define _TIF_SECCOMP (1 << TIF_SECCOMP) #define _TIF_NOTIFY_SIGNAL (1 << TIF_NOTIFY_SIGNAL) #define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT) +#define _TIF_NOTIFY_IPI (1 << TIF_NOTIFY_IPI) /* Checks for any syscall work in entry-common.S */ #define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \ -- 2.34.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2024-02-20 17:18 UTC|newest] Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-02-20 17:14 [RFC PATCH 00/14] Introducing TIF_NOTIFY_IPI flag K Prateek Nayak 2024-02-20 17:14 ` K Prateek Nayak 2024-02-20 17:14 ` [RFC PATCH 01/14] thread_info: Add helpers to test and clear TIF_NOTIFY_IPI K Prateek Nayak 2024-02-20 17:14 ` K Prateek Nayak 2024-02-20 17:14 ` [RFC PATCH 02/14] sched: Define a need_resched_or_ipi() helper and use it treewide K Prateek Nayak 2024-02-20 17:14 ` K Prateek Nayak 2024-02-20 17:14 ` [RFC PATCH 03/14] sched/core: Use TIF_NOTIFY_IPI to notify an idle CPU in TIF_POLLING mode of pending IPI K Prateek Nayak 2024-02-20 17:14 ` K Prateek Nayak 2024-02-20 17:14 ` [RFC PATCH 04/14] x86/thread_info: Introduce TIF_NOTIFY_IPI flag K Prateek Nayak 2024-02-20 17:14 ` K Prateek Nayak [this message] 2024-02-20 17:14 ` [RFC PATCH 05/14] arm/thread_info: " K Prateek Nayak 2024-02-20 17:14 ` [RFC PATCH 06/14] alpha/thread_info: " K Prateek Nayak 2024-02-20 17:14 ` [RFC PATCH 07/14] openrisc/thread_info: " K Prateek Nayak 2024-02-20 17:14 ` [RFC PATCH 08/14] powerpc/thread_info: " K Prateek Nayak 2024-02-20 17:14 ` K Prateek Nayak 2024-02-20 17:14 ` [RFC PATCH 09/14] sh/thread_info: " K Prateek Nayak 2024-02-20 17:14 ` [RFC PATCH 10/14] sparc/thread_info: " K Prateek Nayak 2024-02-20 17:14 ` [RFC PATCH 11/14] csky/thread_info: " K Prateek Nayak 2024-02-23 4:37 ` Guo Ren 2024-02-20 17:14 ` [RFC PATCH 12/14] parisc/thread_info: " K Prateek Nayak 2024-02-20 17:14 ` [RFC PATCH 13/14] nios2/thread_info: " K Prateek Nayak 2024-02-20 17:14 ` [RFC PATCH 14/14] microblaze/thread_info: " K Prateek Nayak 2024-03-06 9:44 ` [RFC PATCH 00/14] Introducing " Linus Walleij 2024-03-06 9:44 ` Linus Walleij 2024-03-06 10:04 ` K Prateek Nayak 2024-03-06 10:04 ` K Prateek Nayak 2024-03-06 9:59 ` Vincent Guittot 2024-03-06 9:59 ` Vincent Guittot 2024-03-06 10:18 ` K Prateek Nayak 2024-03-06 10:18 ` K Prateek Nayak 2024-03-06 10:28 ` Vincent Guittot 2024-03-06 10:28 ` Vincent Guittot 2024-03-07 19:56 ` Julia Lawall 2024-03-15 6:31 ` K Prateek Nayak
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=20240220171457.703-6-kprateek.nayak@amd.com \ --to=kprateek.nayak@amd.com \ --cc=ardb@kernel.org \ --cc=bristot@redhat.com \ --cc=bsegall@google.com \ --cc=daniel.lezcano@linaro.org \ --cc=dietmar.eggemann@arm.com \ --cc=gautham.shenoy@amd.com \ --cc=juri.lelli@redhat.com \ --cc=linus.walleij@linaro.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-pm@vger.kernel.org \ --cc=linux@armlinux.org.uk \ --cc=mgorman@suse.de \ --cc=mingo@redhat.com \ --cc=peterz@infradead.org \ --cc=rafael@kernel.org \ --cc=rostedt@goodmis.org \ --cc=vincent.guittot@linaro.org \ --cc=vschneid@redhat.com \ /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: linkBe 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.