Re: [PATCH v2 4/4] x86/paravirt: remove no longer needed paravirt patching code

2023-10-16 Thread Peter Zijlstra
-- > arch/x86/tools/relocs.c | 2 +- > 7 files changed, 3 insertions(+), 178 deletions(-) More - more better! :-) Acked-by: Peter Zijlstra (Intel) ___ Virtualization mailing list Virtualization@lists.linux-foundation.org ht

Re: [PATCH v2 3/4] x86/paravirt: switch mixed paravirt/alternative calls to alternative_2

2023-10-16 Thread Peter Zijlstra
tches, one introducing ALT_NOT_XEN and then a second with the rest. Regardless, Acked-by: Peter Zijlstra (Intel) ___ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Re: [RFC PATCH 3/3] x86/paravirt: switch mixed paravirt/alternative calls to alternative_2

2023-09-20 Thread Peter Zijlstra
On Thu, Jun 08, 2023 at 04:03:33PM +0200, Juergen Gross wrote: > Instead of stacking alternative and paravirt patching, use the new > ALT_FLAG_CALL flag to switch those mixed calls to pure alternative > handling. > > This eliminates the need to be careful regarding the sequence of > alternative an

Re: [RFC PATCH 1/3] x86/paravirt: move some functions and defines to alternative

2023-09-20 Thread Peter Zijlstra
On Thu, Jun 08, 2023 at 04:03:31PM +0200, Juergen Gross wrote: > As a preparation for replacing paravirt patching completely by > alternative patching, move some backend functions and #defines to > alternative code and header. > > Signed-off-by: Juergen Gross Acked-by: Peter

Re: [PATCH v2 03/47] mm: shrinker: add infrastructure for dynamically allocating shrinker

