Skip to content

cpuidle,rcu: Clean up the mess

Peter Zijlstra linux-acpi linux-alpha linux-arch linux-arm-msm linux-clk linux-csky linux-hexagon linux-ia64 linux-m68k linux-mips linux-mm linux-omap linux-parisc linux-perf-users linux-pm linux-renesas-soc linux-riscv linux-s390 linux-samsung-soc linux-sh linux-snps-arc linux-tegra linux-trace-kernel linux-um linuxppc-dev lkml loongarch sparclinux virtualization 3 versions – Applied

Status from this message: The following commit has been merged into the sched/core branch of tip:

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest51 patches 15 repliesApplied
  2. v244 patches 45 repliesSuperseded
  3. v136 patches 68 repliesSuperseded

Changes in v3 from the cover letter

- rebased to v6.2-rc3; as available at:
git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git sched/idle

- folded: https://lkml.kernel.org/r/[email protected]
which makes the ARM cpuidle index 0 consistently not use CPUIDLE_FLAG_RCU_IDLE, as requested by Ulf.

- added a few more __always_inline to empty stub functions as found by the robot.

- Used _RET_IP_ instead of _THIS_IP_ in a few placed because of:
https://github.com/ClangBuiltLinux/linux/issues/263

- Added new patches to address various robot reports:

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/51x86/perf/amd: Remove tracing from perf_lopwr_cb()arch/x86/events/amd/brs.c arch/x86/include/asm/perf_event.h+6 -90 replies
2/51x86/idle: Replace x86_idle with a static_callarch/x86/kernel/process.c+28 -220 replies
3/51cpuidle/poll: Ensure IRQ state is invariantdrivers/cpuidle/poll_state.c+3 -10 replies
4/51cpuidle: Move IRQ state validationdrivers/cpuidle/cpuidle.c+5 -50 replies
5/51cpuidle,riscv: Push RCU-idle into driverdrivers/cpuidle/cpuidle-riscv-sbi.c+5 -40 replies
6/51cpuidle,tegra: Push RCU-idle into driverdrivers/cpuidle/cpuidle-tegra.c+16 -50 replies
7/51cpuidle,psci: Push RCU-idle into driverdrivers/cpuidle/cpuidle-psci.c+5 -42 replies
8/51cpuidle,imx6: Push RCU-idle into driverarch/arm/mach-imx/cpuidle-imx6sx.c+4 -10 replies
9/51cpuidle,omap3: Push RCU-idle into driverarch/arm/mach-omap2/cpuidle34xx.c+16 -00 replies
10/51cpuidle,armada: Push RCU-idle into driverdrivers/cpuidle/cpuidle-mvebu-v7.c+7 -00 replies
11/51cpuidle,omap4: Push RCU-idle into driverarch/arm/mach-omap2/cpuidle44xx.c+18 -110 replies
12/51cpuidle,dt: Push RCU-idle into driverdrivers/acpi/processor_idle.c drivers/cpuidle/cpuidle-big_little.c drivers/cpuidle/dt_idle_states.c +1 more+11 -30 replies
13/51cpuidle: Fix ct_idle_*() usagearch/arm/mach-imx/cpuidle-imx6q.c arch/arm/mach-imx/cpuidle-imx6sx.c arch/arm/mach-omap2/cpuidle34xx.c +12 more+86 -660 replies
14/51cpuidle,cpu_pm: Remove RCU fiddling from cpu_pm_{enter,exit}()kernel/cpu_pm.c+0 -90 replies
15/51acpi_idle: Remove tracingdrivers/acpi/processor_idle.c+8 -80 replies
16/51cpuidle: Annotate poll_idle()drivers/cpuidle/poll_state.c+5 -13 replies
17/51objtool/idle: Validate __cpuidle code as noinstrarch/alpha/kernel/vmlinux.lds.S arch/arc/kernel/vmlinux.lds.S arch/arm/include/asm/vmlinux.lds.h +29 more+27 -450 replies
18/51cpuidle,intel_idle: Fix CPUIDLE_FLAG_IRQ_ENABLE *again*drivers/idle/intel_idle.c+1 -70 replies
19/51cpuidle,intel_idle: Fix CPUIDLE_FLAG_INIT_XSTATEarch/x86/include/asm/fpu/xcr.h arch/x86/include/asm/special_insns.h arch/x86/kernel/fpu/core.c+5 -50 replies
20/51cpuidle,intel_idle: Fix CPUIDLE_FLAG_IBRSarch/x86/kernel/cpu/bugs.c drivers/idle/intel_idle.c+3 -30 replies
21/51arch/idle: Change arch_cpu_idle() IRQ behaviourarch/alpha/kernel/process.c arch/arc/kernel/process.c arch/arm/kernel/process.c +24 more+29 -370 replies
22/51x86/tdx: Remove TDX_HCALL_ISSUE_STIarch/x86/coco/tdx/tdcall.S arch/x86/coco/tdx/tdx.c arch/x86/include/asm/shared/tdx.h+4 -330 replies
23/51arm,smp: Remove trace_.*_rcuidle() usagearch/arm/kernel/smp.c+3 -30 replies
24/51arm64,smp: Remove trace_.*_rcuidle() usagearch/arm64/kernel/smp.c+2 -20 replies
25/51printk: Remove trace_.*_rcuidle() usagekernel/printk/printk.c+1 -10 replies
26/51time/tick-broadcast: Remove RCU_NONIDLE usagekernel/time/tick-broadcast-hrtimer.c+12 -170 replies
27/51cpuidle,sched: Remove annotations from TIF_{POLLING_NRFLAG,NEED_RESCHED}include/linux/sched/idle.h include/linux/thread_info.h+47 -110 replies
28/51cpuidle,mwait: Make noinstr cleanarch/x86/include/asm/mwait.h arch/x86/include/asm/special_insns.h+7 -70 replies
29/51cpuidle,tdx: Make tdx noinstr cleanarch/x86/boot/compressed/vmlinux.lds.S arch/x86/coco/tdx/tdcall.S arch/x86/coco/tdx/tdx.c+6 -20 replies
30/51cpuidle,xenpv: Make more PARAVIRT_XXL noinstr cleanarch/x86/include/asm/paravirt.h arch/x86/include/asm/special_insns.h arch/x86/include/asm/xen/hypercall.h +3 more+21 -90 replies
31/51cpuidle,nospec: Make noinstr cleanarch/x86/include/asm/nospec-branch.h+1 -10 replies
32/51cpuidle,acpi: Make noinstr cleanarch/x86/include/asm/shared/io.h drivers/acpi/processor_idle.c include/linux/cpumask.h+5 -50 replies
33/51trace: Remove trace_hardirqs_{on,off}_caller()kernel/trace/trace_preemptirq.c+0 -290 replies
34/51trace: WARN on rcuidleinclude/linux/tracepoint.h kernel/trace/trace.c+16 -20 replies
35/51trace,hardirq: No moar _rcuidle() tracingkernel/trace/trace_preemptirq.c+13 -84 replies
36/51cpuidle,omap3: Use WFI for omap3_pm_idle()arch/arm/mach-omap2/pm34xx.c+1 -10 replies
37/51cpuidle,omap3: Push RCU-idle into omap_sram_idle()arch/arm/mach-omap2/cpuidle34xx.c arch/arm/mach-omap2/pm.h arch/arm/mach-omap2/pm34xx.c+12 -60 replies
38/51cpuidle,omap4: Push RCU-idle into omap4_enter_lowpower()arch/arm/mach-omap2/common.h arch/arm/mach-omap2/cpuidle44xx.c arch/arm/mach-omap2/omap-mpuss-lowpower.c +1 more+18 -100 replies
39/51arm,omap2: Use WFI for omap2_pm_idle()arch/arm/mach-omap2/pm24xx.c+2 -490 replies
40/51cpuidle,powerdomain: Remove trace_.*_rcuidle()arch/arm/mach-omap2/powerdomain.c drivers/base/power/runtime.c+17 -170 replies
41/51cpuidle,clk: Remove trace_.*_rcuidle()drivers/clk/clk.c+4 -41 reply
42/51ubsan: Fix objtool UACCESS warnslib/ubsan.c tools/objtool/check.c+5 -10 replies
43/51intel_idle: Add force_irq_on module paramdrivers/idle/intel_idle.c+6 -10 replies
44/51entry,kasan,x86: Disallow overriding mem*() functionsarch/x86/lib/memcpy_64.S arch/x86/lib/memmove_64.S arch/x86/lib/memset_64.S +3 more+53 -50 replies
45/51sched: Always inline __this_cpu_preempt_check()include/linux/percpu-defs.h+1 -10 replies
46/51arm64,riscv,perf: Remove RCU_NONIDLE() usagedrivers/perf/arm_pmu.c drivers/perf/riscv_pmu_sbi.c+2 -170 replies
47/51cpuidle: Ensure ct_cpuidle_enter() is always called from noinstr/__cpuidledrivers/cpuidle/cpuidle.c+28 -90 replies
48/51cpuidle,arch: Mark all ct_cpuidle_enter() callers __cpuidlearch/arm/mach-imx/cpuidle-imx6q.c arch/arm/mach-imx/cpuidle-imx6sx.c arch/arm/mach-omap2/omap-mpuss-lowpower.c +9 more+33 -380 replies
49/51cpuidle,arch: Mark all regular cpuidle_state::enter methods __cpuidlearch/arm/kernel/cpuidle.c arch/arm/mach-davinci/cpuidle.c arch/arm/mach-imx/cpuidle-imx5.c +4 more+15 -160 replies
50/51cpuidle: Comments about noinstr/__cpuidledrivers/cpuidle/cpuidle.c include/linux/compiler_types.h+22 -00 replies
51/51context_tracking: Fix noinstr vs KASANkernel/context_tracking.c+6 -60 replies

