Skip to content

[RHEL 9.3] Merge PREEMPT_RT and build kernel-rt as sub-package

Juri Lelli requested to merge jlelli/centos-stream-9:9.3-merge-rt into main

Targeting RHEL 9.3.

Bugzilla: https://bugzilla.redhat.com/2171995

PREEMPT_RT is a set of patches that minimize the amount of kernel code that is non-preemptible. This code is currently maintained outside of the RHEL source tree because it is not in the mainline upstream. However, significant progress has been made toward this goal, and complete upstream acceptance is now targeted for 6.3+.

The remaining out-of-tree (OOT) patches are expected to be in-tree upstream by the 9.3 timeframe (with the exception of those that are RH specific or printk related - see below). Besides the printk rework, the OOT patches are all mainly fixups and Kconfig enablement, since the basic PREEMPT_RT locking changes have been in place since the 5.17 upstream kernel (and in RHEL since 9.1).

Main JIRA ticket for this effort: https://issues.redhat.com/browse/RHELPLAN-130897

A more detailed patchset description follows:

redhat/ specific changes - 3

redhat: Add kernel-rt configs
redhat: Build aarch64 kernel-rt
redhat: Build kernel-rt as kernel variant

RT specific changes - 31 (rearranged for clarity in this description)

- make i915 work with RT
 
  Revert "drm/i915: Depend on !PREEMPT_RT."
  drm/i915: Drop the irqs_disabled() check
  drm/i915/gt: Use spin_lock_irq() instead of local_irq_disable() + spin_lock()
  drm/i915/gt: Queue and wait for the irq_work item.
  drm/i915: skip DRM_I915_LOW_LEVEL_TRACEPOINTS with NOTRACE
  drm/i915: Disable tracing points on PREEMPT_RT
  drm/i915: Don't check for atomic context on PREEMPT_RT
  drm/i915: Don't disable interrupts on PREEMPT_RT during atomic updates
  drm/i915: Use preempt_disable/enable_rt() where recommended 

- misc

  sysfs: Add /sys/kernel/realtime entry
  locking/lockdep: Remove lockdep_init_map_crosslock.
  iio: adc: stm32-adc: Use generic_handle_domain_irq()
  zram: Replace bit spinlocks with spinlock_t for PREEMPT_RT.
  rcutorture: Also force sched priority to timersd on boosting test.

- enable RT on x86_64 and aarch64

  ARM64: Allow to enable RT
  x86: Allow to enable RT

- make printk work with RT

  tty/serial/pl011: Make the locking work on RT
  tty/serial/omap: Make the locking RT aware
  printk: avoid preempt_disable() for PREEMPT_RT
  serial: 8250: implement write_atomic
  printk: add infrastucture for atomic consoles
  printk: Bring back the RT bits.

- lazy preemption
  
  arch/arm64: Add lazy preempt support
  entry: Fix the preempt lazy fallout
  x86: Support for lazy preemption
  x86/entry: Use should_resched() in idtentry_exit_cond_resched()
  sched: Add support for lazy preemption

- sched/tick/timers

  tick: Fix timer storm since introduction of timersd
  softirq: Use a dedicated thread for timer wakeups.
  sched: Consider task_struct::saved_state in wait_task_inactive().
  signal: Don't disable preemption in ptrace_stop() on PREEMPT_RT.

Dependencies - from upstream (already planned for 9.2+ or to be planned for 9.3) - 30

u64_stats: Streamline the implementation
mm/compaction: Get rid of RT ifdeffery
mm/memcontrol: Replace the PREEMPT_RT conditionals
mm/debug: Provide VM_WARN_ON_IRQS_ENABLED()
mm/vmstat: Use preempt_[dis|en]able_nested()
dentry: Use preempt_[dis|en]able_nested()
preempt: Provide preempt_[dis|en]able_nested()
u64_stats: Disable preemption on 32bit UP+SMP PREEMPT_RT during updates.
net: Use u64_stats_fetch_begin_irq() for stats fetch.
net: dsa: xrs700x: Use irqsave variant for u64 stats update
bcma: gpio: Use generic_handle_irq_safe()
platform/x86: intel_int0002_vgpio: Use generic_handle_irq_safe()
ssb: gpio: Use generic_handle_irq_safe()
pinctrl: amd: Use generic_handle_irq_safe()
genirq: Provide generic_handle_domain_irq_safe().
asm-generic: Conditionally enable do_softirq_own_stack() via Kconfig.
slub: Make PREEMPT_RT support less convoluted
mm/slub: simplify __cmpxchg_double_slab() and slab_[un]lock()
mm/slub: convert object_map_lock to non-raw spinlock
mm/slub: remove slab_lock() usage for debug operations
mm/slub: restrict sysfs validation to debug caches and make it safe
mm/slub: move free_debug_processing() further
arch/*: Disable softirq stacks on PREEMPT_RT.
tools/testing/scatterlist: add missing defines
mm/scatterlist: replace the !preemptible warning in sg_miter_stop()
mm/vmalloc: use raw_cpu_ptr() for vmap_block_queue access
arm64: mm: Make arch_faults_on_old_pte() check for migratability
arm64/sve: Move sve_free() into SVE code section
arm64/sve: Make kernel FPU protection RT friendly
arm64/sve: Delay freeing memory in fpsimd_flush_thread()

Signed-off-by: Juri Lelli juri.lelli@redhat.com

Edited by Juri Lelli

Merge request reports