2023-07-24 Thread Peter Zijlstra
On Mon, Jul 24, 2023 at 05:43:10PM +0800, Qi Zheng wrote: > +void shrinker_unregister(struct shrinker *shrinker) > +{ > + struct dentry *debugfs_entry; > + int debugfs_id; > + > + if (!shrinker || !(shrinker->flags & SHRINKER_REGISTERED)) > + return; > + > + down_write(

Re: [PATCH] x86/paravirt: convert simple paravirt functions to asm

2023-03-16 Thread Peter Zijlstra
On Wed, Mar 08, 2023 at 04:42:10PM +0100, Juergen Gross wrote: > +DEFINE_PARAVIRT_ASM(pv_native_irq_disable, "cli", .text); > +DEFINE_PARAVIRT_ASM(pv_native_irq_enable, "sti", .text); > +DEFINE_PARAVIRT_ASM(pv_native_read_cr2, "mov %cr2, %rax", .text); per these v, the above ^ should be in .noins

Re: [PATCH 0/2] vhost: improve livepatch switching for heavily loaded vhost worker kthreads

2023-01-31 Thread Peter Zijlstra
On Mon, Jan 30, 2023 at 11:59:30AM -0800, Josh Poimboeuf wrote: > @@ -8662,16 +8665,19 @@ void sched_dynamic_update(int mode) > > switch (mode) { > case preempt_dynamic_none: > - preempt_dynamic_enable(cond_resched); > + if (!klp_override) > +

[PATCH v2.1 4/9] tracing, preempt: Squash _rcuidle tracing

2023-01-31 Thread Peter Zijlstra
Extend commit 9aedeaed6fc6 ("tracing, hardirq: No moar _rcuidle() tracing") to also cover trace_preempt_{on,off}() which were mysteriously untouched. Fixes: 9aedeaed6fc6 ("tracing, hardirq: No moar _rcuidle() tracing") Reported-by: Mark Rutland Signed-off-by: Peter Zijlstr

Re: [PATCH 0/2] vhost: improve livepatch switching for heavily loaded vhost worker kthreads

2023-01-30 Thread Peter Zijlstra
On Fri, Jan 27, 2023 at 02:11:31PM -0800, Josh Poimboeuf wrote: > diff --git a/include/linux/sched.h b/include/linux/sched.h > index 4df2b3e76b30..fbcd3acca25c 100644 > --- a/include/linux/sched.h > +++ b/include/linux/sched.h > @@ -36,6 +36,7 @@ > #include > #include > #include > +#include

Re: [PATCH 0/2] vhost: improve livepatch switching for heavily loaded vhost worker kthreads

2023-01-27 Thread Peter Zijlstra
On Thu, Jan 26, 2023 at 08:43:55PM -0800, Josh Poimboeuf wrote: > On Thu, Jan 26, 2023 at 03:12:35PM -0600, Seth Forshee (DigitalOcean) wrote: > > On Thu, Jan 26, 2023 at 06:03:16PM +0100, Petr Mladek wrote: > > > On Fri 2023-01-20 16:12:20, Seth Forshee (DigitalOcean) wrote: > > > > We've fairly r

[PATCH v2 7/9] x86: Mark sched_clock() noinstr

2023-01-26 Thread Peter Zijlstra
In order to use sched_clock() from noinstr code, mark it and all it's implenentations noinstr. The whole pvclock thing (used by KVM/Xen) is a bit of a pain, since it calls out to watchdogs, create a pvclock_clocksource_read_nowd() variant doesn't do that and can be noinstr. Signed-off

[PATCH v2 4/9] tracing, preempt: Squash _rcuidle tracing

2023-01-26 Thread Peter Zijlstra
Extend commit 9aedeaed6fc6 ("tracing, hardirq: No moar _rcuidle() tracing") to also cover trace_preempt_{on,off}() which were mysteriously untouched. Fixes: 9aedeaed6fc6 ("tracing, hardirq: No moar _rcuidle() tracing") Reported-by: Mark Rutland Signed-off-by: Peter Zijlstr

[PATCH v2 9/9] cpuidle: Fix poll_idle() noinstr annotation

2023-01-26 Thread Peter Zijlstra
otate poll_idle()") Signed-off-by: Peter Zijlstra (Intel) Reported-by: kernel test robot Acked-by: Rafael J. Wysocki Link: https://lore.kernel.org/oe-lkp/202301192148.58ece903-oliver.s...@intel.com --- drivers/cpuidle/cpuidle.c|2 +- drivers/cpuidle/poll_state.c |2 -- 2 files

[PATCH v2 6/9] x86/pvclock: improve atomic update of last_value in pvclock_clocksource_read

2023-01-26 Thread Peter Zijlstra
_value" - exactly what atomic64_try_cmpxchg does in a correct and more optimal way. Signed-off-by: Uros Bizjak Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20230118202330.3740-1-ubiz...@gmail.com --- arch/x86/kernel/pvclock.c | 5 ++--- 1 file changed, 2 insertion

[PATCH v2 8/9] sched/clock: Make local_clock() noinstr

2023-01-26 Thread Peter Zijlstra
With sched_clock() noinstr, provide a noinstr implementation of local_clock(). Signed-off-by: Peter Zijlstra (Intel) --- include/linux/sched/clock.h |8 +++- kernel/sched/clock.c| 27 +-- 2 files changed, 24 insertions(+), 11 deletions(-) --- a/include

[PATCH v2 3/9] tracing: Warn about !rcu_is_watching()

2023-01-26 Thread Peter Zijlstra
When using noinstr, WARN when tracing hits when RCU is disabled. Suggested-by: Steven Rostedt (Google) Signed-off-by: Peter Zijlstra (Intel) --- include/linux/trace_recursion.h | 18 ++ 1 file changed, 18 insertions(+) --- a/include/linux/trace_recursion.h +++ b/include

[PATCH v2 0/9] A few more cpuidle vs rcu fixes

2023-01-26 Thread Peter Zijlstra
0-day robot reported graph-tracing made the cpuidle-vs-rcu rework go splat. These patches appear to cure this, the ftrace selftest now runs to completion without spamming scary messages to dmesg. Since v1: - fixed recursive RCU splats - fixed psci thingies for arm (null) - improved the tracin

[PATCH v2 2/9] bug: Disable rcu_is_watching() during WARN/BUG

2023-01-26 Thread Peter Zijlstra
.. Signed-off-by: Peter Zijlstra (Intel) --- include/linux/context_tracking.h | 27 +++ kernel/locking/lockdep.c |3 +++ kernel/panic.c |5 + lib/bug.c| 15 ++- 4 files changed, 49 insertions

[PATCH v2 5/9] x86: Always inline arch_atomic64

2023-01-26 Thread Peter Zijlstra
As already done for regular arch_atomic, always inline arch_atomic64. Signed-off-by: Peter Zijlstra (Intel) --- arch/x86/include/asm/atomic64_32.h | 44 ++--- arch/x86/include/asm/atomic64_64.h | 36 +++--- 2 files changed, 40

[PATCH v2 1/9] drivers: firmware: psci: Dont instrument suspend code

2023-01-26 Thread Peter Zijlstra
__pa_symbol_nodebug() within psci_suspend_finisher(). The raw SMCCC invocation functions are written in assembly, and are not subject to compiler instrumentation. Signed-off-by: Mark Rutland Signed-off-by: Peter Zijlstra (Intel) --- drivers/firmware/psci/psci.c | 31 +++ 1 file

Re: [PATCH 3/6] ftrace/x86: Warn and ignore graph tracing when RCU is disabled

2023-01-26 Thread Peter Zijlstra
day). I managed to tickle the recursion so that it was a test-case for the stack guard... With this on, it prints just the one WARN and lives. --- Subject: bug: Disable rcu_is_watching() during WARN/BUG From: Peter Zijlstra Date: Wed Jan 25 13:57:49 CET 2023 In order to avoid WARN/BUG from gener

Re: [PATCH 3/6] ftrace/x86: Warn and ignore graph tracing when RCU is disabled

2023-01-25 Thread Peter Zijlstra
On Tue, Jan 24, 2023 at 05:12:14PM +, Mark Rutland wrote: > On Tue, Jan 24, 2023 at 03:44:35PM +0100, Peter Zijlstra wrote: > > On Mon, Jan 23, 2023 at 05:07:53PM -0500, Steven Rostedt wrote: > > > > > Actually, perhaps we can just add this, and all you need to do

Re: [PATCH 0/6] A few cpuidle vs rcu fixes

2023-01-25 Thread Peter Zijlstra
On Wed, Jan 25, 2023 at 10:35:16AM +0100, Peter Zijlstra wrote: > tip/sched/core contains the following patch addressing this: > > --- > commit 9aedeaed6fc6fe8452b9b8225e95cc2b8631ff91 > Author: Peter Zijlstra > Date: Thu Jan 12 20:43:49 2023 +0100 > > tracing, h

Re: [PATCH 3/6] ftrace/x86: Warn and ignore graph tracing when RCU is disabled

2023-01-25 Thread Peter Zijlstra
On Tue, Jan 24, 2023 at 05:12:14PM +, Mark Rutland wrote: > On Tue, Jan 24, 2023 at 03:44:35PM +0100, Peter Zijlstra wrote: > > On Mon, Jan 23, 2023 at 05:07:53PM -0500, Steven Rostedt wrote: > > > > > Actually, perhaps we can just add this, and all you need to do

Re: [PATCH 0/6] A few cpuidle vs rcu fixes

2023-01-25 Thread Peter Zijlstra
On Tue, Jan 24, 2023 at 06:39:12PM +, Mark Rutland wrote: > On Tue, Jan 24, 2023 at 05:30:29PM +, Mark Rutland wrote: > > On Tue, Jan 24, 2023 at 04:34:23PM +, Mark Rutland wrote: > > > Hi Peter, > > > > > > On Mon, Jan 23, 2023 at 09:50:09PM +0100,

Re: [PATCH 0/6] A few cpuidle vs rcu fixes

2023-01-25 Thread Peter Zijlstra
On Tue, Jan 24, 2023 at 04:34:23PM +, Mark Rutland wrote: > Hi Peter, > > On Mon, Jan 23, 2023 at 09:50:09PM +0100, Peter Zijlstra wrote: > > 0-day robot reported graph-tracing made the cpuidle-vs-rcu rework go splat. > > Do you have a link toe the splat somewhere? &

Re: [PATCH v2 1/6] mm: introduce vma->vm_flags modifier functions

2023-01-25 Thread Peter Zijlstra
On Wed, Jan 25, 2023 at 12:38:46AM -0800, Suren Baghdasaryan wrote: > diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h > index 2d6d790d9bed..6c7c70bf50dd 100644 > --- a/include/linux/mm_types.h > +++ b/include/linux/mm_types.h > @@ -491,7 +491,13 @@ struct vm_area_struct { >

Re: [PATCH 3/6] ftrace/x86: Warn and ignore graph tracing when RCU is disabled

2023-01-24 Thread Peter Zijlstra
On Mon, Jan 23, 2023 at 05:07:53PM -0500, Steven Rostedt wrote: > Actually, perhaps we can just add this, and all you need to do is create > and set CONFIG_NO_RCU_TRACING (or some other name). Elsewhere I've used CONFIG_ARCH_WANTS_NO_INSTR for this. Anyway, I took it for a spin and it doesn

[PATCH 6/6] cpuidle: Fix poll_idle() noinstr annotation

2023-01-23 Thread Peter Zijlstra
otate poll_idle()") Signed-off-by: Peter Zijlstra (Intel) Reported-by: kernel test robot Link: https://lore.kernel.org/oe-lkp/202301192148.58ece903-oliver.s...@intel.com --- drivers/cpuidle/cpuidle.c|2 +- drivers/cpuidle/poll_state.c |2 -- 2 files changed, 1 insertion(+), 3

[PATCH 2/6] x86/pvclock: improve atomic update of last_value in pvclock_clocksource_read

2023-01-23 Thread Peter Zijlstra
_value" - exactly what atomic64_try_cmpxchg does in a correct and more optimal way. Signed-off-by: Uros Bizjak Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20230118202330.3740-1-ubiz...@gmail.com --- arch/x86/kernel/pvclock.c | 5 ++--- 1 file changed, 2 insertion

[PATCH 4/6] x86: Mark sched_clock() noinstr

2023-01-23 Thread Peter Zijlstra
In order to use sched_clock() from noinstr code, mark it and all it's implenentations noinstr. The whole pvclock thing (used by KVM/Xen) is a bit of a pain, since it calls out to watchdogs, create a pvclock_clocksource_read_nowd() variant doesn't do that and can be noinstr. Signed-off

[PATCH 1/6] x86: Always inline arch_atomic64

2023-01-23 Thread Peter Zijlstra
As already done for regular arch_atomic, always inline arch_atomic64. Signed-off-by: Peter Zijlstra (Intel) --- arch/x86/include/asm/atomic64_32.h | 44 ++--- arch/x86/include/asm/atomic64_64.h | 36 +++--- 2 files changed, 40

[PATCH 0/6] A few cpuidle vs rcu fixes

2023-01-23 Thread Peter Zijlstra
0-day robot reported graph-tracing made the cpuidle-vs-rcu rework go splat. These patches appear to cure this, the ftrace selftest now runs to completion without spamming scary messages to dmesg. --- arch/x86/include/asm/atomic64_32.h | 44 +++--- arch/x86/include

[PATCH 5/6] sched/clock: Make local_clock() noinstr

2023-01-23 Thread Peter Zijlstra
With sched_clock() noinstr, provide a noinstr implementation of local_clock(). Signed-off-by: Peter Zijlstra (Intel) --- include/linux/sched/clock.h |8 +++- kernel/sched/clock.c| 27 +-- 2 files changed, 24 insertions(+), 11 deletions(-) --- a/include

[PATCH 3/6] ftrace/x86: Warn and ignore graph tracing when RCU is disabled

2023-01-23 Thread Peter Zijlstra
All RCU disabled code should be noinstr and hence we should never get here -- when we do, WARN about it and make sure to not actually do tracing. Signed-off-by: Peter Zijlstra (Intel) --- arch/x86/kernel/ftrace.c |3 +++ 1 file changed, 3 insertions(+) --- a/arch/x86/kernel/ftrace.c +++ b

Re: [PATCH v3 16/51] cpuidle: Annotate poll_idle()

2023-01-20 Thread Peter Zijlstra
On Thu, Jan 12, 2023 at 08:43:30PM +0100, Peter Zijlstra wrote: > The __cpuidle functions will become a noinstr class, as such they need > explicit annotations. > > Signed-off-by: Peter Zijlstra (Intel) > Reviewed-by: Rafael J. Wysocki > Acked-by: Frederic Weisbecker > Tes

Re: [PATCH] x86/paravirt: merge activate_mm and dup_mmap callbacks

2023-01-17 Thread Peter Zijlstra
On Sun, Jan 15, 2023 at 08:27:50PM -0800, Srivatsa S. Bhat wrote: > I see that's not an issue right now since there is no other actual > user for these callbacks. But are we sure that merging the callbacks > just because the current user (Xen PV) has the same implementation for > both is a good id

Re: [PATCH v3 00/51] cpuidle,rcu: Clean up the mess

2023-01-17 Thread Peter Zijlstra
On Mon, Jan 16, 2023 at 04:59:04PM +, Mark Rutland wrote: > I'm sorry to have to bear some bad news on that front. :( Moo, something had to give.. > IIUC what's happenign here is the PSCI cpuidle driver has entered idle and RCU > is no longer watching when arm64's cpu_suspend() manipulates

Re: [PATCH v3 35/51] trace,hardirq: No moar _rcuidle() tracing

2023-01-17 Thread Peter Zijlstra
On Tue, Jan 17, 2023 at 01:24:46PM +0900, Masami Hiramatsu wrote: > Hi Peter, > > On Thu, 12 Jan 2023 20:43:49 +0100 > Peter Zijlstra wrote: > > > Robot reported that trace_hardirqs_{on,off}() tickle the forbidden > > _rcuidle() tracepoint through local_irq_{en,dis

[PATCH v3 50/51] cpuidle: Comments about noinstr/__cpuidle

2023-01-12 Thread Peter Zijlstra
Add a few words on noinstr / __cpuidle usage. Signed-off-by: Peter Zijlstra (Intel) --- drivers/cpuidle/cpuidle.c | 12 include/linux/compiler_types.h | 10 ++ 2 files changed, 22 insertions(+) --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c

[PATCH v3 51/51] context_tracking: Fix noinstr vs KASAN

2023-01-12 Thread Peter Zijlstra
vmlinux.o: warning: objtool: __ct_user_enter+0x72: call to __kasan_check_write() leaves .noinstr.text section vmlinux.o: warning: objtool: __ct_user_exit+0x47: call to __kasan_check_write() leaves .noinstr.text section Signed-off-by: Peter Zijlstra (Intel) --- kernel/context_tracking.c | 12

[PATCH v3 29/51] cpuidle,tdx: Make tdx noinstr clean

2023-01-12 Thread Peter Zijlstra
.noinstr.text section Signed-off-by: Peter Zijlstra (Intel) Acked-by: Rafael J. Wysocki Acked-by: Frederic Weisbecker Tested-by: Tony Lindgren Tested-by: Ulf Hansson --- arch/x86/boot/compressed/vmlinux.lds.S |1 + arch/x86/coco/tdx/tdcall.S |2 ++ arch/x86/coco/tdx/tdx.c

[PATCH v3 41/51] cpuidle,clk: Remove trace_.*_rcuidle()

2023-01-12 Thread Peter Zijlstra
OMAP was the one and only user. Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Ulf Hansson Acked-by: Rafael J. Wysocki Acked-by: Frederic Weisbecker Tested-by: Tony Lindgren Tested-by: Ulf Hansson --- drivers/clk/clk.c |8 1 file changed, 4 insertions(+), 4 deletions

[PATCH v3 49/51] cpuidle, arch: Mark all regular cpuidle_state::enter methods __cpuidle

2023-01-12 Thread Peter Zijlstra
For all cpuidle drivers that do not use CPUIDLE_FLAG_RCU_IDLE (iow, the simple ones) make sure all the functions are marked __cpuidle. ( due to lack of noinstr validation on these platforms it is entirely possible this isn't complete ) Signed-off-by: Peter Zijlstra (Intel) --- arc

[PATCH v3 37/51] cpuidle,omap3: Push RCU-idle into omap_sram_idle()

2023-01-12 Thread Peter Zijlstra
OMAP3 uses full SoC suspend modes as idle states, as such it needs the whole power-domain and clock-domain code from the idle path. All that code is not suitable to run with RCU disabled, as such push RCU-idle deeper still. Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Tony Lindgren Acked

[PATCH v3 40/51] cpuidle,powerdomain: Remove trace_.*_rcuidle()

2023-01-12 Thread Peter Zijlstra
OMAP was the one and only user. Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Ulf Hansson Acked-by: Rafael J. Wysocki Acked-by: Frederic Weisbecker Tested-by: Tony Lindgren Tested-by: Ulf Hansson --- arch/arm/mach-omap2/powerdomain.c | 10 +- drivers/base/power/runtime.c

[PATCH v3 00/51] cpuidle,rcu: Clean up the mess

2023-01-12 Thread Peter Zijlstra
Hi All! The (hopefully) final respin of cpuidle vs rcu cleanup patches. Barring any objections I'll be queueing these patches in tip/sched/core in the next few days. v2: https://lkml.kernel.org/r/20220919095939.761690...@infradead.org These here patches clean up the mess that is cpuidle vs rcuid

[PATCH v3 31/51] cpuidle,nospec: Make noinstr clean

2023-01-12 Thread Peter Zijlstra
Signed-off-by: Peter Zijlstra (Intel) Acked-by: Rafael J. Wysocki Acked-by: Frederic Weisbecker Tested-by: Tony Lindgren Tested-by: Ulf Hansson --- arch/x86/include/asm/nospec-branch.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/include/asm/nospec-branch.h +++ b

[PATCH v3 16/51] cpuidle: Annotate poll_idle()

2023-01-12 Thread Peter Zijlstra
The __cpuidle functions will become a noinstr class, as such they need explicit annotations. Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Rafael J. Wysocki Acked-by: Frederic Weisbecker Tested-by: Tony Lindgren Tested-by: Ulf Hansson --- drivers/cpuidle/poll_state.c |6 +- 1

[PATCH v3 48/51] cpuidle, arch: Mark all ct_cpuidle_enter() callers __cpuidle

2023-01-12 Thread Peter Zijlstra
For all cpuidle drivers that use CPUIDLE_FLAG_RCU_IDLE, ensure that all functions that call ct_cpuidle_enter() are marked __cpuidle. ( due to lack of noinstr validation on these platforms it is entirely possible this isn't complete ) Signed-off-by: Peter Zijlstra (Intel) --- arch/arm

[PATCH v3 19/51] cpuidle,intel_idle: Fix CPUIDLE_FLAG_INIT_XSTATE

2023-01-12 Thread Peter Zijlstra
() leaves .noinstr.text section Signed-off-by: Peter Zijlstra (Intel) Acked-by: Rafael J. Wysocki Acked-by: Frederic Weisbecker Tested-by: Tony Lindgren Tested-by: Ulf Hansson --- arch/x86/include/asm/fpu/xcr.h |4 ++-- arch/x86/include/asm/special_insns.h |2 +- arch/x86/kernel/fpu

[PATCH v3 44/51] entry, kasan, x86: Disallow overriding mem*() functions

2023-01-12 Thread Peter Zijlstra
memcpy() leaves .noinstr.text section Remove the weak aliases to ensure nobody hijacks these functions and add them to the noinstr section. Signed-off-by: Peter Zijlstra (Intel) Acked-by: Rafael J. Wysocki Acked-by: Frederic Weisbecker Tested-by: Tony Lindgren Tested-by: Ulf Hansson --- arch

[PATCH v3 39/51] arm,omap2: Use WFI for omap2_pm_idle()

2023-01-12 Thread Peter Zijlstra
ave a cpuidle driver; but adding one would be the recourse to (re)gain the other idle states. Suggested-by: Tony Lindgren Signed-off-by: Peter Zijlstra (Intel) Acked-by: Rafael J. Wysocki Acked-by: Frederic Weisbecker Tested-by: Tony Lindgren Tested-by: Ulf Hansson --- arch/arm/mach-omap2/pm2

[PATCH v3 47/51] cpuidle: Ensure ct_cpuidle_enter() is always called from noinstr/__cpuidle

2023-01-12 Thread Peter Zijlstra
Tracing (kprobes included) and other compiler instrumentation relies on a normal kernel runtime. Therefore all functions that disable RCU should be noinstr, as should all functions that are called while RCU is disabled. Signed-off-by: Peter Zijlstra (Intel) --- drivers/cpuidle/cpuidle.c | 37

[PATCH v3 43/51] intel_idle: Add force_irq_on module param

2023-01-12 Thread Peter Zijlstra
For testing purposes. Signed-off-by: Peter Zijlstra (Intel) Acked-by: Rafael J. Wysocki Acked-by: Frederic Weisbecker Tested-by: Tony Lindgren Tested-by: Ulf Hansson --- drivers/idle/intel_idle.c |7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/drivers/idle/intel_idle.c

[PATCH v3 09/51] cpuidle,omap3: Push RCU-idle into driver

2023-01-12 Thread Peter Zijlstra
Doing RCU-idle outside the driver, only to then teporarily enable it again before going idle is daft. Notably the cpu_pm_*() calls implicitly re-enable RCU for a bit. Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Frederic Weisbecker Reviewed-by: Tony Lindgren Acked-by: Rafael J. Wysocki

[PATCH v3 26/51] time/tick-broadcast: Remove RCU_NONIDLE usage

2023-01-12 Thread Peter Zijlstra
No callers left that have already disabled RCU. Signed-off-by: Peter Zijlstra (Intel) Acked-by: Mark Rutland Acked-by: Rafael J. Wysocki Acked-by: Frederic Weisbecker Tested-by: Tony Lindgren Tested-by: Ulf Hansson --- kernel/time/tick-broadcast-hrtimer.c | 29

[PATCH v3 14/51] cpuidle, cpu_pm: Remove RCU fiddling from cpu_pm_{enter, exit}()

2023-01-12 Thread Peter Zijlstra
All callers should still have RCU enabled. Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Ulf Hansson Acked-by: Mark Rutland Acked-by: Rafael J. Wysocki Acked-by: Frederic Weisbecker Tested-by: Tony Lindgren Tested-by: Ulf Hansson --- kernel/cpu_pm.c |9 - 1 file changed

[PATCH v3 42/51] ubsan: Fix objtool UACCESS warns

2023-01-12 Thread Peter Zijlstra
/restore and whitelist the thing. Signed-off-by: Peter Zijlstra (Intel) Acked-by: Rafael J. Wysocki Acked-by: Frederic Weisbecker Tested-by: Tony Lindgren Tested-by: Ulf Hansson --- lib/ubsan.c |5 - tools/objtool/check.c |1 + 2 files changed, 5 insertions(+), 1 deletion

[PATCH v3 35/51] trace,hardirq: No moar _rcuidle() tracing

2023-01-12 Thread Peter Zijlstra
rom NMI context again. Signed-off-by: Peter Zijlstra (Intel) --- kernel/trace/trace_preemptirq.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) --- a/kernel/trace/trace_preemptirq.c +++ b/kernel/trace/trace_preemptirq.c @@ -20,6 +20,15 @@ static DEFINE_PER_CPU(int,

[PATCH v3 34/51] trace: WARN on rcuidle

2023-01-12 Thread Peter Zijlstra
ARCH_WANTS_NO_INSTR (a superset of CONFIG_GENERIC_ENTRY) disallows any and all tracing when RCU isn't enabled. Signed-off-by: Peter Zijlstra (Intel) Acked-by: Rafael J. Wysocki Acked-by: Frederic Weisbecker Tested-by: Tony Lindgren Tested-by: Ulf Hansson --- include/linux/tracepo

[PATCH v3 10/51] cpuidle,armada: Push RCU-idle into driver

2023-01-12 Thread Peter Zijlstra
Doing RCU-idle outside the driver, only to then temporarily enable it again before going idle is daft. Notably the cpu_pm_*() calls implicitly re-enable RCU for a bit. Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Frederic Weisbecker Acked-by: Rafael J. Wysocki Tested-by: Tony Lindgren

[PATCH v3 45/51] sched: Always inline __this_cpu_preempt_check()

2023-01-12 Thread Peter Zijlstra
vmlinux.o: warning: objtool: acpi_idle_enter_s2idle+0x45: call to __this_cpu_preempt_check() leaves .noinstr.text section Signed-off-by: Peter Zijlstra (Intel) Acked-by: Rafael J. Wysocki Acked-by: Frederic Weisbecker Tested-by: Tony Lindgren Tested-by: Ulf Hansson --- include/linux/percpu

[PATCH v3 22/51] x86/tdx: Remove TDX_HCALL_ISSUE_STI

2023-01-12 Thread Peter Zijlstra
Now that arch_cpu_idle() is expected to return with IRQs disabled, avoid the useless STI/CLI dance. Per the specs this is supposed to work, but nobody has yet relied up this behaviour so broken implementations are possible. Signed-off-by: Peter Zijlstra (Intel) Acked-by: Rafael J. Wysocki

[PATCH v3 02/51] x86/idle: Replace x86_idle with a static_call

2023-01-12 Thread Peter Zijlstra
Typical boot time setup; no need to suffer an indirect call for that. Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Frederic Weisbecker Reviewed-by: Rafael J. Wysocki Tested-by: Tony Lindgren Tested-by: Ulf Hansson --- arch/x86/kernel/process.c | 50

[PATCH v3 20/51] cpuidle,intel_idle: Fix CPUIDLE_FLAG_IBRS

2023-01-12 Thread Peter Zijlstra
vmlinux.o: warning: objtool: intel_idle_ibrs+0x17: call to spec_ctrl_current() leaves .noinstr.text section vmlinux.o: warning: objtool: intel_idle_ibrs+0x27: call to wrmsrl.constprop.0() leaves .noinstr.text section Signed-off-by: Peter Zijlstra (Intel) Acked-by: Rafael J. Wysocki Acked-by

[PATCH v3 13/51] cpuidle: Fix ct_idle_*() usage

2023-01-12 Thread Peter Zijlstra
The whole disable-RCU, enable-IRQS dance is very intricate since changing IRQ state is traced, which depends on RCU. Add two helpers for the cpuidle case that mirror the entry code. Signed-off-by: Peter Zijlstra (Intel) Acked-by: Rafael J. Wysocki Acked-by: Frederic Weisbecker Tested-by: Tony

[PATCH v3 04/51] cpuidle: Move IRQ state validation

2023-01-12 Thread Peter Zijlstra
Make cpuidle_enter_state() consistent with the s2idle variant and verify ->enter() always returns with interrupts disabled. Signed-off-by: Peter Zijlstra (Intel) Acked-by: Rafael J. Wysocki Acked-by: Frederic Weisbecker Tested-by: Tony Lindgren Tested-by: Ulf Hansson --- drivers/cpui

[PATCH v3 21/51] arch/idle: Change arch_cpu_idle() IRQ behaviour

2023-01-12 Thread Peter Zijlstra
nable-disable' dance. Therefore, push this IRQ disabling into the idle function, meaning that those architectures can avoid the pointless IRQ state flipping. Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Gautham R. Shenoy Acked-by: Mark Rutland [arm64] Acked-by: Rafael J. Wysocki Ack

[PATCH v3 25/51] printk: Remove trace_.*_rcuidle() usage

2023-01-12 Thread Peter Zijlstra
The problem, per commit fc98c3c8c9dc ("printk: use rcuidle console tracepoint"), was printk usage from the cpuidle path where RCU was already disabled. Per the patches earlier in this series, this is no longer the case. Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Sergey S

[PATCH v3 33/51] trace: Remove trace_hardirqs_{on,off}_caller()

2023-01-12 Thread Peter Zijlstra
Per commit 56e62a737028 ("s390: convert to generic entry") the last and only callers of trace_hardirqs_{on,off}_caller() went away, clean up. Cc: Sven Schnelle Signed-off-by: Peter Zijlstra (Intel) --- kernel/trace/trace_preemptirq.c | 29 - 1 file c

[PATCH v3 18/51] cpuidle, intel_idle: Fix CPUIDLE_FLAG_IRQ_ENABLE *again*

2023-01-12 Thread Peter Zijlstra
x false positive RCU splats due to incorrect hardirqs state") Signed-off-by: Peter Zijlstra (Intel) Acked-by: Rafael J. Wysocki Acked-by: Frederic Weisbecker Tested-by: Tony Lindgren Tested-by: Ulf Hansson --- drivers/idle/intel_idle.c |8 +--- 1 file changed, 1 insertion(+), 7 d

[PATCH v3 01/51] x86/perf/amd: Remove tracing from perf_lopwr_cb()

2023-01-12 Thread Peter Zijlstra
The perf_lopwr_cb() is called from the idle routines; there is no RCU there, we must not enter tracing. Signed-off-by: Peter Zijlstra (Intel) Acked-by: Rafael J. Wysocki Acked-by: Frederic Weisbecker Tested-by: Tony Lindgren Tested-by: Ulf Hansson --- arch/x86/events/amd/brs.c

[PATCH v3 28/51] cpuidle,mwait: Make noinstr clean

2023-01-12 Thread Peter Zijlstra
__monitor.constprop.0() leaves .noinstr.text section vmlinux.o: warning: objtool: mwait_idle+0x88: call to clflush() leaves .noinstr.text section Signed-off-by: Peter Zijlstra (Intel) Acked-by: Rafael J. Wysocki Acked-by: Frederic Weisbecker Tested-by: Tony Lindgren Tested-by: Ulf Hansson --- arch/x86

[PATCH v3 08/51] cpuidle,imx6: Push RCU-idle into driver

2023-01-12 Thread Peter Zijlstra
Doing RCU-idle outside the driver, only to then temporarily enable it again, at least twice, before going idle is daft. Notably both cpu_pm_enter() and cpu_cluster_pm_enter() implicity re-enable RCU. Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Frederic Weisbecker Acked-by: Rafael J

[PATCH v3 30/51] cpuidle,xenpv: Make more PARAVIRT_XXL noinstr clean

2023-01-12 Thread Peter Zijlstra
() leaves .noinstr.text section Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Srivatsa S. Bhat (VMware) Reviewed-by: Juergen Gross Acked-by: Rafael J. Wysocki Acked-by: Frederic Weisbecker Tested-by: Tony Lindgren Tested-by: Ulf Hansson --- arch/x86/include/asm/paravirt.h |6

[PATCH v3 46/51] arm64,riscv,perf: Remove RCU_NONIDLE() usage

2023-01-12 Thread Peter Zijlstra
The PM notifiers should no longer be ran with RCU disabled (per the previous patches), as such this hack is no longer required either. Signed-off-by: Peter Zijlstra (Intel) Acked-by: Rafael J. Wysocki Acked-by: Frederic Weisbecker Tested-by: Tony Lindgren Tested-by: Ulf Hansson --- drivers

[PATCH v3 36/51] cpuidle,omap3: Use WFI for omap3_pm_idle()

2023-01-12 Thread Peter Zijlstra
complicated idle states for the cpuidle driver. Signed-off-by: Peter Zijlstra (Intel) Acked-by: Tony Lindgren Acked-by: Rafael J. Wysocki Acked-by: Frederic Weisbecker Tested-by: Tony Lindgren Tested-by: Ulf Hansson --- arch/arm/mach-omap2/pm34xx.c |2 +- 1 file changed, 1 insertion(+), 1

[PATCH v3 27/51] cpuidle, sched: Remove annotations from TIF_{POLLING_NRFLAG, NEED_RESCHED}

2023-01-12 Thread Peter Zijlstra
section vmlinux.o: warning: objtool: intel_idle+0x78: call to test_ti_thread_flag.constprop.0() leaves .noinstr.text section vmlinux.o: warning: objtool: acpi_safe_halt+0xf: call to test_ti_thread_flag.constprop.0() leaves .noinstr.text section Signed-off-by: Peter Zijlstra (Intel) Acked-by

[PATCH v3 12/51] cpuidle,dt: Push RCU-idle into driver

2023-01-12 Thread Peter Zijlstra
Doing RCU-idle outside the driver, only to then temporarily enable it again before going idle is daft. Notably: this converts all dt_init_idle_driver() and __CPU_PM_CPU_IDLE_ENTER() users for they are inextrably intertwined. Signed-off-by: Peter Zijlstra (Intel) Acked-by: Rafael J. Wysocki

[PATCH v3 15/51] acpi_idle: Remove tracing

2023-01-12 Thread Peter Zijlstra
All the idle routines are called with RCU disabled, as such there must not be any tracing inside. While there; clean-up the io-port idle thing. Signed-off-by: Peter Zijlstra (Intel) Acked-by: Rafael J. Wysocki Acked-by: Frederic Weisbecker Tested-by: Tony Lindgren Tested-by: Ulf Hansson

[PATCH v3 32/51] cpuidle,acpi: Make noinstr clean

2023-01-12 Thread Peter Zijlstra
() leaves .noinstr.text section Signed-off-by: Peter Zijlstra (Intel) Acked-by: Rafael J. Wysocki Acked-by: Frederic Weisbecker Tested-by: Tony Lindgren Tested-by: Ulf Hansson --- arch/x86/include/asm/shared/io.h |4 ++-- drivers/acpi/processor_idle.c|2 +- include/linux/cpumask.h

[PATCH v3 17/51] objtool/idle: Validate __cpuidle code as noinstr

2023-01-12 Thread Peter Zijlstra
Idle code is very like entry code in that RCU isn't available. As such, add a little validation. Signed-off-by: Peter Zijlstra (Intel) Acked-by: Geert Uytterhoeven Acked-by: Rafael J. Wysocki Acked-by: Frederic Weisbecker Tested-by: Tony Lindgren Tested-by: Ulf Hansson --- arch/

[PATCH v3 07/51] cpuidle,psci: Push RCU-idle into driver

2023-01-12 Thread Peter Zijlstra
Doing RCU-idle outside the driver, only to then temporarily enable it again, at least twice, before going idle is daft. Notably once implicitly through the cpu_pm_*() calls and once explicitly doing ct_irq_*_irqon(). Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Frederic Weisbecker

[PATCH v3 11/51] cpuidle,omap4: Push RCU-idle into driver

2023-01-12 Thread Peter Zijlstra
Doing RCU-idle outside the driver, only to then temporarily enable it again, some *four* times, before going idle is daft. Notably three times explicitly using RCU_NONIDLE() and once implicitly through cpu_pm_*(). Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Frederic Weisbecker Reviewed

[PATCH v3 23/51] arm,smp: Remove trace_.*_rcuidle() usage

2023-01-12 Thread Peter Zijlstra
e for smp_cross_call() tracepoints"), that cpuidle_enter_state_coupled() already had RCU disabled, but that's long been fixed by commit 1098582a0f6c ("sched,idle,rcu: Push rcu_idle deeper into the idle path"). Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Ulf Hansson Ac

[PATCH v3 06/51] cpuidle,tegra: Push RCU-idle into driver

2023-01-12 Thread Peter Zijlstra
Doing RCU-idle outside the driver, only to then temporarily enable it again, at least twice, before going idle is daft. Notably once implicitly through the cpu_pm_*() calls and once explicitly doing RCU_NONIDLE(). Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Frederic Weisbecker Acked-by

[PATCH v3 38/51] cpuidle, omap4: Push RCU-idle into omap4_enter_lowpower()

2023-01-12 Thread Peter Zijlstra
From: Tony Lindgren OMAP4 uses full SoC suspend modes as idle states, as such it needs the whole power-domain and clock-domain code from the idle path. All that code is not suitable to run with RCU disabled, as such push RCU-idle deeper still. Signed-off-by: Tony Lindgren Signed-off-by: Peter

[PATCH v3 03/51] cpuidle/poll: Ensure IRQ state is invariant

2023-01-12 Thread Peter Zijlstra
cpuidle_state::enter() methods should be IRQ invariant. Additionally make sure to use raw_local_irq_*() methods since this cpuidle callback will be called with RCU already disabled. Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Rafael J. Wysocki Reviewed-by: Frederic Weisbecker Tested-by

[PATCH v3 24/51] arm64,smp: Remove trace_.*_rcuidle() usage

2023-01-12 Thread Peter Zijlstra
Ever since commit d3afc7f12987 ("arm64: Allow IPIs to be handled as normal interrupts") this function is called in regular IRQ context. Signed-off-by: Peter Zijlstra (Intel) Acked-by: Mark Rutland Acked-by: Marc Zyngier Acked-by: Rafael J. Wysocki Acked-by: Frederic Weisbecker

[PATCH v3 05/51] cpuidle,riscv: Push RCU-idle into driver

2023-01-12 Thread Peter Zijlstra
Doing RCU-idle outside the driver, only to then temporarily enable it again, at least twice, before going idle is daft. That is, once implicitly through the cpu_pm_*() calls and once explicitly doing ct_irq_*_irqon(). Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Anup Patel Reviewed-by

Re: [PATCH v2 12/44] cpuidle,dt: Push RCU-idle into driver

2022-11-16 Thread Peter Zijlstra
Sorry; things keep getting in the way of finishing this :/ As such, I need a bit of time to get on-track again.. On Tue, Oct 04, 2022 at 01:03:57PM +0200, Ulf Hansson wrote: > > --- a/drivers/acpi/processor_idle.c > > +++ b/drivers/acpi/processor_idle.c > > @@ -1200,6 +1200,8 @@ static int acp

Re: [PATCH v2] x86/paravirt: use common macro for creating simple asm paravirt functions

2022-11-16 Thread Peter Zijlstra
On Wed, Nov 09, 2022 at 02:44:18PM +0100, Juergen Gross wrote: > There are some paravirt assembler functions which are sharing a common > pattern. Introduce a macro DEFINE_PARAVIRT_ASM() for creating them. > > Note that this macro is including explicit alignment of the generated > functions, leadi

Re: [PATCH v3 6/6] freezer,sched: Rewrite core freezer logic

2022-09-26 Thread Peter Zijlstra
On Mon, Sep 26, 2022 at 08:06:46PM +0200, Peter Zijlstra wrote: > Let me go git-grep some to see if there's more similar fail. I've ended up with the below... --- include/linux/wait.h | 2 +- kernel/hung_task.c | 8 ++-- kernel/sched/core.c | 2 +- 3 files changed, 8 ins

Re: [PATCH v3 6/6] freezer,sched: Rewrite core freezer logic

2022-09-26 Thread Peter Zijlstra
On Mon, Sep 26, 2022 at 05:49:16PM +0200, Christian Borntraeger wrote: > Hmm, > > #define ___wait_is_interruptible(state) > \ > (!__builtin_constant_p(state) || > \ > state == TASK_INTERRUPTIB

Re: [PATCH v3 6/6] freezer,sched: Rewrite core freezer logic

2022-09-26 Thread Peter Zijlstra
On Mon, Sep 26, 2022 at 03:23:10PM +0200, Christian Borntraeger wrote: > Am 26.09.22 um 14:55 schrieb Peter Zijlstra: > > > Could you please test with something like the below on? I can boot that > > with KVM, but obviously I didn't suffer any weirdness to begin with :

Re: [PATCH v3 6/6] freezer,sched: Rewrite core freezer logic

2022-09-26 Thread Peter Zijlstra
On Mon, Sep 26, 2022 at 02:32:24PM +0200, Christian Borntraeger wrote: > diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c > index 9fa3c76a267f..e93df4f735fe 100644 > --- a/drivers/char/virtio_console.c > +++ b/drivers/char/virtio_console.c > @@ -790,7 +790,7 @@ static int

Re: [PATCH v3 6/6] freezer,sched: Rewrite core freezer logic

2022-09-26 Thread Peter Zijlstra
On Mon, Sep 26, 2022 at 12:55:21PM +0200, Christian Borntraeger wrote: > > > Am 26.09.22 um 10:06 schrieb Christian Borntraeger: > > > > > > Am 23.09.22 um 09:53 schrieb Christian Borntraeger: > > > Am 23.09.22 um 09:21 schrieb Christian Borntraeger: > > > > Peter, > > > > > > > > as a heads-u

Re: [PATCH] smp/hotplug, x86/vmware: Put offline vCPUs in halt instead of mwait

2022-09-23 Thread Peter Zijlstra
On Thu, Jul 21, 2022 at 01:44:33PM -0700, Srivatsa S. Bhat wrote: > From: Srivatsa S. Bhat (VMware) > > VMware ESXi allows enabling a passthru mwait CPU-idle state in the > guest using the following VMX option: > > monitor_control.mwait_in_guest = "TRUE" > > This lets a vCPU in mwait to remain

Re: [PATCH v2 00/44] cpuidle,rcu: Clean up the mess

2022-09-20 Thread Peter Zijlstra
Because Nadav asked about tracing/kprobing idle, I had another go around and noticed not all functions calling ct_cpuidle_enter are __cpuidle. Basically all cpuidle_driver::enter functions should be __cpuidle; i'll do that audit shortly. For now this is ct_cpuidle_enter / CPU_IDLE_ENTER users.

  1   2   3   4   5   6   >