Reviews trailers per patch

45 of 51 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchRafael J. WysockiFrederic WeisbeckerTony LindgrenUlf HanssonAnup PatelGuo RenKajetan PuchalskiMark RutlandGeert UytterhoevenGautham R. ShenoyMarc ZyngierSergey SenozhatskyPetr MladekSrivatsa S. Bhat (VMware)Juergen GrossStephen BoydPaul E. McKenneySudeep HollaMasami Hiramatsu (Google)
SeriesR-b T-b T-b T-b
1/51A-b A-b T-b T-b
2/51R-b R-b T-b T-b
3/51R-b R-b T-b T-b
4/51A-b A-b T-b T-b
5/51A-b R-b T-b T-b R-b
6/51A-b R-b T-b T-b
7/51A-b R-b T-b T-b R-b T-b
8/51A-b R-b T-b T-b
9/51A-b R-b R-b T-b T-b
10/51A-b R-b T-b T-b
11/51A-b R-b R-b T-b T-b
12/51A-b A-b T-b T-b
13/51A-b A-b T-b T-b
14/51A-b A-b T-b R-b T-b A-b
15/51A-b A-b T-b T-b
16/51R-b A-b T-b T-b
17/51A-b A-b T-b T-b A-b
18/51A-b A-b T-b T-b
19/51A-b A-b T-b T-b
20/51A-b A-b T-b T-b
21/51A-b A-b T-b T-b A-b A-b R-b
22/51A-b A-b T-b T-b
23/51A-b A-b T-b R-b T-b
24/51A-b A-b T-b T-b A-b A-b
25/51A-b A-b T-b T-b R-b A-b
26/51A-b A-b T-b T-b A-b
27/51A-b A-b T-b T-b
28/51A-b A-b T-b T-b
29/51A-b A-b T-b T-b
30/51A-b A-b T-b T-b R-b R-b
31/51A-b A-b T-b T-b
32/51A-b A-b T-b T-b
33/51
34/51A-b A-b T-b T-b
35/51R-b
36/51A-b A-b A-b T-b T-b
37/51A-b A-b R-b T-b T-b
38/51A-b A-b T-b T-b
39/51A-b A-b T-b T-b
40/51A-b A-b T-b R-b T-b
41/51A-b A-b T-b R-b T-b A-b
42/51A-b A-b T-b T-b
43/51A-b A-b T-b T-b
44/51A-b A-b T-b T-b
45/51A-b A-b T-b T-b
46/51A-b A-b T-b T-b
47/51
48/51
49/51
50/51
51/51

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 19 reviewers.

Read the v3 thread

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

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/[email protected]

These here patches clean up the mess that is cpuidle vs rcuidle.

At the end of the ride there's only on RCU_NONIDLE user left:

  arch/arm64/kernel/suspend.c:            RCU_NONIDLE(__cpu_suspend_exit());

And I know Mark has been prodding that with something sharp.

The last version was tested by a number of people and I'm hoping to not have broken anything in the meantime ;-)

Changes since v2:

- rebased to v6.2-rc3; as available at:
git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git sched/idle

- folded: https://lkml.kernel.org/r/[email protected]
which makes the ARM cpuidle index 0 consistently not use CPUIDLE_FLAG_RCU_IDLE, as requested by Ulf.

- added a few more __always_inline to empty stub functions as found by the robot.

- Used _RET_IP_ instead of _THIS_IP_ in a few placed because of:
https://github.com/ClangBuiltLinux/linux/issues/263

- Added new patches to address various robot reports:

     #35:  trace,hardirq: No moar _rcuidle() tracing
     #47:  cpuidle: Ensure ct_cpuidle_enter() is always called from noinstr/__cpuidle
     #48:  cpuidle,arch: Mark all ct_cpuidle_enter() callers __cpuidle
     #49:  cpuidle,arch: Mark all regular cpuidle_state::enter methods __cpuidle
     #50:  cpuidle: Comments about noinstr/__cpuidle
     #51:  context_tracking: Fix noinstr vs KASAN
---
 arch/alpha/kernel/process.c               |  1 -
 arch/alpha/kernel/vmlinux.lds.S           |  1 -
 arch/arc/kernel/process.c                 |  3 ++
 arch/arc/kernel/vmlinux.lds.S             |  1 -
 arch/arm/include/asm/vmlinux.lds.h        |  1 -
 arch/arm/kernel/cpuidle.c                 |  4 +-
 arch/arm/kernel/process.c                 |  1 -
 arch/arm/kernel/smp.c                     |  6 +--
 arch/arm/mach-davinci/cpuidle.c           |  4 +-
 arch/arm/mach-gemini/board-dt.c           |  3 +-
 arch/arm/mach-imx/cpuidle-imx5.c          |  4 +-
 arch/arm/mach-imx/cpuidle-imx6q.c         |  8 ++--
 arch/arm/mach-imx/cpuidle-imx6sl.c        |  4 +-
 arch/arm/mach-imx/cpuidle-imx6sx.c        |  9 ++--
 arch/arm/mach-imx/cpuidle-imx7ulp.c       |  4 +-
 arch/arm/mach-omap2/common.h              |  6 ++-
 arch/arm/mach-omap2/cpuidle34xx.c         | 16 ++++++-
 arch/arm/mach-omap2/cpuidle44xx.c         | 29 +++++++------
 arch/arm/mach-omap2/omap-mpuss-lowpower.c | 12 +++++-
 arch/arm/mach-omap2/pm.h                  |  2 +-
 arch/arm/mach-omap2/pm24xx.c              | 51 +---------------------
 arch/arm/mach-omap2/pm34xx.c              | 14 +++++--
 arch/arm/mach-omap2/pm44xx.c              |  2 +-
 arch/arm/mach-omap2/powerdomain.c         | 10 ++---
 arch/arm/mach-s3c/cpuidle-s3c64xx.c       |  5 +--
 arch/arm64/kernel/cpuidle.c               |  2 +-
 arch/arm64/kernel/idle.c                  |  1 -
 arch/arm64/kernel/smp.c                   |  4 +-
 arch/arm64/kernel/vmlinux.lds.S           |  1 -
 arch/csky/kernel/process.c                |  1 -
 arch/csky/kernel/smp.c                    |  2 +-
 arch/csky/kernel/vmlinux.lds.S            |  1 -
 arch/hexagon/kernel/process.c             |  1 -
 arch/hexagon/kernel/vmlinux.lds.S         |  1 -
 arch/ia64/kernel/process.c                |  1 +
 arch/ia64/kernel/vmlinux.lds.S            |  1 -
 arch/loongarch/kernel/idle.c              |  1 +
 arch/loongarch/kernel/vmlinux.lds.S       |  1 -
 arch/m68k/kernel/vmlinux-nommu.lds        |  1 -
 arch/m68k/kernel/vmlinux-std.lds          |  1 -
 arch/m68k/kernel/vmlinux-sun3.lds         |  1 -
 arch/microblaze/kernel/process.c          |  1 -
 arch/microblaze/kernel/vmlinux.lds.S      |  1 -
 arch/mips/kernel/idle.c                   | 14 +++----
 arch/mips/kernel/vmlinux.lds.S            |  1 -
 arch/nios2/kernel/process.c               |  1 -
 arch/nios2/kernel/vmlinux.lds.S           |  1 -
 arch/openrisc/kernel/process.c            |  1 +
 arch/openrisc/kernel/vmlinux.lds.S        |  1 -
 arch/parisc/kernel/process.c              |  2 -
 arch/parisc/kernel/vmlinux.lds.S          |  1 -
 arch/powerpc/kernel/idle.c                |  5 +--
 arch/powerpc/kernel/vmlinux.lds.S         |  1 -
 arch/riscv/kernel/process.c               |  1 -
 arch/riscv/kernel/vmlinux-xip.lds.S       |  1 -
 arch/riscv/kernel/vmlinux.lds.S           |  1 -
 arch/s390/kernel/idle.c                   |  1 -
 arch/s390/kernel/vmlinux.lds.S            |  1 -
 arch/sh/kernel/idle.c                     |  1 +
 arch/sh/kernel/vmlinux.lds.S              |  1 -
 arch/sparc/kernel/leon_pmc.c              |  4 ++
 arch/sparc/kernel/process_32.c            |  1 -
 arch/sparc/kernel/process_64.c            |  3 +-
 arch/sparc/kernel/vmlinux.lds.S           |  1 -
 arch/um/kernel/dyn.lds.S                  |  1 -
 arch/um/kernel/process.c                  |  1 -
 arch/um/kernel/uml.lds.S                  |  1 -
 arch/x86/boot/compressed/vmlinux.lds.S    |  1 +
 arch/x86/coco/tdx/tdcall.S                | 15 +------
 arch/x86/coco/tdx/tdx.c                   | 25 ++++-------
 arch/x86/events/amd/brs.c                 | 13 +++---
 arch/x86/include/asm/fpu/xcr.h            |  4 +-
 arch/x86/include/asm/irqflags.h           | 11 ++---
 arch/x86/include/asm/mwait.h              | 14 +++----
 arch/x86/include/asm/nospec-branch.h      |  2 +-
 arch/x86/include/asm/paravirt.h           |  6 ++-
 arch/x86/include/asm/perf_event.h         |  2 +-
 arch/x86/include/asm/shared/io.h          |  4 +-
 arch/x86/include/asm/shared/tdx.h         |  1 -
 arch/x86/include/asm/special_insns.h      |  8 ++--
 arch/x86/include/asm/xen/hypercall.h      |  2 +-
 arch/x86/kernel/cpu/bugs.c                |  2 +-
 arch/x86/kernel/fpu/core.c                |  4 +-
 arch/x86/kernel/paravirt.c                | 14 ++++++-
 arch/x86/kernel/process.c                 | 65 ++++++++++++++--------------
 arch/x86/kernel/vmlinux.lds.S             |  1 -
 arch/x86/lib/memcpy_64.S                  |  5 +--
 arch/x86/lib/memmove_64.S                 |  4 +-
 arch/x86/lib/memset_64.S                  |  4 +-
 arch/x86/xen/enlighten_pv.c               |  2 +-
 arch/x86/xen/irq.c                        |  2 +-
 arch/xtensa/kernel/process.c              |  1 +
 arch/xtensa/kernel/vmlinux.lds.S          |  1 -
 drivers/acpi/processor_idle.c             | 28 ++++++++-----
 drivers/base/power/runtime.c              | 24 +++++------
 drivers/clk/clk.c                         |  8 ++--
 drivers/cpuidle/cpuidle-arm.c             |  4 +-
 drivers/cpuidle/cpuidle-big_little.c      | 12 ++++--
 drivers/cpuidle/cpuidle-mvebu-v7.c        | 13 ++++--
 drivers/cpuidle/cpuidle-psci.c            | 26 +++++-------
 drivers/cpuidle/cpuidle-qcom-spm.c        |  4 +-
 drivers/cpuidle/cpuidle-riscv-sbi.c       | 19 +++++----
 drivers/cpuidle/cpuidle-tegra.c           | 31 +++++++++-----
 drivers/cpuidle/cpuidle.c                 | 70 ++++++++++++++++++++++---------
 drivers/cpuidle/dt_idle_states.c          |  2 +-
 drivers/cpuidle/poll_state.c              | 10 ++++-
 drivers/idle/intel_idle.c                 | 19 ++++-----
 drivers/perf/arm_pmu.c                    | 11 +----
 drivers/perf/riscv_pmu_sbi.c              |  8 +---
 include/asm-generic/vmlinux.lds.h         |  9 ++--
 include/linux/clockchips.h                |  4 +-
 include/linux/compiler_types.h            | 18 +++++++-
 include/linux/cpu.h                       |  3 --
 include/linux/cpuidle.h                   | 32 ++++++++++++++
 include/linux/cpumask.h                   |  4 +-
 include/linux/percpu-defs.h               |  2 +-
 include/linux/sched/idle.h                | 40 +++++++++++++-----
 include/linux/thread_info.h               | 18 +++++++-
 include/linux/tracepoint.h                | 15 ++++++-
 kernel/context_tracking.c                 | 12 +++---
 kernel/cpu_pm.c                           |  9 ----
 kernel/printk/printk.c                    |  2 +-
 kernel/sched/idle.c                       | 47 ++++++---------------
 kernel/time/tick-broadcast-hrtimer.c      | 29 ++++++-------
 kernel/time/tick-broadcast.c              |  6 ++-
 kernel/trace/trace.c                      |  3 ++
 kernel/trace/trace_preemptirq.c           | 50 ++++++----------------
 lib/ubsan.c                               |  5 ++-
 mm/kasan/kasan.h                          |  4 ++
 mm/kasan/shadow.c                         | 38 +++++++++++++++++
 tools/objtool/check.c                     | 17 ++++++++
 131 files changed, 617 insertions(+), 523 deletions(-)