From 08f003891b84f52e49a5bdbc8a589fb052ac9a4e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 8 May 2024 05:22:37 +0200 Subject: Merging debian version 4.19.260-1. Signed-off-by: Daniel Baumann --- ...01-ARM-at91-add-TCB-registers-definitions.patch | 8 +- ...-drivers-Add-a-new-driver-for-the-Atmel-A.patch | 8 +- ...-drivers-timer-atmel-tcb-add-clockevent-d.patch | 8 +- ...urce-drivers-atmel-pit-make-option-silent.patch | 8 +- ...-ARM-at91-Implement-clocksource-selection.patch | 8 +- ...ARM-configs-at91-use-new-TCB-timer-driver.patch | 8 +- .../0007-ARM-configs-at91-unselect-PIT.patch | 8 +- ...-v3-its-Move-pending-table-allocation-to-.patch | 8 +- ...hread-convert-worker-lock-to-raw-spinlock.patch | 8 +- ...o-caam-qi-simplify-CGR-allocation-freeing.patch | 8 +- ...air-Robustify-CFS-bandwidth-timer-locking.patch | 8 +- .../0012-arm-Convert-arm-boot_lock-to-raw.patch | 8 +- ...Don-t-let-setaffinity-unmask-threaded-EOI.patch | 8 +- ...-use-irqsave-in-cgroup_rstat_flush_locked.patch | 8 +- ...nitialize-cookie-hash-table-raw-spinlocks.patch | 8 +- ...-hv-vmbus-include-header-for-get_irq_regs.patch | 8 +- ...include-irqflags.h-for-raw_local_irq_save.patch | 8 +- debian/patches-rt/0018-efi-Allow-efi-runtime.patch | 8 +- ...x86-efi-drop-task_lock-from-efi_switch_mm.patch | 8 +- ...ompute_layout-before-altenates-are-applie.patch | 8 +- ...-free-phandle-cache-outside-of-the-devtre.patch | 8 +- ...san-make-quarantine_lock-a-raw_spinlock_t.patch | 8 +- ...ert-expedited-GP-parallelization-cleverne.patch | 8 +- ...-Turn-kmemleak_lock-to-raw-spinlock-on-RT.patch | 8 +- ...NFSv4-replace-seqcount_t-with-a-seqlock_t.patch | 10 +- ...d-Provide-a-pointer-to-the-valid-CPU-mask.patch | 10 +- ...027-kernel-sched-core-add-migrate_disable.patch | 8 +- ...te_disable-Add-export_symbol_gpl-for-__mi.patch | 8 +- ...t91-do-not-disable-enable-clocks-in-a-row.patch | 8 +- ...-TCLIB-Allow-higher-clock-rates-for-clock.patch | 8 +- .../0031-timekeeping-Split-jiffies-seqlock.patch | 12 +- .../0032-signal-Revert-ptrace-preempt-magic.patch | 10 +- ...033-net-sched-Use-msleep-instead-of-yield.patch | 12 +- ...4-dm-rq-remove-BUG_ON-irqs_disabled-check.patch | 8 +- ...-usb-do-no-disable-interrupts-in-giveback.patch | 8 +- ...-rt-Provide-PREEMPT_RT_BASE-config-switch.patch | 8 +- ...sk-Disable-CONFIG_CPUMASK_OFFSTACK-for-RT.patch | 8 +- ...ump-label-disable-if-stop_machine-is-used.patch | 8 +- ...able-config-options-which-are-not-RT-comp.patch | 8 +- .../0040-lockdep-disable-self-test.patch | 10 +- .../patches-rt/0041-mm-Allow-only-slub-on-RT.patch | 8 +- ...0042-locking-Disable-spin-on-owner-for-RT.patch | 8 +- .../0043-rcu-Disable-RCU_FAST_NO_HZ-on-RT.patch | 8 +- .../0044-rcu-make-RCU_BOOST-default-on-RT.patch | 8 +- ...sched-Disable-CONFIG_RT_GROUP_SCHED-on-RT.patch | 8 +- .../0046-net-core-disable-NET_RX_BUSY_POLL.patch | 8 +- .../0047-arm-disable-NEON-in-kernel-mode.patch | 8 +- .../0048-powerpc-Use-generic-rwsem-on-RT.patch | 8 +- ...-Disable-in-kernel-MPIC-emulation-for-PRE.patch | 8 +- .../0050-powerpc-Disable-highmem-on-RT.patch | 8 +- .../0051-mips-Disable-highmem-on-RT.patch | 8 +- ...052-x86-Use-generic-rwsem_spinlocks-on-rt.patch | 8 +- ...53-leds-trigger-disable-CPU-trigger-on-RT.patch | 8 +- ...req-drop-K8-s-driver-from-beeing-selected.patch | 8 +- debian/patches-rt/0055-md-disable-bcache.patch | 8 +- .../0056-efi-Disable-runtime-services-on-RT.patch | 8 +- .../0057-printk-Add-a-printk-kill-switch.patch | 8 +- ...force_early_printk-boot-param-to-help-wit.patch | 8 +- ...preempt-Provide-preempt_-_-no-rt-variants.patch | 8 +- ...round-migrate_disable-enable-in-different.patch | 8 +- .../patches-rt/0061-rt-Add-local-irq-locks.patch | 8 +- ...lock-provide-get-put-_locked_ptr-variants.patch | 8 +- ...-mm-scatterlist-Do-not-disable-irqs-on-RT.patch | 8 +- ...ignal-x86-Delay-calling-signals-in-atomic.patch | 10 +- ...x86-signal-delay-calling-signals-on-32bit.patch | 8 +- ...ffer_head-Replace-bh_uptodate_lock-for-rt.patch | 8 +- ...-Make-state-lock-and-journal-head-lock-rt.patch | 8 +- ...68-list_bl-Make-list-head-locking-RT-safe.patch | 8 +- .../0069-list_bl-fixup-bogus-lockdep-warning.patch | 8 +- .../0070-genirq-Disable-irqpoll-on-rt.patch | 8 +- .../0071-genirq-Force-interrupt-thread-on-RT.patch | 8 +- ...ff-and-zone-lock-while-freeing-pages-from.patch | 8 +- ...ff-and-zone-lock-while-freeing-pages-from.patch | 8 +- ...m-SLxB-change-list_lock-to-raw_spinlock_t.patch | 16 +- ...ay-giving-back-empty-slubs-to-IRQ-enabled.patch | 16 +- ...6-mm-page_alloc-rt-friendly-per-cpu-pages.patch | 8 +- .../0077-mm-swap-Convert-to-percpu-locked.patch | 8 +- ...078-mm-perform-lru_add_drain_all-remotely.patch | 8 +- ...rotect-per-cpu-variables-with-preempt-dis.patch | 8 +- ...ize-split-page-table-locks-for-vector-pag.patch | 8 +- debian/patches-rt/0081-mm-Enable-SLUB-for-RT.patch | 10 +- .../0082-slub-Enable-irqs-for-__GFP_WAIT.patch | 10 +- .../0083-slub-Disable-SLUB_CPU_PARTIAL.patch | 8 +- ...ol-Don-t-call-schedule_work_on-in-preempt.patch | 8 +- ...ol-Replace-local_irq_disable-with-local-l.patch | 8 +- ...smalloc-copy-with-get_cpu_var-and-locking.patch | 8 +- ...disable-preemption-__split_large_page-aft.patch | 8 +- .../0088-radix-tree-use-local-locks.patch | 8 +- .../0089-timers-Prepare-for-full-preemption.patch | 8 +- .../0090-x86-kvm-Require-const-tsc-for-RT.patch | 12 +- ...itchtec-Don-t-use-completion-s-wait-queue.patch | 8 +- .../patches-rt/0092-wait.h-include-atomic.h.patch | 8 +- ...rk-simple-Simple-work-queue-implemenation.patch | 8 +- ...-drop-a-shit-statement-in-SWORK_EVENT_PEN.patch | 8 +- .../0095-completion-Use-simple-wait-queues.patch | 8 +- .../0096-fs-aio-simple-simple-work.patch | 8 +- ...r-avoid-schedule_work-with-interrupts-dis.patch | 8 +- ...solidate-hrtimer_init-hrtimer_init_sleepe.patch | 8 +- .../0099-hrtimers-Prepare-full-preemption.patch | 8 +- ...timers-by-default-into-the-softirq-contex.patch | 10 +- ...hed-fair-Make-the-hrtimers-non-hard-again.patch | 8 +- ...-Move-schedule_work-call-to-helper-thread.patch | 8 +- ...e-state-change-before-hrtimer_cancel-in-d.patch | 8 +- ...osix-timers-Thread-posix-cpu-timers-on-rt.patch | 8 +- ...105-sched-Move-task_struct-cleanup-to-RCU.patch | 8 +- ...t-the-number-of-task-migrations-per-batch.patch | 8 +- .../0107-sched-Move-mmdrop-to-RCU-on-RT.patch | 8 +- ...d-move-stack-kprobe-clean-up-to-__put_tas.patch | 8 +- ...aved_state-for-tasks-blocked-on-sleeping-.patch | 8 +- ...t-account-rcu_preempt_depth-on-RT-in-migh.patch | 8 +- ...e-the-proper-LOCK_OFFSET-for-cond_resched.patch | 8 +- .../0112-sched-Disable-TTWU_QUEUE-on-RT.patch | 8 +- ...ueue-Only-wake-up-idle-workers-if-not-blo.patch | 8 +- ...-decrease-the-nr-of-migratory-tasks-when-.patch | 8 +- .../0115-hotplug-Lightweight-get-online-cpus.patch | 18 +- ...igrate-disabled-counter-to-tracing-output.patch | 10 +- .../patches-rt/0117-lockdep-Make-it-RT-aware.patch | 8 +- ...vent-tasklets-from-going-into-infinite-sp.patch | 8 +- ...ck-preemption-after-reenabling-interrupts.patch | 8 +- ...120-softirq-Disable-softirq-stacks-for-RT.patch | 8 +- .../0121-softirq-Split-softirq-locks.patch | 12 +- ...-core-use-local_bh_disable-in-netif_rx_ni.patch | 8 +- ...w-disabling-of-softirq-processing-in-irq-.patch | 8 +- ...irq-split-timer-softirqs-out-of-ksoftirqd.patch | 8 +- ...id-local_softirq_pending-messages-if-ksof.patch | 8 +- ...id-local_softirq_pending-messages-if-task.patch | 8 +- .../0127-rtmutex-trylock-is-okay-on-RT.patch | 8 +- ...28-fs-nfs-turn-rmdir_sem-into-a-semaphore.patch | 8 +- ...dle-the-various-new-futex-race-conditions.patch | 8 +- ...-bug-on-when-a-requeued-RT-task-times-out.patch | 8 +- ...e-lock-unlock-symetry-versus-pi_lock-and-.patch | 8 +- .../patches-rt/0132-pid.h-include-atomic.h.patch | 8 +- ...0133-arm-include-definition-for-cpumask_t.patch | 8 +- ...ktorture-Do-NOT-include-rwlock.h-directly.patch | 8 +- .../0135-rtmutex-Add-rtmutex_lock_killable.patch | 8 +- .../0136-rtmutex-Make-lock_killable-work.patch | 8 +- ...0137-spinlock-Split-the-lock-types-header.patch | 8 +- .../0138-rtmutex-Avoid-include-hell.patch | 8 +- .../0139-rbtree-don-t-include-the-rcu-header.patch | 8 +- ...-rtmutex-Provide-rt_mutex_slowlock_locked.patch | 8 +- ...ort-lockdep-less-version-of-rt_mutex-s-lo.patch | 8 +- ...-rtmutex-add-sleeping-lock-implementation.patch | 8 +- ...add-mutex-implementation-based-on-rtmutex.patch | 8 +- ...add-rwsem-implementation-based-on-rtmutex.patch | 8 +- ...dd-rwlock-implementation-based-on-rtmutex.patch | 8 +- ...wlock-preserve-state-like-a-sleeping-lock.patch | 8 +- .../0147-rtmutex-wire-up-RT-s-locking.patch | 8 +- ...8-rtmutex-add-ww_mutex-addon-for-mutex-rt.patch | 8 +- .../0149-kconfig-Add-PREEMPT_RT_FULL.patch | 8 +- ...mutex-fix-deadlock-in-device-mapper-block.patch | 8 +- ...-rt-mutex-Flush-block-plug-on-__down_read.patch | 8 +- ...utex-re-init-the-wait_lock-in-rt_mutex_in.patch | 8 +- ...3-ptrace-fix-ptrace-vs-tasklist_lock-race.patch | 10 +- ...54-rtmutex-annotate-sleeping-lock-context.patch | 8 +- ...te_disable-fallback-to-preempt_disable-in.patch | 8 +- ...-t-check-for-__LINUX_SPINLOCK_TYPES_H-on-.patch | 8 +- debian/patches-rt/0157-rcu-Frob-softirq-test.patch | 8 +- .../0158-rcu-Merge-RCU-bh-into-RCU-preempt.patch | 8 +- ...cu-Make-ksoftirqd-do-RCU-quiescent-states.patch | 8 +- ...Eliminate-softirq-processing-from-rcutree.patch | 8 +- ...-srcu-use-cpu_online-instead-custom-check.patch | 8 +- ...cu-replace-local_irqsave-with-a-locallock.patch | 8 +- ...e-rcu_normal_after_boot-by-default-for-RT.patch | 8 +- ...tty-serial-omap-Make-the-locking-RT-aware.patch | 8 +- ...-serial-pl011-Make-the-locking-work-on-RT.patch | 14 +- ...pl011-explicitly-initialize-the-flags-var.patch | 12 +- ...-rt-Improve-the-serial-console-PASS_LIMIT.patch | 8 +- ...l-8250-don-t-take-the-trylock-during-oops.patch | 12 +- ...cpu-rwsem-Remove-preempt_disable-variants.patch | 8 +- ...activate_mm-by-preempt_-disable-enable-_r.patch | 8 +- ...ring-back-explicit-INIT_HLIST_BL_HEAD-ini.patch | 8 +- ...isable-preemption-on-i_dir_seq-s-write-si.patch | 8 +- ...ke-use-of-local-lock-in-multi_cpu-decompr.patch | 8 +- ...4-thermal-Defer-thermal-wakups-to-threads.patch | 8 +- ...isable-preemption-around-local_bh_disable.patch | 8 +- ...-fs-epoll-Do-not-disable-preemption-on-RT.patch | 8 +- ...Another-preempt-disable-region-which-suck.patch | 8 +- .../patches-rt/0178-block-mq-use-cpu_light.patch | 8 +- ...79-block-mq-do-not-invoke-preempt_disable.patch | 8 +- ...-block-mq-don-t-complete-requests-via-IPI.patch | 8 +- ...raid5-Make-raid5_percpu-handling-RT-aware.patch | 10 +- .../patches-rt/0182-rt-Introduce-cpu_chill.patch | 8 +- ...183-hrtimer-Don-t-lose-state-in-cpu_chill.patch | 8 +- ...-cpu_chill-save-task-state-in-saved_state.patch | 8 +- ...q-move-blk_queue_usage_counter_release-in.patch | 8 +- .../0186-block-Use-cpu_chill-for-retry-loops.patch | 8 +- ...-fs-dcache-Use-cpu_chill-in-trylock-loops.patch | 8 +- ...88-net-Use-cpu_chill-instead-of-cpu_relax.patch | 8 +- ...ache-use-swait_queue-instead-of-waitqueue.patch | 8 +- .../patches-rt/0190-workqueue-Use-normal-rcu.patch | 8 +- ...se-local-irq-lock-instead-of-irq-disable-.patch | 8 +- ...revent-workqueue-versus-ata-piix-livelock.patch | 8 +- ...d-Distangle-worker-accounting-from-rqlock.patch | 8 +- .../0194-debugobjects-Make-RT-aware.patch | 8 +- .../0195-seqlock-Prevent-rt-starvation.patch | 8 +- ...ake-svc_xprt_do_enqueue-use-get_cpu_light.patch | 8 +- .../0197-net-Use-skbufhead-with-raw-lock.patch | 31 +- ...xmit_recursion-to-per-task-variable-on-RT.patch | 8 +- ...-a-way-to-delegate-processing-a-softirq-t.patch | 8 +- ...ays-take-qdisc-s-busylock-in-__dev_xmit_s.patch | 8 +- ...-net-Qdisc-use-a-seqlock-instead-seqcount.patch | 10 +- ...k-the-missing-serialization-in-ip_send_un.patch | 10 +- .../0203-net-add-a-lock-around-icmp_sk.patch | 10 +- ...napi_schedule_irqoff-disable-interrupts-o.patch | 8 +- ...qwork-push-most-work-into-softirq-context.patch | 8 +- debian/patches-rt/0206-printk-Make-rt-aware.patch | 8 +- ...tk-Don-t-try-to-print-from-IRQ-NMI-region.patch | 8 +- ...08-printk-Drop-the-logbuf_lock-more-often.patch | 8 +- ...irq-in-translation-section-permission-fau.patch | 8 +- ...pdate-irq_set_irqchip_state-documentation.patch | 8 +- ...64-downgrade-preempt_disable-d-region-to-.patch | 8 +- ...d-use-preemp_disable-in-addition-to-local.patch | 8 +- .../0213-kgdb-serial-Short-term-workaround.patch | 12 +- .../0214-sysfs-Add-sys-kernel-realtime-entry.patch | 8 +- .../0215-mm-rt-kmap_atomic-scheduling.patch | 8 +- ...-x86-highmem-Add-a-already-used-pte-check.patch | 8 +- .../0217-arm-highmem-Flush-tlb-on-unmap.patch | 8 +- .../0218-arm-Enable-highmem-for-rt.patch | 8 +- .../patches-rt/0219-scsi-fcoe-Make-RT-aware.patch | 10 +- ...86-crypto-Reduce-preempt-disabled-regions.patch | 8 +- ...educe-preempt-disabled-regions-more-algos.patch | 8 +- ...22-crypto-limit-more-FPU-enabled-sections.patch | 8 +- ...press-serialize-RT-percpu-scratch-buffer-.patch | 8 +- ...td-add-a-lock-instead-preempt_disable-loc.patch | 8 +- ...get_random_bytes-for-RT_FULL-in-init_oops.patch | 8 +- ...86-stackprotector-Avoid-random-pool-on-rt.patch | 8 +- .../0227-cpu-hotplug-Implement-CPU-pinning.patch | 113 ++ .../0228-cpu-hotplug-Implement-CPU-pinning.patch | 117 -- ...-pinned-user-tasks-to-be-awakened-to-the-.patch | 35 + ...plug-duct-tape-RT-rwlock-usage-for-non-RT.patch | 98 ++ ...-pinned-user-tasks-to-be-awakened-to-the-.patch | 39 - ...plug-duct-tape-RT-rwlock-usage-for-non-RT.patch | 102 -- ...t-Remove-preemption-disabling-in-netif_rx.patch | 67 + ...nother-local_irq_disable-kmalloc-headache.patch | 61 + ...t-Remove-preemption-disabling-in-netif_rx.patch | 71 - ...nother-local_irq_disable-kmalloc-headache.patch | 65 - ...otect-users-of-napi_alloc_cache-against-r.patch | 111 ++ ...otect-users-of-napi_alloc_cache-against-r.patch | 115 -- ...er-Serialize-xt_write_recseq-sections-on-.patch | 80 ++ ...ftest-Only-do-hardirq-context-test-for-ra.patch | 58 + ...er-Serialize-xt_write_recseq-sections-on-.patch | 84 -- ...ftest-Only-do-hardirq-context-test-for-ra.patch | 62 - ...ftest-fix-warnings-due-to-missing-PREEMPT.patch | 145 ++ ...ftest-fix-warnings-due-to-missing-PREEMPT.patch | 149 -- ...236-sched-Add-support-for-lazy-preemption.patch | 667 +++++++++ .../0237-ftrace-Fix-trace-header-alignment.patch | 48 + ...237-sched-Add-support-for-lazy-preemption.patch | 671 --------- .../0238-ftrace-Fix-trace-header-alignment.patch | 52 - .../0238-x86-Support-for-lazy-preemption.patch | 236 ++++ .../0239-x86-Support-for-lazy-preemption.patch | 240 ---- ...eempt-properly-check-against-preempt-mask.patch | 29 + ...eempt-properly-check-against-preempt-mask.patch | 33 - ...eempt-use-proper-return-label-on-32bit-x8.patch | 41 + .../0241-arm-Add-support-for-lazy-preemption.patch | 164 +++ ...eempt-use-proper-return-label-on-32bit-x8.patch | 45 - .../0242-arm-Add-support-for-lazy-preemption.patch | 168 --- ...2-powerpc-Add-support-for-lazy-preemption.patch | 192 +++ .../0243-arch-arm64-Add-lazy-preempt-support.patch | 129 ++ ...3-powerpc-Add-support-for-lazy-preemption.patch | 196 --- .../0244-arch-arm64-Add-lazy-preempt-support.patch | 133 -- ...n_proc-Protect-send_msg-with-a-local-lock.patch | 70 + ...n_proc-Protect-send_msg-with-a-local-lock.patch | 74 - ...ck-zram-Replace-bit-spinlocks-with-rtmute.patch | 100 ++ ...ck-zram-Replace-bit-spinlocks-with-rtmute.patch | 104 -- ...m-Don-t-disable-preemption-in-zcomp_strea.patch | 103 ++ ...m-Don-t-disable-preemption-in-zcomp_strea.patch | 107 -- ...m-fix-zcomp_stream_get-smp_processor_id-u.patch | 40 + ...m-fix-zcomp_stream_get-smp_processor_id-u.patch | 44 - .../0248-tpm_tis-fix-stall-after-iowrite-s.patch | 80 ++ .../0249-tpm_tis-fix-stall-after-iowrite-s.patch | 84 -- ...revent-deferral-of-watchdogd-wakeup-on-RT.patch | 77 + ...i915-Use-preempt_disable-enable_rt-where-.patch | 57 + ...revent-deferral-of-watchdogd-wakeup-on-RT.patch | 81 -- ...e-local_lock-unlock_irq-in-intel_pipe_upd.patch | 124 ++ ...i915-Use-preempt_disable-enable_rt-where-.patch | 61 - ...e-local_lock-unlock_irq-in-intel_pipe_upd.patch | 128 -- .../0252-drm-i915-disable-tracing-on-RT.patch | 43 + .../0253-drm-i915-disable-tracing-on-RT.patch | 47 - ...ip-DRM_I915_LOW_LEVEL_TRACEPOINTS-with-NO.patch | 29 + ...54-cgroups-use-simple-wait-in-css_release.patch | 91 ++ ...ip-DRM_I915_LOW_LEVEL_TRACEPOINTS-with-NO.patch | 33 - ...55-cgroups-use-simple-wait-in-css_release.patch | 95 -- ...t-Convert-callback_lock-to-raw_spinlock_t.patch | 289 ++++ ...r-use-a-locallock-instead-preempt_disable.patch | 81 ++ ...t-Convert-callback_lock-to-raw_spinlock_t.patch | 293 ---- ...r-use-a-locallock-instead-preempt_disable.patch | 85 -- ...57-workqueue-Prevent-deadlock-stall-on-RT.patch | 203 +++ ...low-rt-tasks-to-cache-one-sigqueue-struct.patch | 209 +++ ...58-workqueue-Prevent-deadlock-stall-on-RT.patch | 207 --- .../0259-Add-localversion-for-RT-release.patch | 18 + ...low-rt-tasks-to-cache-one-sigqueue-struct.patch | 213 --- .../0260-Add-localversion-for-RT-release.patch | 22 - ...ries-iommu-Use-a-locallock-instead-local_.patch | 93 ++ ...ries-iommu-Use-a-locallock-instead-local_.patch | 97 -- .../0261-powerpc-reshuffle-TIF-bits.patch | 148 ++ .../0262-powerpc-reshuffle-TIF-bits.patch | 152 -- ...sysrq-Convert-show_lock-to-raw_spinlock_t.patch | 59 + ...n-t-disable-interrupts-independently-of-t.patch | 47 + ...sysrq-Convert-show_lock-to-raw_spinlock_t.patch | 63 - ...n-t-disable-interrupts-independently-of-t.patch | 51 - ...etion-Fix-a-lockup-in-wait_for_completion.patch | 65 + .../0265-kthread-add-a-global-worker-thread.patch | 176 +++ ...etion-Fix-a-lockup-in-wait_for_completion.patch | 69 - .../0266-arm-imx6-cpuidle-Use-raw_spinlock_t.patch | 48 + .../0266-kthread-add-a-global-worker-thread.patch | 180 --- .../0267-arm-imx6-cpuidle-Use-raw_spinlock_t.patch | 52 - ...llow-to-change-rcu_normal_after_boot-on-R.patch | 32 + ...-switchtec-fix-stream_open.cocci-warnings.patch | 36 + ...llow-to-change-rcu_normal_after_boot-on-R.patch | 36 - ...-switchtec-fix-stream_open.cocci-warnings.patch | 40 - ...-core-Drop-a-preempt_disable_rt-statement.patch | 46 + ...-core-Drop-a-preempt_disable_rt-statement.patch | 50 - ...-the-notification-of-canceling-timers-on-.patch | 646 +++++++++ ...x-Ensure-lock-unlock-symetry-versus-pi_lo.patch | 31 + ...-the-notification-of-canceling-timers-on-.patch | 650 --------- ...x-Ensure-lock-unlock-symetry-versus-pi_lo.patch | 35 - ...x-Fix-bug-on-when-a-requeued-RT-task-time.patch | 79 ++ ...x-Fix-bug-on-when-a-requeued-RT-task-time.patch | 83 -- ...tex-Handle-the-various-new-futex-race-con.patch | 245 ++++ ...x-workaround-migrate_disable-enable-in-di.patch | 66 + ...tex-Handle-the-various-new-futex-race-con.patch | 249 ---- ...x-workaround-migrate_disable-enable-in-di.patch | 70 - ...futex-Make-the-futex_hash_bucket-lock-raw.patch | 336 +++++ ...0276-futex-Delay-deallocation-of-pi_state.patch | 178 +++ ...futex-Make-the-futex_hash_bucket-lock-raw.patch | 340 ----- ...0277-futex-Delay-deallocation-of-pi_state.patch | 182 --- ...-not-disable-preemption-in-zswap_frontswa.patch | 123 ++ ...-not-disable-preemption-in-zswap_frontswa.patch | 127 -- debian/patches-rt/0278-revert-aio.patch | 67 + .../0279-fs-aio-simple-simple-work.patch | 72 + debian/patches-rt/0279-revert-aio.patch | 71 - .../0280-fs-aio-simple-simple-work.patch | 76 - debian/patches-rt/0280-revert-thermal.patch | 116 ++ debian/patches-rt/0281-revert-thermal.patch | 120 -- ...1-thermal-Defer-thermal-wakups-to-threads.patch | 94 ++ debian/patches-rt/0282-revert-block.patch | 79 ++ ...2-thermal-Defer-thermal-wakups-to-threads.patch | 98 -- ...q-move-blk_queue_usage_counter_release-in.patch | 110 ++ debian/patches-rt/0283-revert-block.patch | 83 -- ...q-move-blk_queue_usage_counter_release-in.patch | 114 -- debian/patches-rt/0284-workqueue-rework.patch | 1460 +++++++++++++++++++ .../0285-i2c-exynos5-Remove-IRQF_ONESHOT.patch | 44 + debian/patches-rt/0285-workqueue-rework.patch | 1464 -------------------- .../0286-i2c-exynos5-Remove-IRQF_ONESHOT.patch | 48 - .../0286-i2c-hix5hd2-Remove-IRQF_ONESHOT.patch | 38 + .../0287-i2c-hix5hd2-Remove-IRQF_ONESHOT.patch | 42 - ...ine-Ensure-inactive_timer-runs-in-hardirq.patch | 46 + ...ine-Ensure-inactive_timer-runs-in-hardirq.patch | 50 - ..._pkg_temp-make-pkg_temp_lock-a-raw-spinlo.patch | 116 ++ ...e-seqlock_t-instread-disabling-preemption.patch | 292 ++++ ..._pkg_temp-make-pkg_temp_lock-a-raw-spinlo.patch | 120 -- ...64-Let-the-timer-expire-in-hardirq-contex.patch | 50 + ...e-seqlock_t-instread-disabling-preemption.patch | 296 ---- ...64-Let-the-timer-expire-in-hardirq-contex.patch | 54 - ...-Check-preemption-level-before-looking-at.patch | 30 + ...-READ_ONCE-to-access-timer-base-in-hrimer.patch | 38 + ...-Check-preemption-level-before-looking-at.patch | 34 - ...-t-grab-the-expiry-lock-for-non-soft-hrti.patch | 37 + ...-READ_ONCE-to-access-timer-base-in-hrimer.patch | 42 - ...-t-grab-the-expiry-lock-for-non-soft-hrti.patch | 41 - ...vent-using-hrtimer_grab_expiry_lock-on-mi.patch | 39 + ...-a-missing-bracket-and-hide-migration_bas.patch | 71 + ...vent-using-hrtimer_grab_expiry_lock-on-mi.patch | 43 - ...-a-missing-bracket-and-hide-migration_bas.patch | 75 - ...rs-Unlock-expiry-lock-in-the-early-return.patch | 37 + ...rs-Unlock-expiry-lock-in-the-early-return.patch | 41 - ...te_dis-enable-Use-sleeping_lock-to-annota.patch | 54 + ..._cpus_allowed_ptr-Check-cpus_mask-not-cpu.patch | 35 + ...te_dis-enable-Use-sleeping_lock-to-annota.patch | 58 - ...ched-Remove-dead-__migrate_disabled-check.patch | 35 + ..._cpus_allowed_ptr-Check-cpus_mask-not-cpu.patch | 39 - ...ched-Remove-dead-__migrate_disabled-check.patch | 39 - ...igrate-disable-Protect-cpus_ptr-with-lock.patch | 43 + ...-smp_processor_id-Don-t-use-cpumask_equal.patch | 41 + ...igrate-disable-Protect-cpus_ptr-with-lock.patch | 47 - ...the-futex_hash_bucket-spinlock_t-again-an.patch | 731 ++++++++++ ...-smp_processor_id-Don-t-use-cpumask_equal.patch | 45 - ...the-futex_hash_bucket-spinlock_t-again-an.patch | 735 ---------- ...utex-Clean-pi_blocked_on-in-the-error-cas.patch | 98 ++ ...304-lib-ubsan-Don-t-seralize-UBSAN-report.patch | 304 ++++ ...utex-Clean-pi_blocked_on-in-the-error-cas.patch | 102 -- ...ange-the-lock-of-kmemleak_object-to-raw_s.patch | 289 ++++ ...305-lib-ubsan-Don-t-seralize-UBSAN-report.patch | 308 ---- ...ange-the-lock-of-kmemleak_object-to-raw_s.patch | 293 ---- ...hed-migrate_enable-Use-select_fallback_rq.patch | 62 + ...307-sched-Lazy-migrate_disable-processing.patch | 612 ++++++++ ...hed-migrate_enable-Use-select_fallback_rq.patch | 66 - ...308-sched-Lazy-migrate_disable-processing.patch | 616 -------- ...ed-migrate_enable-Use-stop_one_cpu_nowait.patch | 117 ++ ...Initialize-split-page-table-locks-for-vec.patch | 83 ++ ...ed-migrate_enable-Use-stop_one_cpu_nowait.patch | 121 -- ...Initialize-split-page-table-locks-for-vec.patch | 87 -- ...e-spinlock_t-and-rwlock_t-a-RCU-section-o.patch | 125 ++ ...e-spinlock_t-and-rwlock_t-a-RCU-section-o.patch | 129 -- ...migrate_enable-must-access-takedown_cpu_t.patch | 51 + ...cessor_id-Adjust-check_preemption_disable.patch | 37 + ...migrate_enable-must-access-takedown_cpu_t.patch | 55 - ...cessor_id-Adjust-check_preemption_disable.patch | 41 - ...te_enable-Busy-loop-until-the-migration-r.patch | 53 + ...te_enable-Busy-loop-until-the-migration-r.patch | 57 - ...faultfd-Use-a-seqlock-instead-of-seqcount.patch | 76 + ...-migrate_enable-Use-per-cpu-cpu_stop_work.patch | 79 ++ ...faultfd-Use-a-seqlock-instead-of-seqcount.patch | 80 -- ...hed-migrate_enable-Remove-__schedule-call.patch | 37 + ...-migrate_enable-Use-per-cpu-cpu_stop_work.patch | 83 -- ...ol-Move-misplaced-local_unlock_irqrestore.patch | 38 + ...hed-migrate_enable-Remove-__schedule-call.patch | 41 - ...lock-Include-header-for-the-current-macro.patch | 28 + ...ol-Move-misplaced-local_unlock_irqrestore.patch | 42 - ...Drop-preempt_disable-in-vmw_fifo_ping_hos.patch | 41 + ...lock-Include-header-for-the-current-macro.patch | 32 - ...Drop-preempt_disable-in-vmw_fifo_ping_hos.patch | 45 - ...e-preempt_lazy-and-migrate_disable-counte.patch | 52 + ...emove-flags-parameter-from-calls-to-ubsan.patch | 53 + ...e-preempt_lazy-and-migrate_disable-counte.patch | 56 - ...x-checking-of-IRQ_WORK_LAZY-flag-set-on-n.patch | 68 + ...emove-flags-parameter-from-calls-to-ubsan.patch | 57 - ...x-checking-of-IRQ_WORK_LAZY-flag-set-on-n.patch | 72 - ...ddress-a-race-resulting-in-double-enqueue.patch | 116 ++ ...-logic-for-when-grabbing-softirq_expiry_l.patch | 46 + ...ddress-a-race-resulting-in-double-enqueue.patch | 120 -- .../0325-fs-dcache-Include-swait.h-header.patch | 32 + ...-logic-for-when-grabbing-softirq_expiry_l.patch | 50 - .../0326-fs-dcache-Include-swait.h-header.patch | 36 - ...ays-flush-the-delayed-empty-slubs-in-flus.patch | 60 + ...ays-flush-the-delayed-empty-slubs-in-flus.patch | 64 - ...let-Fix-UP-case-for-tasklet-CHAINED-state.patch | 52 + ...signal-Prevent-double-free-of-user-struct.patch | 51 + ...let-Fix-UP-case-for-tasklet-CHAINED-state.patch | 56 - ...cquire-sk_lock.slock-without-disabling-in.patch | 61 + ...signal-Prevent-double-free-of-user-struct.patch | 55 - ...cquire-sk_lock.slock-without-disabling-in.patch | 65 - ...-net-phy-fixed_phy-Remove-unused-seqcount.patch | 85 ++ ...-net-phy-fixed_phy-Remove-unused-seqcount.patch | 89 -- ...-fix-compress-vs-decompress-serialization.patch | 98 ++ ...ol-Disable-preemption-in-__mod_memcg_lruv.patch | 46 + ...-fix-compress-vs-decompress-serialization.patch | 102 -- ...ol-Disable-preemption-in-__mod_memcg_lruv.patch | 50 - ...-ptrace_unfreeze_traced-race-with-rt-lock.patch | 64 + ...-t-resize-the-location-tracking-cache-on-.patch | 34 + ...-ptrace_unfreeze_traced-race-with-rt-lock.patch | 68 - .../0335-Linux-4.19.185-rt76-REBASE.patch | 21 - ...ng-rwsem_rt-Add-__down_read_interruptible.patch | 50 + ...-rwsem-rt-Remove-might_sleep-in-__up_read.patch | 29 + ...-t-resize-the-location-tracking-cache-on-.patch | 38 - ...-initialisation-of-cookie-hash-table-raw-.patch | 33 + ...ng-rwsem_rt-Add-__down_read_interruptible.patch | 54 - .../0338-Linux-4.19.206-rt87-REBASE.patch | 21 - ...EMPT_RT-safety-net-for-backported-patches.patch | 48 + ...-rwsem-rt-Remove-might_sleep-in-__up_read.patch | 33 - ...339-net-Add-missing-xmit_lock_owner-hunks.patch | 113 ++ .../0340-Linux-4.19.214-rt93-REBASE.patch | 21 - ...irq-Add-lost-hunk-to-irq_forced_thread_fn.patch | 37 + ...-initialisation-of-cookie-hash-table-raw-.patch | 37 - ...m-Use-local-locks-for-crng-context-access.patch | 80 ++ .../0342-Linux-4.19.225-rt101-REBASE.patch | 21 - .../0342-Linux-4.19.255-rt113-REBASE.patch | 17 + ...EMPT_RT-safety-net-for-backported-patches.patch | 52 - ...344-net-Add-missing-xmit_lock_owner-hunks.patch | 117 -- .../0345-Linux-4.19.237-rt107-REBASE.patch | 21 - ...irq-Add-lost-hunk-to-irq_forced_thread_fn.patch | 41 - .../0347-Linux-4.19.246-rt110-REBASE.patch | 21 - debian/patches-rt/series | 236 ++-- 463 files changed, 14194 insertions(+), 15592 deletions(-) create mode 100644 debian/patches-rt/0227-cpu-hotplug-Implement-CPU-pinning.patch delete mode 100644 debian/patches-rt/0228-cpu-hotplug-Implement-CPU-pinning.patch create mode 100644 debian/patches-rt/0228-sched-Allow-pinned-user-tasks-to-be-awakened-to-the-.patch create mode 100644 debian/patches-rt/0229-hotplug-duct-tape-RT-rwlock-usage-for-non-RT.patch delete mode 100644 debian/patches-rt/0229-sched-Allow-pinned-user-tasks-to-be-awakened-to-the-.patch delete mode 100644 debian/patches-rt/0230-hotplug-duct-tape-RT-rwlock-usage-for-non-RT.patch create mode 100644 debian/patches-rt/0230-net-Remove-preemption-disabling-in-netif_rx.patch create mode 100644 debian/patches-rt/0231-net-Another-local_irq_disable-kmalloc-headache.patch delete mode 100644 debian/patches-rt/0231-net-Remove-preemption-disabling-in-netif_rx.patch delete mode 100644 debian/patches-rt/0232-net-Another-local_irq_disable-kmalloc-headache.patch create mode 100644 debian/patches-rt/0232-net-core-protect-users-of-napi_alloc_cache-against-r.patch delete mode 100644 debian/patches-rt/0233-net-core-protect-users-of-napi_alloc_cache-against-r.patch create mode 100644 debian/patches-rt/0233-net-netfilter-Serialize-xt_write_recseq-sections-on-.patch create mode 100644 debian/patches-rt/0234-lockdep-selftest-Only-do-hardirq-context-test-for-ra.patch delete mode 100644 debian/patches-rt/0234-net-netfilter-Serialize-xt_write_recseq-sections-on-.patch delete mode 100644 debian/patches-rt/0235-lockdep-selftest-Only-do-hardirq-context-test-for-ra.patch create mode 100644 debian/patches-rt/0235-lockdep-selftest-fix-warnings-due-to-missing-PREEMPT.patch delete mode 100644 debian/patches-rt/0236-lockdep-selftest-fix-warnings-due-to-missing-PREEMPT.patch create mode 100644 debian/patches-rt/0236-sched-Add-support-for-lazy-preemption.patch create mode 100644 debian/patches-rt/0237-ftrace-Fix-trace-header-alignment.patch delete mode 100644 debian/patches-rt/0237-sched-Add-support-for-lazy-preemption.patch delete mode 100644 debian/patches-rt/0238-ftrace-Fix-trace-header-alignment.patch create mode 100644 debian/patches-rt/0238-x86-Support-for-lazy-preemption.patch delete mode 100644 debian/patches-rt/0239-x86-Support-for-lazy-preemption.patch create mode 100644 debian/patches-rt/0239-x86-lazy-preempt-properly-check-against-preempt-mask.patch delete mode 100644 debian/patches-rt/0240-x86-lazy-preempt-properly-check-against-preempt-mask.patch create mode 100644 debian/patches-rt/0240-x86-lazy-preempt-use-proper-return-label-on-32bit-x8.patch create mode 100644 debian/patches-rt/0241-arm-Add-support-for-lazy-preemption.patch delete mode 100644 debian/patches-rt/0241-x86-lazy-preempt-use-proper-return-label-on-32bit-x8.patch delete mode 100644 debian/patches-rt/0242-arm-Add-support-for-lazy-preemption.patch create mode 100644 debian/patches-rt/0242-powerpc-Add-support-for-lazy-preemption.patch create mode 100644 debian/patches-rt/0243-arch-arm64-Add-lazy-preempt-support.patch delete mode 100644 debian/patches-rt/0243-powerpc-Add-support-for-lazy-preemption.patch delete mode 100644 debian/patches-rt/0244-arch-arm64-Add-lazy-preempt-support.patch create mode 100644 debian/patches-rt/0244-connector-cn_proc-Protect-send_msg-with-a-local-lock.patch delete mode 100644 debian/patches-rt/0245-connector-cn_proc-Protect-send_msg-with-a-local-lock.patch create mode 100644 debian/patches-rt/0245-drivers-block-zram-Replace-bit-spinlocks-with-rtmute.patch delete mode 100644 debian/patches-rt/0246-drivers-block-zram-Replace-bit-spinlocks-with-rtmute.patch create mode 100644 debian/patches-rt/0246-drivers-zram-Don-t-disable-preemption-in-zcomp_strea.patch delete mode 100644 debian/patches-rt/0247-drivers-zram-Don-t-disable-preemption-in-zcomp_strea.patch create mode 100644 debian/patches-rt/0247-drivers-zram-fix-zcomp_stream_get-smp_processor_id-u.patch delete mode 100644 debian/patches-rt/0248-drivers-zram-fix-zcomp_stream_get-smp_processor_id-u.patch create mode 100644 debian/patches-rt/0248-tpm_tis-fix-stall-after-iowrite-s.patch delete mode 100644 debian/patches-rt/0249-tpm_tis-fix-stall-after-iowrite-s.patch create mode 100644 debian/patches-rt/0249-watchdog-prevent-deferral-of-watchdogd-wakeup-on-RT.patch create mode 100644 debian/patches-rt/0250-drm-radeon-i915-Use-preempt_disable-enable_rt-where-.patch delete mode 100644 debian/patches-rt/0250-watchdog-prevent-deferral-of-watchdogd-wakeup-on-RT.patch create mode 100644 debian/patches-rt/0251-drm-i915-Use-local_lock-unlock_irq-in-intel_pipe_upd.patch delete mode 100644 debian/patches-rt/0251-drm-radeon-i915-Use-preempt_disable-enable_rt-where-.patch delete mode 100644 debian/patches-rt/0252-drm-i915-Use-local_lock-unlock_irq-in-intel_pipe_upd.patch create mode 100644 debian/patches-rt/0252-drm-i915-disable-tracing-on-RT.patch delete mode 100644 debian/patches-rt/0253-drm-i915-disable-tracing-on-RT.patch create mode 100644 debian/patches-rt/0253-drm-i915-skip-DRM_I915_LOW_LEVEL_TRACEPOINTS-with-NO.patch create mode 100644 debian/patches-rt/0254-cgroups-use-simple-wait-in-css_release.patch delete mode 100644 debian/patches-rt/0254-drm-i915-skip-DRM_I915_LOW_LEVEL_TRACEPOINTS-with-NO.patch delete mode 100644 debian/patches-rt/0255-cgroups-use-simple-wait-in-css_release.patch create mode 100644 debian/patches-rt/0255-cpuset-Convert-callback_lock-to-raw_spinlock_t.patch create mode 100644 debian/patches-rt/0256-apparmor-use-a-locallock-instead-preempt_disable.patch delete mode 100644 debian/patches-rt/0256-cpuset-Convert-callback_lock-to-raw_spinlock_t.patch delete mode 100644 debian/patches-rt/0257-apparmor-use-a-locallock-instead-preempt_disable.patch create mode 100644 debian/patches-rt/0257-workqueue-Prevent-deadlock-stall-on-RT.patch create mode 100644 debian/patches-rt/0258-signals-Allow-rt-tasks-to-cache-one-sigqueue-struct.patch delete mode 100644 debian/patches-rt/0258-workqueue-Prevent-deadlock-stall-on-RT.patch create mode 100644 debian/patches-rt/0259-Add-localversion-for-RT-release.patch delete mode 100644 debian/patches-rt/0259-signals-Allow-rt-tasks-to-cache-one-sigqueue-struct.patch delete mode 100644 debian/patches-rt/0260-Add-localversion-for-RT-release.patch create mode 100644 debian/patches-rt/0260-powerpc-pseries-iommu-Use-a-locallock-instead-local_.patch delete mode 100644 debian/patches-rt/0261-powerpc-pseries-iommu-Use-a-locallock-instead-local_.patch create mode 100644 debian/patches-rt/0261-powerpc-reshuffle-TIF-bits.patch delete mode 100644 debian/patches-rt/0262-powerpc-reshuffle-TIF-bits.patch create mode 100644 debian/patches-rt/0262-tty-sysrq-Convert-show_lock-to-raw_spinlock_t.patch create mode 100644 debian/patches-rt/0263-drm-i915-Don-t-disable-interrupts-independently-of-t.patch delete mode 100644 debian/patches-rt/0263-tty-sysrq-Convert-show_lock-to-raw_spinlock_t.patch delete mode 100644 debian/patches-rt/0264-drm-i915-Don-t-disable-interrupts-independently-of-t.patch create mode 100644 debian/patches-rt/0264-sched-completion-Fix-a-lockup-in-wait_for_completion.patch create mode 100644 debian/patches-rt/0265-kthread-add-a-global-worker-thread.patch delete mode 100644 debian/patches-rt/0265-sched-completion-Fix-a-lockup-in-wait_for_completion.patch create mode 100644 debian/patches-rt/0266-arm-imx6-cpuidle-Use-raw_spinlock_t.patch delete mode 100644 debian/patches-rt/0266-kthread-add-a-global-worker-thread.patch delete mode 100644 debian/patches-rt/0267-arm-imx6-cpuidle-Use-raw_spinlock_t.patch create mode 100644 debian/patches-rt/0267-rcu-Don-t-allow-to-change-rcu_normal_after_boot-on-R.patch create mode 100644 debian/patches-rt/0268-pci-switchtec-fix-stream_open.cocci-warnings.patch delete mode 100644 debian/patches-rt/0268-rcu-Don-t-allow-to-change-rcu_normal_after_boot-on-R.patch delete mode 100644 debian/patches-rt/0269-pci-switchtec-fix-stream_open.cocci-warnings.patch create mode 100644 debian/patches-rt/0269-sched-core-Drop-a-preempt_disable_rt-statement.patch delete mode 100644 debian/patches-rt/0270-sched-core-Drop-a-preempt_disable_rt-statement.patch create mode 100644 debian/patches-rt/0270-timers-Redo-the-notification-of-canceling-timers-on-.patch create mode 100644 debian/patches-rt/0271-Revert-futex-Ensure-lock-unlock-symetry-versus-pi_lo.patch delete mode 100644 debian/patches-rt/0271-timers-Redo-the-notification-of-canceling-timers-on-.patch delete mode 100644 debian/patches-rt/0272-Revert-futex-Ensure-lock-unlock-symetry-versus-pi_lo.patch create mode 100644 debian/patches-rt/0272-Revert-futex-Fix-bug-on-when-a-requeued-RT-task-time.patch delete mode 100644 debian/patches-rt/0273-Revert-futex-Fix-bug-on-when-a-requeued-RT-task-time.patch create mode 100644 debian/patches-rt/0273-Revert-rtmutex-Handle-the-various-new-futex-race-con.patch create mode 100644 debian/patches-rt/0274-Revert-futex-workaround-migrate_disable-enable-in-di.patch delete mode 100644 debian/patches-rt/0274-Revert-rtmutex-Handle-the-various-new-futex-race-con.patch delete mode 100644 debian/patches-rt/0275-Revert-futex-workaround-migrate_disable-enable-in-di.patch create mode 100644 debian/patches-rt/0275-futex-Make-the-futex_hash_bucket-lock-raw.patch create mode 100644 debian/patches-rt/0276-futex-Delay-deallocation-of-pi_state.patch delete mode 100644 debian/patches-rt/0276-futex-Make-the-futex_hash_bucket-lock-raw.patch delete mode 100644 debian/patches-rt/0277-futex-Delay-deallocation-of-pi_state.patch create mode 100644 debian/patches-rt/0277-mm-zswap-Do-not-disable-preemption-in-zswap_frontswa.patch delete mode 100644 debian/patches-rt/0278-mm-zswap-Do-not-disable-preemption-in-zswap_frontswa.patch create mode 100644 debian/patches-rt/0278-revert-aio.patch create mode 100644 debian/patches-rt/0279-fs-aio-simple-simple-work.patch delete mode 100644 debian/patches-rt/0279-revert-aio.patch delete mode 100644 debian/patches-rt/0280-fs-aio-simple-simple-work.patch create mode 100644 debian/patches-rt/0280-revert-thermal.patch delete mode 100644 debian/patches-rt/0281-revert-thermal.patch create mode 100644 debian/patches-rt/0281-thermal-Defer-thermal-wakups-to-threads.patch create mode 100644 debian/patches-rt/0282-revert-block.patch delete mode 100644 debian/patches-rt/0282-thermal-Defer-thermal-wakups-to-threads.patch create mode 100644 debian/patches-rt/0283-block-blk-mq-move-blk_queue_usage_counter_release-in.patch delete mode 100644 debian/patches-rt/0283-revert-block.patch delete mode 100644 debian/patches-rt/0284-block-blk-mq-move-blk_queue_usage_counter_release-in.patch create mode 100644 debian/patches-rt/0284-workqueue-rework.patch create mode 100644 debian/patches-rt/0285-i2c-exynos5-Remove-IRQF_ONESHOT.patch delete mode 100644 debian/patches-rt/0285-workqueue-rework.patch delete mode 100644 debian/patches-rt/0286-i2c-exynos5-Remove-IRQF_ONESHOT.patch create mode 100644 debian/patches-rt/0286-i2c-hix5hd2-Remove-IRQF_ONESHOT.patch delete mode 100644 debian/patches-rt/0287-i2c-hix5hd2-Remove-IRQF_ONESHOT.patch create mode 100644 debian/patches-rt/0287-sched-deadline-Ensure-inactive_timer-runs-in-hardirq.patch delete mode 100644 debian/patches-rt/0288-sched-deadline-Ensure-inactive_timer-runs-in-hardirq.patch create mode 100644 debian/patches-rt/0288-thermal-x86_pkg_temp-make-pkg_temp_lock-a-raw-spinlo.patch create mode 100644 debian/patches-rt/0289-dma-buf-Use-seqlock_t-instread-disabling-preemption.patch delete mode 100644 debian/patches-rt/0289-thermal-x86_pkg_temp-make-pkg_temp_lock-a-raw-spinlo.patch create mode 100644 debian/patches-rt/0290-KVM-arm-arm64-Let-the-timer-expire-in-hardirq-contex.patch delete mode 100644 debian/patches-rt/0290-dma-buf-Use-seqlock_t-instread-disabling-preemption.patch delete mode 100644 debian/patches-rt/0291-KVM-arm-arm64-Let-the-timer-expire-in-hardirq-contex.patch create mode 100644 debian/patches-rt/0291-x86-preempt-Check-preemption-level-before-looking-at.patch create mode 100644 debian/patches-rt/0292-hrtimer-Use-READ_ONCE-to-access-timer-base-in-hrimer.patch delete mode 100644 debian/patches-rt/0292-x86-preempt-Check-preemption-level-before-looking-at.patch create mode 100644 debian/patches-rt/0293-hrtimer-Don-t-grab-the-expiry-lock-for-non-soft-hrti.patch delete mode 100644 debian/patches-rt/0293-hrtimer-Use-READ_ONCE-to-access-timer-base-in-hrimer.patch delete mode 100644 debian/patches-rt/0294-hrtimer-Don-t-grab-the-expiry-lock-for-non-soft-hrti.patch create mode 100644 debian/patches-rt/0294-hrtimer-Prevent-using-hrtimer_grab_expiry_lock-on-mi.patch create mode 100644 debian/patches-rt/0295-hrtimer-Add-a-missing-bracket-and-hide-migration_bas.patch delete mode 100644 debian/patches-rt/0295-hrtimer-Prevent-using-hrtimer_grab_expiry_lock-on-mi.patch delete mode 100644 debian/patches-rt/0296-hrtimer-Add-a-missing-bracket-and-hide-migration_bas.patch create mode 100644 debian/patches-rt/0296-posix-timers-Unlock-expiry-lock-in-the-early-return.patch delete mode 100644 debian/patches-rt/0297-posix-timers-Unlock-expiry-lock-in-the-early-return.patch create mode 100644 debian/patches-rt/0297-sched-migrate_dis-enable-Use-sleeping_lock-to-annota.patch create mode 100644 debian/patches-rt/0298-sched-__set_cpus_allowed_ptr-Check-cpus_mask-not-cpu.patch delete mode 100644 debian/patches-rt/0298-sched-migrate_dis-enable-Use-sleeping_lock-to-annota.patch create mode 100644 debian/patches-rt/0299-sched-Remove-dead-__migrate_disabled-check.patch delete mode 100644 debian/patches-rt/0299-sched-__set_cpus_allowed_ptr-Check-cpus_mask-not-cpu.patch delete mode 100644 debian/patches-rt/0300-sched-Remove-dead-__migrate_disabled-check.patch create mode 100644 debian/patches-rt/0300-sched-migrate-disable-Protect-cpus_ptr-with-lock.patch create mode 100644 debian/patches-rt/0301-lib-smp_processor_id-Don-t-use-cpumask_equal.patch delete mode 100644 debian/patches-rt/0301-sched-migrate-disable-Protect-cpus_ptr-with-lock.patch create mode 100644 debian/patches-rt/0302-futex-Make-the-futex_hash_bucket-spinlock_t-again-an.patch delete mode 100644 debian/patches-rt/0302-lib-smp_processor_id-Don-t-use-cpumask_equal.patch delete mode 100644 debian/patches-rt/0303-futex-Make-the-futex_hash_bucket-spinlock_t-again-an.patch create mode 100644 debian/patches-rt/0303-locking-rtmutex-Clean-pi_blocked_on-in-the-error-cas.patch create mode 100644 debian/patches-rt/0304-lib-ubsan-Don-t-seralize-UBSAN-report.patch delete mode 100644 debian/patches-rt/0304-locking-rtmutex-Clean-pi_blocked_on-in-the-error-cas.patch create mode 100644 debian/patches-rt/0305-kmemleak-Change-the-lock-of-kmemleak_object-to-raw_s.patch delete mode 100644 debian/patches-rt/0305-lib-ubsan-Don-t-seralize-UBSAN-report.patch delete mode 100644 debian/patches-rt/0306-kmemleak-Change-the-lock-of-kmemleak_object-to-raw_s.patch create mode 100644 debian/patches-rt/0306-sched-migrate_enable-Use-select_fallback_rq.patch create mode 100644 debian/patches-rt/0307-sched-Lazy-migrate_disable-processing.patch delete mode 100644 debian/patches-rt/0307-sched-migrate_enable-Use-select_fallback_rq.patch delete mode 100644 debian/patches-rt/0308-sched-Lazy-migrate_disable-processing.patch create mode 100644 debian/patches-rt/0308-sched-migrate_enable-Use-stop_one_cpu_nowait.patch create mode 100644 debian/patches-rt/0309-Revert-ARM-Initialize-split-page-table-locks-for-vec.patch delete mode 100644 debian/patches-rt/0309-sched-migrate_enable-Use-stop_one_cpu_nowait.patch delete mode 100644 debian/patches-rt/0310-Revert-ARM-Initialize-split-page-table-locks-for-vec.patch create mode 100644 debian/patches-rt/0310-locking-Make-spinlock_t-and-rwlock_t-a-RCU-section-o.patch delete mode 100644 debian/patches-rt/0311-locking-Make-spinlock_t-and-rwlock_t-a-RCU-section-o.patch create mode 100644 debian/patches-rt/0311-sched-core-migrate_enable-must-access-takedown_cpu_t.patch create mode 100644 debian/patches-rt/0312-lib-smp_processor_id-Adjust-check_preemption_disable.patch delete mode 100644 debian/patches-rt/0312-sched-core-migrate_enable-must-access-takedown_cpu_t.patch delete mode 100644 debian/patches-rt/0313-lib-smp_processor_id-Adjust-check_preemption_disable.patch create mode 100644 debian/patches-rt/0313-sched-migrate_enable-Busy-loop-until-the-migration-r.patch delete mode 100644 debian/patches-rt/0314-sched-migrate_enable-Busy-loop-until-the-migration-r.patch create mode 100644 debian/patches-rt/0314-userfaultfd-Use-a-seqlock-instead-of-seqcount.patch create mode 100644 debian/patches-rt/0315-sched-migrate_enable-Use-per-cpu-cpu_stop_work.patch delete mode 100644 debian/patches-rt/0315-userfaultfd-Use-a-seqlock-instead-of-seqcount.patch create mode 100644 debian/patches-rt/0316-sched-migrate_enable-Remove-__schedule-call.patch delete mode 100644 debian/patches-rt/0316-sched-migrate_enable-Use-per-cpu-cpu_stop_work.patch create mode 100644 debian/patches-rt/0317-mm-memcontrol-Move-misplaced-local_unlock_irqrestore.patch delete mode 100644 debian/patches-rt/0317-sched-migrate_enable-Remove-__schedule-call.patch create mode 100644 debian/patches-rt/0318-locallock-Include-header-for-the-current-macro.patch delete mode 100644 debian/patches-rt/0318-mm-memcontrol-Move-misplaced-local_unlock_irqrestore.patch create mode 100644 debian/patches-rt/0319-drm-vmwgfx-Drop-preempt_disable-in-vmw_fifo_ping_hos.patch delete mode 100644 debian/patches-rt/0319-locallock-Include-header-for-the-current-macro.patch delete mode 100644 debian/patches-rt/0320-drm-vmwgfx-Drop-preempt_disable-in-vmw_fifo_ping_hos.patch create mode 100644 debian/patches-rt/0320-tracing-make-preempt_lazy-and-migrate_disable-counte.patch create mode 100644 debian/patches-rt/0321-lib-ubsan-Remove-flags-parameter-from-calls-to-ubsan.patch delete mode 100644 debian/patches-rt/0321-tracing-make-preempt_lazy-and-migrate_disable-counte.patch create mode 100644 debian/patches-rt/0322-irq_work-Fix-checking-of-IRQ_WORK_LAZY-flag-set-on-n.patch delete mode 100644 debian/patches-rt/0322-lib-ubsan-Remove-flags-parameter-from-calls-to-ubsan.patch delete mode 100644 debian/patches-rt/0323-irq_work-Fix-checking-of-IRQ_WORK_LAZY-flag-set-on-n.patch create mode 100644 debian/patches-rt/0323-tasklet-Address-a-race-resulting-in-double-enqueue.patch create mode 100644 debian/patches-rt/0324-hrtimer-fix-logic-for-when-grabbing-softirq_expiry_l.patch delete mode 100644 debian/patches-rt/0324-tasklet-Address-a-race-resulting-in-double-enqueue.patch create mode 100644 debian/patches-rt/0325-fs-dcache-Include-swait.h-header.patch delete mode 100644 debian/patches-rt/0325-hrtimer-fix-logic-for-when-grabbing-softirq_expiry_l.patch delete mode 100644 debian/patches-rt/0326-fs-dcache-Include-swait.h-header.patch create mode 100644 debian/patches-rt/0326-mm-slub-Always-flush-the-delayed-empty-slubs-in-flus.patch delete mode 100644 debian/patches-rt/0327-mm-slub-Always-flush-the-delayed-empty-slubs-in-flus.patch create mode 100644 debian/patches-rt/0327-tasklet-Fix-UP-case-for-tasklet-CHAINED-state.patch create mode 100644 debian/patches-rt/0328-signal-Prevent-double-free-of-user-struct.patch delete mode 100644 debian/patches-rt/0328-tasklet-Fix-UP-case-for-tasklet-CHAINED-state.patch create mode 100644 debian/patches-rt/0329-Bluetooth-Acquire-sk_lock.slock-without-disabling-in.patch delete mode 100644 debian/patches-rt/0329-signal-Prevent-double-free-of-user-struct.patch delete mode 100644 debian/patches-rt/0330-Bluetooth-Acquire-sk_lock.slock-without-disabling-in.patch create mode 100644 debian/patches-rt/0330-net-phy-fixed_phy-Remove-unused-seqcount.patch delete mode 100644 debian/patches-rt/0331-net-phy-fixed_phy-Remove-unused-seqcount.patch create mode 100644 debian/patches-rt/0331-net-xfrm-fix-compress-vs-decompress-serialization.patch create mode 100644 debian/patches-rt/0332-mm-memcontrol-Disable-preemption-in-__mod_memcg_lruv.patch delete mode 100644 debian/patches-rt/0332-net-xfrm-fix-compress-vs-decompress-serialization.patch delete mode 100644 debian/patches-rt/0333-mm-memcontrol-Disable-preemption-in-__mod_memcg_lruv.patch create mode 100644 debian/patches-rt/0333-ptrace-fix-ptrace_unfreeze_traced-race-with-rt-lock.patch create mode 100644 debian/patches-rt/0334-mm-slub-Don-t-resize-the-location-tracking-cache-on-.patch delete mode 100644 debian/patches-rt/0334-ptrace-fix-ptrace_unfreeze_traced-race-with-rt-lock.patch delete mode 100644 debian/patches-rt/0335-Linux-4.19.185-rt76-REBASE.patch create mode 100644 debian/patches-rt/0335-locking-rwsem_rt-Add-__down_read_interruptible.patch create mode 100644 debian/patches-rt/0336-locking-rwsem-rt-Remove-might_sleep-in-__up_read.patch delete mode 100644 debian/patches-rt/0336-mm-slub-Don-t-resize-the-location-tracking-cache-on-.patch create mode 100644 debian/patches-rt/0337-fscache-fix-initialisation-of-cookie-hash-table-raw-.patch delete mode 100644 debian/patches-rt/0337-locking-rwsem_rt-Add-__down_read_interruptible.patch delete mode 100644 debian/patches-rt/0338-Linux-4.19.206-rt87-REBASE.patch create mode 100644 debian/patches-rt/0338-rt-PREEMPT_RT-safety-net-for-backported-patches.patch delete mode 100644 debian/patches-rt/0339-locking-rwsem-rt-Remove-might_sleep-in-__up_read.patch create mode 100644 debian/patches-rt/0339-net-Add-missing-xmit_lock_owner-hunks.patch delete mode 100644 debian/patches-rt/0340-Linux-4.19.214-rt93-REBASE.patch create mode 100644 debian/patches-rt/0340-genirq-Add-lost-hunk-to-irq_forced_thread_fn.patch delete mode 100644 debian/patches-rt/0341-fscache-fix-initialisation-of-cookie-hash-table-raw-.patch create mode 100644 debian/patches-rt/0341-random-Use-local-locks-for-crng-context-access.patch delete mode 100644 debian/patches-rt/0342-Linux-4.19.225-rt101-REBASE.patch create mode 100644 debian/patches-rt/0342-Linux-4.19.255-rt113-REBASE.patch delete mode 100644 debian/patches-rt/0343-rt-PREEMPT_RT-safety-net-for-backported-patches.patch delete mode 100644 debian/patches-rt/0344-net-Add-missing-xmit_lock_owner-hunks.patch delete mode 100644 debian/patches-rt/0345-Linux-4.19.237-rt107-REBASE.patch delete mode 100644 debian/patches-rt/0346-genirq-Add-lost-hunk-to-irq_forced_thread_fn.patch delete mode 100644 debian/patches-rt/0347-Linux-4.19.246-rt110-REBASE.patch (limited to 'debian/patches-rt') diff --git a/debian/patches-rt/0001-ARM-at91-add-TCB-registers-definitions.patch b/debian/patches-rt/0001-ARM-at91-add-TCB-registers-definitions.patch index 39c411035..b1156f3d4 100644 --- a/debian/patches-rt/0001-ARM-at91-add-TCB-registers-definitions.patch +++ b/debian/patches-rt/0001-ARM-at91-add-TCB-registers-definitions.patch @@ -1,8 +1,7 @@ -From c7b29fd1b38b96426c553ddda13ebf7b8c823fd6 Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Thu, 13 Sep 2018 13:30:18 +0200 -Subject: [PATCH 001/347] ARM: at91: add TCB registers definitions -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 001/342] ARM: at91: add TCB registers definitions +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=3122df320b5f6ba0e36a28168877c8205ab46747 Add registers and bits definitions for the timer counter blocks found on Atmel ARM SoCs. @@ -205,6 +204,3 @@ index 000000000000..657e234b1483 +}; + +#endif /* __SOC_ATMEL_TCB_H */ --- -2.36.1 - diff --git a/debian/patches-rt/0002-clocksource-drivers-Add-a-new-driver-for-the-Atmel-A.patch b/debian/patches-rt/0002-clocksource-drivers-Add-a-new-driver-for-the-Atmel-A.patch index 6f8c04a6c..650f9b842 100644 --- a/debian/patches-rt/0002-clocksource-drivers-Add-a-new-driver-for-the-Atmel-A.patch +++ b/debian/patches-rt/0002-clocksource-drivers-Add-a-new-driver-for-the-Atmel-A.patch @@ -1,9 +1,8 @@ -From ad55e9aff22686f2ddf3d898aac7aef214a5ed82 Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Thu, 13 Sep 2018 13:30:19 +0200 -Subject: [PATCH 002/347] clocksource/drivers: Add a new driver for the Atmel +Subject: [PATCH 002/342] clocksource/drivers: Add a new driver for the Atmel ARM TC blocks -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=3a947a9a5de4fc114b407c5648b6f71e9f825856 Add a driver for the Atmel Timer Counter Blocks. This driver provides a clocksource and two clockevent devices. @@ -480,6 +479,3 @@ index 000000000000..21fbe430f91b + bits); +} +TIMER_OF_DECLARE(atmel_tcb_clksrc, "atmel,tcb-timer", tcb_clksrc_init); --- -2.36.1 - diff --git a/debian/patches-rt/0003-clocksource-drivers-timer-atmel-tcb-add-clockevent-d.patch b/debian/patches-rt/0003-clocksource-drivers-timer-atmel-tcb-add-clockevent-d.patch index 4d1f366c3..fb37f66d2 100644 --- a/debian/patches-rt/0003-clocksource-drivers-timer-atmel-tcb-add-clockevent-d.patch +++ b/debian/patches-rt/0003-clocksource-drivers-timer-atmel-tcb-add-clockevent-d.patch @@ -1,9 +1,8 @@ -From fd06bfd5716c6f1f5905db9be97507fda425080c Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Thu, 13 Sep 2018 13:30:20 +0200 -Subject: [PATCH 003/347] clocksource/drivers: timer-atmel-tcb: add clockevent +Subject: [PATCH 003/342] clocksource/drivers: timer-atmel-tcb: add clockevent device on separate channel -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=13133ffb22ec065c30837eceb253ab60a7f86715 Add an other clockevent device that uses a separate TCB channel when available. @@ -266,6 +265,3 @@ index 21fbe430f91b..63ce3b69338a 100644 } } --- -2.36.1 - diff --git a/debian/patches-rt/0004-clocksource-drivers-atmel-pit-make-option-silent.patch b/debian/patches-rt/0004-clocksource-drivers-atmel-pit-make-option-silent.patch index c506f1465..812239f21 100644 --- a/debian/patches-rt/0004-clocksource-drivers-atmel-pit-make-option-silent.patch +++ b/debian/patches-rt/0004-clocksource-drivers-atmel-pit-make-option-silent.patch @@ -1,8 +1,7 @@ -From e8dbe99dae1d78e7094d87357a904c2e30572fc3 Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Thu, 13 Sep 2018 13:30:21 +0200 -Subject: [PATCH 004/347] clocksource/drivers: atmel-pit: make option silent -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 004/342] clocksource/drivers: atmel-pit: make option silent +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=ec89b134f165b0003da705e1eb33db69f8b105f5 To conform with the other option, make the ATMEL_PIT option silent so it can be selected from the platform @@ -31,6 +30,3 @@ index 9422ea3a52ac..1dbd40f6c01d 100644 config ATMEL_ST bool "Atmel ST timer support" if COMPILE_TEST --- -2.36.1 - diff --git a/debian/patches-rt/0005-ARM-at91-Implement-clocksource-selection.patch b/debian/patches-rt/0005-ARM-at91-Implement-clocksource-selection.patch index 561c3c162..1ca294cdf 100644 --- a/debian/patches-rt/0005-ARM-at91-Implement-clocksource-selection.patch +++ b/debian/patches-rt/0005-ARM-at91-Implement-clocksource-selection.patch @@ -1,8 +1,7 @@ -From 4071bcd6aab6d507cb20f20cfc9f111cfa5a406f Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Thu, 13 Sep 2018 13:30:22 +0200 -Subject: [PATCH 005/347] ARM: at91: Implement clocksource selection -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 005/342] ARM: at91: Implement clocksource selection +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=86f4900f6f6c9c8786a1162b473598e6f83fa5fd Allow selecting and unselecting the PIT clocksource driver so it doesn't have to be compile when unused. @@ -50,6 +49,3 @@ index 903f23c309df..fa493a86e2bb 100644 config HAVE_AT91_UTMI bool --- -2.36.1 - diff --git a/debian/patches-rt/0006-ARM-configs-at91-use-new-TCB-timer-driver.patch b/debian/patches-rt/0006-ARM-configs-at91-use-new-TCB-timer-driver.patch index 8d93a1f2d..1e3746718 100644 --- a/debian/patches-rt/0006-ARM-configs-at91-use-new-TCB-timer-driver.patch +++ b/debian/patches-rt/0006-ARM-configs-at91-use-new-TCB-timer-driver.patch @@ -1,8 +1,7 @@ -From 39aa1ef47843270c427a2c8f4d787ca29d944140 Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Thu, 13 Sep 2018 13:30:23 +0200 -Subject: [PATCH 006/347] ARM: configs: at91: use new TCB timer driver -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 006/342] ARM: configs: at91: use new TCB timer driver +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=0f91582449e7283518ad5c49a625b35d49dceb3d Unselecting ATMEL_TCLIB switches the TCB timer driver from tcb_clksrc to timer-atmel-tcb. @@ -38,6 +37,3 @@ index 2080025556b5..f2bbc6339ca6 100644 CONFIG_ATMEL_SSC=y CONFIG_EEPROM_AT24=y CONFIG_SCSI=y --- -2.36.1 - diff --git a/debian/patches-rt/0007-ARM-configs-at91-unselect-PIT.patch b/debian/patches-rt/0007-ARM-configs-at91-unselect-PIT.patch index a2e5c5d39..7627ee614 100644 --- a/debian/patches-rt/0007-ARM-configs-at91-unselect-PIT.patch +++ b/debian/patches-rt/0007-ARM-configs-at91-unselect-PIT.patch @@ -1,8 +1,7 @@ -From 4e7ea26bf6a9dc935b6db1085488bde47f63f68e Mon Sep 17 00:00:00 2001 From: Alexandre Belloni Date: Thu, 13 Sep 2018 13:30:24 +0200 -Subject: [PATCH 007/347] ARM: configs: at91: unselect PIT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 007/342] ARM: configs: at91: unselect PIT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=b9a3f3c8892299e5539c6ae47a682c3c77e9a3dd The PIT is not required anymore to successfully boot and may actually harm in case preempt-rt is used because the PIT interrupt is shared. @@ -39,6 +38,3 @@ index f2bbc6339ca6..be92871ab155 100644 CONFIG_AEABI=y CONFIG_UACCESS_WITH_MEMCPY=y CONFIG_ZBOOT_ROM_TEXT=0x0 --- -2.36.1 - diff --git a/debian/patches-rt/0008-irqchip-gic-v3-its-Move-pending-table-allocation-to-.patch b/debian/patches-rt/0008-irqchip-gic-v3-its-Move-pending-table-allocation-to-.patch index ebeacb299..fecbdb3e6 100644 --- a/debian/patches-rt/0008-irqchip-gic-v3-its-Move-pending-table-allocation-to-.patch +++ b/debian/patches-rt/0008-irqchip-gic-v3-its-Move-pending-table-allocation-to-.patch @@ -1,9 +1,8 @@ -From c85652aaa06764a7d68d8da3c6e146cf2650bff8 Mon Sep 17 00:00:00 2001 From: Marc Zyngier Date: Fri, 27 Jul 2018 13:38:54 +0100 -Subject: [PATCH 008/347] irqchip/gic-v3-its: Move pending table allocation to +Subject: [PATCH 008/342] irqchip/gic-v3-its: Move pending table allocation to init time -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=9b8978ba6e95562abffb58dc7969127f4c05afe0 Signed-off-by: Marc Zyngier Signed-off-by: Sebastian Andrzej Siewior @@ -166,6 +165,3 @@ index 1d21e98d6854..fdddead7e307 100644 } __percpu *rdist; struct page *prop_page; u64 flags; --- -2.36.1 - diff --git a/debian/patches-rt/0009-kthread-convert-worker-lock-to-raw-spinlock.patch b/debian/patches-rt/0009-kthread-convert-worker-lock-to-raw-spinlock.patch index 2d5f5508f..c60ad230c 100644 --- a/debian/patches-rt/0009-kthread-convert-worker-lock-to-raw-spinlock.patch +++ b/debian/patches-rt/0009-kthread-convert-worker-lock-to-raw-spinlock.patch @@ -1,8 +1,7 @@ -From 3384b42fd998f06c79b4536609c48e3147adb1eb Mon Sep 17 00:00:00 2001 From: Julia Cartwright Date: Fri, 28 Sep 2018 21:03:51 +0000 -Subject: [PATCH 009/347] kthread: convert worker lock to raw spinlock -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 009/342] kthread: convert worker lock to raw spinlock +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=25ba83fe78235738f65e2c7b07943e346ccb9452 In order to enable the queuing of kthread work items from hardirq context even when PREEMPT_RT_FULL is enabled, convert the worker @@ -198,6 +197,3 @@ index 9750f4f7f901..c8cf4731ced8 100644 out: return ret; } --- -2.36.1 - diff --git a/debian/patches-rt/0010-crypto-caam-qi-simplify-CGR-allocation-freeing.patch b/debian/patches-rt/0010-crypto-caam-qi-simplify-CGR-allocation-freeing.patch index 924b46797..9d2fafcd8 100644 --- a/debian/patches-rt/0010-crypto-caam-qi-simplify-CGR-allocation-freeing.patch +++ b/debian/patches-rt/0010-crypto-caam-qi-simplify-CGR-allocation-freeing.patch @@ -1,11 +1,10 @@ -From c752e0c3b941130c799de323f647d8547ff04a81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Horia=20Geant=C4=83?= Date: Mon, 8 Oct 2018 14:09:37 +0300 -Subject: [PATCH 010/347] crypto: caam/qi - simplify CGR allocation, freeing +Subject: [PATCH 010/342] crypto: caam/qi - simplify CGR allocation, freeing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=268ff461cf60c56307d742d6937380187c150147 [Upstream commit 29e83c757006fd751966bdc53392bb22d74179c6] @@ -135,6 +134,3 @@ index 357b69f57072..b6c8acc30853 100644 /** * qi_cache_alloc - Allocate buffers from CAAM-QI cache --- -2.36.1 - diff --git a/debian/patches-rt/0011-sched-fair-Robustify-CFS-bandwidth-timer-locking.patch b/debian/patches-rt/0011-sched-fair-Robustify-CFS-bandwidth-timer-locking.patch index e250e2aa4..7df648712 100644 --- a/debian/patches-rt/0011-sched-fair-Robustify-CFS-bandwidth-timer-locking.patch +++ b/debian/patches-rt/0011-sched-fair-Robustify-CFS-bandwidth-timer-locking.patch @@ -1,8 +1,7 @@ -From e19a4689e9aa66751202caf5aeade89ecb118f2c Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Mon, 7 Jan 2019 13:52:31 +0100 -Subject: [PATCH 011/347] sched/fair: Robustify CFS-bandwidth timer locking -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 011/342] sched/fair: Robustify CFS-bandwidth timer locking +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=b3b58e86ed0fa1cd05db063c8da6034a698bd96d Traditionally hrtimer callbacks were run with IRQs disabled, but with the introduction of HRTIMER_MODE_SOFT it is possible they run from @@ -143,6 +142,3 @@ index 84e7efda98da..e84a056f783f 100644 return idle ? HRTIMER_NORESTART : HRTIMER_RESTART; } --- -2.36.1 - diff --git a/debian/patches-rt/0012-arm-Convert-arm-boot_lock-to-raw.patch b/debian/patches-rt/0012-arm-Convert-arm-boot_lock-to-raw.patch index 2ad1e225e..56625fdcb 100644 --- a/debian/patches-rt/0012-arm-Convert-arm-boot_lock-to-raw.patch +++ b/debian/patches-rt/0012-arm-Convert-arm-boot_lock-to-raw.patch @@ -1,8 +1,7 @@ -From 794763d18a168f7eb7dd98185021fd74a3d0778f Mon Sep 17 00:00:00 2001 From: Frank Rowand Date: Mon, 19 Sep 2011 14:51:14 -0700 -Subject: [PATCH 012/347] arm: Convert arm boot_lock to raw -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 012/342] arm: Convert arm boot_lock to raw +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=832bd38726e8de90d400c1708e3c68c0eb97f0ae The arm boot_lock is used by the secondary processor startup code. The locking task is the idle thread, which has idle->sched_class == &idle_sched_class. @@ -427,6 +426,3 @@ index c2366510187a..6b60f582b738 100644 return pen_release != -1 ? -ENOSYS : 0; } --- -2.36.1 - diff --git a/debian/patches-rt/0013-x86-ioapic-Don-t-let-setaffinity-unmask-threaded-EOI.patch b/debian/patches-rt/0013-x86-ioapic-Don-t-let-setaffinity-unmask-threaded-EOI.patch index 5c222cfd8..fa5207746 100644 --- a/debian/patches-rt/0013-x86-ioapic-Don-t-let-setaffinity-unmask-threaded-EOI.patch +++ b/debian/patches-rt/0013-x86-ioapic-Don-t-let-setaffinity-unmask-threaded-EOI.patch @@ -1,9 +1,8 @@ -From 39f1823e7293c365e7abdc19c1b15d772fc0dbc1 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Tue, 17 Jul 2018 18:25:31 +0200 -Subject: [PATCH 013/347] x86/ioapic: Don't let setaffinity unmask threaded EOI +Subject: [PATCH 013/342] x86/ioapic: Don't let setaffinity unmask threaded EOI interrupt too early -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=6d53bf26f7092895193d947150b8de66ea8e226a There is an issue with threaded interrupts which are marked ONESHOT and using the fasteoi handler. @@ -96,6 +95,3 @@ index 677508baf95a..b1a7f453415f 100644 } static void ioapic_ir_ack_level(struct irq_data *irq_data) --- -2.36.1 - diff --git a/debian/patches-rt/0014-cgroup-use-irqsave-in-cgroup_rstat_flush_locked.patch b/debian/patches-rt/0014-cgroup-use-irqsave-in-cgroup_rstat_flush_locked.patch index 6d9213b5b..cfef075fd 100644 --- a/debian/patches-rt/0014-cgroup-use-irqsave-in-cgroup_rstat_flush_locked.patch +++ b/debian/patches-rt/0014-cgroup-use-irqsave-in-cgroup_rstat_flush_locked.patch @@ -1,8 +1,7 @@ -From 9cbe69b64cc03234634926f56a219900edb90899 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Tue, 3 Jul 2018 18:19:48 +0200 -Subject: [PATCH 014/347] cgroup: use irqsave in cgroup_rstat_flush_locked() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 014/342] cgroup: use irqsave in cgroup_rstat_flush_locked() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=b1c2c072c291f7bcf9e3480cc8474ff68ecebb31 All callers of cgroup_rstat_flush_locked() acquire cgroup_rstat_lock either with spin_lock_irq() or spin_lock_irqsave(). @@ -45,6 +44,3 @@ index d0ed410b4127..3c949c46c6b3 100644 /* if @may_sleep, play nice and yield if necessary */ if (may_sleep && (need_resched() || --- -2.36.1 - diff --git a/debian/patches-rt/0015-fscache-initialize-cookie-hash-table-raw-spinlocks.patch b/debian/patches-rt/0015-fscache-initialize-cookie-hash-table-raw-spinlocks.patch index 1aef96ead..e4b2a74a6 100644 --- a/debian/patches-rt/0015-fscache-initialize-cookie-hash-table-raw-spinlocks.patch +++ b/debian/patches-rt/0015-fscache-initialize-cookie-hash-table-raw-spinlocks.patch @@ -1,8 +1,7 @@ -From efd6f660496f4a70e788963b4b914791eed32c42 Mon Sep 17 00:00:00 2001 From: Clark Williams Date: Tue, 3 Jul 2018 13:34:30 -0500 -Subject: [PATCH 015/347] fscache: initialize cookie hash table raw spinlocks -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 015/342] fscache: initialize cookie hash table raw spinlocks +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=5f9b412940e746eb7fd8900f57db7046efe4f2e0 The fscache cookie mechanism uses a hash table of hlist_bl_head structures. The PREEMPT_RT patcheset adds a raw spinlock to this structure and so on PREEMPT_RT @@ -59,6 +58,3 @@ index 84b90a79d75a..87a9330eafa2 100644 /** * fscache_register_netfs - Register a filesystem as desiring caching services --- -2.36.1 - diff --git a/debian/patches-rt/0016-Drivers-hv-vmbus-include-header-for-get_irq_regs.patch b/debian/patches-rt/0016-Drivers-hv-vmbus-include-header-for-get_irq_regs.patch index bdbfbb7d7..ff80542d2 100644 --- a/debian/patches-rt/0016-Drivers-hv-vmbus-include-header-for-get_irq_regs.patch +++ b/debian/patches-rt/0016-Drivers-hv-vmbus-include-header-for-get_irq_regs.patch @@ -1,11 +1,10 @@ -From 8feaa1571755787a4012cb74fbb937f8c436939e Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Wed, 29 Aug 2018 21:59:04 +0200 -Subject: [PATCH 016/347] Drivers: hv: vmbus: include header for get_irq_regs() +Subject: [PATCH 016/342] Drivers: hv: vmbus: include header for get_irq_regs() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=d64aa2fd269aac918b112984f2dab94ad18aff89 On !RT the header file get_irq_regs() gets pulled in via other header files. On RT it does not and the build fails: @@ -35,6 +34,3 @@ index c4ad51889024..14af29c0ea1c 100644 #include "hv_trace.h" --- -2.36.1 - diff --git a/debian/patches-rt/0017-percpu-include-irqflags.h-for-raw_local_irq_save.patch b/debian/patches-rt/0017-percpu-include-irqflags.h-for-raw_local_irq_save.patch index 0b8f0b08b..2a9367801 100644 --- a/debian/patches-rt/0017-percpu-include-irqflags.h-for-raw_local_irq_save.patch +++ b/debian/patches-rt/0017-percpu-include-irqflags.h-for-raw_local_irq_save.patch @@ -1,8 +1,7 @@ -From 8af0819c5a38547ea3f6b09ff350092c21c13e73 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Thu, 11 Oct 2018 16:39:59 +0200 -Subject: [PATCH 017/347] percpu: include irqflags.h for raw_local_irq_save() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 017/342] percpu: include irqflags.h for raw_local_irq_save() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=83573d1e9158243e6190ff7a90a1fe73c4794a8b The header percpu.h header file is using raw_local_irq_save() but does not include irqflags.h for its definition. It compiles because the @@ -28,6 +27,3 @@ index 1817a8415a5e..942d64c0476e 100644 #ifdef CONFIG_SMP --- -2.36.1 - diff --git a/debian/patches-rt/0018-efi-Allow-efi-runtime.patch b/debian/patches-rt/0018-efi-Allow-efi-runtime.patch index b31c9ad25..592a3e9fc 100644 --- a/debian/patches-rt/0018-efi-Allow-efi-runtime.patch +++ b/debian/patches-rt/0018-efi-Allow-efi-runtime.patch @@ -1,8 +1,7 @@ -From f62b786096a94d0a49da8d0c97bc1d5b6213e6a6 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Thu, 26 Jul 2018 15:06:10 +0200 -Subject: [PATCH 018/347] efi: Allow efi=runtime -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 018/342] efi: Allow efi=runtime +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=bd99215d19fcabe2d1580cda61ff189cc41aa689 In case the option "efi=noruntime" is default at built-time, the user could overwrite its sate by `efi=runtime' and allow it again. @@ -27,6 +26,3 @@ index 7098744f9276..e89932f1ae65 100644 return 0; } early_param("efi", parse_efi_cmdline); --- -2.36.1 - diff --git a/debian/patches-rt/0019-x86-efi-drop-task_lock-from-efi_switch_mm.patch b/debian/patches-rt/0019-x86-efi-drop-task_lock-from-efi_switch_mm.patch index cc5aa4db1..1aaf6ca75 100644 --- a/debian/patches-rt/0019-x86-efi-drop-task_lock-from-efi_switch_mm.patch +++ b/debian/patches-rt/0019-x86-efi-drop-task_lock-from-efi_switch_mm.patch @@ -1,8 +1,7 @@ -From dc7eee776061da65e8343c30c068e3862a192bef Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Tue, 24 Jul 2018 14:48:55 +0200 -Subject: [PATCH 019/347] x86/efi: drop task_lock() from efi_switch_mm() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 019/342] x86/efi: drop task_lock() from efi_switch_mm() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=420295d524170fe978692f9ccc424105b7a6f4a7 efi_switch_mm() is a wrapper around switch_mm() which saves current's ->active_mm, sets the requests mm as ->active_mm and invokes @@ -50,6 +49,3 @@ index 77d05b56089a..cd7e4bfb43cf 100644 } #ifdef CONFIG_EFI_MIXED --- -2.36.1 - diff --git a/debian/patches-rt/0020-arm64-KVM-compute_layout-before-altenates-are-applie.patch b/debian/patches-rt/0020-arm64-KVM-compute_layout-before-altenates-are-applie.patch index 9ebe84c33..c1af4d95b 100644 --- a/debian/patches-rt/0020-arm64-KVM-compute_layout-before-altenates-are-applie.patch +++ b/debian/patches-rt/0020-arm64-KVM-compute_layout-before-altenates-are-applie.patch @@ -1,9 +1,8 @@ -From 67b8d4ae9c2cf65bccbb75f2099bca2da5e78de5 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Thu, 26 Jul 2018 09:13:42 +0200 -Subject: [PATCH 020/347] arm64: KVM: compute_layout before altenates are +Subject: [PATCH 020/342] arm64: KVM: compute_layout before altenates are applied -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=4a7c21c9d8dd18466e30c7b471e0e9ad276f38de compute_layout() is invoked as part of an alternative fixup under stop_machine() and needs a sleeping lock as part of get_random_long(). @@ -78,6 +77,3 @@ index c712a7376bc1..792da0e125de 100644 /* * Compute HYP VA by using the same computation as kern_hyp_va() */ --- -2.36.1 - diff --git a/debian/patches-rt/0021-of-allocate-free-phandle-cache-outside-of-the-devtre.patch b/debian/patches-rt/0021-of-allocate-free-phandle-cache-outside-of-the-devtre.patch index 9b53b3722..910dd1aa1 100644 --- a/debian/patches-rt/0021-of-allocate-free-phandle-cache-outside-of-the-devtre.patch +++ b/debian/patches-rt/0021-of-allocate-free-phandle-cache-outside-of-the-devtre.patch @@ -1,9 +1,8 @@ -From aafa075abaa80a17d9ac105e72ab235ddb573aac Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Fri, 31 Aug 2018 14:16:30 +0200 -Subject: [PATCH 021/347] of: allocate / free phandle cache outside of the +Subject: [PATCH 021/342] of: allocate / free phandle cache outside of the devtree_lock -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=811c1552ba8fc9c2522834455cc7a0f0421cc149 The phandle cache code allocates memory while holding devtree_lock which is a raw_spinlock_t. Memory allocation (and free()) is not possible on @@ -98,6 +97,3 @@ index f0dbb7ad88cf..c59b30bab0e0 100644 } void __init of_core_init(void) --- -2.36.1 - diff --git a/debian/patches-rt/0022-mm-kasan-make-quarantine_lock-a-raw_spinlock_t.patch b/debian/patches-rt/0022-mm-kasan-make-quarantine_lock-a-raw_spinlock_t.patch index 0d6a6458f..d6f6279fa 100644 --- a/debian/patches-rt/0022-mm-kasan-make-quarantine_lock-a-raw_spinlock_t.patch +++ b/debian/patches-rt/0022-mm-kasan-make-quarantine_lock-a-raw_spinlock_t.patch @@ -1,8 +1,7 @@ -From 4613446aa7e0744f1f4895714184b4a5608153bd Mon Sep 17 00:00:00 2001 From: Clark Williams Date: Tue, 18 Sep 2018 10:29:31 -0500 -Subject: [PATCH 022/347] mm/kasan: make quarantine_lock a raw_spinlock_t -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 022/342] mm/kasan: make quarantine_lock a raw_spinlock_t +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=320da726e91aaaedde9f1b6921f60f7ff8dd76d8 The static lock quarantine_lock is used in quarantine.c to protect the quarantine queue datastructures. It is taken inside quarantine queue @@ -93,6 +92,3 @@ index 3a8ddf8baf7d..b209dbaefde8 100644 qlist_free_all(&to_free, cache); --- -2.36.1 - diff --git a/debian/patches-rt/0023-EXP-rcu-Revert-expedited-GP-parallelization-cleverne.patch b/debian/patches-rt/0023-EXP-rcu-Revert-expedited-GP-parallelization-cleverne.patch index 576cef248..78dca5721 100644 --- a/debian/patches-rt/0023-EXP-rcu-Revert-expedited-GP-parallelization-cleverne.patch +++ b/debian/patches-rt/0023-EXP-rcu-Revert-expedited-GP-parallelization-cleverne.patch @@ -1,9 +1,8 @@ -From 502b30371ea2dc6a5ba4ec401468053719944d93 Mon Sep 17 00:00:00 2001 From: "Paul E. McKenney" Date: Mon, 29 Oct 2018 11:53:01 +0100 -Subject: [PATCH 023/347] EXP rcu: Revert expedited GP parallelization +Subject: [PATCH 023/342] EXP rcu: Revert expedited GP parallelization cleverness -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=bbc41f565212047da61ffb6763bb9843c6ea9775 (Commit 258ba8e089db23f760139266c232f01bad73f85c from linux-rcu) @@ -46,6 +45,3 @@ index 72770a551c24..ac6d6fdf5783 100644 rnp->exp_need_flush = true; } --- -2.36.1 - diff --git a/debian/patches-rt/0024-kmemleak-Turn-kmemleak_lock-to-raw-spinlock-on-RT.patch b/debian/patches-rt/0024-kmemleak-Turn-kmemleak_lock-to-raw-spinlock-on-RT.patch index 13c6dabe9..cbe6080bc 100644 --- a/debian/patches-rt/0024-kmemleak-Turn-kmemleak_lock-to-raw-spinlock-on-RT.patch +++ b/debian/patches-rt/0024-kmemleak-Turn-kmemleak_lock-to-raw-spinlock-on-RT.patch @@ -1,11 +1,10 @@ -From 4de935e0bd7598a837928fb0d15048e5b04c5b05 Mon Sep 17 00:00:00 2001 From: He Zhe Date: Wed, 19 Dec 2018 16:30:57 +0100 -Subject: [PATCH 024/347] kmemleak: Turn kmemleak_lock to raw spinlock on RT +Subject: [PATCH 024/342] kmemleak: Turn kmemleak_lock to raw spinlock on RT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=214db2ab9702fd60e0549651edf19dcfb17d9f20 kmemleak_lock, as a rwlock on RT, can possibly be held in atomic context and causes the follow BUG. @@ -164,6 +163,3 @@ index 639acbb91fd5..5b6718dd3a64 100644 } /* --- -2.36.1 - diff --git a/debian/patches-rt/0025-NFSv4-replace-seqcount_t-with-a-seqlock_t.patch b/debian/patches-rt/0025-NFSv4-replace-seqcount_t-with-a-seqlock_t.patch index 837bf02da..38cd44c91 100644 --- a/debian/patches-rt/0025-NFSv4-replace-seqcount_t-with-a-seqlock_t.patch +++ b/debian/patches-rt/0025-NFSv4-replace-seqcount_t-with-a-seqlock_t.patch @@ -1,8 +1,7 @@ -From a21527d57f8b1d303be3a91b055080f68bd83448 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Fri, 28 Oct 2016 23:05:11 +0200 -Subject: [PATCH 025/347] NFSv4: replace seqcount_t with a seqlock_t -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 025/342] NFSv4: replace seqcount_t with a seqlock_t +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=b840fb9c0979726ce4cf8e6136da1ce9be6baeb8 The raw_write_seqcount_begin() in nfs4_reclaim_open_state() bugs me because it maps to preempt_disable() in -RT which I can't have at this @@ -58,7 +57,7 @@ index 5ac7bf24c507..b15a7a2f64fe 100644 }; diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c -index 759c834b60fd..256a4b0c4407 100644 +index f48a11fa78bb..93dcfcd1424d 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -2874,7 +2874,7 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata, @@ -131,6 +130,3 @@ index 30576a10a1f4..e0b94cbce3bf 100644 return status; } --- -2.36.1 - diff --git a/debian/patches-rt/0026-kernel-sched-Provide-a-pointer-to-the-valid-CPU-mask.patch b/debian/patches-rt/0026-kernel-sched-Provide-a-pointer-to-the-valid-CPU-mask.patch index f8d5cd7db..56d89ace2 100644 --- a/debian/patches-rt/0026-kernel-sched-Provide-a-pointer-to-the-valid-CPU-mask.patch +++ b/debian/patches-rt/0026-kernel-sched-Provide-a-pointer-to-the-valid-CPU-mask.patch @@ -1,12 +1,11 @@ -From 3f55ace58d1fbc90dd64acd3564cb4713f74a45e Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Tue, 4 Apr 2017 12:50:16 +0200 -Subject: [PATCH 026/347] kernel: sched: Provide a pointer to the valid CPU +Subject: [PATCH 026/342] kernel: sched: Provide a pointer to the valid CPU mask MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=3a742715efe880a8606d4b57cd2d1ee4715afa3c In commit 4b53a3412d66 ("sched/core: Remove the tsk_nr_cpus_allowed() wrapper") the tsk_nr_cpus_allowed() wrapper was removed. There was not @@ -210,7 +209,7 @@ index 01ed0a667928..2c62de6b5bf1 100644 current->pid, current->comm, cpumask_pr_args(proc_mask)); diff --git a/drivers/infiniband/hw/hfi1/sdma.c b/drivers/infiniband/hw/hfi1/sdma.c -index 38258de75a94..3ee680fc3fda 100644 +index 33ff9eca28f6..6115a9902435 100644 --- a/drivers/infiniband/hw/hfi1/sdma.c +++ b/drivers/infiniband/hw/hfi1/sdma.c @@ -853,14 +853,13 @@ struct sdma_engine *sdma_select_user_engine(struct hfi1_devdata *dd, @@ -780,6 +779,3 @@ index 5522692100ba..8b4be8e1802a 100644 trace_foo_with_template_simple("HELLO", cnt); --- -2.36.1 - diff --git a/debian/patches-rt/0027-kernel-sched-core-add-migrate_disable.patch b/debian/patches-rt/0027-kernel-sched-core-add-migrate_disable.patch index bd257b53a..3f81197cb 100644 --- a/debian/patches-rt/0027-kernel-sched-core-add-migrate_disable.patch +++ b/debian/patches-rt/0027-kernel-sched-core-add-migrate_disable.patch @@ -1,8 +1,7 @@ -From 842b16f6165e848057d292bb2e2a17a5c143bc55 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Sat, 27 May 2017 19:02:06 +0200 -Subject: [PATCH 027/347] kernel/sched/core: add migrate_disable() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 027/342] kernel/sched/core: add migrate_disable() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=530f57e728e9d76193a46746650e621d832ef4ce --- include/linux/preempt.h | 23 +++++++ @@ -261,6 +260,3 @@ index b1ef4f2e7edc..dc3f3e6fa0bd 100644 #undef PN_SCHEDSTAT #undef PN #undef __PN --- -2.36.1 - diff --git a/debian/patches-rt/0028-sched-migrate_disable-Add-export_symbol_gpl-for-__mi.patch b/debian/patches-rt/0028-sched-migrate_disable-Add-export_symbol_gpl-for-__mi.patch index f4980bd69..7ad746c36 100644 --- a/debian/patches-rt/0028-sched-migrate_disable-Add-export_symbol_gpl-for-__mi.patch +++ b/debian/patches-rt/0028-sched-migrate_disable-Add-export_symbol_gpl-for-__mi.patch @@ -1,9 +1,8 @@ -From 4df960200f0e46c435a32baad0ba0e90ec8db1a5 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Tue, 9 Oct 2018 17:34:50 +0200 -Subject: [PATCH 028/347] sched/migrate_disable: Add export_symbol_gpl for +Subject: [PATCH 028/342] sched/migrate_disable: Add export_symbol_gpl for __migrate_disabled -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=4b2f85c983f4170f60b4cbcaad98639bae7f7405 Jonathan reported that lttng/modules can't use __migrate_disabled(). This function is only used by sched/core itself and the tracing @@ -33,6 +32,3 @@ index 5a691d2bfbfe..0a51a66f5a63 100644 #endif static void __do_set_cpus_allowed_tail(struct task_struct *p, --- -2.36.1 - diff --git a/debian/patches-rt/0029-arm-at91-do-not-disable-enable-clocks-in-a-row.patch b/debian/patches-rt/0029-arm-at91-do-not-disable-enable-clocks-in-a-row.patch index 8bf2d54e0..36959604c 100644 --- a/debian/patches-rt/0029-arm-at91-do-not-disable-enable-clocks-in-a-row.patch +++ b/debian/patches-rt/0029-arm-at91-do-not-disable-enable-clocks-in-a-row.patch @@ -1,8 +1,7 @@ -From 61b697c120be1e50542dfa879ebb522bf834b8d2 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Wed, 9 Mar 2016 10:51:06 +0100 -Subject: [PATCH 029/347] arm: at91: do not disable/enable clocks in a row -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 029/342] arm: at91: do not disable/enable clocks in a row +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=c36a4aed62bdfc4b3139d5eb2a696dbe27949d8a Currently the driver will disable the clock and enable it one line later if it is switching from periodic mode into one shot. @@ -93,6 +92,3 @@ index 43f4d5c4d6fa..de6baf564dfe 100644 .set_state_periodic = tc_set_periodic, .set_state_oneshot = tc_set_oneshot, }, --- -2.36.1 - diff --git a/debian/patches-rt/0030-clocksource-TCLIB-Allow-higher-clock-rates-for-clock.patch b/debian/patches-rt/0030-clocksource-TCLIB-Allow-higher-clock-rates-for-clock.patch index 92ac4b1e3..7a86c07d1 100644 --- a/debian/patches-rt/0030-clocksource-TCLIB-Allow-higher-clock-rates-for-clock.patch +++ b/debian/patches-rt/0030-clocksource-TCLIB-Allow-higher-clock-rates-for-clock.patch @@ -1,12 +1,11 @@ -From 785e3ab127a7476bb4da35910092b0d2fd767a47 Mon Sep 17 00:00:00 2001 From: Benedikt Spranger Date: Mon, 8 Mar 2010 18:57:04 +0100 -Subject: [PATCH 030/347] clocksource: TCLIB: Allow higher clock rates for +Subject: [PATCH 030/342] clocksource: TCLIB: Allow higher clock rates for clock events MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=08b49c99b7289f44964d91fe316ef6ae8c374390 As default the TCLIB uses the 32KiHz base clock rate for clock events. Add a compile time selection to allow higher clock resulution. @@ -165,6 +164,3 @@ index 3726eacdf65d..0900dec7ec04 100644 config DUMMY_IRQ tristate "Dummy IRQ handler" default n --- -2.36.1 - diff --git a/debian/patches-rt/0031-timekeeping-Split-jiffies-seqlock.patch b/debian/patches-rt/0031-timekeeping-Split-jiffies-seqlock.patch index 0b4af0dee..5fdbb3432 100644 --- a/debian/patches-rt/0031-timekeeping-Split-jiffies-seqlock.patch +++ b/debian/patches-rt/0031-timekeeping-Split-jiffies-seqlock.patch @@ -1,8 +1,7 @@ -From 8af466b69f15bf4b922703f7b7d6bba72f2ae86c Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Thu, 14 Feb 2013 22:36:59 +0100 -Subject: [PATCH 031/347] timekeeping: Split jiffies seqlock -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 031/342] timekeeping: Split jiffies seqlock +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=3d75e269bb6eae9e11c610942b292d51c3c196eb Replace jiffies_lock seqlock with a simple seqcounter and a rawlock so it can be taken in atomic context on RT. @@ -136,10 +135,10 @@ index 48403fb653c2..e774a49176cc 100644 ts->timer_expires_base = basemono; diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c -index f246818e35db..2cc8a1e8e94f 100644 +index 087f71183c3f..3d41ca395dd1 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c -@@ -2392,8 +2392,10 @@ EXPORT_SYMBOL(hardpps); +@@ -2407,8 +2407,10 @@ EXPORT_SYMBOL(hardpps); */ void xtime_update(unsigned long ticks) { @@ -166,6 +165,3 @@ index 141ab3ab0354..099737f6f10c 100644 #define CS_NAME_LEN 32 --- -2.36.1 - diff --git a/debian/patches-rt/0032-signal-Revert-ptrace-preempt-magic.patch b/debian/patches-rt/0032-signal-Revert-ptrace-preempt-magic.patch index 584eaea9c..b4180b71a 100644 --- a/debian/patches-rt/0032-signal-Revert-ptrace-preempt-magic.patch +++ b/debian/patches-rt/0032-signal-Revert-ptrace-preempt-magic.patch @@ -1,8 +1,7 @@ -From a52b4b412745dea30d5833c35df527de9aceaf70 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Wed, 21 Sep 2011 19:57:12 +0200 -Subject: [PATCH 032/347] signal: Revert ptrace preempt magic -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 032/342] signal: Revert ptrace preempt magic +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=51da8853d991fbd0844a069e36176cf6ed659a37 Upstream commit '53da1d9456fe7f8 fix ptrace slowness' is nothing more than a bandaid around the ptrace design trainwreck. It's not a @@ -14,7 +13,7 @@ Signed-off-by: Thomas Gleixner 1 file changed, 8 deletions(-) diff --git a/kernel/signal.c b/kernel/signal.c -index 4cc3f3ba13a9..23764988b5d1 100644 +index c79b87ac1041..5f2df0301cd2 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -2099,15 +2099,7 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info) @@ -33,6 +32,3 @@ index 4cc3f3ba13a9..23764988b5d1 100644 freezable_schedule(); } else { /* --- -2.36.1 - diff --git a/debian/patches-rt/0033-net-sched-Use-msleep-instead-of-yield.patch b/debian/patches-rt/0033-net-sched-Use-msleep-instead-of-yield.patch index 04ac2a1dd..527f92bbf 100644 --- a/debian/patches-rt/0033-net-sched-Use-msleep-instead-of-yield.patch +++ b/debian/patches-rt/0033-net-sched-Use-msleep-instead-of-yield.patch @@ -1,8 +1,7 @@ -From 6312157ef6ed82e76dfab7c719dc7b5f731eb189 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Wed, 5 Mar 2014 00:49:47 +0100 -Subject: [PATCH 033/347] net: sched: Use msleep() instead of yield() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 033/342] net: sched: Use msleep() instead of yield() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=a94458b4bbc9b3a16e8bb4a00125a37f47e8b599 On PREEMPT_RT enabled systems the interrupt handler run as threads at prio 50 (by default). If a high priority userspace process tries to shut down a busy @@ -47,10 +46,10 @@ Signed-off-by: Sebastian Andrzej Siewior 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c -index 7c1b1eff84f4..42a776abdf2f 100644 +index cad2586c3473..8d8a9ac2562f 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c -@@ -1253,7 +1253,7 @@ void dev_deactivate_many(struct list_head *head) +@@ -1254,7 +1254,7 @@ void dev_deactivate_many(struct list_head *head) /* Wait for outstanding qdisc_run calls. */ list_for_each_entry(dev, head, close_list) { while (some_qdisc_is_busy(dev)) @@ -59,6 +58,3 @@ index 7c1b1eff84f4..42a776abdf2f 100644 /* The new qdisc is assigned at this point so we can safely * unwind stale skb lists and qdisc statistics */ --- -2.36.1 - diff --git a/debian/patches-rt/0034-dm-rq-remove-BUG_ON-irqs_disabled-check.patch b/debian/patches-rt/0034-dm-rq-remove-BUG_ON-irqs_disabled-check.patch index ee27e4207..e3e7ed5f9 100644 --- a/debian/patches-rt/0034-dm-rq-remove-BUG_ON-irqs_disabled-check.patch +++ b/debian/patches-rt/0034-dm-rq-remove-BUG_ON-irqs_disabled-check.patch @@ -1,8 +1,7 @@ -From 7437113ac72d093e8ee118ccfd6174f199811e3e Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Tue, 27 Mar 2018 16:24:15 +0200 -Subject: [PATCH 034/347] dm rq: remove BUG_ON(!irqs_disabled) check -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 034/342] dm rq: remove BUG_ON(!irqs_disabled) check +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=04040555cbe921e190bb0678f83732b0d6fa3874 In commit 052189a2ec95 ("dm: remove superfluous irq disablement in dm_request_fn") the spin_lock_irq() was replaced with spin_lock() + a @@ -32,6 +31,3 @@ index 2957a3763f01..bc8192b4e7b2 100644 } } --- -2.36.1 - diff --git a/debian/patches-rt/0035-usb-do-no-disable-interrupts-in-giveback.patch b/debian/patches-rt/0035-usb-do-no-disable-interrupts-in-giveback.patch index 07b1ab8e9..4980cdeb8 100644 --- a/debian/patches-rt/0035-usb-do-no-disable-interrupts-in-giveback.patch +++ b/debian/patches-rt/0035-usb-do-no-disable-interrupts-in-giveback.patch @@ -1,8 +1,7 @@ -From 58c679541448da375ccc262585f3172e913811f3 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Fri, 8 Nov 2013 17:34:54 +0100 -Subject: [PATCH 035/347] usb: do no disable interrupts in giveback -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 035/342] usb: do no disable interrupts in giveback +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=0fb80d18f8ca1e31e157b7f8a6730906446c1841 Since commit 94dfd7ed ("USB: HCD: support giveback of URB in tasklet context") the USB code disables interrupts before invoking the complete @@ -41,6 +40,3 @@ index df661460e9f9..1a1487d312d0 100644 usb_anchor_resume_wakeups(anchor); atomic_dec(&urb->use_count); --- -2.36.1 - diff --git a/debian/patches-rt/0036-rt-Provide-PREEMPT_RT_BASE-config-switch.patch b/debian/patches-rt/0036-rt-Provide-PREEMPT_RT_BASE-config-switch.patch index 06f68e211..f3c92a375 100644 --- a/debian/patches-rt/0036-rt-Provide-PREEMPT_RT_BASE-config-switch.patch +++ b/debian/patches-rt/0036-rt-Provide-PREEMPT_RT_BASE-config-switch.patch @@ -1,8 +1,7 @@ -From a32da1fe301b84a5d1e22c83472290f0f10e8b12 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Fri, 17 Jun 2011 12:39:57 +0200 -Subject: [PATCH 036/347] rt: Provide PREEMPT_RT_BASE config switch -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 036/342] rt: Provide PREEMPT_RT_BASE config switch +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=b37dde63f1b8d26b2f65461293519ec99abe4dbd Introduce PREEMPT_RT_BASE which enables parts of PREEMPT_RT_FULL. Forces interrupt threading and enables some of the RT @@ -59,6 +58,3 @@ index cd1655122ec0..027db5976c2f 100644 - bool \ No newline at end of file + bool --- -2.36.1 - diff --git a/debian/patches-rt/0037-cpumask-Disable-CONFIG_CPUMASK_OFFSTACK-for-RT.patch b/debian/patches-rt/0037-cpumask-Disable-CONFIG_CPUMASK_OFFSTACK-for-RT.patch index f5e098023..3e1d44c0e 100644 --- a/debian/patches-rt/0037-cpumask-Disable-CONFIG_CPUMASK_OFFSTACK-for-RT.patch +++ b/debian/patches-rt/0037-cpumask-Disable-CONFIG_CPUMASK_OFFSTACK-for-RT.patch @@ -1,8 +1,7 @@ -From ecd952b9f170afff929edaa1b5b7a172b07881c8 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Wed, 14 Dec 2011 01:03:49 +0100 -Subject: [PATCH 037/347] cpumask: Disable CONFIG_CPUMASK_OFFSTACK for RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 037/342] cpumask: Disable CONFIG_CPUMASK_OFFSTACK for RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=f8131bb6f8295c7b4fabd12a0c0c3eb1713c9d48 There are "valid" GFP_ATOMIC allocations such as @@ -71,6 +70,3 @@ index 714ec2f50bb1..4857bb4c490a 100644 help Use dynamic allocation for cpumask_var_t, instead of putting them on the stack. This is a bit more expensive, but avoids --- -2.36.1 - diff --git a/debian/patches-rt/0038-jump-label-disable-if-stop_machine-is-used.patch b/debian/patches-rt/0038-jump-label-disable-if-stop_machine-is-used.patch index 2492e61a1..25e6be2d0 100644 --- a/debian/patches-rt/0038-jump-label-disable-if-stop_machine-is-used.patch +++ b/debian/patches-rt/0038-jump-label-disable-if-stop_machine-is-used.patch @@ -1,8 +1,7 @@ -From d1a6d4880db516353e443bbe3b11ce97767dd75e Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Wed, 8 Jul 2015 17:14:48 +0200 -Subject: [PATCH 038/347] jump-label: disable if stop_machine() is used -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 038/342] jump-label: disable if stop_machine() is used +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=6a7f82ff6e79a284d2d7daccbc50d25896e6f846 Some architectures are using stop_machine() while switching the opcode which leads to latency spikes. @@ -37,6 +36,3 @@ index d89d013f586c..32d59b815b52 100644 select HAVE_ARCH_KGDB if !CPU_ENDIAN_BE32 && MMU select HAVE_ARCH_MMAP_RND_BITS if MMU select HAVE_ARCH_SECCOMP_FILTER if (AEABI && !OABI_COMPAT) --- -2.36.1 - diff --git a/debian/patches-rt/0039-kconfig-Disable-config-options-which-are-not-RT-comp.patch b/debian/patches-rt/0039-kconfig-Disable-config-options-which-are-not-RT-comp.patch index 20f55cc87..b1012ea33 100644 --- a/debian/patches-rt/0039-kconfig-Disable-config-options-which-are-not-RT-comp.patch +++ b/debian/patches-rt/0039-kconfig-Disable-config-options-which-are-not-RT-comp.patch @@ -1,9 +1,8 @@ -From 92e84c0530709b63ff982d19ccf2ae0523aa712a Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Sun, 24 Jul 2011 12:11:43 +0200 -Subject: [PATCH 039/347] kconfig: Disable config options which are not RT +Subject: [PATCH 039/342] kconfig: Disable config options which are not RT compatible -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=d20dc87ef027ae10b83e8aa13ba63fcde819da26 Disable stuff which is known to have issues on RT @@ -38,6 +37,3 @@ index b457e94ae618..0dddbb2a3282 100644 select COMPACTION select RADIX_TREE_MULTIORDER help --- -2.36.1 - diff --git a/debian/patches-rt/0040-lockdep-disable-self-test.patch b/debian/patches-rt/0040-lockdep-disable-self-test.patch index ff859feb8..3679cc993 100644 --- a/debian/patches-rt/0040-lockdep-disable-self-test.patch +++ b/debian/patches-rt/0040-lockdep-disable-self-test.patch @@ -1,11 +1,10 @@ -From 563448c3c6d54ac0304256d02827bd841ba65a2f Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Tue, 17 Oct 2017 16:36:18 +0200 -Subject: [PATCH 040/347] lockdep: disable self-test +Subject: [PATCH 040/342] lockdep: disable self-test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=af6ae5f97037f7668869705020867edf0a5e09c6 The self-test wasn't always 100% accurate for RT. We disabled a few tests which failed because they had a different semantic for RT. Some @@ -18,7 +17,7 @@ Signed-off-by: Sebastian Andrzej Siewior 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug -index 621859a453f8..02f962c9b199 100644 +index 9a4277034c64..ee81b31aa9c5 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -1206,7 +1206,7 @@ config DEBUG_ATOMIC_SLEEP @@ -30,6 +29,3 @@ index 621859a453f8..02f962c9b199 100644 help Say Y here if you want the kernel to run a short self-test during bootup. The self-test checks whether common types of locking bugs --- -2.36.1 - diff --git a/debian/patches-rt/0041-mm-Allow-only-slub-on-RT.patch b/debian/patches-rt/0041-mm-Allow-only-slub-on-RT.patch index b41b5188e..c876f8229 100644 --- a/debian/patches-rt/0041-mm-Allow-only-slub-on-RT.patch +++ b/debian/patches-rt/0041-mm-Allow-only-slub-on-RT.patch @@ -1,8 +1,7 @@ -From 8b775963cebd7cc5b3416a9d8f85ef4c343874df Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Fri, 3 Jul 2009 08:44:03 -0500 -Subject: [PATCH 041/347] mm: Allow only slub on RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 041/342] mm: Allow only slub on RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=24f9bbf38dfd0fd57553176d5d441c91a7a2c0a1 Disable SLAB and SLOB on -RT. Only SLUB is adopted to -RT needs. @@ -32,6 +31,3 @@ index 15c02e15d3fd..45a9846f1464 100644 help SLOB replaces the stock allocator with a drastically simpler allocator. SLOB is generally more space efficient but --- -2.36.1 - diff --git a/debian/patches-rt/0042-locking-Disable-spin-on-owner-for-RT.patch b/debian/patches-rt/0042-locking-Disable-spin-on-owner-for-RT.patch index f17f2534e..dc1e1715f 100644 --- a/debian/patches-rt/0042-locking-Disable-spin-on-owner-for-RT.patch +++ b/debian/patches-rt/0042-locking-Disable-spin-on-owner-for-RT.patch @@ -1,11 +1,10 @@ -From 08935fef7d8bf9943412aabcac4133066923333f Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Sun, 17 Jul 2011 21:51:45 +0200 -Subject: [PATCH 042/347] locking: Disable spin on owner for RT +Subject: [PATCH 042/342] locking: Disable spin on owner for RT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=595a698c628e8a06b9aa23ee86ce93052b1e9cf4 Drop spin on owner for mutex / rwsem. We are most likely not using it but… @@ -33,6 +32,3 @@ index 84d882f3e299..af27c4000812 100644 config LOCK_SPIN_ON_OWNER def_bool y --- -2.36.1 - diff --git a/debian/patches-rt/0043-rcu-Disable-RCU_FAST_NO_HZ-on-RT.patch b/debian/patches-rt/0043-rcu-Disable-RCU_FAST_NO_HZ-on-RT.patch index 7f601cc2e..f4486a279 100644 --- a/debian/patches-rt/0043-rcu-Disable-RCU_FAST_NO_HZ-on-RT.patch +++ b/debian/patches-rt/0043-rcu-Disable-RCU_FAST_NO_HZ-on-RT.patch @@ -1,8 +1,7 @@ -From bf68f45a17d9185950e69e908fcbff3fe28f7764 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Sun, 28 Oct 2012 13:26:09 +0000 -Subject: [PATCH 043/347] rcu: Disable RCU_FAST_NO_HZ on RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 043/342] rcu: Disable RCU_FAST_NO_HZ on RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=2906b81a2b2eac6c3a6ca5e7e782008896eacf43 This uses a timer_list timer from the irq disabled guts of the idle code. Disable it for now to prevent wreckage. @@ -25,6 +24,3 @@ index 9210379c0353..644264be90f0 100644 default n help This option permits CPUs to enter dynticks-idle state even if --- -2.36.1 - diff --git a/debian/patches-rt/0044-rcu-make-RCU_BOOST-default-on-RT.patch b/debian/patches-rt/0044-rcu-make-RCU_BOOST-default-on-RT.patch index 41c8f5cf1..8bff8ab7d 100644 --- a/debian/patches-rt/0044-rcu-make-RCU_BOOST-default-on-RT.patch +++ b/debian/patches-rt/0044-rcu-make-RCU_BOOST-default-on-RT.patch @@ -1,8 +1,7 @@ -From 54dcdf587a5ea4e590122c0666760e151bb3f122 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Fri, 21 Mar 2014 20:19:05 +0100 -Subject: [PATCH 044/347] rcu: make RCU_BOOST default on RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 044/342] rcu: make RCU_BOOST default on RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=3c6db36bde45dd585557217b67660ac13aff8c9e Since it is no longer invoked from the softirq people run into OOM more often if the priority of the RCU thread is too low. Making boosting @@ -29,6 +28,3 @@ index 644264be90f0..a243a78ff38c 100644 help This option boosts the priority of preempted RCU readers that block the current preemptible RCU grace period for too long. --- -2.36.1 - diff --git a/debian/patches-rt/0045-sched-Disable-CONFIG_RT_GROUP_SCHED-on-RT.patch b/debian/patches-rt/0045-sched-Disable-CONFIG_RT_GROUP_SCHED-on-RT.patch index f7214c126..8ab2262eb 100644 --- a/debian/patches-rt/0045-sched-Disable-CONFIG_RT_GROUP_SCHED-on-RT.patch +++ b/debian/patches-rt/0045-sched-Disable-CONFIG_RT_GROUP_SCHED-on-RT.patch @@ -1,8 +1,7 @@ -From 99a129e243d912aefe039e78e82c3f39204fd05c Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Mon, 18 Jul 2011 17:03:52 +0200 -Subject: [PATCH 045/347] sched: Disable CONFIG_RT_GROUP_SCHED on RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 045/342] sched: Disable CONFIG_RT_GROUP_SCHED on RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=35fe4c7ed5f8c8dbd6fc8dbc4ea79f38e6709cbc Carsten reported problems when running: @@ -30,6 +29,3 @@ index 45a9846f1464..1793e8bd71ef 100644 default n help This feature lets you explicitly allocate real CPU bandwidth --- -2.36.1 - diff --git a/debian/patches-rt/0046-net-core-disable-NET_RX_BUSY_POLL.patch b/debian/patches-rt/0046-net-core-disable-NET_RX_BUSY_POLL.patch index 7eb1fc029..4997d3125 100644 --- a/debian/patches-rt/0046-net-core-disable-NET_RX_BUSY_POLL.patch +++ b/debian/patches-rt/0046-net-core-disable-NET_RX_BUSY_POLL.patch @@ -1,11 +1,10 @@ -From ad59d8a0c65befc94d4dc8d0f000ab096011f737 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Sat, 27 May 2017 19:02:06 +0200 -Subject: [PATCH 046/347] net/core: disable NET_RX_BUSY_POLL +Subject: [PATCH 046/342] net/core: disable NET_RX_BUSY_POLL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=9ddd1e187d289bf0b0e0ed40eb776010526c95fb sk_busy_loop() does preempt_disable() followed by a few operations which can take sleeping locks and may get long. @@ -33,6 +32,3 @@ index 228dfa382eec..bc8d01996f22 100644 config BQL bool --- -2.36.1 - diff --git a/debian/patches-rt/0047-arm-disable-NEON-in-kernel-mode.patch b/debian/patches-rt/0047-arm-disable-NEON-in-kernel-mode.patch index 03e38de78..6081352c4 100644 --- a/debian/patches-rt/0047-arm-disable-NEON-in-kernel-mode.patch +++ b/debian/patches-rt/0047-arm-disable-NEON-in-kernel-mode.patch @@ -1,8 +1,7 @@ -From 8cd6e5200e3869218d2da84e16e4638eb6de6923 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Fri, 1 Dec 2017 10:42:03 +0100 -Subject: [PATCH 047/347] arm*: disable NEON in kernel mode -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 047/342] arm*: disable NEON in kernel mode +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=3871acb68bb4ed0ffe77ad68b497182a4aaf9cce NEON in kernel mode is used by the crypto algorithms and raid6 code. While the raid6 code looks okay, the crypto algorithms do not: NEON @@ -161,6 +160,3 @@ index 34b4e3d46aab..ae055cdad8cf 100644 crc32_pmull_algs[0].update = crc32_pmull_update; crc32_pmull_algs[1].update = crc32c_pmull_update; --- -2.36.1 - diff --git a/debian/patches-rt/0048-powerpc-Use-generic-rwsem-on-RT.patch b/debian/patches-rt/0048-powerpc-Use-generic-rwsem-on-RT.patch index 24e9ef59e..d0fdba62d 100644 --- a/debian/patches-rt/0048-powerpc-Use-generic-rwsem-on-RT.patch +++ b/debian/patches-rt/0048-powerpc-Use-generic-rwsem-on-RT.patch @@ -1,8 +1,7 @@ -From 030e3aaf44e1d067c8b44227ace30a35b90b1dda Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Tue, 14 Jul 2015 14:26:34 +0200 -Subject: [PATCH 048/347] powerpc: Use generic rwsem on RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 048/342] powerpc: Use generic rwsem on RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=31c7f2b069511b279e94f8dcd85a919944e98866 Use generic code which uses rtmutex @@ -28,6 +27,3 @@ index f0e09d5f0bed..d6aae022d8c3 100644 config GENERIC_LOCKBREAK bool --- -2.36.1 - diff --git a/debian/patches-rt/0049-powerpc-kvm-Disable-in-kernel-MPIC-emulation-for-PRE.patch b/debian/patches-rt/0049-powerpc-kvm-Disable-in-kernel-MPIC-emulation-for-PRE.patch index f019d3e49..72d40f076 100644 --- a/debian/patches-rt/0049-powerpc-kvm-Disable-in-kernel-MPIC-emulation-for-PRE.patch +++ b/debian/patches-rt/0049-powerpc-kvm-Disable-in-kernel-MPIC-emulation-for-PRE.patch @@ -1,9 +1,8 @@ -From d20454871d553f909f09445def1ccc5edee641de Mon Sep 17 00:00:00 2001 From: Bogdan Purcareata Date: Fri, 24 Apr 2015 15:53:13 +0000 -Subject: [PATCH 049/347] powerpc/kvm: Disable in-kernel MPIC emulation for +Subject: [PATCH 049/342] powerpc/kvm: Disable in-kernel MPIC emulation for PREEMPT_RT_FULL -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=157f0f9e40401380eeb97d8cba087b4f8380c2f3 While converting the openpic emulation code to use a raw_spinlock_t enables guests to run on RT, there's still a performance issue. For interrupts sent in @@ -40,6 +39,3 @@ index 68a0e9d5b440..6f4d5d7615af 100644 select HAVE_KVM_IRQCHIP select HAVE_KVM_IRQFD select HAVE_KVM_IRQ_ROUTING --- -2.36.1 - diff --git a/debian/patches-rt/0050-powerpc-Disable-highmem-on-RT.patch b/debian/patches-rt/0050-powerpc-Disable-highmem-on-RT.patch index 75dd3f847..4f2ce559d 100644 --- a/debian/patches-rt/0050-powerpc-Disable-highmem-on-RT.patch +++ b/debian/patches-rt/0050-powerpc-Disable-highmem-on-RT.patch @@ -1,8 +1,7 @@ -From fb0a390ea78c69d7d649e3cca6252b3f18659432 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Mon, 18 Jul 2011 17:08:34 +0200 -Subject: [PATCH 050/347] powerpc: Disable highmem on RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 050/342] powerpc: Disable highmem on RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=ea4bdea3cd8b827c68cf8d5b7622f834dadc2761 The current highmem handling on -RT is not compatible and needs fixups. @@ -24,6 +23,3 @@ index d6aae022d8c3..f4517f4be192 100644 source kernel/Kconfig.hz --- -2.36.1 - diff --git a/debian/patches-rt/0051-mips-Disable-highmem-on-RT.patch b/debian/patches-rt/0051-mips-Disable-highmem-on-RT.patch index 775a7da1c..939256714 100644 --- a/debian/patches-rt/0051-mips-Disable-highmem-on-RT.patch +++ b/debian/patches-rt/0051-mips-Disable-highmem-on-RT.patch @@ -1,8 +1,7 @@ -From 4ee6a41454883114c19ed1d09d6337846d8fe685 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Mon, 18 Jul 2011 17:10:12 +0200 -Subject: [PATCH 051/347] mips: Disable highmem on RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 051/342] mips: Disable highmem on RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=269a64247aeed7cb930850d38719a815cedbfebc The current highmem handling on -RT is not compatible and needs fixups. @@ -24,6 +23,3 @@ index 8a227a80f6bd..bbd790058e46 100644 config CPU_SUPPORTS_HIGHMEM bool --- -2.36.1 - diff --git a/debian/patches-rt/0052-x86-Use-generic-rwsem_spinlocks-on-rt.patch b/debian/patches-rt/0052-x86-Use-generic-rwsem_spinlocks-on-rt.patch index 61295d2a3..1c01fec7e 100644 --- a/debian/patches-rt/0052-x86-Use-generic-rwsem_spinlocks-on-rt.patch +++ b/debian/patches-rt/0052-x86-Use-generic-rwsem_spinlocks-on-rt.patch @@ -1,8 +1,7 @@ -From ba7790a3c551c3de98d561dbdfc21b1ee3da42b7 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Sun, 26 Jul 2009 02:21:32 +0200 -Subject: [PATCH 052/347] x86: Use generic rwsem_spinlocks on -rt -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 052/342] x86: Use generic rwsem_spinlocks on -rt +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=3f6a1a4dffbffb8bc4e0b4dbcf46fa6409d3635c Simplifies the separation of anon_rw_semaphores and rw_semaphores for -rt. @@ -29,6 +28,3 @@ index a8ec5d0c024e..6ee7220e7f47 100644 config GENERIC_CALIBRATE_DELAY def_bool y --- -2.36.1 - diff --git a/debian/patches-rt/0053-leds-trigger-disable-CPU-trigger-on-RT.patch b/debian/patches-rt/0053-leds-trigger-disable-CPU-trigger-on-RT.patch index d8b93a3b6..6584b8eb6 100644 --- a/debian/patches-rt/0053-leds-trigger-disable-CPU-trigger-on-RT.patch +++ b/debian/patches-rt/0053-leds-trigger-disable-CPU-trigger-on-RT.patch @@ -1,8 +1,7 @@ -From 2f974cb740c62b0919de64dfd6adffd2ee6de05e Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Thu, 23 Jan 2014 14:45:59 +0100 -Subject: [PATCH 053/347] leds: trigger: disable CPU trigger on -RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 053/342] leds: trigger: disable CPU trigger on -RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=33c8d8dbc6da63c95050f879b153aeec536b820b as it triggers: |CPU: 0 PID: 0 Comm: swapper Not tainted 3.12.8-rt10 #141 @@ -36,6 +35,3 @@ index 4018af769969..b4ce8c115949 100644 help This allows LEDs to be controlled by active CPUs. This shows the active CPUs across an array of LEDs so you can see which --- -2.36.1 - diff --git a/debian/patches-rt/0054-cpufreq-drop-K8-s-driver-from-beeing-selected.patch b/debian/patches-rt/0054-cpufreq-drop-K8-s-driver-from-beeing-selected.patch index d93572692..4b2f990f2 100644 --- a/debian/patches-rt/0054-cpufreq-drop-K8-s-driver-from-beeing-selected.patch +++ b/debian/patches-rt/0054-cpufreq-drop-K8-s-driver-from-beeing-selected.patch @@ -1,8 +1,7 @@ -From b7705efed15774a4424b72dc695c15636b458a3b Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Thu, 9 Apr 2015 15:23:01 +0200 -Subject: [PATCH 054/347] cpufreq: drop K8's driver from beeing selected -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 054/342] cpufreq: drop K8's driver from beeing selected +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=5418743cfe93bd81d0666a754324fbb8c0d094bd Ralf posted a picture of a backtrace from @@ -34,6 +33,3 @@ index 35f71825b7f3..bb4a6160d0f7 100644 help This adds the CPUFreq driver for K8/early Opteron/Athlon64 processors. Support for K10 and newer processors is now in acpi-cpufreq. --- -2.36.1 - diff --git a/debian/patches-rt/0055-md-disable-bcache.patch b/debian/patches-rt/0055-md-disable-bcache.patch index f2de464c8..64e79c786 100644 --- a/debian/patches-rt/0055-md-disable-bcache.patch +++ b/debian/patches-rt/0055-md-disable-bcache.patch @@ -1,11 +1,10 @@ -From 660157bd8a977bb04e9ef58df7270b51f7e315e1 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Thu, 29 Aug 2013 11:48:57 +0200 -Subject: [PATCH 055/347] md: disable bcache +Subject: [PATCH 055/342] md: disable bcache MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=b43ef7e1e9d0f8f376c1cbecd5603eed7ffd27c3 It uses anon semaphores |drivers/md/bcache/request.c: In function ‘cached_dev_write_complete’: @@ -36,6 +35,3 @@ index f6e0a8b3a61e..18c03d79a442 100644 select CRC64 help Allows a block device to be used as cache for other devices; uses --- -2.36.1 - diff --git a/debian/patches-rt/0056-efi-Disable-runtime-services-on-RT.patch b/debian/patches-rt/0056-efi-Disable-runtime-services-on-RT.patch index fe647f6c4..a3991fa44 100644 --- a/debian/patches-rt/0056-efi-Disable-runtime-services-on-RT.patch +++ b/debian/patches-rt/0056-efi-Disable-runtime-services-on-RT.patch @@ -1,8 +1,7 @@ -From 6c62319a5f5caaf647997706f6996ce4e8dfc939 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Thu, 26 Jul 2018 15:03:16 +0200 -Subject: [PATCH 056/347] efi: Disable runtime services on RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 056/342] efi: Disable runtime services on RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=365411fe5df7eb06fef3644a96222b96878107f6 Based on meassurements the EFI functions get_variable / get_next_variable take up to 2us which looks okay. @@ -41,6 +40,3 @@ index e89932f1ae65..221957ccdb0b 100644 static int __init setup_noefi(char *arg) { disable_runtime = true; --- -2.36.1 - diff --git a/debian/patches-rt/0057-printk-Add-a-printk-kill-switch.patch b/debian/patches-rt/0057-printk-Add-a-printk-kill-switch.patch index 54f3d96d2..8bab85c4e 100644 --- a/debian/patches-rt/0057-printk-Add-a-printk-kill-switch.patch +++ b/debian/patches-rt/0057-printk-Add-a-printk-kill-switch.patch @@ -1,8 +1,7 @@ -From 0450159a3552782546de4c88cbeae98683079ee9 Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Fri, 22 Jul 2011 17:58:40 +0200 -Subject: [PATCH 057/347] printk: Add a printk kill switch -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 057/342] printk: Add a printk kill switch +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=ed296a69a4f4cc1e1df5a29c87fe629f9f7a61c5 Add a prinkt-kill-switch. This is used from (NMI) watchdog to ensure that it does not dead-lock with the early printk code. @@ -169,6 +168,3 @@ index 71381168dede..685443375dc0 100644 if (hardlockup_panic) nmi_panic(regs, "Hard LOCKUP"); --- -2.36.1 - diff --git a/debian/patches-rt/0058-printk-Add-force_early_printk-boot-param-to-help-wit.patch b/debian/patches-rt/0058-printk-Add-force_early_printk-boot-param-to-help-wit.patch index 68fc30c35..891f76a59 100644 --- a/debian/patches-rt/0058-printk-Add-force_early_printk-boot-param-to-help-wit.patch +++ b/debian/patches-rt/0058-printk-Add-force_early_printk-boot-param-to-help-wit.patch @@ -1,9 +1,8 @@ -From fa9f6eea1ebbb987a57d889ad00f142a21aa1843 Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Fri, 2 Sep 2011 14:41:29 +0200 -Subject: [PATCH 058/347] printk: Add "force_early_printk" boot param to help +Subject: [PATCH 058/342] printk: Add "force_early_printk" boot param to help with debugging -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=5bc26d1775b46f51023f203f4eab5c1068cc165c Gives me an option to screw printk and actually see what the machine says. @@ -34,6 +33,3 @@ index 963c20ab9548..7b774743e1ac 100644 void printk_kill(void) { printk_killswitch = true; --- -2.36.1 - diff --git a/debian/patches-rt/0059-preempt-Provide-preempt_-_-no-rt-variants.patch b/debian/patches-rt/0059-preempt-Provide-preempt_-_-no-rt-variants.patch index c4b54be3a..06a260365 100644 --- a/debian/patches-rt/0059-preempt-Provide-preempt_-_-no-rt-variants.patch +++ b/debian/patches-rt/0059-preempt-Provide-preempt_-_-no-rt-variants.patch @@ -1,8 +1,7 @@ -From 284c759a4a661cea5ac84fac628731f6b79d6b2e Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Fri, 24 Jul 2009 12:38:56 +0200 -Subject: [PATCH 059/347] preempt: Provide preempt_*_(no)rt variants -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 059/342] preempt: Provide preempt_*_(no)rt variants +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=53b5cbf2736307303fe726f09c6036bc8490fa9e RT needs a few preempt_disable/enable points which are not necessary otherwise. Implement variants to avoid #ifdeffery. @@ -48,6 +47,3 @@ index 3196d0e76719..f7a17fcc3fec 100644 #ifdef CONFIG_PREEMPT_NOTIFIERS struct preempt_notifier; --- -2.36.1 - diff --git a/debian/patches-rt/0060-futex-workaround-migrate_disable-enable-in-different.patch b/debian/patches-rt/0060-futex-workaround-migrate_disable-enable-in-different.patch index 373f02a64..f589e420b 100644 --- a/debian/patches-rt/0060-futex-workaround-migrate_disable-enable-in-different.patch +++ b/debian/patches-rt/0060-futex-workaround-migrate_disable-enable-in-different.patch @@ -1,9 +1,8 @@ -From d142001fdbdd8cc5fb558e9c3fa110f575875355 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Wed, 8 Mar 2017 14:23:35 +0100 -Subject: [PATCH 060/347] futex: workaround migrate_disable/enable in different +Subject: [PATCH 060/342] futex: workaround migrate_disable/enable in different context -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=1b4d3dbc8790453456e4eed79e76cc04c35af965 migrate_disable()/migrate_enable() takes a different path in atomic() vs !atomic() context. These little hacks ensure that we don't underflow / overflow @@ -65,6 +64,3 @@ index 3c67da9b8408..fac994367189 100644 put_pi_state(pi_state); /* --- -2.36.1 - diff --git a/debian/patches-rt/0061-rt-Add-local-irq-locks.patch b/debian/patches-rt/0061-rt-Add-local-irq-locks.patch index 205579b09..3b46f2259 100644 --- a/debian/patches-rt/0061-rt-Add-local-irq-locks.patch +++ b/debian/patches-rt/0061-rt-Add-local-irq-locks.patch @@ -1,8 +1,7 @@ -From d870e74a28988a6bb802f1e4bffd33297e63053f Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Mon, 20 Jun 2011 09:03:47 +0200 -Subject: [PATCH 061/347] rt: Add local irq locks -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 061/342] rt: Add local irq locks +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=c059c18f3ffb8049cb8d1e3f674ce1dadd9e1716 Introduce locallock. For !RT this maps to preempt_disable()/ local_irq_disable() so there is not much that changes. For RT this will @@ -336,6 +335,3 @@ index 70b7123f38c7..24421bf8c4b3 100644 /* minimum unit size, also is the maximum supported allocation size */ #define PCPU_MIN_UNIT_SIZE PFN_ALIGN(32 << 10) --- -2.36.1 - diff --git a/debian/patches-rt/0062-locallock-provide-get-put-_locked_ptr-variants.patch b/debian/patches-rt/0062-locallock-provide-get-put-_locked_ptr-variants.patch index d3d7ffdeb..59782baab 100644 --- a/debian/patches-rt/0062-locallock-provide-get-put-_locked_ptr-variants.patch +++ b/debian/patches-rt/0062-locallock-provide-get-put-_locked_ptr-variants.patch @@ -1,8 +1,7 @@ -From 5b024e1bb773440c6f4c48fdb21090bfadab8a7a Mon Sep 17 00:00:00 2001 From: Julia Cartwright Date: Mon, 7 May 2018 08:58:56 -0500 -Subject: [PATCH 062/347] locallock: provide {get,put}_locked_ptr() variants -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 062/342] locallock: provide {get,put}_locked_ptr() variants +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=a103d13e1c82e65714758163ca6a573a1192099c Provide a set of locallocked accessors for pointers to per-CPU data; this is useful for dynamically-allocated per-CPU regions, for example. @@ -44,6 +43,3 @@ index d658c2552601..921eab83cd34 100644 #define local_lock_cpu(lvar) get_cpu() #define local_unlock_cpu(lvar) put_cpu() --- -2.36.1 - diff --git a/debian/patches-rt/0063-mm-scatterlist-Do-not-disable-irqs-on-RT.patch b/debian/patches-rt/0063-mm-scatterlist-Do-not-disable-irqs-on-RT.patch index 368da63b4..41f44b72e 100644 --- a/debian/patches-rt/0063-mm-scatterlist-Do-not-disable-irqs-on-RT.patch +++ b/debian/patches-rt/0063-mm-scatterlist-Do-not-disable-irqs-on-RT.patch @@ -1,8 +1,7 @@ -From 48680d53abae6cad7df7eb850fb2acb81da70ef8 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Fri, 3 Jul 2009 08:44:34 -0500 -Subject: [PATCH 063/347] mm/scatterlist: Do not disable irqs on RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 063/342] mm/scatterlist: Do not disable irqs on RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=e9f18c257d54ad5d2aab765ab83165b1f914a211 For -RT it is enough to keep pagefault disabled (which is currently handled by kmap_atomic()). @@ -25,6 +24,3 @@ index 3b859201f84c..093c3aa3d895 100644 kunmap_atomic(miter->addr); } else kunmap(miter->page); --- -2.36.1 - diff --git a/debian/patches-rt/0064-signal-x86-Delay-calling-signals-in-atomic.patch b/debian/patches-rt/0064-signal-x86-Delay-calling-signals-in-atomic.patch index 8acb6a058..fac2bd9ec 100644 --- a/debian/patches-rt/0064-signal-x86-Delay-calling-signals-in-atomic.patch +++ b/debian/patches-rt/0064-signal-x86-Delay-calling-signals-in-atomic.patch @@ -1,8 +1,7 @@ -From 47c69a6b85d4820b49840b1bd914a970e7eb6851 Mon Sep 17 00:00:00 2001 From: Oleg Nesterov Date: Tue, 14 Jul 2015 14:26:34 +0200 -Subject: [PATCH 064/347] signal/x86: Delay calling signals in atomic -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 064/342] signal/x86: Delay calling signals in atomic +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=b34409a64f8206c8591fe1e49021a5b10f2da5d8 On x86_64 we must disable preemption before we enable interrupts for stack faults, int3 and debugging, because the current task is using @@ -95,7 +94,7 @@ index 52069b9ddce8..56047f57ebc7 100644 size_t sas_ss_size; unsigned int sas_ss_flags; diff --git a/kernel/signal.c b/kernel/signal.c -index 23764988b5d1..58bd3b3dd499 100644 +index 5f2df0301cd2..708ee1bd4059 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -1283,8 +1283,8 @@ int do_send_sig_info(int sig, struct siginfo *info, struct task_struct *p, @@ -149,6 +148,3 @@ index 23764988b5d1..58bd3b3dd499 100644 /* * Nuke all other threads in the group. */ --- -2.36.1 - diff --git a/debian/patches-rt/0065-x86-signal-delay-calling-signals-on-32bit.patch b/debian/patches-rt/0065-x86-signal-delay-calling-signals-on-32bit.patch index d03ec8bc1..c5e0394ae 100644 --- a/debian/patches-rt/0065-x86-signal-delay-calling-signals-on-32bit.patch +++ b/debian/patches-rt/0065-x86-signal-delay-calling-signals-on-32bit.patch @@ -1,8 +1,7 @@ -From b2265189b45c7240033cc856851c5bbf4c2dc323 Mon Sep 17 00:00:00 2001 From: Yang Shi Date: Thu, 10 Dec 2015 10:58:51 -0800 -Subject: [PATCH 065/347] x86/signal: delay calling signals on 32bit -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 065/342] x86/signal: delay calling signals on 32bit +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=634425200c2407f794e54dfa9f59786e87b81860 When running some ptrace single step tests on x86-32 machine, the below problem is triggered: @@ -44,6 +43,3 @@ index fb0438d06ca7..c00e27af2205 100644 #define ARCH_RT_DELAYS_SIGNAL_SEND #endif --- -2.36.1 - diff --git a/debian/patches-rt/0066-buffer_head-Replace-bh_uptodate_lock-for-rt.patch b/debian/patches-rt/0066-buffer_head-Replace-bh_uptodate_lock-for-rt.patch index 711c91563..4fb0d2e07 100644 --- a/debian/patches-rt/0066-buffer_head-Replace-bh_uptodate_lock-for-rt.patch +++ b/debian/patches-rt/0066-buffer_head-Replace-bh_uptodate_lock-for-rt.patch @@ -1,8 +1,7 @@ -From a309856cae0c403bb844c9c89bd345168c2f6ee1 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Fri, 18 Mar 2011 09:18:52 +0100 -Subject: [PATCH 066/347] buffer_head: Replace bh_uptodate_lock for -rt -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 066/342] buffer_head: Replace bh_uptodate_lock for -rt +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=83ebb8fff9183675790a74c7d47700e4498cc51a Wrap the bit_spin_lock calls into a separate inline and add the RT replacements with a real spinlock. @@ -192,6 +191,3 @@ index 9168fc33a4f7..572541d6cc90 100644 /* * macro tricks to expand the set_buffer_foo(), clear_buffer_foo() * and buffer_foo() functions. --- -2.36.1 - diff --git a/debian/patches-rt/0067-fs-jbd-jbd2-Make-state-lock-and-journal-head-lock-rt.patch b/debian/patches-rt/0067-fs-jbd-jbd2-Make-state-lock-and-journal-head-lock-rt.patch index 46bb6aca2..3f88de87a 100644 --- a/debian/patches-rt/0067-fs-jbd-jbd2-Make-state-lock-and-journal-head-lock-rt.patch +++ b/debian/patches-rt/0067-fs-jbd-jbd2-Make-state-lock-and-journal-head-lock-rt.patch @@ -1,9 +1,8 @@ -From 18cc82093eb65f5fc2db7ff78b49fd443c52da5c Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Fri, 18 Mar 2011 10:11:25 +0100 -Subject: [PATCH 067/347] fs: jbd/jbd2: Make state lock and journal head lock +Subject: [PATCH 067/342] fs: jbd/jbd2: Make state lock and journal head lock rt safe -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=f91a99950e81ad7b0afc52a031624f5c58aab806 bit_spin_locks break under RT. @@ -105,6 +104,3 @@ index 268f3000d1b3..8f5d6ecb802e 100644 } #define J_ASSERT(assert) BUG_ON(!(assert)) --- -2.36.1 - diff --git a/debian/patches-rt/0068-list_bl-Make-list-head-locking-RT-safe.patch b/debian/patches-rt/0068-list_bl-Make-list-head-locking-RT-safe.patch index 940959051..4a6b621f2 100644 --- a/debian/patches-rt/0068-list_bl-Make-list-head-locking-RT-safe.patch +++ b/debian/patches-rt/0068-list_bl-Make-list-head-locking-RT-safe.patch @@ -1,8 +1,7 @@ -From c1eeae383297bbad06f5e7b6d1dafa5ff5fb286e Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Fri, 21 Jun 2013 15:07:25 -0400 -Subject: [PATCH 068/347] list_bl: Make list head locking RT safe -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 068/342] list_bl: Make list head locking RT safe +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=51b2c6abf67d49a7986b6c833aed0acb1392865e As per changes in include/linux/jbd_common.h for avoiding the bit_spin_locks on RT ("fs: jbd/jbd2: Make state lock and journal @@ -116,6 +115,3 @@ index 3fc2cc57ba1b..69b659259bac 100644 } static inline bool hlist_bl_is_locked(struct hlist_bl_head *b) --- -2.36.1 - diff --git a/debian/patches-rt/0069-list_bl-fixup-bogus-lockdep-warning.patch b/debian/patches-rt/0069-list_bl-fixup-bogus-lockdep-warning.patch index 9fe3abb77..bbb6e593d 100644 --- a/debian/patches-rt/0069-list_bl-fixup-bogus-lockdep-warning.patch +++ b/debian/patches-rt/0069-list_bl-fixup-bogus-lockdep-warning.patch @@ -1,8 +1,7 @@ -From 6702144cc338594e14d79ce9dd255f50d21840f9 Mon Sep 17 00:00:00 2001 From: Josh Cartwright Date: Thu, 31 Mar 2016 00:04:25 -0500 -Subject: [PATCH 069/347] list_bl: fixup bogus lockdep warning -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 069/342] list_bl: fixup bogus lockdep warning +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=31f4da06270d71015ad1d8d03c45fdba34ef07bb At first glance, the use of 'static inline' seems appropriate for INIT_HLIST_BL_HEAD(). @@ -99,6 +98,3 @@ index 69b659259bac..0b5de7d9ffcf 100644 static inline void INIT_HLIST_BL_NODE(struct hlist_bl_node *h) { --- -2.36.1 - diff --git a/debian/patches-rt/0070-genirq-Disable-irqpoll-on-rt.patch b/debian/patches-rt/0070-genirq-Disable-irqpoll-on-rt.patch index 1bb671732..d05578e64 100644 --- a/debian/patches-rt/0070-genirq-Disable-irqpoll-on-rt.patch +++ b/debian/patches-rt/0070-genirq-Disable-irqpoll-on-rt.patch @@ -1,8 +1,7 @@ -From 9e5ed96dec7a2d9bf3359966eec008c2434610d6 Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Fri, 3 Jul 2009 08:29:57 -0500 -Subject: [PATCH 070/347] genirq: Disable irqpoll on -rt -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 070/342] genirq: Disable irqpoll on -rt +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=eb89b91111430b636ef8decb3c4b1043fff1658b Creates long latencies for no value @@ -38,6 +37,3 @@ index d867d6ddafdd..cd12ee86c01e 100644 irqfixup = 2; printk(KERN_WARNING "Misrouted IRQ fixup and polling support " "enabled\n"); --- -2.36.1 - diff --git a/debian/patches-rt/0071-genirq-Force-interrupt-thread-on-RT.patch b/debian/patches-rt/0071-genirq-Force-interrupt-thread-on-RT.patch index 9eb44beb4..70501763b 100644 --- a/debian/patches-rt/0071-genirq-Force-interrupt-thread-on-RT.patch +++ b/debian/patches-rt/0071-genirq-Force-interrupt-thread-on-RT.patch @@ -1,8 +1,7 @@ -From d4c832ada3bdbd395d69e11232761697f6ed9523 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Sun, 3 Apr 2011 11:57:29 +0200 -Subject: [PATCH 071/347] genirq: Force interrupt thread on RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 071/342] genirq: Force interrupt thread on RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=9ed3c480f56be478ccd03c80943df887b0e0baa6 Force threaded_irqs and optimize the code (force_irqthreads) in regard to this. @@ -49,6 +48,3 @@ index 18f3cdbf41fd..f12f50f5b605 100644 #endif static void __synchronize_hardirq(struct irq_desc *desc, bool sync_chip) --- -2.36.1 - diff --git a/debian/patches-rt/0072-Split-IRQ-off-and-zone-lock-while-freeing-pages-from.patch b/debian/patches-rt/0072-Split-IRQ-off-and-zone-lock-while-freeing-pages-from.patch index deadce9a4..71f2952c5 100644 --- a/debian/patches-rt/0072-Split-IRQ-off-and-zone-lock-while-freeing-pages-from.patch +++ b/debian/patches-rt/0072-Split-IRQ-off-and-zone-lock-while-freeing-pages-from.patch @@ -1,9 +1,8 @@ -From a2351869ba46346be8b541abd8f1ca7a81df2537 Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Mon, 28 May 2018 15:24:20 +0200 -Subject: [PATCH 072/347] Split IRQ-off and zone->lock while freeing pages from +Subject: [PATCH 072/342] Split IRQ-off and zone->lock while freeing pages from PCP list #1 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=214e6808e3ae9655e1530a4da1698e20754a33a5 Split the IRQ-off section while accessing the PCP list from zone->lock while freeing pages. @@ -168,6 +167,3 @@ index 9c35403d9646..6763dfc2dde0 100644 } } --- -2.36.1 - diff --git a/debian/patches-rt/0073-Split-IRQ-off-and-zone-lock-while-freeing-pages-from.patch b/debian/patches-rt/0073-Split-IRQ-off-and-zone-lock-while-freeing-pages-from.patch index f19c558a2..eddc1c4de 100644 --- a/debian/patches-rt/0073-Split-IRQ-off-and-zone-lock-while-freeing-pages-from.patch +++ b/debian/patches-rt/0073-Split-IRQ-off-and-zone-lock-while-freeing-pages-from.patch @@ -1,9 +1,8 @@ -From 2c267f4e1c964c28022ee12c9b86f07854427ac5 Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Mon, 28 May 2018 15:24:21 +0200 -Subject: [PATCH 073/347] Split IRQ-off and zone->lock while freeing pages from +Subject: [PATCH 073/342] Split IRQ-off and zone->lock while freeing pages from PCP list #2 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=0a4d7be1a0591f795f80c043627b1c30d633459a Split the IRQ-off section while accessing the PCP list from zone->lock while freeing pages. @@ -167,6 +166,3 @@ index 6763dfc2dde0..ba6f9b334073 100644 } /* --- -2.36.1 - diff --git a/debian/patches-rt/0074-mm-SLxB-change-list_lock-to-raw_spinlock_t.patch b/debian/patches-rt/0074-mm-SLxB-change-list_lock-to-raw_spinlock_t.patch index 564ebe845..e3bd8de68 100644 --- a/debian/patches-rt/0074-mm-SLxB-change-list_lock-to-raw_spinlock_t.patch +++ b/debian/patches-rt/0074-mm-SLxB-change-list_lock-to-raw_spinlock_t.patch @@ -1,8 +1,7 @@ -From 3e8b37b77db38c83eaff3b8fdcd23e91f8d78613 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Mon, 28 May 2018 15:24:22 +0200 -Subject: [PATCH 074/347] mm/SLxB: change list_lock to raw_spinlock_t -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 074/342] mm/SLxB: change list_lock to raw_spinlock_t +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=d8c58de5abafe875e6c797d46f6a9272262d1358 The list_lock is used with used with IRQs off on RT. Make it a raw_spinlock_t otherwise the interrupts won't be disabled on -RT. The locking rules remain @@ -399,7 +398,7 @@ index 0ed7a463f476..12b7da32bcd0 100644 #ifdef CONFIG_SLAB struct list_head slabs_partial; /* partial list first, better asm code */ diff --git a/mm/slub.c b/mm/slub.c -index 499fb073d1ff..0e4670add1e9 100644 +index 0fefe0ad8f57..ef6fc4df3ed5 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -1182,7 +1182,7 @@ static noinline int free_debug_processing( @@ -465,7 +464,7 @@ index 499fb073d1ff..0e4670add1e9 100644 if (m == M_FREE) { stat(s, DEACTIVATE_EMPTY); -@@ -2187,10 +2187,10 @@ static void unfreeze_partials(struct kmem_cache *s, +@@ -2188,10 +2188,10 @@ static void unfreeze_partials(struct kmem_cache *s, n2 = get_node(s, page_to_nid(page)); if (n != n2) { if (n) @@ -478,7 +477,7 @@ index 499fb073d1ff..0e4670add1e9 100644 } do { -@@ -2219,7 +2219,7 @@ static void unfreeze_partials(struct kmem_cache *s, +@@ -2220,7 +2220,7 @@ static void unfreeze_partials(struct kmem_cache *s, } if (n) @@ -487,7 +486,7 @@ index 499fb073d1ff..0e4670add1e9 100644 while (discard_page) { page = discard_page; -@@ -2388,10 +2388,10 @@ static unsigned long count_partial(struct kmem_cache_node *n, +@@ -2387,10 +2387,10 @@ static unsigned long count_partial(struct kmem_cache_node *n, unsigned long x = 0; struct page *page; @@ -614,6 +613,3 @@ index 499fb073d1ff..0e4670add1e9 100644 } for (i = 0; i < t.count; i++) { --- -2.36.1 - diff --git a/debian/patches-rt/0075-mm-SLUB-delay-giving-back-empty-slubs-to-IRQ-enabled.patch b/debian/patches-rt/0075-mm-SLUB-delay-giving-back-empty-slubs-to-IRQ-enabled.patch index c62fd4658..0035016fb 100644 --- a/debian/patches-rt/0075-mm-SLUB-delay-giving-back-empty-slubs-to-IRQ-enabled.patch +++ b/debian/patches-rt/0075-mm-SLUB-delay-giving-back-empty-slubs-to-IRQ-enabled.patch @@ -1,9 +1,8 @@ -From 77ff019039696fc4bd8962110c689eb3520386b1 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Thu, 21 Jun 2018 17:29:19 +0200 -Subject: [PATCH 075/347] mm/SLUB: delay giving back empty slubs to IRQ enabled +Subject: [PATCH 075/342] mm/SLUB: delay giving back empty slubs to IRQ enabled regions -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=2ea46cd4066413ae217e7307020fa0e4a4cbc223 __free_slab() is invoked with disabled interrupts which increases the irq-off time while __free_pages() is doing the work. @@ -18,7 +17,7 @@ Signed-off-by: Sebastian Andrzej Siewior 1 file changed, 69 insertions(+), 5 deletions(-) diff --git a/mm/slub.c b/mm/slub.c -index 0e4670add1e9..a5a086ed4493 100644 +index ef6fc4df3ed5..e9abe4aa5801 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -1350,6 +1350,12 @@ static bool freelist_corrupted(struct kmem_cache *s, struct page *page, @@ -64,7 +63,7 @@ index 0e4670add1e9..a5a086ed4493 100644 } else __free_slab(s, page); } -@@ -2256,14 +2278,21 @@ static void put_cpu_partial(struct kmem_cache *s, struct page *page, int drain) +@@ -2257,14 +2279,21 @@ static void put_cpu_partial(struct kmem_cache *s, struct page *page, int drain) pobjects = oldpage->pobjects; pages = oldpage->pages; if (drain && pobjects > s->cpu_partial) { @@ -86,7 +85,7 @@ index 0e4670add1e9..a5a086ed4493 100644 oldpage = NULL; pobjects = 0; pages = 0; -@@ -2333,7 +2362,22 @@ static bool has_cpu_slab(int cpu, void *info) +@@ -2332,7 +2361,22 @@ static bool has_cpu_slab(int cpu, void *info) static void flush_all(struct kmem_cache *s) { @@ -109,7 +108,7 @@ index 0e4670add1e9..a5a086ed4493 100644 } /* -@@ -2531,8 +2575,10 @@ static inline void *get_freelist(struct kmem_cache *s, struct page *page) +@@ -2530,8 +2574,10 @@ static inline void *get_freelist(struct kmem_cache *s, struct page *page) * already disabled (which is the case for bulk allocation). */ static void *___slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node, @@ -218,6 +217,3 @@ index 0e4670add1e9..a5a086ed4493 100644 if (debug_guardpage_minorder()) slub_max_order = 0; --- -2.36.1 - diff --git a/debian/patches-rt/0076-mm-page_alloc-rt-friendly-per-cpu-pages.patch b/debian/patches-rt/0076-mm-page_alloc-rt-friendly-per-cpu-pages.patch index 819fc71a0..3422be6dc 100644 --- a/debian/patches-rt/0076-mm-page_alloc-rt-friendly-per-cpu-pages.patch +++ b/debian/patches-rt/0076-mm-page_alloc-rt-friendly-per-cpu-pages.patch @@ -1,8 +1,7 @@ -From 85f14b575e2fadf9ab80ef7b3e5158833d79939e Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Fri, 3 Jul 2009 08:29:37 -0500 -Subject: [PATCH 076/347] mm: page_alloc: rt-friendly per-cpu pages -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 076/342] mm: page_alloc: rt-friendly per-cpu pages +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=5a85fb64e5e9bd14a4754af946d40a154f966492 rt-friendly per-cpu pages: convert the irqs-off per-cpu locking method into a preemptible, explicit-per-cpu-locks method. @@ -234,6 +233,3 @@ index ba6f9b334073..59ea701ecfe0 100644 } #ifdef CONFIG_MEMORY_HOTREMOVE --- -2.36.1 - diff --git a/debian/patches-rt/0077-mm-swap-Convert-to-percpu-locked.patch b/debian/patches-rt/0077-mm-swap-Convert-to-percpu-locked.patch index a2925871b..46e35b420 100644 --- a/debian/patches-rt/0077-mm-swap-Convert-to-percpu-locked.patch +++ b/debian/patches-rt/0077-mm-swap-Convert-to-percpu-locked.patch @@ -1,8 +1,7 @@ -From cba209957a582e2758768ae3c7e5be17d11fc94a Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Fri, 3 Jul 2009 08:29:51 -0500 -Subject: [PATCH 077/347] mm/swap: Convert to percpu locked -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 077/342] mm/swap: Convert to percpu locked +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=40bb64bdb9f08a966387ce191c13d6042c979062 Replace global locks (get_cpu + local_irq_save) with "local_locks()". Currently there is one of for "rotate" and one for "swap". @@ -206,6 +205,3 @@ index 45fdbfb6b2a6..92f994b962f0 100644 } #ifdef CONFIG_SMP --- -2.36.1 - diff --git a/debian/patches-rt/0078-mm-perform-lru_add_drain_all-remotely.patch b/debian/patches-rt/0078-mm-perform-lru_add_drain_all-remotely.patch index 0983e2795..1c1bc4128 100644 --- a/debian/patches-rt/0078-mm-perform-lru_add_drain_all-remotely.patch +++ b/debian/patches-rt/0078-mm-perform-lru_add_drain_all-remotely.patch @@ -1,8 +1,7 @@ -From 9336f220ffe2a225210342f5977ec2636ffc8717 Mon Sep 17 00:00:00 2001 From: Luiz Capitulino Date: Fri, 27 May 2016 15:03:28 +0200 -Subject: [PATCH 078/347] mm: perform lru_add_drain_all() remotely -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 078/342] mm: perform lru_add_drain_all() remotely +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=0db71c6d6c532698314525788c98376e43ab8792 lru_add_drain_all() works by scheduling lru_add_drain_cpu() to run on all CPUs that have non-empty LRU pagevecs and then waiting for @@ -104,6 +103,3 @@ index 92f994b962f0..3885645a45ce 100644 mutex_unlock(&lock); } --- -2.36.1 - diff --git a/debian/patches-rt/0079-mm-vmstat-Protect-per-cpu-variables-with-preempt-dis.patch b/debian/patches-rt/0079-mm-vmstat-Protect-per-cpu-variables-with-preempt-dis.patch index 0c7ea39e8..0a244ba6a 100644 --- a/debian/patches-rt/0079-mm-vmstat-Protect-per-cpu-variables-with-preempt-dis.patch +++ b/debian/patches-rt/0079-mm-vmstat-Protect-per-cpu-variables-with-preempt-dis.patch @@ -1,9 +1,8 @@ -From a61a39e63a0af178f57da615a22877b00fee0a58 Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Fri, 3 Jul 2009 08:30:13 -0500 -Subject: [PATCH 079/347] mm/vmstat: Protect per cpu variables with preempt +Subject: [PATCH 079/342] mm/vmstat: Protect per cpu variables with preempt disable on RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=2f41021e38ad41f3fa1580a7d2562c242d06be06 Disable preemption on -RT for the vmstat code. On vanila the code runs in IRQ-off regions while on -RT it is not. "preempt_disable" ensures that the @@ -140,6 +139,3 @@ index 21e07e71ea2d..ff7c0d08f2b6 100644 } void __dec_zone_page_state(struct page *page, enum zone_stat_item item) --- -2.36.1 - diff --git a/debian/patches-rt/0080-ARM-Initialize-split-page-table-locks-for-vector-pag.patch b/debian/patches-rt/0080-ARM-Initialize-split-page-table-locks-for-vector-pag.patch index d983a6470..e9ce703fa 100644 --- a/debian/patches-rt/0080-ARM-Initialize-split-page-table-locks-for-vector-pag.patch +++ b/debian/patches-rt/0080-ARM-Initialize-split-page-table-locks-for-vector-pag.patch @@ -1,9 +1,8 @@ -From 2056bb928af7ba7036b8d058c0a52a182cd0b9b6 Mon Sep 17 00:00:00 2001 From: Frank Rowand Date: Sat, 1 Oct 2011 18:58:13 -0700 -Subject: [PATCH 080/347] ARM: Initialize split page table locks for vector +Subject: [PATCH 080/342] ARM: Initialize split page table locks for vector page -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=004b09285edbce245a32c7ba47b4c0d1ce080afe Without this patch, ARM can not use SPLIT_PTLOCK_CPUS if PREEMPT_RT_FULL=y because vectors_user_mapping() creates a @@ -71,6 +70,3 @@ index 82ab015bf42b..8d3c7ce34c24 100644 #ifdef CONFIG_KUSER_HELPERS /* * The vectors page is always readable from user space for the --- -2.36.1 - diff --git a/debian/patches-rt/0081-mm-Enable-SLUB-for-RT.patch b/debian/patches-rt/0081-mm-Enable-SLUB-for-RT.patch index 4d6e35faa..6636ce493 100644 --- a/debian/patches-rt/0081-mm-Enable-SLUB-for-RT.patch +++ b/debian/patches-rt/0081-mm-Enable-SLUB-for-RT.patch @@ -1,8 +1,7 @@ -From 24cc0bd393e472cf081687c51f59d2677a0ca367 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Thu, 25 Oct 2012 10:32:35 +0100 -Subject: [PATCH 081/347] mm: Enable SLUB for RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 081/342] mm: Enable SLUB for RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=66a902f49030b2d9bfb39fe4f55b1896c93f213d Avoid the memory allocation in IRQ section @@ -14,7 +13,7 @@ Signed-off-by: Sebastian Andrzej Siewior 1 file changed, 6 insertions(+) diff --git a/mm/slub.c b/mm/slub.c -index a5a086ed4493..959ccf873292 100644 +index e9abe4aa5801..ae6ab2cb4fbf 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -3734,6 +3734,11 @@ static void list_slab_objects(struct kmem_cache *s, struct page *page, @@ -37,6 +36,3 @@ index a5a086ed4493..959ccf873292 100644 } /* --- -2.36.1 - diff --git a/debian/patches-rt/0082-slub-Enable-irqs-for-__GFP_WAIT.patch b/debian/patches-rt/0082-slub-Enable-irqs-for-__GFP_WAIT.patch index 05fa462e3..280d17588 100644 --- a/debian/patches-rt/0082-slub-Enable-irqs-for-__GFP_WAIT.patch +++ b/debian/patches-rt/0082-slub-Enable-irqs-for-__GFP_WAIT.patch @@ -1,8 +1,7 @@ -From e2e03d2e904d1df3d1e70dd70d5d939a6f5ccb26 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Wed, 9 Jan 2013 12:08:15 +0100 -Subject: [PATCH 082/347] slub: Enable irqs for __GFP_WAIT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 082/342] slub: Enable irqs for __GFP_WAIT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=34456ee6c4c856f7cce8ac33edc699d985d3a9ed SYSTEM_RUNNING might be too late for enabling interrupts. Allocations with GFP_WAIT can happen before that. So use this as an indicator. @@ -13,7 +12,7 @@ Signed-off-by: Thomas Gleixner 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mm/slub.c b/mm/slub.c -index 959ccf873292..3b1edb545215 100644 +index ae6ab2cb4fbf..676006f34077 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -1597,10 +1597,17 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node) @@ -43,6 +42,3 @@ index 959ccf873292..3b1edb545215 100644 local_irq_disable(); if (!page) return NULL; --- -2.36.1 - diff --git a/debian/patches-rt/0083-slub-Disable-SLUB_CPU_PARTIAL.patch b/debian/patches-rt/0083-slub-Disable-SLUB_CPU_PARTIAL.patch index 12eef9aa5..737240239 100644 --- a/debian/patches-rt/0083-slub-Disable-SLUB_CPU_PARTIAL.patch +++ b/debian/patches-rt/0083-slub-Disable-SLUB_CPU_PARTIAL.patch @@ -1,8 +1,7 @@ -From 1a6400867d9fa3d3e0c8d816c8ae5bb10c202e8a Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Wed, 15 Apr 2015 19:00:47 +0200 -Subject: [PATCH 083/347] slub: Disable SLUB_CPU_PARTIAL -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 083/342] slub: Disable SLUB_CPU_PARTIAL +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=3cd2c1912d56bbd633cd7fb9da7e156ec2c8019f |BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:915 |in_atomic(): 1, irqs_disabled(): 0, pid: 87, name: rcuop/7 @@ -49,6 +48,3 @@ index 1793e8bd71ef..0c912e74ee40 100644 bool "SLUB per cpu partial cache" help Per cpu partial caches accellerate objects allocation and freeing --- -2.36.1 - diff --git a/debian/patches-rt/0084-mm-memcontrol-Don-t-call-schedule_work_on-in-preempt.patch b/debian/patches-rt/0084-mm-memcontrol-Don-t-call-schedule_work_on-in-preempt.patch index ddb288711..a48bfa868 100644 --- a/debian/patches-rt/0084-mm-memcontrol-Don-t-call-schedule_work_on-in-preempt.patch +++ b/debian/patches-rt/0084-mm-memcontrol-Don-t-call-schedule_work_on-in-preempt.patch @@ -1,9 +1,8 @@ -From 6b3d7c229967c2b2c01394e4dadcc8f210d52fa0 Mon Sep 17 00:00:00 2001 From: Yang Shi Date: Wed, 30 Oct 2013 11:48:33 -0700 -Subject: [PATCH 084/347] mm/memcontrol: Don't call schedule_work_on in +Subject: [PATCH 084/342] mm/memcontrol: Don't call schedule_work_on in preemption disabled context -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=1453dc8469e34b538adc7c22d2e33f0c4b017153 The following trace is triggered when running ltp oom test cases: @@ -70,6 +69,3 @@ index f3aa6e6214d5..281d74f86892 100644 mutex_unlock(&percpu_charge_mutex); } --- -2.36.1 - diff --git a/debian/patches-rt/0085-mm-memcontrol-Replace-local_irq_disable-with-local-l.patch b/debian/patches-rt/0085-mm-memcontrol-Replace-local_irq_disable-with-local-l.patch index 8da70c668..c58a81b82 100644 --- a/debian/patches-rt/0085-mm-memcontrol-Replace-local_irq_disable-with-local-l.patch +++ b/debian/patches-rt/0085-mm-memcontrol-Replace-local_irq_disable-with-local-l.patch @@ -1,9 +1,8 @@ -From d5d11c92081bb9edd9eb11cd752a325f8822a0a5 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Wed, 28 Jan 2015 17:14:16 +0100 -Subject: [PATCH 085/347] mm/memcontrol: Replace local_irq_disable with local +Subject: [PATCH 085/342] mm/memcontrol: Replace local_irq_disable with local locks -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=c695d8d84b8950d1dbadfb23f5135d0482c74014 There are a few local_irq_disable() which then take sleeping locks. This patch converts them local locks. @@ -119,6 +118,3 @@ index 281d74f86892..239fec6eac9f 100644 } /** --- -2.36.1 - diff --git a/debian/patches-rt/0086-mm-zsmalloc-copy-with-get_cpu_var-and-locking.patch b/debian/patches-rt/0086-mm-zsmalloc-copy-with-get_cpu_var-and-locking.patch index a3f158052..5933d34ed 100644 --- a/debian/patches-rt/0086-mm-zsmalloc-copy-with-get_cpu_var-and-locking.patch +++ b/debian/patches-rt/0086-mm-zsmalloc-copy-with-get_cpu_var-and-locking.patch @@ -1,8 +1,7 @@ -From 7041bc73c6e3c572934b9c42968151577521955e Mon Sep 17 00:00:00 2001 From: Mike Galbraith Date: Tue, 22 Mar 2016 11:16:09 +0100 -Subject: [PATCH 086/347] mm/zsmalloc: copy with get_cpu_var() and locking -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 086/342] mm/zsmalloc: copy with get_cpu_var() and locking +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=0d02aa51348471acca9af9ec915069b45e1709da get_cpu_var() disables preemption and triggers a might_sleep() splat later. This is replaced with get_locked_var(). @@ -198,6 +197,3 @@ index 4d71356ea66a..50c5c3922b07 100644 migrate_read_unlock(zspage); unpin_tag(handle); --- -2.36.1 - diff --git a/debian/patches-rt/0087-x86-mm-pat-disable-preemption-__split_large_page-aft.patch b/debian/patches-rt/0087-x86-mm-pat-disable-preemption-__split_large_page-aft.patch index 6f9e4c5a0..ef0db33f5 100644 --- a/debian/patches-rt/0087-x86-mm-pat-disable-preemption-__split_large_page-aft.patch +++ b/debian/patches-rt/0087-x86-mm-pat-disable-preemption-__split_large_page-aft.patch @@ -1,9 +1,8 @@ -From 0d3b3e949716c72656373354c9658f523cf369a2 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Tue, 11 Dec 2018 21:53:43 +0100 -Subject: [PATCH 087/347] x86/mm/pat: disable preemption __split_large_page() +Subject: [PATCH 087/342] x86/mm/pat: disable preemption __split_large_page() after spin_lock() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=ee35c399cafe97f822c232c385f3e5be619dbe9e Commit "x86/mm/pat: Disable preemption around __flush_tlb_all()" added a warning if __flush_tlb_all() is invoked in preemptible context. On !RT @@ -57,6 +56,3 @@ index 101f3ad0d6ad..0b0396261ca1 100644 spin_unlock(&pgd_lock); return 0; --- -2.36.1 - diff --git a/debian/patches-rt/0088-radix-tree-use-local-locks.patch b/debian/patches-rt/0088-radix-tree-use-local-locks.patch index 97af42757..8a8531ebb 100644 --- a/debian/patches-rt/0088-radix-tree-use-local-locks.patch +++ b/debian/patches-rt/0088-radix-tree-use-local-locks.patch @@ -1,8 +1,7 @@ -From af6ad9480a842859f957315fdf189b6ad041a4be Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Wed, 25 Jan 2017 16:34:27 +0100 -Subject: [PATCH 088/347] radix-tree: use local locks -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 088/342] radix-tree: use local locks +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=234dfd00f2c617fbc93207317ac69f2dba0bb05a The preload functionality uses per-CPU variables and preempt-disable to ensure that it does not switch CPUs during its usage. This patch adds @@ -171,6 +170,3 @@ index e5cab5c4e383..9309e813bc1f 100644 if (!this_cpu_read(ida_bitmap)) { struct ida_bitmap *bitmap = kzalloc(sizeof(*bitmap), gfp); --- -2.36.1 - diff --git a/debian/patches-rt/0089-timers-Prepare-for-full-preemption.patch b/debian/patches-rt/0089-timers-Prepare-for-full-preemption.patch index 35a649740..8fba12012 100644 --- a/debian/patches-rt/0089-timers-Prepare-for-full-preemption.patch +++ b/debian/patches-rt/0089-timers-Prepare-for-full-preemption.patch @@ -1,8 +1,7 @@ -From 413cdf16e5561fbf143c28525fe70c1fd441a624 Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Fri, 3 Jul 2009 08:29:34 -0500 -Subject: [PATCH 089/347] timers: Prepare for full preemption -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 089/342] timers: Prepare for full preemption +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=6e530eb3ecf4c019b3d4a2b5f00c0dcd295c741f When softirqs can be preempted we need to make sure that cancelling the timer from the active thread can not deadlock vs. a running timer @@ -171,6 +170,3 @@ index a6e88d9bb931..0043bf8e2c90 100644 } } --- -2.36.1 - diff --git a/debian/patches-rt/0090-x86-kvm-Require-const-tsc-for-RT.patch b/debian/patches-rt/0090-x86-kvm-Require-const-tsc-for-RT.patch index f748cb9d8..1f8082f04 100644 --- a/debian/patches-rt/0090-x86-kvm-Require-const-tsc-for-RT.patch +++ b/debian/patches-rt/0090-x86-kvm-Require-const-tsc-for-RT.patch @@ -1,8 +1,7 @@ -From 53f33d36d7741754ec7b7f2e4a0c62faa30d6902 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Sun, 6 Nov 2011 12:26:18 +0100 -Subject: [PATCH 090/347] x86: kvm Require const tsc for RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 090/342] x86: kvm Require const tsc for RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=6a78a1abd53560fa236781a743b6991f1d2115c5 Non constant TSC is a nightmare on bare metal already, but with virtualization it becomes a complete disaster because the workarounds @@ -15,10 +14,10 @@ Signed-off-by: Thomas Gleixner 1 file changed, 7 insertions(+) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c -index 417abc9ba1ad..9829e0fbdd41 100644 +index be4697d91bb2..11391b7ace1e 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c -@@ -6875,6 +6875,13 @@ int kvm_arch_init(void *opaque) +@@ -6879,6 +6879,13 @@ int kvm_arch_init(void *opaque) goto out; } @@ -32,6 +31,3 @@ index 417abc9ba1ad..9829e0fbdd41 100644 r = kvm_mmu_module_init(); if (r) goto out_free_percpu; --- -2.36.1 - diff --git a/debian/patches-rt/0091-pci-switchtec-Don-t-use-completion-s-wait-queue.patch b/debian/patches-rt/0091-pci-switchtec-Don-t-use-completion-s-wait-queue.patch index c42b306c1..9b54f7f8b 100644 --- a/debian/patches-rt/0091-pci-switchtec-Don-t-use-completion-s-wait-queue.patch +++ b/debian/patches-rt/0091-pci-switchtec-Don-t-use-completion-s-wait-queue.patch @@ -1,8 +1,7 @@ -From aec60cbb460a43de9b530e8b08d24c032292c210 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Wed, 4 Oct 2017 10:24:23 +0200 -Subject: [PATCH 091/347] pci/switchtec: Don't use completion's wait queue -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 091/342] pci/switchtec: Don't use completion's wait queue +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=bc4efd9eda261dc33bbd4879e5372415434f2b73 The poll callback is using completion's wait_queue_head_t member and puts it in poll_wait() so the poll() caller gets a wakeup after command @@ -110,6 +109,3 @@ index 291c0074ad6f..a8df847bedee 100644 list_del_init(&stuser->list); stuser_put(stuser); } --- -2.36.1 - diff --git a/debian/patches-rt/0092-wait.h-include-atomic.h.patch b/debian/patches-rt/0092-wait.h-include-atomic.h.patch index 03bf6c567..c41af172e 100644 --- a/debian/patches-rt/0092-wait.h-include-atomic.h.patch +++ b/debian/patches-rt/0092-wait.h-include-atomic.h.patch @@ -1,11 +1,10 @@ -From d06c78959ab56d0307d0d41aa75324ab707d0ca3 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Mon, 28 Oct 2013 12:19:57 +0100 -Subject: [PATCH 092/347] wait.h: include atomic.h +Subject: [PATCH 092/342] wait.h: include atomic.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=c5650d84f71a6e552239a8cb37bfd4c4f71c3694 | CC init/main.o |In file included from include/linux/mmzone.h:9:0, @@ -37,6 +36,3 @@ index 1d726d79063c..189da6e44756 100644 typedef struct wait_queue_entry wait_queue_entry_t; --- -2.36.1 - diff --git a/debian/patches-rt/0093-work-simple-Simple-work-queue-implemenation.patch b/debian/patches-rt/0093-work-simple-Simple-work-queue-implemenation.patch index 4c0335469..9e5fcdae8 100644 --- a/debian/patches-rt/0093-work-simple-Simple-work-queue-implemenation.patch +++ b/debian/patches-rt/0093-work-simple-Simple-work-queue-implemenation.patch @@ -1,8 +1,7 @@ -From fd404eb0247d5c8b5574eb138485984a7e7568ef Mon Sep 17 00:00:00 2001 From: Daniel Wagner Date: Fri, 11 Jul 2014 15:26:11 +0200 -Subject: [PATCH 093/347] work-simple: Simple work queue implemenation -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 093/342] work-simple: Simple work queue implemenation +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=1db798e94e6356004af3d7f40120bfa1d3085575 Provides a framework for enqueuing callbacks from irq context PREEMPT_RT_FULL safe. The callbacks are executed in kthread context. @@ -241,6 +240,3 @@ index 000000000000..a5b89fdacf19 + mutex_unlock(&worker_mutex); +} +EXPORT_SYMBOL_GPL(swork_put); --- -2.36.1 - diff --git a/debian/patches-rt/0094-work-simple-drop-a-shit-statement-in-SWORK_EVENT_PEN.patch b/debian/patches-rt/0094-work-simple-drop-a-shit-statement-in-SWORK_EVENT_PEN.patch index 873809a1b..870364e7c 100644 --- a/debian/patches-rt/0094-work-simple-drop-a-shit-statement-in-SWORK_EVENT_PEN.patch +++ b/debian/patches-rt/0094-work-simple-drop-a-shit-statement-in-SWORK_EVENT_PEN.patch @@ -1,9 +1,8 @@ -From eb5624af6c4a8461799304ee91b9d0fe34acfcb2 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Mon, 10 Sep 2018 18:00:31 +0200 -Subject: [PATCH 094/347] work-simple: drop a shit statement in +Subject: [PATCH 094/342] work-simple: drop a shit statement in SWORK_EVENT_PENDING -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=0792de6350ded4bfe1e75e38094d9a96714f2345 Dan Carpenter reported | smatch warnings: @@ -32,6 +31,3 @@ index a5b89fdacf19..c90d14b9b126 100644 static DEFINE_MUTEX(worker_mutex); static struct sworker *glob_worker; --- -2.36.1 - diff --git a/debian/patches-rt/0095-completion-Use-simple-wait-queues.patch b/debian/patches-rt/0095-completion-Use-simple-wait-queues.patch index 34be7740f..03ed158d5 100644 --- a/debian/patches-rt/0095-completion-Use-simple-wait-queues.patch +++ b/debian/patches-rt/0095-completion-Use-simple-wait-queues.patch @@ -1,8 +1,7 @@ -From 6a60230ca64d58b651171ad00c84b251a7fd2046 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Fri, 11 Jan 2013 11:23:51 +0100 -Subject: [PATCH 095/347] completion: Use simple wait queues -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 095/342] completion: Use simple wait queues +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=2d23a63b2ce2dac0f15ecccec672b163dc974c1b Completions have no long lasting callbacks and therefor do not need the complex waitqueue variant. Use simple waitqueues which reduces the @@ -386,6 +385,3 @@ index 66b59ac77c22..c7cb30cdd1b7 100644 { wait->task = current; if (list_empty(&wait->task_list)) --- -2.36.1 - diff --git a/debian/patches-rt/0096-fs-aio-simple-simple-work.patch b/debian/patches-rt/0096-fs-aio-simple-simple-work.patch index 3ac3a9d89..862846974 100644 --- a/debian/patches-rt/0096-fs-aio-simple-simple-work.patch +++ b/debian/patches-rt/0096-fs-aio-simple-simple-work.patch @@ -1,8 +1,7 @@ -From ccc2aded5c27d9bb441bcbe15f50369c098d4440 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Mon, 16 Feb 2015 18:49:10 +0100 -Subject: [PATCH 096/347] fs/aio: simple simple work -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 096/342] fs/aio: simple simple work +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=4617d96a1bbab94f3bcd001e87d8180e39423e14 |BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:768 |in_atomic(): 1, irqs_disabled(): 0, pid: 26, name: rcuos/2 @@ -84,6 +83,3 @@ index 9635c29b83da..21eacb0f3f56 100644 static int ioctx_add_table(struct kioctx *ctx, struct mm_struct *mm) { unsigned i, new_nr; --- -2.36.1 - diff --git a/debian/patches-rt/0097-time-hrtimer-avoid-schedule_work-with-interrupts-dis.patch b/debian/patches-rt/0097-time-hrtimer-avoid-schedule_work-with-interrupts-dis.patch index c3dd3b73e..0ecc12bf9 100644 --- a/debian/patches-rt/0097-time-hrtimer-avoid-schedule_work-with-interrupts-dis.patch +++ b/debian/patches-rt/0097-time-hrtimer-avoid-schedule_work-with-interrupts-dis.patch @@ -1,9 +1,8 @@ -From 97abf968e205dd81621ca60a59060f3eda0c7081 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Wed, 15 Nov 2017 17:29:51 +0100 -Subject: [PATCH 097/347] time/hrtimer: avoid schedule_work() with interrupts +Subject: [PATCH 097/342] time/hrtimer: avoid schedule_work() with interrupts disabled -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=aedfbca1bdb44eeadb289b485e48abe2fb8f387c The NOHZ code tries to schedule a workqueue with interrupts disabled. Since this does not work -RT I am switching it to swork instead. @@ -55,6 +54,3 @@ index 0043bf8e2c90..3cb79167852f 100644 int timer_migration_handler(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) --- -2.36.1 - diff --git a/debian/patches-rt/0098-hrtimer-consolidate-hrtimer_init-hrtimer_init_sleepe.patch b/debian/patches-rt/0098-hrtimer-consolidate-hrtimer_init-hrtimer_init_sleepe.patch index 997af2fb1..fcc2e35a7 100644 --- a/debian/patches-rt/0098-hrtimer-consolidate-hrtimer_init-hrtimer_init_sleepe.patch +++ b/debian/patches-rt/0098-hrtimer-consolidate-hrtimer_init-hrtimer_init_sleepe.patch @@ -1,9 +1,8 @@ -From 4b2913d980738fe5078dd581af6d6183c40a0616 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Tue, 3 Jul 2018 11:25:41 +0200 -Subject: [PATCH 098/347] hrtimer: consolidate hrtimer_init() + +Subject: [PATCH 098/342] hrtimer: consolidate hrtimer_init() + hrtimer_init_sleeper() calls -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=07da73a0fed15ec8893cb1866155b59c290a3238 hrtimer_init_sleeper() calls require a prior initialisation of the hrtimer object with hrtimer_init(). Lets make the initialisation of @@ -285,6 +284,3 @@ index 3714cd9e3111..2cea192b1475 100644 do { set_current_state(TASK_INTERRUPTIBLE); hrtimer_start_expires(&t.timer, HRTIMER_MODE_ABS); --- -2.36.1 - diff --git a/debian/patches-rt/0099-hrtimers-Prepare-full-preemption.patch b/debian/patches-rt/0099-hrtimers-Prepare-full-preemption.patch index 897f91d52..8883a33f1 100644 --- a/debian/patches-rt/0099-hrtimers-Prepare-full-preemption.patch +++ b/debian/patches-rt/0099-hrtimers-Prepare-full-preemption.patch @@ -1,8 +1,7 @@ -From a5aed5c2dd54bdd010ed396577c328505028990d Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Fri, 3 Jul 2009 08:29:34 -0500 -Subject: [PATCH 099/347] hrtimers: Prepare full preemption -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 099/342] hrtimers: Prepare full preemption +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=ff266a71965e444605aee13d7b449196b60a9cb6 Make cancellation of a running callback in softirq context safe against preemption. @@ -285,6 +284,3 @@ index 48758108e055..2cf5aa704106 100644 goto retry_delete; } list_del(&timer->list); --- -2.36.1 - diff --git a/debian/patches-rt/0100-hrtimer-by-timers-by-default-into-the-softirq-contex.patch b/debian/patches-rt/0100-hrtimer-by-timers-by-default-into-the-softirq-contex.patch index 1b924bac1..06a7570b8 100644 --- a/debian/patches-rt/0100-hrtimer-by-timers-by-default-into-the-softirq-contex.patch +++ b/debian/patches-rt/0100-hrtimer-by-timers-by-default-into-the-softirq-contex.patch @@ -1,9 +1,8 @@ -From 8a7e45b02f567fa32754c24195d5c0d095069685 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Fri, 3 Jul 2009 08:44:31 -0500 -Subject: [PATCH 100/347] hrtimer: by timers by default into the softirq +Subject: [PATCH 100/342] hrtimer: by timers by default into the softirq context -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=f68468a5cbe2c273bed160e13102b7ed2a2dc653 We can't have hrtimers callbacks running in hardirq context on RT. Therefore the timers are deferred to the softirq context by default. @@ -66,7 +65,7 @@ index 8714f1a37d84..082147c07831 100644 /* diff --git a/kernel/events/core.c b/kernel/events/core.c -index 88dd1398ae88..7f2441f671d3 100644 +index ba66ea3ca705..11e9bbad4878 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -1108,7 +1108,7 @@ static void __perf_mux_hrtimer_init(struct perf_cpu_context *cpuctx, int cpu) @@ -232,6 +231,3 @@ index 6d60701dc636..328620fe85f6 100644 hrtimer->function = watchdog_timer_fn; hrtimer_start(hrtimer, ns_to_ktime(sample_period), HRTIMER_MODE_REL_PINNED); --- -2.36.1 - diff --git a/debian/patches-rt/0101-sched-fair-Make-the-hrtimers-non-hard-again.patch b/debian/patches-rt/0101-sched-fair-Make-the-hrtimers-non-hard-again.patch index 5e4c29b6b..f80f74104 100644 --- a/debian/patches-rt/0101-sched-fair-Make-the-hrtimers-non-hard-again.patch +++ b/debian/patches-rt/0101-sched-fair-Make-the-hrtimers-non-hard-again.patch @@ -1,8 +1,7 @@ -From 79daa2a0bfdb433f8f4dfb8fe3b3652199bf7cb8 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Tue, 8 Jan 2019 12:31:06 +0100 -Subject: [PATCH 101/347] sched/fair: Make the hrtimers non-hard again -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 101/342] sched/fair: Make the hrtimers non-hard again +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=90e4dd88198300e2cff6390921e007f8c9b65cd2 Since commit "sched/fair: Robustify CFS-bandwidth timer locking" both hrtimer can run in softirq context because now interrupts are disabled @@ -29,6 +28,3 @@ index d804b5443bb9..16940416d526 100644 cfs_b->slack_timer.function = sched_cfs_slack_timer; cfs_b->distribute_running = 0; } --- -2.36.1 - diff --git a/debian/patches-rt/0102-hrtimer-Move-schedule_work-call-to-helper-thread.patch b/debian/patches-rt/0102-hrtimer-Move-schedule_work-call-to-helper-thread.patch index 59bec99cb..1090eca9f 100644 --- a/debian/patches-rt/0102-hrtimer-Move-schedule_work-call-to-helper-thread.patch +++ b/debian/patches-rt/0102-hrtimer-Move-schedule_work-call-to-helper-thread.patch @@ -1,8 +1,7 @@ -From da39809d4f91a8c4a41fdf3f17fc892dc71dd9ae Mon Sep 17 00:00:00 2001 From: Yang Shi Date: Mon, 16 Sep 2013 14:09:19 -0700 -Subject: [PATCH 102/347] hrtimer: Move schedule_work call to helper thread -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 102/342] hrtimer: Move schedule_work call to helper thread +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=fb8fb1f4b937d13140f8318d40aa918bb3d56c6a When run ltp leapsec_timer test, the following call trace is caught: @@ -93,6 +92,3 @@ index e947f3b344ac..0833e5cf224d 100644 #else --- -2.36.1 - diff --git a/debian/patches-rt/0103-hrtimer-move-state-change-before-hrtimer_cancel-in-d.patch b/debian/patches-rt/0103-hrtimer-move-state-change-before-hrtimer_cancel-in-d.patch index d93342369..1f6332c5b 100644 --- a/debian/patches-rt/0103-hrtimer-move-state-change-before-hrtimer_cancel-in-d.patch +++ b/debian/patches-rt/0103-hrtimer-move-state-change-before-hrtimer_cancel-in-d.patch @@ -1,9 +1,8 @@ -From baa58a4f1714630ef1a780575a907b4f80344e19 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Thu, 6 Dec 2018 10:15:13 +0100 -Subject: [PATCH 103/347] hrtimer: move state change before hrtimer_cancel in +Subject: [PATCH 103/342] hrtimer: move state change before hrtimer_cancel in do_nanosleep() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=caa78d03cd12d437e13c46990f9bbf0d5e4213a2 There is a small window between setting t->task to NULL and waking the task up (which would set TASK_RUNNING). So the timer would fire, run and @@ -46,6 +45,3 @@ index 0833e5cf224d..009001f06d33 100644 if (!t->task) return 0; --- -2.36.1 - diff --git a/debian/patches-rt/0104-posix-timers-Thread-posix-cpu-timers-on-rt.patch b/debian/patches-rt/0104-posix-timers-Thread-posix-cpu-timers-on-rt.patch index 36a78b986..cfb97e0ec 100644 --- a/debian/patches-rt/0104-posix-timers-Thread-posix-cpu-timers-on-rt.patch +++ b/debian/patches-rt/0104-posix-timers-Thread-posix-cpu-timers-on-rt.patch @@ -1,8 +1,7 @@ -From 59ac8673b0cb63baa55b3058ba0cb36ecb14a9d7 Mon Sep 17 00:00:00 2001 From: John Stultz Date: Fri, 3 Jul 2009 08:29:58 -0500 -Subject: [PATCH 104/347] posix-timers: Thread posix-cpu-timers on -rt -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 104/342] posix-timers: Thread posix-cpu-timers on -rt +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=b9fccc98390795269e7eadabb5d45da878152469 posix-cpu-timer code takes non -rt safe locks in hard irq context. Move it to a thread. @@ -264,6 +263,3 @@ index bfaa44a80c03..2d29b269dc83 100644 /* * Set one of the process-wide special case CPU timers or RLIMIT_CPU. * The tsk->sighand->siglock must be held by the caller. --- -2.36.1 - diff --git a/debian/patches-rt/0105-sched-Move-task_struct-cleanup-to-RCU.patch b/debian/patches-rt/0105-sched-Move-task_struct-cleanup-to-RCU.patch index 8883673e8..35ae45e9c 100644 --- a/debian/patches-rt/0105-sched-Move-task_struct-cleanup-to-RCU.patch +++ b/debian/patches-rt/0105-sched-Move-task_struct-cleanup-to-RCU.patch @@ -1,8 +1,7 @@ -From 6b5806854133faa2eda014a6553665c6fa393d5e Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Tue, 31 May 2011 16:59:16 +0200 -Subject: [PATCH 105/347] sched: Move task_struct cleanup to RCU -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 105/342] sched: Move task_struct cleanup to RCU +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=db20a0cee5b392d2b8ed3c4190f110cb0bb4190f __put_task_struct() does quite some expensive work. We don't want to burden random tasks with that. @@ -91,6 +90,3 @@ index c27c196fd70e..f5a4c42233f0 100644 void __init __weak arch_task_cache_init(void) { } --- -2.36.1 - diff --git a/debian/patches-rt/0106-sched-Limit-the-number-of-task-migrations-per-batch.patch b/debian/patches-rt/0106-sched-Limit-the-number-of-task-migrations-per-batch.patch index 7c34d3924..9be17c7d6 100644 --- a/debian/patches-rt/0106-sched-Limit-the-number-of-task-migrations-per-batch.patch +++ b/debian/patches-rt/0106-sched-Limit-the-number-of-task-migrations-per-batch.patch @@ -1,8 +1,7 @@ -From 6447e629affa080b84d75e0f685848104a5601ee Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Mon, 6 Jun 2011 12:12:51 +0200 -Subject: [PATCH 106/347] sched: Limit the number of task migrations per batch -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 106/342] sched: Limit the number of task migrations per batch +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=f99e05418d4105ecba282a7b0f8213164425f903 Put an upper limit on the number of tasks which are migrated per batch to avoid large latencies. @@ -28,6 +27,3 @@ index 0f949b7738fd..4cc39856c4c6 100644 /* * period over which we measure -rt task CPU usage in us. --- -2.36.1 - diff --git a/debian/patches-rt/0107-sched-Move-mmdrop-to-RCU-on-RT.patch b/debian/patches-rt/0107-sched-Move-mmdrop-to-RCU-on-RT.patch index 9c6b2f686..c0c665ee2 100644 --- a/debian/patches-rt/0107-sched-Move-mmdrop-to-RCU-on-RT.patch +++ b/debian/patches-rt/0107-sched-Move-mmdrop-to-RCU-on-RT.patch @@ -1,8 +1,7 @@ -From 977952ae9f00231e71587f8dc135949a2bed15e2 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Mon, 6 Jun 2011 12:20:33 +0200 -Subject: [PATCH 107/347] sched: Move mmdrop to RCU on RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 107/342] sched: Move mmdrop to RCU on RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=8de90b6c82e68a3d721e0eab2caedb37ba27386a Takes sleeping locks and calls into the memory allocator, so nothing we want to do in task switch and oder atomic contexts. @@ -110,6 +109,3 @@ index 4cc39856c4c6..676b9b213991 100644 /* * Ensure that the idle task is using init_mm right before its CPU goes * offline. --- -2.36.1 - diff --git a/debian/patches-rt/0108-kernel-sched-move-stack-kprobe-clean-up-to-__put_tas.patch b/debian/patches-rt/0108-kernel-sched-move-stack-kprobe-clean-up-to-__put_tas.patch index da1b8eee6..b5ae2dbe7 100644 --- a/debian/patches-rt/0108-kernel-sched-move-stack-kprobe-clean-up-to-__put_tas.patch +++ b/debian/patches-rt/0108-kernel-sched-move-stack-kprobe-clean-up-to-__put_tas.patch @@ -1,9 +1,8 @@ -From 3028eeca5a3657762aa36512dac687f987462a80 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Mon, 21 Nov 2016 19:31:08 +0100 -Subject: [PATCH 108/347] kernel/sched: move stack + kprobe clean up to +Subject: [PATCH 108/342] kernel/sched: move stack + kprobe clean up to __put_task_struct() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=3dd0ebab3223ff2fcf7a12a1ee3bf1ad46d17b85 There is no need to free the stack before the task struct (except for reasons mentioned in commit 68f24b08ee89 ("sched/core: Free the stack early if @@ -65,6 +64,3 @@ index 676b9b213991..089779e18440 100644 put_task_struct(prev); } --- -2.36.1 - diff --git a/debian/patches-rt/0109-sched-Add-saved_state-for-tasks-blocked-on-sleeping-.patch b/debian/patches-rt/0109-sched-Add-saved_state-for-tasks-blocked-on-sleeping-.patch index f8b1532fb..0340f4f44 100644 --- a/debian/patches-rt/0109-sched-Add-saved_state-for-tasks-blocked-on-sleeping-.patch +++ b/debian/patches-rt/0109-sched-Add-saved_state-for-tasks-blocked-on-sleeping-.patch @@ -1,9 +1,8 @@ -From 84facacc5994009491bb74f5bee0c8399540c9b5 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Sat, 25 Jun 2011 09:21:04 +0200 -Subject: [PATCH 109/347] sched: Add saved_state for tasks blocked on sleeping +Subject: [PATCH 109/342] sched: Add saved_state for tasks blocked on sleeping locks -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=2b049915c871102cb82a98f65f734bdf7963f933 Spinlocks are state preserving in !RT. RT changes the state when a task gets blocked on a lock. So we need to remember the state before @@ -103,6 +102,3 @@ index 55e695080fc6..637c408fb2dc 100644 /* * To aid in avoiding the subversion of "niceness" due to uneven distribution --- -2.36.1 - diff --git a/debian/patches-rt/0110-sched-Do-not-account-rcu_preempt_depth-on-RT-in-migh.patch b/debian/patches-rt/0110-sched-Do-not-account-rcu_preempt_depth-on-RT-in-migh.patch index f7f28c137..9d2a2a801 100644 --- a/debian/patches-rt/0110-sched-Do-not-account-rcu_preempt_depth-on-RT-in-migh.patch +++ b/debian/patches-rt/0110-sched-Do-not-account-rcu_preempt_depth-on-RT-in-migh.patch @@ -1,9 +1,8 @@ -From f56cb07175c10678a26521bb7be0f493ffd5d544 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Tue, 7 Jun 2011 09:19:06 +0200 -Subject: [PATCH 110/347] sched: Do not account rcu_preempt_depth on RT in +Subject: [PATCH 110/342] sched: Do not account rcu_preempt_depth on RT in might_sleep() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=46c7e6ef6b0afa0ef14f78ebafb0de5027ff2a1a RT changes the rcu_preempt_depth semantics, so we cannot check for it in might_sleep(). @@ -52,6 +51,3 @@ index 3ec69104d0e0..52e821ac5872 100644 return (nested == preempt_offset); } --- -2.36.1 - diff --git a/debian/patches-rt/0111-sched-Use-the-proper-LOCK_OFFSET-for-cond_resched.patch b/debian/patches-rt/0111-sched-Use-the-proper-LOCK_OFFSET-for-cond_resched.patch index eccb1e428..02abd27d7 100644 --- a/debian/patches-rt/0111-sched-Use-the-proper-LOCK_OFFSET-for-cond_resched.patch +++ b/debian/patches-rt/0111-sched-Use-the-proper-LOCK_OFFSET-for-cond_resched.patch @@ -1,8 +1,7 @@ -From 5c317385aa997812acc4dd102c34f7d843bd7eb6 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Sun, 17 Jul 2011 22:51:33 +0200 -Subject: [PATCH 111/347] sched: Use the proper LOCK_OFFSET for cond_resched() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 111/342] sched: Use the proper LOCK_OFFSET for cond_resched() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=ad711b8b50c3ec2c9eb719a8dd713462e9480baa RT does not increment preempt count when a 'sleeping' spinlock is locked. Update PREEMPT_LOCK_OFFSET for that case. @@ -28,6 +27,3 @@ index f7a17fcc3fec..b7fe717eb1f4 100644 /* * The preempt_count offset needed for things like: --- -2.36.1 - diff --git a/debian/patches-rt/0112-sched-Disable-TTWU_QUEUE-on-RT.patch b/debian/patches-rt/0112-sched-Disable-TTWU_QUEUE-on-RT.patch index 8e44536b2..0cc8404ca 100644 --- a/debian/patches-rt/0112-sched-Disable-TTWU_QUEUE-on-RT.patch +++ b/debian/patches-rt/0112-sched-Disable-TTWU_QUEUE-on-RT.patch @@ -1,8 +1,7 @@ -From 31cdcd445b6fbf09238e8e3a25c2dd72be0bb187 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Tue, 13 Sep 2011 16:42:35 +0200 -Subject: [PATCH 112/347] sched: Disable TTWU_QUEUE on RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 112/342] sched: Disable TTWU_QUEUE on RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=c761744fc89f74ee4646f732e2f7589faa095af3 The queued remote wakeup mechanism can introduce rather large latencies if the number of migrated tasks is high. Disable it for RT. @@ -33,6 +32,3 @@ index 85ae8488039c..68de18405857 100644 /* * When doing wakeups, attempt to limit superfluous scans of the LLC domain. --- -2.36.1 - diff --git a/debian/patches-rt/0113-sched-workqueue-Only-wake-up-idle-workers-if-not-blo.patch b/debian/patches-rt/0113-sched-workqueue-Only-wake-up-idle-workers-if-not-blo.patch index e02a45c7e..cac51e0af 100644 --- a/debian/patches-rt/0113-sched-workqueue-Only-wake-up-idle-workers-if-not-blo.patch +++ b/debian/patches-rt/0113-sched-workqueue-Only-wake-up-idle-workers-if-not-blo.patch @@ -1,9 +1,8 @@ -From 495d970d1b7c60361c296ff0e613787355a1cbd3 Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Mon, 18 Mar 2013 15:12:49 -0400 -Subject: [PATCH 113/347] sched/workqueue: Only wake up idle workers if not +Subject: [PATCH 113/342] sched/workqueue: Only wake up idle workers if not blocked on sleeping spin lock -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=317447a5b3d776b6cfd3c4c98050fcd97322e4d8 In -rt, most spin_locks() turn into mutexes. One of these spin_lock conversions is performed on the workqueue gcwq->lock. When the idle @@ -40,6 +39,3 @@ index 52e821ac5872..dadf92046f01 100644 struct task_struct *to_wakeup; to_wakeup = wq_worker_sleeping(prev); --- -2.36.1 - diff --git a/debian/patches-rt/0114-rt-Increase-decrease-the-nr-of-migratory-tasks-when-.patch b/debian/patches-rt/0114-rt-Increase-decrease-the-nr-of-migratory-tasks-when-.patch index 16febe92b..40b318eb7 100644 --- a/debian/patches-rt/0114-rt-Increase-decrease-the-nr-of-migratory-tasks-when-.patch +++ b/debian/patches-rt/0114-rt-Increase-decrease-the-nr-of-migratory-tasks-when-.patch @@ -1,9 +1,8 @@ -From fbd999856a435086bb3dced2d54c5ece42c00fd6 Mon Sep 17 00:00:00 2001 From: Daniel Bristot de Oliveira Date: Mon, 26 Jun 2017 17:07:15 +0200 -Subject: [PATCH 114/347] rt: Increase/decrease the nr of migratory tasks when +Subject: [PATCH 114/342] rt: Increase/decrease the nr of migratory tasks when enabling/disabling migration -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=7cec25c101288e60f1ff32098dcf7f6ddb34cce0 There is a problem in the migrate_disable()/enable() implementation regarding the number of migratory tasks in the rt/dl RQs. The problem @@ -157,6 +156,3 @@ index dadf92046f01..ba6f445ac9e8 100644 if (p->migrate_disable_update) { struct rq *rq; --- -2.36.1 - diff --git a/debian/patches-rt/0115-hotplug-Lightweight-get-online-cpus.patch b/debian/patches-rt/0115-hotplug-Lightweight-get-online-cpus.patch index 5561bbcf7..dce52eae4 100644 --- a/debian/patches-rt/0115-hotplug-Lightweight-get-online-cpus.patch +++ b/debian/patches-rt/0115-hotplug-Lightweight-get-online-cpus.patch @@ -1,8 +1,7 @@ -From bf07bc52ad387c3cec5179aac1a8a08bfe0e24f7 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Wed, 15 Jun 2011 12:36:06 +0200 -Subject: [PATCH 115/347] hotplug: Lightweight get online cpus -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 115/342] hotplug: Lightweight get online cpus +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=9830fd079687f2127d5cfc53c16f8d4d0e1cfb19 get_online_cpus() is a heavy weight function which involves a global mutex. migrate_disable() wants a simpler construct which prevents only @@ -20,10 +19,10 @@ Signed-off-by: Thomas Gleixner 3 files changed, 24 insertions(+) diff --git a/include/linux/cpu.h b/include/linux/cpu.h -index aab4273810e3..e67645924404 100644 +index 8cc06e1d4fc2..a3c246214d28 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h -@@ -118,6 +118,8 @@ extern void cpu_hotplug_disable(void); +@@ -122,6 +122,8 @@ extern void cpu_hotplug_disable(void); extern void cpu_hotplug_enable(void); void clear_tasks_mm_cpumask(int cpu); int cpu_down(unsigned int cpu); @@ -32,7 +31,7 @@ index aab4273810e3..e67645924404 100644 #else /* CONFIG_HOTPLUG_CPU */ -@@ -129,6 +131,9 @@ static inline int cpus_read_trylock(void) { return true; } +@@ -133,6 +135,9 @@ static inline int cpus_read_trylock(void) { return true; } static inline void lockdep_assert_cpus_held(void) { } static inline void cpu_hotplug_disable(void) { } static inline void cpu_hotplug_enable(void) { } @@ -43,10 +42,10 @@ index aab4273810e3..e67645924404 100644 /* Wrappers which go away once all code is converted */ diff --git a/kernel/cpu.c b/kernel/cpu.c -index d6fd362afc81..89a96cc14b39 100644 +index c9ca190ec034..f4c49bbc3fa3 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c -@@ -283,6 +283,21 @@ static int cpu_hotplug_disabled; +@@ -284,6 +284,21 @@ static int cpu_hotplug_disabled; #ifdef CONFIG_HOTPLUG_CPU @@ -96,6 +95,3 @@ index ba6f445ac9e8..ed79f921a84e 100644 preempt_enable(); } EXPORT_SYMBOL(migrate_enable); --- -2.36.1 - diff --git a/debian/patches-rt/0116-trace-Add-migrate-disabled-counter-to-tracing-output.patch b/debian/patches-rt/0116-trace-Add-migrate-disabled-counter-to-tracing-output.patch index 9f41d515a..26dc37a7e 100644 --- a/debian/patches-rt/0116-trace-Add-migrate-disabled-counter-to-tracing-output.patch +++ b/debian/patches-rt/0116-trace-Add-migrate-disabled-counter-to-tracing-output.patch @@ -1,8 +1,7 @@ -From 54b651a215692cc3d5d07f69dd37f1c3eb1ee353 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Sun, 17 Jul 2011 21:56:42 +0200 -Subject: [PATCH 116/347] trace: Add migrate-disabled counter to tracing output -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 116/342] trace: Add migrate-disabled counter to tracing output +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=5252ba8da88a7390c388073a08dcc5eba3206046 Signed-off-by: Thomas Gleixner --- @@ -26,7 +25,7 @@ index 0643c083ed86..1cc4d2da954c 100644 #define TRACE_EVENT_TYPE_MAX \ diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c -index 063b434c89d2..2a8b830d42f1 100644 +index 5b7a6e9b0ab6..5cb37fa71316 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -2165,6 +2165,8 @@ tracing_generic_entry_update(struct trace_entry *entry, unsigned long flags, @@ -81,6 +80,3 @@ index 6e6cc64faa38..46c96744f09d 100644 return !trace_seq_has_overflowed(s); } --- -2.36.1 - diff --git a/debian/patches-rt/0117-lockdep-Make-it-RT-aware.patch b/debian/patches-rt/0117-lockdep-Make-it-RT-aware.patch index 445f08b7b..edeec8c3e 100644 --- a/debian/patches-rt/0117-lockdep-Make-it-RT-aware.patch +++ b/debian/patches-rt/0117-lockdep-Make-it-RT-aware.patch @@ -1,8 +1,7 @@ -From 847045ea96b917f8dab8df5053e66280a83c84e4 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Sun, 17 Jul 2011 18:51:23 +0200 -Subject: [PATCH 117/347] lockdep: Make it RT aware -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 117/342] lockdep: Make it RT aware +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=3079bca07ad3f83c30c86e9542e7edb1c7f2ed70 teach lockdep that we don't really do softirqs on -RT. @@ -73,6 +72,3 @@ index 4dc79f57af82..4dd83428b56d 100644 if (!debug_locks) print_irqtrace_events(current); --- -2.36.1 - diff --git a/debian/patches-rt/0118-tasklet-Prevent-tasklets-from-going-into-infinite-sp.patch b/debian/patches-rt/0118-tasklet-Prevent-tasklets-from-going-into-infinite-sp.patch index 2885b4101..6c3880cdb 100644 --- a/debian/patches-rt/0118-tasklet-Prevent-tasklets-from-going-into-infinite-sp.patch +++ b/debian/patches-rt/0118-tasklet-Prevent-tasklets-from-going-into-infinite-sp.patch @@ -1,9 +1,8 @@ -From ff4b7bd98df1b1100237e3ac2f11c687a486c18b Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Tue, 29 Nov 2011 20:18:22 -0500 -Subject: [PATCH 118/347] tasklet: Prevent tasklets from going into infinite +Subject: [PATCH 118/342] tasklet: Prevent tasklets from going into infinite spin in RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=e11d4ceb7976f9f4bb42ed76c972b28cc32c295f When CONFIG_PREEMPT_RT_FULL is enabled, tasklets run as threads, and spinlocks turn are mutexes. But this can cause issues with @@ -298,6 +297,3 @@ index 6f584861d329..1d3a482246cc 100644 static int ksoftirqd_should_run(unsigned int cpu) { return local_softirq_pending(); --- -2.36.1 - diff --git a/debian/patches-rt/0119-softirq-Check-preemption-after-reenabling-interrupts.patch b/debian/patches-rt/0119-softirq-Check-preemption-after-reenabling-interrupts.patch index fbf761018..c12437f64 100644 --- a/debian/patches-rt/0119-softirq-Check-preemption-after-reenabling-interrupts.patch +++ b/debian/patches-rt/0119-softirq-Check-preemption-after-reenabling-interrupts.patch @@ -1,8 +1,7 @@ -From 45feb7680d31346f7a6da9926cdb23a37b640f47 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Sun, 13 Nov 2011 17:17:09 +0100 -Subject: [PATCH 119/347] softirq: Check preemption after reenabling interrupts -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 119/342] softirq: Check preemption after reenabling interrupts +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=2c36de62cf384d49f3a0f23f7502b17c1be03ceb raise_softirq_irqoff() disables interrupts and wakes the softirq daemon, but after reenabling interrupts there is no preemption check, @@ -175,6 +174,3 @@ index 42f6ff8b9703..b8e3ae050bcc 100644 #ifdef CONFIG_RPS remsd = oldsd->rps_ipi_list; --- -2.36.1 - diff --git a/debian/patches-rt/0120-softirq-Disable-softirq-stacks-for-RT.patch b/debian/patches-rt/0120-softirq-Disable-softirq-stacks-for-RT.patch index 3c4ba7e3e..458995fb2 100644 --- a/debian/patches-rt/0120-softirq-Disable-softirq-stacks-for-RT.patch +++ b/debian/patches-rt/0120-softirq-Disable-softirq-stacks-for-RT.patch @@ -1,8 +1,7 @@ -From 7e198889f2947f9bfeecdda6955492f55399a621 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Mon, 18 Jul 2011 13:59:17 +0200 -Subject: [PATCH 120/347] softirq: Disable softirq stacks for RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 120/342] softirq: Disable softirq stacks for RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=accf186584b07cb6c604b5f165381367dad68b9e Disable extra stacks for softirqs. We want to preempt softirqs and having them on special IRQ-stack does not make this easier. @@ -172,6 +171,3 @@ index 35fa335c475b..eec4bec454b5 100644 void do_softirq_own_stack(void); #else static inline void do_softirq_own_stack(void) --- -2.36.1 - diff --git a/debian/patches-rt/0121-softirq-Split-softirq-locks.patch b/debian/patches-rt/0121-softirq-Split-softirq-locks.patch index e3aeafa1d..1744900fe 100644 --- a/debian/patches-rt/0121-softirq-Split-softirq-locks.patch +++ b/debian/patches-rt/0121-softirq-Split-softirq-locks.patch @@ -1,8 +1,7 @@ -From 4f304d0db14e45c0b23ed9ed8ee6749255dd180a Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Thu, 4 Oct 2012 14:20:47 +0100 -Subject: [PATCH 121/347] softirq: Split softirq locks -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 121/342] softirq: Split softirq locks +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=8b2084eea88470c1ab4999158ba663263ffe62cc The 3.x RT series removed the split softirq implementation in favour of pushing softirq processing into the context of the thread which @@ -199,10 +198,10 @@ index 1b2884889dd0..63a97f24d138 100644 #define PF_EXITING 0x00000004 /* Getting shut down */ #define PF_VCPU 0x00000010 /* I'm a virtual CPU */ diff --git a/init/main.c b/init/main.c -index 272ec131211c..0d5763c5da28 100644 +index 489a5aa7ba53..703b627a6060 100644 --- a/init/main.c +++ b/init/main.c -@@ -560,6 +560,7 @@ asmlinkage __visible void __init start_kernel(void) +@@ -553,6 +553,7 @@ asmlinkage __visible void __init start_kernel(void) setup_command_line(command_line); setup_nr_cpu_ids(); setup_per_cpu_areas(); @@ -827,6 +826,3 @@ index 012bc81879bf..2b0ddd50e879 100644 return false; } --- -2.36.1 - diff --git a/debian/patches-rt/0122-net-core-use-local_bh_disable-in-netif_rx_ni.patch b/debian/patches-rt/0122-net-core-use-local_bh_disable-in-netif_rx_ni.patch index 6f4fcdbeb..2bad52b3c 100644 --- a/debian/patches-rt/0122-net-core-use-local_bh_disable-in-netif_rx_ni.patch +++ b/debian/patches-rt/0122-net-core-use-local_bh_disable-in-netif_rx_ni.patch @@ -1,8 +1,7 @@ -From 2e2c294b277d487a55a1b9cd56dd172795e0f3f8 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Fri, 16 Jun 2017 19:03:16 +0200 -Subject: [PATCH 122/347] net/core: use local_bh_disable() in netif_rx_ni() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 122/342] net/core: use local_bh_disable() in netif_rx_ni() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=90c011694ab18ee6bf1ed891fd489a5ec95ffb1a In 2004 netif_rx_ni() gained a preempt_disable() section around netif_rx() and its do_softirq() + testing for it. The do_softirq() part @@ -36,6 +35,3 @@ index b8e3ae050bcc..315bdaf00ac8 100644 return err; } --- -2.36.1 - diff --git a/debian/patches-rt/0123-genirq-Allow-disabling-of-softirq-processing-in-irq-.patch b/debian/patches-rt/0123-genirq-Allow-disabling-of-softirq-processing-in-irq-.patch index d24e2a815..75cdbf25f 100644 --- a/debian/patches-rt/0123-genirq-Allow-disabling-of-softirq-processing-in-irq-.patch +++ b/debian/patches-rt/0123-genirq-Allow-disabling-of-softirq-processing-in-irq-.patch @@ -1,9 +1,8 @@ -From 70cfb822ccb0d82006eb62a4774d58021b340151 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Tue, 31 Jan 2012 13:01:27 +0100 -Subject: [PATCH 123/347] genirq: Allow disabling of softirq processing in irq +Subject: [PATCH 123/342] genirq: Allow disabling of softirq processing in irq thread context -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=fcae9108c6950e37988deba7ca6c824ccb1c97cc The processing of softirqs in irq thread context is a performance gain for the non-rt workloads of a system, but it's counterproductive for @@ -139,6 +138,3 @@ index fd89f8ab85ac..3e9333d148ad 100644 int in_serving_softirq(void) { return current->flags & PF_IN_SOFTIRQ; --- -2.36.1 - diff --git a/debian/patches-rt/0124-softirq-split-timer-softirqs-out-of-ksoftirqd.patch b/debian/patches-rt/0124-softirq-split-timer-softirqs-out-of-ksoftirqd.patch index b6bb8cca8..4413600e9 100644 --- a/debian/patches-rt/0124-softirq-split-timer-softirqs-out-of-ksoftirqd.patch +++ b/debian/patches-rt/0124-softirq-split-timer-softirqs-out-of-ksoftirqd.patch @@ -1,8 +1,7 @@ -From 883087f48f717058bc203cd47430b55f77275fbd Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Wed, 20 Jan 2016 16:34:17 +0100 -Subject: [PATCH 124/347] softirq: split timer softirqs out of ksoftirqd -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 124/342] softirq: split timer softirqs out of ksoftirqd +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=df12f0ccfce0f4ac8542c56f719e8f2f71a65f2a The softirqd runs in -RT with SCHED_FIFO (prio 1) and deals mostly with timer wakeup which can not happen in hardirq context. The prio has been @@ -210,6 +209,3 @@ index 3e9333d148ad..fe4e59c80a08 100644 return 0; } early_initcall(spawn_ksoftirqd); --- -2.36.1 - diff --git a/debian/patches-rt/0125-softirq-Avoid-local_softirq_pending-messages-if-ksof.patch b/debian/patches-rt/0125-softirq-Avoid-local_softirq_pending-messages-if-ksof.patch index 1302bc0ef..ce57380af 100644 --- a/debian/patches-rt/0125-softirq-Avoid-local_softirq_pending-messages-if-ksof.patch +++ b/debian/patches-rt/0125-softirq-Avoid-local_softirq_pending-messages-if-ksof.patch @@ -1,9 +1,8 @@ -From 287a0b153109b1e2d548befe904bc14f3de5f2c8 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Mon, 18 Feb 2019 13:19:59 +0100 -Subject: [PATCH 125/347] softirq: Avoid "local_softirq_pending" messages if +Subject: [PATCH 125/342] softirq: Avoid "local_softirq_pending" messages if ksoftirqd is blocked -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=96d9095dbc28be31e65da4563d72dca0813eccbf If the ksoftirqd thread has a softirq pending and is blocked on the `local_softirq_locks' lock then softirq_check_pending_idle() won't @@ -107,6 +106,3 @@ index fe4e59c80a08..1920985eeb09 100644 } if (warnpending) { --- -2.36.1 - diff --git a/debian/patches-rt/0126-softirq-Avoid-local_softirq_pending-messages-if-task.patch b/debian/patches-rt/0126-softirq-Avoid-local_softirq_pending-messages-if-task.patch index 965311d51..3615bb40a 100644 --- a/debian/patches-rt/0126-softirq-Avoid-local_softirq_pending-messages-if-task.patch +++ b/debian/patches-rt/0126-softirq-Avoid-local_softirq_pending-messages-if-task.patch @@ -1,9 +1,8 @@ -From 7879ba227dbde103356be2bef58a9733a930c0a0 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Tue, 19 Feb 2019 16:49:29 +0100 -Subject: [PATCH 126/347] softirq: Avoid "local_softirq_pending" messages if +Subject: [PATCH 126/342] softirq: Avoid "local_softirq_pending" messages if task is in cpu_chill() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=29f30ebce0eb689baf7f7b34e71797872822a58d If the softirq thread enters cpu_chill() then ->state is UNINTERRUPTIBLE and has no ->pi_blocked_on set and so its mask is not taken into account. @@ -36,6 +35,3 @@ index 1920985eeb09..27a4bb2303d0 100644 /* Clear all bits pending in that task */ *pending &= ~(tsk->softirqs_raised); ret = true; --- -2.36.1 - diff --git a/debian/patches-rt/0127-rtmutex-trylock-is-okay-on-RT.patch b/debian/patches-rt/0127-rtmutex-trylock-is-okay-on-RT.patch index 292becc02..291d8d372 100644 --- a/debian/patches-rt/0127-rtmutex-trylock-is-okay-on-RT.patch +++ b/debian/patches-rt/0127-rtmutex-trylock-is-okay-on-RT.patch @@ -1,8 +1,7 @@ -From 0b94209cb7e2a97538d5f7cf08c0d1433cc83b05 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Wed, 2 Dec 2015 11:34:07 +0100 -Subject: [PATCH 127/347] rtmutex: trylock is okay on -RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 127/342] rtmutex: trylock is okay on -RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=f76f4735aed998bb2c03c61a89230b757a4fe952 non-RT kernel could deadlock on rt_mutex_trylock() in softirq context. On -RT we don't run softirqs in IRQ context but in thread context so it is @@ -29,6 +28,3 @@ index a5ec4f68527e..4bec24dfafc6 100644 return 0; ret = rt_mutex_fasttrylock(lock, rt_mutex_slowtrylock); --- -2.36.1 - diff --git a/debian/patches-rt/0128-fs-nfs-turn-rmdir_sem-into-a-semaphore.patch b/debian/patches-rt/0128-fs-nfs-turn-rmdir_sem-into-a-semaphore.patch index 4ff90ed43..bf211c1b5 100644 --- a/debian/patches-rt/0128-fs-nfs-turn-rmdir_sem-into-a-semaphore.patch +++ b/debian/patches-rt/0128-fs-nfs-turn-rmdir_sem-into-a-semaphore.patch @@ -1,8 +1,7 @@ -From dbfda01f7e6e30541e35b49f6972022917fd685a Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Thu, 15 Sep 2016 10:51:27 +0200 -Subject: [PATCH 128/347] fs/nfs: turn rmdir_sem into a semaphore -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 128/342] fs/nfs: turn rmdir_sem into a semaphore +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=6fb5ec130d9a1ccb20b3cea61c5b177c798e898c The RW semaphore had a reader side which used the _non_owner version because it most likely took the reader lock in one thread and released it @@ -146,6 +145,3 @@ index 8ea7ceed8285..d52dfae05d2a 100644 struct mutex commit_mutex; #if IS_ENABLED(CONFIG_NFS_V4) --- -2.36.1 - diff --git a/debian/patches-rt/0129-rtmutex-Handle-the-various-new-futex-race-conditions.patch b/debian/patches-rt/0129-rtmutex-Handle-the-various-new-futex-race-conditions.patch index bdf75c3c6..8befd5d3f 100644 --- a/debian/patches-rt/0129-rtmutex-Handle-the-various-new-futex-race-conditions.patch +++ b/debian/patches-rt/0129-rtmutex-Handle-the-various-new-futex-race-conditions.patch @@ -1,8 +1,7 @@ -From 9c83cf8ce7911f4f00f4fc71b365a30ebed5fdf4 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Fri, 10 Jun 2011 11:04:15 +0200 -Subject: [PATCH 129/347] rtmutex: Handle the various new futex race conditions -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 129/342] rtmutex: Handle the various new futex race conditions +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=7f36213e96b6be3d94dda72b8b3d6dbe386346a1 RT opens a few new interesting race conditions in the rtmutex/futex combo due to futex hash bucket lock being a 'sleeping' spinlock and @@ -249,6 +248,3 @@ index ca6fb489007b..8f39bc139735 100644 extern struct task_struct *rt_mutex_next_owner(struct rt_mutex *lock); extern void rt_mutex_init_proxy_locked(struct rt_mutex *lock, struct task_struct *proxy_owner); --- -2.36.1 - diff --git a/debian/patches-rt/0130-futex-Fix-bug-on-when-a-requeued-RT-task-times-out.patch b/debian/patches-rt/0130-futex-Fix-bug-on-when-a-requeued-RT-task-times-out.patch index 1b73b4e00..74ad7a1cb 100644 --- a/debian/patches-rt/0130-futex-Fix-bug-on-when-a-requeued-RT-task-times-out.patch +++ b/debian/patches-rt/0130-futex-Fix-bug-on-when-a-requeued-RT-task-times-out.patch @@ -1,8 +1,7 @@ -From e4bd34c056ee1cfe80dbe490977b5496ba5eeb70 Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Tue, 14 Jul 2015 14:26:34 +0200 -Subject: [PATCH 130/347] futex: Fix bug on when a requeued RT task times out -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 130/342] futex: Fix bug on when a requeued RT task times out +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=a211a6391b03430c4bd22cf99ebe8e4412a76fc1 Requeue with timeout causes a bug with PREEMPT_RT_FULL. @@ -116,6 +115,3 @@ index 8f39bc139735..202e2b0d1251 100644 extern struct task_struct *rt_mutex_next_owner(struct rt_mutex *lock); extern void rt_mutex_init_proxy_locked(struct rt_mutex *lock, --- -2.36.1 - diff --git a/debian/patches-rt/0131-futex-Ensure-lock-unlock-symetry-versus-pi_lock-and-.patch b/debian/patches-rt/0131-futex-Ensure-lock-unlock-symetry-versus-pi_lock-and-.patch index 385cbe279..aecdc337a 100644 --- a/debian/patches-rt/0131-futex-Ensure-lock-unlock-symetry-versus-pi_lock-and-.patch +++ b/debian/patches-rt/0131-futex-Ensure-lock-unlock-symetry-versus-pi_lock-and-.patch @@ -1,9 +1,8 @@ -From be3ec67dc13250ace8bd04c65a4fb643d683c9c1 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Fri, 1 Mar 2013 11:17:42 +0100 -Subject: [PATCH 131/347] futex: Ensure lock/unlock symetry versus pi_lock and +Subject: [PATCH 131/342] futex: Ensure lock/unlock symetry versus pi_lock and hash bucket lock -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=9b9b23148e1ee440fb6709067736cfa33b4c4f27 In exit_pi_state_list() we have the following locking construct: @@ -45,6 +44,3 @@ index dc2d81d11b17..0e136045a720 100644 put_pi_state(pi_state); continue; } --- -2.36.1 - diff --git a/debian/patches-rt/0132-pid.h-include-atomic.h.patch b/debian/patches-rt/0132-pid.h-include-atomic.h.patch index 74e014526..25d9273ac 100644 --- a/debian/patches-rt/0132-pid.h-include-atomic.h.patch +++ b/debian/patches-rt/0132-pid.h-include-atomic.h.patch @@ -1,8 +1,7 @@ -From 4893375573fc1c881fe9d5f74f5c3199a8adafd7 Mon Sep 17 00:00:00 2001 From: Grygorii Strashko Date: Tue, 21 Jul 2015 19:43:56 +0300 -Subject: [PATCH 132/347] pid.h: include atomic.h -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 132/342] pid.h: include atomic.h +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=ebc8e476657349538056e71e80aa977057972195 This patch fixes build error: CC kernel/pid_namespace.o @@ -38,6 +37,3 @@ index 14a9a39da9c7..a9026a5da196 100644 enum pid_type { --- -2.36.1 - diff --git a/debian/patches-rt/0133-arm-include-definition-for-cpumask_t.patch b/debian/patches-rt/0133-arm-include-definition-for-cpumask_t.patch index 770c1d0d6..1b2825108 100644 --- a/debian/patches-rt/0133-arm-include-definition-for-cpumask_t.patch +++ b/debian/patches-rt/0133-arm-include-definition-for-cpumask_t.patch @@ -1,8 +1,7 @@ -From 83a90ab3e2bccc269afe608919d57872e41d3518 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Thu, 22 Dec 2016 17:28:33 +0100 -Subject: [PATCH 133/347] arm: include definition for cpumask_t -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 133/342] arm: include definition for cpumask_t +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=d65c1c9c5bf77db5005a8b99a0c703f5bb892fcb This definition gets pulled in by other files. With the (later) split of RCU and spinlock.h it won't compile anymore. @@ -26,6 +25,3 @@ index 46d41140df27..c421b5b81946 100644 struct irqaction; struct pt_regs; --- -2.36.1 - diff --git a/debian/patches-rt/0134-locking-locktorture-Do-NOT-include-rwlock.h-directly.patch b/debian/patches-rt/0134-locking-locktorture-Do-NOT-include-rwlock.h-directly.patch index 2777ffd6a..b548ef966 100644 --- a/debian/patches-rt/0134-locking-locktorture-Do-NOT-include-rwlock.h-directly.patch +++ b/debian/patches-rt/0134-locking-locktorture-Do-NOT-include-rwlock.h-directly.patch @@ -1,9 +1,8 @@ -From 651a6a4d30c878862e8ba912da5d7140d5e23a6e Mon Sep 17 00:00:00 2001 From: "Wolfgang M. Reimer" Date: Tue, 21 Jul 2015 16:20:07 +0200 -Subject: [PATCH 134/347] locking: locktorture: Do NOT include rwlock.h +Subject: [PATCH 134/342] locking: locktorture: Do NOT include rwlock.h directly -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=cc9d1be680177e81b590286d422a410a747aaeb4 Including rwlock.h directly will cause kernel builds to fail if CONFIG_PREEMPT_RT_FULL is defined. The correct header file @@ -29,6 +28,3 @@ index 95395ef5922a..5748c1936edb 100644 #include #include #include --- -2.36.1 - diff --git a/debian/patches-rt/0135-rtmutex-Add-rtmutex_lock_killable.patch b/debian/patches-rt/0135-rtmutex-Add-rtmutex_lock_killable.patch index 92652b7a1..d97f3545b 100644 --- a/debian/patches-rt/0135-rtmutex-Add-rtmutex_lock_killable.patch +++ b/debian/patches-rt/0135-rtmutex-Add-rtmutex_lock_killable.patch @@ -1,8 +1,7 @@ -From 12727f37858de62d47250dc9fcee2ce4ea19dd66 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Thu, 9 Jun 2011 11:43:52 +0200 -Subject: [PATCH 135/347] rtmutex: Add rtmutex_lock_killable() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 135/342] rtmutex: Add rtmutex_lock_killable() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=ab6b6c8bc1aabe6b845f3f27a2e1177591c6f619 Add "killable" type to rtmutex. We need this since rtmutex are used as "normal" mutexes which do use this type. @@ -55,6 +54,3 @@ index 069f025180b8..81bae2e3d82e 100644 /** * rt_mutex_timed_lock - lock a rt_mutex interruptible * the timeout structure is provided --- -2.36.1 - diff --git a/debian/patches-rt/0136-rtmutex-Make-lock_killable-work.patch b/debian/patches-rt/0136-rtmutex-Make-lock_killable-work.patch index 605d0286e..394058af8 100644 --- a/debian/patches-rt/0136-rtmutex-Make-lock_killable-work.patch +++ b/debian/patches-rt/0136-rtmutex-Make-lock_killable-work.patch @@ -1,8 +1,7 @@ -From 36064ed74738cac8ebb382e5ce34d55a8f2e24a8 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Sat, 1 Apr 2017 12:50:59 +0200 -Subject: [PATCH 136/347] rtmutex: Make lock_killable work -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 136/342] rtmutex: Make lock_killable work +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=61fa01d84f2b1b35d66b69c4b7fda86f45ad7d50 Locking an rt mutex killable does not work because signal handling is restricted to TASK_INTERRUPTIBLE. @@ -46,6 +45,3 @@ index 81bae2e3d82e..333c4b7aa8e8 100644 } raw_spin_unlock_irq(&lock->wait_lock); --- -2.36.1 - diff --git a/debian/patches-rt/0137-spinlock-Split-the-lock-types-header.patch b/debian/patches-rt/0137-spinlock-Split-the-lock-types-header.patch index 472048028..1b5e85469 100644 --- a/debian/patches-rt/0137-spinlock-Split-the-lock-types-header.patch +++ b/debian/patches-rt/0137-spinlock-Split-the-lock-types-header.patch @@ -1,8 +1,7 @@ -From ea56713a6d4b07d5d16d350f989ea6e4575feb41 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Wed, 29 Jun 2011 19:34:01 +0200 -Subject: [PATCH 137/347] spinlock: Split the lock types header -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 137/342] spinlock: Split the lock types header +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=c79f3fea34f5b6aa30f2e97c8d5dcb95fd161f64 Split raw_spinlock into its own file and the remaining spinlock_t into its own non-RT header. The non-RT header will be replaced later by sleeping @@ -216,6 +215,3 @@ index 000000000000..822bf64a61d3 +#define DEFINE_RAW_SPINLOCK(x) raw_spinlock_t x = __RAW_SPIN_LOCK_UNLOCKED(x) + +#endif --- -2.36.1 - diff --git a/debian/patches-rt/0138-rtmutex-Avoid-include-hell.patch b/debian/patches-rt/0138-rtmutex-Avoid-include-hell.patch index 7ffdecc51..44a5be729 100644 --- a/debian/patches-rt/0138-rtmutex-Avoid-include-hell.patch +++ b/debian/patches-rt/0138-rtmutex-Avoid-include-hell.patch @@ -1,8 +1,7 @@ -From b243e04054c677bb38c429d31e62f64af1db11fe Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Wed, 29 Jun 2011 20:06:39 +0200 -Subject: [PATCH 138/347] rtmutex: Avoid include hell -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 138/342] rtmutex: Avoid include hell +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=c34fc8975a05f3be15d042b8e1a195fe2e406e7e Include only the required raw types. This avoids pulling in the complete spinlock header which in turn requires rtmutex.h at some point. @@ -25,6 +24,3 @@ index 81ece6a8291a..a355289b1fa1 100644 extern int max_lock_depth; /* for sysctl */ --- -2.36.1 - diff --git a/debian/patches-rt/0139-rbtree-don-t-include-the-rcu-header.patch b/debian/patches-rt/0139-rbtree-don-t-include-the-rcu-header.patch index e300e5d34..ef16640ab 100644 --- a/debian/patches-rt/0139-rbtree-don-t-include-the-rcu-header.patch +++ b/debian/patches-rt/0139-rbtree-don-t-include-the-rcu-header.patch @@ -1,11 +1,10 @@ -From 5bd4fe94ce198734cd4b23d3486b154486f137ae Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Tue, 26 Feb 2019 16:56:02 +0100 -Subject: [PATCH 139/347] rbtree: don't include the rcu header +Subject: [PATCH 139/342] rbtree: don't include the rcu header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=89a313db5ff54e6ebe97cd147bc27e27e7448732 The RCU header pulls in spinlock.h and fails due not yet defined types: @@ -170,6 +169,3 @@ index 027c58cdbb6e..e6733d7911e9 100644 /** * rcu_swap_protected() - swap an RCU and a regular pointer * @rcu_ptr: RCU pointer --- -2.36.1 - diff --git a/debian/patches-rt/0140-rtmutex-Provide-rt_mutex_slowlock_locked.patch b/debian/patches-rt/0140-rtmutex-Provide-rt_mutex_slowlock_locked.patch index d63649047..17f0a56e5 100644 --- a/debian/patches-rt/0140-rtmutex-Provide-rt_mutex_slowlock_locked.patch +++ b/debian/patches-rt/0140-rtmutex-Provide-rt_mutex_slowlock_locked.patch @@ -1,8 +1,7 @@ -From 2263182a5f18a0abbe7ba2d582f42308580bbd31 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Thu, 12 Oct 2017 16:14:22 +0200 -Subject: [PATCH 140/347] rtmutex: Provide rt_mutex_slowlock_locked() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 140/342] rtmutex: Provide rt_mutex_slowlock_locked() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=53cb0c772c30a3f534246da306630892657aee07 This is the inner-part of rt_mutex_slowlock(), required for rwsem-rt. @@ -140,6 +139,3 @@ index 202e2b0d1251..66deb94765fb 100644 #ifdef CONFIG_DEBUG_RT_MUTEXES # include "rtmutex-debug.h" --- -2.36.1 - diff --git a/debian/patches-rt/0141-rtmutex-export-lockdep-less-version-of-rt_mutex-s-lo.patch b/debian/patches-rt/0141-rtmutex-export-lockdep-less-version-of-rt_mutex-s-lo.patch index 23300e884..41b28d266 100644 --- a/debian/patches-rt/0141-rtmutex-export-lockdep-less-version-of-rt_mutex-s-lo.patch +++ b/debian/patches-rt/0141-rtmutex-export-lockdep-less-version-of-rt_mutex-s-lo.patch @@ -1,9 +1,8 @@ -From 1b3711a9fe0b85e927a131441083be32b7879496 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Thu, 12 Oct 2017 16:36:39 +0200 -Subject: [PATCH 141/347] rtmutex: export lockdep-less version of rt_mutex's +Subject: [PATCH 141/342] rtmutex: export lockdep-less version of rt_mutex's lock, trylock and unlock -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=5dbdcffac97ac1a307e15a14592c3e8d837766c4 Required for lock implementation ontop of rtmutex. @@ -148,6 +147,3 @@ index 66deb94765fb..53a8c5d03d28 100644 int __sched rt_mutex_slowlock_locked(struct rt_mutex *lock, int state, struct hrtimer_sleeper *timeout, enum rtmutex_chainwalk chwalk, --- -2.36.1 - diff --git a/debian/patches-rt/0142-rtmutex-add-sleeping-lock-implementation.patch b/debian/patches-rt/0142-rtmutex-add-sleeping-lock-implementation.patch index 1e1934085..0891c9fa3 100644 --- a/debian/patches-rt/0142-rtmutex-add-sleeping-lock-implementation.patch +++ b/debian/patches-rt/0142-rtmutex-add-sleeping-lock-implementation.patch @@ -1,8 +1,7 @@ -From 16d4ed57212cef457bf87864ffb00f8b297f06e2 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Thu, 12 Oct 2017 17:11:19 +0200 -Subject: [PATCH 142/347] rtmutex: add sleeping lock implementation -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 142/342] rtmutex: add sleeping lock implementation +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=ba50c47e65ffab81bd256813390bbdf7f4c7ff22 Signed-off-by: Thomas Gleixner Signed-off-by: Sebastian Andrzej Siewior @@ -1204,6 +1203,3 @@ index ed79f921a84e..1f450a7649f0 100644 put_task_struct(task); } } --- -2.36.1 - diff --git a/debian/patches-rt/0143-rtmutex-add-mutex-implementation-based-on-rtmutex.patch b/debian/patches-rt/0143-rtmutex-add-mutex-implementation-based-on-rtmutex.patch index 268579aea..ab0dfe716 100644 --- a/debian/patches-rt/0143-rtmutex-add-mutex-implementation-based-on-rtmutex.patch +++ b/debian/patches-rt/0143-rtmutex-add-mutex-implementation-based-on-rtmutex.patch @@ -1,8 +1,7 @@ -From df07ee70a0dfe4c5f6c6b8a01afd04d748635c84 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Thu, 12 Oct 2017 17:17:03 +0200 -Subject: [PATCH 143/347] rtmutex: add mutex implementation based on rtmutex -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 143/342] rtmutex: add mutex implementation based on rtmutex +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=0721909250ea1708b9a71d403791a6d0d1c847bf Signed-off-by: Thomas Gleixner Signed-off-by: Sebastian Andrzej Siewior @@ -378,6 +377,3 @@ index 000000000000..4f81595c0f52 + return 1; +} +EXPORT_SYMBOL(atomic_dec_and_mutex_lock); --- -2.36.1 - diff --git a/debian/patches-rt/0144-rtmutex-add-rwsem-implementation-based-on-rtmutex.patch b/debian/patches-rt/0144-rtmutex-add-rwsem-implementation-based-on-rtmutex.patch index b05b5ef45..b045cbb85 100644 --- a/debian/patches-rt/0144-rtmutex-add-rwsem-implementation-based-on-rtmutex.patch +++ b/debian/patches-rt/0144-rtmutex-add-rwsem-implementation-based-on-rtmutex.patch @@ -1,8 +1,7 @@ -From d5648fc940b9d669cad909970b95064ee3634612 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Thu, 12 Oct 2017 17:28:34 +0200 -Subject: [PATCH 144/347] rtmutex: add rwsem implementation based on rtmutex -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 144/342] rtmutex: add rwsem implementation based on rtmutex +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=a50802f1a28bc3efc3da58b2dc02e2ce9e262bf7 The RT specific R/W semaphore implementation restricts the number of readers to one because a writer cannot block on multiple readers and inherit its @@ -422,6 +421,3 @@ index 000000000000..7d3c5cf3d23d + /* Release it and account current as reader */ + __up_write_unlock(sem, WRITER_BIAS - 1, flags); +} --- -2.36.1 - diff --git a/debian/patches-rt/0145-rtmutex-add-rwlock-implementation-based-on-rtmutex.patch b/debian/patches-rt/0145-rtmutex-add-rwlock-implementation-based-on-rtmutex.patch index 3045accc9..a23eb96df 100644 --- a/debian/patches-rt/0145-rtmutex-add-rwlock-implementation-based-on-rtmutex.patch +++ b/debian/patches-rt/0145-rtmutex-add-rwlock-implementation-based-on-rtmutex.patch @@ -1,8 +1,7 @@ -From f6a36a3573a2474292d6b6e71f206f52212b6cd5 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Thu, 12 Oct 2017 17:18:06 +0200 -Subject: [PATCH 145/347] rtmutex: add rwlock implementation based on rtmutex -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 145/342] rtmutex: add rwlock implementation based on rtmutex +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=15018c2ebb240be9c688212d67e7ccef0a0b76c3 The implementation is bias-based, similar to the rwsem implementation. @@ -577,6 +576,3 @@ index 000000000000..aebb7ce25bc6 + do_rwlock_rt_init(rwlock, name, key); +} +EXPORT_SYMBOL(__rt_rwlock_init); --- -2.36.1 - diff --git a/debian/patches-rt/0146-rtmutex-rwlock-preserve-state-like-a-sleeping-lock.patch b/debian/patches-rt/0146-rtmutex-rwlock-preserve-state-like-a-sleeping-lock.patch index 44b53bba1..6eca4e175 100644 --- a/debian/patches-rt/0146-rtmutex-rwlock-preserve-state-like-a-sleeping-lock.patch +++ b/debian/patches-rt/0146-rtmutex-rwlock-preserve-state-like-a-sleeping-lock.patch @@ -1,8 +1,7 @@ -From 0e2b5eb41fc6820a80428de4a73ede6f47d74cf0 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Fri, 11 Jan 2019 21:16:31 +0100 -Subject: [PATCH 146/347] rtmutex/rwlock: preserve state like a sleeping lock -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 146/342] rtmutex/rwlock: preserve state like a sleeping lock +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=a394b6d10212e9724d148f88c5ca736270ad2967 The rwlock is spinning while acquiring a lock. Therefore it must become a sleeping lock on RT and preserve its task state while sleeping and @@ -28,6 +27,3 @@ index aebb7ce25bc6..8f90afe111ce 100644 rt_spin_lock_slowlock_locked(m, &waiter, flags); /* * The slowlock() above is guaranteed to return with the rtmutex is --- -2.36.1 - diff --git a/debian/patches-rt/0147-rtmutex-wire-up-RT-s-locking.patch b/debian/patches-rt/0147-rtmutex-wire-up-RT-s-locking.patch index 8110605a3..30f210655 100644 --- a/debian/patches-rt/0147-rtmutex-wire-up-RT-s-locking.patch +++ b/debian/patches-rt/0147-rtmutex-wire-up-RT-s-locking.patch @@ -1,8 +1,7 @@ -From d334127aee6c64a7cdf5e5d3420666bcfdeb8ba6 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Thu, 12 Oct 2017 17:31:14 +0200 -Subject: [PATCH 147/347] rtmutex: wire up RT's locking -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 147/342] rtmutex: wire up RT's locking +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=15d882ef5f548758242ab6f1ef81b06189619403 Signed-off-by: Thomas Gleixner Signed-off-by: Sebastian Andrzej Siewior @@ -266,6 +265,3 @@ index 03595c29c566..d63df281b495 100644 } + +#endif --- -2.36.1 - diff --git a/debian/patches-rt/0148-rtmutex-add-ww_mutex-addon-for-mutex-rt.patch b/debian/patches-rt/0148-rtmutex-add-ww_mutex-addon-for-mutex-rt.patch index 86e8aed22..6241aed37 100644 --- a/debian/patches-rt/0148-rtmutex-add-ww_mutex-addon-for-mutex-rt.patch +++ b/debian/patches-rt/0148-rtmutex-add-ww_mutex-addon-for-mutex-rt.patch @@ -1,8 +1,7 @@ -From d33397686c7cab5c3c263709534ec1e58ac42b54 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Thu, 12 Oct 2017 17:34:38 +0200 -Subject: [PATCH 148/347] rtmutex: add ww_mutex addon for mutex-rt -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 148/342] rtmutex: add ww_mutex addon for mutex-rt +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=09033e8bd64e77065eceb62cd95fa1054dbd4b84 Signed-off-by: Sebastian Andrzej Siewior --- @@ -440,6 +439,3 @@ index 7d3c5cf3d23d..660e22caf709 100644 /* * The slowlock() above is guaranteed to return with the rtmutex (for * ret = 0) is now held, so there can't be a writer active. Increment --- -2.36.1 - diff --git a/debian/patches-rt/0149-kconfig-Add-PREEMPT_RT_FULL.patch b/debian/patches-rt/0149-kconfig-Add-PREEMPT_RT_FULL.patch index a9ee49334..4e04f34aa 100644 --- a/debian/patches-rt/0149-kconfig-Add-PREEMPT_RT_FULL.patch +++ b/debian/patches-rt/0149-kconfig-Add-PREEMPT_RT_FULL.patch @@ -1,8 +1,7 @@ -From 484511a754ae9320cc61d583c24e811d3cc476ff Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Wed, 29 Jun 2011 14:58:57 +0200 -Subject: [PATCH 149/347] kconfig: Add PREEMPT_RT_FULL -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 149/342] kconfig: Add PREEMPT_RT_FULL +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=602f4e43efe1b27b4acd0a6f09186d0d2aa71a24 Introduce the final symbol for PREEMPT_RT_FULL. @@ -64,6 +63,3 @@ index 662fe19da990..089200debc38 100755 UTS_VERSION="$UTS_VERSION $CONFIG_FLAGS $TIMESTAMP" # Truncate to maximum length --- -2.36.1 - diff --git a/debian/patches-rt/0150-locking-rt-mutex-fix-deadlock-in-device-mapper-block.patch b/debian/patches-rt/0150-locking-rt-mutex-fix-deadlock-in-device-mapper-block.patch index 5404d73d6..baf9bfc92 100644 --- a/debian/patches-rt/0150-locking-rt-mutex-fix-deadlock-in-device-mapper-block.patch +++ b/debian/patches-rt/0150-locking-rt-mutex-fix-deadlock-in-device-mapper-block.patch @@ -1,9 +1,8 @@ -From d6b1373a76eff772848ccbfed73baf94c807e464 Mon Sep 17 00:00:00 2001 From: Mikulas Patocka Date: Mon, 13 Nov 2017 12:56:53 -0500 -Subject: [PATCH 150/347] locking/rt-mutex: fix deadlock in device mapper / +Subject: [PATCH 150/342] locking/rt-mutex: fix deadlock in device mapper / block-IO -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=5d5e1d7efa41d6c8e4e40b2505c073c13555f8cf When some block device driver creates a bio and submits it to another block device driver, the bio is added to current->bio_list (in order to @@ -76,6 +75,3 @@ index cc47d5aa93a1..721e3a4916d9 100644 return slowfn(lock, state, timeout, chwalk, ww_ctx); } --- -2.36.1 - diff --git a/debian/patches-rt/0151-locking-rt-mutex-Flush-block-plug-on-__down_read.patch b/debian/patches-rt/0151-locking-rt-mutex-Flush-block-plug-on-__down_read.patch index 3128f971d..27c354d1d 100644 --- a/debian/patches-rt/0151-locking-rt-mutex-Flush-block-plug-on-__down_read.patch +++ b/debian/patches-rt/0151-locking-rt-mutex-Flush-block-plug-on-__down_read.patch @@ -1,8 +1,7 @@ -From 229f57115cd91a8632a85152d6e43e781ebd367e Mon Sep 17 00:00:00 2001 From: Scott Wood Date: Fri, 4 Jan 2019 15:33:21 -0500 -Subject: [PATCH 151/347] locking/rt-mutex: Flush block plug on __down_read() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 151/342] locking/rt-mutex: Flush block plug on __down_read() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=0997f874d638be3d2f65de4bf3d9710d1e5bc2d8 __down_read() bypasses the rtmutex frontend to call rt_mutex_slowlock_locked() directly, and thus it needs to call @@ -41,6 +40,3 @@ index 660e22caf709..f518495bd6cc 100644 might_sleep(); raw_spin_lock_irq(&m->wait_lock); --- -2.36.1 - diff --git a/debian/patches-rt/0152-locking-rtmutex-re-init-the-wait_lock-in-rt_mutex_in.patch b/debian/patches-rt/0152-locking-rtmutex-re-init-the-wait_lock-in-rt_mutex_in.patch index d3b273dbb..d79f148a7 100644 --- a/debian/patches-rt/0152-locking-rtmutex-re-init-the-wait_lock-in-rt_mutex_in.patch +++ b/debian/patches-rt/0152-locking-rtmutex-re-init-the-wait_lock-in-rt_mutex_in.patch @@ -1,9 +1,8 @@ -From b30a729eace6fa1b27e10316b55cfe2d0c7dbf9a Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Thu, 16 Nov 2017 16:48:48 +0100 -Subject: [PATCH 152/347] locking/rtmutex: re-init the wait_lock in +Subject: [PATCH 152/342] locking/rtmutex: re-init the wait_lock in rt_mutex_init_proxy_locked() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=33986efd8958c2bf3bbd528799dcb6cba9aaef50 We could provide a key-class for the lockdep (and fixup all callers) or move the init to all callers (like it was) in order to avoid lockdep @@ -34,6 +33,3 @@ index 721e3a4916d9..11bcae2184c4 100644 debug_rt_mutex_proxy_lock(lock, proxy_owner); rt_mutex_set_owner(lock, proxy_owner); } --- -2.36.1 - diff --git a/debian/patches-rt/0153-ptrace-fix-ptrace-vs-tasklist_lock-race.patch b/debian/patches-rt/0153-ptrace-fix-ptrace-vs-tasklist_lock-race.patch index fa509ce15..2fffa6e73 100644 --- a/debian/patches-rt/0153-ptrace-fix-ptrace-vs-tasklist_lock-race.patch +++ b/debian/patches-rt/0153-ptrace-fix-ptrace-vs-tasklist_lock-race.patch @@ -1,8 +1,7 @@ -From 590484060b22c2d41b6e33ab142e7bf68ad3d85a Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Thu, 29 Aug 2013 18:21:04 +0200 -Subject: [PATCH 153/347] ptrace: fix ptrace vs tasklist_lock race -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 153/342] ptrace: fix ptrace vs tasklist_lock race +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=cb675ae1b0511d73895bd276d65c88740717b40b As explained by Alexander Fyodorov : @@ -100,7 +99,7 @@ index e4e206a1e7dd..5374ade34b87 100644 * cond_resched() and cond_resched_lock(): latency reduction via * explicit rescheduling in places that are safe. The return diff --git a/kernel/ptrace.c b/kernel/ptrace.c -index 8a98e3e78c70..9c59e523f3cd 100644 +index bf8360e86f62..9078fdefc6e0 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c @@ -190,7 +190,14 @@ static bool ptrace_freeze_traced(struct task_struct *task) @@ -161,6 +160,3 @@ index 1f450a7649f0..9494e2007118 100644 ncsw = p->nvcsw | LONG_MIN; /* sets MSB */ task_rq_unlock(rq, p, &rf); --- -2.36.1 - diff --git a/debian/patches-rt/0154-rtmutex-annotate-sleeping-lock-context.patch b/debian/patches-rt/0154-rtmutex-annotate-sleeping-lock-context.patch index 916d8d802..0780d303e 100644 --- a/debian/patches-rt/0154-rtmutex-annotate-sleeping-lock-context.patch +++ b/debian/patches-rt/0154-rtmutex-annotate-sleeping-lock-context.patch @@ -1,8 +1,7 @@ -From ac520c8f628b0eeff2af71b77289199262510960 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Thu, 21 Sep 2017 14:25:13 +0200 -Subject: [PATCH 154/347] rtmutex: annotate sleeping lock context -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 154/342] rtmutex: annotate sleeping lock context +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=776ea97a6f953041a1ba42eafc4148ee1687f731 The RCU code complains on schedule() within a rcu_readlock() section. The valid scenario on -RT is if a sleeping is held. In order to suppress @@ -303,6 +302,3 @@ index 9494e2007118..555dea10764e 100644 +} +EXPORT_SYMBOL(migrate_enable); #endif --- -2.36.1 - diff --git a/debian/patches-rt/0155-sched-migrate_disable-fallback-to-preempt_disable-in.patch b/debian/patches-rt/0155-sched-migrate_disable-fallback-to-preempt_disable-in.patch index c471ea20d..4ed82ea97 100644 --- a/debian/patches-rt/0155-sched-migrate_disable-fallback-to-preempt_disable-in.patch +++ b/debian/patches-rt/0155-sched-migrate_disable-fallback-to-preempt_disable-in.patch @@ -1,9 +1,8 @@ -From e85e95b0e59b7d493402419e3a63a06978a06452 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Thu, 5 Jul 2018 14:44:51 +0200 -Subject: [PATCH 155/347] sched/migrate_disable: fallback to preempt_disable() +Subject: [PATCH 155/342] sched/migrate_disable: fallback to preempt_disable() instead barrier() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=1e31f6ab66216ee3cd7976b73cf11a8f8f0ab55f On SMP + !RT migrate_disable() is still around. It is not part of spin_lock() anymore so it has almost no users. However the futex code has a workaround for @@ -199,6 +198,3 @@ index dc3f3e6fa0bd..169b98c12da7 100644 P(migrate_disable); #endif P(nr_cpus_allowed); --- -2.36.1 - diff --git a/debian/patches-rt/0156-locking-don-t-check-for-__LINUX_SPINLOCK_TYPES_H-on-.patch b/debian/patches-rt/0156-locking-don-t-check-for-__LINUX_SPINLOCK_TYPES_H-on-.patch index b8812e5b3..cca123ab3 100644 --- a/debian/patches-rt/0156-locking-don-t-check-for-__LINUX_SPINLOCK_TYPES_H-on-.patch +++ b/debian/patches-rt/0156-locking-don-t-check-for-__LINUX_SPINLOCK_TYPES_H-on-.patch @@ -1,9 +1,8 @@ -From af3f791cb33d8bb0c19a9057198100a3bae10cb9 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Fri, 4 Aug 2017 17:40:42 +0200 -Subject: [PATCH 156/347] locking: don't check for __LINUX_SPINLOCK_TYPES_H on +Subject: [PATCH 156/342] locking: don't check for __LINUX_SPINLOCK_TYPES_H on -RT archs -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=8ab0fecbe8b849e10b94a02f931ef52a238372cc Upstream uses arch_spinlock_t within spinlock_t and requests that spinlock_types.h header file is included first. @@ -177,6 +176,3 @@ index c09b6407ae1b..b0243ba07fb7 100644 /* * include/linux/spinlock_types_up.h - spinlock type definitions for UP * --- -2.36.1 - diff --git a/debian/patches-rt/0157-rcu-Frob-softirq-test.patch b/debian/patches-rt/0157-rcu-Frob-softirq-test.patch index f69f7c094..6598a1655 100644 --- a/debian/patches-rt/0157-rcu-Frob-softirq-test.patch +++ b/debian/patches-rt/0157-rcu-Frob-softirq-test.patch @@ -1,8 +1,7 @@ -From 638391362ce6f052267016840a592cad59ee3eef Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Sat, 13 Aug 2011 00:23:17 +0200 -Subject: [PATCH 157/347] rcu: Frob softirq test -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 157/342] rcu: Frob softirq test +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=628969206bda92fd3cb80f9a7f60d46f759f6ff3 With RT_FULL we get the below wreckage: @@ -168,6 +167,3 @@ index 35f3552b7463..e9ce51e19e87 100644 lockdep_rcu_suspicious(__FILE__, __LINE__, "rcu_read_unlock() from irq or softirq with blocking in critical section!!!\n"); pr_alert("->rcu_read_unlock_special: %#x (b: %d, enq: %d nq: %d)\n", --- -2.36.1 - diff --git a/debian/patches-rt/0158-rcu-Merge-RCU-bh-into-RCU-preempt.patch b/debian/patches-rt/0158-rcu-Merge-RCU-bh-into-RCU-preempt.patch index 1c3897d25..2b96eb9c6 100644 --- a/debian/patches-rt/0158-rcu-Merge-RCU-bh-into-RCU-preempt.patch +++ b/debian/patches-rt/0158-rcu-Merge-RCU-bh-into-RCU-preempt.patch @@ -1,8 +1,7 @@ -From d21751c3efb035a08326d8a28789b91cb769ea70 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Wed, 5 Oct 2011 11:59:38 -0700 -Subject: [PATCH 158/347] rcu: Merge RCU-bh into RCU-preempt -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 158/342] rcu: Merge RCU-bh into RCU-preempt +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=e8243820023d1864d3416ab5ecae7c3537625b9e The Linux kernel has long RCU-bh read-side critical sections that intolerably increase scheduling latency under mainline's RCU-bh rules, @@ -346,6 +345,3 @@ index 81688a133552..6ffafb1b1584 100644 #endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ --- -2.36.1 - diff --git a/debian/patches-rt/0159-rcu-Make-ksoftirqd-do-RCU-quiescent-states.patch b/debian/patches-rt/0159-rcu-Make-ksoftirqd-do-RCU-quiescent-states.patch index 44b6d052a..e166211d1 100644 --- a/debian/patches-rt/0159-rcu-Make-ksoftirqd-do-RCU-quiescent-states.patch +++ b/debian/patches-rt/0159-rcu-Make-ksoftirqd-do-RCU-quiescent-states.patch @@ -1,8 +1,7 @@ -From 19f2644a64bbf80c134cc923b59d5448d76af806 Mon Sep 17 00:00:00 2001 From: "Paul E. McKenney" Date: Wed, 5 Oct 2011 11:45:18 -0700 -Subject: [PATCH 159/347] rcu: Make ksoftirqd do RCU quiescent states -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 159/342] rcu: Make ksoftirqd do RCU quiescent states +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=910ed8de1b690c46028f322611f08647be22a46e Implementing RCU-bh in terms of RCU-preempt makes the system vulnerable to network-based denial-of-service attacks. This patch therefore @@ -112,6 +111,3 @@ index e9ce51e19e87..938e64c69d18 100644 /* * Prepare a CPU for idle from an RCU perspective. The first major task --- -2.36.1 - diff --git a/debian/patches-rt/0160-rcu-Eliminate-softirq-processing-from-rcutree.patch b/debian/patches-rt/0160-rcu-Eliminate-softirq-processing-from-rcutree.patch index d4a6e3195..00533902b 100644 --- a/debian/patches-rt/0160-rcu-Eliminate-softirq-processing-from-rcutree.patch +++ b/debian/patches-rt/0160-rcu-Eliminate-softirq-processing-from-rcutree.patch @@ -1,8 +1,7 @@ -From 4fa514eb294144f8698e721f4b5a4de0447be272 Mon Sep 17 00:00:00 2001 From: "Paul E. McKenney" Date: Mon, 4 Nov 2013 13:21:10 -0800 -Subject: [PATCH 160/347] rcu: Eliminate softirq processing from rcutree -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 160/342] rcu: Eliminate softirq processing from rcutree +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=e6956a4a5226c57030ab0f03a099961a7912622c Running RCU out of softirq is a problem for some workloads that would like to manage RCU core processing independently of other softirq work, @@ -418,6 +417,3 @@ index 938e64c69d18..56639c8ed550 100644 static bool rcu_is_callbacks_kthread(void) { return false; --- -2.36.1 - diff --git a/debian/patches-rt/0161-srcu-use-cpu_online-instead-custom-check.patch b/debian/patches-rt/0161-srcu-use-cpu_online-instead-custom-check.patch index 626188f7a..f59184c6f 100644 --- a/debian/patches-rt/0161-srcu-use-cpu_online-instead-custom-check.patch +++ b/debian/patches-rt/0161-srcu-use-cpu_online-instead-custom-check.patch @@ -1,8 +1,7 @@ -From 4ce509b22af5e28f62c90f342169dad726731a39 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Wed, 13 Sep 2017 14:43:41 +0200 -Subject: [PATCH 161/347] srcu: use cpu_online() instead custom check -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 161/342] srcu: use cpu_online() instead custom check +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=40f0daab09838e3cb2bb289fd81961d4b99a371b The current check via srcu_online is slightly racy because after looking at srcu_online there could be an interrupt that interrupted us long @@ -91,6 +90,3 @@ index ae716ca783bc..f162a4f54b05 100644 return 0; } --- -2.36.1 - diff --git a/debian/patches-rt/0162-srcu-replace-local_irqsave-with-a-locallock.patch b/debian/patches-rt/0162-srcu-replace-local_irqsave-with-a-locallock.patch index 5cdde2079..b6f85e0af 100644 --- a/debian/patches-rt/0162-srcu-replace-local_irqsave-with-a-locallock.patch +++ b/debian/patches-rt/0162-srcu-replace-local_irqsave-with-a-locallock.patch @@ -1,8 +1,7 @@ -From 62524e62d2f224889aee36c1c134f0efb2fba025 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Thu, 12 Oct 2017 18:37:12 +0200 -Subject: [PATCH 162/347] srcu: replace local_irqsave() with a locallock -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 162/342] srcu: replace local_irqsave() with a locallock +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=2fc8ab8893cf5d21d8f969355bfafef1e2d061f9 There are two instances which disable interrupts in order to become a stable this_cpu_ptr() pointer. The restore part is coupled with @@ -72,6 +71,3 @@ index df0375453ba1..0f09a1a9e17c 100644 if (needgp) srcu_funnel_gp_start(sp, sdp, s, do_norm); else if (needexp) --- -2.36.1 - diff --git a/debian/patches-rt/0163-rcu-enable-rcu_normal_after_boot-by-default-for-RT.patch b/debian/patches-rt/0163-rcu-enable-rcu_normal_after_boot-by-default-for-RT.patch index 495aa2d9d..deabd95f6 100644 --- a/debian/patches-rt/0163-rcu-enable-rcu_normal_after_boot-by-default-for-RT.patch +++ b/debian/patches-rt/0163-rcu-enable-rcu_normal_after_boot-by-default-for-RT.patch @@ -1,8 +1,7 @@ -From 4da02c2768978a9206e437ab36a1d6e9ed2641af Mon Sep 17 00:00:00 2001 From: Julia Cartwright Date: Wed, 12 Oct 2016 11:21:14 -0500 -Subject: [PATCH 163/347] rcu: enable rcu_normal_after_boot by default for RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 163/342] rcu: enable rcu_normal_after_boot by default for RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=2a0165d80207502259764b4e08ff9292ec282d14 The forcing of an expedited grace period is an expensive and very RT-application unfriendly operation, as it forcibly preempts all running @@ -32,6 +31,3 @@ index 6ffafb1b1584..16d8dba23329 100644 module_param(rcu_normal_after_boot, int, 0); #endif /* #ifndef CONFIG_TINY_RCU */ --- -2.36.1 - diff --git a/debian/patches-rt/0164-tty-serial-omap-Make-the-locking-RT-aware.patch b/debian/patches-rt/0164-tty-serial-omap-Make-the-locking-RT-aware.patch index 842a20687..34496fcb7 100644 --- a/debian/patches-rt/0164-tty-serial-omap-Make-the-locking-RT-aware.patch +++ b/debian/patches-rt/0164-tty-serial-omap-Make-the-locking-RT-aware.patch @@ -1,8 +1,7 @@ -From ebe8e211893ebd446569ab83eeb7277a77db835f Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Thu, 28 Jul 2011 13:32:57 +0200 -Subject: [PATCH 164/347] tty/serial/omap: Make the locking RT aware -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 164/342] tty/serial/omap: Make the locking RT aware +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=21dad8bb64706a3b67bd55dc0e9bbc20e87e5975 The lock is a sleeping lock and local_irq_save() is not the optimsation we are looking for. Redo it to make it work on -RT and @@ -44,6 +43,3 @@ index 6420ae581a80..0f4f41ed9ffa 100644 } static int __init --- -2.36.1 - diff --git a/debian/patches-rt/0165-tty-serial-pl011-Make-the-locking-work-on-RT.patch b/debian/patches-rt/0165-tty-serial-pl011-Make-the-locking-work-on-RT.patch index 6309f7e50..9bb7c51b0 100644 --- a/debian/patches-rt/0165-tty-serial-pl011-Make-the-locking-work-on-RT.patch +++ b/debian/patches-rt/0165-tty-serial-pl011-Make-the-locking-work-on-RT.patch @@ -1,8 +1,7 @@ -From e699af6cca35d036a6876b5c9ec0b1355cc16842 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Tue, 8 Jan 2013 21:36:51 +0100 -Subject: [PATCH 165/347] tty/serial/pl011: Make the locking work on RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 165/342] tty/serial/pl011: Make the locking work on RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=4fdbc8d0d5cf770ae17bc4112cb279784d1e78de The lock is a sleeping lock and local_irq_save() is not the optimsation we are looking for. Redo it to make it work on -RT and non-RT. @@ -13,10 +12,10 @@ Signed-off-by: Thomas Gleixner 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c -index 5edc3813a9b9..7d4aee4c5091 100644 +index 7de4bed1ddba..c93f742f1d9d 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c -@@ -2196,13 +2196,19 @@ pl011_console_write(struct console *co, const char *s, unsigned int count) +@@ -2215,13 +2215,19 @@ pl011_console_write(struct console *co, const char *s, unsigned int count) clk_enable(uap->clk); @@ -39,7 +38,7 @@ index 5edc3813a9b9..7d4aee4c5091 100644 /* * First save the CR then disable the interrupts -@@ -2228,8 +2234,7 @@ pl011_console_write(struct console *co, const char *s, unsigned int count) +@@ -2247,8 +2253,7 @@ pl011_console_write(struct console *co, const char *s, unsigned int count) pl011_write(old_cr, uap, REG_CR); if (locked) @@ -49,6 +48,3 @@ index 5edc3813a9b9..7d4aee4c5091 100644 clk_disable(uap->clk); } --- -2.36.1 - diff --git a/debian/patches-rt/0166-tty-serial-pl011-explicitly-initialize-the-flags-var.patch b/debian/patches-rt/0166-tty-serial-pl011-explicitly-initialize-the-flags-var.patch index abf490978..963fe9faf 100644 --- a/debian/patches-rt/0166-tty-serial-pl011-explicitly-initialize-the-flags-var.patch +++ b/debian/patches-rt/0166-tty-serial-pl011-explicitly-initialize-the-flags-var.patch @@ -1,12 +1,11 @@ -From 59b39d4106f01f2ad2f1e7999490b5afc54f8b49 Mon Sep 17 00:00:00 2001 From: Kurt Kanzenbach Date: Mon, 24 Sep 2018 10:29:01 +0200 -Subject: [PATCH 166/347] tty: serial: pl011: explicitly initialize the flags +Subject: [PATCH 166/342] tty: serial: pl011: explicitly initialize the flags variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=2a2684c06eb6b87c6cd8a915f01cd285ae4acec1 Silence the following gcc warning: @@ -28,10 +27,10 @@ Signed-off-by: Sebastian Andrzej Siewior 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c -index 7d4aee4c5091..9666a20f23ec 100644 +index c93f742f1d9d..925c3556ffb9 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c -@@ -2191,7 +2191,7 @@ pl011_console_write(struct console *co, const char *s, unsigned int count) +@@ -2210,7 +2210,7 @@ pl011_console_write(struct console *co, const char *s, unsigned int count) { struct uart_amba_port *uap = amba_ports[co->index]; unsigned int old_cr = 0, new_cr; @@ -40,6 +39,3 @@ index 7d4aee4c5091..9666a20f23ec 100644 int locked = 1; clk_enable(uap->clk); --- -2.36.1 - diff --git a/debian/patches-rt/0167-rt-Improve-the-serial-console-PASS_LIMIT.patch b/debian/patches-rt/0167-rt-Improve-the-serial-console-PASS_LIMIT.patch index aa552dbab..5fbfa68c3 100644 --- a/debian/patches-rt/0167-rt-Improve-the-serial-console-PASS_LIMIT.patch +++ b/debian/patches-rt/0167-rt-Improve-the-serial-console-PASS_LIMIT.patch @@ -1,11 +1,10 @@ -From 2ca7e055b4220689e58ff53c7e64caf5e8eadb37 Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Wed, 14 Dec 2011 13:05:54 +0100 -Subject: [PATCH 167/347] rt: Improve the serial console PASS_LIMIT +Subject: [PATCH 167/342] rt: Improve the serial console PASS_LIMIT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=c489a37730ab7dc6711eaf529e620ffa4a040083 Beyond the warning: @@ -42,6 +41,3 @@ index d2df7d71d666..57fd29b2ddf5 100644 #include /* --- -2.36.1 - diff --git a/debian/patches-rt/0168-tty-serial-8250-don-t-take-the-trylock-during-oops.patch b/debian/patches-rt/0168-tty-serial-8250-don-t-take-the-trylock-during-oops.patch index 8cb91d2aa..e80b1a15e 100644 --- a/debian/patches-rt/0168-tty-serial-8250-don-t-take-the-trylock-during-oops.patch +++ b/debian/patches-rt/0168-tty-serial-8250-don-t-take-the-trylock-during-oops.patch @@ -1,8 +1,7 @@ -From bf2010a260b11e805d39d0d1a6d0302b1d3e7210 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Mon, 11 Apr 2016 16:55:02 +0200 -Subject: [PATCH 168/347] tty: serial: 8250: don't take the trylock during oops -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 168/342] tty: serial: 8250: don't take the trylock during oops +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=9baedf4a77e41542731e04db12fe39ec29b3f547 An oops with irqs off (panic() from irqsafe hrtimer like the watchdog timer) will lead to a lockdep warning on each invocation and as such @@ -15,10 +14,10 @@ Signed-off-by: Sebastian Andrzej Siewior 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c -index 34687c354f5e..ef8bccc0823c 100644 +index f11d1202566e..33d489691fdf 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c -@@ -3294,10 +3294,8 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s, +@@ -3298,10 +3298,8 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s, serial8250_rpm_get(up); @@ -30,6 +29,3 @@ index 34687c354f5e..ef8bccc0823c 100644 else spin_lock_irqsave(&port->lock, flags); --- -2.36.1 - diff --git a/debian/patches-rt/0169-locking-percpu-rwsem-Remove-preempt_disable-variants.patch b/debian/patches-rt/0169-locking-percpu-rwsem-Remove-preempt_disable-variants.patch index a6a0cd7c4..2691f7f99 100644 --- a/debian/patches-rt/0169-locking-percpu-rwsem-Remove-preempt_disable-variants.patch +++ b/debian/patches-rt/0169-locking-percpu-rwsem-Remove-preempt_disable-variants.patch @@ -1,8 +1,7 @@ -From 80adc8fb1dabebcc9d41cb6c0f122860061c12a3 Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Wed, 23 Nov 2016 16:29:32 +0100 -Subject: [PATCH 169/347] locking/percpu-rwsem: Remove preempt_disable variants -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 169/342] locking/percpu-rwsem: Remove preempt_disable variants +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=a6144b3d320a51f37923f97565c2075acfa272e2 Effective revert commit: @@ -221,6 +220,3 @@ index 79b99d653e03..fb44e237316d 100644 extern void percpu_down_write(struct percpu_rw_semaphore *); extern void percpu_up_write(struct percpu_rw_semaphore *); --- -2.36.1 - diff --git a/debian/patches-rt/0170-mm-Protect-activate_mm-by-preempt_-disable-enable-_r.patch b/debian/patches-rt/0170-mm-Protect-activate_mm-by-preempt_-disable-enable-_r.patch index f39bdbeba..efb35b78d 100644 --- a/debian/patches-rt/0170-mm-Protect-activate_mm-by-preempt_-disable-enable-_r.patch +++ b/debian/patches-rt/0170-mm-Protect-activate_mm-by-preempt_-disable-enable-_r.patch @@ -1,9 +1,8 @@ -From 67c3a14d6fbac8e692c9e7a999b7fe8d062529bc Mon Sep 17 00:00:00 2001 From: Yong Zhang Date: Tue, 15 May 2012 13:53:56 +0800 -Subject: [PATCH 170/347] mm: Protect activate_mm() by +Subject: [PATCH 170/342] mm: Protect activate_mm() by preempt_[disable&enable]_rt() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=9c267b77756364bd7e03dfa8c35b44e8aac88a92 User preempt_*_rt instead of local_irq_*_rt or otherwise there will be warning on ARM like below: @@ -77,6 +76,3 @@ index 3e612ae748e9..d0ccc070979f 100644 task_unlock(tsk); #ifdef finish_arch_post_lock_switch finish_arch_post_lock_switch(); --- -2.36.1 - diff --git a/debian/patches-rt/0171-fs-dcache-bring-back-explicit-INIT_HLIST_BL_HEAD-ini.patch b/debian/patches-rt/0171-fs-dcache-bring-back-explicit-INIT_HLIST_BL_HEAD-ini.patch index c6db9639d..fd867af3a 100644 --- a/debian/patches-rt/0171-fs-dcache-bring-back-explicit-INIT_HLIST_BL_HEAD-ini.patch +++ b/debian/patches-rt/0171-fs-dcache-bring-back-explicit-INIT_HLIST_BL_HEAD-ini.patch @@ -1,9 +1,8 @@ -From 54729c769ee68192a795377f27cc479b959ca152 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Wed, 13 Sep 2017 12:32:34 +0200 -Subject: [PATCH 171/347] fs/dcache: bring back explicit INIT_HLIST_BL_HEAD +Subject: [PATCH 171/342] fs/dcache: bring back explicit INIT_HLIST_BL_HEAD init -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=16d7e388305072fa331ed9314f101642caf833df Commit 3d375d78593c ("mm: update callers to use HASH_ZERO flag") removed INIT_HLIST_BL_HEAD and uses the ZERO flag instead for the init. However @@ -56,6 +55,3 @@ index 1897833a4668..b5e53587d14b 100644 d_hash_shift = 32 - d_hash_shift; } --- -2.36.1 - diff --git a/debian/patches-rt/0172-fs-dcache-disable-preemption-on-i_dir_seq-s-write-si.patch b/debian/patches-rt/0172-fs-dcache-disable-preemption-on-i_dir_seq-s-write-si.patch index 83ac5e6c0..5e95883cd 100644 --- a/debian/patches-rt/0172-fs-dcache-disable-preemption-on-i_dir_seq-s-write-si.patch +++ b/debian/patches-rt/0172-fs-dcache-disable-preemption-on-i_dir_seq-s-write-si.patch @@ -1,9 +1,8 @@ -From 44eeab3501a8354ba4c3fe6414168df6ccf60b74 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Fri, 20 Oct 2017 11:29:53 +0200 -Subject: [PATCH 172/347] fs/dcache: disable preemption on i_dir_seq's write +Subject: [PATCH 172/342] fs/dcache: disable preemption on i_dir_seq's write side -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=e5aa3cd1fb61377548b05992478366fa06df648a i_dir_seq is an opencoded seqcounter. Based on the code it looks like we could have two writers in parallel despite the fact that the d_lock is @@ -94,6 +93,3 @@ index 86f884e78b6b..029870aca4ff 100644 }; __u32 i_generation; --- -2.36.1 - diff --git a/debian/patches-rt/0173-squashfs-make-use-of-local-lock-in-multi_cpu-decompr.patch b/debian/patches-rt/0173-squashfs-make-use-of-local-lock-in-multi_cpu-decompr.patch index e885134f9..a8c04adce 100644 --- a/debian/patches-rt/0173-squashfs-make-use-of-local-lock-in-multi_cpu-decompr.patch +++ b/debian/patches-rt/0173-squashfs-make-use-of-local-lock-in-multi_cpu-decompr.patch @@ -1,9 +1,8 @@ -From 98873b747e4321516bb428c214fde307593e19f8 Mon Sep 17 00:00:00 2001 From: Julia Cartwright Date: Mon, 7 May 2018 08:58:57 -0500 -Subject: [PATCH 173/347] squashfs: make use of local lock in multi_cpu +Subject: [PATCH 173/342] squashfs: make use of local lock in multi_cpu decompressor -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=cd15b8ea0b373f60c52fd336a51db28780e51ddf Currently, the squashfs multi_cpu decompressor makes use of get_cpu_ptr()/put_cpu_ptr(), which unconditionally disable preemption @@ -67,6 +66,3 @@ index 23a9c28ad8ea..6a73c4fa88e7 100644 if (res < 0) ERROR("%s decompression failed, data probably corrupt\n", --- -2.36.1 - diff --git a/debian/patches-rt/0174-thermal-Defer-thermal-wakups-to-threads.patch b/debian/patches-rt/0174-thermal-Defer-thermal-wakups-to-threads.patch index 87e9fc777..55f25516b 100644 --- a/debian/patches-rt/0174-thermal-Defer-thermal-wakups-to-threads.patch +++ b/debian/patches-rt/0174-thermal-Defer-thermal-wakups-to-threads.patch @@ -1,8 +1,7 @@ -From add227c3c4d74e71f3d02036aed9c6ceae6a6f6c Mon Sep 17 00:00:00 2001 From: Daniel Wagner Date: Tue, 17 Feb 2015 09:37:44 +0100 -Subject: [PATCH 174/347] thermal: Defer thermal wakups to threads -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 174/342] thermal: Defer thermal wakups to threads +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=80d2debabf144ce9ed2ba4ef7be880809eb9415e On RT the spin lock in pkg_temp_thermal_platfrom_thermal_notify will call schedule while we run in irq context. @@ -132,6 +131,3 @@ index 1ef937d799e4..a5991cbb408f 100644 } module_exit(pkg_temp_thermal_exit) --- -2.36.1 - diff --git a/debian/patches-rt/0175-x86-fpu-Disable-preemption-around-local_bh_disable.patch b/debian/patches-rt/0175-x86-fpu-Disable-preemption-around-local_bh_disable.patch index 1aaf1d6d1..83ea602c2 100644 --- a/debian/patches-rt/0175-x86-fpu-Disable-preemption-around-local_bh_disable.patch +++ b/debian/patches-rt/0175-x86-fpu-Disable-preemption-around-local_bh_disable.patch @@ -1,8 +1,7 @@ -From b666ce0515d1940495c2bbb0ca0f32c1fea9ef38 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Tue, 11 Dec 2018 15:10:33 +0100 -Subject: [PATCH 175/347] x86/fpu: Disable preemption around local_bh_disable() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 175/342] x86/fpu: Disable preemption around local_bh_disable() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=71e8b8cd3f9e13bcfed104c93718b61839917f12 __fpu__restore_sig() restores the content of the FPU state in the CPUs and in order to avoid concurency it disbles BH. On !RT it also disables @@ -33,6 +32,3 @@ index 86a231338bbf..e5c8d5245289 100644 /* Failure is already handled */ return err; --- -2.36.1 - diff --git a/debian/patches-rt/0176-fs-epoll-Do-not-disable-preemption-on-RT.patch b/debian/patches-rt/0176-fs-epoll-Do-not-disable-preemption-on-RT.patch index bf911af26..a38bf0919 100644 --- a/debian/patches-rt/0176-fs-epoll-Do-not-disable-preemption-on-RT.patch +++ b/debian/patches-rt/0176-fs-epoll-Do-not-disable-preemption-on-RT.patch @@ -1,8 +1,7 @@ -From 6507a3f1c5cfe4486efb5aada6114437dd6d099f Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Fri, 8 Jul 2011 16:35:35 +0200 -Subject: [PATCH 176/347] fs/epoll: Do not disable preemption on RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 176/342] fs/epoll: Do not disable preemption on RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=39465cb875c530ab48723b2d7631fd7f39e0a332 ep_call_nested() takes a sleeping lock so we can't disable preemption. The light version is enough since ep_call_nested() doesn't mind beeing @@ -32,6 +31,3 @@ index a4a32b79e832..8569db5eceb0 100644 } #else --- -2.36.1 - diff --git a/debian/patches-rt/0177-mm-vmalloc-Another-preempt-disable-region-which-suck.patch b/debian/patches-rt/0177-mm-vmalloc-Another-preempt-disable-region-which-suck.patch index 54171e08f..a0fd78510 100644 --- a/debian/patches-rt/0177-mm-vmalloc-Another-preempt-disable-region-which-suck.patch +++ b/debian/patches-rt/0177-mm-vmalloc-Another-preempt-disable-region-which-suck.patch @@ -1,9 +1,8 @@ -From 1bb6422feb2c5d6c151b91f71dac97b33685af69 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Tue, 12 Jul 2011 11:39:36 +0200 -Subject: [PATCH 177/347] mm/vmalloc: Another preempt disable region which +Subject: [PATCH 177/342] mm/vmalloc: Another preempt disable region which sucks -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=08f4a1f48722a9046148340af70b3e2fcde3eb75 Avoid the preempt disable version of get_cpu_var(). The inner-lock should provide enough serialisation. @@ -68,6 +67,3 @@ index 1817871b0239..aa06badc76f4 100644 rcu_read_unlock(); /* Allocate new block if nothing was found */ --- -2.36.1 - diff --git a/debian/patches-rt/0178-block-mq-use-cpu_light.patch b/debian/patches-rt/0178-block-mq-use-cpu_light.patch index 127e4aeb1..ed3ebd629 100644 --- a/debian/patches-rt/0178-block-mq-use-cpu_light.patch +++ b/debian/patches-rt/0178-block-mq-use-cpu_light.patch @@ -1,8 +1,7 @@ -From 0d89852edf5dc2169659eb46bba1b5dc4f92444b Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Wed, 9 Apr 2014 10:37:23 +0200 -Subject: [PATCH 178/347] block: mq: use cpu_light() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 178/342] block: mq: use cpu_light() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=ceaaa62b2d57cc6c4ea2ea7dba6f6c266bd208b5 there is a might sleep splat because get_cpu() disables preemption and later we grab a lock. As a workaround for this we use get_cpu_light(). @@ -31,6 +30,3 @@ index 5ad9251627f8..5a96c97991b6 100644 } struct blk_mq_alloc_data { --- -2.36.1 - diff --git a/debian/patches-rt/0179-block-mq-do-not-invoke-preempt_disable.patch b/debian/patches-rt/0179-block-mq-do-not-invoke-preempt_disable.patch index c6d47b2d4..859ff09e8 100644 --- a/debian/patches-rt/0179-block-mq-do-not-invoke-preempt_disable.patch +++ b/debian/patches-rt/0179-block-mq-do-not-invoke-preempt_disable.patch @@ -1,8 +1,7 @@ -From 438290ebaac377f499a9c17e07ffa735ff6db1c2 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Tue, 14 Jul 2015 14:26:34 +0200 -Subject: [PATCH 179/347] block/mq: do not invoke preempt_disable() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 179/342] block/mq: do not invoke preempt_disable() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=fb97e375c69de88bac89ad2d4b152f3ae23637ad preempt_disable() and get_cpu() don't play well together with the sleeping locks it tries to allocate later. @@ -53,6 +52,3 @@ index ffa97d90bde9..ea41d67e4db5 100644 } kblockd_mod_delayed_work_on(blk_mq_hctx_next_cpu(hctx), &hctx->run_work, --- -2.36.1 - diff --git a/debian/patches-rt/0180-block-mq-don-t-complete-requests-via-IPI.patch b/debian/patches-rt/0180-block-mq-don-t-complete-requests-via-IPI.patch index b29ad2ead..207cd80ff 100644 --- a/debian/patches-rt/0180-block-mq-don-t-complete-requests-via-IPI.patch +++ b/debian/patches-rt/0180-block-mq-don-t-complete-requests-via-IPI.patch @@ -1,8 +1,7 @@ -From 229760413c4138a40587def4f9420bdb432fa502 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Thu, 29 Jan 2015 15:10:08 +0100 -Subject: [PATCH 180/347] block/mq: don't complete requests via IPI -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 180/342] block/mq: don't complete requests via IPI +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=4e9380971f8b08119840af917fb3d20b44697363 The IPI runs in hardirq context and there are sleeping locks. This patch moves the completion into a workqueue. @@ -114,6 +113,3 @@ index 56fe682d9beb..39d90bf9b5fa 100644 struct blk_mq_ctx *mq_ctx; int cpu; --- -2.36.1 - diff --git a/debian/patches-rt/0181-md-raid5-Make-raid5_percpu-handling-RT-aware.patch b/debian/patches-rt/0181-md-raid5-Make-raid5_percpu-handling-RT-aware.patch index e1f7c3fce..148b94e4b 100644 --- a/debian/patches-rt/0181-md-raid5-Make-raid5_percpu-handling-RT-aware.patch +++ b/debian/patches-rt/0181-md-raid5-Make-raid5_percpu-handling-RT-aware.patch @@ -1,8 +1,7 @@ -From 17db75361d2ecbea4026acde76a744fdecc4c475 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Tue, 6 Apr 2010 16:51:31 +0200 -Subject: [PATCH 181/347] md: raid5: Make raid5_percpu handling RT aware -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 181/342] md: raid5: Make raid5_percpu handling RT aware +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=ee5b72719d2eaaef95179f02ba27140ecc010e87 __raid_run_ops() disables preemption with get_cpu() around the access to the raid5_percpu variables. That causes scheduling while atomic @@ -20,7 +19,7 @@ Tested-by: Udo van den Heuvel 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c -index c7bda4b0bced..8eb234732c9b 100644 +index dad426cc0f90..73083d826cb5 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -2069,8 +2069,9 @@ static void raid_run_ops(struct stripe_head *sh, unsigned long ops_request) @@ -72,6 +71,3 @@ index 8474c224127b..a3bf907ab2af 100644 struct page *spare_page; /* Used when checking P/Q in raid6 */ struct flex_array *scribble; /* space for constructing buffer * lists and performing address --- -2.36.1 - diff --git a/debian/patches-rt/0182-rt-Introduce-cpu_chill.patch b/debian/patches-rt/0182-rt-Introduce-cpu_chill.patch index 4980e8e7b..45763af0f 100644 --- a/debian/patches-rt/0182-rt-Introduce-cpu_chill.patch +++ b/debian/patches-rt/0182-rt-Introduce-cpu_chill.patch @@ -1,8 +1,7 @@ -From 7c3cf849b26619430967542431dbe55c30629824 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Wed, 7 Mar 2012 20:51:03 +0100 -Subject: [PATCH 182/347] rt: Introduce cpu_chill() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 182/342] rt: Introduce cpu_chill() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=1a90e8a8114c8293b082950723f161fb291c9a98 Retry loops on RT might loop forever when the modifying side was preempted. Add cpu_chill() to replace cpu_relax(). cpu_chill() @@ -108,6 +107,3 @@ index 009001f06d33..0b94f54453ef 100644 /* * Functions related to boot-time initialization: */ --- -2.36.1 - diff --git a/debian/patches-rt/0183-hrtimer-Don-t-lose-state-in-cpu_chill.patch b/debian/patches-rt/0183-hrtimer-Don-t-lose-state-in-cpu_chill.patch index bb9264a1f..f559f43c0 100644 --- a/debian/patches-rt/0183-hrtimer-Don-t-lose-state-in-cpu_chill.patch +++ b/debian/patches-rt/0183-hrtimer-Don-t-lose-state-in-cpu_chill.patch @@ -1,8 +1,7 @@ -From f5a443f1a8355f1e2aca72d20e931d136b979ac9 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Tue, 19 Feb 2019 16:59:15 +0100 -Subject: [PATCH 183/347] hrtimer: Don't lose state in cpu_chill() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 183/342] hrtimer: Don't lose state in cpu_chill() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=97dde541f771635fac327fcb3c43579f5a62e644 In cpu_chill() the state is set to TASK_UNINTERRUPTIBLE and a timer is programmed. On return the state is always TASK_RUNNING which means we @@ -43,6 +42,3 @@ index 0b94f54453ef..96e505abf939 100644 } EXPORT_SYMBOL(cpu_chill); #endif --- -2.36.1 - diff --git a/debian/patches-rt/0184-hrtimer-cpu_chill-save-task-state-in-saved_state.patch b/debian/patches-rt/0184-hrtimer-cpu_chill-save-task-state-in-saved_state.patch index 6917a5783..7c2b86a09 100644 --- a/debian/patches-rt/0184-hrtimer-cpu_chill-save-task-state-in-saved_state.patch +++ b/debian/patches-rt/0184-hrtimer-cpu_chill-save-task-state-in-saved_state.patch @@ -1,9 +1,8 @@ -From 351c688963d6bfafec5cf05168e195effc77811c Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Tue, 26 Feb 2019 12:31:10 +0100 -Subject: [PATCH 184/347] hrtimer: cpu_chill(): save task state in +Subject: [PATCH 184/342] hrtimer: cpu_chill(): save task state in ->saved_state() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=250017b35e442ec3f0c0de915bc759b7c09970a4 In the previous change I saved the current task state on stack. This was bad because while the task is scheduled-out it might receive a wake-up. @@ -58,6 +57,3 @@ index 96e505abf939..aa8f3177580a 100644 } EXPORT_SYMBOL(cpu_chill); #endif --- -2.36.1 - diff --git a/debian/patches-rt/0185-block-blk-mq-move-blk_queue_usage_counter_release-in.patch b/debian/patches-rt/0185-block-blk-mq-move-blk_queue_usage_counter_release-in.patch index 802e53619..a408a43f9 100644 --- a/debian/patches-rt/0185-block-blk-mq-move-blk_queue_usage_counter_release-in.patch +++ b/debian/patches-rt/0185-block-blk-mq-move-blk_queue_usage_counter_release-in.patch @@ -1,9 +1,8 @@ -From 3c180d9b5b9620bc5c18e0a7fb9f02059b333db3 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Tue, 13 Mar 2018 13:49:16 +0100 -Subject: [PATCH 185/347] block: blk-mq: move blk_queue_usage_counter_release() +Subject: [PATCH 185/342] block: blk-mq: move blk_queue_usage_counter_release() into process context -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=6a7adb1b98617edcc96b31d7e0540fa0c3e0028e | BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:914 | in_atomic(): 1, irqs_disabled(): 0, pid: 255, name: kworker/u257:6 @@ -115,6 +114,3 @@ index 39d90bf9b5fa..0313098a428d 100644 struct percpu_ref q_usage_counter; struct list_head all_q_node; --- -2.36.1 - diff --git a/debian/patches-rt/0186-block-Use-cpu_chill-for-retry-loops.patch b/debian/patches-rt/0186-block-Use-cpu_chill-for-retry-loops.patch index 1e0c86edd..96077e1de 100644 --- a/debian/patches-rt/0186-block-Use-cpu_chill-for-retry-loops.patch +++ b/debian/patches-rt/0186-block-Use-cpu_chill-for-retry-loops.patch @@ -1,8 +1,7 @@ -From f13997a9d1ad83528116e8daabc9b2247530ec63 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Thu, 20 Dec 2012 18:28:26 +0100 -Subject: [PATCH 186/347] block: Use cpu_chill() for retry loops -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 186/342] block: Use cpu_chill() for retry loops +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=09fd64566fb6662245eaad575fa0c9639974f404 Retry loops on RT might loop forever when the modifying side was preempted. Steven also observed a live lock when there was a @@ -46,6 +45,3 @@ index 4c810969c3e2..48089f5bcc11 100644 goto retry; } } --- -2.36.1 - diff --git a/debian/patches-rt/0187-fs-dcache-Use-cpu_chill-in-trylock-loops.patch b/debian/patches-rt/0187-fs-dcache-Use-cpu_chill-in-trylock-loops.patch index 2df32b031..e25f891db 100644 --- a/debian/patches-rt/0187-fs-dcache-Use-cpu_chill-in-trylock-loops.patch +++ b/debian/patches-rt/0187-fs-dcache-Use-cpu_chill-in-trylock-loops.patch @@ -1,8 +1,7 @@ -From d12da2a9ddfd2e6803327ef9856a63caedb4c653 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Wed, 7 Mar 2012 21:00:34 +0100 -Subject: [PATCH 187/347] fs: dcache: Use cpu_chill() in trylock loops -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 187/342] fs: dcache: Use cpu_chill() in trylock loops +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=e02df13d5d60689b59c3c616e8d5e8b0b590f5ac Retry loops on RT might loop forever when the modifying side was preempted. Use cpu_chill() instead of cpu_relax() to let the system @@ -61,6 +60,3 @@ index 396ff1bcfdad..2c0ff275e978 100644 /* * After the slowpath clears MNT_WRITE_HOLD, mnt_is_readonly will * be set to match its requirements. So we must not load that until --- -2.36.1 - diff --git a/debian/patches-rt/0188-net-Use-cpu_chill-instead-of-cpu_relax.patch b/debian/patches-rt/0188-net-Use-cpu_chill-instead-of-cpu_relax.patch index eace39fdc..842d973e9 100644 --- a/debian/patches-rt/0188-net-Use-cpu_chill-instead-of-cpu_relax.patch +++ b/debian/patches-rt/0188-net-Use-cpu_chill-instead-of-cpu_relax.patch @@ -1,8 +1,7 @@ -From 6113e8d5c66aab6927b9d8656e1c5b1e8d7e35fb Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Wed, 7 Mar 2012 21:10:04 +0100 -Subject: [PATCH 188/347] net: Use cpu_chill() instead of cpu_relax() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 188/342] net: Use cpu_chill() instead of cpu_relax() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=08d2287893d5effd32a2d1c8821c3cf55702d8c2 Retry loops on RT might loop forever when the modifying side was preempted. Use cpu_chill() instead of cpu_relax() to let the system @@ -65,6 +64,3 @@ index 0b347f46b2f4..f395f06031bc 100644 } } --- -2.36.1 - diff --git a/debian/patches-rt/0189-fs-dcache-use-swait_queue-instead-of-waitqueue.patch b/debian/patches-rt/0189-fs-dcache-use-swait_queue-instead-of-waitqueue.patch index 70a3b56d9..5e37f719f 100644 --- a/debian/patches-rt/0189-fs-dcache-use-swait_queue-instead-of-waitqueue.patch +++ b/debian/patches-rt/0189-fs-dcache-use-swait_queue-instead-of-waitqueue.patch @@ -1,8 +1,7 @@ -From c6039e4946aa32ae6b790148a5a7357380e4a998 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Wed, 14 Sep 2016 14:35:49 +0200 -Subject: [PATCH 189/347] fs/dcache: use swait_queue instead of waitqueue -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 189/342] fs/dcache: use swait_queue instead of waitqueue +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=d7dde6c012afca804e922a5e807f06908f9170fe __d_lookup_done() invokes wake_up_all() while holding a hlist_bl_lock() which disables preemption. As a workaround convert it to swait. @@ -236,6 +235,3 @@ index c7cb30cdd1b7..119a56d7f739 100644 raw_spin_lock_irq(&q->lock); list_splice_init(&q->task_list, &tmp); while (!list_empty(&tmp)) { --- -2.36.1 - diff --git a/debian/patches-rt/0190-workqueue-Use-normal-rcu.patch b/debian/patches-rt/0190-workqueue-Use-normal-rcu.patch index ca3010992..da306db75 100644 --- a/debian/patches-rt/0190-workqueue-Use-normal-rcu.patch +++ b/debian/patches-rt/0190-workqueue-Use-normal-rcu.patch @@ -1,8 +1,7 @@ -From 8a58c9e05c039f23a1192df034ad9f56961ba52d Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Wed, 24 Jul 2013 15:26:54 +0200 -Subject: [PATCH 190/347] workqueue: Use normal rcu -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 190/342] workqueue: Use normal rcu +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=320456e9c705d27e54f3896084adce4fc4930f86 There is no need for sched_rcu. The undocumented reason why sched_rcu is used is to avoid a few explicit rcu_read_lock()/unlock() pairs by @@ -355,6 +354,3 @@ index b1bb6cb5802e..3e2f67b77ab8 100644 return written; } --- -2.36.1 - diff --git a/debian/patches-rt/0191-workqueue-Use-local-irq-lock-instead-of-irq-disable-.patch b/debian/patches-rt/0191-workqueue-Use-local-irq-lock-instead-of-irq-disable-.patch index d77219e80..af0123dec 100644 --- a/debian/patches-rt/0191-workqueue-Use-local-irq-lock-instead-of-irq-disable-.patch +++ b/debian/patches-rt/0191-workqueue-Use-local-irq-lock-instead-of-irq-disable-.patch @@ -1,9 +1,8 @@ -From c05bd3f09ed30bc24aa6a2fe5cfc0abd2fe883b3 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Sun, 17 Jul 2011 21:42:26 +0200 -Subject: [PATCH 191/347] workqueue: Use local irq lock instead of irq disable +Subject: [PATCH 191/342] workqueue: Use local irq lock instead of irq disable regions -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=db677b16afffaae08d8aa77b72025ae6155646ca Use a local_irq_lock as a replacement for irq off regions. We keep the semantic of irq-off in regard to the pool->lock and remain preemptible. @@ -181,6 +180,3 @@ index 3e2f67b77ab8..2b4c052c51b3 100644 return ret; } --- -2.36.1 - diff --git a/debian/patches-rt/0192-workqueue-Prevent-workqueue-versus-ata-piix-livelock.patch b/debian/patches-rt/0192-workqueue-Prevent-workqueue-versus-ata-piix-livelock.patch index 28a95db99..998f230b3 100644 --- a/debian/patches-rt/0192-workqueue-Prevent-workqueue-versus-ata-piix-livelock.patch +++ b/debian/patches-rt/0192-workqueue-Prevent-workqueue-versus-ata-piix-livelock.patch @@ -1,8 +1,7 @@ -From c86179fe263e888b8dcffa0f1956e2b170b36b48 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Mon, 1 Jul 2013 11:02:42 +0200 -Subject: [PATCH 192/347] workqueue: Prevent workqueue versus ata-piix livelock -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 192/342] workqueue: Prevent workqueue versus ata-piix livelock +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=7e44200efbc637bb4e2d7632e624fae8d13d050f An Intel i7 system regularly detected rcu_preempt stalls after the kernel was upgraded from 3.6-rt to 3.8-rt. When the stall happened, disk I/O was no @@ -134,6 +133,3 @@ index 2b4c052c51b3..6e73e3eaca5e 100644 return -EAGAIN; } --- -2.36.1 - diff --git a/debian/patches-rt/0193-sched-Distangle-worker-accounting-from-rqlock.patch b/debian/patches-rt/0193-sched-Distangle-worker-accounting-from-rqlock.patch index 5347efe07..a973153f3 100644 --- a/debian/patches-rt/0193-sched-Distangle-worker-accounting-from-rqlock.patch +++ b/debian/patches-rt/0193-sched-Distangle-worker-accounting-from-rqlock.patch @@ -1,8 +1,7 @@ -From a446a9e4a93ca3245891dbdac928195f604ee473 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Wed, 22 Jun 2011 19:47:03 +0200 -Subject: [PATCH 193/347] sched: Distangle worker accounting from rqlock -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 193/342] sched: Distangle worker accounting from rqlock +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=8ca2a73886fa457834e49ae8f2488d39428f7a6b The worker accounting for cpu bound workers is plugged into the core scheduler code and the wakeup code. This is not a hard requirement and @@ -286,6 +285,3 @@ index 66fbb5a9e633..30cfed226b39 100644 +void wq_worker_sleeping(struct task_struct *task); #endif /* _KERNEL_WORKQUEUE_INTERNAL_H */ --- -2.36.1 - diff --git a/debian/patches-rt/0194-debugobjects-Make-RT-aware.patch b/debian/patches-rt/0194-debugobjects-Make-RT-aware.patch index 3fd87b158..84ba1e2bb 100644 --- a/debian/patches-rt/0194-debugobjects-Make-RT-aware.patch +++ b/debian/patches-rt/0194-debugobjects-Make-RT-aware.patch @@ -1,8 +1,7 @@ -From eaad8379256de9e0327feb6fac10f692aaee4498 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Sun, 17 Jul 2011 21:41:35 +0200 -Subject: [PATCH 194/347] debugobjects: Make RT aware -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 194/342] debugobjects: Make RT aware +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=3f4b31a6cffe2e681eb6631ee488dfb405b2cd8c Avoid filling the pool / allocating memory with irqs off(). @@ -27,6 +26,3 @@ index 14afeeb7d6ef..e28481c402ae 100644 db = get_bucket((unsigned long) addr); --- -2.36.1 - diff --git a/debian/patches-rt/0195-seqlock-Prevent-rt-starvation.patch b/debian/patches-rt/0195-seqlock-Prevent-rt-starvation.patch index 6398461d7..9be672971 100644 --- a/debian/patches-rt/0195-seqlock-Prevent-rt-starvation.patch +++ b/debian/patches-rt/0195-seqlock-Prevent-rt-starvation.patch @@ -1,8 +1,7 @@ -From d2adc15afeaebd45ad21834295e100c5627a7fa2 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Wed, 22 Feb 2012 12:03:30 +0100 -Subject: [PATCH 195/347] seqlock: Prevent rt starvation -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 195/342] seqlock: Prevent rt starvation +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=8072825488181a21a2f501d13d57d3220abcb7f3 If a low prio writer gets preempted while holding the seqlock write locked, a high prio reader spins forever on RT. @@ -190,6 +189,3 @@ index 5ce035984a4d..1166fc17b757 100644 const struct net_device *dev) { unsigned int seq; --- -2.36.1 - diff --git a/debian/patches-rt/0196-sunrpc-Make-svc_xprt_do_enqueue-use-get_cpu_light.patch b/debian/patches-rt/0196-sunrpc-Make-svc_xprt_do_enqueue-use-get_cpu_light.patch index e55b80bd6..c5f235d1e 100644 --- a/debian/patches-rt/0196-sunrpc-Make-svc_xprt_do_enqueue-use-get_cpu_light.patch +++ b/debian/patches-rt/0196-sunrpc-Make-svc_xprt_do_enqueue-use-get_cpu_light.patch @@ -1,9 +1,8 @@ -From f1452101ff124dd5a82d5345b6f92f98d891054f Mon Sep 17 00:00:00 2001 From: Mike Galbraith Date: Wed, 18 Feb 2015 16:05:28 +0100 -Subject: [PATCH 196/347] sunrpc: Make svc_xprt_do_enqueue() use +Subject: [PATCH 196/342] sunrpc: Make svc_xprt_do_enqueue() use get_cpu_light() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=228ab644582c29253ee82c543e2ebb2e63f1d55b |BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:915 |in_atomic(): 1, irqs_disabled(): 0, pid: 3194, name: rpc.nfsd @@ -56,6 +55,3 @@ index 4b56b949a463..83a4a0a13a1c 100644 trace_svc_xprt_do_enqueue(xprt, rqstp); } EXPORT_SYMBOL_GPL(svc_xprt_do_enqueue); --- -2.36.1 - diff --git a/debian/patches-rt/0197-net-Use-skbufhead-with-raw-lock.patch b/debian/patches-rt/0197-net-Use-skbufhead-with-raw-lock.patch index f54ab15b6..4625d57cb 100644 --- a/debian/patches-rt/0197-net-Use-skbufhead-with-raw-lock.patch +++ b/debian/patches-rt/0197-net-Use-skbufhead-with-raw-lock.patch @@ -1,22 +1,20 @@ -From 8c4af88efcc296bc2daa2be90fbea82190799883 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Tue, 12 Jul 2011 15:38:34 +0200 -Subject: [PATCH 197/347] net: Use skbufhead with raw lock -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 197/342] net: Use skbufhead with raw lock +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=f524a61883a8ae93a669bc5d257d7bd5ecb25b4f Use the rps lock as rawlock so we can keep irq-off regions. It looks low latency. However we can't kfree() from this context therefore we defer this to the softirq and use the tofree_queue list for it (similar to process_queue). Signed-off-by: Thomas Gleixner +[bwh: Adjust context to apply on top of 4.19.257] --- include/linux/netdevice.h | 1 + include/linux/skbuff.h | 7 +++++++ net/core/dev.c | 26 ++++++++++++++++++++------ 3 files changed, 28 insertions(+), 6 deletions(-) -diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h -index 8d48b352ee74..d893dc112afc 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -2990,6 +2990,7 @@ struct softnet_data { @@ -27,8 +25,6 @@ index 8d48b352ee74..d893dc112afc 100644 }; -diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h -index f97734f34746..3ede4f0eac10 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -287,6 +287,7 @@ struct sk_buff_head { @@ -39,7 +35,7 @@ index f97734f34746..3ede4f0eac10 100644 }; struct sk_buff; -@@ -1735,6 +1736,12 @@ static inline void skb_queue_head_init(struct sk_buff_head *list) +@@ -1735,6 +1736,12 @@ static inline void skb_queue_head_init(s __skb_queue_head_init(list); } @@ -52,11 +48,9 @@ index f97734f34746..3ede4f0eac10 100644 static inline void skb_queue_head_init_class(struct sk_buff_head *list, struct lock_class_key *class) { -diff --git a/net/core/dev.c b/net/core/dev.c -index 315bdaf00ac8..c279375fa5b9 100644 --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -219,14 +219,14 @@ static inline struct hlist_head *dev_index_hash(struct net *net, int ifindex) +@@ -219,14 +219,14 @@ static inline struct hlist_head *dev_ind static inline void rps_lock(struct softnet_data *sd) { #ifdef CONFIG_RPS @@ -73,7 +67,7 @@ index 315bdaf00ac8..c279375fa5b9 100644 #endif } -@@ -5858,7 +5858,9 @@ static int process_backlog(struct napi_struct *napi, int quota) +@@ -5858,7 +5858,9 @@ static int process_backlog(struct napi_s while (again) { struct sk_buff *skb; @@ -83,7 +77,7 @@ index 315bdaf00ac8..c279375fa5b9 100644 rcu_read_lock(); __netif_receive_skb(skb); rcu_read_unlock(); -@@ -5866,9 +5868,9 @@ static int process_backlog(struct napi_struct *napi, int quota) +@@ -5866,9 +5868,9 @@ static int process_backlog(struct napi_s if (++work >= quota) return work; @@ -94,10 +88,10 @@ index 315bdaf00ac8..c279375fa5b9 100644 rps_lock(sd); if (skb_queue_empty(&sd->input_pkt_queue)) { /* -@@ -6341,13 +6343,21 @@ static __latent_entropy void net_rx_action(struct softirq_action *h) +@@ -6341,13 +6343,21 @@ static __latent_entropy void net_rx_acti unsigned long time_limit = jiffies + - usecs_to_jiffies(netdev_budget_usecs); - int budget = netdev_budget; + usecs_to_jiffies(READ_ONCE(netdev_budget_usecs)); + int budget = READ_ONCE(netdev_budget); + struct sk_buff_head tofree_q; + struct sk_buff *skb; LIST_HEAD(list); @@ -116,7 +110,7 @@ index 315bdaf00ac8..c279375fa5b9 100644 for (;;) { struct napi_struct *n; -@@ -9545,10 +9555,13 @@ static int dev_cpu_dead(unsigned int oldcpu) +@@ -9545,10 +9555,13 @@ static int dev_cpu_dead(unsigned int old netif_rx_ni(skb); input_queue_head_incr(oldsd); } @@ -143,6 +137,3 @@ index 315bdaf00ac8..c279375fa5b9 100644 #ifdef CONFIG_XFRM_OFFLOAD skb_queue_head_init(&sd->xfrm_backlog); #endif --- -2.36.1 - diff --git a/debian/patches-rt/0198-net-move-xmit_recursion-to-per-task-variable-on-RT.patch b/debian/patches-rt/0198-net-move-xmit_recursion-to-per-task-variable-on-RT.patch index 242d9fd91..8bcd7bc6b 100644 --- a/debian/patches-rt/0198-net-move-xmit_recursion-to-per-task-variable-on-RT.patch +++ b/debian/patches-rt/0198-net-move-xmit_recursion-to-per-task-variable-on-RT.patch @@ -1,8 +1,7 @@ -From 5b1c12f86da1a979d45cda068adc9b597bc37e53 Mon Sep 17 00:00:00 2001 From: Clark Williams Date: Fri, 17 Dec 2021 14:31:31 -0600 -Subject: [PATCH 198/347] net: move xmit_recursion to per-task variable on -RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 198/342] net: move xmit_recursion to per-task variable on -RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=94836799f3c24696f98f3517a0681f167007fd18 A softirq on -RT can be preempted. That means one task is in __dev_queue_xmit(), gets preempted and another task may enter @@ -184,6 +183,3 @@ index c279375fa5b9..a59b1db02f8b 100644 netdev_queue_numa_node_write(queue, NUMA_NO_NODE); queue->dev = dev; #ifdef CONFIG_BQL --- -2.36.1 - diff --git a/debian/patches-rt/0199-net-provide-a-way-to-delegate-processing-a-softirq-t.patch b/debian/patches-rt/0199-net-provide-a-way-to-delegate-processing-a-softirq-t.patch index ad68c8b6d..ab1e08c6b 100644 --- a/debian/patches-rt/0199-net-provide-a-way-to-delegate-processing-a-softirq-t.patch +++ b/debian/patches-rt/0199-net-provide-a-way-to-delegate-processing-a-softirq-t.patch @@ -1,9 +1,8 @@ -From e035c89c203c5d80fa945338da5efe3ec563c7f7 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Wed, 20 Jan 2016 15:39:05 +0100 -Subject: [PATCH 199/347] net: provide a way to delegate processing a softirq +Subject: [PATCH 199/342] net: provide a way to delegate processing a softirq to ksoftirqd -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=9c6bc0e0c15e8990049af42ea7f423c9057c262d If the NET_RX uses up all of his budget it moves the following NAPI invocations into the `ksoftirqd`. On -RT it does not do so. Instead it @@ -84,6 +83,3 @@ index a59b1db02f8b..2bf357d5602b 100644 net_rps_action_and_irq_enable(sd); out: --- -2.36.1 - diff --git a/debian/patches-rt/0200-net-dev-always-take-qdisc-s-busylock-in-__dev_xmit_s.patch b/debian/patches-rt/0200-net-dev-always-take-qdisc-s-busylock-in-__dev_xmit_s.patch index 026e263e5..ad802bb69 100644 --- a/debian/patches-rt/0200-net-dev-always-take-qdisc-s-busylock-in-__dev_xmit_s.patch +++ b/debian/patches-rt/0200-net-dev-always-take-qdisc-s-busylock-in-__dev_xmit_s.patch @@ -1,9 +1,8 @@ -From e58c64de87f7c5ae3df17d3f8c9615e1655176eb Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Wed, 30 Mar 2016 13:36:29 +0200 -Subject: [PATCH 200/347] net: dev: always take qdisc's busylock in +Subject: [PATCH 200/342] net: dev: always take qdisc's busylock in __dev_xmit_skb() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=1722e39cfe183bfcf871f6e35ffcf2b3f1738b3e The root-lock is dropped before dev_hard_start_xmit() is invoked and after setting the __QDISC___STATE_RUNNING bit. If this task is now pushed away @@ -37,6 +36,3 @@ index 2bf357d5602b..7c59fa4d3ecf 100644 if (unlikely(contended)) spin_lock(&q->busylock); --- -2.36.1 - diff --git a/debian/patches-rt/0201-net-Qdisc-use-a-seqlock-instead-seqcount.patch b/debian/patches-rt/0201-net-Qdisc-use-a-seqlock-instead-seqcount.patch index 8d15d62a7..dac59a0ed 100644 --- a/debian/patches-rt/0201-net-Qdisc-use-a-seqlock-instead-seqcount.patch +++ b/debian/patches-rt/0201-net-Qdisc-use-a-seqlock-instead-seqcount.patch @@ -1,8 +1,7 @@ -From 561eb0fa2d08a2b919983a6deaaef8022a6d0707 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Wed, 14 Sep 2016 17:36:35 +0200 -Subject: [PATCH 201/347] net/Qdisc: use a seqlock instead seqcount -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 201/342] net/Qdisc: use a seqlock instead seqcount +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=b3887369aebc1200946b977b1291a1226f40613d The seqcount disables preemption on -RT while it is held which can't remove. Also we don't want the reader to spin for ages if the writer is @@ -255,7 +254,7 @@ index 424e70907b96..6b4ee7c98d69 100644 err = -EOPNOTSUPP; if (sch->flags & TCQ_F_MQROOT) { diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c -index 42a776abdf2f..cc4c4309a2b8 100644 +index 8d8a9ac2562f..cc777abd16da 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c @@ -576,7 +576,11 @@ struct Qdisc noop_qdisc = { @@ -288,6 +287,3 @@ index 42a776abdf2f..cc4c4309a2b8 100644 sch->ops = ops; sch->flags = ops->static_flags; --- -2.36.1 - diff --git a/debian/patches-rt/0202-net-add-back-the-missing-serialization-in-ip_send_un.patch b/debian/patches-rt/0202-net-add-back-the-missing-serialization-in-ip_send_un.patch index b6925c62f..7201414d9 100644 --- a/debian/patches-rt/0202-net-add-back-the-missing-serialization-in-ip_send_un.patch +++ b/debian/patches-rt/0202-net-add-back-the-missing-serialization-in-ip_send_un.patch @@ -1,12 +1,11 @@ -From 3254a7bf68224051974bf79f76549e4592e45262 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Wed, 31 Aug 2016 17:21:56 +0200 -Subject: [PATCH 202/347] net: add back the missing serialization in +Subject: [PATCH 202/342] net: add back the missing serialization in ip_send_unicast_reply() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=513fe58b8aa1cf9e2d118103cc28854c01e83ab1 Some time ago Sami Pietikäinen reported a crash on -RT in ip_send_unicast_reply() which was later fixed by Nicholas Mc Guire @@ -43,7 +42,7 @@ Signed-off-by: Sebastian Andrzej Siewior 1 file changed, 6 insertions(+) diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c -index 2719c60f285b..8e2db5007f59 100644 +index ddc1af8731e3..2a080d70d64c 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -62,6 +62,7 @@ @@ -94,6 +93,3 @@ index 2719c60f285b..8e2db5007f59 100644 local_bh_enable(); } --- -2.36.1 - diff --git a/debian/patches-rt/0203-net-add-a-lock-around-icmp_sk.patch b/debian/patches-rt/0203-net-add-a-lock-around-icmp_sk.patch index fa2ad051e..4ee80f7e7 100644 --- a/debian/patches-rt/0203-net-add-a-lock-around-icmp_sk.patch +++ b/debian/patches-rt/0203-net-add-a-lock-around-icmp_sk.patch @@ -1,8 +1,7 @@ -From 95179968fe9e7b7b6484facb14b8ac985cc0d779 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Wed, 31 Aug 2016 17:54:09 +0200 -Subject: [PATCH 203/347] net: add a lock around icmp_sk() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 203/342] net: add a lock around icmp_sk() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=0034f22f94d4dda2d9486dfb4e8acabc8f947c17 It looks like the this_cpu_ptr() access in icmp_sk() is protected with local_bh_disable(). To avoid missing serialization in -RT I am adding @@ -15,7 +14,7 @@ Signed-off-by: Sebastian Andrzej Siewior 1 file changed, 8 insertions(+) diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c -index fe10a565b7d8..d35719e08aef 100644 +index aa179e6461e1..47ebb0e0445c 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -77,6 +77,7 @@ @@ -60,6 +59,3 @@ index fe10a565b7d8..d35719e08aef 100644 } int sysctl_icmp_msgs_per_sec __read_mostly = 1000; --- -2.36.1 - diff --git a/debian/patches-rt/0204-net-Have-__napi_schedule_irqoff-disable-interrupts-o.patch b/debian/patches-rt/0204-net-Have-__napi_schedule_irqoff-disable-interrupts-o.patch index 5a4aed73f..11f3b2b95 100644 --- a/debian/patches-rt/0204-net-Have-__napi_schedule_irqoff-disable-interrupts-o.patch +++ b/debian/patches-rt/0204-net-Have-__napi_schedule_irqoff-disable-interrupts-o.patch @@ -1,9 +1,8 @@ -From 2faaff72af2ce49a00236dbfe09246e3099229ec Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Tue, 6 Dec 2016 17:50:30 -0500 -Subject: [PATCH 204/347] net: Have __napi_schedule_irqoff() disable interrupts +Subject: [PATCH 204/342] net: Have __napi_schedule_irqoff() disable interrupts on RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=4171dffd1a3b19e920140745da11771243ac3631 A customer hit a crash where the napi sd->poll_list became corrupted. The customer had the bnx2x driver, which does a @@ -72,6 +71,3 @@ index 7c59fa4d3ecf..e65dc7a7cc13 100644 bool napi_complete_done(struct napi_struct *n, int work_done) { --- -2.36.1 - diff --git a/debian/patches-rt/0205-irqwork-push-most-work-into-softirq-context.patch b/debian/patches-rt/0205-irqwork-push-most-work-into-softirq-context.patch index 964c52d2e..314809d7b 100644 --- a/debian/patches-rt/0205-irqwork-push-most-work-into-softirq-context.patch +++ b/debian/patches-rt/0205-irqwork-push-most-work-into-softirq-context.patch @@ -1,8 +1,7 @@ -From c0405a2b67942dd7f8564a25fa5580c8f2774765 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Tue, 23 Jun 2015 15:32:51 +0200 -Subject: [PATCH 205/347] irqwork: push most work into softirq context -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 205/342] irqwork: push most work into softirq context +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=3b91447711938ba1aee8c66249408ab12ba1b8f2 Initially we defered all irqwork into softirq because we didn't want the latency spikes if perf or another user was busy and delayed the RT task. @@ -259,6 +258,3 @@ index 3cb79167852f..c7bd68db6f63 100644 __run_timers(base); if (IS_ENABLED(CONFIG_NO_HZ_COMMON)) __run_timers(this_cpu_ptr(&timer_bases[BASE_DEF])); --- -2.36.1 - diff --git a/debian/patches-rt/0206-printk-Make-rt-aware.patch b/debian/patches-rt/0206-printk-Make-rt-aware.patch index 0ca16f202..0a5220da2 100644 --- a/debian/patches-rt/0206-printk-Make-rt-aware.patch +++ b/debian/patches-rt/0206-printk-Make-rt-aware.patch @@ -1,8 +1,7 @@ -From fe512f6331aa2cda166c08988965010dd06d68e3 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Wed, 19 Sep 2012 14:50:37 +0200 -Subject: [PATCH 206/347] printk: Make rt aware -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 206/342] printk: Make rt aware +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=338dc05ea3a9f2fc4900771ff722965bf1a72427 Drop the lock before calling the console driver and do not disable interrupts while printing to a serial console. @@ -109,6 +108,3 @@ index 7b774743e1ac..c06b1e00448d 100644 if (do_cond_resched) cond_resched(); --- -2.36.1 - diff --git a/debian/patches-rt/0207-kernel-printk-Don-t-try-to-print-from-IRQ-NMI-region.patch b/debian/patches-rt/0207-kernel-printk-Don-t-try-to-print-from-IRQ-NMI-region.patch index 75627e24f..b7e92b8c4 100644 --- a/debian/patches-rt/0207-kernel-printk-Don-t-try-to-print-from-IRQ-NMI-region.patch +++ b/debian/patches-rt/0207-kernel-printk-Don-t-try-to-print-from-IRQ-NMI-region.patch @@ -1,8 +1,7 @@ -From 5ff42463701b87deff98424f5417e808d69fd327 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Thu, 19 May 2016 17:45:27 +0200 -Subject: [PATCH 207/347] kernel/printk: Don't try to print from IRQ/NMI region -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 207/342] kernel/printk: Don't try to print from IRQ/NMI region +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=5d98d6ee2ef71f23a1efd1f0a393f41b7329acfd On -RT we try to acquire sleeping locks which might lead to warnings from lockdep or a warn_on() from spin_try_lock() (which is a rtmutex on @@ -43,6 +42,3 @@ index c06b1e00448d..273f2c7864b5 100644 /* * console_unblank can no longer be called in interrupt context unless * oops_in_progress is set to 1.. --- -2.36.1 - diff --git a/debian/patches-rt/0208-printk-Drop-the-logbuf_lock-more-often.patch b/debian/patches-rt/0208-printk-Drop-the-logbuf_lock-more-often.patch index bc4f44f50..07a845599 100644 --- a/debian/patches-rt/0208-printk-Drop-the-logbuf_lock-more-often.patch +++ b/debian/patches-rt/0208-printk-Drop-the-logbuf_lock-more-often.patch @@ -1,8 +1,7 @@ -From b4bf7654e00cd7da0d18577698e25eb199de2d57 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Thu, 21 Mar 2013 19:01:05 +0100 -Subject: [PATCH 208/347] printk: Drop the logbuf_lock more often -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 208/342] printk: Drop the logbuf_lock more often +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=51849f67a7bf243a541853e4d207d4e94fd82a78 The lock is hold with irgs off. The latency drops 500us+ on my arm bugs with a "full" buffer after executing "dmesg" on the shell. @@ -78,6 +77,3 @@ index 273f2c7864b5..1e0988a0bb97 100644 logbuf_unlock_irq(); kfree(text); --- -2.36.1 - diff --git a/debian/patches-rt/0209-ARM-enable-irq-in-translation-section-permission-fau.patch b/debian/patches-rt/0209-ARM-enable-irq-in-translation-section-permission-fau.patch index 58d59fbae..94a0637df 100644 --- a/debian/patches-rt/0209-ARM-enable-irq-in-translation-section-permission-fau.patch +++ b/debian/patches-rt/0209-ARM-enable-irq-in-translation-section-permission-fau.patch @@ -1,12 +1,11 @@ -From c4bff0275d502012b7673069a3d2da755e67cdfb Mon Sep 17 00:00:00 2001 From: "Yadi.hu" Date: Wed, 10 Dec 2014 10:32:09 +0800 -Subject: [PATCH 209/347] ARM: enable irq in translation/section permission +Subject: [PATCH 209/342] ARM: enable irq in translation/section permission fault handlers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=339dbf4f42b071e7f56b9dcb8e219d4d4e0656d6 Probably happens on all ARM, with CONFIG_PREEMPT_RT_FULL @@ -91,6 +90,3 @@ index a9ee0d9dc740..20b0e146de98 100644 do_bad_area(addr, fsr, regs); return 0; } --- -2.36.1 - diff --git a/debian/patches-rt/0210-genirq-update-irq_set_irqchip_state-documentation.patch b/debian/patches-rt/0210-genirq-update-irq_set_irqchip_state-documentation.patch index 587d4cec5..dd1b4df51 100644 --- a/debian/patches-rt/0210-genirq-update-irq_set_irqchip_state-documentation.patch +++ b/debian/patches-rt/0210-genirq-update-irq_set_irqchip_state-documentation.patch @@ -1,8 +1,7 @@ -From ab960649ff425bcc7910011a0f591a4673e76df6 Mon Sep 17 00:00:00 2001 From: Josh Cartwright Date: Thu, 11 Feb 2016 11:54:00 -0600 -Subject: [PATCH 210/347] genirq: update irq_set_irqchip_state documentation -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 210/342] genirq: update irq_set_irqchip_state documentation +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=fd9790f0effc20eb941a4073134c21ca951f238c On -rt kernels, the use of migrate_disable()/migrate_enable() is sufficient to guarantee a task isn't moved to another CPU. Update the @@ -27,6 +26,3 @@ index 2bb77b0ebac8..683debac6759 100644 * interrupt controller has per-cpu registers. */ int irq_set_irqchip_state(unsigned int irq, enum irqchip_irq_state which, --- -2.36.1 - diff --git a/debian/patches-rt/0211-KVM-arm-arm64-downgrade-preempt_disable-d-region-to-.patch b/debian/patches-rt/0211-KVM-arm-arm64-downgrade-preempt_disable-d-region-to-.patch index a49a4c01e..2ab74f6ae 100644 --- a/debian/patches-rt/0211-KVM-arm-arm64-downgrade-preempt_disable-d-region-to-.patch +++ b/debian/patches-rt/0211-KVM-arm-arm64-downgrade-preempt_disable-d-region-to-.patch @@ -1,9 +1,8 @@ -From e3788b349ef7d4161dc666a0aca9fc054c913c04 Mon Sep 17 00:00:00 2001 From: Josh Cartwright Date: Thu, 11 Feb 2016 11:54:01 -0600 -Subject: [PATCH 211/347] KVM: arm/arm64: downgrade preempt_disable()d region +Subject: [PATCH 211/342] KVM: arm/arm64: downgrade preempt_disable()d region to migrate_disable() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=3da26421c3fe48964d225679c51bda781c92b5e2 kvm_arch_vcpu_ioctl_run() disables the use of preemption when updating the vgic and timer states to prevent the calling task from migrating to @@ -54,6 +53,3 @@ index b943ec5345cb..ddc6db1e8cd2 100644 ret = handle_exit(vcpu, run, ret); } --- -2.36.1 - diff --git a/debian/patches-rt/0212-arm64-fpsimd-use-preemp_disable-in-addition-to-local.patch b/debian/patches-rt/0212-arm64-fpsimd-use-preemp_disable-in-addition-to-local.patch index 5ac88e5fe..bf251dfc5 100644 --- a/debian/patches-rt/0212-arm64-fpsimd-use-preemp_disable-in-addition-to-local.patch +++ b/debian/patches-rt/0212-arm64-fpsimd-use-preemp_disable-in-addition-to-local.patch @@ -1,9 +1,8 @@ -From e6eac38976a1eebb792eb6a02fd95ed0868576fc Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Wed, 25 Jul 2018 14:02:38 +0200 -Subject: [PATCH 212/347] arm64: fpsimd: use preemp_disable in addition to +Subject: [PATCH 212/342] arm64: fpsimd: use preemp_disable in addition to local_bh_disable() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=008f9bc0512899030ddd5356f45dae391302fa9b In v4.16-RT I noticed a number of warnings from task_fpsimd_load(). The code disables BH and expects that it is not preemptible. On -RT the @@ -166,6 +165,3 @@ index 89ab68cb35bb..481793a5adc1 100644 } EXPORT_SYMBOL(kernel_neon_begin); --- -2.36.1 - diff --git a/debian/patches-rt/0213-kgdb-serial-Short-term-workaround.patch b/debian/patches-rt/0213-kgdb-serial-Short-term-workaround.patch index 464f4b0d7..71f829e94 100644 --- a/debian/patches-rt/0213-kgdb-serial-Short-term-workaround.patch +++ b/debian/patches-rt/0213-kgdb-serial-Short-term-workaround.patch @@ -1,8 +1,7 @@ -From 63a68f078dbbdde2ffc3a7cb2928cef6b17a38a3 Mon Sep 17 00:00:00 2001 From: Jason Wessel Date: Thu, 28 Jul 2011 12:42:23 -0500 -Subject: [PATCH 213/347] kgdb/serial: Short term workaround -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 213/342] kgdb/serial: Short term workaround +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=85172618f0e8bf15a8cf9029d0eca810de4ce722 On 07/27/2011 04:37 PM, Thomas Gleixner wrote: > - KGDB (not yet disabled) is reportedly unusable on -rt right now due @@ -25,7 +24,7 @@ Jason. 3 files changed, 7 insertions(+) diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c -index ef8bccc0823c..418b9c818b2e 100644 +index 33d489691fdf..8f6239892d39 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -31,6 +31,7 @@ @@ -36,7 +35,7 @@ index ef8bccc0823c..418b9c818b2e 100644 #include #include #include -@@ -3296,6 +3297,8 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s, +@@ -3300,6 +3301,8 @@ void serial8250_console_write(struct uart_8250_port *up, const char *s, if (port->sysrq || oops_in_progress) locked = 0; @@ -81,6 +80,3 @@ index b45576ca3b0d..ad1a3bc7908f 100644 return r; } --- -2.36.1 - diff --git a/debian/patches-rt/0214-sysfs-Add-sys-kernel-realtime-entry.patch b/debian/patches-rt/0214-sysfs-Add-sys-kernel-realtime-entry.patch index b477086ae..f9b72b5dd 100644 --- a/debian/patches-rt/0214-sysfs-Add-sys-kernel-realtime-entry.patch +++ b/debian/patches-rt/0214-sysfs-Add-sys-kernel-realtime-entry.patch @@ -1,8 +1,7 @@ -From c48c3a32632d4b467e3609a87b4149f9136afff6 Mon Sep 17 00:00:00 2001 From: Clark Williams Date: Sat, 30 Jul 2011 21:55:53 -0500 -Subject: [PATCH 214/347] sysfs: Add /sys/kernel/realtime entry -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 214/342] sysfs: Add /sys/kernel/realtime entry +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=377be180fa8ca554fbf62d9c8c01fe9e4d007f47 Add a /sys/kernel entry to indicate that the kernel is a realtime kernel. @@ -49,6 +48,3 @@ index 46ba853656f6..9a23632b6294 100644 #endif NULL }; --- -2.36.1 - diff --git a/debian/patches-rt/0215-mm-rt-kmap_atomic-scheduling.patch b/debian/patches-rt/0215-mm-rt-kmap_atomic-scheduling.patch index fe9e29581..fc23f6506 100644 --- a/debian/patches-rt/0215-mm-rt-kmap_atomic-scheduling.patch +++ b/debian/patches-rt/0215-mm-rt-kmap_atomic-scheduling.patch @@ -1,8 +1,7 @@ -From 6ffc40164236bf03b6c7c3c8dc826f5f96d8d797 Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Thu, 28 Jul 2011 10:43:51 +0200 -Subject: [PATCH 215/347] mm, rt: kmap_atomic scheduling -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 215/342] mm, rt: kmap_atomic scheduling +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=92ff3d2e6bfe3adeccf410f7b9e9a95ce2bf8d53 In fact, with migrate_disable() existing one could play games with kmap_atomic. You could save/restore the kmap_atomic slots on context @@ -320,6 +319,3 @@ index 59db3223a5d6..22aa3ddbd87b 100644 unsigned int nr_free_highpages (void) { --- -2.36.1 - diff --git a/debian/patches-rt/0216-x86-highmem-Add-a-already-used-pte-check.patch b/debian/patches-rt/0216-x86-highmem-Add-a-already-used-pte-check.patch index 1ed131e93..b04db4e0c 100644 --- a/debian/patches-rt/0216-x86-highmem-Add-a-already-used-pte-check.patch +++ b/debian/patches-rt/0216-x86-highmem-Add-a-already-used-pte-check.patch @@ -1,8 +1,7 @@ -From 0aa2a1e54dccb65560925aedd34406b867f182ce Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Mon, 11 Mar 2013 17:09:55 +0100 -Subject: [PATCH 216/347] x86/highmem: Add a "already used pte" check -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 216/342] x86/highmem: Add a "already used pte" check +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=7f6be1300407789b3a66f5ca8fa2bceef903b897 This is a copy from kmap_atomic_prot(). @@ -24,6 +23,3 @@ index d5a48210d0f6..c0ec8d430c02 100644 #ifdef CONFIG_PREEMPT_RT_FULL current->kmap_pte[type] = pte; #endif --- -2.36.1 - diff --git a/debian/patches-rt/0217-arm-highmem-Flush-tlb-on-unmap.patch b/debian/patches-rt/0217-arm-highmem-Flush-tlb-on-unmap.patch index 12a3a9b1e..47cc179f0 100644 --- a/debian/patches-rt/0217-arm-highmem-Flush-tlb-on-unmap.patch +++ b/debian/patches-rt/0217-arm-highmem-Flush-tlb-on-unmap.patch @@ -1,8 +1,7 @@ -From 83b4c6d1975b6bbcc60751fc7150c6bda6b460a7 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Mon, 11 Mar 2013 21:37:27 +0100 -Subject: [PATCH 217/347] arm/highmem: Flush tlb on unmap -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 217/342] arm/highmem: Flush tlb on unmap +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=176869557b04f77d08189ccf8f2acf9f07da4b26 The tlb should be flushed on unmap and thus make the mapping entry invalid. This is only done in the non-debug case which does not look @@ -29,6 +28,3 @@ index d02f8187b1cc..eb4b225d28c9 100644 kmap_atomic_idx_pop(); } else if (vaddr >= PKMAP_ADDR(0) && vaddr < PKMAP_ADDR(LAST_PKMAP)) { /* this address was obtained through kmap_high_get() */ --- -2.36.1 - diff --git a/debian/patches-rt/0218-arm-Enable-highmem-for-rt.patch b/debian/patches-rt/0218-arm-Enable-highmem-for-rt.patch index 6d37c0670..3b7aa387a 100644 --- a/debian/patches-rt/0218-arm-Enable-highmem-for-rt.patch +++ b/debian/patches-rt/0218-arm-Enable-highmem-for-rt.patch @@ -1,8 +1,7 @@ -From d8647f71379a704607e15bb3a7fd5d84b3f10a6d Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Wed, 13 Feb 2013 11:03:11 +0100 -Subject: [PATCH 218/347] arm: Enable highmem for rt -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 218/342] arm: Enable highmem for rt +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=9a34408767001844806b3b8225682c8afdc6c17a fixup highmem for ARM. @@ -179,6 +178,3 @@ index 1ac89e4718bf..eaa2ef9bc10e 100644 #include --- -2.36.1 - diff --git a/debian/patches-rt/0219-scsi-fcoe-Make-RT-aware.patch b/debian/patches-rt/0219-scsi-fcoe-Make-RT-aware.patch index e64e58af6..068b8f620 100644 --- a/debian/patches-rt/0219-scsi-fcoe-Make-RT-aware.patch +++ b/debian/patches-rt/0219-scsi-fcoe-Make-RT-aware.patch @@ -1,8 +1,7 @@ -From de388c8a89d8d509914406a15bb839cc95b1eb06 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Sat, 12 Nov 2011 14:00:48 +0100 -Subject: [PATCH 219/347] scsi/fcoe: Make RT aware. -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 219/342] scsi/fcoe: Make RT aware. +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=4940a288f7cc4f9cf09fbdb0084921be93d92152 Do not disable preemption while taking sleeping locks. All user look safe for migrate_diable() only. @@ -73,7 +72,7 @@ index 6768b2e8148a..c20f51af6bdf 100644 } diff --git a/drivers/scsi/fcoe/fcoe_ctlr.c b/drivers/scsi/fcoe/fcoe_ctlr.c -index 658c0726581f..bceab74eecf7 100644 +index 1e087a206f48..27624aac530f 100644 --- a/drivers/scsi/fcoe/fcoe_ctlr.c +++ b/drivers/scsi/fcoe/fcoe_ctlr.c @@ -838,7 +838,7 @@ static unsigned long fcoe_ctlr_age_fcfs(struct fcoe_ctlr *fip) @@ -111,6 +110,3 @@ index 9fa0aa235cb4..ed538164320a 100644 /* peek cache of free slot */ if (pool->left != FC_XID_UNKNOWN) { --- -2.36.1 - diff --git a/debian/patches-rt/0220-x86-crypto-Reduce-preempt-disabled-regions.patch b/debian/patches-rt/0220-x86-crypto-Reduce-preempt-disabled-regions.patch index eeb0ae4e6..38357c7ba 100644 --- a/debian/patches-rt/0220-x86-crypto-Reduce-preempt-disabled-regions.patch +++ b/debian/patches-rt/0220-x86-crypto-Reduce-preempt-disabled-regions.patch @@ -1,8 +1,7 @@ -From 795856da132e0e41e6ba20d6020b7016f23159cf Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Mon, 14 Nov 2011 18:19:27 +0100 -Subject: [PATCH 220/347] x86: crypto: Reduce preempt disabled regions -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 220/342] x86: crypto: Reduce preempt disabled regions +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=d4fad8b937dfa74e2ccba8a8e492be8f8249cc9c Restrict the preempt disabled regions to the actual floating point operations and enable preemption for the administrative actions. @@ -113,6 +112,3 @@ index 917f25e4d0a8..58d8c03fc32d 100644 return err; } --- -2.36.1 - diff --git a/debian/patches-rt/0221-crypto-Reduce-preempt-disabled-regions-more-algos.patch b/debian/patches-rt/0221-crypto-Reduce-preempt-disabled-regions-more-algos.patch index ed1ebcb6d..f2dda2f5b 100644 --- a/debian/patches-rt/0221-crypto-Reduce-preempt-disabled-regions-more-algos.patch +++ b/debian/patches-rt/0221-crypto-Reduce-preempt-disabled-regions-more-algos.patch @@ -1,8 +1,7 @@ -From ae835a4684737b3c2efebe8bcbb5e0348eefa1eb Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Fri, 21 Feb 2014 17:24:04 +0100 -Subject: [PATCH 221/347] crypto: Reduce preempt disabled regions, more algos -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 221/342] crypto: Reduce preempt disabled regions, more algos +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=ceb1792fc68a494695be3551b6a796af177f2f30 Don Estabrook reported | kernel: WARNING: CPU: 2 PID: 858 at kernel/sched/core.c:2428 migrate_disable+0xed/0x100() @@ -258,6 +257,3 @@ index a78ef99a9981..dac489a1c4da 100644 return err; } EXPORT_SYMBOL_GPL(glue_xts_req_128bit); --- -2.36.1 - diff --git a/debian/patches-rt/0222-crypto-limit-more-FPU-enabled-sections.patch b/debian/patches-rt/0222-crypto-limit-more-FPU-enabled-sections.patch index e615a446d..57c9a4d1c 100644 --- a/debian/patches-rt/0222-crypto-limit-more-FPU-enabled-sections.patch +++ b/debian/patches-rt/0222-crypto-limit-more-FPU-enabled-sections.patch @@ -1,11 +1,10 @@ -From 8e09b2bca6f9a8364bba581fb391a85b500095bb Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Thu, 30 Nov 2017 13:40:10 +0100 -Subject: [PATCH 222/347] crypto: limit more FPU-enabled sections +Subject: [PATCH 222/342] crypto: limit more FPU-enabled sections MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=d77f41fea4c23bf15b65b4703f0a70c3e8c633c2 Those crypto drivers use SSE/AVX/… for their crypto work and in order to do so in kernel they need to enable the "FPU" in kernel mode which @@ -103,6 +102,3 @@ index 2e5003fef51a..768c53767bb2 100644 /* * Save the FPU state (mark it for reload if necessary): * --- -2.36.1 - diff --git a/debian/patches-rt/0223-crypto-scompress-serialize-RT-percpu-scratch-buffer-.patch b/debian/patches-rt/0223-crypto-scompress-serialize-RT-percpu-scratch-buffer-.patch index e7be12f3f..eb8b1dde8 100644 --- a/debian/patches-rt/0223-crypto-scompress-serialize-RT-percpu-scratch-buffer-.patch +++ b/debian/patches-rt/0223-crypto-scompress-serialize-RT-percpu-scratch-buffer-.patch @@ -1,9 +1,8 @@ -From fe05a8e53c2f5560f734ab76a4527bab302e88c0 Mon Sep 17 00:00:00 2001 From: Mike Galbraith Date: Wed, 11 Jul 2018 17:14:47 +0200 -Subject: [PATCH 223/347] crypto: scompress - serialize RT percpu scratch +Subject: [PATCH 223/342] crypto: scompress - serialize RT percpu scratch buffer access with a local lock -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=3ded7053ca92ed84c6a4aa9392ce406faaca6e12 | BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:974 | in_atomic(): 1, irqs_disabled(): 0, pid: 1401, name: cryptomgr_test @@ -78,6 +77,3 @@ index 968bbcf65c94..c2f0077e0801 100644 return ret; } --- -2.36.1 - diff --git a/debian/patches-rt/0224-crypto-cryptd-add-a-lock-instead-preempt_disable-loc.patch b/debian/patches-rt/0224-crypto-cryptd-add-a-lock-instead-preempt_disable-loc.patch index 85f584f79..883b1e747 100644 --- a/debian/patches-rt/0224-crypto-cryptd-add-a-lock-instead-preempt_disable-loc.patch +++ b/debian/patches-rt/0224-crypto-cryptd-add-a-lock-instead-preempt_disable-loc.patch @@ -1,9 +1,8 @@ -From 7a1d28b6b70837f1554c28799195274823fc1e72 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Thu, 26 Jul 2018 18:52:00 +0200 -Subject: [PATCH 224/347] crypto: cryptd - add a lock instead +Subject: [PATCH 224/342] crypto: cryptd - add a lock instead preempt_disable/local_bh_disable -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=a65b405a299e90f7a3a0de278af917a86e2c1f07 cryptd has a per-CPU lock which protected with local_bh_disable() and preempt_disable(). @@ -80,6 +79,3 @@ index e0c8e907b086..e079f9a70201 100644 if (!req) return; --- -2.36.1 - diff --git a/debian/patches-rt/0225-panic-skip-get_random_bytes-for-RT_FULL-in-init_oops.patch b/debian/patches-rt/0225-panic-skip-get_random_bytes-for-RT_FULL-in-init_oops.patch index 855ce6928..4104ddf50 100644 --- a/debian/patches-rt/0225-panic-skip-get_random_bytes-for-RT_FULL-in-init_oops.patch +++ b/debian/patches-rt/0225-panic-skip-get_random_bytes-for-RT_FULL-in-init_oops.patch @@ -1,9 +1,8 @@ -From bc8c16173e79b830e1fb430fc0169dd04b8bbee8 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Tue, 14 Jul 2015 14:26:34 +0200 -Subject: [PATCH 225/347] panic: skip get_random_bytes for RT_FULL in +Subject: [PATCH 225/342] panic: skip get_random_bytes for RT_FULL in init_oops_id -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=4859e3416b599547296a1970d9b8fef5c72bb671 Disable on -RT. If this is invoked from irq-context we will have problems to acquire the sleeping lock. @@ -29,6 +28,3 @@ index 8138a676fb7d..fa114be5c30f 100644 oops_id++; return 0; --- -2.36.1 - diff --git a/debian/patches-rt/0226-x86-stackprotector-Avoid-random-pool-on-rt.patch b/debian/patches-rt/0226-x86-stackprotector-Avoid-random-pool-on-rt.patch index f9db1d99d..3021c7916 100644 --- a/debian/patches-rt/0226-x86-stackprotector-Avoid-random-pool-on-rt.patch +++ b/debian/patches-rt/0226-x86-stackprotector-Avoid-random-pool-on-rt.patch @@ -1,8 +1,7 @@ -From b70b05c554fb10c5bccff5b27a1d5ed73d054313 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Thu, 16 Dec 2010 14:25:18 +0100 -Subject: [PATCH 226/347] x86: stackprotector: Avoid random pool on rt -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz +Subject: [PATCH 226/342] x86: stackprotector: Avoid random pool on rt +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=899dd6a87172ba4ef8839115bce7f4393a0274bc CPU bringup calls into the random pool to initialize the stack canary. During boot that works nicely even on RT as the might sleep @@ -46,6 +45,3 @@ index 9c556ea2eaa7..b136992beb1b 100644 tsc = rdtsc(); canary += tsc + (tsc << 32UL); canary &= CANARY_MASK; --- -2.36.1 - diff --git a/debian/patches-rt/0227-cpu-hotplug-Implement-CPU-pinning.patch b/debian/patches-rt/0227-cpu-hotplug-Implement-CPU-pinning.patch new file mode 100644 index 000000000..1a1ee7954 --- /dev/null +++ b/debian/patches-rt/0227-cpu-hotplug-Implement-CPU-pinning.patch @@ -0,0 +1,113 @@ +From: Thomas Gleixner +Date: Wed, 19 Jul 2017 17:31:20 +0200 +Subject: [PATCH 227/342] cpu/hotplug: Implement CPU pinning +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=6fa443c6c513b0e160a42bfbc0a4f3023fdf4edb + +Signed-off-by: Thomas Gleixner +--- + include/linux/sched.h | 1 + + kernel/cpu.c | 38 ++++++++++++++++++++++++++++++++++++++ + 2 files changed, 39 insertions(+) + +diff --git a/include/linux/sched.h b/include/linux/sched.h +index 577045ae8693..7523c0786a63 100644 +--- a/include/linux/sched.h ++++ b/include/linux/sched.h +@@ -671,6 +671,7 @@ struct task_struct { + #if defined(CONFIG_SMP) && defined(CONFIG_PREEMPT_RT_BASE) + int migrate_disable; + int migrate_disable_update; ++ int pinned_on_cpu; + # ifdef CONFIG_SCHED_DEBUG + int migrate_disable_atomic; + # endif +diff --git a/kernel/cpu.c b/kernel/cpu.c +index f4c49bbc3fa3..56cb58fce84c 100644 +--- a/kernel/cpu.c ++++ b/kernel/cpu.c +@@ -78,6 +78,11 @@ static DEFINE_PER_CPU(struct cpuhp_cpu_state, cpuhp_state) = { + .fail = CPUHP_INVALID, + }; + ++#ifdef CONFIG_HOTPLUG_CPU ++static DEFINE_PER_CPU(struct rt_rw_lock, cpuhp_pin_lock) = \ ++ __RWLOCK_RT_INITIALIZER(cpuhp_pin_lock); ++#endif ++ + #if defined(CONFIG_LOCKDEP) && defined(CONFIG_SMP) + static struct lockdep_map cpuhp_state_up_map = + STATIC_LOCKDEP_MAP_INIT("cpuhp_state-up", &cpuhp_state_up_map); +@@ -289,7 +294,28 @@ static int cpu_hotplug_disabled; + */ + void pin_current_cpu(void) + { ++ struct rt_rw_lock *cpuhp_pin; ++ unsigned int cpu; ++ int ret; ++ ++again: ++ cpuhp_pin = this_cpu_ptr(&cpuhp_pin_lock); ++ ret = __read_rt_trylock(cpuhp_pin); ++ if (ret) { ++ current->pinned_on_cpu = smp_processor_id(); ++ return; ++ } ++ cpu = smp_processor_id(); ++ preempt_enable(); ++ ++ __read_rt_lock(cpuhp_pin); + ++ preempt_disable(); ++ if (cpu != smp_processor_id()) { ++ __read_rt_unlock(cpuhp_pin); ++ goto again; ++ } ++ current->pinned_on_cpu = cpu; + } + + /** +@@ -297,6 +323,13 @@ void pin_current_cpu(void) + */ + void unpin_current_cpu(void) + { ++ struct rt_rw_lock *cpuhp_pin = this_cpu_ptr(&cpuhp_pin_lock); ++ ++ if (WARN_ON(current->pinned_on_cpu != smp_processor_id())) ++ cpuhp_pin = per_cpu_ptr(&cpuhp_pin_lock, current->pinned_on_cpu); ++ ++ current->pinned_on_cpu = -1; ++ __read_rt_unlock(cpuhp_pin); + } + + DEFINE_STATIC_PERCPU_RWSEM(cpu_hotplug_lock); +@@ -921,6 +954,7 @@ static int take_cpu_down(void *_param) + + static int takedown_cpu(unsigned int cpu) + { ++ struct rt_rw_lock *cpuhp_pin = per_cpu_ptr(&cpuhp_pin_lock, cpu); + struct cpuhp_cpu_state *st = per_cpu_ptr(&cpuhp_state, cpu); + int err; + +@@ -933,11 +967,14 @@ static int takedown_cpu(unsigned int cpu) + */ + irq_lock_sparse(); + ++ __write_rt_lock(cpuhp_pin); ++ + /* + * So now all preempt/rcu users must observe !cpu_active(). + */ + err = stop_machine_cpuslocked(take_cpu_down, NULL, cpumask_of(cpu)); + if (err) { ++ __write_rt_unlock(cpuhp_pin); + /* CPU refused to die */ + irq_unlock_sparse(); + /* Unpark the hotplug thread so we can rollback there */ +@@ -956,6 +993,7 @@ static int takedown_cpu(unsigned int cpu) + wait_for_ap_thread(st, false); + BUG_ON(st->state != CPUHP_AP_IDLE_DEAD); + ++ __write_rt_unlock(cpuhp_pin); + /* Interrupts are moved away from the dying cpu, reenable alloc/free */ + irq_unlock_sparse(); + diff --git a/debian/patches-rt/0228-cpu-hotplug-Implement-CPU-pinning.patch b/debian/patches-rt/0228-cpu-hotplug-Implement-CPU-pinning.patch deleted file mode 100644 index 9a3b2430f..000000000 --- a/debian/patches-rt/0228-cpu-hotplug-Implement-CPU-pinning.patch +++ /dev/null @@ -1,117 +0,0 @@ -From 784e4a9806842dc64aa0902210fe4e11984d868a Mon Sep 17 00:00:00 2001 -From: Thomas Gleixner -Date: Wed, 19 Jul 2017 17:31:20 +0200 -Subject: [PATCH 228/347] cpu/hotplug: Implement CPU pinning -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -Signed-off-by: Thomas Gleixner ---- - include/linux/sched.h | 1 + - kernel/cpu.c | 38 ++++++++++++++++++++++++++++++++++++++ - 2 files changed, 39 insertions(+) - -diff --git a/include/linux/sched.h b/include/linux/sched.h -index 577045ae8693..7523c0786a63 100644 ---- a/include/linux/sched.h -+++ b/include/linux/sched.h -@@ -671,6 +671,7 @@ struct task_struct { - #if defined(CONFIG_SMP) && defined(CONFIG_PREEMPT_RT_BASE) - int migrate_disable; - int migrate_disable_update; -+ int pinned_on_cpu; - # ifdef CONFIG_SCHED_DEBUG - int migrate_disable_atomic; - # endif -diff --git a/kernel/cpu.c b/kernel/cpu.c -index 89a96cc14b39..797216a0b4c6 100644 ---- a/kernel/cpu.c -+++ b/kernel/cpu.c -@@ -77,6 +77,11 @@ static DEFINE_PER_CPU(struct cpuhp_cpu_state, cpuhp_state) = { - .fail = CPUHP_INVALID, - }; - -+#ifdef CONFIG_HOTPLUG_CPU -+static DEFINE_PER_CPU(struct rt_rw_lock, cpuhp_pin_lock) = \ -+ __RWLOCK_RT_INITIALIZER(cpuhp_pin_lock); -+#endif -+ - #if defined(CONFIG_LOCKDEP) && defined(CONFIG_SMP) - static struct lockdep_map cpuhp_state_up_map = - STATIC_LOCKDEP_MAP_INIT("cpuhp_state-up", &cpuhp_state_up_map); -@@ -288,7 +293,28 @@ static int cpu_hotplug_disabled; - */ - void pin_current_cpu(void) - { -+ struct rt_rw_lock *cpuhp_pin; -+ unsigned int cpu; -+ int ret; -+ -+again: -+ cpuhp_pin = this_cpu_ptr(&cpuhp_pin_lock); -+ ret = __read_rt_trylock(cpuhp_pin); -+ if (ret) { -+ current->pinned_on_cpu = smp_processor_id(); -+ return; -+ } -+ cpu = smp_processor_id(); -+ preempt_enable(); -+ -+ __read_rt_lock(cpuhp_pin); - -+ preempt_disable(); -+ if (cpu != smp_processor_id()) { -+ __read_rt_unlock(cpuhp_pin); -+ goto again; -+ } -+ current->pinned_on_cpu = cpu; - } - - /** -@@ -296,6 +322,13 @@ void pin_current_cpu(void) - */ - void unpin_current_cpu(void) - { -+ struct rt_rw_lock *cpuhp_pin = this_cpu_ptr(&cpuhp_pin_lock); -+ -+ if (WARN_ON(current->pinned_on_cpu != smp_processor_id())) -+ cpuhp_pin = per_cpu_ptr(&cpuhp_pin_lock, current->pinned_on_cpu); -+ -+ current->pinned_on_cpu = -1; -+ __read_rt_unlock(cpuhp_pin); - } - - DEFINE_STATIC_PERCPU_RWSEM(cpu_hotplug_lock); -@@ -920,6 +953,7 @@ static int take_cpu_down(void *_param) - - static int takedown_cpu(unsigned int cpu) - { -+ struct rt_rw_lock *cpuhp_pin = per_cpu_ptr(&cpuhp_pin_lock, cpu); - struct cpuhp_cpu_state *st = per_cpu_ptr(&cpuhp_state, cpu); - int err; - -@@ -932,11 +966,14 @@ static int takedown_cpu(unsigned int cpu) - */ - irq_lock_sparse(); - -+ __write_rt_lock(cpuhp_pin); -+ - /* - * So now all preempt/rcu users must observe !cpu_active(). - */ - err = stop_machine_cpuslocked(take_cpu_down, NULL, cpumask_of(cpu)); - if (err) { -+ __write_rt_unlock(cpuhp_pin); - /* CPU refused to die */ - irq_unlock_sparse(); - /* Unpark the hotplug thread so we can rollback there */ -@@ -955,6 +992,7 @@ static int takedown_cpu(unsigned int cpu) - wait_for_ap_thread(st, false); - BUG_ON(st->state != CPUHP_AP_IDLE_DEAD); - -+ __write_rt_unlock(cpuhp_pin); - /* Interrupts are moved away from the dying cpu, reenable alloc/free */ - irq_unlock_sparse(); - --- -2.36.1 - diff --git a/debian/patches-rt/0228-sched-Allow-pinned-user-tasks-to-be-awakened-to-the-.patch b/debian/patches-rt/0228-sched-Allow-pinned-user-tasks-to-be-awakened-to-the-.patch new file mode 100644 index 000000000..817e0736d --- /dev/null +++ b/debian/patches-rt/0228-sched-Allow-pinned-user-tasks-to-be-awakened-to-the-.patch @@ -0,0 +1,35 @@ +From: Mike Galbraith +Date: Sun, 19 Aug 2018 08:28:35 +0200 +Subject: [PATCH 228/342] sched: Allow pinned user tasks to be awakened to the + CPU they pinned +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=1a7a03ac5f6eb866ddd317630b747d6e8f81013b + +Since commit 7af443ee16976 ("sched/core: Require cpu_active() in +select_task_rq(), for user tasks") select_fallback_rq() will BUG() if +the CPU to which a task has pinned itself and pinned becomes +!cpu_active() while it slept. +The task will continue running on the to-be-removed CPU and will remove +itself from the CPU during takedown_cpu() (while cpuhp_pin_lock will be +acquired) and move to another CPU based on its mask after the +migrate_disable() section has been left. + +Cc: stable-rt@vger.kernel.org +Signed-off-by: Mike Galbraith +Signed-off-by: Sebastian Andrzej Siewior +--- + kernel/sched/core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/kernel/sched/core.c b/kernel/sched/core.c +index 11afaa2c618a..dba425296275 100644 +--- a/kernel/sched/core.c ++++ b/kernel/sched/core.c +@@ -904,7 +904,7 @@ static inline bool is_cpu_allowed(struct task_struct *p, int cpu) + if (!cpumask_test_cpu(cpu, p->cpus_ptr)) + return false; + +- if (is_per_cpu_kthread(p)) ++ if (is_per_cpu_kthread(p) || __migrate_disabled(p)) + return cpu_online(cpu); + + return cpu_active(cpu); diff --git a/debian/patches-rt/0229-hotplug-duct-tape-RT-rwlock-usage-for-non-RT.patch b/debian/patches-rt/0229-hotplug-duct-tape-RT-rwlock-usage-for-non-RT.patch new file mode 100644 index 000000000..357c70d07 --- /dev/null +++ b/debian/patches-rt/0229-hotplug-duct-tape-RT-rwlock-usage-for-non-RT.patch @@ -0,0 +1,98 @@ +From: Sebastian Andrzej Siewior +Date: Fri, 4 Aug 2017 18:31:00 +0200 +Subject: [PATCH 229/342] hotplug: duct-tape RT-rwlock usage for non-RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=c925857dee98daf7eea5dd1e206a94a9d9cd72cf + +This type is only available on -RT. We need to craft something for +non-RT. Since the only migrate_disable() user is -RT only, there is no +damage. + +Signed-off-by: Sebastian Andrzej Siewior +--- + kernel/cpu.c | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +diff --git a/kernel/cpu.c b/kernel/cpu.c +index 56cb58fce84c..6ae5b18bf3a5 100644 +--- a/kernel/cpu.c ++++ b/kernel/cpu.c +@@ -78,7 +78,7 @@ static DEFINE_PER_CPU(struct cpuhp_cpu_state, cpuhp_state) = { + .fail = CPUHP_INVALID, + }; + +-#ifdef CONFIG_HOTPLUG_CPU ++#if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PREEMPT_RT_FULL) + static DEFINE_PER_CPU(struct rt_rw_lock, cpuhp_pin_lock) = \ + __RWLOCK_RT_INITIALIZER(cpuhp_pin_lock); + #endif +@@ -294,6 +294,7 @@ static int cpu_hotplug_disabled; + */ + void pin_current_cpu(void) + { ++#ifdef CONFIG_PREEMPT_RT_FULL + struct rt_rw_lock *cpuhp_pin; + unsigned int cpu; + int ret; +@@ -316,6 +317,7 @@ void pin_current_cpu(void) + goto again; + } + current->pinned_on_cpu = cpu; ++#endif + } + + /** +@@ -323,6 +325,7 @@ void pin_current_cpu(void) + */ + void unpin_current_cpu(void) + { ++#ifdef CONFIG_PREEMPT_RT_FULL + struct rt_rw_lock *cpuhp_pin = this_cpu_ptr(&cpuhp_pin_lock); + + if (WARN_ON(current->pinned_on_cpu != smp_processor_id())) +@@ -330,6 +333,7 @@ void unpin_current_cpu(void) + + current->pinned_on_cpu = -1; + __read_rt_unlock(cpuhp_pin); ++#endif + } + + DEFINE_STATIC_PERCPU_RWSEM(cpu_hotplug_lock); +@@ -954,7 +958,9 @@ static int take_cpu_down(void *_param) + + static int takedown_cpu(unsigned int cpu) + { ++#ifdef CONFIG_PREEMPT_RT_FULL + struct rt_rw_lock *cpuhp_pin = per_cpu_ptr(&cpuhp_pin_lock, cpu); ++#endif + struct cpuhp_cpu_state *st = per_cpu_ptr(&cpuhp_state, cpu); + int err; + +@@ -967,14 +973,18 @@ static int takedown_cpu(unsigned int cpu) + */ + irq_lock_sparse(); + ++#ifdef CONFIG_PREEMPT_RT_FULL + __write_rt_lock(cpuhp_pin); ++#endif + + /* + * So now all preempt/rcu users must observe !cpu_active(). + */ + err = stop_machine_cpuslocked(take_cpu_down, NULL, cpumask_of(cpu)); + if (err) { ++#ifdef CONFIG_PREEMPT_RT_FULL + __write_rt_unlock(cpuhp_pin); ++#endif + /* CPU refused to die */ + irq_unlock_sparse(); + /* Unpark the hotplug thread so we can rollback there */ +@@ -993,7 +1003,9 @@ static int takedown_cpu(unsigned int cpu) + wait_for_ap_thread(st, false); + BUG_ON(st->state != CPUHP_AP_IDLE_DEAD); + ++#ifdef CONFIG_PREEMPT_RT_FULL + __write_rt_unlock(cpuhp_pin); ++#endif + /* Interrupts are moved away from the dying cpu, reenable alloc/free */ + irq_unlock_sparse(); + diff --git a/debian/patches-rt/0229-sched-Allow-pinned-user-tasks-to-be-awakened-to-the-.patch b/debian/patches-rt/0229-sched-Allow-pinned-user-tasks-to-be-awakened-to-the-.patch deleted file mode 100644 index 2c10d0def..000000000 --- a/debian/patches-rt/0229-sched-Allow-pinned-user-tasks-to-be-awakened-to-the-.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 1e7afdc27ed9146e30dc69cdc8fcdc2ce334430e Mon Sep 17 00:00:00 2001 -From: Mike Galbraith -Date: Sun, 19 Aug 2018 08:28:35 +0200 -Subject: [PATCH 229/347] sched: Allow pinned user tasks to be awakened to the - CPU they pinned -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -Since commit 7af443ee16976 ("sched/core: Require cpu_active() in -select_task_rq(), for user tasks") select_fallback_rq() will BUG() if -the CPU to which a task has pinned itself and pinned becomes -!cpu_active() while it slept. -The task will continue running on the to-be-removed CPU and will remove -itself from the CPU during takedown_cpu() (while cpuhp_pin_lock will be -acquired) and move to another CPU based on its mask after the -migrate_disable() section has been left. - -Cc: stable-rt@vger.kernel.org -Signed-off-by: Mike Galbraith -Signed-off-by: Sebastian Andrzej Siewior ---- - kernel/sched/core.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/kernel/sched/core.c b/kernel/sched/core.c -index 11afaa2c618a..dba425296275 100644 ---- a/kernel/sched/core.c -+++ b/kernel/sched/core.c -@@ -904,7 +904,7 @@ static inline bool is_cpu_allowed(struct task_struct *p, int cpu) - if (!cpumask_test_cpu(cpu, p->cpus_ptr)) - return false; - -- if (is_per_cpu_kthread(p)) -+ if (is_per_cpu_kthread(p) || __migrate_disabled(p)) - return cpu_online(cpu); - - return cpu_active(cpu); --- -2.36.1 - diff --git a/debian/patches-rt/0230-hotplug-duct-tape-RT-rwlock-usage-for-non-RT.patch b/debian/patches-rt/0230-hotplug-duct-tape-RT-rwlock-usage-for-non-RT.patch deleted file mode 100644 index f60b81343..000000000 --- a/debian/patches-rt/0230-hotplug-duct-tape-RT-rwlock-usage-for-non-RT.patch +++ /dev/null @@ -1,102 +0,0 @@ -From 3ed5cb0e7f86a61b58b20f64a79148a2a80dac29 Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Fri, 4 Aug 2017 18:31:00 +0200 -Subject: [PATCH 230/347] hotplug: duct-tape RT-rwlock usage for non-RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -This type is only available on -RT. We need to craft something for -non-RT. Since the only migrate_disable() user is -RT only, there is no -damage. - -Signed-off-by: Sebastian Andrzej Siewior ---- - kernel/cpu.c | 14 +++++++++++++- - 1 file changed, 13 insertions(+), 1 deletion(-) - -diff --git a/kernel/cpu.c b/kernel/cpu.c -index 797216a0b4c6..f6511c62c9a4 100644 ---- a/kernel/cpu.c -+++ b/kernel/cpu.c -@@ -77,7 +77,7 @@ static DEFINE_PER_CPU(struct cpuhp_cpu_state, cpuhp_state) = { - .fail = CPUHP_INVALID, - }; - --#ifdef CONFIG_HOTPLUG_CPU -+#if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PREEMPT_RT_FULL) - static DEFINE_PER_CPU(struct rt_rw_lock, cpuhp_pin_lock) = \ - __RWLOCK_RT_INITIALIZER(cpuhp_pin_lock); - #endif -@@ -293,6 +293,7 @@ static int cpu_hotplug_disabled; - */ - void pin_current_cpu(void) - { -+#ifdef CONFIG_PREEMPT_RT_FULL - struct rt_rw_lock *cpuhp_pin; - unsigned int cpu; - int ret; -@@ -315,6 +316,7 @@ void pin_current_cpu(void) - goto again; - } - current->pinned_on_cpu = cpu; -+#endif - } - - /** -@@ -322,6 +324,7 @@ void pin_current_cpu(void) - */ - void unpin_current_cpu(void) - { -+#ifdef CONFIG_PREEMPT_RT_FULL - struct rt_rw_lock *cpuhp_pin = this_cpu_ptr(&cpuhp_pin_lock); - - if (WARN_ON(current->pinned_on_cpu != smp_processor_id())) -@@ -329,6 +332,7 @@ void unpin_current_cpu(void) - - current->pinned_on_cpu = -1; - __read_rt_unlock(cpuhp_pin); -+#endif - } - - DEFINE_STATIC_PERCPU_RWSEM(cpu_hotplug_lock); -@@ -953,7 +957,9 @@ static int take_cpu_down(void *_param) - - static int takedown_cpu(unsigned int cpu) - { -+#ifdef CONFIG_PREEMPT_RT_FULL - struct rt_rw_lock *cpuhp_pin = per_cpu_ptr(&cpuhp_pin_lock, cpu); -+#endif - struct cpuhp_cpu_state *st = per_cpu_ptr(&cpuhp_state, cpu); - int err; - -@@ -966,14 +972,18 @@ static int takedown_cpu(unsigned int cpu) - */ - irq_lock_sparse(); - -+#ifdef CONFIG_PREEMPT_RT_FULL - __write_rt_lock(cpuhp_pin); -+#endif - - /* - * So now all preempt/rcu users must observe !cpu_active(). - */ - err = stop_machine_cpuslocked(take_cpu_down, NULL, cpumask_of(cpu)); - if (err) { -+#ifdef CONFIG_PREEMPT_RT_FULL - __write_rt_unlock(cpuhp_pin); -+#endif - /* CPU refused to die */ - irq_unlock_sparse(); - /* Unpark the hotplug thread so we can rollback there */ -@@ -992,7 +1002,9 @@ static int takedown_cpu(unsigned int cpu) - wait_for_ap_thread(st, false); - BUG_ON(st->state != CPUHP_AP_IDLE_DEAD); - -+#ifdef CONFIG_PREEMPT_RT_FULL - __write_rt_unlock(cpuhp_pin); -+#endif - /* Interrupts are moved away from the dying cpu, reenable alloc/free */ - irq_unlock_sparse(); - --- -2.36.1 - diff --git a/debian/patches-rt/0230-net-Remove-preemption-disabling-in-netif_rx.patch b/debian/patches-rt/0230-net-Remove-preemption-disabling-in-netif_rx.patch new file mode 100644 index 000000000..190c702a6 --- /dev/null +++ b/debian/patches-rt/0230-net-Remove-preemption-disabling-in-netif_rx.patch @@ -0,0 +1,67 @@ +From: Priyanka Jain +Date: Thu, 17 May 2012 09:35:11 +0530 +Subject: [PATCH 230/342] net: Remove preemption disabling in netif_rx() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=857d0eea97c02863c4283d4ece826762ed4ae3f3 + +1)enqueue_to_backlog() (called from netif_rx) should be + bind to a particluar CPU. This can be achieved by + disabling migration. No need to disable preemption + +2)Fixes crash "BUG: scheduling while atomic: ksoftirqd" + in case of RT. + If preemption is disabled, enqueue_to_backog() is called + in atomic context. And if backlog exceeds its count, + kfree_skb() is called. But in RT, kfree_skb() might + gets scheduled out, so it expects non atomic context. + +3)When CONFIG_PREEMPT_RT_FULL is not defined, + migrate_enable(), migrate_disable() maps to + preempt_enable() and preempt_disable(), so no + change in functionality in case of non-RT. + +-Replace preempt_enable(), preempt_disable() with + migrate_enable(), migrate_disable() respectively +-Replace get_cpu(), put_cpu() with get_cpu_light(), + put_cpu_light() respectively + +Signed-off-by: Priyanka Jain +Acked-by: Rajan Srivastava +Cc: +Link: http://lkml.kernel.org/r/1337227511-2271-1-git-send-email-Priyanka.Jain@freescale.com + +Signed-off-by: Thomas Gleixner +--- + net/core/dev.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/net/core/dev.c b/net/core/dev.c +index e65dc7a7cc13..3df1fe052863 100644 +--- a/net/core/dev.c ++++ b/net/core/dev.c +@@ -4494,7 +4494,7 @@ static int netif_rx_internal(struct sk_buff *skb) + struct rps_dev_flow voidflow, *rflow = &voidflow; + int cpu; + +- preempt_disable(); ++ migrate_disable(); + rcu_read_lock(); + + cpu = get_rps_cpu(skb->dev, skb, &rflow); +@@ -4504,14 +4504,14 @@ static int netif_rx_internal(struct sk_buff *skb) + ret = enqueue_to_backlog(skb, cpu, &rflow->last_qtail); + + rcu_read_unlock(); +- preempt_enable(); ++ migrate_enable(); + } else + #endif + { + unsigned int qtail; + +- ret = enqueue_to_backlog(skb, get_cpu(), &qtail); +- put_cpu(); ++ ret = enqueue_to_backlog(skb, get_cpu_light(), &qtail); ++ put_cpu_light(); + } + return ret; + } diff --git a/debian/patches-rt/0231-net-Another-local_irq_disable-kmalloc-headache.patch b/debian/patches-rt/0231-net-Another-local_irq_disable-kmalloc-headache.patch new file mode 100644 index 000000000..14d695001 --- /dev/null +++ b/debian/patches-rt/0231-net-Another-local_irq_disable-kmalloc-headache.patch @@ -0,0 +1,61 @@ +From: Thomas Gleixner +Date: Wed, 26 Sep 2012 16:21:08 +0200 +Subject: [PATCH 231/342] net: Another local_irq_disable/kmalloc headache +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=10e37587e11821472945b3a1cfe2306a3ca12b8f + +Replace it by a local lock. Though that's pretty inefficient :( + +Signed-off-by: Thomas Gleixner +--- + net/core/skbuff.c | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/net/core/skbuff.c b/net/core/skbuff.c +index c623c129d0ab..0696d3cb809d 100644 +--- a/net/core/skbuff.c ++++ b/net/core/skbuff.c +@@ -63,6 +63,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -330,6 +331,7 @@ struct napi_alloc_cache { + + static DEFINE_PER_CPU(struct page_frag_cache, netdev_alloc_cache); + static DEFINE_PER_CPU(struct napi_alloc_cache, napi_alloc_cache); ++static DEFINE_LOCAL_IRQ_LOCK(netdev_alloc_lock); + + static void *__netdev_alloc_frag(unsigned int fragsz, gfp_t gfp_mask) + { +@@ -337,10 +339,10 @@ static void *__netdev_alloc_frag(unsigned int fragsz, gfp_t gfp_mask) + unsigned long flags; + void *data; + +- local_irq_save(flags); ++ local_lock_irqsave(netdev_alloc_lock, flags); + nc = this_cpu_ptr(&netdev_alloc_cache); + data = page_frag_alloc(nc, fragsz, gfp_mask); +- local_irq_restore(flags); ++ local_unlock_irqrestore(netdev_alloc_lock, flags); + return data; + } + +@@ -416,13 +418,13 @@ struct sk_buff *__netdev_alloc_skb(struct net_device *dev, unsigned int len, + if (sk_memalloc_socks()) + gfp_mask |= __GFP_MEMALLOC; + +- local_irq_save(flags); ++ local_lock_irqsave(netdev_alloc_lock, flags); + + nc = this_cpu_ptr(&netdev_alloc_cache); + data = page_frag_alloc(nc, len, gfp_mask); + pfmemalloc = nc->pfmemalloc; + +- local_irq_restore(flags); ++ local_unlock_irqrestore(netdev_alloc_lock, flags); + + if (unlikely(!data)) + return NULL; diff --git a/debian/patches-rt/0231-net-Remove-preemption-disabling-in-netif_rx.patch b/debian/patches-rt/0231-net-Remove-preemption-disabling-in-netif_rx.patch deleted file mode 100644 index 5575db994..000000000 --- a/debian/patches-rt/0231-net-Remove-preemption-disabling-in-netif_rx.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 455243ba6a0787a8a8ed109e5af4e0cb42d90fbf Mon Sep 17 00:00:00 2001 -From: Priyanka Jain -Date: Thu, 17 May 2012 09:35:11 +0530 -Subject: [PATCH 231/347] net: Remove preemption disabling in netif_rx() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -1)enqueue_to_backlog() (called from netif_rx) should be - bind to a particluar CPU. This can be achieved by - disabling migration. No need to disable preemption - -2)Fixes crash "BUG: scheduling while atomic: ksoftirqd" - in case of RT. - If preemption is disabled, enqueue_to_backog() is called - in atomic context. And if backlog exceeds its count, - kfree_skb() is called. But in RT, kfree_skb() might - gets scheduled out, so it expects non atomic context. - -3)When CONFIG_PREEMPT_RT_FULL is not defined, - migrate_enable(), migrate_disable() maps to - preempt_enable() and preempt_disable(), so no - change in functionality in case of non-RT. - --Replace preempt_enable(), preempt_disable() with - migrate_enable(), migrate_disable() respectively --Replace get_cpu(), put_cpu() with get_cpu_light(), - put_cpu_light() respectively - -Signed-off-by: Priyanka Jain -Acked-by: Rajan Srivastava -Cc: -Link: http://lkml.kernel.org/r/1337227511-2271-1-git-send-email-Priyanka.Jain@freescale.com - -Signed-off-by: Thomas Gleixner ---- - net/core/dev.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/net/core/dev.c b/net/core/dev.c -index e65dc7a7cc13..3df1fe052863 100644 ---- a/net/core/dev.c -+++ b/net/core/dev.c -@@ -4494,7 +4494,7 @@ static int netif_rx_internal(struct sk_buff *skb) - struct rps_dev_flow voidflow, *rflow = &voidflow; - int cpu; - -- preempt_disable(); -+ migrate_disable(); - rcu_read_lock(); - - cpu = get_rps_cpu(skb->dev, skb, &rflow); -@@ -4504,14 +4504,14 @@ static int netif_rx_internal(struct sk_buff *skb) - ret = enqueue_to_backlog(skb, cpu, &rflow->last_qtail); - - rcu_read_unlock(); -- preempt_enable(); -+ migrate_enable(); - } else - #endif - { - unsigned int qtail; - -- ret = enqueue_to_backlog(skb, get_cpu(), &qtail); -- put_cpu(); -+ ret = enqueue_to_backlog(skb, get_cpu_light(), &qtail); -+ put_cpu_light(); - } - return ret; - } --- -2.36.1 - diff --git a/debian/patches-rt/0232-net-Another-local_irq_disable-kmalloc-headache.patch b/debian/patches-rt/0232-net-Another-local_irq_disable-kmalloc-headache.patch deleted file mode 100644 index 374593ebd..000000000 --- a/debian/patches-rt/0232-net-Another-local_irq_disable-kmalloc-headache.patch +++ /dev/null @@ -1,65 +0,0 @@ -From b83d94e087c52b96575acd87c8ecaff00a418d02 Mon Sep 17 00:00:00 2001 -From: Thomas Gleixner -Date: Wed, 26 Sep 2012 16:21:08 +0200 -Subject: [PATCH 232/347] net: Another local_irq_disable/kmalloc headache -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -Replace it by a local lock. Though that's pretty inefficient :( - -Signed-off-by: Thomas Gleixner ---- - net/core/skbuff.c | 10 ++++++---- - 1 file changed, 6 insertions(+), 4 deletions(-) - -diff --git a/net/core/skbuff.c b/net/core/skbuff.c -index c623c129d0ab..0696d3cb809d 100644 ---- a/net/core/skbuff.c -+++ b/net/core/skbuff.c -@@ -63,6 +63,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -330,6 +331,7 @@ struct napi_alloc_cache { - - static DEFINE_PER_CPU(struct page_frag_cache, netdev_alloc_cache); - static DEFINE_PER_CPU(struct napi_alloc_cache, napi_alloc_cache); -+static DEFINE_LOCAL_IRQ_LOCK(netdev_alloc_lock); - - static void *__netdev_alloc_frag(unsigned int fragsz, gfp_t gfp_mask) - { -@@ -337,10 +339,10 @@ static void *__netdev_alloc_frag(unsigned int fragsz, gfp_t gfp_mask) - unsigned long flags; - void *data; - -- local_irq_save(flags); -+ local_lock_irqsave(netdev_alloc_lock, flags); - nc = this_cpu_ptr(&netdev_alloc_cache); - data = page_frag_alloc(nc, fragsz, gfp_mask); -- local_irq_restore(flags); -+ local_unlock_irqrestore(netdev_alloc_lock, flags); - return data; - } - -@@ -416,13 +418,13 @@ struct sk_buff *__netdev_alloc_skb(struct net_device *dev, unsigned int len, - if (sk_memalloc_socks()) - gfp_mask |= __GFP_MEMALLOC; - -- local_irq_save(flags); -+ local_lock_irqsave(netdev_alloc_lock, flags); - - nc = this_cpu_ptr(&netdev_alloc_cache); - data = page_frag_alloc(nc, len, gfp_mask); - pfmemalloc = nc->pfmemalloc; - -- local_irq_restore(flags); -+ local_unlock_irqrestore(netdev_alloc_lock, flags); - - if (unlikely(!data)) - return NULL; --- -2.36.1 - diff --git a/debian/patches-rt/0232-net-core-protect-users-of-napi_alloc_cache-against-r.patch b/debian/patches-rt/0232-net-core-protect-users-of-napi_alloc_cache-against-r.patch new file mode 100644 index 000000000..137625f8c --- /dev/null +++ b/debian/patches-rt/0232-net-core-protect-users-of-napi_alloc_cache-against-r.patch @@ -0,0 +1,111 @@ +From: Sebastian Andrzej Siewior +Date: Fri, 15 Jan 2016 16:33:34 +0100 +Subject: [PATCH 232/342] net/core: protect users of napi_alloc_cache against + reentrance +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=2a676f69c03cd2c988d61efa9af4089f653fd83f + +On -RT the code running in BH can not be moved to another CPU so CPU +local variable remain local. However the code can be preempted +and another task may enter BH accessing the same CPU using the same +napi_alloc_cache variable. +This patch ensures that each user of napi_alloc_cache uses a local lock. + +Cc: stable-rt@vger.kernel.org +Signed-off-by: Sebastian Andrzej Siewior +--- + net/core/skbuff.c | 23 ++++++++++++++++++----- + 1 file changed, 18 insertions(+), 5 deletions(-) + +diff --git a/net/core/skbuff.c b/net/core/skbuff.c +index 0696d3cb809d..58f78205585c 100644 +--- a/net/core/skbuff.c ++++ b/net/core/skbuff.c +@@ -332,6 +332,7 @@ struct napi_alloc_cache { + static DEFINE_PER_CPU(struct page_frag_cache, netdev_alloc_cache); + static DEFINE_PER_CPU(struct napi_alloc_cache, napi_alloc_cache); + static DEFINE_LOCAL_IRQ_LOCK(netdev_alloc_lock); ++static DEFINE_LOCAL_IRQ_LOCK(napi_alloc_cache_lock); + + static void *__netdev_alloc_frag(unsigned int fragsz, gfp_t gfp_mask) + { +@@ -363,9 +364,13 @@ EXPORT_SYMBOL(netdev_alloc_frag); + + static void *__napi_alloc_frag(unsigned int fragsz, gfp_t gfp_mask) + { +- struct napi_alloc_cache *nc = this_cpu_ptr(&napi_alloc_cache); ++ struct napi_alloc_cache *nc; ++ void *data; + +- return page_frag_alloc(&nc->page, fragsz, gfp_mask); ++ nc = &get_locked_var(napi_alloc_cache_lock, napi_alloc_cache); ++ data = page_frag_alloc(&nc->page, fragsz, gfp_mask); ++ put_locked_var(napi_alloc_cache_lock, napi_alloc_cache); ++ return data; + } + + void *napi_alloc_frag(unsigned int fragsz) +@@ -468,6 +473,7 @@ struct sk_buff *__napi_alloc_skb(struct napi_struct *napi, unsigned int len, + struct napi_alloc_cache *nc; + struct sk_buff *skb; + void *data; ++ bool pfmemalloc; + + len += NET_SKB_PAD + NET_IP_ALIGN; + +@@ -490,7 +496,10 @@ struct sk_buff *__napi_alloc_skb(struct napi_struct *napi, unsigned int len, + if (sk_memalloc_socks()) + gfp_mask |= __GFP_MEMALLOC; + ++ nc = &get_locked_var(napi_alloc_cache_lock, napi_alloc_cache); + data = page_frag_alloc(&nc->page, len, gfp_mask); ++ pfmemalloc = nc->page.pfmemalloc; ++ put_locked_var(napi_alloc_cache_lock, napi_alloc_cache); + if (unlikely(!data)) + return NULL; + +@@ -501,7 +510,7 @@ struct sk_buff *__napi_alloc_skb(struct napi_struct *napi, unsigned int len, + } + + /* use OR instead of assignment to avoid clearing of bits in mask */ +- if (nc->page.pfmemalloc) ++ if (pfmemalloc) + skb->pfmemalloc = 1; + skb->head_frag = 1; + +@@ -733,23 +742,26 @@ void __consume_stateless_skb(struct sk_buff *skb) + + void __kfree_skb_flush(void) + { +- struct napi_alloc_cache *nc = this_cpu_ptr(&napi_alloc_cache); ++ struct napi_alloc_cache *nc; + ++ nc = &get_locked_var(napi_alloc_cache_lock, napi_alloc_cache); + /* flush skb_cache if containing objects */ + if (nc->skb_count) { + kmem_cache_free_bulk(skbuff_head_cache, nc->skb_count, + nc->skb_cache); + nc->skb_count = 0; + } ++ put_locked_var(napi_alloc_cache_lock, napi_alloc_cache); + } + + static inline void _kfree_skb_defer(struct sk_buff *skb) + { +- struct napi_alloc_cache *nc = this_cpu_ptr(&napi_alloc_cache); ++ struct napi_alloc_cache *nc; + + /* drop skb->head and call any destructors for packet */ + skb_release_all(skb); + ++ nc = &get_locked_var(napi_alloc_cache_lock, napi_alloc_cache); + /* record skb to CPU local list */ + nc->skb_cache[nc->skb_count++] = skb; + +@@ -764,6 +776,7 @@ static inline void _kfree_skb_defer(struct sk_buff *skb) + nc->skb_cache); + nc->skb_count = 0; + } ++ put_locked_var(napi_alloc_cache_lock, napi_alloc_cache); + } + void __kfree_skb_defer(struct sk_buff *skb) + { diff --git a/debian/patches-rt/0233-net-core-protect-users-of-napi_alloc_cache-against-r.patch b/debian/patches-rt/0233-net-core-protect-users-of-napi_alloc_cache-against-r.patch deleted file mode 100644 index 58878036d..000000000 --- a/debian/patches-rt/0233-net-core-protect-users-of-napi_alloc_cache-against-r.patch +++ /dev/null @@ -1,115 +0,0 @@ -From e8e3e8f9d02d605ac0820c51015b248d4c4a0873 Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Fri, 15 Jan 2016 16:33:34 +0100 -Subject: [PATCH 233/347] net/core: protect users of napi_alloc_cache against - reentrance -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -On -RT the code running in BH can not be moved to another CPU so CPU -local variable remain local. However the code can be preempted -and another task may enter BH accessing the same CPU using the same -napi_alloc_cache variable. -This patch ensures that each user of napi_alloc_cache uses a local lock. - -Cc: stable-rt@vger.kernel.org -Signed-off-by: Sebastian Andrzej Siewior ---- - net/core/skbuff.c | 23 ++++++++++++++++++----- - 1 file changed, 18 insertions(+), 5 deletions(-) - -diff --git a/net/core/skbuff.c b/net/core/skbuff.c -index 0696d3cb809d..58f78205585c 100644 ---- a/net/core/skbuff.c -+++ b/net/core/skbuff.c -@@ -332,6 +332,7 @@ struct napi_alloc_cache { - static DEFINE_PER_CPU(struct page_frag_cache, netdev_alloc_cache); - static DEFINE_PER_CPU(struct napi_alloc_cache, napi_alloc_cache); - static DEFINE_LOCAL_IRQ_LOCK(netdev_alloc_lock); -+static DEFINE_LOCAL_IRQ_LOCK(napi_alloc_cache_lock); - - static void *__netdev_alloc_frag(unsigned int fragsz, gfp_t gfp_mask) - { -@@ -363,9 +364,13 @@ EXPORT_SYMBOL(netdev_alloc_frag); - - static void *__napi_alloc_frag(unsigned int fragsz, gfp_t gfp_mask) - { -- struct napi_alloc_cache *nc = this_cpu_ptr(&napi_alloc_cache); -+ struct napi_alloc_cache *nc; -+ void *data; - -- return page_frag_alloc(&nc->page, fragsz, gfp_mask); -+ nc = &get_locked_var(napi_alloc_cache_lock, napi_alloc_cache); -+ data = page_frag_alloc(&nc->page, fragsz, gfp_mask); -+ put_locked_var(napi_alloc_cache_lock, napi_alloc_cache); -+ return data; - } - - void *napi_alloc_frag(unsigned int fragsz) -@@ -468,6 +473,7 @@ struct sk_buff *__napi_alloc_skb(struct napi_struct *napi, unsigned int len, - struct napi_alloc_cache *nc; - struct sk_buff *skb; - void *data; -+ bool pfmemalloc; - - len += NET_SKB_PAD + NET_IP_ALIGN; - -@@ -490,7 +496,10 @@ struct sk_buff *__napi_alloc_skb(struct napi_struct *napi, unsigned int len, - if (sk_memalloc_socks()) - gfp_mask |= __GFP_MEMALLOC; - -+ nc = &get_locked_var(napi_alloc_cache_lock, napi_alloc_cache); - data = page_frag_alloc(&nc->page, len, gfp_mask); -+ pfmemalloc = nc->page.pfmemalloc; -+ put_locked_var(napi_alloc_cache_lock, napi_alloc_cache); - if (unlikely(!data)) - return NULL; - -@@ -501,7 +510,7 @@ struct sk_buff *__napi_alloc_skb(struct napi_struct *napi, unsigned int len, - } - - /* use OR instead of assignment to avoid clearing of bits in mask */ -- if (nc->page.pfmemalloc) -+ if (pfmemalloc) - skb->pfmemalloc = 1; - skb->head_frag = 1; - -@@ -733,23 +742,26 @@ void __consume_stateless_skb(struct sk_buff *skb) - - void __kfree_skb_flush(void) - { -- struct napi_alloc_cache *nc = this_cpu_ptr(&napi_alloc_cache); -+ struct napi_alloc_cache *nc; - -+ nc = &get_locked_var(napi_alloc_cache_lock, napi_alloc_cache); - /* flush skb_cache if containing objects */ - if (nc->skb_count) { - kmem_cache_free_bulk(skbuff_head_cache, nc->skb_count, - nc->skb_cache); - nc->skb_count = 0; - } -+ put_locked_var(napi_alloc_cache_lock, napi_alloc_cache); - } - - static inline void _kfree_skb_defer(struct sk_buff *skb) - { -- struct napi_alloc_cache *nc = this_cpu_ptr(&napi_alloc_cache); -+ struct napi_alloc_cache *nc; - - /* drop skb->head and call any destructors for packet */ - skb_release_all(skb); - -+ nc = &get_locked_var(napi_alloc_cache_lock, napi_alloc_cache); - /* record skb to CPU local list */ - nc->skb_cache[nc->skb_count++] = skb; - -@@ -764,6 +776,7 @@ static inline void _kfree_skb_defer(struct sk_buff *skb) - nc->skb_cache); - nc->skb_count = 0; - } -+ put_locked_var(napi_alloc_cache_lock, napi_alloc_cache); - } - void __kfree_skb_defer(struct sk_buff *skb) - { --- -2.36.1 - diff --git a/debian/patches-rt/0233-net-netfilter-Serialize-xt_write_recseq-sections-on-.patch b/debian/patches-rt/0233-net-netfilter-Serialize-xt_write_recseq-sections-on-.patch new file mode 100644 index 000000000..3f6319ef4 --- /dev/null +++ b/debian/patches-rt/0233-net-netfilter-Serialize-xt_write_recseq-sections-on-.patch @@ -0,0 +1,80 @@ +From: Thomas Gleixner +Date: Sun, 28 Oct 2012 11:18:08 +0100 +Subject: [PATCH 233/342] net: netfilter: Serialize xt_write_recseq sections on + RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=a9374258672d870fd9fa14c86167cf3fb4186859 + +The netfilter code relies only on the implicit semantics of +local_bh_disable() for serializing wt_write_recseq sections. RT breaks +that and needs explicit serialization here. + +Reported-by: Peter LaDow +Signed-off-by: Thomas Gleixner +--- + include/linux/netfilter/x_tables.h | 7 +++++++ + net/netfilter/core.c | 6 ++++++ + 2 files changed, 13 insertions(+) + +diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h +index 0ade4d1e4dd9..3e21ce64ce54 100644 +--- a/include/linux/netfilter/x_tables.h ++++ b/include/linux/netfilter/x_tables.h +@@ -6,6 +6,7 @@ + #include + #include + #include ++#include + #include + + /* Test a struct->invflags and a boolean for inequality */ +@@ -345,6 +346,8 @@ void xt_free_table_info(struct xt_table_info *info); + */ + DECLARE_PER_CPU(seqcount_t, xt_recseq); + ++DECLARE_LOCAL_IRQ_LOCK(xt_write_lock); ++ + /* xt_tee_enabled - true if x_tables needs to handle reentrancy + * + * Enabled if current ip(6)tables ruleset has at least one -j TEE rule. +@@ -365,6 +368,9 @@ static inline unsigned int xt_write_recseq_begin(void) + { + unsigned int addend; + ++ /* RT protection */ ++ local_lock(xt_write_lock); ++ + /* + * Low order bit of sequence is set if we already + * called xt_write_recseq_begin(). +@@ -395,6 +401,7 @@ static inline void xt_write_recseq_end(unsigned int addend) + /* this is kind of a write_seqcount_end(), but addend is 0 or 1 */ + smp_wmb(); + __this_cpu_add(xt_recseq.sequence, addend); ++ local_unlock(xt_write_lock); + } + + /* +diff --git a/net/netfilter/core.c b/net/netfilter/core.c +index 722d1b057f61..5b8ebd8abcb0 100644 +--- a/net/netfilter/core.c ++++ b/net/netfilter/core.c +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -27,6 +28,11 @@ + + #include "nf_internals.h" + ++#ifdef CONFIG_PREEMPT_RT_BASE ++DEFINE_LOCAL_IRQ_LOCK(xt_write_lock); ++EXPORT_PER_CPU_SYMBOL(xt_write_lock); ++#endif ++ + const struct nf_ipv6_ops __rcu *nf_ipv6_ops __read_mostly; + EXPORT_SYMBOL_GPL(nf_ipv6_ops); + diff --git a/debian/patches-rt/0234-lockdep-selftest-Only-do-hardirq-context-test-for-ra.patch b/debian/patches-rt/0234-lockdep-selftest-Only-do-hardirq-context-test-for-ra.patch new file mode 100644 index 000000000..5b9098659 --- /dev/null +++ b/debian/patches-rt/0234-lockdep-selftest-Only-do-hardirq-context-test-for-ra.patch @@ -0,0 +1,58 @@ +From: Yong Zhang +Date: Mon, 16 Apr 2012 15:01:56 +0800 +Subject: [PATCH 234/342] lockdep: selftest: Only do hardirq context test for + raw spinlock +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=f4f917f2cf46718b42d1954b657f756852896a52 + +On -rt there is no softirq context any more and rwlock is sleepable, +disable softirq context test and rwlock+irq test. + +Signed-off-by: Yong Zhang +Cc: Yong Zhang +Link: http://lkml.kernel.org/r/1334559716-18447-3-git-send-email-yong.zhang0@gmail.com +Signed-off-by: Thomas Gleixner +--- + lib/locking-selftest.c | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +diff --git a/lib/locking-selftest.c b/lib/locking-selftest.c +index 1e1bbf171eca..5cdf3809905e 100644 +--- a/lib/locking-selftest.c ++++ b/lib/locking-selftest.c +@@ -2057,6 +2057,7 @@ void locking_selftest(void) + + printk(" --------------------------------------------------------------------------\n"); + ++#ifndef CONFIG_PREEMPT_RT_FULL + /* + * irq-context testcases: + */ +@@ -2069,6 +2070,28 @@ void locking_selftest(void) + + DO_TESTCASE_6x2("irq read-recursion", irq_read_recursion); + // DO_TESTCASE_6x2B("irq read-recursion #2", irq_read_recursion2); ++#else ++ /* On -rt, we only do hardirq context test for raw spinlock */ ++ DO_TESTCASE_1B("hard-irqs-on + irq-safe-A", irqsafe1_hard_spin, 12); ++ DO_TESTCASE_1B("hard-irqs-on + irq-safe-A", irqsafe1_hard_spin, 21); ++ ++ DO_TESTCASE_1B("hard-safe-A + irqs-on", irqsafe2B_hard_spin, 12); ++ DO_TESTCASE_1B("hard-safe-A + irqs-on", irqsafe2B_hard_spin, 21); ++ ++ DO_TESTCASE_1B("hard-safe-A + unsafe-B #1", irqsafe3_hard_spin, 123); ++ DO_TESTCASE_1B("hard-safe-A + unsafe-B #1", irqsafe3_hard_spin, 132); ++ DO_TESTCASE_1B("hard-safe-A + unsafe-B #1", irqsafe3_hard_spin, 213); ++ DO_TESTCASE_1B("hard-safe-A + unsafe-B #1", irqsafe3_hard_spin, 231); ++ DO_TESTCASE_1B("hard-safe-A + unsafe-B #1", irqsafe3_hard_spin, 312); ++ DO_TESTCASE_1B("hard-safe-A + unsafe-B #1", irqsafe3_hard_spin, 321); ++ ++ DO_TESTCASE_1B("hard-safe-A + unsafe-B #2", irqsafe4_hard_spin, 123); ++ DO_TESTCASE_1B("hard-safe-A + unsafe-B #2", irqsafe4_hard_spin, 132); ++ DO_TESTCASE_1B("hard-safe-A + unsafe-B #2", irqsafe4_hard_spin, 213); ++ DO_TESTCASE_1B("hard-safe-A + unsafe-B #2", irqsafe4_hard_spin, 231); ++ DO_TESTCASE_1B("hard-safe-A + unsafe-B #2", irqsafe4_hard_spin, 312); ++ DO_TESTCASE_1B("hard-safe-A + unsafe-B #2", irqsafe4_hard_spin, 321); ++#endif + + ww_tests(); + diff --git a/debian/patches-rt/0234-net-netfilter-Serialize-xt_write_recseq-sections-on-.patch b/debian/patches-rt/0234-net-netfilter-Serialize-xt_write_recseq-sections-on-.patch deleted file mode 100644 index 615fae013..000000000 --- a/debian/patches-rt/0234-net-netfilter-Serialize-xt_write_recseq-sections-on-.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 1eb35887a41aa67c6e796dc4f7097e1b08c82a38 Mon Sep 17 00:00:00 2001 -From: Thomas Gleixner -Date: Sun, 28 Oct 2012 11:18:08 +0100 -Subject: [PATCH 234/347] net: netfilter: Serialize xt_write_recseq sections on - RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -The netfilter code relies only on the implicit semantics of -local_bh_disable() for serializing wt_write_recseq sections. RT breaks -that and needs explicit serialization here. - -Reported-by: Peter LaDow -Signed-off-by: Thomas Gleixner ---- - include/linux/netfilter/x_tables.h | 7 +++++++ - net/netfilter/core.c | 6 ++++++ - 2 files changed, 13 insertions(+) - -diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h -index 0ade4d1e4dd9..3e21ce64ce54 100644 ---- a/include/linux/netfilter/x_tables.h -+++ b/include/linux/netfilter/x_tables.h -@@ -6,6 +6,7 @@ - #include - #include - #include -+#include - #include - - /* Test a struct->invflags and a boolean for inequality */ -@@ -345,6 +346,8 @@ void xt_free_table_info(struct xt_table_info *info); - */ - DECLARE_PER_CPU(seqcount_t, xt_recseq); - -+DECLARE_LOCAL_IRQ_LOCK(xt_write_lock); -+ - /* xt_tee_enabled - true if x_tables needs to handle reentrancy - * - * Enabled if current ip(6)tables ruleset has at least one -j TEE rule. -@@ -365,6 +368,9 @@ static inline unsigned int xt_write_recseq_begin(void) - { - unsigned int addend; - -+ /* RT protection */ -+ local_lock(xt_write_lock); -+ - /* - * Low order bit of sequence is set if we already - * called xt_write_recseq_begin(). -@@ -395,6 +401,7 @@ static inline void xt_write_recseq_end(unsigned int addend) - /* this is kind of a write_seqcount_end(), but addend is 0 or 1 */ - smp_wmb(); - __this_cpu_add(xt_recseq.sequence, addend); -+ local_unlock(xt_write_lock); - } - - /* -diff --git a/net/netfilter/core.c b/net/netfilter/core.c -index 722d1b057f61..5b8ebd8abcb0 100644 ---- a/net/netfilter/core.c -+++ b/net/netfilter/core.c -@@ -20,6 +20,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -27,6 +28,11 @@ - - #include "nf_internals.h" - -+#ifdef CONFIG_PREEMPT_RT_BASE -+DEFINE_LOCAL_IRQ_LOCK(xt_write_lock); -+EXPORT_PER_CPU_SYMBOL(xt_write_lock); -+#endif -+ - const struct nf_ipv6_ops __rcu *nf_ipv6_ops __read_mostly; - EXPORT_SYMBOL_GPL(nf_ipv6_ops); - --- -2.36.1 - diff --git a/debian/patches-rt/0235-lockdep-selftest-Only-do-hardirq-context-test-for-ra.patch b/debian/patches-rt/0235-lockdep-selftest-Only-do-hardirq-context-test-for-ra.patch deleted file mode 100644 index 4b7bc1086..000000000 --- a/debian/patches-rt/0235-lockdep-selftest-Only-do-hardirq-context-test-for-ra.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 8e7150c0542da06cffef7097a59911e86fbfe15e Mon Sep 17 00:00:00 2001 -From: Yong Zhang -Date: Mon, 16 Apr 2012 15:01:56 +0800 -Subject: [PATCH 235/347] lockdep: selftest: Only do hardirq context test for - raw spinlock -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -On -rt there is no softirq context any more and rwlock is sleepable, -disable softirq context test and rwlock+irq test. - -Signed-off-by: Yong Zhang -Cc: Yong Zhang -Link: http://lkml.kernel.org/r/1334559716-18447-3-git-send-email-yong.zhang0@gmail.com -Signed-off-by: Thomas Gleixner ---- - lib/locking-selftest.c | 23 +++++++++++++++++++++++ - 1 file changed, 23 insertions(+) - -diff --git a/lib/locking-selftest.c b/lib/locking-selftest.c -index 1e1bbf171eca..5cdf3809905e 100644 ---- a/lib/locking-selftest.c -+++ b/lib/locking-selftest.c -@@ -2057,6 +2057,7 @@ void locking_selftest(void) - - printk(" --------------------------------------------------------------------------\n"); - -+#ifndef CONFIG_PREEMPT_RT_FULL - /* - * irq-context testcases: - */ -@@ -2069,6 +2070,28 @@ void locking_selftest(void) - - DO_TESTCASE_6x2("irq read-recursion", irq_read_recursion); - // DO_TESTCASE_6x2B("irq read-recursion #2", irq_read_recursion2); -+#else -+ /* On -rt, we only do hardirq context test for raw spinlock */ -+ DO_TESTCASE_1B("hard-irqs-on + irq-safe-A", irqsafe1_hard_spin, 12); -+ DO_TESTCASE_1B("hard-irqs-on + irq-safe-A", irqsafe1_hard_spin, 21); -+ -+ DO_TESTCASE_1B("hard-safe-A + irqs-on", irqsafe2B_hard_spin, 12); -+ DO_TESTCASE_1B("hard-safe-A + irqs-on", irqsafe2B_hard_spin, 21); -+ -+ DO_TESTCASE_1B("hard-safe-A + unsafe-B #1", irqsafe3_hard_spin, 123); -+ DO_TESTCASE_1B("hard-safe-A + unsafe-B #1", irqsafe3_hard_spin, 132); -+ DO_TESTCASE_1B("hard-safe-A + unsafe-B #1", irqsafe3_hard_spin, 213); -+ DO_TESTCASE_1B("hard-safe-A + unsafe-B #1", irqsafe3_hard_spin, 231); -+ DO_TESTCASE_1B("hard-safe-A + unsafe-B #1", irqsafe3_hard_spin, 312); -+ DO_TESTCASE_1B("hard-safe-A + unsafe-B #1", irqsafe3_hard_spin, 321); -+ -+ DO_TESTCASE_1B("hard-safe-A + unsafe-B #2", irqsafe4_hard_spin, 123); -+ DO_TESTCASE_1B("hard-safe-A + unsafe-B #2", irqsafe4_hard_spin, 132); -+ DO_TESTCASE_1B("hard-safe-A + unsafe-B #2", irqsafe4_hard_spin, 213); -+ DO_TESTCASE_1B("hard-safe-A + unsafe-B #2", irqsafe4_hard_spin, 231); -+ DO_TESTCASE_1B("hard-safe-A + unsafe-B #2", irqsafe4_hard_spin, 312); -+ DO_TESTCASE_1B("hard-safe-A + unsafe-B #2", irqsafe4_hard_spin, 321); -+#endif - - ww_tests(); - --- -2.36.1 - diff --git a/debian/patches-rt/0235-lockdep-selftest-fix-warnings-due-to-missing-PREEMPT.patch b/debian/patches-rt/0235-lockdep-selftest-fix-warnings-due-to-missing-PREEMPT.patch new file mode 100644 index 000000000..22b6ac89b --- /dev/null +++ b/debian/patches-rt/0235-lockdep-selftest-fix-warnings-due-to-missing-PREEMPT.patch @@ -0,0 +1,145 @@ +From: Josh Cartwright +Date: Wed, 28 Jan 2015 13:08:45 -0600 +Subject: [PATCH 235/342] lockdep: selftest: fix warnings due to missing + PREEMPT_RT conditionals +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=55b0653e2c4e3159bdfece0f545e959b2583de30 + +"lockdep: Selftest: Only do hardirq context test for raw spinlock" +disabled the execution of certain tests with PREEMPT_RT_FULL, but did +not prevent the tests from still being defined. This leads to warnings +like: + + ./linux/lib/locking-selftest.c:574:1: warning: 'irqsafe1_hard_rlock_12' defined but not used [-Wunused-function] + ./linux/lib/locking-selftest.c:574:1: warning: 'irqsafe1_hard_rlock_21' defined but not used [-Wunused-function] + ./linux/lib/locking-selftest.c:577:1: warning: 'irqsafe1_hard_wlock_12' defined but not used [-Wunused-function] + ./linux/lib/locking-selftest.c:577:1: warning: 'irqsafe1_hard_wlock_21' defined but not used [-Wunused-function] + ./linux/lib/locking-selftest.c:580:1: warning: 'irqsafe1_soft_spin_12' defined but not used [-Wunused-function] + ... + +Fixed by wrapping the test definitions in #ifndef CONFIG_PREEMPT_RT_FULL +conditionals. + + +Signed-off-by: Josh Cartwright +Signed-off-by: Xander Huff +Acked-by: Gratian Crisan +Signed-off-by: Sebastian Andrzej Siewior +--- + lib/locking-selftest.c | 27 +++++++++++++++++++++++++++ + 1 file changed, 27 insertions(+) + +diff --git a/lib/locking-selftest.c b/lib/locking-selftest.c +index 5cdf3809905e..32db9532ddd4 100644 +--- a/lib/locking-selftest.c ++++ b/lib/locking-selftest.c +@@ -742,6 +742,8 @@ GENERATE_TESTCASE(init_held_rtmutex); + #include "locking-selftest-spin-hardirq.h" + GENERATE_PERMUTATIONS_2_EVENTS(irqsafe1_hard_spin) + ++#ifndef CONFIG_PREEMPT_RT_FULL ++ + #include "locking-selftest-rlock-hardirq.h" + GENERATE_PERMUTATIONS_2_EVENTS(irqsafe1_hard_rlock) + +@@ -757,9 +759,12 @@ GENERATE_PERMUTATIONS_2_EVENTS(irqsafe1_soft_rlock) + #include "locking-selftest-wlock-softirq.h" + GENERATE_PERMUTATIONS_2_EVENTS(irqsafe1_soft_wlock) + ++#endif ++ + #undef E1 + #undef E2 + ++#ifndef CONFIG_PREEMPT_RT_FULL + /* + * Enabling hardirqs with a softirq-safe lock held: + */ +@@ -792,6 +797,8 @@ GENERATE_PERMUTATIONS_2_EVENTS(irqsafe2A_rlock) + #undef E1 + #undef E2 + ++#endif ++ + /* + * Enabling irqs with an irq-safe lock held: + */ +@@ -815,6 +822,8 @@ GENERATE_PERMUTATIONS_2_EVENTS(irqsafe2A_rlock) + #include "locking-selftest-spin-hardirq.h" + GENERATE_PERMUTATIONS_2_EVENTS(irqsafe2B_hard_spin) + ++#ifndef CONFIG_PREEMPT_RT_FULL ++ + #include "locking-selftest-rlock-hardirq.h" + GENERATE_PERMUTATIONS_2_EVENTS(irqsafe2B_hard_rlock) + +@@ -830,6 +839,8 @@ GENERATE_PERMUTATIONS_2_EVENTS(irqsafe2B_soft_rlock) + #include "locking-selftest-wlock-softirq.h" + GENERATE_PERMUTATIONS_2_EVENTS(irqsafe2B_soft_wlock) + ++#endif ++ + #undef E1 + #undef E2 + +@@ -861,6 +872,8 @@ GENERATE_PERMUTATIONS_2_EVENTS(irqsafe2B_soft_wlock) + #include "locking-selftest-spin-hardirq.h" + GENERATE_PERMUTATIONS_3_EVENTS(irqsafe3_hard_spin) + ++#ifndef CONFIG_PREEMPT_RT_FULL ++ + #include "locking-selftest-rlock-hardirq.h" + GENERATE_PERMUTATIONS_3_EVENTS(irqsafe3_hard_rlock) + +@@ -876,6 +889,8 @@ GENERATE_PERMUTATIONS_3_EVENTS(irqsafe3_soft_rlock) + #include "locking-selftest-wlock-softirq.h" + GENERATE_PERMUTATIONS_3_EVENTS(irqsafe3_soft_wlock) + ++#endif ++ + #undef E1 + #undef E2 + #undef E3 +@@ -909,6 +924,8 @@ GENERATE_PERMUTATIONS_3_EVENTS(irqsafe3_soft_wlock) + #include "locking-selftest-spin-hardirq.h" + GENERATE_PERMUTATIONS_3_EVENTS(irqsafe4_hard_spin) + ++#ifndef CONFIG_PREEMPT_RT_FULL ++ + #include "locking-selftest-rlock-hardirq.h" + GENERATE_PERMUTATIONS_3_EVENTS(irqsafe4_hard_rlock) + +@@ -924,10 +941,14 @@ GENERATE_PERMUTATIONS_3_EVENTS(irqsafe4_soft_rlock) + #include "locking-selftest-wlock-softirq.h" + GENERATE_PERMUTATIONS_3_EVENTS(irqsafe4_soft_wlock) + ++#endif ++ + #undef E1 + #undef E2 + #undef E3 + ++#ifndef CONFIG_PREEMPT_RT_FULL ++ + /* + * read-lock / write-lock irq inversion. + * +@@ -990,6 +1011,10 @@ GENERATE_PERMUTATIONS_3_EVENTS(irq_inversion_soft_wlock) + #undef E2 + #undef E3 + ++#endif ++ ++#ifndef CONFIG_PREEMPT_RT_FULL ++ + /* + * read-lock / write-lock recursion that is actually safe. + */ +@@ -1028,6 +1053,8 @@ GENERATE_PERMUTATIONS_3_EVENTS(irq_read_recursion_soft) + #undef E2 + #undef E3 + ++#endif ++ + /* + * read-lock / write-lock recursion that is unsafe. + */ diff --git a/debian/patches-rt/0236-lockdep-selftest-fix-warnings-due-to-missing-PREEMPT.patch b/debian/patches-rt/0236-lockdep-selftest-fix-warnings-due-to-missing-PREEMPT.patch deleted file mode 100644 index 35eb70ae6..000000000 --- a/debian/patches-rt/0236-lockdep-selftest-fix-warnings-due-to-missing-PREEMPT.patch +++ /dev/null @@ -1,149 +0,0 @@ -From 8ad69a9f55b91025e0c0db41575ffe79d52fdb7b Mon Sep 17 00:00:00 2001 -From: Josh Cartwright -Date: Wed, 28 Jan 2015 13:08:45 -0600 -Subject: [PATCH 236/347] lockdep: selftest: fix warnings due to missing - PREEMPT_RT conditionals -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -"lockdep: Selftest: Only do hardirq context test for raw spinlock" -disabled the execution of certain tests with PREEMPT_RT_FULL, but did -not prevent the tests from still being defined. This leads to warnings -like: - - ./linux/lib/locking-selftest.c:574:1: warning: 'irqsafe1_hard_rlock_12' defined but not used [-Wunused-function] - ./linux/lib/locking-selftest.c:574:1: warning: 'irqsafe1_hard_rlock_21' defined but not used [-Wunused-function] - ./linux/lib/locking-selftest.c:577:1: warning: 'irqsafe1_hard_wlock_12' defined but not used [-Wunused-function] - ./linux/lib/locking-selftest.c:577:1: warning: 'irqsafe1_hard_wlock_21' defined but not used [-Wunused-function] - ./linux/lib/locking-selftest.c:580:1: warning: 'irqsafe1_soft_spin_12' defined but not used [-Wunused-function] - ... - -Fixed by wrapping the test definitions in #ifndef CONFIG_PREEMPT_RT_FULL -conditionals. - - -Signed-off-by: Josh Cartwright -Signed-off-by: Xander Huff -Acked-by: Gratian Crisan -Signed-off-by: Sebastian Andrzej Siewior ---- - lib/locking-selftest.c | 27 +++++++++++++++++++++++++++ - 1 file changed, 27 insertions(+) - -diff --git a/lib/locking-selftest.c b/lib/locking-selftest.c -index 5cdf3809905e..32db9532ddd4 100644 ---- a/lib/locking-selftest.c -+++ b/lib/locking-selftest.c -@@ -742,6 +742,8 @@ GENERATE_TESTCASE(init_held_rtmutex); - #include "locking-selftest-spin-hardirq.h" - GENERATE_PERMUTATIONS_2_EVENTS(irqsafe1_hard_spin) - -+#ifndef CONFIG_PREEMPT_RT_FULL -+ - #include "locking-selftest-rlock-hardirq.h" - GENERATE_PERMUTATIONS_2_EVENTS(irqsafe1_hard_rlock) - -@@ -757,9 +759,12 @@ GENERATE_PERMUTATIONS_2_EVENTS(irqsafe1_soft_rlock) - #include "locking-selftest-wlock-softirq.h" - GENERATE_PERMUTATIONS_2_EVENTS(irqsafe1_soft_wlock) - -+#endif -+ - #undef E1 - #undef E2 - -+#ifndef CONFIG_PREEMPT_RT_FULL - /* - * Enabling hardirqs with a softirq-safe lock held: - */ -@@ -792,6 +797,8 @@ GENERATE_PERMUTATIONS_2_EVENTS(irqsafe2A_rlock) - #undef E1 - #undef E2 - -+#endif -+ - /* - * Enabling irqs with an irq-safe lock held: - */ -@@ -815,6 +822,8 @@ GENERATE_PERMUTATIONS_2_EVENTS(irqsafe2A_rlock) - #include "locking-selftest-spin-hardirq.h" - GENERATE_PERMUTATIONS_2_EVENTS(irqsafe2B_hard_spin) - -+#ifndef CONFIG_PREEMPT_RT_FULL -+ - #include "locking-selftest-rlock-hardirq.h" - GENERATE_PERMUTATIONS_2_EVENTS(irqsafe2B_hard_rlock) - -@@ -830,6 +839,8 @@ GENERATE_PERMUTATIONS_2_EVENTS(irqsafe2B_soft_rlock) - #include "locking-selftest-wlock-softirq.h" - GENERATE_PERMUTATIONS_2_EVENTS(irqsafe2B_soft_wlock) - -+#endif -+ - #undef E1 - #undef E2 - -@@ -861,6 +872,8 @@ GENERATE_PERMUTATIONS_2_EVENTS(irqsafe2B_soft_wlock) - #include "locking-selftest-spin-hardirq.h" - GENERATE_PERMUTATIONS_3_EVENTS(irqsafe3_hard_spin) - -+#ifndef CONFIG_PREEMPT_RT_FULL -+ - #include "locking-selftest-rlock-hardirq.h" - GENERATE_PERMUTATIONS_3_EVENTS(irqsafe3_hard_rlock) - -@@ -876,6 +889,8 @@ GENERATE_PERMUTATIONS_3_EVENTS(irqsafe3_soft_rlock) - #include "locking-selftest-wlock-softirq.h" - GENERATE_PERMUTATIONS_3_EVENTS(irqsafe3_soft_wlock) - -+#endif -+ - #undef E1 - #undef E2 - #undef E3 -@@ -909,6 +924,8 @@ GENERATE_PERMUTATIONS_3_EVENTS(irqsafe3_soft_wlock) - #include "locking-selftest-spin-hardirq.h" - GENERATE_PERMUTATIONS_3_EVENTS(irqsafe4_hard_spin) - -+#ifndef CONFIG_PREEMPT_RT_FULL -+ - #include "locking-selftest-rlock-hardirq.h" - GENERATE_PERMUTATIONS_3_EVENTS(irqsafe4_hard_rlock) - -@@ -924,10 +941,14 @@ GENERATE_PERMUTATIONS_3_EVENTS(irqsafe4_soft_rlock) - #include "locking-selftest-wlock-softirq.h" - GENERATE_PERMUTATIONS_3_EVENTS(irqsafe4_soft_wlock) - -+#endif -+ - #undef E1 - #undef E2 - #undef E3 - -+#ifndef CONFIG_PREEMPT_RT_FULL -+ - /* - * read-lock / write-lock irq inversion. - * -@@ -990,6 +1011,10 @@ GENERATE_PERMUTATIONS_3_EVENTS(irq_inversion_soft_wlock) - #undef E2 - #undef E3 - -+#endif -+ -+#ifndef CONFIG_PREEMPT_RT_FULL -+ - /* - * read-lock / write-lock recursion that is actually safe. - */ -@@ -1028,6 +1053,8 @@ GENERATE_PERMUTATIONS_3_EVENTS(irq_read_recursion_soft) - #undef E2 - #undef E3 - -+#endif -+ - /* - * read-lock / write-lock recursion that is unsafe. - */ --- -2.36.1 - diff --git a/debian/patches-rt/0236-sched-Add-support-for-lazy-preemption.patch b/debian/patches-rt/0236-sched-Add-support-for-lazy-preemption.patch new file mode 100644 index 000000000..0c7ff0691 --- /dev/null +++ b/debian/patches-rt/0236-sched-Add-support-for-lazy-preemption.patch @@ -0,0 +1,667 @@ +From: Thomas Gleixner +Date: Fri, 26 Oct 2012 18:50:54 +0100 +Subject: [PATCH 236/342] sched: Add support for lazy preemption +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=f58baddb785517ba67a7470fb9278fcf919590ff + +It has become an obsession to mitigate the determinism vs. throughput +loss of RT. Looking at the mainline semantics of preemption points +gives a hint why RT sucks throughput wise for ordinary SCHED_OTHER +tasks. One major issue is the wakeup of tasks which are right away +preempting the waking task while the waking task holds a lock on which +the woken task will block right after having preempted the wakee. In +mainline this is prevented due to the implicit preemption disable of +spin/rw_lock held regions. On RT this is not possible due to the fully +preemptible nature of sleeping spinlocks. + +Though for a SCHED_OTHER task preempting another SCHED_OTHER task this +is really not a correctness issue. RT folks are concerned about +SCHED_FIFO/RR tasks preemption and not about the purely fairness +driven SCHED_OTHER preemption latencies. + +So I introduced a lazy preemption mechanism which only applies to +SCHED_OTHER tasks preempting another SCHED_OTHER task. Aside of the +existing preempt_count each tasks sports now a preempt_lazy_count +which is manipulated on lock acquiry and release. This is slightly +incorrect as for lazyness reasons I coupled this on +migrate_disable/enable so some other mechanisms get the same treatment +(e.g. get_cpu_light). + +Now on the scheduler side instead of setting NEED_RESCHED this sets +NEED_RESCHED_LAZY in case of a SCHED_OTHER/SCHED_OTHER preemption and +therefor allows to exit the waking task the lock held region before +the woken task preempts. That also works better for cross CPU wakeups +as the other side can stay in the adaptive spinning loop. + +For RT class preemption there is no change. This simply sets +NEED_RESCHED and forgoes the lazy preemption counter. + + Initial test do not expose any observable latency increasement, but +history shows that I've been proven wrong before :) + +The lazy preemption mode is per default on, but with +CONFIG_SCHED_DEBUG enabled it can be disabled via: + + # echo NO_PREEMPT_LAZY >/sys/kernel/debug/sched_features + +and reenabled via + + # echo PREEMPT_LAZY >/sys/kernel/debug/sched_features + +The test results so far are very machine and workload dependent, but +there is a clear trend that it enhances the non RT workload +performance. + +Signed-off-by: Thomas Gleixner +--- + include/linux/preempt.h | 35 ++++++++++++++- + include/linux/sched.h | 38 +++++++++++++++++ + include/linux/thread_info.h | 12 +++++- + include/linux/trace_events.h | 1 + + kernel/Kconfig.preempt | 6 +++ + kernel/cpu.c | 2 + + kernel/sched/core.c | 83 +++++++++++++++++++++++++++++++++++- + kernel/sched/fair.c | 16 +++---- + kernel/sched/features.h | 3 ++ + kernel/sched/sched.h | 9 ++++ + kernel/trace/trace.c | 36 +++++++++------- + kernel/trace/trace.h | 2 + + kernel/trace/trace_output.c | 14 +++++- + 13 files changed, 228 insertions(+), 29 deletions(-) + +diff --git a/include/linux/preempt.h b/include/linux/preempt.h +index ed8413e7140f..9c74a019bf57 100644 +--- a/include/linux/preempt.h ++++ b/include/linux/preempt.h +@@ -180,6 +180,20 @@ extern void preempt_count_sub(int val); + #define preempt_count_inc() preempt_count_add(1) + #define preempt_count_dec() preempt_count_sub(1) + ++#ifdef CONFIG_PREEMPT_LAZY ++#define add_preempt_lazy_count(val) do { preempt_lazy_count() += (val); } while (0) ++#define sub_preempt_lazy_count(val) do { preempt_lazy_count() -= (val); } while (0) ++#define inc_preempt_lazy_count() add_preempt_lazy_count(1) ++#define dec_preempt_lazy_count() sub_preempt_lazy_count(1) ++#define preempt_lazy_count() (current_thread_info()->preempt_lazy_count) ++#else ++#define add_preempt_lazy_count(val) do { } while (0) ++#define sub_preempt_lazy_count(val) do { } while (0) ++#define inc_preempt_lazy_count() do { } while (0) ++#define dec_preempt_lazy_count() do { } while (0) ++#define preempt_lazy_count() (0) ++#endif ++ + #ifdef CONFIG_PREEMPT_COUNT + + #define preempt_disable() \ +@@ -188,6 +202,12 @@ do { \ + barrier(); \ + } while (0) + ++#define preempt_lazy_disable() \ ++do { \ ++ inc_preempt_lazy_count(); \ ++ barrier(); \ ++} while (0) ++ + #define sched_preempt_enable_no_resched() \ + do { \ + barrier(); \ +@@ -250,6 +270,13 @@ do { \ + __preempt_schedule(); \ + } while (0) + ++#define preempt_lazy_enable() \ ++do { \ ++ dec_preempt_lazy_count(); \ ++ barrier(); \ ++ preempt_check_resched(); \ ++} while (0) ++ + #else /* !CONFIG_PREEMPT */ + #define preempt_enable() \ + do { \ +@@ -257,6 +284,12 @@ do { \ + preempt_count_dec(); \ + } while (0) + ++#define preempt_lazy_enable() \ ++do { \ ++ dec_preempt_lazy_count(); \ ++ barrier(); \ ++} while (0) ++ + #define preempt_enable_notrace() \ + do { \ + barrier(); \ +@@ -323,7 +356,7 @@ do { \ + } while (0) + #define preempt_fold_need_resched() \ + do { \ +- if (tif_need_resched()) \ ++ if (tif_need_resched_now()) \ + set_preempt_need_resched(); \ + } while (0) + +diff --git a/include/linux/sched.h b/include/linux/sched.h +index 7523c0786a63..044bebd3d16f 100644 +--- a/include/linux/sched.h ++++ b/include/linux/sched.h +@@ -1733,6 +1733,44 @@ static inline int test_tsk_need_resched(struct task_struct *tsk) + return unlikely(test_tsk_thread_flag(tsk,TIF_NEED_RESCHED)); + } + ++#ifdef CONFIG_PREEMPT_LAZY ++static inline void set_tsk_need_resched_lazy(struct task_struct *tsk) ++{ ++ set_tsk_thread_flag(tsk,TIF_NEED_RESCHED_LAZY); ++} ++ ++static inline void clear_tsk_need_resched_lazy(struct task_struct *tsk) ++{ ++ clear_tsk_thread_flag(tsk,TIF_NEED_RESCHED_LAZY); ++} ++ ++static inline int test_tsk_need_resched_lazy(struct task_struct *tsk) ++{ ++ return unlikely(test_tsk_thread_flag(tsk,TIF_NEED_RESCHED_LAZY)); ++} ++ ++static inline int need_resched_lazy(void) ++{ ++ return test_thread_flag(TIF_NEED_RESCHED_LAZY); ++} ++ ++static inline int need_resched_now(void) ++{ ++ return test_thread_flag(TIF_NEED_RESCHED); ++} ++ ++#else ++static inline void clear_tsk_need_resched_lazy(struct task_struct *tsk) { } ++static inline int need_resched_lazy(void) { return 0; } ++ ++static inline int need_resched_now(void) ++{ ++ return test_thread_flag(TIF_NEED_RESCHED); ++} ++ ++#endif ++ ++ + static inline bool __task_is_stopped_or_traced(struct task_struct *task) + { + if (task->state & (__TASK_STOPPED | __TASK_TRACED)) +diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h +index 62dbecfe9132..57a3d99dc067 100644 +--- a/include/linux/thread_info.h ++++ b/include/linux/thread_info.h +@@ -110,7 +110,17 @@ static inline int test_ti_thread_flag(struct thread_info *ti, int flag) + #define test_thread_flag(flag) \ + test_ti_thread_flag(current_thread_info(), flag) + +-#define tif_need_resched() test_thread_flag(TIF_NEED_RESCHED) ++#ifdef CONFIG_PREEMPT_LAZY ++#define tif_need_resched() (test_thread_flag(TIF_NEED_RESCHED) || \ ++ test_thread_flag(TIF_NEED_RESCHED_LAZY)) ++#define tif_need_resched_now() (test_thread_flag(TIF_NEED_RESCHED)) ++#define tif_need_resched_lazy() test_thread_flag(TIF_NEED_RESCHED_LAZY)) ++ ++#else ++#define tif_need_resched() test_thread_flag(TIF_NEED_RESCHED) ++#define tif_need_resched_now() test_thread_flag(TIF_NEED_RESCHED) ++#define tif_need_resched_lazy() 0 ++#endif + + #ifndef CONFIG_HAVE_ARCH_WITHIN_STACK_FRAMES + static inline int arch_within_stack_frames(const void * const stack, +diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h +index 1cc4d2da954c..72864a11cec0 100644 +--- a/include/linux/trace_events.h ++++ b/include/linux/trace_events.h +@@ -64,6 +64,7 @@ struct trace_entry { + int pid; + unsigned short migrate_disable; + unsigned short padding; ++ unsigned char preempt_lazy_count; + }; + + #define TRACE_EVENT_TYPE_MAX \ +diff --git a/kernel/Kconfig.preempt b/kernel/Kconfig.preempt +index 907d72b3ba95..306567f72a3e 100644 +--- a/kernel/Kconfig.preempt ++++ b/kernel/Kconfig.preempt +@@ -6,6 +6,12 @@ config PREEMPT_RT_BASE + bool + select PREEMPT + ++config HAVE_PREEMPT_LAZY ++ bool ++ ++config PREEMPT_LAZY ++ def_bool y if HAVE_PREEMPT_LAZY && PREEMPT_RT_FULL ++ + choice + prompt "Preemption Model" + default PREEMPT_NONE +diff --git a/kernel/cpu.c b/kernel/cpu.c +index 6ae5b18bf3a5..396394ebbc5b 100644 +--- a/kernel/cpu.c ++++ b/kernel/cpu.c +@@ -307,11 +307,13 @@ void pin_current_cpu(void) + return; + } + cpu = smp_processor_id(); ++ preempt_lazy_enable(); + preempt_enable(); + + __read_rt_lock(cpuhp_pin); + + preempt_disable(); ++ preempt_lazy_disable(); + if (cpu != smp_processor_id()) { + __read_rt_unlock(cpuhp_pin); + goto again; +diff --git a/kernel/sched/core.c b/kernel/sched/core.c +index dba425296275..0995748a3a1d 100644 +--- a/kernel/sched/core.c ++++ b/kernel/sched/core.c +@@ -493,6 +493,48 @@ void resched_curr(struct rq *rq) + trace_sched_wake_idle_without_ipi(cpu); + } + ++#ifdef CONFIG_PREEMPT_LAZY ++ ++static int tsk_is_polling(struct task_struct *p) ++{ ++#ifdef TIF_POLLING_NRFLAG ++ return test_tsk_thread_flag(p, TIF_POLLING_NRFLAG); ++#else ++ return 0; ++#endif ++} ++ ++void resched_curr_lazy(struct rq *rq) ++{ ++ struct task_struct *curr = rq->curr; ++ int cpu; ++ ++ if (!sched_feat(PREEMPT_LAZY)) { ++ resched_curr(rq); ++ return; ++ } ++ ++ lockdep_assert_held(&rq->lock); ++ ++ if (test_tsk_need_resched(curr)) ++ return; ++ ++ if (test_tsk_need_resched_lazy(curr)) ++ return; ++ ++ set_tsk_need_resched_lazy(curr); ++ ++ cpu = cpu_of(rq); ++ if (cpu == smp_processor_id()) ++ return; ++ ++ /* NEED_RESCHED_LAZY must be visible before we test polling */ ++ smp_mb(); ++ if (!tsk_is_polling(curr)) ++ smp_send_reschedule(cpu); ++} ++#endif ++ + void resched_cpu(int cpu) + { + struct rq *rq = cpu_rq(cpu); +@@ -2409,6 +2451,9 @@ int sched_fork(unsigned long clone_flags, struct task_struct *p) + p->on_cpu = 0; + #endif + init_task_preempt_count(p); ++#ifdef CONFIG_HAVE_PREEMPT_LAZY ++ task_thread_info(p)->preempt_lazy_count = 0; ++#endif + #ifdef CONFIG_SMP + plist_node_init(&p->pushable_tasks, MAX_PRIO); + RB_CLEAR_NODE(&p->pushable_dl_tasks); +@@ -3518,6 +3563,7 @@ static void __sched notrace __schedule(bool preempt) + + next = pick_next_task(rq, prev, &rf); + clear_tsk_need_resched(prev); ++ clear_tsk_need_resched_lazy(prev); + clear_preempt_need_resched(); + + if (likely(prev != next)) { +@@ -3698,6 +3744,30 @@ static void __sched notrace preempt_schedule_common(void) + } while (need_resched()); + } + ++#ifdef CONFIG_PREEMPT_LAZY ++/* ++ * If TIF_NEED_RESCHED is then we allow to be scheduled away since this is ++ * set by a RT task. Oterwise we try to avoid beeing scheduled out as long as ++ * preempt_lazy_count counter >0. ++ */ ++static __always_inline int preemptible_lazy(void) ++{ ++ if (test_thread_flag(TIF_NEED_RESCHED)) ++ return 1; ++ if (current_thread_info()->preempt_lazy_count) ++ return 0; ++ return 1; ++} ++ ++#else ++ ++static inline int preemptible_lazy(void) ++{ ++ return 1; ++} ++ ++#endif ++ + #ifdef CONFIG_PREEMPT + /* + * this is the entry point to schedule() from in-kernel preemption +@@ -3712,7 +3782,8 @@ asmlinkage __visible void __sched notrace preempt_schedule(void) + */ + if (likely(!preemptible())) + return; +- ++ if (!preemptible_lazy()) ++ return; + preempt_schedule_common(); + } + NOKPROBE_SYMBOL(preempt_schedule); +@@ -3739,6 +3810,9 @@ asmlinkage __visible void __sched notrace preempt_schedule_notrace(void) + if (likely(!preemptible())) + return; + ++ if (!preemptible_lazy()) ++ return; ++ + do { + /* + * Because the function tracer can trace preempt_count_sub() +@@ -5505,7 +5579,9 @@ void init_idle(struct task_struct *idle, int cpu) + + /* Set the preempt count _outside_ the spinlocks! */ + init_idle_preempt_count(idle, cpu); +- ++#ifdef CONFIG_HAVE_PREEMPT_LAZY ++ task_thread_info(idle)->preempt_lazy_count = 0; ++#endif + /* + * The idle tasks have their own, simple scheduling class: + */ +@@ -7222,6 +7298,7 @@ void migrate_disable(void) + } + + preempt_disable(); ++ preempt_lazy_disable(); + pin_current_cpu(); + + migrate_disable_update_cpus_allowed(p); +@@ -7289,6 +7366,7 @@ void migrate_enable(void) + arg.dest_cpu = dest_cpu; + + unpin_current_cpu(); ++ preempt_lazy_enable(); + preempt_enable(); + stop_one_cpu(task_cpu(p), migration_cpu_stop, &arg); + tlb_migrate_finish(p->mm); +@@ -7297,6 +7375,7 @@ void migrate_enable(void) + } + } + unpin_current_cpu(); ++ preempt_lazy_enable(); + preempt_enable(); + } + EXPORT_SYMBOL(migrate_enable); +diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c +index 16940416d526..d006dfc54a45 100644 +--- a/kernel/sched/fair.c ++++ b/kernel/sched/fair.c +@@ -4104,7 +4104,7 @@ check_preempt_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr) + ideal_runtime = sched_slice(cfs_rq, curr); + delta_exec = curr->sum_exec_runtime - curr->prev_sum_exec_runtime; + if (delta_exec > ideal_runtime) { +- resched_curr(rq_of(cfs_rq)); ++ resched_curr_lazy(rq_of(cfs_rq)); + /* + * The current task ran long enough, ensure it doesn't get + * re-elected due to buddy favours. +@@ -4128,7 +4128,7 @@ check_preempt_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr) + return; + + if (delta > ideal_runtime) +- resched_curr(rq_of(cfs_rq)); ++ resched_curr_lazy(rq_of(cfs_rq)); + } + + static void +@@ -4270,7 +4270,7 @@ entity_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr, int queued) + * validating it and just reschedule. + */ + if (queued) { +- resched_curr(rq_of(cfs_rq)); ++ resched_curr_lazy(rq_of(cfs_rq)); + return; + } + /* +@@ -4404,7 +4404,7 @@ static void __account_cfs_rq_runtime(struct cfs_rq *cfs_rq, u64 delta_exec) + * hierarchy can be throttled + */ + if (!assign_cfs_rq_runtime(cfs_rq) && likely(cfs_rq->curr)) +- resched_curr(rq_of(cfs_rq)); ++ resched_curr_lazy(rq_of(cfs_rq)); + } + + static __always_inline +@@ -5112,7 +5112,7 @@ static void hrtick_start_fair(struct rq *rq, struct task_struct *p) + + if (delta < 0) { + if (rq->curr == p) +- resched_curr(rq); ++ resched_curr_lazy(rq); + return; + } + hrtick_start(rq, delta); +@@ -6706,7 +6706,7 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_ + return; + + preempt: +- resched_curr(rq); ++ resched_curr_lazy(rq); + /* + * Only set the backward buddy when the current task is still + * on the rq. This can happen when a wakeup gets interleaved +@@ -9840,7 +9840,7 @@ static void task_fork_fair(struct task_struct *p) + * 'current' within the tree based on its new key value. + */ + swap(curr->vruntime, se->vruntime); +- resched_curr(rq); ++ resched_curr_lazy(rq); + } + + se->vruntime -= cfs_rq->min_vruntime; +@@ -9864,7 +9864,7 @@ prio_changed_fair(struct rq *rq, struct task_struct *p, int oldprio) + */ + if (rq->curr == p) { + if (p->prio > oldprio) +- resched_curr(rq); ++ resched_curr_lazy(rq); + } else + check_preempt_curr(rq, p, 0); + } +diff --git a/kernel/sched/features.h b/kernel/sched/features.h +index 68de18405857..12a12be6770b 100644 +--- a/kernel/sched/features.h ++++ b/kernel/sched/features.h +@@ -48,6 +48,9 @@ SCHED_FEAT(NONTASK_CAPACITY, true) + + #ifdef CONFIG_PREEMPT_RT_FULL + SCHED_FEAT(TTWU_QUEUE, false) ++# ifdef CONFIG_PREEMPT_LAZY ++SCHED_FEAT(PREEMPT_LAZY, true) ++# endif + #else + + /* +diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h +index 637c408fb2dc..87a05bb90124 100644 +--- a/kernel/sched/sched.h ++++ b/kernel/sched/sched.h +@@ -1643,6 +1643,15 @@ extern void reweight_task(struct task_struct *p, int prio); + extern void resched_curr(struct rq *rq); + extern void resched_cpu(int cpu); + ++#ifdef CONFIG_PREEMPT_LAZY ++extern void resched_curr_lazy(struct rq *rq); ++#else ++static inline void resched_curr_lazy(struct rq *rq) ++{ ++ resched_curr(rq); ++} ++#endif ++ + extern struct rt_bandwidth def_rt_bandwidth; + extern void init_rt_bandwidth(struct rt_bandwidth *rt_b, u64 period, u64 runtime); + +diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c +index 5cb37fa71316..50eee8dcf85c 100644 +--- a/kernel/trace/trace.c ++++ b/kernel/trace/trace.c +@@ -2153,6 +2153,7 @@ tracing_generic_entry_update(struct trace_entry *entry, unsigned long flags, + struct task_struct *tsk = current; + + entry->preempt_count = pc & 0xff; ++ entry->preempt_lazy_count = preempt_lazy_count(); + entry->pid = (tsk) ? tsk->pid : 0; + entry->flags = + #ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT +@@ -2163,7 +2164,8 @@ tracing_generic_entry_update(struct trace_entry *entry, unsigned long flags, + ((pc & NMI_MASK ) ? TRACE_FLAG_NMI : 0) | + ((pc & HARDIRQ_MASK) ? TRACE_FLAG_HARDIRQ : 0) | + ((pc & SOFTIRQ_OFFSET) ? TRACE_FLAG_SOFTIRQ : 0) | +- (tif_need_resched() ? TRACE_FLAG_NEED_RESCHED : 0) | ++ (tif_need_resched_now() ? TRACE_FLAG_NEED_RESCHED : 0) | ++ (need_resched_lazy() ? TRACE_FLAG_NEED_RESCHED_LAZY : 0) | + (test_preempt_need_resched() ? TRACE_FLAG_PREEMPT_RESCHED : 0); + + entry->migrate_disable = (tsk) ? __migrate_disabled(tsk) & 0xFF : 0; +@@ -3364,15 +3366,17 @@ get_total_entries(struct trace_buffer *buf, + + static void print_lat_help_header(struct seq_file *m) + { +- seq_puts(m, "# _------=> CPU# \n" +- "# / _-----=> irqs-off \n" +- "# | / _----=> need-resched \n" +- "# || / _---=> hardirq/softirq \n" +- "# ||| / _--=> preempt-depth \n" +- "# |||| / _--=> migrate-disable\n" +- "# ||||| / delay \n" +- "# cmd pid |||||| time | caller \n" +- "# \\ / ||||| \\ | / \n"); ++ seq_puts(m, "# _--------=> CPU# \n" ++ "# / _-------=> irqs-off \n" ++ "# | / _------=> need-resched \n" ++ "# || / _-----=> need-resched_lazy \n" ++ "# ||| / _----=> hardirq/softirq \n" ++ "# |||| / _---=> preempt-depth \n" ++ "# ||||| / _--=> preempt-lazy-depth\n" ++ "# |||||| / _-=> migrate-disable \n" ++ "# ||||||| / delay \n" ++ "# cmd pid |||||||| time | caller \n" ++ "# \\ / |||||||| \\ | / \n"); + } + + static void print_event_info(struct trace_buffer *buf, struct seq_file *m) +@@ -3410,15 +3414,17 @@ static void print_func_help_header_irq(struct trace_buffer *buf, struct seq_file + tgid ? tgid_space : space); + seq_printf(m, "# %s / _----=> need-resched\n", + tgid ? tgid_space : space); +- seq_printf(m, "# %s| / _---=> hardirq/softirq\n", ++ seq_printf(m, "# %s| / _---=> need-resched_lazy\n", + tgid ? tgid_space : space); +- seq_printf(m, "# %s|| / _--=> preempt-depth\n", ++ seq_printf(m, "# %s|| / _--=> hardirq/softirq\n", + tgid ? tgid_space : space); +- seq_printf(m, "# %s||| / delay\n", ++ seq_printf(m, "# %s||| / preempt-depth\n", + tgid ? tgid_space : space); +- seq_printf(m, "# TASK-PID %sCPU# |||| TIMESTAMP FUNCTION\n", ++ seq_printf(m, "# %s|||| / delay\n", ++ tgid ? tgid_space : space); ++ seq_printf(m, "# TASK-PID %sCPU# ||||| TIMESTAMP FUNCTION\n", + tgid ? " TGID " : space); +- seq_printf(m, "# | | %s | |||| | |\n", ++ seq_printf(m, "# | | %s | ||||| | |\n", + tgid ? " | " : space); + } + +diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h +index 74185fb040f3..7740bcdad355 100644 +--- a/kernel/trace/trace.h ++++ b/kernel/trace/trace.h +@@ -127,6 +127,7 @@ struct kretprobe_trace_entry_head { + * NEED_RESCHED - reschedule is requested + * HARDIRQ - inside an interrupt handler + * SOFTIRQ - inside a softirq handler ++ * NEED_RESCHED_LAZY - lazy reschedule is requested + */ + enum trace_flag_type { + TRACE_FLAG_IRQS_OFF = 0x01, +@@ -136,6 +137,7 @@ enum trace_flag_type { + TRACE_FLAG_SOFTIRQ = 0x10, + TRACE_FLAG_PREEMPT_RESCHED = 0x20, + TRACE_FLAG_NMI = 0x40, ++ TRACE_FLAG_NEED_RESCHED_LAZY = 0x80, + }; + + #define TRACE_BUF_SIZE 1024 +diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c +index 46c96744f09d..3f78b0afb729 100644 +--- a/kernel/trace/trace_output.c ++++ b/kernel/trace/trace_output.c +@@ -448,6 +448,7 @@ int trace_print_lat_fmt(struct trace_seq *s, struct trace_entry *entry) + { + char hardsoft_irq; + char need_resched; ++ char need_resched_lazy; + char irqs_off; + int hardirq; + int softirq; +@@ -478,6 +479,9 @@ int trace_print_lat_fmt(struct trace_seq *s, struct trace_entry *entry) + break; + } + ++ need_resched_lazy = ++ (entry->flags & TRACE_FLAG_NEED_RESCHED_LAZY) ? 'L' : '.'; ++ + hardsoft_irq = + (nmi && hardirq) ? 'Z' : + nmi ? 'z' : +@@ -486,14 +490,20 @@ int trace_print_lat_fmt(struct trace_seq *s, struct trace_entry *entry) + softirq ? 's' : + '.' ; + +- trace_seq_printf(s, "%c%c%c", +- irqs_off, need_resched, hardsoft_irq); ++ trace_seq_printf(s, "%c%c%c%c", ++ irqs_off, need_resched, need_resched_lazy, ++ hardsoft_irq); + + if (entry->preempt_count) + trace_seq_printf(s, "%x", entry->preempt_count); + else + trace_seq_putc(s, '.'); + ++ if (entry->preempt_lazy_count) ++ trace_seq_printf(s, "%x", entry->preempt_lazy_count); ++ else ++ trace_seq_putc(s, '.'); ++ + if (entry->migrate_disable) + trace_seq_printf(s, "%x", entry->migrate_disable); + else diff --git a/debian/patches-rt/0237-ftrace-Fix-trace-header-alignment.patch b/debian/patches-rt/0237-ftrace-Fix-trace-header-alignment.patch new file mode 100644 index 000000000..45a8800f7 --- /dev/null +++ b/debian/patches-rt/0237-ftrace-Fix-trace-header-alignment.patch @@ -0,0 +1,48 @@ +From: Mike Galbraith +Date: Sun, 16 Oct 2016 05:08:30 +0200 +Subject: [PATCH 237/342] ftrace: Fix trace header alignment +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=b5e921de659bd00cd76e89aded2b7d6b63533a6a + +Line up helper arrows to the right column. + +Cc: stable-rt@vger.kernel.org +Signed-off-by: Mike Galbraith +[bigeasy: fixup function tracer header] +Signed-off-by: Sebastian Andrzej Siewior +--- + kernel/trace/trace.c | 22 +++++++++++----------- + 1 file changed, 11 insertions(+), 11 deletions(-) + +diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c +index 50eee8dcf85c..e1db56edeb0d 100644 +--- a/kernel/trace/trace.c ++++ b/kernel/trace/trace.c +@@ -3366,17 +3366,17 @@ get_total_entries(struct trace_buffer *buf, + + static void print_lat_help_header(struct seq_file *m) + { +- seq_puts(m, "# _--------=> CPU# \n" +- "# / _-------=> irqs-off \n" +- "# | / _------=> need-resched \n" +- "# || / _-----=> need-resched_lazy \n" +- "# ||| / _----=> hardirq/softirq \n" +- "# |||| / _---=> preempt-depth \n" +- "# ||||| / _--=> preempt-lazy-depth\n" +- "# |||||| / _-=> migrate-disable \n" +- "# ||||||| / delay \n" +- "# cmd pid |||||||| time | caller \n" +- "# \\ / |||||||| \\ | / \n"); ++ seq_puts(m, "# _--------=> CPU# \n" ++ "# / _-------=> irqs-off \n" ++ "# | / _------=> need-resched \n" ++ "# || / _-----=> need-resched_lazy \n" ++ "# ||| / _----=> hardirq/softirq \n" ++ "# |||| / _---=> preempt-depth \n" ++ "# ||||| / _--=> preempt-lazy-depth\n" ++ "# |||||| / _-=> migrate-disable \n" ++ "# ||||||| / delay \n" ++ "# cmd pid |||||||| time | caller \n" ++ "# \\ / |||||||| \\ | / \n"); + } + + static void print_event_info(struct trace_buffer *buf, struct seq_file *m) diff --git a/debian/patches-rt/0237-sched-Add-support-for-lazy-preemption.patch b/debian/patches-rt/0237-sched-Add-support-for-lazy-preemption.patch deleted file mode 100644 index cc0305fdc..000000000 --- a/debian/patches-rt/0237-sched-Add-support-for-lazy-preemption.patch +++ /dev/null @@ -1,671 +0,0 @@ -From a8be86e68c8a8706268f9765c7e4eba79d265e70 Mon Sep 17 00:00:00 2001 -From: Thomas Gleixner -Date: Fri, 26 Oct 2012 18:50:54 +0100 -Subject: [PATCH 237/347] sched: Add support for lazy preemption -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -It has become an obsession to mitigate the determinism vs. throughput -loss of RT. Looking at the mainline semantics of preemption points -gives a hint why RT sucks throughput wise for ordinary SCHED_OTHER -tasks. One major issue is the wakeup of tasks which are right away -preempting the waking task while the waking task holds a lock on which -the woken task will block right after having preempted the wakee. In -mainline this is prevented due to the implicit preemption disable of -spin/rw_lock held regions. On RT this is not possible due to the fully -preemptible nature of sleeping spinlocks. - -Though for a SCHED_OTHER task preempting another SCHED_OTHER task this -is really not a correctness issue. RT folks are concerned about -SCHED_FIFO/RR tasks preemption and not about the purely fairness -driven SCHED_OTHER preemption latencies. - -So I introduced a lazy preemption mechanism which only applies to -SCHED_OTHER tasks preempting another SCHED_OTHER task. Aside of the -existing preempt_count each tasks sports now a preempt_lazy_count -which is manipulated on lock acquiry and release. This is slightly -incorrect as for lazyness reasons I coupled this on -migrate_disable/enable so some other mechanisms get the same treatment -(e.g. get_cpu_light). - -Now on the scheduler side instead of setting NEED_RESCHED this sets -NEED_RESCHED_LAZY in case of a SCHED_OTHER/SCHED_OTHER preemption and -therefor allows to exit the waking task the lock held region before -the woken task preempts. That also works better for cross CPU wakeups -as the other side can stay in the adaptive spinning loop. - -For RT class preemption there is no change. This simply sets -NEED_RESCHED and forgoes the lazy preemption counter. - - Initial test do not expose any observable latency increasement, but -history shows that I've been proven wrong before :) - -The lazy preemption mode is per default on, but with -CONFIG_SCHED_DEBUG enabled it can be disabled via: - - # echo NO_PREEMPT_LAZY >/sys/kernel/debug/sched_features - -and reenabled via - - # echo PREEMPT_LAZY >/sys/kernel/debug/sched_features - -The test results so far are very machine and workload dependent, but -there is a clear trend that it enhances the non RT workload -performance. - -Signed-off-by: Thomas Gleixner ---- - include/linux/preempt.h | 35 ++++++++++++++- - include/linux/sched.h | 38 +++++++++++++++++ - include/linux/thread_info.h | 12 +++++- - include/linux/trace_events.h | 1 + - kernel/Kconfig.preempt | 6 +++ - kernel/cpu.c | 2 + - kernel/sched/core.c | 83 +++++++++++++++++++++++++++++++++++- - kernel/sched/fair.c | 16 +++---- - kernel/sched/features.h | 3 ++ - kernel/sched/sched.h | 9 ++++ - kernel/trace/trace.c | 36 +++++++++------- - kernel/trace/trace.h | 2 + - kernel/trace/trace_output.c | 14 +++++- - 13 files changed, 228 insertions(+), 29 deletions(-) - -diff --git a/include/linux/preempt.h b/include/linux/preempt.h -index ed8413e7140f..9c74a019bf57 100644 ---- a/include/linux/preempt.h -+++ b/include/linux/preempt.h -@@ -180,6 +180,20 @@ extern void preempt_count_sub(int val); - #define preempt_count_inc() preempt_count_add(1) - #define preempt_count_dec() preempt_count_sub(1) - -+#ifdef CONFIG_PREEMPT_LAZY -+#define add_preempt_lazy_count(val) do { preempt_lazy_count() += (val); } while (0) -+#define sub_preempt_lazy_count(val) do { preempt_lazy_count() -= (val); } while (0) -+#define inc_preempt_lazy_count() add_preempt_lazy_count(1) -+#define dec_preempt_lazy_count() sub_preempt_lazy_count(1) -+#define preempt_lazy_count() (current_thread_info()->preempt_lazy_count) -+#else -+#define add_preempt_lazy_count(val) do { } while (0) -+#define sub_preempt_lazy_count(val) do { } while (0) -+#define inc_preempt_lazy_count() do { } while (0) -+#define dec_preempt_lazy_count() do { } while (0) -+#define preempt_lazy_count() (0) -+#endif -+ - #ifdef CONFIG_PREEMPT_COUNT - - #define preempt_disable() \ -@@ -188,6 +202,12 @@ do { \ - barrier(); \ - } while (0) - -+#define preempt_lazy_disable() \ -+do { \ -+ inc_preempt_lazy_count(); \ -+ barrier(); \ -+} while (0) -+ - #define sched_preempt_enable_no_resched() \ - do { \ - barrier(); \ -@@ -250,6 +270,13 @@ do { \ - __preempt_schedule(); \ - } while (0) - -+#define preempt_lazy_enable() \ -+do { \ -+ dec_preempt_lazy_count(); \ -+ barrier(); \ -+ preempt_check_resched(); \ -+} while (0) -+ - #else /* !CONFIG_PREEMPT */ - #define preempt_enable() \ - do { \ -@@ -257,6 +284,12 @@ do { \ - preempt_count_dec(); \ - } while (0) - -+#define preempt_lazy_enable() \ -+do { \ -+ dec_preempt_lazy_count(); \ -+ barrier(); \ -+} while (0) -+ - #define preempt_enable_notrace() \ - do { \ - barrier(); \ -@@ -323,7 +356,7 @@ do { \ - } while (0) - #define preempt_fold_need_resched() \ - do { \ -- if (tif_need_resched()) \ -+ if (tif_need_resched_now()) \ - set_preempt_need_resched(); \ - } while (0) - -diff --git a/include/linux/sched.h b/include/linux/sched.h -index 7523c0786a63..044bebd3d16f 100644 ---- a/include/linux/sched.h -+++ b/include/linux/sched.h -@@ -1733,6 +1733,44 @@ static inline int test_tsk_need_resched(struct task_struct *tsk) - return unlikely(test_tsk_thread_flag(tsk,TIF_NEED_RESCHED)); - } - -+#ifdef CONFIG_PREEMPT_LAZY -+static inline void set_tsk_need_resched_lazy(struct task_struct *tsk) -+{ -+ set_tsk_thread_flag(tsk,TIF_NEED_RESCHED_LAZY); -+} -+ -+static inline void clear_tsk_need_resched_lazy(struct task_struct *tsk) -+{ -+ clear_tsk_thread_flag(tsk,TIF_NEED_RESCHED_LAZY); -+} -+ -+static inline int test_tsk_need_resched_lazy(struct task_struct *tsk) -+{ -+ return unlikely(test_tsk_thread_flag(tsk,TIF_NEED_RESCHED_LAZY)); -+} -+ -+static inline int need_resched_lazy(void) -+{ -+ return test_thread_flag(TIF_NEED_RESCHED_LAZY); -+} -+ -+static inline int need_resched_now(void) -+{ -+ return test_thread_flag(TIF_NEED_RESCHED); -+} -+ -+#else -+static inline void clear_tsk_need_resched_lazy(struct task_struct *tsk) { } -+static inline int need_resched_lazy(void) { return 0; } -+ -+static inline int need_resched_now(void) -+{ -+ return test_thread_flag(TIF_NEED_RESCHED); -+} -+ -+#endif -+ -+ - static inline bool __task_is_stopped_or_traced(struct task_struct *task) - { - if (task->state & (__TASK_STOPPED | __TASK_TRACED)) -diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h -index 62dbecfe9132..57a3d99dc067 100644 ---- a/include/linux/thread_info.h -+++ b/include/linux/thread_info.h -@@ -110,7 +110,17 @@ static inline int test_ti_thread_flag(struct thread_info *ti, int flag) - #define test_thread_flag(flag) \ - test_ti_thread_flag(current_thread_info(), flag) - --#define tif_need_resched() test_thread_flag(TIF_NEED_RESCHED) -+#ifdef CONFIG_PREEMPT_LAZY -+#define tif_need_resched() (test_thread_flag(TIF_NEED_RESCHED) || \ -+ test_thread_flag(TIF_NEED_RESCHED_LAZY)) -+#define tif_need_resched_now() (test_thread_flag(TIF_NEED_RESCHED)) -+#define tif_need_resched_lazy() test_thread_flag(TIF_NEED_RESCHED_LAZY)) -+ -+#else -+#define tif_need_resched() test_thread_flag(TIF_NEED_RESCHED) -+#define tif_need_resched_now() test_thread_flag(TIF_NEED_RESCHED) -+#define tif_need_resched_lazy() 0 -+#endif - - #ifndef CONFIG_HAVE_ARCH_WITHIN_STACK_FRAMES - static inline int arch_within_stack_frames(const void * const stack, -diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h -index 1cc4d2da954c..72864a11cec0 100644 ---- a/include/linux/trace_events.h -+++ b/include/linux/trace_events.h -@@ -64,6 +64,7 @@ struct trace_entry { - int pid; - unsigned short migrate_disable; - unsigned short padding; -+ unsigned char preempt_lazy_count; - }; - - #define TRACE_EVENT_TYPE_MAX \ -diff --git a/kernel/Kconfig.preempt b/kernel/Kconfig.preempt -index 907d72b3ba95..306567f72a3e 100644 ---- a/kernel/Kconfig.preempt -+++ b/kernel/Kconfig.preempt -@@ -6,6 +6,12 @@ config PREEMPT_RT_BASE - bool - select PREEMPT - -+config HAVE_PREEMPT_LAZY -+ bool -+ -+config PREEMPT_LAZY -+ def_bool y if HAVE_PREEMPT_LAZY && PREEMPT_RT_FULL -+ - choice - prompt "Preemption Model" - default PREEMPT_NONE -diff --git a/kernel/cpu.c b/kernel/cpu.c -index f6511c62c9a4..11f48774b129 100644 ---- a/kernel/cpu.c -+++ b/kernel/cpu.c -@@ -306,11 +306,13 @@ void pin_current_cpu(void) - return; - } - cpu = smp_processor_id(); -+ preempt_lazy_enable(); - preempt_enable(); - - __read_rt_lock(cpuhp_pin); - - preempt_disable(); -+ preempt_lazy_disable(); - if (cpu != smp_processor_id()) { - __read_rt_unlock(cpuhp_pin); - goto again; -diff --git a/kernel/sched/core.c b/kernel/sched/core.c -index dba425296275..0995748a3a1d 100644 ---- a/kernel/sched/core.c -+++ b/kernel/sched/core.c -@@ -493,6 +493,48 @@ void resched_curr(struct rq *rq) - trace_sched_wake_idle_without_ipi(cpu); - } - -+#ifdef CONFIG_PREEMPT_LAZY -+ -+static int tsk_is_polling(struct task_struct *p) -+{ -+#ifdef TIF_POLLING_NRFLAG -+ return test_tsk_thread_flag(p, TIF_POLLING_NRFLAG); -+#else -+ return 0; -+#endif -+} -+ -+void resched_curr_lazy(struct rq *rq) -+{ -+ struct task_struct *curr = rq->curr; -+ int cpu; -+ -+ if (!sched_feat(PREEMPT_LAZY)) { -+ resched_curr(rq); -+ return; -+ } -+ -+ lockdep_assert_held(&rq->lock); -+ -+ if (test_tsk_need_resched(curr)) -+ return; -+ -+ if (test_tsk_need_resched_lazy(curr)) -+ return; -+ -+ set_tsk_need_resched_lazy(curr); -+ -+ cpu = cpu_of(rq); -+ if (cpu == smp_processor_id()) -+ return; -+ -+ /* NEED_RESCHED_LAZY must be visible before we test polling */ -+ smp_mb(); -+ if (!tsk_is_polling(curr)) -+ smp_send_reschedule(cpu); -+} -+#endif -+ - void resched_cpu(int cpu) - { - struct rq *rq = cpu_rq(cpu); -@@ -2409,6 +2451,9 @@ int sched_fork(unsigned long clone_flags, struct task_struct *p) - p->on_cpu = 0; - #endif - init_task_preempt_count(p); -+#ifdef CONFIG_HAVE_PREEMPT_LAZY -+ task_thread_info(p)->preempt_lazy_count = 0; -+#endif - #ifdef CONFIG_SMP - plist_node_init(&p->pushable_tasks, MAX_PRIO); - RB_CLEAR_NODE(&p->pushable_dl_tasks); -@@ -3518,6 +3563,7 @@ static void __sched notrace __schedule(bool preempt) - - next = pick_next_task(rq, prev, &rf); - clear_tsk_need_resched(prev); -+ clear_tsk_need_resched_lazy(prev); - clear_preempt_need_resched(); - - if (likely(prev != next)) { -@@ -3698,6 +3744,30 @@ static void __sched notrace preempt_schedule_common(void) - } while (need_resched()); - } - -+#ifdef CONFIG_PREEMPT_LAZY -+/* -+ * If TIF_NEED_RESCHED is then we allow to be scheduled away since this is -+ * set by a RT task. Oterwise we try to avoid beeing scheduled out as long as -+ * preempt_lazy_count counter >0. -+ */ -+static __always_inline int preemptible_lazy(void) -+{ -+ if (test_thread_flag(TIF_NEED_RESCHED)) -+ return 1; -+ if (current_thread_info()->preempt_lazy_count) -+ return 0; -+ return 1; -+} -+ -+#else -+ -+static inline int preemptible_lazy(void) -+{ -+ return 1; -+} -+ -+#endif -+ - #ifdef CONFIG_PREEMPT - /* - * this is the entry point to schedule() from in-kernel preemption -@@ -3712,7 +3782,8 @@ asmlinkage __visible void __sched notrace preempt_schedule(void) - */ - if (likely(!preemptible())) - return; -- -+ if (!preemptible_lazy()) -+ return; - preempt_schedule_common(); - } - NOKPROBE_SYMBOL(preempt_schedule); -@@ -3739,6 +3810,9 @@ asmlinkage __visible void __sched notrace preempt_schedule_notrace(void) - if (likely(!preemptible())) - return; - -+ if (!preemptible_lazy()) -+ return; -+ - do { - /* - * Because the function tracer can trace preempt_count_sub() -@@ -5505,7 +5579,9 @@ void init_idle(struct task_struct *idle, int cpu) - - /* Set the preempt count _outside_ the spinlocks! */ - init_idle_preempt_count(idle, cpu); -- -+#ifdef CONFIG_HAVE_PREEMPT_LAZY -+ task_thread_info(idle)->preempt_lazy_count = 0; -+#endif - /* - * The idle tasks have their own, simple scheduling class: - */ -@@ -7222,6 +7298,7 @@ void migrate_disable(void) - } - - preempt_disable(); -+ preempt_lazy_disable(); - pin_current_cpu(); - - migrate_disable_update_cpus_allowed(p); -@@ -7289,6 +7366,7 @@ void migrate_enable(void) - arg.dest_cpu = dest_cpu; - - unpin_current_cpu(); -+ preempt_lazy_enable(); - preempt_enable(); - stop_one_cpu(task_cpu(p), migration_cpu_stop, &arg); - tlb_migrate_finish(p->mm); -@@ -7297,6 +7375,7 @@ void migrate_enable(void) - } - } - unpin_current_cpu(); -+ preempt_lazy_enable(); - preempt_enable(); - } - EXPORT_SYMBOL(migrate_enable); -diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c -index 16940416d526..d006dfc54a45 100644 ---- a/kernel/sched/fair.c -+++ b/kernel/sched/fair.c -@@ -4104,7 +4104,7 @@ check_preempt_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr) - ideal_runtime = sched_slice(cfs_rq, curr); - delta_exec = curr->sum_exec_runtime - curr->prev_sum_exec_runtime; - if (delta_exec > ideal_runtime) { -- resched_curr(rq_of(cfs_rq)); -+ resched_curr_lazy(rq_of(cfs_rq)); - /* - * The current task ran long enough, ensure it doesn't get - * re-elected due to buddy favours. -@@ -4128,7 +4128,7 @@ check_preempt_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr) - return; - - if (delta > ideal_runtime) -- resched_curr(rq_of(cfs_rq)); -+ resched_curr_lazy(rq_of(cfs_rq)); - } - - static void -@@ -4270,7 +4270,7 @@ entity_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr, int queued) - * validating it and just reschedule. - */ - if (queued) { -- resched_curr(rq_of(cfs_rq)); -+ resched_curr_lazy(rq_of(cfs_rq)); - return; - } - /* -@@ -4404,7 +4404,7 @@ static void __account_cfs_rq_runtime(struct cfs_rq *cfs_rq, u64 delta_exec) - * hierarchy can be throttled - */ - if (!assign_cfs_rq_runtime(cfs_rq) && likely(cfs_rq->curr)) -- resched_curr(rq_of(cfs_rq)); -+ resched_curr_lazy(rq_of(cfs_rq)); - } - - static __always_inline -@@ -5112,7 +5112,7 @@ static void hrtick_start_fair(struct rq *rq, struct task_struct *p) - - if (delta < 0) { - if (rq->curr == p) -- resched_curr(rq); -+ resched_curr_lazy(rq); - return; - } - hrtick_start(rq, delta); -@@ -6706,7 +6706,7 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_ - return; - - preempt: -- resched_curr(rq); -+ resched_curr_lazy(rq); - /* - * Only set the backward buddy when the current task is still - * on the rq. This can happen when a wakeup gets interleaved -@@ -9840,7 +9840,7 @@ static void task_fork_fair(struct task_struct *p) - * 'current' within the tree based on its new key value. - */ - swap(curr->vruntime, se->vruntime); -- resched_curr(rq); -+ resched_curr_lazy(rq); - } - - se->vruntime -= cfs_rq->min_vruntime; -@@ -9864,7 +9864,7 @@ prio_changed_fair(struct rq *rq, struct task_struct *p, int oldprio) - */ - if (rq->curr == p) { - if (p->prio > oldprio) -- resched_curr(rq); -+ resched_curr_lazy(rq); - } else - check_preempt_curr(rq, p, 0); - } -diff --git a/kernel/sched/features.h b/kernel/sched/features.h -index 68de18405857..12a12be6770b 100644 ---- a/kernel/sched/features.h -+++ b/kernel/sched/features.h -@@ -48,6 +48,9 @@ SCHED_FEAT(NONTASK_CAPACITY, true) - - #ifdef CONFIG_PREEMPT_RT_FULL - SCHED_FEAT(TTWU_QUEUE, false) -+# ifdef CONFIG_PREEMPT_LAZY -+SCHED_FEAT(PREEMPT_LAZY, true) -+# endif - #else - - /* -diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h -index 637c408fb2dc..87a05bb90124 100644 ---- a/kernel/sched/sched.h -+++ b/kernel/sched/sched.h -@@ -1643,6 +1643,15 @@ extern void reweight_task(struct task_struct *p, int prio); - extern void resched_curr(struct rq *rq); - extern void resched_cpu(int cpu); - -+#ifdef CONFIG_PREEMPT_LAZY -+extern void resched_curr_lazy(struct rq *rq); -+#else -+static inline void resched_curr_lazy(struct rq *rq) -+{ -+ resched_curr(rq); -+} -+#endif -+ - extern struct rt_bandwidth def_rt_bandwidth; - extern void init_rt_bandwidth(struct rt_bandwidth *rt_b, u64 period, u64 runtime); - -diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c -index 2a8b830d42f1..f36b954d2e30 100644 ---- a/kernel/trace/trace.c -+++ b/kernel/trace/trace.c -@@ -2153,6 +2153,7 @@ tracing_generic_entry_update(struct trace_entry *entry, unsigned long flags, - struct task_struct *tsk = current; - - entry->preempt_count = pc & 0xff; -+ entry->preempt_lazy_count = preempt_lazy_count(); - entry->pid = (tsk) ? tsk->pid : 0; - entry->flags = - #ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT -@@ -2163,7 +2164,8 @@ tracing_generic_entry_update(struct trace_entry *entry, unsigned long flags, - ((pc & NMI_MASK ) ? TRACE_FLAG_NMI : 0) | - ((pc & HARDIRQ_MASK) ? TRACE_FLAG_HARDIRQ : 0) | - ((pc & SOFTIRQ_OFFSET) ? TRACE_FLAG_SOFTIRQ : 0) | -- (tif_need_resched() ? TRACE_FLAG_NEED_RESCHED : 0) | -+ (tif_need_resched_now() ? TRACE_FLAG_NEED_RESCHED : 0) | -+ (need_resched_lazy() ? TRACE_FLAG_NEED_RESCHED_LAZY : 0) | - (test_preempt_need_resched() ? TRACE_FLAG_PREEMPT_RESCHED : 0); - - entry->migrate_disable = (tsk) ? __migrate_disabled(tsk) & 0xFF : 0; -@@ -3364,15 +3366,17 @@ get_total_entries(struct trace_buffer *buf, - - static void print_lat_help_header(struct seq_file *m) - { -- seq_puts(m, "# _------=> CPU# \n" -- "# / _-----=> irqs-off \n" -- "# | / _----=> need-resched \n" -- "# || / _---=> hardirq/softirq \n" -- "# ||| / _--=> preempt-depth \n" -- "# |||| / _--=> migrate-disable\n" -- "# ||||| / delay \n" -- "# cmd pid |||||| time | caller \n" -- "# \\ / ||||| \\ | / \n"); -+ seq_puts(m, "# _--------=> CPU# \n" -+ "# / _-------=> irqs-off \n" -+ "# | / _------=> need-resched \n" -+ "# || / _-----=> need-resched_lazy \n" -+ "# ||| / _----=> hardirq/softirq \n" -+ "# |||| / _---=> preempt-depth \n" -+ "# ||||| / _--=> preempt-lazy-depth\n" -+ "# |||||| / _-=> migrate-disable \n" -+ "# ||||||| / delay \n" -+ "# cmd pid |||||||| time | caller \n" -+ "# \\ / |||||||| \\ | / \n"); - } - - static void print_event_info(struct trace_buffer *buf, struct seq_file *m) -@@ -3410,15 +3414,17 @@ static void print_func_help_header_irq(struct trace_buffer *buf, struct seq_file - tgid ? tgid_space : space); - seq_printf(m, "# %s / _----=> need-resched\n", - tgid ? tgid_space : space); -- seq_printf(m, "# %s| / _---=> hardirq/softirq\n", -+ seq_printf(m, "# %s| / _---=> need-resched_lazy\n", - tgid ? tgid_space : space); -- seq_printf(m, "# %s|| / _--=> preempt-depth\n", -+ seq_printf(m, "# %s|| / _--=> hardirq/softirq\n", - tgid ? tgid_space : space); -- seq_printf(m, "# %s||| / delay\n", -+ seq_printf(m, "# %s||| / preempt-depth\n", - tgid ? tgid_space : space); -- seq_printf(m, "# TASK-PID %sCPU# |||| TIMESTAMP FUNCTION\n", -+ seq_printf(m, "# %s|||| / delay\n", -+ tgid ? tgid_space : space); -+ seq_printf(m, "# TASK-PID %sCPU# ||||| TIMESTAMP FUNCTION\n", - tgid ? " TGID " : space); -- seq_printf(m, "# | | %s | |||| | |\n", -+ seq_printf(m, "# | | %s | ||||| | |\n", - tgid ? " | " : space); - } - -diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h -index 74185fb040f3..7740bcdad355 100644 ---- a/kernel/trace/trace.h -+++ b/kernel/trace/trace.h -@@ -127,6 +127,7 @@ struct kretprobe_trace_entry_head { - * NEED_RESCHED - reschedule is requested - * HARDIRQ - inside an interrupt handler - * SOFTIRQ - inside a softirq handler -+ * NEED_RESCHED_LAZY - lazy reschedule is requested - */ - enum trace_flag_type { - TRACE_FLAG_IRQS_OFF = 0x01, -@@ -136,6 +137,7 @@ enum trace_flag_type { - TRACE_FLAG_SOFTIRQ = 0x10, - TRACE_FLAG_PREEMPT_RESCHED = 0x20, - TRACE_FLAG_NMI = 0x40, -+ TRACE_FLAG_NEED_RESCHED_LAZY = 0x80, - }; - - #define TRACE_BUF_SIZE 1024 -diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c -index 46c96744f09d..3f78b0afb729 100644 ---- a/kernel/trace/trace_output.c -+++ b/kernel/trace/trace_output.c -@@ -448,6 +448,7 @@ int trace_print_lat_fmt(struct trace_seq *s, struct trace_entry *entry) - { - char hardsoft_irq; - char need_resched; -+ char need_resched_lazy; - char irqs_off; - int hardirq; - int softirq; -@@ -478,6 +479,9 @@ int trace_print_lat_fmt(struct trace_seq *s, struct trace_entry *entry) - break; - } - -+ need_resched_lazy = -+ (entry->flags & TRACE_FLAG_NEED_RESCHED_LAZY) ? 'L' : '.'; -+ - hardsoft_irq = - (nmi && hardirq) ? 'Z' : - nmi ? 'z' : -@@ -486,14 +490,20 @@ int trace_print_lat_fmt(struct trace_seq *s, struct trace_entry *entry) - softirq ? 's' : - '.' ; - -- trace_seq_printf(s, "%c%c%c", -- irqs_off, need_resched, hardsoft_irq); -+ trace_seq_printf(s, "%c%c%c%c", -+ irqs_off, need_resched, need_resched_lazy, -+ hardsoft_irq); - - if (entry->preempt_count) - trace_seq_printf(s, "%x", entry->preempt_count); - else - trace_seq_putc(s, '.'); - -+ if (entry->preempt_lazy_count) -+ trace_seq_printf(s, "%x", entry->preempt_lazy_count); -+ else -+ trace_seq_putc(s, '.'); -+ - if (entry->migrate_disable) - trace_seq_printf(s, "%x", entry->migrate_disable); - else --- -2.36.1 - diff --git a/debian/patches-rt/0238-ftrace-Fix-trace-header-alignment.patch b/debian/patches-rt/0238-ftrace-Fix-trace-header-alignment.patch deleted file mode 100644 index 37c7a1fee..000000000 --- a/debian/patches-rt/0238-ftrace-Fix-trace-header-alignment.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 4462a16fd2c2a84dcf4ff6f574044ed4cafd7860 Mon Sep 17 00:00:00 2001 -From: Mike Galbraith -Date: Sun, 16 Oct 2016 05:08:30 +0200 -Subject: [PATCH 238/347] ftrace: Fix trace header alignment -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -Line up helper arrows to the right column. - -Cc: stable-rt@vger.kernel.org -Signed-off-by: Mike Galbraith -[bigeasy: fixup function tracer header] -Signed-off-by: Sebastian Andrzej Siewior ---- - kernel/trace/trace.c | 22 +++++++++++----------- - 1 file changed, 11 insertions(+), 11 deletions(-) - -diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c -index f36b954d2e30..87bce59fa340 100644 ---- a/kernel/trace/trace.c -+++ b/kernel/trace/trace.c -@@ -3366,17 +3366,17 @@ get_total_entries(struct trace_buffer *buf, - - static void print_lat_help_header(struct seq_file *m) - { -- seq_puts(m, "# _--------=> CPU# \n" -- "# / _-------=> irqs-off \n" -- "# | / _------=> need-resched \n" -- "# || / _-----=> need-resched_lazy \n" -- "# ||| / _----=> hardirq/softirq \n" -- "# |||| / _---=> preempt-depth \n" -- "# ||||| / _--=> preempt-lazy-depth\n" -- "# |||||| / _-=> migrate-disable \n" -- "# ||||||| / delay \n" -- "# cmd pid |||||||| time | caller \n" -- "# \\ / |||||||| \\ | / \n"); -+ seq_puts(m, "# _--------=> CPU# \n" -+ "# / _-------=> irqs-off \n" -+ "# | / _------=> need-resched \n" -+ "# || / _-----=> need-resched_lazy \n" -+ "# ||| / _----=> hardirq/softirq \n" -+ "# |||| / _---=> preempt-depth \n" -+ "# ||||| / _--=> preempt-lazy-depth\n" -+ "# |||||| / _-=> migrate-disable \n" -+ "# ||||||| / delay \n" -+ "# cmd pid |||||||| time | caller \n" -+ "# \\ / |||||||| \\ | / \n"); - } - - static void print_event_info(struct trace_buffer *buf, struct seq_file *m) --- -2.36.1 - diff --git a/debian/patches-rt/0238-x86-Support-for-lazy-preemption.patch b/debian/patches-rt/0238-x86-Support-for-lazy-preemption.patch new file mode 100644 index 000000000..563d97c84 --- /dev/null +++ b/debian/patches-rt/0238-x86-Support-for-lazy-preemption.patch @@ -0,0 +1,236 @@ +From: Thomas Gleixner +Date: Thu, 1 Nov 2012 11:03:47 +0100 +Subject: [PATCH 238/342] x86: Support for lazy preemption +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=ebf6918cf9f47fbdd3414aacbc7091e776654392 + +Implement the x86 pieces for lazy preempt. + +Signed-off-by: Thomas Gleixner +--- + arch/x86/Kconfig | 1 + + arch/x86/entry/common.c | 4 ++-- + arch/x86/entry/entry_32.S | 17 ++++++++++++++++ + arch/x86/entry/entry_64.S | 16 +++++++++++++++ + arch/x86/include/asm/preempt.h | 31 +++++++++++++++++++++++++++++- + arch/x86/include/asm/thread_info.h | 11 +++++++++++ + arch/x86/kernel/asm-offsets.c | 2 ++ + 7 files changed, 79 insertions(+), 3 deletions(-) + +diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig +index 6ee7220e7f47..7299aeaa7cbb 100644 +--- a/arch/x86/Kconfig ++++ b/arch/x86/Kconfig +@@ -180,6 +180,7 @@ config X86 + select HAVE_HARDLOCKUP_DETECTOR_PERF if PERF_EVENTS && HAVE_PERF_EVENTS_NMI + select HAVE_PERF_REGS + select HAVE_PERF_USER_STACK_DUMP ++ select HAVE_PREEMPT_LAZY + select HAVE_RCU_TABLE_FREE if PARAVIRT + select HAVE_RCU_TABLE_INVALIDATE if HAVE_RCU_TABLE_FREE + select HAVE_REGS_AND_STACK_ACCESS_API +diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c +index 91676b0d2d4c..3b5e41d9b29d 100644 +--- a/arch/x86/entry/common.c ++++ b/arch/x86/entry/common.c +@@ -134,7 +134,7 @@ static long syscall_trace_enter(struct pt_regs *regs) + + #define EXIT_TO_USERMODE_LOOP_FLAGS \ + (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_UPROBE | \ +- _TIF_NEED_RESCHED | _TIF_USER_RETURN_NOTIFY | _TIF_PATCH_PENDING) ++ _TIF_NEED_RESCHED_MASK | _TIF_USER_RETURN_NOTIFY | _TIF_PATCH_PENDING) + + static void exit_to_usermode_loop(struct pt_regs *regs, u32 cached_flags) + { +@@ -149,7 +149,7 @@ static void exit_to_usermode_loop(struct pt_regs *regs, u32 cached_flags) + /* We have work to do. */ + local_irq_enable(); + +- if (cached_flags & _TIF_NEED_RESCHED) ++ if (cached_flags & _TIF_NEED_RESCHED_MASK) + schedule(); + + #ifdef ARCH_RT_DELAYS_SIGNAL_SEND +diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S +index 37d9016d4768..324b7539eaab 100644 +--- a/arch/x86/entry/entry_32.S ++++ b/arch/x86/entry/entry_32.S +@@ -750,8 +750,25 @@ END(ret_from_exception) + ENTRY(resume_kernel) + DISABLE_INTERRUPTS(CLBR_ANY) + .Lneed_resched: ++ # preempt count == 0 + NEED_RS set? + cmpl $0, PER_CPU_VAR(__preempt_count) ++#ifndef CONFIG_PREEMPT_LAZY + jnz restore_all_kernel ++#else ++ jz test_int_off ++ ++ # atleast preempt count == 0 ? ++ cmpl $_PREEMPT_ENABLED,PER_CPU_VAR(__preempt_count) ++ jne restore_all ++ ++ movl PER_CPU_VAR(current_task), %ebp ++ cmpl $0,TASK_TI_preempt_lazy_count(%ebp) # non-zero preempt_lazy_count ? ++ jnz restore_all ++ ++ testl $_TIF_NEED_RESCHED_LAZY, TASK_TI_flags(%ebp) ++ jz restore_all ++ test_int_off: ++#endif + testl $X86_EFLAGS_IF, PT_EFLAGS(%esp) # interrupts off (exception path) ? + jz restore_all_kernel + call preempt_schedule_irq +diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S +index f53d995b1370..94fccaa04bfa 100644 +--- a/arch/x86/entry/entry_64.S ++++ b/arch/x86/entry/entry_64.S +@@ -733,7 +733,23 @@ GLOBAL(swapgs_restore_regs_and_return_to_usermode) + btl $9, EFLAGS(%rsp) /* were interrupts off? */ + jnc 1f + 0: cmpl $0, PER_CPU_VAR(__preempt_count) ++#ifndef CONFIG_PREEMPT_LAZY + jnz 1f ++#else ++ jz do_preempt_schedule_irq ++ ++ # atleast preempt count == 0 ? ++ cmpl $_PREEMPT_ENABLED,PER_CPU_VAR(__preempt_count) ++ jnz 1f ++ ++ movq PER_CPU_VAR(current_task), %rcx ++ cmpl $0, TASK_TI_preempt_lazy_count(%rcx) ++ jnz 1f ++ ++ btl $TIF_NEED_RESCHED_LAZY,TASK_TI_flags(%rcx) ++ jnc 1f ++do_preempt_schedule_irq: ++#endif + call preempt_schedule_irq + jmp 0b + 1: +diff --git a/arch/x86/include/asm/preempt.h b/arch/x86/include/asm/preempt.h +index 7f2dbd91fc74..22992c837795 100644 +--- a/arch/x86/include/asm/preempt.h ++++ b/arch/x86/include/asm/preempt.h +@@ -86,17 +86,46 @@ static __always_inline void __preempt_count_sub(int val) + * a decrement which hits zero means we have no preempt_count and should + * reschedule. + */ +-static __always_inline bool __preempt_count_dec_and_test(void) ++static __always_inline bool ____preempt_count_dec_and_test(void) + { + GEN_UNARY_RMWcc("decl", __preempt_count, __percpu_arg(0), e); + } + ++static __always_inline bool __preempt_count_dec_and_test(void) ++{ ++ if (____preempt_count_dec_and_test()) ++ return true; ++#ifdef CONFIG_PREEMPT_LAZY ++ if (current_thread_info()->preempt_lazy_count) ++ return false; ++ return test_thread_flag(TIF_NEED_RESCHED_LAZY); ++#else ++ return false; ++#endif ++} ++ + /* + * Returns true when we need to resched and can (barring IRQ state). + */ + static __always_inline bool should_resched(int preempt_offset) + { ++#ifdef CONFIG_PREEMPT_LAZY ++ u32 tmp; ++ ++ tmp = raw_cpu_read_4(__preempt_count); ++ if (tmp == preempt_offset) ++ return true; ++ ++ /* preempt count == 0 ? */ ++ tmp &= ~PREEMPT_NEED_RESCHED; ++ if (tmp) ++ return false; ++ if (current_thread_info()->preempt_lazy_count) ++ return false; ++ return test_thread_flag(TIF_NEED_RESCHED_LAZY); ++#else + return unlikely(raw_cpu_read_4(__preempt_count) == preempt_offset); ++#endif + } + + #ifdef CONFIG_PREEMPT +diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h +index b5e4c357523e..d311dc042ddd 100644 +--- a/arch/x86/include/asm/thread_info.h ++++ b/arch/x86/include/asm/thread_info.h +@@ -56,17 +56,24 @@ struct task_struct; + struct thread_info { + unsigned long flags; /* low level flags */ + u32 status; /* thread synchronous flags */ ++ int preempt_lazy_count; /* 0 => lazy preemptable ++ <0 => BUG */ + }; + + #define INIT_THREAD_INFO(tsk) \ + { \ + .flags = 0, \ ++ .preempt_lazy_count = 0, \ + } + + #else /* !__ASSEMBLY__ */ + + #include + ++#define GET_THREAD_INFO(reg) \ ++ _ASM_MOV PER_CPU_VAR(cpu_current_top_of_stack),reg ; \ ++ _ASM_SUB $(THREAD_SIZE),reg ; ++ + #endif + + /* +@@ -91,6 +98,7 @@ struct thread_info { + #define TIF_NOCPUID 15 /* CPUID is not accessible in userland */ + #define TIF_NOTSC 16 /* TSC is not accessible in userland */ + #define TIF_IA32 17 /* IA32 compatibility process */ ++#define TIF_NEED_RESCHED_LAZY 18 /* lazy rescheduling necessary */ + #define TIF_NOHZ 19 /* in adaptive nohz mode */ + #define TIF_MEMDIE 20 /* is terminating due to OOM killer */ + #define TIF_POLLING_NRFLAG 21 /* idle is polling for TIF_NEED_RESCHED */ +@@ -120,6 +128,7 @@ struct thread_info { + #define _TIF_NOCPUID (1 << TIF_NOCPUID) + #define _TIF_NOTSC (1 << TIF_NOTSC) + #define _TIF_IA32 (1 << TIF_IA32) ++#define _TIF_NEED_RESCHED_LAZY (1 << TIF_NEED_RESCHED_LAZY) + #define _TIF_NOHZ (1 << TIF_NOHZ) + #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) + #define _TIF_IO_BITMAP (1 << TIF_IO_BITMAP) +@@ -165,6 +174,8 @@ struct thread_info { + #define _TIF_WORK_CTXSW_PREV (_TIF_WORK_CTXSW|_TIF_USER_RETURN_NOTIFY) + #define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW) + ++#define _TIF_NEED_RESCHED_MASK (_TIF_NEED_RESCHED | _TIF_NEED_RESCHED_LAZY) ++ + #define STACK_WARN (THREAD_SIZE/8) + + /* +diff --git a/arch/x86/kernel/asm-offsets.c b/arch/x86/kernel/asm-offsets.c +index 01de31db300d..ce1c5b9fbd8c 100644 +--- a/arch/x86/kernel/asm-offsets.c ++++ b/arch/x86/kernel/asm-offsets.c +@@ -38,6 +38,7 @@ void common(void) { + + BLANK(); + OFFSET(TASK_TI_flags, task_struct, thread_info.flags); ++ OFFSET(TASK_TI_preempt_lazy_count, task_struct, thread_info.preempt_lazy_count); + OFFSET(TASK_addr_limit, task_struct, thread.addr_limit); + + BLANK(); +@@ -94,6 +95,7 @@ void common(void) { + + BLANK(); + DEFINE(PTREGS_SIZE, sizeof(struct pt_regs)); ++ DEFINE(_PREEMPT_ENABLED, PREEMPT_ENABLED); + + /* TLB state for the entry code */ + OFFSET(TLB_STATE_user_pcid_flush_mask, tlb_state, user_pcid_flush_mask); diff --git a/debian/patches-rt/0239-x86-Support-for-lazy-preemption.patch b/debian/patches-rt/0239-x86-Support-for-lazy-preemption.patch deleted file mode 100644 index a1c901aff..000000000 --- a/debian/patches-rt/0239-x86-Support-for-lazy-preemption.patch +++ /dev/null @@ -1,240 +0,0 @@ -From 0a855342d92f9b1b29ba2616d4d50637087cd955 Mon Sep 17 00:00:00 2001 -From: Thomas Gleixner -Date: Thu, 1 Nov 2012 11:03:47 +0100 -Subject: [PATCH 239/347] x86: Support for lazy preemption -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -Implement the x86 pieces for lazy preempt. - -Signed-off-by: Thomas Gleixner ---- - arch/x86/Kconfig | 1 + - arch/x86/entry/common.c | 4 ++-- - arch/x86/entry/entry_32.S | 17 ++++++++++++++++ - arch/x86/entry/entry_64.S | 16 +++++++++++++++ - arch/x86/include/asm/preempt.h | 31 +++++++++++++++++++++++++++++- - arch/x86/include/asm/thread_info.h | 11 +++++++++++ - arch/x86/kernel/asm-offsets.c | 2 ++ - 7 files changed, 79 insertions(+), 3 deletions(-) - -diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig -index 6ee7220e7f47..7299aeaa7cbb 100644 ---- a/arch/x86/Kconfig -+++ b/arch/x86/Kconfig -@@ -180,6 +180,7 @@ config X86 - select HAVE_HARDLOCKUP_DETECTOR_PERF if PERF_EVENTS && HAVE_PERF_EVENTS_NMI - select HAVE_PERF_REGS - select HAVE_PERF_USER_STACK_DUMP -+ select HAVE_PREEMPT_LAZY - select HAVE_RCU_TABLE_FREE if PARAVIRT - select HAVE_RCU_TABLE_INVALIDATE if HAVE_RCU_TABLE_FREE - select HAVE_REGS_AND_STACK_ACCESS_API -diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c -index 91676b0d2d4c..3b5e41d9b29d 100644 ---- a/arch/x86/entry/common.c -+++ b/arch/x86/entry/common.c -@@ -134,7 +134,7 @@ static long syscall_trace_enter(struct pt_regs *regs) - - #define EXIT_TO_USERMODE_LOOP_FLAGS \ - (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_UPROBE | \ -- _TIF_NEED_RESCHED | _TIF_USER_RETURN_NOTIFY | _TIF_PATCH_PENDING) -+ _TIF_NEED_RESCHED_MASK | _TIF_USER_RETURN_NOTIFY | _TIF_PATCH_PENDING) - - static void exit_to_usermode_loop(struct pt_regs *regs, u32 cached_flags) - { -@@ -149,7 +149,7 @@ static void exit_to_usermode_loop(struct pt_regs *regs, u32 cached_flags) - /* We have work to do. */ - local_irq_enable(); - -- if (cached_flags & _TIF_NEED_RESCHED) -+ if (cached_flags & _TIF_NEED_RESCHED_MASK) - schedule(); - - #ifdef ARCH_RT_DELAYS_SIGNAL_SEND -diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S -index 37d9016d4768..324b7539eaab 100644 ---- a/arch/x86/entry/entry_32.S -+++ b/arch/x86/entry/entry_32.S -@@ -750,8 +750,25 @@ END(ret_from_exception) - ENTRY(resume_kernel) - DISABLE_INTERRUPTS(CLBR_ANY) - .Lneed_resched: -+ # preempt count == 0 + NEED_RS set? - cmpl $0, PER_CPU_VAR(__preempt_count) -+#ifndef CONFIG_PREEMPT_LAZY - jnz restore_all_kernel -+#else -+ jz test_int_off -+ -+ # atleast preempt count == 0 ? -+ cmpl $_PREEMPT_ENABLED,PER_CPU_VAR(__preempt_count) -+ jne restore_all -+ -+ movl PER_CPU_VAR(current_task), %ebp -+ cmpl $0,TASK_TI_preempt_lazy_count(%ebp) # non-zero preempt_lazy_count ? -+ jnz restore_all -+ -+ testl $_TIF_NEED_RESCHED_LAZY, TASK_TI_flags(%ebp) -+ jz restore_all -+ test_int_off: -+#endif - testl $X86_EFLAGS_IF, PT_EFLAGS(%esp) # interrupts off (exception path) ? - jz restore_all_kernel - call preempt_schedule_irq -diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S -index f53d995b1370..94fccaa04bfa 100644 ---- a/arch/x86/entry/entry_64.S -+++ b/arch/x86/entry/entry_64.S -@@ -733,7 +733,23 @@ GLOBAL(swapgs_restore_regs_and_return_to_usermode) - btl $9, EFLAGS(%rsp) /* were interrupts off? */ - jnc 1f - 0: cmpl $0, PER_CPU_VAR(__preempt_count) -+#ifndef CONFIG_PREEMPT_LAZY - jnz 1f -+#else -+ jz do_preempt_schedule_irq -+ -+ # atleast preempt count == 0 ? -+ cmpl $_PREEMPT_ENABLED,PER_CPU_VAR(__preempt_count) -+ jnz 1f -+ -+ movq PER_CPU_VAR(current_task), %rcx -+ cmpl $0, TASK_TI_preempt_lazy_count(%rcx) -+ jnz 1f -+ -+ btl $TIF_NEED_RESCHED_LAZY,TASK_TI_flags(%rcx) -+ jnc 1f -+do_preempt_schedule_irq: -+#endif - call preempt_schedule_irq - jmp 0b - 1: -diff --git a/arch/x86/include/asm/preempt.h b/arch/x86/include/asm/preempt.h -index 7f2dbd91fc74..22992c837795 100644 ---- a/arch/x86/include/asm/preempt.h -+++ b/arch/x86/include/asm/preempt.h -@@ -86,17 +86,46 @@ static __always_inline void __preempt_count_sub(int val) - * a decrement which hits zero means we have no preempt_count and should - * reschedule. - */ --static __always_inline bool __preempt_count_dec_and_test(void) -+static __always_inline bool ____preempt_count_dec_and_test(void) - { - GEN_UNARY_RMWcc("decl", __preempt_count, __percpu_arg(0), e); - } - -+static __always_inline bool __preempt_count_dec_and_test(void) -+{ -+ if (____preempt_count_dec_and_test()) -+ return true; -+#ifdef CONFIG_PREEMPT_LAZY -+ if (current_thread_info()->preempt_lazy_count) -+ return false; -+ return test_thread_flag(TIF_NEED_RESCHED_LAZY); -+#else -+ return false; -+#endif -+} -+ - /* - * Returns true when we need to resched and can (barring IRQ state). - */ - static __always_inline bool should_resched(int preempt_offset) - { -+#ifdef CONFIG_PREEMPT_LAZY -+ u32 tmp; -+ -+ tmp = raw_cpu_read_4(__preempt_count); -+ if (tmp == preempt_offset) -+ return true; -+ -+ /* preempt count == 0 ? */ -+ tmp &= ~PREEMPT_NEED_RESCHED; -+ if (tmp) -+ return false; -+ if (current_thread_info()->preempt_lazy_count) -+ return false; -+ return test_thread_flag(TIF_NEED_RESCHED_LAZY); -+#else - return unlikely(raw_cpu_read_4(__preempt_count) == preempt_offset); -+#endif - } - - #ifdef CONFIG_PREEMPT -diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h -index b5e4c357523e..d311dc042ddd 100644 ---- a/arch/x86/include/asm/thread_info.h -+++ b/arch/x86/include/asm/thread_info.h -@@ -56,17 +56,24 @@ struct task_struct; - struct thread_info { - unsigned long flags; /* low level flags */ - u32 status; /* thread synchronous flags */ -+ int preempt_lazy_count; /* 0 => lazy preemptable -+ <0 => BUG */ - }; - - #define INIT_THREAD_INFO(tsk) \ - { \ - .flags = 0, \ -+ .preempt_lazy_count = 0, \ - } - - #else /* !__ASSEMBLY__ */ - - #include - -+#define GET_THREAD_INFO(reg) \ -+ _ASM_MOV PER_CPU_VAR(cpu_current_top_of_stack),reg ; \ -+ _ASM_SUB $(THREAD_SIZE),reg ; -+ - #endif - - /* -@@ -91,6 +98,7 @@ struct thread_info { - #define TIF_NOCPUID 15 /* CPUID is not accessible in userland */ - #define TIF_NOTSC 16 /* TSC is not accessible in userland */ - #define TIF_IA32 17 /* IA32 compatibility process */ -+#define TIF_NEED_RESCHED_LAZY 18 /* lazy rescheduling necessary */ - #define TIF_NOHZ 19 /* in adaptive nohz mode */ - #define TIF_MEMDIE 20 /* is terminating due to OOM killer */ - #define TIF_POLLING_NRFLAG 21 /* idle is polling for TIF_NEED_RESCHED */ -@@ -120,6 +128,7 @@ struct thread_info { - #define _TIF_NOCPUID (1 << TIF_NOCPUID) - #define _TIF_NOTSC (1 << TIF_NOTSC) - #define _TIF_IA32 (1 << TIF_IA32) -+#define _TIF_NEED_RESCHED_LAZY (1 << TIF_NEED_RESCHED_LAZY) - #define _TIF_NOHZ (1 << TIF_NOHZ) - #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) - #define _TIF_IO_BITMAP (1 << TIF_IO_BITMAP) -@@ -165,6 +174,8 @@ struct thread_info { - #define _TIF_WORK_CTXSW_PREV (_TIF_WORK_CTXSW|_TIF_USER_RETURN_NOTIFY) - #define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW) - -+#define _TIF_NEED_RESCHED_MASK (_TIF_NEED_RESCHED | _TIF_NEED_RESCHED_LAZY) -+ - #define STACK_WARN (THREAD_SIZE/8) - - /* -diff --git a/arch/x86/kernel/asm-offsets.c b/arch/x86/kernel/asm-offsets.c -index 01de31db300d..ce1c5b9fbd8c 100644 ---- a/arch/x86/kernel/asm-offsets.c -+++ b/arch/x86/kernel/asm-offsets.c -@@ -38,6 +38,7 @@ void common(void) { - - BLANK(); - OFFSET(TASK_TI_flags, task_struct, thread_info.flags); -+ OFFSET(TASK_TI_preempt_lazy_count, task_struct, thread_info.preempt_lazy_count); - OFFSET(TASK_addr_limit, task_struct, thread.addr_limit); - - BLANK(); -@@ -94,6 +95,7 @@ void common(void) { - - BLANK(); - DEFINE(PTREGS_SIZE, sizeof(struct pt_regs)); -+ DEFINE(_PREEMPT_ENABLED, PREEMPT_ENABLED); - - /* TLB state for the entry code */ - OFFSET(TLB_STATE_user_pcid_flush_mask, tlb_state, user_pcid_flush_mask); --- -2.36.1 - diff --git a/debian/patches-rt/0239-x86-lazy-preempt-properly-check-against-preempt-mask.patch b/debian/patches-rt/0239-x86-lazy-preempt-properly-check-against-preempt-mask.patch new file mode 100644 index 000000000..2c287d8e1 --- /dev/null +++ b/debian/patches-rt/0239-x86-lazy-preempt-properly-check-against-preempt-mask.patch @@ -0,0 +1,29 @@ +From: Sebastian Andrzej Siewior +Date: Mon, 18 Feb 2019 16:57:09 +0100 +Subject: [PATCH 239/342] x86: lazy-preempt: properly check against + preempt-mask +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=62de1107905ffc4ce432b5192aa4e86cba2ea98b + +should_resched() should check against preempt_offset after unmasking the +need-resched-bit. Otherwise should_resched() won't work for +preempt_offset != 0 and lazy-preempt set. + +Cc: stable-rt@vger.kernel.org +Signed-off-by: Sebastian Andrzej Siewior +--- + arch/x86/include/asm/preempt.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/x86/include/asm/preempt.h b/arch/x86/include/asm/preempt.h +index 22992c837795..f66708779274 100644 +--- a/arch/x86/include/asm/preempt.h ++++ b/arch/x86/include/asm/preempt.h +@@ -118,7 +118,7 @@ static __always_inline bool should_resched(int preempt_offset) + + /* preempt count == 0 ? */ + tmp &= ~PREEMPT_NEED_RESCHED; +- if (tmp) ++ if (tmp != preempt_offset) + return false; + if (current_thread_info()->preempt_lazy_count) + return false; diff --git a/debian/patches-rt/0240-x86-lazy-preempt-properly-check-against-preempt-mask.patch b/debian/patches-rt/0240-x86-lazy-preempt-properly-check-against-preempt-mask.patch deleted file mode 100644 index df8346c2d..000000000 --- a/debian/patches-rt/0240-x86-lazy-preempt-properly-check-against-preempt-mask.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 87b957ebbe16c81c7a72161e8d1ab55d0746bd83 Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Mon, 18 Feb 2019 16:57:09 +0100 -Subject: [PATCH 240/347] x86: lazy-preempt: properly check against - preempt-mask -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -should_resched() should check against preempt_offset after unmasking the -need-resched-bit. Otherwise should_resched() won't work for -preempt_offset != 0 and lazy-preempt set. - -Cc: stable-rt@vger.kernel.org -Signed-off-by: Sebastian Andrzej Siewior ---- - arch/x86/include/asm/preempt.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/arch/x86/include/asm/preempt.h b/arch/x86/include/asm/preempt.h -index 22992c837795..f66708779274 100644 ---- a/arch/x86/include/asm/preempt.h -+++ b/arch/x86/include/asm/preempt.h -@@ -118,7 +118,7 @@ static __always_inline bool should_resched(int preempt_offset) - - /* preempt count == 0 ? */ - tmp &= ~PREEMPT_NEED_RESCHED; -- if (tmp) -+ if (tmp != preempt_offset) - return false; - if (current_thread_info()->preempt_lazy_count) - return false; --- -2.36.1 - diff --git a/debian/patches-rt/0240-x86-lazy-preempt-use-proper-return-label-on-32bit-x8.patch b/debian/patches-rt/0240-x86-lazy-preempt-use-proper-return-label-on-32bit-x8.patch new file mode 100644 index 000000000..2d6a1424f --- /dev/null +++ b/debian/patches-rt/0240-x86-lazy-preempt-use-proper-return-label-on-32bit-x8.patch @@ -0,0 +1,41 @@ +From: Sebastian Andrzej Siewior +Date: Tue, 26 Feb 2019 14:53:49 +0100 +Subject: [PATCH 240/342] x86: lazy-preempt: use proper return label on + 32bit-x86 +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=af7aacae59cd66ea1a797fb9f9e333423d3d7c71 + +The lazy-preempt uses the wrong return label in case preemption isn't +possible. This results crash while returning to the kernel. + +Use the correct return label if preemption isn' possible. + +Reported-by: Andri Yngvason +Signed-off-by: Sebastian Andrzej Siewior +--- + arch/x86/entry/entry_32.S | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S +index 324b7539eaab..d8b40085c2b8 100644 +--- a/arch/x86/entry/entry_32.S ++++ b/arch/x86/entry/entry_32.S +@@ -759,15 +759,15 @@ ENTRY(resume_kernel) + + # atleast preempt count == 0 ? + cmpl $_PREEMPT_ENABLED,PER_CPU_VAR(__preempt_count) +- jne restore_all ++ jne restore_all_kernel + + movl PER_CPU_VAR(current_task), %ebp + cmpl $0,TASK_TI_preempt_lazy_count(%ebp) # non-zero preempt_lazy_count ? +- jnz restore_all ++ jnz restore_all_kernel + + testl $_TIF_NEED_RESCHED_LAZY, TASK_TI_flags(%ebp) +- jz restore_all +- test_int_off: ++ jz restore_all_kernel ++test_int_off: + #endif + testl $X86_EFLAGS_IF, PT_EFLAGS(%esp) # interrupts off (exception path) ? + jz restore_all_kernel diff --git a/debian/patches-rt/0241-arm-Add-support-for-lazy-preemption.patch b/debian/patches-rt/0241-arm-Add-support-for-lazy-preemption.patch new file mode 100644 index 000000000..477fe5af0 --- /dev/null +++ b/debian/patches-rt/0241-arm-Add-support-for-lazy-preemption.patch @@ -0,0 +1,164 @@ +From: Thomas Gleixner +Date: Wed, 31 Oct 2012 12:04:11 +0100 +Subject: [PATCH 241/342] arm: Add support for lazy preemption +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=33e85292f4a1b6620af83c5904889dfba4732126 + +Implement the arm pieces for lazy preempt. + +Signed-off-by: Thomas Gleixner +--- + arch/arm/Kconfig | 1 + + arch/arm/include/asm/thread_info.h | 8 ++++++-- + arch/arm/kernel/asm-offsets.c | 1 + + arch/arm/kernel/entry-armv.S | 19 ++++++++++++++++--- + arch/arm/kernel/entry-common.S | 9 +++++++-- + arch/arm/kernel/signal.c | 3 ++- + 6 files changed, 33 insertions(+), 8 deletions(-) + +diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig +index ec99422059e3..2607cae04885 100644 +--- a/arch/arm/Kconfig ++++ b/arch/arm/Kconfig +@@ -91,6 +91,7 @@ config ARM + select HAVE_PERF_EVENTS + select HAVE_PERF_REGS + select HAVE_PERF_USER_STACK_DUMP ++ select HAVE_PREEMPT_LAZY + select HAVE_RCU_TABLE_FREE if (SMP && ARM_LPAE) + select HAVE_REGS_AND_STACK_ACCESS_API + select HAVE_RSEQ +diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h +index 8f55dc520a3e..4f834bfca470 100644 +--- a/arch/arm/include/asm/thread_info.h ++++ b/arch/arm/include/asm/thread_info.h +@@ -49,6 +49,7 @@ struct cpu_context_save { + struct thread_info { + unsigned long flags; /* low level flags */ + int preempt_count; /* 0 => preemptable, <0 => bug */ ++ int preempt_lazy_count; /* 0 => preemptable, <0 => bug */ + mm_segment_t addr_limit; /* address limit */ + struct task_struct *task; /* main task structure */ + __u32 cpu; /* cpu */ +@@ -139,7 +140,8 @@ extern int vfp_restore_user_hwstate(struct user_vfp *, + #define TIF_SYSCALL_TRACE 4 /* syscall trace active */ + #define TIF_SYSCALL_AUDIT 5 /* syscall auditing active */ + #define TIF_SYSCALL_TRACEPOINT 6 /* syscall tracepoint instrumentation */ +-#define TIF_SECCOMP 7 /* seccomp syscall filtering active */ ++#define TIF_SECCOMP 8 /* seccomp syscall filtering active */ ++#define TIF_NEED_RESCHED_LAZY 7 + + #define TIF_NOHZ 12 /* in adaptive nohz mode */ + #define TIF_USING_IWMMXT 17 +@@ -149,6 +151,7 @@ extern int vfp_restore_user_hwstate(struct user_vfp *, + #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) + #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) + #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) ++#define _TIF_NEED_RESCHED_LAZY (1 << TIF_NEED_RESCHED_LAZY) + #define _TIF_UPROBE (1 << TIF_UPROBE) + #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) + #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) +@@ -164,7 +167,8 @@ extern int vfp_restore_user_hwstate(struct user_vfp *, + * Change these and you break ASM code in entry-common.S + */ + #define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \ +- _TIF_NOTIFY_RESUME | _TIF_UPROBE) ++ _TIF_NOTIFY_RESUME | _TIF_UPROBE | \ ++ _TIF_NEED_RESCHED_LAZY) + + #endif /* __KERNEL__ */ + #endif /* __ASM_ARM_THREAD_INFO_H */ +diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c +index 40afe953a0e2..d634d6f36140 100644 +--- a/arch/arm/kernel/asm-offsets.c ++++ b/arch/arm/kernel/asm-offsets.c +@@ -58,6 +58,7 @@ int main(void) + BLANK(); + DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); + DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count)); ++ DEFINE(TI_PREEMPT_LAZY, offsetof(struct thread_info, preempt_lazy_count)); + DEFINE(TI_ADDR_LIMIT, offsetof(struct thread_info, addr_limit)); + DEFINE(TI_TASK, offsetof(struct thread_info, task)); + DEFINE(TI_CPU, offsetof(struct thread_info, cpu)); +diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S +index d779cd1a3b0c..dc7ae3d8e62f 100644 +--- a/arch/arm/kernel/entry-armv.S ++++ b/arch/arm/kernel/entry-armv.S +@@ -209,11 +209,18 @@ ENDPROC(__dabt_svc) + + #ifdef CONFIG_PREEMPT + ldr r8, [tsk, #TI_PREEMPT] @ get preempt count +- ldr r0, [tsk, #TI_FLAGS] @ get flags + teq r8, #0 @ if preempt count != 0 ++ bne 1f @ return from exeption ++ ldr r0, [tsk, #TI_FLAGS] @ get flags ++ tst r0, #_TIF_NEED_RESCHED @ if NEED_RESCHED is set ++ blne svc_preempt @ preempt! ++ ++ ldr r8, [tsk, #TI_PREEMPT_LAZY] @ get preempt lazy count ++ teq r8, #0 @ if preempt lazy count != 0 + movne r0, #0 @ force flags to 0 +- tst r0, #_TIF_NEED_RESCHED ++ tst r0, #_TIF_NEED_RESCHED_LAZY + blne svc_preempt ++1: + #endif + + svc_exit r5, irq = 1 @ return from exception +@@ -228,8 +235,14 @@ ENDPROC(__irq_svc) + 1: bl preempt_schedule_irq @ irq en/disable is done inside + ldr r0, [tsk, #TI_FLAGS] @ get new tasks TI_FLAGS + tst r0, #_TIF_NEED_RESCHED ++ bne 1b ++ tst r0, #_TIF_NEED_RESCHED_LAZY + reteq r8 @ go again +- b 1b ++ ldr r0, [tsk, #TI_PREEMPT_LAZY] @ get preempt lazy count ++ teq r0, #0 @ if preempt lazy count != 0 ++ beq 1b ++ ret r8 @ go again ++ + #endif + + __und_fault: +diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S +index e27fc2df5231..bc326519f648 100644 +--- a/arch/arm/kernel/entry-common.S ++++ b/arch/arm/kernel/entry-common.S +@@ -56,7 +56,9 @@ saved_pc .req lr + cmp r2, #TASK_SIZE + blne addr_limit_check_failed + ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing +- tst r1, #_TIF_SYSCALL_WORK | _TIF_WORK_MASK ++ tst r1, #((_TIF_SYSCALL_WORK | _TIF_WORK_MASK) & ~_TIF_SECCOMP) ++ bne fast_work_pending ++ tst r1, #_TIF_SECCOMP + bne fast_work_pending + + +@@ -93,8 +95,11 @@ ENDPROC(ret_fast_syscall) + cmp r2, #TASK_SIZE + blne addr_limit_check_failed + ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing +- tst r1, #_TIF_SYSCALL_WORK | _TIF_WORK_MASK ++ tst r1, #((_TIF_SYSCALL_WORK | _TIF_WORK_MASK) & ~_TIF_SECCOMP) ++ bne do_slower_path ++ tst r1, #_TIF_SECCOMP + beq no_work_pending ++do_slower_path: + UNWIND(.fnend ) + ENDPROC(ret_fast_syscall) + +diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c +index 1c01358b9b6d..263b0321dc50 100644 +--- a/arch/arm/kernel/signal.c ++++ b/arch/arm/kernel/signal.c +@@ -652,7 +652,8 @@ do_work_pending(struct pt_regs *regs, unsigned int thread_flags, int syscall) + */ + trace_hardirqs_off(); + do { +- if (likely(thread_flags & _TIF_NEED_RESCHED)) { ++ if (likely(thread_flags & (_TIF_NEED_RESCHED | ++ _TIF_NEED_RESCHED_LAZY))) { + schedule(); + } else { + if (unlikely(!user_mode(regs))) diff --git a/debian/patches-rt/0241-x86-lazy-preempt-use-proper-return-label-on-32bit-x8.patch b/debian/patches-rt/0241-x86-lazy-preempt-use-proper-return-label-on-32bit-x8.patch deleted file mode 100644 index 430b7295c..000000000 --- a/debian/patches-rt/0241-x86-lazy-preempt-use-proper-return-label-on-32bit-x8.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 6f0e27cbe8c66801cdad07e48be779eff3301cc1 Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Tue, 26 Feb 2019 14:53:49 +0100 -Subject: [PATCH 241/347] x86: lazy-preempt: use proper return label on - 32bit-x86 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -The lazy-preempt uses the wrong return label in case preemption isn't -possible. This results crash while returning to the kernel. - -Use the correct return label if preemption isn' possible. - -Reported-by: Andri Yngvason -Signed-off-by: Sebastian Andrzej Siewior ---- - arch/x86/entry/entry_32.S | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S -index 324b7539eaab..d8b40085c2b8 100644 ---- a/arch/x86/entry/entry_32.S -+++ b/arch/x86/entry/entry_32.S -@@ -759,15 +759,15 @@ ENTRY(resume_kernel) - - # atleast preempt count == 0 ? - cmpl $_PREEMPT_ENABLED,PER_CPU_VAR(__preempt_count) -- jne restore_all -+ jne restore_all_kernel - - movl PER_CPU_VAR(current_task), %ebp - cmpl $0,TASK_TI_preempt_lazy_count(%ebp) # non-zero preempt_lazy_count ? -- jnz restore_all -+ jnz restore_all_kernel - - testl $_TIF_NEED_RESCHED_LAZY, TASK_TI_flags(%ebp) -- jz restore_all -- test_int_off: -+ jz restore_all_kernel -+test_int_off: - #endif - testl $X86_EFLAGS_IF, PT_EFLAGS(%esp) # interrupts off (exception path) ? - jz restore_all_kernel --- -2.36.1 - diff --git a/debian/patches-rt/0242-arm-Add-support-for-lazy-preemption.patch b/debian/patches-rt/0242-arm-Add-support-for-lazy-preemption.patch deleted file mode 100644 index af7fd9bc3..000000000 --- a/debian/patches-rt/0242-arm-Add-support-for-lazy-preemption.patch +++ /dev/null @@ -1,168 +0,0 @@ -From 3845cb2e5f05561da9e363932c9373f45b5fa6a4 Mon Sep 17 00:00:00 2001 -From: Thomas Gleixner -Date: Wed, 31 Oct 2012 12:04:11 +0100 -Subject: [PATCH 242/347] arm: Add support for lazy preemption -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -Implement the arm pieces for lazy preempt. - -Signed-off-by: Thomas Gleixner ---- - arch/arm/Kconfig | 1 + - arch/arm/include/asm/thread_info.h | 8 ++++++-- - arch/arm/kernel/asm-offsets.c | 1 + - arch/arm/kernel/entry-armv.S | 19 ++++++++++++++++--- - arch/arm/kernel/entry-common.S | 9 +++++++-- - arch/arm/kernel/signal.c | 3 ++- - 6 files changed, 33 insertions(+), 8 deletions(-) - -diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig -index ec99422059e3..2607cae04885 100644 ---- a/arch/arm/Kconfig -+++ b/arch/arm/Kconfig -@@ -91,6 +91,7 @@ config ARM - select HAVE_PERF_EVENTS - select HAVE_PERF_REGS - select HAVE_PERF_USER_STACK_DUMP -+ select HAVE_PREEMPT_LAZY - select HAVE_RCU_TABLE_FREE if (SMP && ARM_LPAE) - select HAVE_REGS_AND_STACK_ACCESS_API - select HAVE_RSEQ -diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h -index 8f55dc520a3e..4f834bfca470 100644 ---- a/arch/arm/include/asm/thread_info.h -+++ b/arch/arm/include/asm/thread_info.h -@@ -49,6 +49,7 @@ struct cpu_context_save { - struct thread_info { - unsigned long flags; /* low level flags */ - int preempt_count; /* 0 => preemptable, <0 => bug */ -+ int preempt_lazy_count; /* 0 => preemptable, <0 => bug */ - mm_segment_t addr_limit; /* address limit */ - struct task_struct *task; /* main task structure */ - __u32 cpu; /* cpu */ -@@ -139,7 +140,8 @@ extern int vfp_restore_user_hwstate(struct user_vfp *, - #define TIF_SYSCALL_TRACE 4 /* syscall trace active */ - #define TIF_SYSCALL_AUDIT 5 /* syscall auditing active */ - #define TIF_SYSCALL_TRACEPOINT 6 /* syscall tracepoint instrumentation */ --#define TIF_SECCOMP 7 /* seccomp syscall filtering active */ -+#define TIF_SECCOMP 8 /* seccomp syscall filtering active */ -+#define TIF_NEED_RESCHED_LAZY 7 - - #define TIF_NOHZ 12 /* in adaptive nohz mode */ - #define TIF_USING_IWMMXT 17 -@@ -149,6 +151,7 @@ extern int vfp_restore_user_hwstate(struct user_vfp *, - #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) - #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) - #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) -+#define _TIF_NEED_RESCHED_LAZY (1 << TIF_NEED_RESCHED_LAZY) - #define _TIF_UPROBE (1 << TIF_UPROBE) - #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) - #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) -@@ -164,7 +167,8 @@ extern int vfp_restore_user_hwstate(struct user_vfp *, - * Change these and you break ASM code in entry-common.S - */ - #define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \ -- _TIF_NOTIFY_RESUME | _TIF_UPROBE) -+ _TIF_NOTIFY_RESUME | _TIF_UPROBE | \ -+ _TIF_NEED_RESCHED_LAZY) - - #endif /* __KERNEL__ */ - #endif /* __ASM_ARM_THREAD_INFO_H */ -diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c -index 40afe953a0e2..d634d6f36140 100644 ---- a/arch/arm/kernel/asm-offsets.c -+++ b/arch/arm/kernel/asm-offsets.c -@@ -58,6 +58,7 @@ int main(void) - BLANK(); - DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); - DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count)); -+ DEFINE(TI_PREEMPT_LAZY, offsetof(struct thread_info, preempt_lazy_count)); - DEFINE(TI_ADDR_LIMIT, offsetof(struct thread_info, addr_limit)); - DEFINE(TI_TASK, offsetof(struct thread_info, task)); - DEFINE(TI_CPU, offsetof(struct thread_info, cpu)); -diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S -index d779cd1a3b0c..dc7ae3d8e62f 100644 ---- a/arch/arm/kernel/entry-armv.S -+++ b/arch/arm/kernel/entry-armv.S -@@ -209,11 +209,18 @@ ENDPROC(__dabt_svc) - - #ifdef CONFIG_PREEMPT - ldr r8, [tsk, #TI_PREEMPT] @ get preempt count -- ldr r0, [tsk, #TI_FLAGS] @ get flags - teq r8, #0 @ if preempt count != 0 -+ bne 1f @ return from exeption -+ ldr r0, [tsk, #TI_FLAGS] @ get flags -+ tst r0, #_TIF_NEED_RESCHED @ if NEED_RESCHED is set -+ blne svc_preempt @ preempt! -+ -+ ldr r8, [tsk, #TI_PREEMPT_LAZY] @ get preempt lazy count -+ teq r8, #0 @ if preempt lazy count != 0 - movne r0, #0 @ force flags to 0 -- tst r0, #_TIF_NEED_RESCHED -+ tst r0, #_TIF_NEED_RESCHED_LAZY - blne svc_preempt -+1: - #endif - - svc_exit r5, irq = 1 @ return from exception -@@ -228,8 +235,14 @@ ENDPROC(__irq_svc) - 1: bl preempt_schedule_irq @ irq en/disable is done inside - ldr r0, [tsk, #TI_FLAGS] @ get new tasks TI_FLAGS - tst r0, #_TIF_NEED_RESCHED -+ bne 1b -+ tst r0, #_TIF_NEED_RESCHED_LAZY - reteq r8 @ go again -- b 1b -+ ldr r0, [tsk, #TI_PREEMPT_LAZY] @ get preempt lazy count -+ teq r0, #0 @ if preempt lazy count != 0 -+ beq 1b -+ ret r8 @ go again -+ - #endif - - __und_fault: -diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S -index e27fc2df5231..bc326519f648 100644 ---- a/arch/arm/kernel/entry-common.S -+++ b/arch/arm/kernel/entry-common.S -@@ -56,7 +56,9 @@ saved_pc .req lr - cmp r2, #TASK_SIZE - blne addr_limit_check_failed - ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing -- tst r1, #_TIF_SYSCALL_WORK | _TIF_WORK_MASK -+ tst r1, #((_TIF_SYSCALL_WORK | _TIF_WORK_MASK) & ~_TIF_SECCOMP) -+ bne fast_work_pending -+ tst r1, #_TIF_SECCOMP - bne fast_work_pending - - -@@ -93,8 +95,11 @@ ENDPROC(ret_fast_syscall) - cmp r2, #TASK_SIZE - blne addr_limit_check_failed - ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing -- tst r1, #_TIF_SYSCALL_WORK | _TIF_WORK_MASK -+ tst r1, #((_TIF_SYSCALL_WORK | _TIF_WORK_MASK) & ~_TIF_SECCOMP) -+ bne do_slower_path -+ tst r1, #_TIF_SECCOMP - beq no_work_pending -+do_slower_path: - UNWIND(.fnend ) - ENDPROC(ret_fast_syscall) - -diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c -index 1c01358b9b6d..263b0321dc50 100644 ---- a/arch/arm/kernel/signal.c -+++ b/arch/arm/kernel/signal.c -@@ -652,7 +652,8 @@ do_work_pending(struct pt_regs *regs, unsigned int thread_flags, int syscall) - */ - trace_hardirqs_off(); - do { -- if (likely(thread_flags & _TIF_NEED_RESCHED)) { -+ if (likely(thread_flags & (_TIF_NEED_RESCHED | -+ _TIF_NEED_RESCHED_LAZY))) { - schedule(); - } else { - if (unlikely(!user_mode(regs))) --- -2.36.1 - diff --git a/debian/patches-rt/0242-powerpc-Add-support-for-lazy-preemption.patch b/debian/patches-rt/0242-powerpc-Add-support-for-lazy-preemption.patch new file mode 100644 index 000000000..45e464dee --- /dev/null +++ b/debian/patches-rt/0242-powerpc-Add-support-for-lazy-preemption.patch @@ -0,0 +1,192 @@ +From: Thomas Gleixner +Date: Thu, 1 Nov 2012 10:14:11 +0100 +Subject: [PATCH 242/342] powerpc: Add support for lazy preemption +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=807f60d61d5538e5acc319218a368950deb6fcdf + +Implement the powerpc pieces for lazy preempt. + +Signed-off-by: Thomas Gleixner +--- + arch/powerpc/Kconfig | 1 + + arch/powerpc/include/asm/thread_info.h | 9 +++++++-- + arch/powerpc/kernel/asm-offsets.c | 1 + + arch/powerpc/kernel/entry_32.S | 17 ++++++++++++----- + arch/powerpc/kernel/entry_64.S | 16 ++++++++++++---- + 5 files changed, 33 insertions(+), 11 deletions(-) + +diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig +index f4517f4be192..4536d047cdff 100644 +--- a/arch/powerpc/Kconfig ++++ b/arch/powerpc/Kconfig +@@ -217,6 +217,7 @@ config PPC + select HAVE_HARDLOCKUP_DETECTOR_PERF if PERF_EVENTS && HAVE_PERF_EVENTS_NMI && !HAVE_HARDLOCKUP_DETECTOR_ARCH + select HAVE_PERF_REGS + select HAVE_PERF_USER_STACK_DUMP ++ select HAVE_PREEMPT_LAZY + select HAVE_RCU_TABLE_FREE if SMP + select HAVE_REGS_AND_STACK_ACCESS_API + select HAVE_RELIABLE_STACKTRACE if PPC64 && CPU_LITTLE_ENDIAN +diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h +index 3c0002044bc9..ce316076bc52 100644 +--- a/arch/powerpc/include/asm/thread_info.h ++++ b/arch/powerpc/include/asm/thread_info.h +@@ -37,6 +37,8 @@ struct thread_info { + int cpu; /* cpu we're on */ + int preempt_count; /* 0 => preemptable, + <0 => BUG */ ++ int preempt_lazy_count; /* 0 => preemptable, ++ <0 => BUG */ + unsigned long local_flags; /* private flags for thread */ + #ifdef CONFIG_LIVEPATCH + unsigned long *livepatch_sp; +@@ -81,7 +83,7 @@ extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src + #define TIF_SIGPENDING 1 /* signal pending */ + #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ + #define TIF_FSCHECK 3 /* Check FS is USER_DS on return */ +-#define TIF_32BIT 4 /* 32 bit binary */ ++#define TIF_NEED_RESCHED_LAZY 4 /* lazy rescheduling necessary */ + #define TIF_RESTORE_TM 5 /* need to restore TM FP/VEC/VSX */ + #define TIF_PATCH_PENDING 6 /* pending live patching update */ + #define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */ +@@ -100,6 +102,7 @@ extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src + #define TIF_ELF2ABI 18 /* function descriptors must die! */ + #endif + #define TIF_POLLING_NRFLAG 19 /* true if poll_idle() is polling TIF_NEED_RESCHED */ ++#define TIF_32BIT 20 /* 32 bit binary */ + + /* as above, but as bit values */ + #define _TIF_SYSCALL_TRACE (1< +Date: Thu, 14 May 2015 17:52:17 +0200 +Subject: [PATCH 243/342] arch/arm64: Add lazy preempt support +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=d78ec4a3e861e9c07b84fa323cfd72f647808a23 + +arm64 is missing support for PREEMPT_RT. The main feature which is +lacking is support for lazy preemption. The arch-specific entry code, +thread information structure definitions, and associated data tables +have to be extended to provide this support. Then the Kconfig file has +to be extended to indicate the support is available, and also to +indicate that support for full RT preemption is now available. + +Signed-off-by: Anders Roxell +--- + arch/arm64/Kconfig | 1 + + arch/arm64/include/asm/thread_info.h | 6 +++++- + arch/arm64/kernel/asm-offsets.c | 1 + + arch/arm64/kernel/entry.S | 12 +++++++++--- + arch/arm64/kernel/signal.c | 2 +- + 5 files changed, 17 insertions(+), 5 deletions(-) + +diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig +index a101f5d2fbed..84f53dc1a75b 100644 +--- a/arch/arm64/Kconfig ++++ b/arch/arm64/Kconfig +@@ -141,6 +141,7 @@ config ARM64 + select HAVE_PERF_EVENTS + select HAVE_PERF_REGS + select HAVE_PERF_USER_STACK_DUMP ++ select HAVE_PREEMPT_LAZY + select HAVE_REGS_AND_STACK_ACCESS_API + select HAVE_RCU_TABLE_FREE + select HAVE_RSEQ +diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h +index 69ac5262cccd..39e921817f28 100644 +--- a/arch/arm64/include/asm/thread_info.h ++++ b/arch/arm64/include/asm/thread_info.h +@@ -43,6 +43,7 @@ struct thread_info { + u64 ttbr0; /* saved TTBR0_EL1 */ + #endif + int preempt_count; /* 0 => preemptable, <0 => bug */ ++ int preempt_lazy_count; /* 0 => preemptable, <0 => bug */ + }; + + #define thread_saved_pc(tsk) \ +@@ -76,6 +77,7 @@ void arch_release_task_struct(struct task_struct *tsk); + #define TIF_FOREIGN_FPSTATE 3 /* CPU's FP state is not current's */ + #define TIF_UPROBE 4 /* uprobe breakpoint or singlestep */ + #define TIF_FSCHECK 5 /* Check FS is USER_DS on return */ ++#define TIF_NEED_RESCHED_LAZY 6 + #define TIF_NOHZ 7 + #define TIF_SYSCALL_TRACE 8 + #define TIF_SYSCALL_AUDIT 9 +@@ -94,6 +96,7 @@ void arch_release_task_struct(struct task_struct *tsk); + #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) + #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) + #define _TIF_FOREIGN_FPSTATE (1 << TIF_FOREIGN_FPSTATE) ++#define _TIF_NEED_RESCHED_LAZY (1 << TIF_NEED_RESCHED_LAZY) + #define _TIF_NOHZ (1 << TIF_NOHZ) + #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) + #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) +@@ -107,8 +110,9 @@ void arch_release_task_struct(struct task_struct *tsk); + + #define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \ + _TIF_NOTIFY_RESUME | _TIF_FOREIGN_FPSTATE | \ +- _TIF_UPROBE | _TIF_FSCHECK) ++ _TIF_UPROBE | _TIF_FSCHECK | _TIF_NEED_RESCHED_LAZY) + ++#define _TIF_NEED_RESCHED_MASK (_TIF_NEED_RESCHED | _TIF_NEED_RESCHED_LAZY) + #define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \ + _TIF_SYSCALL_TRACEPOINT | _TIF_SECCOMP | \ + _TIF_NOHZ) +diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c +index 92fba851ce53..844c71bc865b 100644 +--- a/arch/arm64/kernel/asm-offsets.c ++++ b/arch/arm64/kernel/asm-offsets.c +@@ -41,6 +41,7 @@ int main(void) + BLANK(); + DEFINE(TSK_TI_FLAGS, offsetof(struct task_struct, thread_info.flags)); + DEFINE(TSK_TI_PREEMPT, offsetof(struct task_struct, thread_info.preempt_count)); ++ DEFINE(TSK_TI_PREEMPT_LAZY, offsetof(struct task_struct, thread_info.preempt_lazy_count)); + DEFINE(TSK_TI_ADDR_LIMIT, offsetof(struct task_struct, thread_info.addr_limit)); + #ifdef CONFIG_ARM64_SW_TTBR0_PAN + DEFINE(TSK_TI_TTBR0, offsetof(struct task_struct, thread_info.ttbr0)); +diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S +index 85433a84783b..201f412b556e 100644 +--- a/arch/arm64/kernel/entry.S ++++ b/arch/arm64/kernel/entry.S +@@ -634,11 +634,16 @@ ENDPROC(el1_sync) + + #ifdef CONFIG_PREEMPT + ldr w24, [tsk, #TSK_TI_PREEMPT] // get preempt count +- cbnz w24, 1f // preempt count != 0 ++ cbnz w24, 2f // preempt count != 0 + ldr x0, [tsk, #TSK_TI_FLAGS] // get flags +- tbz x0, #TIF_NEED_RESCHED, 1f // needs rescheduling? +- bl el1_preempt ++ tbnz x0, #TIF_NEED_RESCHED, 1f // needs rescheduling? ++ ++ ldr w24, [tsk, #TSK_TI_PREEMPT_LAZY] // get preempt lazy count ++ cbnz w24, 2f // preempt lazy count != 0 ++ tbz x0, #TIF_NEED_RESCHED_LAZY, 2f // needs rescheduling? + 1: ++ bl el1_preempt ++2: + #endif + #ifdef CONFIG_TRACE_IRQFLAGS + bl trace_hardirqs_on +@@ -652,6 +657,7 @@ ENDPROC(el1_irq) + 1: bl preempt_schedule_irq // irq en/disable is done inside + ldr x0, [tsk, #TSK_TI_FLAGS] // get new tasks TI_FLAGS + tbnz x0, #TIF_NEED_RESCHED, 1b // needs rescheduling? ++ tbnz x0, #TIF_NEED_RESCHED_LAZY, 1b // needs rescheduling? + ret x24 + #endif + +diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c +index ca565853dea6..3f321daa7702 100644 +--- a/arch/arm64/kernel/signal.c ++++ b/arch/arm64/kernel/signal.c +@@ -919,7 +919,7 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, + /* Check valid user FS if needed */ + addr_limit_user_check(); + +- if (thread_flags & _TIF_NEED_RESCHED) { ++ if (thread_flags & _TIF_NEED_RESCHED_MASK) { + /* Unmask Debug and SError for the next task */ + local_daif_restore(DAIF_PROCCTX_NOIRQ); + diff --git a/debian/patches-rt/0243-powerpc-Add-support-for-lazy-preemption.patch b/debian/patches-rt/0243-powerpc-Add-support-for-lazy-preemption.patch deleted file mode 100644 index 7c07610a1..000000000 --- a/debian/patches-rt/0243-powerpc-Add-support-for-lazy-preemption.patch +++ /dev/null @@ -1,196 +0,0 @@ -From 0fe19697678375c08da0c1d53231706a9df830d4 Mon Sep 17 00:00:00 2001 -From: Thomas Gleixner -Date: Thu, 1 Nov 2012 10:14:11 +0100 -Subject: [PATCH 243/347] powerpc: Add support for lazy preemption -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -Implement the powerpc pieces for lazy preempt. - -Signed-off-by: Thomas Gleixner ---- - arch/powerpc/Kconfig | 1 + - arch/powerpc/include/asm/thread_info.h | 9 +++++++-- - arch/powerpc/kernel/asm-offsets.c | 1 + - arch/powerpc/kernel/entry_32.S | 17 ++++++++++++----- - arch/powerpc/kernel/entry_64.S | 16 ++++++++++++---- - 5 files changed, 33 insertions(+), 11 deletions(-) - -diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig -index f4517f4be192..4536d047cdff 100644 ---- a/arch/powerpc/Kconfig -+++ b/arch/powerpc/Kconfig -@@ -217,6 +217,7 @@ config PPC - select HAVE_HARDLOCKUP_DETECTOR_PERF if PERF_EVENTS && HAVE_PERF_EVENTS_NMI && !HAVE_HARDLOCKUP_DETECTOR_ARCH - select HAVE_PERF_REGS - select HAVE_PERF_USER_STACK_DUMP -+ select HAVE_PREEMPT_LAZY - select HAVE_RCU_TABLE_FREE if SMP - select HAVE_REGS_AND_STACK_ACCESS_API - select HAVE_RELIABLE_STACKTRACE if PPC64 && CPU_LITTLE_ENDIAN -diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h -index 3c0002044bc9..ce316076bc52 100644 ---- a/arch/powerpc/include/asm/thread_info.h -+++ b/arch/powerpc/include/asm/thread_info.h -@@ -37,6 +37,8 @@ struct thread_info { - int cpu; /* cpu we're on */ - int preempt_count; /* 0 => preemptable, - <0 => BUG */ -+ int preempt_lazy_count; /* 0 => preemptable, -+ <0 => BUG */ - unsigned long local_flags; /* private flags for thread */ - #ifdef CONFIG_LIVEPATCH - unsigned long *livepatch_sp; -@@ -81,7 +83,7 @@ extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src - #define TIF_SIGPENDING 1 /* signal pending */ - #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ - #define TIF_FSCHECK 3 /* Check FS is USER_DS on return */ --#define TIF_32BIT 4 /* 32 bit binary */ -+#define TIF_NEED_RESCHED_LAZY 4 /* lazy rescheduling necessary */ - #define TIF_RESTORE_TM 5 /* need to restore TM FP/VEC/VSX */ - #define TIF_PATCH_PENDING 6 /* pending live patching update */ - #define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */ -@@ -100,6 +102,7 @@ extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src - #define TIF_ELF2ABI 18 /* function descriptors must die! */ - #endif - #define TIF_POLLING_NRFLAG 19 /* true if poll_idle() is polling TIF_NEED_RESCHED */ -+#define TIF_32BIT 20 /* 32 bit binary */ - - /* as above, but as bit values */ - #define _TIF_SYSCALL_TRACE (1< -Date: Thu, 14 May 2015 17:52:17 +0200 -Subject: [PATCH 244/347] arch/arm64: Add lazy preempt support -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -arm64 is missing support for PREEMPT_RT. The main feature which is -lacking is support for lazy preemption. The arch-specific entry code, -thread information structure definitions, and associated data tables -have to be extended to provide this support. Then the Kconfig file has -to be extended to indicate the support is available, and also to -indicate that support for full RT preemption is now available. - -Signed-off-by: Anders Roxell ---- - arch/arm64/Kconfig | 1 + - arch/arm64/include/asm/thread_info.h | 6 +++++- - arch/arm64/kernel/asm-offsets.c | 1 + - arch/arm64/kernel/entry.S | 12 +++++++++--- - arch/arm64/kernel/signal.c | 2 +- - 5 files changed, 17 insertions(+), 5 deletions(-) - -diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig -index a101f5d2fbed..84f53dc1a75b 100644 ---- a/arch/arm64/Kconfig -+++ b/arch/arm64/Kconfig -@@ -141,6 +141,7 @@ config ARM64 - select HAVE_PERF_EVENTS - select HAVE_PERF_REGS - select HAVE_PERF_USER_STACK_DUMP -+ select HAVE_PREEMPT_LAZY - select HAVE_REGS_AND_STACK_ACCESS_API - select HAVE_RCU_TABLE_FREE - select HAVE_RSEQ -diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h -index 69ac5262cccd..39e921817f28 100644 ---- a/arch/arm64/include/asm/thread_info.h -+++ b/arch/arm64/include/asm/thread_info.h -@@ -43,6 +43,7 @@ struct thread_info { - u64 ttbr0; /* saved TTBR0_EL1 */ - #endif - int preempt_count; /* 0 => preemptable, <0 => bug */ -+ int preempt_lazy_count; /* 0 => preemptable, <0 => bug */ - }; - - #define thread_saved_pc(tsk) \ -@@ -76,6 +77,7 @@ void arch_release_task_struct(struct task_struct *tsk); - #define TIF_FOREIGN_FPSTATE 3 /* CPU's FP state is not current's */ - #define TIF_UPROBE 4 /* uprobe breakpoint or singlestep */ - #define TIF_FSCHECK 5 /* Check FS is USER_DS on return */ -+#define TIF_NEED_RESCHED_LAZY 6 - #define TIF_NOHZ 7 - #define TIF_SYSCALL_TRACE 8 - #define TIF_SYSCALL_AUDIT 9 -@@ -94,6 +96,7 @@ void arch_release_task_struct(struct task_struct *tsk); - #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) - #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) - #define _TIF_FOREIGN_FPSTATE (1 << TIF_FOREIGN_FPSTATE) -+#define _TIF_NEED_RESCHED_LAZY (1 << TIF_NEED_RESCHED_LAZY) - #define _TIF_NOHZ (1 << TIF_NOHZ) - #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) - #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) -@@ -107,8 +110,9 @@ void arch_release_task_struct(struct task_struct *tsk); - - #define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \ - _TIF_NOTIFY_RESUME | _TIF_FOREIGN_FPSTATE | \ -- _TIF_UPROBE | _TIF_FSCHECK) -+ _TIF_UPROBE | _TIF_FSCHECK | _TIF_NEED_RESCHED_LAZY) - -+#define _TIF_NEED_RESCHED_MASK (_TIF_NEED_RESCHED | _TIF_NEED_RESCHED_LAZY) - #define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \ - _TIF_SYSCALL_TRACEPOINT | _TIF_SECCOMP | \ - _TIF_NOHZ) -diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c -index 92fba851ce53..844c71bc865b 100644 ---- a/arch/arm64/kernel/asm-offsets.c -+++ b/arch/arm64/kernel/asm-offsets.c -@@ -41,6 +41,7 @@ int main(void) - BLANK(); - DEFINE(TSK_TI_FLAGS, offsetof(struct task_struct, thread_info.flags)); - DEFINE(TSK_TI_PREEMPT, offsetof(struct task_struct, thread_info.preempt_count)); -+ DEFINE(TSK_TI_PREEMPT_LAZY, offsetof(struct task_struct, thread_info.preempt_lazy_count)); - DEFINE(TSK_TI_ADDR_LIMIT, offsetof(struct task_struct, thread_info.addr_limit)); - #ifdef CONFIG_ARM64_SW_TTBR0_PAN - DEFINE(TSK_TI_TTBR0, offsetof(struct task_struct, thread_info.ttbr0)); -diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S -index 85433a84783b..201f412b556e 100644 ---- a/arch/arm64/kernel/entry.S -+++ b/arch/arm64/kernel/entry.S -@@ -634,11 +634,16 @@ ENDPROC(el1_sync) - - #ifdef CONFIG_PREEMPT - ldr w24, [tsk, #TSK_TI_PREEMPT] // get preempt count -- cbnz w24, 1f // preempt count != 0 -+ cbnz w24, 2f // preempt count != 0 - ldr x0, [tsk, #TSK_TI_FLAGS] // get flags -- tbz x0, #TIF_NEED_RESCHED, 1f // needs rescheduling? -- bl el1_preempt -+ tbnz x0, #TIF_NEED_RESCHED, 1f // needs rescheduling? -+ -+ ldr w24, [tsk, #TSK_TI_PREEMPT_LAZY] // get preempt lazy count -+ cbnz w24, 2f // preempt lazy count != 0 -+ tbz x0, #TIF_NEED_RESCHED_LAZY, 2f // needs rescheduling? - 1: -+ bl el1_preempt -+2: - #endif - #ifdef CONFIG_TRACE_IRQFLAGS - bl trace_hardirqs_on -@@ -652,6 +657,7 @@ ENDPROC(el1_irq) - 1: bl preempt_schedule_irq // irq en/disable is done inside - ldr x0, [tsk, #TSK_TI_FLAGS] // get new tasks TI_FLAGS - tbnz x0, #TIF_NEED_RESCHED, 1b // needs rescheduling? -+ tbnz x0, #TIF_NEED_RESCHED_LAZY, 1b // needs rescheduling? - ret x24 - #endif - -diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c -index ca565853dea6..3f321daa7702 100644 ---- a/arch/arm64/kernel/signal.c -+++ b/arch/arm64/kernel/signal.c -@@ -919,7 +919,7 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, - /* Check valid user FS if needed */ - addr_limit_user_check(); - -- if (thread_flags & _TIF_NEED_RESCHED) { -+ if (thread_flags & _TIF_NEED_RESCHED_MASK) { - /* Unmask Debug and SError for the next task */ - local_daif_restore(DAIF_PROCCTX_NOIRQ); - --- -2.36.1 - diff --git a/debian/patches-rt/0244-connector-cn_proc-Protect-send_msg-with-a-local-lock.patch b/debian/patches-rt/0244-connector-cn_proc-Protect-send_msg-with-a-local-lock.patch new file mode 100644 index 000000000..038bec03d --- /dev/null +++ b/debian/patches-rt/0244-connector-cn_proc-Protect-send_msg-with-a-local-lock.patch @@ -0,0 +1,70 @@ +From: Mike Galbraith +Date: Sun, 16 Oct 2016 05:11:54 +0200 +Subject: [PATCH 244/342] connector/cn_proc: Protect send_msg() with a local + lock on RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=b4f0ce722072d0e6ea67db8c7f6936abe9de0764 + +|BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:931 +|in_atomic(): 1, irqs_disabled(): 0, pid: 31807, name: sleep +|Preemption disabled at:[] proc_exit_connector+0xbb/0x140 +| +|CPU: 4 PID: 31807 Comm: sleep Tainted: G W E 4.8.0-rt11-rt #106 +|Call Trace: +| [] dump_stack+0x65/0x88 +| [] ___might_sleep+0xf5/0x180 +| [] __rt_spin_lock+0x20/0x50 +| [] rt_read_lock+0x28/0x30 +| [] netlink_broadcast_filtered+0x49/0x3f0 +| [] ? __kmalloc_reserve.isra.33+0x31/0x90 +| [] netlink_broadcast+0x1d/0x20 +| [] cn_netlink_send_mult+0x19a/0x1f0 +| [] cn_netlink_send+0x1b/0x20 +| [] proc_exit_connector+0xf8/0x140 +| [] do_exit+0x5d1/0xba0 +| [] do_group_exit+0x4c/0xc0 +| [] SyS_exit_group+0x14/0x20 +| [] entry_SYSCALL_64_fastpath+0x1a/0xa4 + +Since ab8ed951080e ("connector: fix out-of-order cn_proc netlink message +delivery") which is v4.7-rc6. + +Signed-off-by: Mike Galbraith +Signed-off-by: Sebastian Andrzej Siewior +--- + drivers/connector/cn_proc.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c +index ad48fd52cb53..c5264b3ee0b0 100644 +--- a/drivers/connector/cn_proc.c ++++ b/drivers/connector/cn_proc.c +@@ -32,6 +32,7 @@ + #include + + #include ++#include + + /* + * Size of a cn_msg followed by a proc_event structure. Since the +@@ -54,10 +55,11 @@ static struct cb_id cn_proc_event_id = { CN_IDX_PROC, CN_VAL_PROC }; + + /* proc_event_counts is used as the sequence number of the netlink message */ + static DEFINE_PER_CPU(__u32, proc_event_counts) = { 0 }; ++static DEFINE_LOCAL_IRQ_LOCK(send_msg_lock); + + static inline void send_msg(struct cn_msg *msg) + { +- preempt_disable(); ++ local_lock(send_msg_lock); + + msg->seq = __this_cpu_inc_return(proc_event_counts) - 1; + ((struct proc_event *)msg->data)->cpu = smp_processor_id(); +@@ -70,7 +72,7 @@ static inline void send_msg(struct cn_msg *msg) + */ + cn_netlink_send(msg, 0, CN_IDX_PROC, GFP_NOWAIT); + +- preempt_enable(); ++ local_unlock(send_msg_lock); + } + + void proc_fork_connector(struct task_struct *task) diff --git a/debian/patches-rt/0245-connector-cn_proc-Protect-send_msg-with-a-local-lock.patch b/debian/patches-rt/0245-connector-cn_proc-Protect-send_msg-with-a-local-lock.patch deleted file mode 100644 index 8ce25e4b2..000000000 --- a/debian/patches-rt/0245-connector-cn_proc-Protect-send_msg-with-a-local-lock.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 2d5d86f2a24500c2b02576c9d5de36bb90e86f10 Mon Sep 17 00:00:00 2001 -From: Mike Galbraith -Date: Sun, 16 Oct 2016 05:11:54 +0200 -Subject: [PATCH 245/347] connector/cn_proc: Protect send_msg() with a local - lock on RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -|BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:931 -|in_atomic(): 1, irqs_disabled(): 0, pid: 31807, name: sleep -|Preemption disabled at:[] proc_exit_connector+0xbb/0x140 -| -|CPU: 4 PID: 31807 Comm: sleep Tainted: G W E 4.8.0-rt11-rt #106 -|Call Trace: -| [] dump_stack+0x65/0x88 -| [] ___might_sleep+0xf5/0x180 -| [] __rt_spin_lock+0x20/0x50 -| [] rt_read_lock+0x28/0x30 -| [] netlink_broadcast_filtered+0x49/0x3f0 -| [] ? __kmalloc_reserve.isra.33+0x31/0x90 -| [] netlink_broadcast+0x1d/0x20 -| [] cn_netlink_send_mult+0x19a/0x1f0 -| [] cn_netlink_send+0x1b/0x20 -| [] proc_exit_connector+0xf8/0x140 -| [] do_exit+0x5d1/0xba0 -| [] do_group_exit+0x4c/0xc0 -| [] SyS_exit_group+0x14/0x20 -| [] entry_SYSCALL_64_fastpath+0x1a/0xa4 - -Since ab8ed951080e ("connector: fix out-of-order cn_proc netlink message -delivery") which is v4.7-rc6. - -Signed-off-by: Mike Galbraith -Signed-off-by: Sebastian Andrzej Siewior ---- - drivers/connector/cn_proc.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c -index ad48fd52cb53..c5264b3ee0b0 100644 ---- a/drivers/connector/cn_proc.c -+++ b/drivers/connector/cn_proc.c -@@ -32,6 +32,7 @@ - #include - - #include -+#include - - /* - * Size of a cn_msg followed by a proc_event structure. Since the -@@ -54,10 +55,11 @@ static struct cb_id cn_proc_event_id = { CN_IDX_PROC, CN_VAL_PROC }; - - /* proc_event_counts is used as the sequence number of the netlink message */ - static DEFINE_PER_CPU(__u32, proc_event_counts) = { 0 }; -+static DEFINE_LOCAL_IRQ_LOCK(send_msg_lock); - - static inline void send_msg(struct cn_msg *msg) - { -- preempt_disable(); -+ local_lock(send_msg_lock); - - msg->seq = __this_cpu_inc_return(proc_event_counts) - 1; - ((struct proc_event *)msg->data)->cpu = smp_processor_id(); -@@ -70,7 +72,7 @@ static inline void send_msg(struct cn_msg *msg) - */ - cn_netlink_send(msg, 0, CN_IDX_PROC, GFP_NOWAIT); - -- preempt_enable(); -+ local_unlock(send_msg_lock); - } - - void proc_fork_connector(struct task_struct *task) --- -2.36.1 - diff --git a/debian/patches-rt/0245-drivers-block-zram-Replace-bit-spinlocks-with-rtmute.patch b/debian/patches-rt/0245-drivers-block-zram-Replace-bit-spinlocks-with-rtmute.patch new file mode 100644 index 000000000..b33d8a7a0 --- /dev/null +++ b/debian/patches-rt/0245-drivers-block-zram-Replace-bit-spinlocks-with-rtmute.patch @@ -0,0 +1,100 @@ +From: Mike Galbraith +Date: Thu, 31 Mar 2016 04:08:28 +0200 +Subject: [PATCH 245/342] drivers/block/zram: Replace bit spinlocks with + rtmutex for -rt +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=e9c40001860ea506bbb2d75c4f9a704fdce8b98c + +They're nondeterministic, and lead to ___might_sleep() splats in -rt. +OTOH, they're a lot less wasteful than an rtmutex per page. + +Signed-off-by: Mike Galbraith +Signed-off-by: Sebastian Andrzej Siewior +--- + drivers/block/zram/zram_drv.c | 38 +++++++++++++++++++++++++++++++++++ + drivers/block/zram/zram_drv.h | 3 +++ + 2 files changed, 41 insertions(+) + +diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c +index 5e05bfcecd7b..04e4297f8318 100644 +--- a/drivers/block/zram/zram_drv.c ++++ b/drivers/block/zram/zram_drv.c +@@ -53,6 +53,40 @@ static size_t huge_class_size; + + static void zram_free_page(struct zram *zram, size_t index); + ++#ifdef CONFIG_PREEMPT_RT_BASE ++static void zram_meta_init_table_locks(struct zram *zram, size_t num_pages) ++{ ++ size_t index; ++ ++ for (index = 0; index < num_pages; index++) ++ spin_lock_init(&zram->table[index].lock); ++} ++ ++static int zram_slot_trylock(struct zram *zram, u32 index) ++{ ++ int ret; ++ ++ ret = spin_trylock(&zram->table[index].lock); ++ if (ret) ++ __set_bit(ZRAM_LOCK, &zram->table[index].value); ++ return ret; ++} ++ ++static void zram_slot_lock(struct zram *zram, u32 index) ++{ ++ spin_lock(&zram->table[index].lock); ++ __set_bit(ZRAM_LOCK, &zram->table[index].value); ++} ++ ++static void zram_slot_unlock(struct zram *zram, u32 index) ++{ ++ __clear_bit(ZRAM_LOCK, &zram->table[index].value); ++ spin_unlock(&zram->table[index].lock); ++} ++ ++#else ++static void zram_meta_init_table_locks(struct zram *zram, size_t num_pages) { } ++ + static int zram_slot_trylock(struct zram *zram, u32 index) + { + return bit_spin_trylock(ZRAM_LOCK, &zram->table[index].value); +@@ -67,6 +101,7 @@ static void zram_slot_unlock(struct zram *zram, u32 index) + { + bit_spin_unlock(ZRAM_LOCK, &zram->table[index].value); + } ++#endif + + static inline bool init_done(struct zram *zram) + { +@@ -902,6 +937,8 @@ static DEVICE_ATTR_RO(io_stat); + static DEVICE_ATTR_RO(mm_stat); + static DEVICE_ATTR_RO(debug_stat); + ++ ++ + static void zram_meta_free(struct zram *zram, u64 disksize) + { + size_t num_pages = disksize >> PAGE_SHIFT; +@@ -932,6 +969,7 @@ static bool zram_meta_alloc(struct zram *zram, u64 disksize) + + if (!huge_class_size) + huge_class_size = zs_huge_class_size(zram->mem_pool); ++ zram_meta_init_table_locks(zram, num_pages); + return true; + } + +diff --git a/drivers/block/zram/zram_drv.h b/drivers/block/zram/zram_drv.h +index d1095dfdffa8..144e91061df8 100644 +--- a/drivers/block/zram/zram_drv.h ++++ b/drivers/block/zram/zram_drv.h +@@ -61,6 +61,9 @@ struct zram_table_entry { + unsigned long element; + }; + unsigned long value; ++#ifdef CONFIG_PREEMPT_RT_BASE ++ spinlock_t lock; ++#endif + #ifdef CONFIG_ZRAM_MEMORY_TRACKING + ktime_t ac_time; + #endif diff --git a/debian/patches-rt/0246-drivers-block-zram-Replace-bit-spinlocks-with-rtmute.patch b/debian/patches-rt/0246-drivers-block-zram-Replace-bit-spinlocks-with-rtmute.patch deleted file mode 100644 index 04dcb13d9..000000000 --- a/debian/patches-rt/0246-drivers-block-zram-Replace-bit-spinlocks-with-rtmute.patch +++ /dev/null @@ -1,104 +0,0 @@ -From cdff10ec863d6d0e7d18beb8cb66adc86674bb2b Mon Sep 17 00:00:00 2001 -From: Mike Galbraith -Date: Thu, 31 Mar 2016 04:08:28 +0200 -Subject: [PATCH 246/347] drivers/block/zram: Replace bit spinlocks with - rtmutex for -rt -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -They're nondeterministic, and lead to ___might_sleep() splats in -rt. -OTOH, they're a lot less wasteful than an rtmutex per page. - -Signed-off-by: Mike Galbraith -Signed-off-by: Sebastian Andrzej Siewior ---- - drivers/block/zram/zram_drv.c | 38 +++++++++++++++++++++++++++++++++++ - drivers/block/zram/zram_drv.h | 3 +++ - 2 files changed, 41 insertions(+) - -diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c -index 5e05bfcecd7b..04e4297f8318 100644 ---- a/drivers/block/zram/zram_drv.c -+++ b/drivers/block/zram/zram_drv.c -@@ -53,6 +53,40 @@ static size_t huge_class_size; - - static void zram_free_page(struct zram *zram, size_t index); - -+#ifdef CONFIG_PREEMPT_RT_BASE -+static void zram_meta_init_table_locks(struct zram *zram, size_t num_pages) -+{ -+ size_t index; -+ -+ for (index = 0; index < num_pages; index++) -+ spin_lock_init(&zram->table[index].lock); -+} -+ -+static int zram_slot_trylock(struct zram *zram, u32 index) -+{ -+ int ret; -+ -+ ret = spin_trylock(&zram->table[index].lock); -+ if (ret) -+ __set_bit(ZRAM_LOCK, &zram->table[index].value); -+ return ret; -+} -+ -+static void zram_slot_lock(struct zram *zram, u32 index) -+{ -+ spin_lock(&zram->table[index].lock); -+ __set_bit(ZRAM_LOCK, &zram->table[index].value); -+} -+ -+static void zram_slot_unlock(struct zram *zram, u32 index) -+{ -+ __clear_bit(ZRAM_LOCK, &zram->table[index].value); -+ spin_unlock(&zram->table[index].lock); -+} -+ -+#else -+static void zram_meta_init_table_locks(struct zram *zram, size_t num_pages) { } -+ - static int zram_slot_trylock(struct zram *zram, u32 index) - { - return bit_spin_trylock(ZRAM_LOCK, &zram->table[index].value); -@@ -67,6 +101,7 @@ static void zram_slot_unlock(struct zram *zram, u32 index) - { - bit_spin_unlock(ZRAM_LOCK, &zram->table[index].value); - } -+#endif - - static inline bool init_done(struct zram *zram) - { -@@ -902,6 +937,8 @@ static DEVICE_ATTR_RO(io_stat); - static DEVICE_ATTR_RO(mm_stat); - static DEVICE_ATTR_RO(debug_stat); - -+ -+ - static void zram_meta_free(struct zram *zram, u64 disksize) - { - size_t num_pages = disksize >> PAGE_SHIFT; -@@ -932,6 +969,7 @@ static bool zram_meta_alloc(struct zram *zram, u64 disksize) - - if (!huge_class_size) - huge_class_size = zs_huge_class_size(zram->mem_pool); -+ zram_meta_init_table_locks(zram, num_pages); - return true; - } - -diff --git a/drivers/block/zram/zram_drv.h b/drivers/block/zram/zram_drv.h -index d1095dfdffa8..144e91061df8 100644 ---- a/drivers/block/zram/zram_drv.h -+++ b/drivers/block/zram/zram_drv.h -@@ -61,6 +61,9 @@ struct zram_table_entry { - unsigned long element; - }; - unsigned long value; -+#ifdef CONFIG_PREEMPT_RT_BASE -+ spinlock_t lock; -+#endif - #ifdef CONFIG_ZRAM_MEMORY_TRACKING - ktime_t ac_time; - #endif --- -2.36.1 - diff --git a/debian/patches-rt/0246-drivers-zram-Don-t-disable-preemption-in-zcomp_strea.patch b/debian/patches-rt/0246-drivers-zram-Don-t-disable-preemption-in-zcomp_strea.patch new file mode 100644 index 000000000..dfb12a9b2 --- /dev/null +++ b/debian/patches-rt/0246-drivers-zram-Don-t-disable-preemption-in-zcomp_strea.patch @@ -0,0 +1,103 @@ +From: Mike Galbraith +Date: Thu, 20 Oct 2016 11:15:22 +0200 +Subject: [PATCH 246/342] drivers/zram: Don't disable preemption in + zcomp_stream_get/put() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=2689fcbfe8b15a102ec207f5b8c94095333fae9c + +In v4.7, the driver switched to percpu compression streams, disabling +preemption via get/put_cpu_ptr(). Use a per-zcomp_strm lock here. We +also have to fix an lock order issue in zram_decompress_page() such +that zs_map_object() nests inside of zcomp_stream_put() as it does in +zram_bvec_write(). + +Signed-off-by: Mike Galbraith +[bigeasy: get_locked_var() -> per zcomp_strm lock] +Signed-off-by: Sebastian Andrzej Siewior +--- + drivers/block/zram/zcomp.c | 12 ++++++++++-- + drivers/block/zram/zcomp.h | 1 + + drivers/block/zram/zram_drv.c | 5 +++-- + 3 files changed, 14 insertions(+), 4 deletions(-) + +diff --git a/drivers/block/zram/zcomp.c b/drivers/block/zram/zcomp.c +index 4ed0a78fdc09..dd65a27ae2cc 100644 +--- a/drivers/block/zram/zcomp.c ++++ b/drivers/block/zram/zcomp.c +@@ -116,12 +116,19 @@ ssize_t zcomp_available_show(const char *comp, char *buf) + + struct zcomp_strm *zcomp_stream_get(struct zcomp *comp) + { +- return *get_cpu_ptr(comp->stream); ++ struct zcomp_strm *zstrm; ++ ++ zstrm = *this_cpu_ptr(comp->stream); ++ spin_lock(&zstrm->zcomp_lock); ++ return zstrm; + } + + void zcomp_stream_put(struct zcomp *comp) + { +- put_cpu_ptr(comp->stream); ++ struct zcomp_strm *zstrm; ++ ++ zstrm = *this_cpu_ptr(comp->stream); ++ spin_unlock(&zstrm->zcomp_lock); + } + + int zcomp_compress(struct zcomp_strm *zstrm, +@@ -171,6 +178,7 @@ int zcomp_cpu_up_prepare(unsigned int cpu, struct hlist_node *node) + pr_err("Can't allocate a compression stream\n"); + return -ENOMEM; + } ++ spin_lock_init(&zstrm->zcomp_lock); + *per_cpu_ptr(comp->stream, cpu) = zstrm; + return 0; + } +diff --git a/drivers/block/zram/zcomp.h b/drivers/block/zram/zcomp.h +index 41c1002a7d7d..d424eafcbf8e 100644 +--- a/drivers/block/zram/zcomp.h ++++ b/drivers/block/zram/zcomp.h +@@ -14,6 +14,7 @@ struct zcomp_strm { + /* compression/decompression buffer */ + void *buffer; + struct crypto_comp *tfm; ++ spinlock_t zcomp_lock; + }; + + /* dynamic per-device compression frontend */ +diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c +index 04e4297f8318..2919ad13bce9 100644 +--- a/drivers/block/zram/zram_drv.c ++++ b/drivers/block/zram/zram_drv.c +@@ -1028,6 +1028,7 @@ static int __zram_bvec_read(struct zram *zram, struct page *page, u32 index, + unsigned long handle; + unsigned int size; + void *src, *dst; ++ struct zcomp_strm *zstrm; + + if (zram_wb_enabled(zram)) { + zram_slot_lock(zram, index); +@@ -1062,6 +1063,7 @@ static int __zram_bvec_read(struct zram *zram, struct page *page, u32 index, + + size = zram_get_obj_size(zram, index); + ++ zstrm = zcomp_stream_get(zram->comp); + src = zs_map_object(zram->mem_pool, handle, ZS_MM_RO); + if (size == PAGE_SIZE) { + dst = kmap_atomic(page); +@@ -1069,14 +1071,13 @@ static int __zram_bvec_read(struct zram *zram, struct page *page, u32 index, + kunmap_atomic(dst); + ret = 0; + } else { +- struct zcomp_strm *zstrm = zcomp_stream_get(zram->comp); + + dst = kmap_atomic(page); + ret = zcomp_decompress(zstrm, src, size, dst); + kunmap_atomic(dst); +- zcomp_stream_put(zram->comp); + } + zs_unmap_object(zram->mem_pool, handle); ++ zcomp_stream_put(zram->comp); + zram_slot_unlock(zram, index); + + /* Should NEVER happen. Return bio error if it does. */ diff --git a/debian/patches-rt/0247-drivers-zram-Don-t-disable-preemption-in-zcomp_strea.patch b/debian/patches-rt/0247-drivers-zram-Don-t-disable-preemption-in-zcomp_strea.patch deleted file mode 100644 index e12dd3c3c..000000000 --- a/debian/patches-rt/0247-drivers-zram-Don-t-disable-preemption-in-zcomp_strea.patch +++ /dev/null @@ -1,107 +0,0 @@ -From fcbeb7ab5dc2a2e2f1243df805e9a4f0103b212b Mon Sep 17 00:00:00 2001 -From: Mike Galbraith -Date: Thu, 20 Oct 2016 11:15:22 +0200 -Subject: [PATCH 247/347] drivers/zram: Don't disable preemption in - zcomp_stream_get/put() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -In v4.7, the driver switched to percpu compression streams, disabling -preemption via get/put_cpu_ptr(). Use a per-zcomp_strm lock here. We -also have to fix an lock order issue in zram_decompress_page() such -that zs_map_object() nests inside of zcomp_stream_put() as it does in -zram_bvec_write(). - -Signed-off-by: Mike Galbraith -[bigeasy: get_locked_var() -> per zcomp_strm lock] -Signed-off-by: Sebastian Andrzej Siewior ---- - drivers/block/zram/zcomp.c | 12 ++++++++++-- - drivers/block/zram/zcomp.h | 1 + - drivers/block/zram/zram_drv.c | 5 +++-- - 3 files changed, 14 insertions(+), 4 deletions(-) - -diff --git a/drivers/block/zram/zcomp.c b/drivers/block/zram/zcomp.c -index 4ed0a78fdc09..dd65a27ae2cc 100644 ---- a/drivers/block/zram/zcomp.c -+++ b/drivers/block/zram/zcomp.c -@@ -116,12 +116,19 @@ ssize_t zcomp_available_show(const char *comp, char *buf) - - struct zcomp_strm *zcomp_stream_get(struct zcomp *comp) - { -- return *get_cpu_ptr(comp->stream); -+ struct zcomp_strm *zstrm; -+ -+ zstrm = *this_cpu_ptr(comp->stream); -+ spin_lock(&zstrm->zcomp_lock); -+ return zstrm; - } - - void zcomp_stream_put(struct zcomp *comp) - { -- put_cpu_ptr(comp->stream); -+ struct zcomp_strm *zstrm; -+ -+ zstrm = *this_cpu_ptr(comp->stream); -+ spin_unlock(&zstrm->zcomp_lock); - } - - int zcomp_compress(struct zcomp_strm *zstrm, -@@ -171,6 +178,7 @@ int zcomp_cpu_up_prepare(unsigned int cpu, struct hlist_node *node) - pr_err("Can't allocate a compression stream\n"); - return -ENOMEM; - } -+ spin_lock_init(&zstrm->zcomp_lock); - *per_cpu_ptr(comp->stream, cpu) = zstrm; - return 0; - } -diff --git a/drivers/block/zram/zcomp.h b/drivers/block/zram/zcomp.h -index 41c1002a7d7d..d424eafcbf8e 100644 ---- a/drivers/block/zram/zcomp.h -+++ b/drivers/block/zram/zcomp.h -@@ -14,6 +14,7 @@ struct zcomp_strm { - /* compression/decompression buffer */ - void *buffer; - struct crypto_comp *tfm; -+ spinlock_t zcomp_lock; - }; - - /* dynamic per-device compression frontend */ -diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c -index 04e4297f8318..2919ad13bce9 100644 ---- a/drivers/block/zram/zram_drv.c -+++ b/drivers/block/zram/zram_drv.c -@@ -1028,6 +1028,7 @@ static int __zram_bvec_read(struct zram *zram, struct page *page, u32 index, - unsigned long handle; - unsigned int size; - void *src, *dst; -+ struct zcomp_strm *zstrm; - - if (zram_wb_enabled(zram)) { - zram_slot_lock(zram, index); -@@ -1062,6 +1063,7 @@ static int __zram_bvec_read(struct zram *zram, struct page *page, u32 index, - - size = zram_get_obj_size(zram, index); - -+ zstrm = zcomp_stream_get(zram->comp); - src = zs_map_object(zram->mem_pool, handle, ZS_MM_RO); - if (size == PAGE_SIZE) { - dst = kmap_atomic(page); -@@ -1069,14 +1071,13 @@ static int __zram_bvec_read(struct zram *zram, struct page *page, u32 index, - kunmap_atomic(dst); - ret = 0; - } else { -- struct zcomp_strm *zstrm = zcomp_stream_get(zram->comp); - - dst = kmap_atomic(page); - ret = zcomp_decompress(zstrm, src, size, dst); - kunmap_atomic(dst); -- zcomp_stream_put(zram->comp); - } - zs_unmap_object(zram->mem_pool, handle); -+ zcomp_stream_put(zram->comp); - zram_slot_unlock(zram, index); - - /* Should NEVER happen. Return bio error if it does. */ --- -2.36.1 - diff --git a/debian/patches-rt/0247-drivers-zram-fix-zcomp_stream_get-smp_processor_id-u.patch b/debian/patches-rt/0247-drivers-zram-fix-zcomp_stream_get-smp_processor_id-u.patch new file mode 100644 index 000000000..6c1508d32 --- /dev/null +++ b/debian/patches-rt/0247-drivers-zram-fix-zcomp_stream_get-smp_processor_id-u.patch @@ -0,0 +1,40 @@ +From: Mike Galbraith +Date: Wed, 23 Aug 2017 11:57:29 +0200 +Subject: [PATCH 247/342] drivers/zram: fix zcomp_stream_get() + smp_processor_id() use in preemptible code +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=8623e80cefb82edf752c74cb790d33a96410271d + +Use get_local_ptr() instead this_cpu_ptr() to avoid a warning regarding +smp_processor_id() in preemptible code. +raw_cpu_ptr() would be fine, too because the per-CPU data structure is +protected with a spin lock so it does not matter much if we take the +other one. + +Cc: stable-rt@vger.kernel.org +Signed-off-by: Mike Galbraith +Signed-off-by: Sebastian Andrzej Siewior +--- + drivers/block/zram/zcomp.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/block/zram/zcomp.c b/drivers/block/zram/zcomp.c +index dd65a27ae2cc..eece02262000 100644 +--- a/drivers/block/zram/zcomp.c ++++ b/drivers/block/zram/zcomp.c +@@ -118,7 +118,7 @@ struct zcomp_strm *zcomp_stream_get(struct zcomp *comp) + { + struct zcomp_strm *zstrm; + +- zstrm = *this_cpu_ptr(comp->stream); ++ zstrm = *get_local_ptr(comp->stream); + spin_lock(&zstrm->zcomp_lock); + return zstrm; + } +@@ -129,6 +129,7 @@ void zcomp_stream_put(struct zcomp *comp) + + zstrm = *this_cpu_ptr(comp->stream); + spin_unlock(&zstrm->zcomp_lock); ++ put_local_ptr(zstrm); + } + + int zcomp_compress(struct zcomp_strm *zstrm, diff --git a/debian/patches-rt/0248-drivers-zram-fix-zcomp_stream_get-smp_processor_id-u.patch b/debian/patches-rt/0248-drivers-zram-fix-zcomp_stream_get-smp_processor_id-u.patch deleted file mode 100644 index 0ff366338..000000000 --- a/debian/patches-rt/0248-drivers-zram-fix-zcomp_stream_get-smp_processor_id-u.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 6b94039830863cbed6f161843e96e0cd79637353 Mon Sep 17 00:00:00 2001 -From: Mike Galbraith -Date: Wed, 23 Aug 2017 11:57:29 +0200 -Subject: [PATCH 248/347] drivers/zram: fix zcomp_stream_get() - smp_processor_id() use in preemptible code -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -Use get_local_ptr() instead this_cpu_ptr() to avoid a warning regarding -smp_processor_id() in preemptible code. -raw_cpu_ptr() would be fine, too because the per-CPU data structure is -protected with a spin lock so it does not matter much if we take the -other one. - -Cc: stable-rt@vger.kernel.org -Signed-off-by: Mike Galbraith -Signed-off-by: Sebastian Andrzej Siewior ---- - drivers/block/zram/zcomp.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/drivers/block/zram/zcomp.c b/drivers/block/zram/zcomp.c -index dd65a27ae2cc..eece02262000 100644 ---- a/drivers/block/zram/zcomp.c -+++ b/drivers/block/zram/zcomp.c -@@ -118,7 +118,7 @@ struct zcomp_strm *zcomp_stream_get(struct zcomp *comp) - { - struct zcomp_strm *zstrm; - -- zstrm = *this_cpu_ptr(comp->stream); -+ zstrm = *get_local_ptr(comp->stream); - spin_lock(&zstrm->zcomp_lock); - return zstrm; - } -@@ -129,6 +129,7 @@ void zcomp_stream_put(struct zcomp *comp) - - zstrm = *this_cpu_ptr(comp->stream); - spin_unlock(&zstrm->zcomp_lock); -+ put_local_ptr(zstrm); - } - - int zcomp_compress(struct zcomp_strm *zstrm, --- -2.36.1 - diff --git a/debian/patches-rt/0248-tpm_tis-fix-stall-after-iowrite-s.patch b/debian/patches-rt/0248-tpm_tis-fix-stall-after-iowrite-s.patch new file mode 100644 index 000000000..97554882b --- /dev/null +++ b/debian/patches-rt/0248-tpm_tis-fix-stall-after-iowrite-s.patch @@ -0,0 +1,80 @@ +From: Haris Okanovic +Date: Tue, 15 Aug 2017 15:13:08 -0500 +Subject: [PATCH 248/342] tpm_tis: fix stall after iowrite*()s +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=704fbd8b3a5c6a211e3b96b92a5a73ee0bba800c + +ioread8() operations to TPM MMIO addresses can stall the cpu when +immediately following a sequence of iowrite*()'s to the same region. + +For example, cyclitest measures ~400us latency spikes when a non-RT +usermode application communicates with an SPI-based TPM chip (Intel Atom +E3940 system, PREEMPT_RT_FULL kernel). The spikes are caused by a +stalling ioread8() operation following a sequence of 30+ iowrite8()s to +the same address. I believe this happens because the write sequence is +buffered (in cpu or somewhere along the bus), and gets flushed on the +first LOAD instruction (ioread*()) that follows. + +The enclosed change appears to fix this issue: read the TPM chip's +access register (status code) after every iowrite*() operation to +amortize the cost of flushing data to chip across multiple instructions. + +Signed-off-by: Haris Okanovic +Signed-off-by: Sebastian Andrzej Siewior +--- + drivers/char/tpm/tpm_tis.c | 29 +++++++++++++++++++++++++++-- + 1 file changed, 27 insertions(+), 2 deletions(-) + +diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c +index 5a3a4f095391..5ecca6585049 100644 +--- a/drivers/char/tpm/tpm_tis.c ++++ b/drivers/char/tpm/tpm_tis.c +@@ -54,6 +54,31 @@ static inline struct tpm_tis_tcg_phy *to_tpm_tis_tcg_phy(struct tpm_tis_data *da + return container_of(data, struct tpm_tis_tcg_phy, priv); + } + ++#ifdef CONFIG_PREEMPT_RT_FULL ++/* ++ * Flushes previous write operations to chip so that a subsequent ++ * ioread*()s won't stall a cpu. ++ */ ++static inline void tpm_tis_flush(void __iomem *iobase) ++{ ++ ioread8(iobase + TPM_ACCESS(0)); ++} ++#else ++#define tpm_tis_flush(iobase) do { } while (0) ++#endif ++ ++static inline void tpm_tis_iowrite8(u8 b, void __iomem *iobase, u32 addr) ++{ ++ iowrite8(b, iobase + addr); ++ tpm_tis_flush(iobase); ++} ++ ++static inline void tpm_tis_iowrite32(u32 b, void __iomem *iobase, u32 addr) ++{ ++ iowrite32(b, iobase + addr); ++ tpm_tis_flush(iobase); ++} ++ + static int interrupts = -1; + module_param(interrupts, int, 0444); + MODULE_PARM_DESC(interrupts, "Enable interrupts"); +@@ -173,7 +198,7 @@ static int tpm_tcg_write_bytes(struct tpm_tis_data *data, u32 addr, u16 len, + struct tpm_tis_tcg_phy *phy = to_tpm_tis_tcg_phy(data); + + while (len--) +- iowrite8(*value++, phy->iobase + addr); ++ tpm_tis_iowrite8(*value++, phy->iobase, addr); + + return 0; + } +@@ -200,7 +225,7 @@ static int tpm_tcg_write32(struct tpm_tis_data *data, u32 addr, u32 value) + { + struct tpm_tis_tcg_phy *phy = to_tpm_tis_tcg_phy(data); + +- iowrite32(value, phy->iobase + addr); ++ tpm_tis_iowrite32(value, phy->iobase, addr); + + return 0; + } diff --git a/debian/patches-rt/0249-tpm_tis-fix-stall-after-iowrite-s.patch b/debian/patches-rt/0249-tpm_tis-fix-stall-after-iowrite-s.patch deleted file mode 100644 index 0da4b19d0..000000000 --- a/debian/patches-rt/0249-tpm_tis-fix-stall-after-iowrite-s.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 4ef974ed9fe88d78a6e03689fab80c553fcf70df Mon Sep 17 00:00:00 2001 -From: Haris Okanovic -Date: Tue, 15 Aug 2017 15:13:08 -0500 -Subject: [PATCH 249/347] tpm_tis: fix stall after iowrite*()s -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -ioread8() operations to TPM MMIO addresses can stall the cpu when -immediately following a sequence of iowrite*()'s to the same region. - -For example, cyclitest measures ~400us latency spikes when a non-RT -usermode application communicates with an SPI-based TPM chip (Intel Atom -E3940 system, PREEMPT_RT_FULL kernel). The spikes are caused by a -stalling ioread8() operation following a sequence of 30+ iowrite8()s to -the same address. I believe this happens because the write sequence is -buffered (in cpu or somewhere along the bus), and gets flushed on the -first LOAD instruction (ioread*()) that follows. - -The enclosed change appears to fix this issue: read the TPM chip's -access register (status code) after every iowrite*() operation to -amortize the cost of flushing data to chip across multiple instructions. - -Signed-off-by: Haris Okanovic -Signed-off-by: Sebastian Andrzej Siewior ---- - drivers/char/tpm/tpm_tis.c | 29 +++++++++++++++++++++++++++-- - 1 file changed, 27 insertions(+), 2 deletions(-) - -diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c -index 5a3a4f095391..5ecca6585049 100644 ---- a/drivers/char/tpm/tpm_tis.c -+++ b/drivers/char/tpm/tpm_tis.c -@@ -54,6 +54,31 @@ static inline struct tpm_tis_tcg_phy *to_tpm_tis_tcg_phy(struct tpm_tis_data *da - return container_of(data, struct tpm_tis_tcg_phy, priv); - } - -+#ifdef CONFIG_PREEMPT_RT_FULL -+/* -+ * Flushes previous write operations to chip so that a subsequent -+ * ioread*()s won't stall a cpu. -+ */ -+static inline void tpm_tis_flush(void __iomem *iobase) -+{ -+ ioread8(iobase + TPM_ACCESS(0)); -+} -+#else -+#define tpm_tis_flush(iobase) do { } while (0) -+#endif -+ -+static inline void tpm_tis_iowrite8(u8 b, void __iomem *iobase, u32 addr) -+{ -+ iowrite8(b, iobase + addr); -+ tpm_tis_flush(iobase); -+} -+ -+static inline void tpm_tis_iowrite32(u32 b, void __iomem *iobase, u32 addr) -+{ -+ iowrite32(b, iobase + addr); -+ tpm_tis_flush(iobase); -+} -+ - static int interrupts = -1; - module_param(interrupts, int, 0444); - MODULE_PARM_DESC(interrupts, "Enable interrupts"); -@@ -173,7 +198,7 @@ static int tpm_tcg_write_bytes(struct tpm_tis_data *data, u32 addr, u16 len, - struct tpm_tis_tcg_phy *phy = to_tpm_tis_tcg_phy(data); - - while (len--) -- iowrite8(*value++, phy->iobase + addr); -+ tpm_tis_iowrite8(*value++, phy->iobase, addr); - - return 0; - } -@@ -200,7 +225,7 @@ static int tpm_tcg_write32(struct tpm_tis_data *data, u32 addr, u32 value) - { - struct tpm_tis_tcg_phy *phy = to_tpm_tis_tcg_phy(data); - -- iowrite32(value, phy->iobase + addr); -+ tpm_tis_iowrite32(value, phy->iobase, addr); - - return 0; - } --- -2.36.1 - diff --git a/debian/patches-rt/0249-watchdog-prevent-deferral-of-watchdogd-wakeup-on-RT.patch b/debian/patches-rt/0249-watchdog-prevent-deferral-of-watchdogd-wakeup-on-RT.patch new file mode 100644 index 000000000..2a7057825 --- /dev/null +++ b/debian/patches-rt/0249-watchdog-prevent-deferral-of-watchdogd-wakeup-on-RT.patch @@ -0,0 +1,77 @@ +From: Julia Cartwright +Date: Fri, 28 Sep 2018 21:03:51 +0000 +Subject: [PATCH 249/342] watchdog: prevent deferral of watchdogd wakeup on RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=2bdd12a025e0691b88a6b524a8bf4659f64211d0 + +When PREEMPT_RT_FULL is enabled, all hrtimer expiry functions are +deferred for execution into the context of ktimersoftd unless otherwise +annotated. + +Deferring the expiry of the hrtimer used by the watchdog core, however, +is a waste, as the callback does nothing but queue a kthread work item +and wakeup watchdogd. + +It's worst then that, too: the deferral through ktimersoftd also means +that for correct behavior a user must adjust the scheduling parameters +of both watchdogd _and_ ktimersoftd, which is unnecessary and has other +side effects (like causing unrelated expiry functions to execute at +potentially elevated priority). + +Instead, mark the hrtimer used by the watchdog core as being _HARD to +allow it's execution directly from hardirq context. The work done in +this expiry function is well-bounded and minimal. + +A user still must adjust the scheduling parameters of the watchdogd +to be correct w.r.t. their application needs. + +Cc: Guenter Roeck +Reported-and-tested-by: Steffen Trumtrar +Reported-by: Tim Sander +Signed-off-by: Julia Cartwright +Acked-by: Guenter Roeck +[bigeasy: use only HRTIMER_MODE_REL_HARD] +Signed-off-by: Sebastian Andrzej Siewior +--- + drivers/watchdog/watchdog_dev.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c +index 8fe59b7d8eec..516782cff8d2 100644 +--- a/drivers/watchdog/watchdog_dev.c ++++ b/drivers/watchdog/watchdog_dev.c +@@ -145,7 +145,7 @@ static inline void watchdog_update_worker(struct watchdog_device *wdd) + ktime_t t = watchdog_next_keepalive(wdd); + + if (t > 0) +- hrtimer_start(&wd_data->timer, t, HRTIMER_MODE_REL); ++ hrtimer_start(&wd_data->timer, t, HRTIMER_MODE_REL_HARD); + } else { + hrtimer_cancel(&wd_data->timer); + } +@@ -164,7 +164,7 @@ static int __watchdog_ping(struct watchdog_device *wdd) + if (ktime_after(earliest_keepalive, now)) { + hrtimer_start(&wd_data->timer, + ktime_sub(earliest_keepalive, now), +- HRTIMER_MODE_REL); ++ HRTIMER_MODE_REL_HARD); + return 0; + } + +@@ -959,7 +959,7 @@ static int watchdog_cdev_register(struct watchdog_device *wdd) + dev_set_name(&wd_data->dev, "watchdog%d", wdd->id); + + kthread_init_work(&wd_data->work, watchdog_ping_work); +- hrtimer_init(&wd_data->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); ++ hrtimer_init(&wd_data->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD); + wd_data->timer.function = watchdog_timer_expired; + + if (wdd->id == 0) { +@@ -1007,7 +1007,7 @@ static int watchdog_cdev_register(struct watchdog_device *wdd) + __module_get(wdd->ops->owner); + get_device(&wd_data->dev); + if (handle_boot_enabled) +- hrtimer_start(&wd_data->timer, 0, HRTIMER_MODE_REL); ++ hrtimer_start(&wd_data->timer, 0, HRTIMER_MODE_REL_HARD); + else + pr_info("watchdog%d running and kernel based pre-userspace handler disabled\n", + wdd->id); diff --git a/debian/patches-rt/0250-drm-radeon-i915-Use-preempt_disable-enable_rt-where-.patch b/debian/patches-rt/0250-drm-radeon-i915-Use-preempt_disable-enable_rt-where-.patch new file mode 100644 index 000000000..9dc4e81e3 --- /dev/null +++ b/debian/patches-rt/0250-drm-radeon-i915-Use-preempt_disable-enable_rt-where-.patch @@ -0,0 +1,57 @@ +From: Mike Galbraith +Date: Sat, 27 Feb 2016 08:09:11 +0100 +Subject: [PATCH 250/342] drm,radeon,i915: Use preempt_disable/enable_rt() + where recommended +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=d94a37f0014c1bfccacffb6a70f731af4c289090 + +DRM folks identified the spots, so use them. + +Signed-off-by: Mike Galbraith +Cc: Sebastian Andrzej Siewior +Cc: linux-rt-users +Signed-off-by: Thomas Gleixner +--- + drivers/gpu/drm/i915/i915_irq.c | 2 ++ + drivers/gpu/drm/radeon/radeon_display.c | 2 ++ + 2 files changed, 4 insertions(+) + +diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c +index b7c398232136..eed1ba3009c6 100644 +--- a/drivers/gpu/drm/i915/i915_irq.c ++++ b/drivers/gpu/drm/i915/i915_irq.c +@@ -1025,6 +1025,7 @@ static bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe, + spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); + + /* preempt_disable_rt() should go right here in PREEMPT_RT patchset. */ ++ preempt_disable_rt(); + + /* Get optional system timestamp before query. */ + if (stime) +@@ -1076,6 +1077,7 @@ static bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe, + *etime = ktime_get(); + + /* preempt_enable_rt() should go right here in PREEMPT_RT patchset. */ ++ preempt_enable_rt(); + + spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags); + +diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c +index 5985efc5a1f3..de2552a40d36 100644 +--- a/drivers/gpu/drm/radeon/radeon_display.c ++++ b/drivers/gpu/drm/radeon/radeon_display.c +@@ -1818,6 +1818,7 @@ int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe, + struct radeon_device *rdev = dev->dev_private; + + /* preempt_disable_rt() should go right here in PREEMPT_RT patchset. */ ++ preempt_disable_rt(); + + /* Get optional system timestamp before query. */ + if (stime) +@@ -1910,6 +1911,7 @@ int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe, + *etime = ktime_get(); + + /* preempt_enable_rt() should go right here in PREEMPT_RT patchset. */ ++ preempt_enable_rt(); + + /* Decode into vertical and horizontal scanout position. */ + *vpos = position & 0x1fff; diff --git a/debian/patches-rt/0250-watchdog-prevent-deferral-of-watchdogd-wakeup-on-RT.patch b/debian/patches-rt/0250-watchdog-prevent-deferral-of-watchdogd-wakeup-on-RT.patch deleted file mode 100644 index c9d461226..000000000 --- a/debian/patches-rt/0250-watchdog-prevent-deferral-of-watchdogd-wakeup-on-RT.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 2536bb24992f08158455b5ad1434f439f6543db5 Mon Sep 17 00:00:00 2001 -From: Julia Cartwright -Date: Fri, 28 Sep 2018 21:03:51 +0000 -Subject: [PATCH 250/347] watchdog: prevent deferral of watchdogd wakeup on RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -When PREEMPT_RT_FULL is enabled, all hrtimer expiry functions are -deferred for execution into the context of ktimersoftd unless otherwise -annotated. - -Deferring the expiry of the hrtimer used by the watchdog core, however, -is a waste, as the callback does nothing but queue a kthread work item -and wakeup watchdogd. - -It's worst then that, too: the deferral through ktimersoftd also means -that for correct behavior a user must adjust the scheduling parameters -of both watchdogd _and_ ktimersoftd, which is unnecessary and has other -side effects (like causing unrelated expiry functions to execute at -potentially elevated priority). - -Instead, mark the hrtimer used by the watchdog core as being _HARD to -allow it's execution directly from hardirq context. The work done in -this expiry function is well-bounded and minimal. - -A user still must adjust the scheduling parameters of the watchdogd -to be correct w.r.t. their application needs. - -Cc: Guenter Roeck -Reported-and-tested-by: Steffen Trumtrar -Reported-by: Tim Sander -Signed-off-by: Julia Cartwright -Acked-by: Guenter Roeck -[bigeasy: use only HRTIMER_MODE_REL_HARD] -Signed-off-by: Sebastian Andrzej Siewior ---- - drivers/watchdog/watchdog_dev.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c -index 8fe59b7d8eec..516782cff8d2 100644 ---- a/drivers/watchdog/watchdog_dev.c -+++ b/drivers/watchdog/watchdog_dev.c -@@ -145,7 +145,7 @@ static inline void watchdog_update_worker(struct watchdog_device *wdd) - ktime_t t = watchdog_next_keepalive(wdd); - - if (t > 0) -- hrtimer_start(&wd_data->timer, t, HRTIMER_MODE_REL); -+ hrtimer_start(&wd_data->timer, t, HRTIMER_MODE_REL_HARD); - } else { - hrtimer_cancel(&wd_data->timer); - } -@@ -164,7 +164,7 @@ static int __watchdog_ping(struct watchdog_device *wdd) - if (ktime_after(earliest_keepalive, now)) { - hrtimer_start(&wd_data->timer, - ktime_sub(earliest_keepalive, now), -- HRTIMER_MODE_REL); -+ HRTIMER_MODE_REL_HARD); - return 0; - } - -@@ -959,7 +959,7 @@ static int watchdog_cdev_register(struct watchdog_device *wdd) - dev_set_name(&wd_data->dev, "watchdog%d", wdd->id); - - kthread_init_work(&wd_data->work, watchdog_ping_work); -- hrtimer_init(&wd_data->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); -+ hrtimer_init(&wd_data->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD); - wd_data->timer.function = watchdog_timer_expired; - - if (wdd->id == 0) { -@@ -1007,7 +1007,7 @@ static int watchdog_cdev_register(struct watchdog_device *wdd) - __module_get(wdd->ops->owner); - get_device(&wd_data->dev); - if (handle_boot_enabled) -- hrtimer_start(&wd_data->timer, 0, HRTIMER_MODE_REL); -+ hrtimer_start(&wd_data->timer, 0, HRTIMER_MODE_REL_HARD); - else - pr_info("watchdog%d running and kernel based pre-userspace handler disabled\n", - wdd->id); --- -2.36.1 - diff --git a/debian/patches-rt/0251-drm-i915-Use-local_lock-unlock_irq-in-intel_pipe_upd.patch b/debian/patches-rt/0251-drm-i915-Use-local_lock-unlock_irq-in-intel_pipe_upd.patch new file mode 100644 index 000000000..9d529c66e --- /dev/null +++ b/debian/patches-rt/0251-drm-i915-Use-local_lock-unlock_irq-in-intel_pipe_upd.patch @@ -0,0 +1,124 @@ +From: Mike Galbraith +Date: Sat, 27 Feb 2016 09:01:42 +0100 +Subject: [PATCH 251/342] drm,i915: Use local_lock/unlock_irq() in + intel_pipe_update_start/end() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=7f085a648643b652361155e0b483d114b769aaeb + +[ 8.014039] BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:918 +[ 8.014041] in_atomic(): 0, irqs_disabled(): 1, pid: 78, name: kworker/u4:4 +[ 8.014045] CPU: 1 PID: 78 Comm: kworker/u4:4 Not tainted 4.1.7-rt7 #5 +[ 8.014055] Workqueue: events_unbound async_run_entry_fn +[ 8.014059] 0000000000000000 ffff880037153748 ffffffff815f32c9 0000000000000002 +[ 8.014063] ffff88013a50e380 ffff880037153768 ffffffff815ef075 ffff8800372c06c8 +[ 8.014066] ffff8800372c06c8 ffff880037153778 ffffffff8107c0b3 ffff880037153798 +[ 8.014067] Call Trace: +[ 8.014074] [] dump_stack+0x4a/0x61 +[ 8.014078] [] ___might_sleep.part.93+0xe9/0xee +[ 8.014082] [] ___might_sleep+0x53/0x80 +[ 8.014086] [] rt_spin_lock+0x24/0x50 +[ 8.014090] [] prepare_to_wait+0x2b/0xa0 +[ 8.014152] [] intel_pipe_update_start+0x17c/0x300 [i915] +[ 8.014156] [] ? prepare_to_wait_event+0x120/0x120 +[ 8.014201] [] intel_begin_crtc_commit+0x166/0x1e0 [i915] +[ 8.014215] [] drm_atomic_helper_commit_planes+0x5d/0x1a0 [drm_kms_helper] +[ 8.014260] [] intel_atomic_commit+0xab/0xf0 [i915] +[ 8.014288] [] drm_atomic_commit+0x37/0x60 [drm] +[ 8.014298] [] drm_atomic_helper_plane_set_property+0x8d/0xd0 [drm_kms_helper] +[ 8.014301] [] ? __ww_mutex_lock+0x39/0x40 +[ 8.014319] [] drm_mode_plane_set_obj_prop+0x2d/0x90 [drm] +[ 8.014328] [] restore_fbdev_mode+0x6b/0xf0 [drm_kms_helper] +[ 8.014337] [] drm_fb_helper_restore_fbdev_mode_unlocked+0x29/0x80 [drm_kms_helper] +[ 8.014346] [] drm_fb_helper_set_par+0x22/0x50 [drm_kms_helper] +[ 8.014390] [] intel_fbdev_set_par+0x1a/0x60 [i915] +[ 8.014394] [] fbcon_init+0x4f4/0x580 +[ 8.014398] [] visual_init+0xbc/0x120 +[ 8.014401] [] do_bind_con_driver+0x163/0x330 +[ 8.014405] [] do_take_over_console+0x11c/0x1c0 +[ 8.014408] [] do_fbcon_takeover+0x63/0xd0 +[ 8.014410] [] fbcon_event_notify+0x785/0x8d0 +[ 8.014413] [] ? __might_sleep+0x4d/0x90 +[ 8.014416] [] notifier_call_chain+0x4e/0x80 +[ 8.014419] [] __blocking_notifier_call_chain+0x4d/0x70 +[ 8.014422] [] blocking_notifier_call_chain+0x16/0x20 +[ 8.014425] [] fb_notifier_call_chain+0x1b/0x20 +[ 8.014428] [] register_framebuffer+0x21a/0x350 +[ 8.014439] [] drm_fb_helper_initial_config+0x274/0x3e0 [drm_kms_helper] +[ 8.014483] [] intel_fbdev_initial_config+0x1b/0x20 [i915] +[ 8.014486] [] async_run_entry_fn+0x4c/0x160 +[ 8.014490] [] process_one_work+0x14a/0x470 +[ 8.014493] [] worker_thread+0x169/0x4c0 +[ 8.014496] [] ? process_one_work+0x470/0x470 +[ 8.014499] [] kthread+0xc6/0xe0 +[ 8.014502] [] ? queue_work_on+0x80/0x110 +[ 8.014506] [] ? kthread_worker_fn+0x1c0/0x1c0 + +Signed-off-by: Mike Galbraith +Cc: Sebastian Andrzej Siewior +Cc: linux-rt-users +Signed-off-by: Thomas Gleixner +--- + drivers/gpu/drm/i915/intel_sprite.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c +index f7026e887fa9..07e4ddebdd80 100644 +--- a/drivers/gpu/drm/i915/intel_sprite.c ++++ b/drivers/gpu/drm/i915/intel_sprite.c +@@ -36,6 +36,7 @@ + #include + #include + #include ++#include + #include "intel_drv.h" + #include "intel_frontbuffer.h" + #include +@@ -60,6 +61,8 @@ int intel_usecs_to_scanlines(const struct drm_display_mode *adjusted_mode, + #define VBLANK_EVASION_TIME_US 100 + #endif + ++static DEFINE_LOCAL_IRQ_LOCK(pipe_update_lock); ++ + /** + * intel_pipe_update_start() - start update of a set of display registers + * @new_crtc_state: the new crtc state +@@ -107,7 +110,7 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state) + if (intel_psr_wait_for_idle(new_crtc_state)) + DRM_ERROR("PSR idle timed out, atomic update may fail\n"); + +- local_irq_disable(); ++ local_lock_irq(pipe_update_lock); + + crtc->debug.min_vbl = min; + crtc->debug.max_vbl = max; +@@ -131,11 +134,11 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state) + break; + } + +- local_irq_enable(); ++ local_unlock_irq(pipe_update_lock); + + timeout = schedule_timeout(timeout); + +- local_irq_disable(); ++ local_lock_irq(pipe_update_lock); + } + + finish_wait(wq, &wait); +@@ -168,7 +171,7 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state) + return; + + irq_disable: +- local_irq_disable(); ++ local_lock_irq(pipe_update_lock); + } + + /** +@@ -204,7 +207,7 @@ void intel_pipe_update_end(struct intel_crtc_state *new_crtc_state) + new_crtc_state->base.event = NULL; + } + +- local_irq_enable(); ++ local_unlock_irq(pipe_update_lock); + + if (intel_vgpu_active(dev_priv)) + return; diff --git a/debian/patches-rt/0251-drm-radeon-i915-Use-preempt_disable-enable_rt-where-.patch b/debian/patches-rt/0251-drm-radeon-i915-Use-preempt_disable-enable_rt-where-.patch deleted file mode 100644 index 898eacd8a..000000000 --- a/debian/patches-rt/0251-drm-radeon-i915-Use-preempt_disable-enable_rt-where-.patch +++ /dev/null @@ -1,61 +0,0 @@ -From f85948d1377d8e7d97d94d7d90250791825fc355 Mon Sep 17 00:00:00 2001 -From: Mike Galbraith -Date: Sat, 27 Feb 2016 08:09:11 +0100 -Subject: [PATCH 251/347] drm,radeon,i915: Use preempt_disable/enable_rt() - where recommended -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -DRM folks identified the spots, so use them. - -Signed-off-by: Mike Galbraith -Cc: Sebastian Andrzej Siewior -Cc: linux-rt-users -Signed-off-by: Thomas Gleixner ---- - drivers/gpu/drm/i915/i915_irq.c | 2 ++ - drivers/gpu/drm/radeon/radeon_display.c | 2 ++ - 2 files changed, 4 insertions(+) - -diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c -index b7c398232136..eed1ba3009c6 100644 ---- a/drivers/gpu/drm/i915/i915_irq.c -+++ b/drivers/gpu/drm/i915/i915_irq.c -@@ -1025,6 +1025,7 @@ static bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe, - spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); - - /* preempt_disable_rt() should go right here in PREEMPT_RT patchset. */ -+ preempt_disable_rt(); - - /* Get optional system timestamp before query. */ - if (stime) -@@ -1076,6 +1077,7 @@ static bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe, - *etime = ktime_get(); - - /* preempt_enable_rt() should go right here in PREEMPT_RT patchset. */ -+ preempt_enable_rt(); - - spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags); - -diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c -index 5985efc5a1f3..de2552a40d36 100644 ---- a/drivers/gpu/drm/radeon/radeon_display.c -+++ b/drivers/gpu/drm/radeon/radeon_display.c -@@ -1818,6 +1818,7 @@ int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe, - struct radeon_device *rdev = dev->dev_private; - - /* preempt_disable_rt() should go right here in PREEMPT_RT patchset. */ -+ preempt_disable_rt(); - - /* Get optional system timestamp before query. */ - if (stime) -@@ -1910,6 +1911,7 @@ int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe, - *etime = ktime_get(); - - /* preempt_enable_rt() should go right here in PREEMPT_RT patchset. */ -+ preempt_enable_rt(); - - /* Decode into vertical and horizontal scanout position. */ - *vpos = position & 0x1fff; --- -2.36.1 - diff --git a/debian/patches-rt/0252-drm-i915-Use-local_lock-unlock_irq-in-intel_pipe_upd.patch b/debian/patches-rt/0252-drm-i915-Use-local_lock-unlock_irq-in-intel_pipe_upd.patch deleted file mode 100644 index dde8a6cd7..000000000 --- a/debian/patches-rt/0252-drm-i915-Use-local_lock-unlock_irq-in-intel_pipe_upd.patch +++ /dev/null @@ -1,128 +0,0 @@ -From d4f3a1228c468da8962aa6b9742e67924796defd Mon Sep 17 00:00:00 2001 -From: Mike Galbraith -Date: Sat, 27 Feb 2016 09:01:42 +0100 -Subject: [PATCH 252/347] drm,i915: Use local_lock/unlock_irq() in - intel_pipe_update_start/end() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ 8.014039] BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:918 -[ 8.014041] in_atomic(): 0, irqs_disabled(): 1, pid: 78, name: kworker/u4:4 -[ 8.014045] CPU: 1 PID: 78 Comm: kworker/u4:4 Not tainted 4.1.7-rt7 #5 -[ 8.014055] Workqueue: events_unbound async_run_entry_fn -[ 8.014059] 0000000000000000 ffff880037153748 ffffffff815f32c9 0000000000000002 -[ 8.014063] ffff88013a50e380 ffff880037153768 ffffffff815ef075 ffff8800372c06c8 -[ 8.014066] ffff8800372c06c8 ffff880037153778 ffffffff8107c0b3 ffff880037153798 -[ 8.014067] Call Trace: -[ 8.014074] [] dump_stack+0x4a/0x61 -[ 8.014078] [] ___might_sleep.part.93+0xe9/0xee -[ 8.014082] [] ___might_sleep+0x53/0x80 -[ 8.014086] [] rt_spin_lock+0x24/0x50 -[ 8.014090] [] prepare_to_wait+0x2b/0xa0 -[ 8.014152] [] intel_pipe_update_start+0x17c/0x300 [i915] -[ 8.014156] [] ? prepare_to_wait_event+0x120/0x120 -[ 8.014201] [] intel_begin_crtc_commit+0x166/0x1e0 [i915] -[ 8.014215] [] drm_atomic_helper_commit_planes+0x5d/0x1a0 [drm_kms_helper] -[ 8.014260] [] intel_atomic_commit+0xab/0xf0 [i915] -[ 8.014288] [] drm_atomic_commit+0x37/0x60 [drm] -[ 8.014298] [] drm_atomic_helper_plane_set_property+0x8d/0xd0 [drm_kms_helper] -[ 8.014301] [] ? __ww_mutex_lock+0x39/0x40 -[ 8.014319] [] drm_mode_plane_set_obj_prop+0x2d/0x90 [drm] -[ 8.014328] [] restore_fbdev_mode+0x6b/0xf0 [drm_kms_helper] -[ 8.014337] [] drm_fb_helper_restore_fbdev_mode_unlocked+0x29/0x80 [drm_kms_helper] -[ 8.014346] [] drm_fb_helper_set_par+0x22/0x50 [drm_kms_helper] -[ 8.014390] [] intel_fbdev_set_par+0x1a/0x60 [i915] -[ 8.014394] [] fbcon_init+0x4f4/0x580 -[ 8.014398] [] visual_init+0xbc/0x120 -[ 8.014401] [] do_bind_con_driver+0x163/0x330 -[ 8.014405] [] do_take_over_console+0x11c/0x1c0 -[ 8.014408] [] do_fbcon_takeover+0x63/0xd0 -[ 8.014410] [] fbcon_event_notify+0x785/0x8d0 -[ 8.014413] [] ? __might_sleep+0x4d/0x90 -[ 8.014416] [] notifier_call_chain+0x4e/0x80 -[ 8.014419] [] __blocking_notifier_call_chain+0x4d/0x70 -[ 8.014422] [] blocking_notifier_call_chain+0x16/0x20 -[ 8.014425] [] fb_notifier_call_chain+0x1b/0x20 -[ 8.014428] [] register_framebuffer+0x21a/0x350 -[ 8.014439] [] drm_fb_helper_initial_config+0x274/0x3e0 [drm_kms_helper] -[ 8.014483] [] intel_fbdev_initial_config+0x1b/0x20 [i915] -[ 8.014486] [] async_run_entry_fn+0x4c/0x160 -[ 8.014490] [] process_one_work+0x14a/0x470 -[ 8.014493] [] worker_thread+0x169/0x4c0 -[ 8.014496] [] ? process_one_work+0x470/0x470 -[ 8.014499] [] kthread+0xc6/0xe0 -[ 8.014502] [] ? queue_work_on+0x80/0x110 -[ 8.014506] [] ? kthread_worker_fn+0x1c0/0x1c0 - -Signed-off-by: Mike Galbraith -Cc: Sebastian Andrzej Siewior -Cc: linux-rt-users -Signed-off-by: Thomas Gleixner ---- - drivers/gpu/drm/i915/intel_sprite.c | 13 ++++++++----- - 1 file changed, 8 insertions(+), 5 deletions(-) - -diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c -index f7026e887fa9..07e4ddebdd80 100644 ---- a/drivers/gpu/drm/i915/intel_sprite.c -+++ b/drivers/gpu/drm/i915/intel_sprite.c -@@ -36,6 +36,7 @@ - #include - #include - #include -+#include - #include "intel_drv.h" - #include "intel_frontbuffer.h" - #include -@@ -60,6 +61,8 @@ int intel_usecs_to_scanlines(const struct drm_display_mode *adjusted_mode, - #define VBLANK_EVASION_TIME_US 100 - #endif - -+static DEFINE_LOCAL_IRQ_LOCK(pipe_update_lock); -+ - /** - * intel_pipe_update_start() - start update of a set of display registers - * @new_crtc_state: the new crtc state -@@ -107,7 +110,7 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state) - if (intel_psr_wait_for_idle(new_crtc_state)) - DRM_ERROR("PSR idle timed out, atomic update may fail\n"); - -- local_irq_disable(); -+ local_lock_irq(pipe_update_lock); - - crtc->debug.min_vbl = min; - crtc->debug.max_vbl = max; -@@ -131,11 +134,11 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state) - break; - } - -- local_irq_enable(); -+ local_unlock_irq(pipe_update_lock); - - timeout = schedule_timeout(timeout); - -- local_irq_disable(); -+ local_lock_irq(pipe_update_lock); - } - - finish_wait(wq, &wait); -@@ -168,7 +171,7 @@ void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state) - return; - - irq_disable: -- local_irq_disable(); -+ local_lock_irq(pipe_update_lock); - } - - /** -@@ -204,7 +207,7 @@ void intel_pipe_update_end(struct intel_crtc_state *new_crtc_state) - new_crtc_state->base.event = NULL; - } - -- local_irq_enable(); -+ local_unlock_irq(pipe_update_lock); - - if (intel_vgpu_active(dev_priv)) - return; --- -2.36.1 - diff --git a/debian/patches-rt/0252-drm-i915-disable-tracing-on-RT.patch b/debian/patches-rt/0252-drm-i915-disable-tracing-on-RT.patch new file mode 100644 index 000000000..714ab87a8 --- /dev/null +++ b/debian/patches-rt/0252-drm-i915-disable-tracing-on-RT.patch @@ -0,0 +1,43 @@ +From: Sebastian Andrzej Siewior +Date: Thu, 6 Dec 2018 09:52:20 +0100 +Subject: [PATCH 252/342] drm/i915: disable tracing on -RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=ac5ab95c075b23b5b71b8c9727bc0e4aabe64906 + +Luca Abeni reported this: +| BUG: scheduling while atomic: kworker/u8:2/15203/0x00000003 +| CPU: 1 PID: 15203 Comm: kworker/u8:2 Not tainted 4.19.1-rt3 #10 +| Call Trace: +| rt_spin_lock+0x3f/0x50 +| gen6_read32+0x45/0x1d0 [i915] +| g4x_get_vblank_counter+0x36/0x40 [i915] +| trace_event_raw_event_i915_pipe_update_start+0x7d/0xf0 [i915] + +The tracing events use trace_i915_pipe_update_start() among other events +use functions acquire spin locks. A few trace points use +intel_get_crtc_scanline(), others use ->get_vblank_counter() wich also +might acquire a sleeping lock. + +Based on this I don't see any other way than disable trace points on RT. + +Cc: stable-rt@vger.kernel.org +Reported-by: Luca Abeni +Signed-off-by: Sebastian Andrzej Siewior +--- + drivers/gpu/drm/i915/i915_trace.h | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h +index b50c6b829715..cc54ec0ef75c 100644 +--- a/drivers/gpu/drm/i915/i915_trace.h ++++ b/drivers/gpu/drm/i915/i915_trace.h +@@ -2,6 +2,10 @@ + #if !defined(_I915_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ) + #define _I915_TRACE_H_ + ++#ifdef CONFIG_PREEMPT_RT_BASE ++#define NOTRACE ++#endif ++ + #include + #include + #include diff --git a/debian/patches-rt/0253-drm-i915-disable-tracing-on-RT.patch b/debian/patches-rt/0253-drm-i915-disable-tracing-on-RT.patch deleted file mode 100644 index 78662975e..000000000 --- a/debian/patches-rt/0253-drm-i915-disable-tracing-on-RT.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 5e32c1ba695c3d32da799c26e267183a4516ffb8 Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Thu, 6 Dec 2018 09:52:20 +0100 -Subject: [PATCH 253/347] drm/i915: disable tracing on -RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -Luca Abeni reported this: -| BUG: scheduling while atomic: kworker/u8:2/15203/0x00000003 -| CPU: 1 PID: 15203 Comm: kworker/u8:2 Not tainted 4.19.1-rt3 #10 -| Call Trace: -| rt_spin_lock+0x3f/0x50 -| gen6_read32+0x45/0x1d0 [i915] -| g4x_get_vblank_counter+0x36/0x40 [i915] -| trace_event_raw_event_i915_pipe_update_start+0x7d/0xf0 [i915] - -The tracing events use trace_i915_pipe_update_start() among other events -use functions acquire spin locks. A few trace points use -intel_get_crtc_scanline(), others use ->get_vblank_counter() wich also -might acquire a sleeping lock. - -Based on this I don't see any other way than disable trace points on RT. - -Cc: stable-rt@vger.kernel.org -Reported-by: Luca Abeni -Signed-off-by: Sebastian Andrzej Siewior ---- - drivers/gpu/drm/i915/i915_trace.h | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h -index b50c6b829715..cc54ec0ef75c 100644 ---- a/drivers/gpu/drm/i915/i915_trace.h -+++ b/drivers/gpu/drm/i915/i915_trace.h -@@ -2,6 +2,10 @@ - #if !defined(_I915_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ) - #define _I915_TRACE_H_ - -+#ifdef CONFIG_PREEMPT_RT_BASE -+#define NOTRACE -+#endif -+ - #include - #include - #include --- -2.36.1 - diff --git a/debian/patches-rt/0253-drm-i915-skip-DRM_I915_LOW_LEVEL_TRACEPOINTS-with-NO.patch b/debian/patches-rt/0253-drm-i915-skip-DRM_I915_LOW_LEVEL_TRACEPOINTS-with-NO.patch new file mode 100644 index 000000000..b80f180b8 --- /dev/null +++ b/debian/patches-rt/0253-drm-i915-skip-DRM_I915_LOW_LEVEL_TRACEPOINTS-with-NO.patch @@ -0,0 +1,29 @@ +From: Sebastian Andrzej Siewior +Date: Wed, 19 Dec 2018 10:47:02 +0100 +Subject: [PATCH 253/342] drm/i915: skip DRM_I915_LOW_LEVEL_TRACEPOINTS with + NOTRACE +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=a8537101898e867f331b1425ee9d3ed7c42e479d + +The order of the header files is important. If this header file is +included after tracepoint.h was included then the NOTRACE here becomes a +nop. Currently this happens for two .c files which use the tracepoitns +behind DRM_I915_LOW_LEVEL_TRACEPOINTS. + +Signed-off-by: Sebastian Andrzej Siewior +--- + drivers/gpu/drm/i915/i915_trace.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h +index cc54ec0ef75c..33028d8f470e 100644 +--- a/drivers/gpu/drm/i915/i915_trace.h ++++ b/drivers/gpu/drm/i915/i915_trace.h +@@ -683,7 +683,7 @@ DEFINE_EVENT(i915_request, i915_request_add, + TP_ARGS(rq) + ); + +-#if defined(CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS) ++#if defined(CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS) && !defined(NOTRACE) + DEFINE_EVENT(i915_request, i915_request_submit, + TP_PROTO(struct i915_request *rq), + TP_ARGS(rq) diff --git a/debian/patches-rt/0254-cgroups-use-simple-wait-in-css_release.patch b/debian/patches-rt/0254-cgroups-use-simple-wait-in-css_release.patch new file mode 100644 index 000000000..dc69d3b4d --- /dev/null +++ b/debian/patches-rt/0254-cgroups-use-simple-wait-in-css_release.patch @@ -0,0 +1,91 @@ +From: Sebastian Andrzej Siewior +Date: Fri, 13 Feb 2015 15:52:24 +0100 +Subject: [PATCH 254/342] cgroups: use simple wait in css_release() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=5ac1545190c5a7071dc36c3dfda12707af3664c9 + +To avoid: +|BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:914 +|in_atomic(): 1, irqs_disabled(): 0, pid: 92, name: rcuc/11 +|2 locks held by rcuc/11/92: +| #0: (rcu_callback){......}, at: [] rcu_cpu_kthread+0x3de/0x940 +| #1: (rcu_read_lock_sched){......}, at: [] percpu_ref_call_confirm_rcu+0x0/0xd0 +|Preemption disabled at:[] percpu_ref_switch_to_atomic_rcu+0x82/0xc0 +|CPU: 11 PID: 92 Comm: rcuc/11 Not tainted 3.18.7-rt0+ #1 +| ffff8802398cdf80 ffff880235f0bc28 ffffffff815b3a12 0000000000000000 +| 0000000000000000 ffff880235f0bc48 ffffffff8109aa16 0000000000000000 +| ffff8802398cdf80 ffff880235f0bc78 ffffffff815b8dd4 000000000000df80 +|Call Trace: +| [] dump_stack+0x4f/0x7c +| [] __might_sleep+0x116/0x190 +| [] rt_spin_lock+0x24/0x60 +| [] queue_work_on+0x6d/0x1d0 +| [] css_release+0x81/0x90 +| [] percpu_ref_call_confirm_rcu+0xbe/0xd0 +| [] percpu_ref_switch_to_atomic_rcu+0x82/0xc0 +| [] rcu_cpu_kthread+0x445/0x940 +| [] smpboot_thread_fn+0x18d/0x2d0 +| [] kthread+0xe8/0x100 +| [] ret_from_fork+0x7c/0xb0 + +Signed-off-by: Sebastian Andrzej Siewior +--- + include/linux/cgroup-defs.h | 2 ++ + kernel/cgroup/cgroup.c | 9 +++++---- + 2 files changed, 7 insertions(+), 4 deletions(-) + +diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h +index 56442d3b651d..1d2275287f0e 100644 +--- a/include/linux/cgroup-defs.h ++++ b/include/linux/cgroup-defs.h +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + + #ifdef CONFIG_CGROUPS + +@@ -157,6 +158,7 @@ struct cgroup_subsys_state { + + /* percpu_ref killing and RCU release */ + struct work_struct destroy_work; ++ struct swork_event destroy_swork; + struct rcu_work destroy_rwork; + + /* +diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c +index a892a99eb4bf..992f0ee8dba1 100644 +--- a/kernel/cgroup/cgroup.c ++++ b/kernel/cgroup/cgroup.c +@@ -4747,10 +4747,10 @@ static void css_free_rwork_fn(struct work_struct *work) + } + } + +-static void css_release_work_fn(struct work_struct *work) ++static void css_release_work_fn(struct swork_event *sev) + { + struct cgroup_subsys_state *css = +- container_of(work, struct cgroup_subsys_state, destroy_work); ++ container_of(sev, struct cgroup_subsys_state, destroy_swork); + struct cgroup_subsys *ss = css->ss; + struct cgroup *cgrp = css->cgroup; + +@@ -4812,8 +4812,8 @@ static void css_release(struct percpu_ref *ref) + struct cgroup_subsys_state *css = + container_of(ref, struct cgroup_subsys_state, refcnt); + +- INIT_WORK(&css->destroy_work, css_release_work_fn); +- queue_work(cgroup_destroy_wq, &css->destroy_work); ++ INIT_SWORK(&css->destroy_swork, css_release_work_fn); ++ swork_queue(&css->destroy_swork); + } + + static void init_and_link_css(struct cgroup_subsys_state *css, +@@ -5533,6 +5533,7 @@ static int __init cgroup_wq_init(void) + */ + cgroup_destroy_wq = alloc_workqueue("cgroup_destroy", 0, 1); + BUG_ON(!cgroup_destroy_wq); ++ BUG_ON(swork_get()); + return 0; + } + core_initcall(cgroup_wq_init); diff --git a/debian/patches-rt/0254-drm-i915-skip-DRM_I915_LOW_LEVEL_TRACEPOINTS-with-NO.patch b/debian/patches-rt/0254-drm-i915-skip-DRM_I915_LOW_LEVEL_TRACEPOINTS-with-NO.patch deleted file mode 100644 index 773a63282..000000000 --- a/debian/patches-rt/0254-drm-i915-skip-DRM_I915_LOW_LEVEL_TRACEPOINTS-with-NO.patch +++ /dev/null @@ -1,33 +0,0 @@ -From ce732f94a77dce31d3b008046d756121676cc0f4 Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Wed, 19 Dec 2018 10:47:02 +0100 -Subject: [PATCH 254/347] drm/i915: skip DRM_I915_LOW_LEVEL_TRACEPOINTS with - NOTRACE -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -The order of the header files is important. If this header file is -included after tracepoint.h was included then the NOTRACE here becomes a -nop. Currently this happens for two .c files which use the tracepoitns -behind DRM_I915_LOW_LEVEL_TRACEPOINTS. - -Signed-off-by: Sebastian Andrzej Siewior ---- - drivers/gpu/drm/i915/i915_trace.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h -index cc54ec0ef75c..33028d8f470e 100644 ---- a/drivers/gpu/drm/i915/i915_trace.h -+++ b/drivers/gpu/drm/i915/i915_trace.h -@@ -683,7 +683,7 @@ DEFINE_EVENT(i915_request, i915_request_add, - TP_ARGS(rq) - ); - --#if defined(CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS) -+#if defined(CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS) && !defined(NOTRACE) - DEFINE_EVENT(i915_request, i915_request_submit, - TP_PROTO(struct i915_request *rq), - TP_ARGS(rq) --- -2.36.1 - diff --git a/debian/patches-rt/0255-cgroups-use-simple-wait-in-css_release.patch b/debian/patches-rt/0255-cgroups-use-simple-wait-in-css_release.patch deleted file mode 100644 index 684e7bd06..000000000 --- a/debian/patches-rt/0255-cgroups-use-simple-wait-in-css_release.patch +++ /dev/null @@ -1,95 +0,0 @@ -From 8aa689c199e634af88b029260b92afed2a93b215 Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Fri, 13 Feb 2015 15:52:24 +0100 -Subject: [PATCH 255/347] cgroups: use simple wait in css_release() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -To avoid: -|BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:914 -|in_atomic(): 1, irqs_disabled(): 0, pid: 92, name: rcuc/11 -|2 locks held by rcuc/11/92: -| #0: (rcu_callback){......}, at: [] rcu_cpu_kthread+0x3de/0x940 -| #1: (rcu_read_lock_sched){......}, at: [] percpu_ref_call_confirm_rcu+0x0/0xd0 -|Preemption disabled at:[] percpu_ref_switch_to_atomic_rcu+0x82/0xc0 -|CPU: 11 PID: 92 Comm: rcuc/11 Not tainted 3.18.7-rt0+ #1 -| ffff8802398cdf80 ffff880235f0bc28 ffffffff815b3a12 0000000000000000 -| 0000000000000000 ffff880235f0bc48 ffffffff8109aa16 0000000000000000 -| ffff8802398cdf80 ffff880235f0bc78 ffffffff815b8dd4 000000000000df80 -|Call Trace: -| [] dump_stack+0x4f/0x7c -| [] __might_sleep+0x116/0x190 -| [] rt_spin_lock+0x24/0x60 -| [] queue_work_on+0x6d/0x1d0 -| [] css_release+0x81/0x90 -| [] percpu_ref_call_confirm_rcu+0xbe/0xd0 -| [] percpu_ref_switch_to_atomic_rcu+0x82/0xc0 -| [] rcu_cpu_kthread+0x445/0x940 -| [] smpboot_thread_fn+0x18d/0x2d0 -| [] kthread+0xe8/0x100 -| [] ret_from_fork+0x7c/0xb0 - -Signed-off-by: Sebastian Andrzej Siewior ---- - include/linux/cgroup-defs.h | 2 ++ - kernel/cgroup/cgroup.c | 9 +++++---- - 2 files changed, 7 insertions(+), 4 deletions(-) - -diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h -index f92264d1ed4f..cc912f3dc203 100644 ---- a/include/linux/cgroup-defs.h -+++ b/include/linux/cgroup-defs.h -@@ -20,6 +20,7 @@ - #include - #include - #include -+#include - - #ifdef CONFIG_CGROUPS - -@@ -157,6 +158,7 @@ struct cgroup_subsys_state { - - /* percpu_ref killing and RCU release */ - struct work_struct destroy_work; -+ struct swork_event destroy_swork; - struct rcu_work destroy_rwork; - - /* -diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c -index 4e8284d8cacc..86b10cb1d68a 100644 ---- a/kernel/cgroup/cgroup.c -+++ b/kernel/cgroup/cgroup.c -@@ -4738,10 +4738,10 @@ static void css_free_rwork_fn(struct work_struct *work) - } - } - --static void css_release_work_fn(struct work_struct *work) -+static void css_release_work_fn(struct swork_event *sev) - { - struct cgroup_subsys_state *css = -- container_of(work, struct cgroup_subsys_state, destroy_work); -+ container_of(sev, struct cgroup_subsys_state, destroy_swork); - struct cgroup_subsys *ss = css->ss; - struct cgroup *cgrp = css->cgroup; - -@@ -4803,8 +4803,8 @@ static void css_release(struct percpu_ref *ref) - struct cgroup_subsys_state *css = - container_of(ref, struct cgroup_subsys_state, refcnt); - -- INIT_WORK(&css->destroy_work, css_release_work_fn); -- queue_work(cgroup_destroy_wq, &css->destroy_work); -+ INIT_SWORK(&css->destroy_swork, css_release_work_fn); -+ swork_queue(&css->destroy_swork); - } - - static void init_and_link_css(struct cgroup_subsys_state *css, -@@ -5524,6 +5524,7 @@ static int __init cgroup_wq_init(void) - */ - cgroup_destroy_wq = alloc_workqueue("cgroup_destroy", 0, 1); - BUG_ON(!cgroup_destroy_wq); -+ BUG_ON(swork_get()); - return 0; - } - core_initcall(cgroup_wq_init); --- -2.36.1 - diff --git a/debian/patches-rt/0255-cpuset-Convert-callback_lock-to-raw_spinlock_t.patch b/debian/patches-rt/0255-cpuset-Convert-callback_lock-to-raw_spinlock_t.patch new file mode 100644 index 000000000..0b163ce8b --- /dev/null +++ b/debian/patches-rt/0255-cpuset-Convert-callback_lock-to-raw_spinlock_t.patch @@ -0,0 +1,289 @@ +From: Mike Galbraith +Date: Sun, 8 Jan 2017 09:32:25 +0100 +Subject: [PATCH 255/342] cpuset: Convert callback_lock to raw_spinlock_t +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=a75ea5624901308867ac5949e01e65b349192283 + +The two commits below add up to a cpuset might_sleep() splat for RT: + +8447a0fee974 cpuset: convert callback_mutex to a spinlock +344736f29b35 cpuset: simplify cpuset_node_allowed API + +BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:995 +in_atomic(): 0, irqs_disabled(): 1, pid: 11718, name: cset +CPU: 135 PID: 11718 Comm: cset Tainted: G E 4.10.0-rt1-rt #4 +Hardware name: Intel Corporation BRICKLAND/BRICKLAND, BIOS BRHSXSD1.86B.0056.R01.1409242327 09/24/2014 +Call Trace: + ? dump_stack+0x5c/0x81 + ? ___might_sleep+0xf4/0x170 + ? rt_spin_lock+0x1c/0x50 + ? __cpuset_node_allowed+0x66/0xc0 + ? ___slab_alloc+0x390/0x570 + ? anon_vma_fork+0x8f/0x140 + ? copy_page_range+0x6cf/0xb00 + ? anon_vma_fork+0x8f/0x140 + ? __slab_alloc.isra.74+0x5a/0x81 + ? anon_vma_fork+0x8f/0x140 + ? kmem_cache_alloc+0x1b5/0x1f0 + ? anon_vma_fork+0x8f/0x140 + ? copy_process.part.35+0x1670/0x1ee0 + ? _do_fork+0xdd/0x3f0 + ? _do_fork+0xdd/0x3f0 + ? do_syscall_64+0x61/0x170 + ? entry_SYSCALL64_slow_path+0x25/0x25 + +The later ensured that a NUMA box WILL take callback_lock in atomic +context by removing the allocator and reclaim path __GFP_HARDWALL +usage which prevented such contexts from taking callback_mutex. + +One option would be to reinstate __GFP_HARDWALL protections for +RT, however, as the 8447a0fee974 changelog states: + +The callback_mutex is only used to synchronize reads/updates of cpusets' +flags and cpu/node masks. These operations should always proceed fast so +there's no reason why we can't use a spinlock instead of the mutex. + +Cc: stable-rt@vger.kernel.org +Signed-off-by: Mike Galbraith +Signed-off-by: Sebastian Andrzej Siewior +--- + kernel/cgroup/cpuset.c | 66 +++++++++++++++++++++--------------------- + 1 file changed, 33 insertions(+), 33 deletions(-) + +diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c +index 35541e1dfad9..42ed4e497336 100644 +--- a/kernel/cgroup/cpuset.c ++++ b/kernel/cgroup/cpuset.c +@@ -288,7 +288,7 @@ static struct cpuset top_cpuset = { + */ + + static DEFINE_MUTEX(cpuset_mutex); +-static DEFINE_SPINLOCK(callback_lock); ++static DEFINE_RAW_SPINLOCK(callback_lock); + + static struct workqueue_struct *cpuset_migrate_mm_wq; + +@@ -922,9 +922,9 @@ static void update_cpumasks_hier(struct cpuset *cs, struct cpumask *new_cpus) + continue; + rcu_read_unlock(); + +- spin_lock_irq(&callback_lock); ++ raw_spin_lock_irq(&callback_lock); + cpumask_copy(cp->effective_cpus, new_cpus); +- spin_unlock_irq(&callback_lock); ++ raw_spin_unlock_irq(&callback_lock); + + WARN_ON(!is_in_v2_mode() && + !cpumask_equal(cp->cpus_allowed, cp->effective_cpus)); +@@ -989,9 +989,9 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs, + if (retval < 0) + return retval; + +- spin_lock_irq(&callback_lock); ++ raw_spin_lock_irq(&callback_lock); + cpumask_copy(cs->cpus_allowed, trialcs->cpus_allowed); +- spin_unlock_irq(&callback_lock); ++ raw_spin_unlock_irq(&callback_lock); + + /* use trialcs->cpus_allowed as a temp variable */ + update_cpumasks_hier(cs, trialcs->cpus_allowed); +@@ -1175,9 +1175,9 @@ static void update_nodemasks_hier(struct cpuset *cs, nodemask_t *new_mems) + continue; + rcu_read_unlock(); + +- spin_lock_irq(&callback_lock); ++ raw_spin_lock_irq(&callback_lock); + cp->effective_mems = *new_mems; +- spin_unlock_irq(&callback_lock); ++ raw_spin_unlock_irq(&callback_lock); + + WARN_ON(!is_in_v2_mode() && + !nodes_equal(cp->mems_allowed, cp->effective_mems)); +@@ -1245,9 +1245,9 @@ static int update_nodemask(struct cpuset *cs, struct cpuset *trialcs, + if (retval < 0) + goto done; + +- spin_lock_irq(&callback_lock); ++ raw_spin_lock_irq(&callback_lock); + cs->mems_allowed = trialcs->mems_allowed; +- spin_unlock_irq(&callback_lock); ++ raw_spin_unlock_irq(&callback_lock); + + /* use trialcs->mems_allowed as a temp variable */ + update_nodemasks_hier(cs, &trialcs->mems_allowed); +@@ -1338,9 +1338,9 @@ static int update_flag(cpuset_flagbits_t bit, struct cpuset *cs, + spread_flag_changed = ((is_spread_slab(cs) != is_spread_slab(trialcs)) + || (is_spread_page(cs) != is_spread_page(trialcs))); + +- spin_lock_irq(&callback_lock); ++ raw_spin_lock_irq(&callback_lock); + cs->flags = trialcs->flags; +- spin_unlock_irq(&callback_lock); ++ raw_spin_unlock_irq(&callback_lock); + + if (!cpumask_empty(trialcs->cpus_allowed) && balance_flag_changed) + rebuild_sched_domains_locked(); +@@ -1761,7 +1761,7 @@ static int cpuset_common_seq_show(struct seq_file *sf, void *v) + cpuset_filetype_t type = seq_cft(sf)->private; + int ret = 0; + +- spin_lock_irq(&callback_lock); ++ raw_spin_lock_irq(&callback_lock); + + switch (type) { + case FILE_CPULIST: +@@ -1780,7 +1780,7 @@ static int cpuset_common_seq_show(struct seq_file *sf, void *v) + ret = -EINVAL; + } + +- spin_unlock_irq(&callback_lock); ++ raw_spin_unlock_irq(&callback_lock); + return ret; + } + +@@ -1995,12 +1995,12 @@ static int cpuset_css_online(struct cgroup_subsys_state *css) + + cpuset_inc(); + +- spin_lock_irq(&callback_lock); ++ raw_spin_lock_irq(&callback_lock); + if (is_in_v2_mode()) { + cpumask_copy(cs->effective_cpus, parent->effective_cpus); + cs->effective_mems = parent->effective_mems; + } +- spin_unlock_irq(&callback_lock); ++ raw_spin_unlock_irq(&callback_lock); + + if (!test_bit(CGRP_CPUSET_CLONE_CHILDREN, &css->cgroup->flags)) + goto out_unlock; +@@ -2027,12 +2027,12 @@ static int cpuset_css_online(struct cgroup_subsys_state *css) + } + rcu_read_unlock(); + +- spin_lock_irq(&callback_lock); ++ raw_spin_lock_irq(&callback_lock); + cs->mems_allowed = parent->mems_allowed; + cs->effective_mems = parent->mems_allowed; + cpumask_copy(cs->cpus_allowed, parent->cpus_allowed); + cpumask_copy(cs->effective_cpus, parent->cpus_allowed); +- spin_unlock_irq(&callback_lock); ++ raw_spin_unlock_irq(&callback_lock); + out_unlock: + mutex_unlock(&cpuset_mutex); + return 0; +@@ -2071,7 +2071,7 @@ static void cpuset_css_free(struct cgroup_subsys_state *css) + static void cpuset_bind(struct cgroup_subsys_state *root_css) + { + mutex_lock(&cpuset_mutex); +- spin_lock_irq(&callback_lock); ++ raw_spin_lock_irq(&callback_lock); + + if (is_in_v2_mode()) { + cpumask_copy(top_cpuset.cpus_allowed, cpu_possible_mask); +@@ -2082,7 +2082,7 @@ static void cpuset_bind(struct cgroup_subsys_state *root_css) + top_cpuset.mems_allowed = top_cpuset.effective_mems; + } + +- spin_unlock_irq(&callback_lock); ++ raw_spin_unlock_irq(&callback_lock); + mutex_unlock(&cpuset_mutex); + } + +@@ -2180,12 +2180,12 @@ hotplug_update_tasks_legacy(struct cpuset *cs, + { + bool is_empty; + +- spin_lock_irq(&callback_lock); ++ raw_spin_lock_irq(&callback_lock); + cpumask_copy(cs->cpus_allowed, new_cpus); + cpumask_copy(cs->effective_cpus, new_cpus); + cs->mems_allowed = *new_mems; + cs->effective_mems = *new_mems; +- spin_unlock_irq(&callback_lock); ++ raw_spin_unlock_irq(&callback_lock); + + /* + * Don't call update_tasks_cpumask() if the cpuset becomes empty, +@@ -2222,10 +2222,10 @@ hotplug_update_tasks(struct cpuset *cs, + if (nodes_empty(*new_mems)) + *new_mems = parent_cs(cs)->effective_mems; + +- spin_lock_irq(&callback_lock); ++ raw_spin_lock_irq(&callback_lock); + cpumask_copy(cs->effective_cpus, new_cpus); + cs->effective_mems = *new_mems; +- spin_unlock_irq(&callback_lock); ++ raw_spin_unlock_irq(&callback_lock); + + if (cpus_updated) + update_tasks_cpumask(cs); +@@ -2318,21 +2318,21 @@ static void cpuset_hotplug_workfn(struct work_struct *work) + + /* synchronize cpus_allowed to cpu_active_mask */ + if (cpus_updated) { +- spin_lock_irq(&callback_lock); ++ raw_spin_lock_irq(&callback_lock); + if (!on_dfl) + cpumask_copy(top_cpuset.cpus_allowed, &new_cpus); + cpumask_copy(top_cpuset.effective_cpus, &new_cpus); +- spin_unlock_irq(&callback_lock); ++ raw_spin_unlock_irq(&callback_lock); + /* we don't mess with cpumasks of tasks in top_cpuset */ + } + + /* synchronize mems_allowed to N_MEMORY */ + if (mems_updated) { +- spin_lock_irq(&callback_lock); ++ raw_spin_lock_irq(&callback_lock); + if (!on_dfl) + top_cpuset.mems_allowed = new_mems; + top_cpuset.effective_mems = new_mems; +- spin_unlock_irq(&callback_lock); ++ raw_spin_unlock_irq(&callback_lock); + update_tasks_nodemask(&top_cpuset); + } + +@@ -2434,11 +2434,11 @@ void cpuset_cpus_allowed(struct task_struct *tsk, struct cpumask *pmask) + { + unsigned long flags; + +- spin_lock_irqsave(&callback_lock, flags); ++ raw_spin_lock_irqsave(&callback_lock, flags); + rcu_read_lock(); + guarantee_online_cpus(task_cs(tsk), pmask); + rcu_read_unlock(); +- spin_unlock_irqrestore(&callback_lock, flags); ++ raw_spin_unlock_irqrestore(&callback_lock, flags); + } + + /** +@@ -2499,11 +2499,11 @@ nodemask_t cpuset_mems_allowed(struct task_struct *tsk) + nodemask_t mask; + unsigned long flags; + +- spin_lock_irqsave(&callback_lock, flags); ++ raw_spin_lock_irqsave(&callback_lock, flags); + rcu_read_lock(); + guarantee_online_mems(task_cs(tsk), &mask); + rcu_read_unlock(); +- spin_unlock_irqrestore(&callback_lock, flags); ++ raw_spin_unlock_irqrestore(&callback_lock, flags); + + return mask; + } +@@ -2595,14 +2595,14 @@ bool __cpuset_node_allowed(int node, gfp_t gfp_mask) + return true; + + /* Not hardwall and node outside mems_allowed: scan up cpusets */ +- spin_lock_irqsave(&callback_lock, flags); ++ raw_spin_lock_irqsave(&callback_lock, flags); + + rcu_read_lock(); + cs = nearest_hardwall_ancestor(task_cs(current)); + allowed = node_isset(node, cs->mems_allowed); + rcu_read_unlock(); + +- spin_unlock_irqrestore(&callback_lock, flags); ++ raw_spin_unlock_irqrestore(&callback_lock, flags); + return allowed; + } + diff --git a/debian/patches-rt/0256-apparmor-use-a-locallock-instead-preempt_disable.patch b/debian/patches-rt/0256-apparmor-use-a-locallock-instead-preempt_disable.patch new file mode 100644 index 000000000..2c7d17fea --- /dev/null +++ b/debian/patches-rt/0256-apparmor-use-a-locallock-instead-preempt_disable.patch @@ -0,0 +1,81 @@ +From: Sebastian Andrzej Siewior +Date: Wed, 11 Oct 2017 17:43:49 +0200 +Subject: [PATCH 256/342] apparmor: use a locallock instead preempt_disable() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=9f1cf26d60407ea931cff7f1be73bf279a69dd56 + +get_buffers() disables preemption which acts as a lock for the per-CPU +variable. Since we can't disable preemption here on RT, a local_lock is +lock is used in order to remain on the same CPU and not to have more +than one user within the critical section. + +Signed-off-by: Sebastian Andrzej Siewior +--- + security/apparmor/include/path.h | 19 ++++++++++++++++--- + security/apparmor/lsm.c | 2 +- + 2 files changed, 17 insertions(+), 4 deletions(-) + +diff --git a/security/apparmor/include/path.h b/security/apparmor/include/path.h +index b6380c5f0097..12abfddb19c9 100644 +--- a/security/apparmor/include/path.h ++++ b/security/apparmor/include/path.h +@@ -40,8 +40,10 @@ struct aa_buffers { + + #include + #include ++#include + + DECLARE_PER_CPU(struct aa_buffers, aa_buffers); ++DECLARE_LOCAL_IRQ_LOCK(aa_buffers_lock); + + #define ASSIGN(FN, A, X, N) ((X) = FN(A, N)) + #define EVAL1(FN, A, X) ASSIGN(FN, A, X, 0) /*X = FN(0)*/ +@@ -51,7 +53,17 @@ DECLARE_PER_CPU(struct aa_buffers, aa_buffers); + + #define for_each_cpu_buffer(I) for ((I) = 0; (I) < MAX_PATH_BUFFERS; (I)++) + +-#ifdef CONFIG_DEBUG_PREEMPT ++#ifdef CONFIG_PREEMPT_RT_BASE ++static inline void AA_BUG_PREEMPT_ENABLED(const char *s) ++{ ++ struct local_irq_lock *lv; ++ ++ lv = this_cpu_ptr(&aa_buffers_lock); ++ WARN_ONCE(lv->owner != current, ++ "__get_buffer without aa_buffers_lock\n"); ++} ++ ++#elif defined(CONFIG_DEBUG_PREEMPT) + #define AA_BUG_PREEMPT_ENABLED(X) AA_BUG(preempt_count() <= 0, X) + #else + #define AA_BUG_PREEMPT_ENABLED(X) /* nop */ +@@ -67,14 +79,15 @@ DECLARE_PER_CPU(struct aa_buffers, aa_buffers); + + #define get_buffers(X...) \ + do { \ +- struct aa_buffers *__cpu_var = get_cpu_ptr(&aa_buffers); \ ++ struct aa_buffers *__cpu_var; \ ++ __cpu_var = get_locked_ptr(aa_buffers_lock, &aa_buffers); \ + __get_buffers(__cpu_var, X); \ + } while (0) + + #define put_buffers(X, Y...) \ + do { \ + __put_buffers(X, Y); \ +- put_cpu_ptr(&aa_buffers); \ ++ put_locked_ptr(aa_buffers_lock, &aa_buffers); \ + } while (0) + + #endif /* __AA_PATH_H */ +diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c +index 898752b818dc..690c8fccd0a0 100644 +--- a/security/apparmor/lsm.c ++++ b/security/apparmor/lsm.c +@@ -45,7 +45,7 @@ + int apparmor_initialized; + + DEFINE_PER_CPU(struct aa_buffers, aa_buffers); +- ++DEFINE_LOCAL_IRQ_LOCK(aa_buffers_lock); + + /* + * LSM hook functions diff --git a/debian/patches-rt/0256-cpuset-Convert-callback_lock-to-raw_spinlock_t.patch b/debian/patches-rt/0256-cpuset-Convert-callback_lock-to-raw_spinlock_t.patch deleted file mode 100644 index 68ac442a9..000000000 --- a/debian/patches-rt/0256-cpuset-Convert-callback_lock-to-raw_spinlock_t.patch +++ /dev/null @@ -1,293 +0,0 @@ -From fd27c495e357db5ecab593fc59617b9c3f39c770 Mon Sep 17 00:00:00 2001 -From: Mike Galbraith -Date: Sun, 8 Jan 2017 09:32:25 +0100 -Subject: [PATCH 256/347] cpuset: Convert callback_lock to raw_spinlock_t -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -The two commits below add up to a cpuset might_sleep() splat for RT: - -8447a0fee974 cpuset: convert callback_mutex to a spinlock -344736f29b35 cpuset: simplify cpuset_node_allowed API - -BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:995 -in_atomic(): 0, irqs_disabled(): 1, pid: 11718, name: cset -CPU: 135 PID: 11718 Comm: cset Tainted: G E 4.10.0-rt1-rt #4 -Hardware name: Intel Corporation BRICKLAND/BRICKLAND, BIOS BRHSXSD1.86B.0056.R01.1409242327 09/24/2014 -Call Trace: - ? dump_stack+0x5c/0x81 - ? ___might_sleep+0xf4/0x170 - ? rt_spin_lock+0x1c/0x50 - ? __cpuset_node_allowed+0x66/0xc0 - ? ___slab_alloc+0x390/0x570 - ? anon_vma_fork+0x8f/0x140 - ? copy_page_range+0x6cf/0xb00 - ? anon_vma_fork+0x8f/0x140 - ? __slab_alloc.isra.74+0x5a/0x81 - ? anon_vma_fork+0x8f/0x140 - ? kmem_cache_alloc+0x1b5/0x1f0 - ? anon_vma_fork+0x8f/0x140 - ? copy_process.part.35+0x1670/0x1ee0 - ? _do_fork+0xdd/0x3f0 - ? _do_fork+0xdd/0x3f0 - ? do_syscall_64+0x61/0x170 - ? entry_SYSCALL64_slow_path+0x25/0x25 - -The later ensured that a NUMA box WILL take callback_lock in atomic -context by removing the allocator and reclaim path __GFP_HARDWALL -usage which prevented such contexts from taking callback_mutex. - -One option would be to reinstate __GFP_HARDWALL protections for -RT, however, as the 8447a0fee974 changelog states: - -The callback_mutex is only used to synchronize reads/updates of cpusets' -flags and cpu/node masks. These operations should always proceed fast so -there's no reason why we can't use a spinlock instead of the mutex. - -Cc: stable-rt@vger.kernel.org -Signed-off-by: Mike Galbraith -Signed-off-by: Sebastian Andrzej Siewior ---- - kernel/cgroup/cpuset.c | 66 +++++++++++++++++++++--------------------- - 1 file changed, 33 insertions(+), 33 deletions(-) - -diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c -index 35541e1dfad9..42ed4e497336 100644 ---- a/kernel/cgroup/cpuset.c -+++ b/kernel/cgroup/cpuset.c -@@ -288,7 +288,7 @@ static struct cpuset top_cpuset = { - */ - - static DEFINE_MUTEX(cpuset_mutex); --static DEFINE_SPINLOCK(callback_lock); -+static DEFINE_RAW_SPINLOCK(callback_lock); - - static struct workqueue_struct *cpuset_migrate_mm_wq; - -@@ -922,9 +922,9 @@ static void update_cpumasks_hier(struct cpuset *cs, struct cpumask *new_cpus) - continue; - rcu_read_unlock(); - -- spin_lock_irq(&callback_lock); -+ raw_spin_lock_irq(&callback_lock); - cpumask_copy(cp->effective_cpus, new_cpus); -- spin_unlock_irq(&callback_lock); -+ raw_spin_unlock_irq(&callback_lock); - - WARN_ON(!is_in_v2_mode() && - !cpumask_equal(cp->cpus_allowed, cp->effective_cpus)); -@@ -989,9 +989,9 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs, - if (retval < 0) - return retval; - -- spin_lock_irq(&callback_lock); -+ raw_spin_lock_irq(&callback_lock); - cpumask_copy(cs->cpus_allowed, trialcs->cpus_allowed); -- spin_unlock_irq(&callback_lock); -+ raw_spin_unlock_irq(&callback_lock); - - /* use trialcs->cpus_allowed as a temp variable */ - update_cpumasks_hier(cs, trialcs->cpus_allowed); -@@ -1175,9 +1175,9 @@ static void update_nodemasks_hier(struct cpuset *cs, nodemask_t *new_mems) - continue; - rcu_read_unlock(); - -- spin_lock_irq(&callback_lock); -+ raw_spin_lock_irq(&callback_lock); - cp->effective_mems = *new_mems; -- spin_unlock_irq(&callback_lock); -+ raw_spin_unlock_irq(&callback_lock); - - WARN_ON(!is_in_v2_mode() && - !nodes_equal(cp->mems_allowed, cp->effective_mems)); -@@ -1245,9 +1245,9 @@ static int update_nodemask(struct cpuset *cs, struct cpuset *trialcs, - if (retval < 0) - goto done; - -- spin_lock_irq(&callback_lock); -+ raw_spin_lock_irq(&callback_lock); - cs->mems_allowed = trialcs->mems_allowed; -- spin_unlock_irq(&callback_lock); -+ raw_spin_unlock_irq(&callback_lock); - - /* use trialcs->mems_allowed as a temp variable */ - update_nodemasks_hier(cs, &trialcs->mems_allowed); -@@ -1338,9 +1338,9 @@ static int update_flag(cpuset_flagbits_t bit, struct cpuset *cs, - spread_flag_changed = ((is_spread_slab(cs) != is_spread_slab(trialcs)) - || (is_spread_page(cs) != is_spread_page(trialcs))); - -- spin_lock_irq(&callback_lock); -+ raw_spin_lock_irq(&callback_lock); - cs->flags = trialcs->flags; -- spin_unlock_irq(&callback_lock); -+ raw_spin_unlock_irq(&callback_lock); - - if (!cpumask_empty(trialcs->cpus_allowed) && balance_flag_changed) - rebuild_sched_domains_locked(); -@@ -1761,7 +1761,7 @@ static int cpuset_common_seq_show(struct seq_file *sf, void *v) - cpuset_filetype_t type = seq_cft(sf)->private; - int ret = 0; - -- spin_lock_irq(&callback_lock); -+ raw_spin_lock_irq(&callback_lock); - - switch (type) { - case FILE_CPULIST: -@@ -1780,7 +1780,7 @@ static int cpuset_common_seq_show(struct seq_file *sf, void *v) - ret = -EINVAL; - } - -- spin_unlock_irq(&callback_lock); -+ raw_spin_unlock_irq(&callback_lock); - return ret; - } - -@@ -1995,12 +1995,12 @@ static int cpuset_css_online(struct cgroup_subsys_state *css) - - cpuset_inc(); - -- spin_lock_irq(&callback_lock); -+ raw_spin_lock_irq(&callback_lock); - if (is_in_v2_mode()) { - cpumask_copy(cs->effective_cpus, parent->effective_cpus); - cs->effective_mems = parent->effective_mems; - } -- spin_unlock_irq(&callback_lock); -+ raw_spin_unlock_irq(&callback_lock); - - if (!test_bit(CGRP_CPUSET_CLONE_CHILDREN, &css->cgroup->flags)) - goto out_unlock; -@@ -2027,12 +2027,12 @@ static int cpuset_css_online(struct cgroup_subsys_state *css) - } - rcu_read_unlock(); - -- spin_lock_irq(&callback_lock); -+ raw_spin_lock_irq(&callback_lock); - cs->mems_allowed = parent->mems_allowed; - cs->effective_mems = parent->mems_allowed; - cpumask_copy(cs->cpus_allowed, parent->cpus_allowed); - cpumask_copy(cs->effective_cpus, parent->cpus_allowed); -- spin_unlock_irq(&callback_lock); -+ raw_spin_unlock_irq(&callback_lock); - out_unlock: - mutex_unlock(&cpuset_mutex); - return 0; -@@ -2071,7 +2071,7 @@ static void cpuset_css_free(struct cgroup_subsys_state *css) - static void cpuset_bind(struct cgroup_subsys_state *root_css) - { - mutex_lock(&cpuset_mutex); -- spin_lock_irq(&callback_lock); -+ raw_spin_lock_irq(&callback_lock); - - if (is_in_v2_mode()) { - cpumask_copy(top_cpuset.cpus_allowed, cpu_possible_mask); -@@ -2082,7 +2082,7 @@ static void cpuset_bind(struct cgroup_subsys_state *root_css) - top_cpuset.mems_allowed = top_cpuset.effective_mems; - } - -- spin_unlock_irq(&callback_lock); -+ raw_spin_unlock_irq(&callback_lock); - mutex_unlock(&cpuset_mutex); - } - -@@ -2180,12 +2180,12 @@ hotplug_update_tasks_legacy(struct cpuset *cs, - { - bool is_empty; - -- spin_lock_irq(&callback_lock); -+ raw_spin_lock_irq(&callback_lock); - cpumask_copy(cs->cpus_allowed, new_cpus); - cpumask_copy(cs->effective_cpus, new_cpus); - cs->mems_allowed = *new_mems; - cs->effective_mems = *new_mems; -- spin_unlock_irq(&callback_lock); -+ raw_spin_unlock_irq(&callback_lock); - - /* - * Don't call update_tasks_cpumask() if the cpuset becomes empty, -@@ -2222,10 +2222,10 @@ hotplug_update_tasks(struct cpuset *cs, - if (nodes_empty(*new_mems)) - *new_mems = parent_cs(cs)->effective_mems; - -- spin_lock_irq(&callback_lock); -+ raw_spin_lock_irq(&callback_lock); - cpumask_copy(cs->effective_cpus, new_cpus); - cs->effective_mems = *new_mems; -- spin_unlock_irq(&callback_lock); -+ raw_spin_unlock_irq(&callback_lock); - - if (cpus_updated) - update_tasks_cpumask(cs); -@@ -2318,21 +2318,21 @@ static void cpuset_hotplug_workfn(struct work_struct *work) - - /* synchronize cpus_allowed to cpu_active_mask */ - if (cpus_updated) { -- spin_lock_irq(&callback_lock); -+ raw_spin_lock_irq(&callback_lock); - if (!on_dfl) - cpumask_copy(top_cpuset.cpus_allowed, &new_cpus); - cpumask_copy(top_cpuset.effective_cpus, &new_cpus); -- spin_unlock_irq(&callback_lock); -+ raw_spin_unlock_irq(&callback_lock); - /* we don't mess with cpumasks of tasks in top_cpuset */ - } - - /* synchronize mems_allowed to N_MEMORY */ - if (mems_updated) { -- spin_lock_irq(&callback_lock); -+ raw_spin_lock_irq(&callback_lock); - if (!on_dfl) - top_cpuset.mems_allowed = new_mems; - top_cpuset.effective_mems = new_mems; -- spin_unlock_irq(&callback_lock); -+ raw_spin_unlock_irq(&callback_lock); - update_tasks_nodemask(&top_cpuset); - } - -@@ -2434,11 +2434,11 @@ void cpuset_cpus_allowed(struct task_struct *tsk, struct cpumask *pmask) - { - unsigned long flags; - -- spin_lock_irqsave(&callback_lock, flags); -+ raw_spin_lock_irqsave(&callback_lock, flags); - rcu_read_lock(); - guarantee_online_cpus(task_cs(tsk), pmask); - rcu_read_unlock(); -- spin_unlock_irqrestore(&callback_lock, flags); -+ raw_spin_unlock_irqrestore(&callback_lock, flags); - } - - /** -@@ -2499,11 +2499,11 @@ nodemask_t cpuset_mems_allowed(struct task_struct *tsk) - nodemask_t mask; - unsigned long flags; - -- spin_lock_irqsave(&callback_lock, flags); -+ raw_spin_lock_irqsave(&callback_lock, flags); - rcu_read_lock(); - guarantee_online_mems(task_cs(tsk), &mask); - rcu_read_unlock(); -- spin_unlock_irqrestore(&callback_lock, flags); -+ raw_spin_unlock_irqrestore(&callback_lock, flags); - - return mask; - } -@@ -2595,14 +2595,14 @@ bool __cpuset_node_allowed(int node, gfp_t gfp_mask) - return true; - - /* Not hardwall and node outside mems_allowed: scan up cpusets */ -- spin_lock_irqsave(&callback_lock, flags); -+ raw_spin_lock_irqsave(&callback_lock, flags); - - rcu_read_lock(); - cs = nearest_hardwall_ancestor(task_cs(current)); - allowed = node_isset(node, cs->mems_allowed); - rcu_read_unlock(); - -- spin_unlock_irqrestore(&callback_lock, flags); -+ raw_spin_unlock_irqrestore(&callback_lock, flags); - return allowed; - } - --- -2.36.1 - diff --git a/debian/patches-rt/0257-apparmor-use-a-locallock-instead-preempt_disable.patch b/debian/patches-rt/0257-apparmor-use-a-locallock-instead-preempt_disable.patch deleted file mode 100644 index c00ea5391..000000000 --- a/debian/patches-rt/0257-apparmor-use-a-locallock-instead-preempt_disable.patch +++ /dev/null @@ -1,85 +0,0 @@ -From bc99d234e02c1f42a9a71a2aca38406d1902582b Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Wed, 11 Oct 2017 17:43:49 +0200 -Subject: [PATCH 257/347] apparmor: use a locallock instead preempt_disable() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -get_buffers() disables preemption which acts as a lock for the per-CPU -variable. Since we can't disable preemption here on RT, a local_lock is -lock is used in order to remain on the same CPU and not to have more -than one user within the critical section. - -Signed-off-by: Sebastian Andrzej Siewior ---- - security/apparmor/include/path.h | 19 ++++++++++++++++--- - security/apparmor/lsm.c | 2 +- - 2 files changed, 17 insertions(+), 4 deletions(-) - -diff --git a/security/apparmor/include/path.h b/security/apparmor/include/path.h -index b6380c5f0097..12abfddb19c9 100644 ---- a/security/apparmor/include/path.h -+++ b/security/apparmor/include/path.h -@@ -40,8 +40,10 @@ struct aa_buffers { - - #include - #include -+#include - - DECLARE_PER_CPU(struct aa_buffers, aa_buffers); -+DECLARE_LOCAL_IRQ_LOCK(aa_buffers_lock); - - #define ASSIGN(FN, A, X, N) ((X) = FN(A, N)) - #define EVAL1(FN, A, X) ASSIGN(FN, A, X, 0) /*X = FN(0)*/ -@@ -51,7 +53,17 @@ DECLARE_PER_CPU(struct aa_buffers, aa_buffers); - - #define for_each_cpu_buffer(I) for ((I) = 0; (I) < MAX_PATH_BUFFERS; (I)++) - --#ifdef CONFIG_DEBUG_PREEMPT -+#ifdef CONFIG_PREEMPT_RT_BASE -+static inline void AA_BUG_PREEMPT_ENABLED(const char *s) -+{ -+ struct local_irq_lock *lv; -+ -+ lv = this_cpu_ptr(&aa_buffers_lock); -+ WARN_ONCE(lv->owner != current, -+ "__get_buffer without aa_buffers_lock\n"); -+} -+ -+#elif defined(CONFIG_DEBUG_PREEMPT) - #define AA_BUG_PREEMPT_ENABLED(X) AA_BUG(preempt_count() <= 0, X) - #else - #define AA_BUG_PREEMPT_ENABLED(X) /* nop */ -@@ -67,14 +79,15 @@ DECLARE_PER_CPU(struct aa_buffers, aa_buffers); - - #define get_buffers(X...) \ - do { \ -- struct aa_buffers *__cpu_var = get_cpu_ptr(&aa_buffers); \ -+ struct aa_buffers *__cpu_var; \ -+ __cpu_var = get_locked_ptr(aa_buffers_lock, &aa_buffers); \ - __get_buffers(__cpu_var, X); \ - } while (0) - - #define put_buffers(X, Y...) \ - do { \ - __put_buffers(X, Y); \ -- put_cpu_ptr(&aa_buffers); \ -+ put_locked_ptr(aa_buffers_lock, &aa_buffers); \ - } while (0) - - #endif /* __AA_PATH_H */ -diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c -index 898752b818dc..690c8fccd0a0 100644 ---- a/security/apparmor/lsm.c -+++ b/security/apparmor/lsm.c -@@ -45,7 +45,7 @@ - int apparmor_initialized; - - DEFINE_PER_CPU(struct aa_buffers, aa_buffers); -- -+DEFINE_LOCAL_IRQ_LOCK(aa_buffers_lock); - - /* - * LSM hook functions --- -2.36.1 - diff --git a/debian/patches-rt/0257-workqueue-Prevent-deadlock-stall-on-RT.patch b/debian/patches-rt/0257-workqueue-Prevent-deadlock-stall-on-RT.patch new file mode 100644 index 000000000..730a017ed --- /dev/null +++ b/debian/patches-rt/0257-workqueue-Prevent-deadlock-stall-on-RT.patch @@ -0,0 +1,203 @@ +From: Thomas Gleixner +Date: Fri, 27 Jun 2014 16:24:52 +0200 +Subject: [PATCH 257/342] workqueue: Prevent deadlock/stall on RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=3250e54d2a2051a789ae9c8fe3a7191f56f4e205 + +Austin reported a XFS deadlock/stall on RT where scheduled work gets +never exececuted and tasks are waiting for each other for ever. + +The underlying problem is the modification of the RT code to the +handling of workers which are about to go to sleep. In mainline a +worker thread which goes to sleep wakes an idle worker if there is +more work to do. This happens from the guts of the schedule() +function. On RT this must be outside and the accessed data structures +are not protected against scheduling due to the spinlock to rtmutex +conversion. So the naive solution to this was to move the code outside +of the scheduler and protect the data structures by the pool +lock. That approach turned out to be a little naive as we cannot call +into that code when the thread blocks on a lock, as it is not allowed +to block on two locks in parallel. So we dont call into the worker +wakeup magic when the worker is blocked on a lock, which causes the +deadlock/stall observed by Austin and Mike. + +Looking deeper into that worker code it turns out that the only +relevant data structure which needs to be protected is the list of +idle workers which can be woken up. + +So the solution is to protect the list manipulation operations with +preempt_enable/disable pairs on RT and call unconditionally into the +worker code even when the worker is blocked on a lock. The preemption +protection is safe as there is nothing which can fiddle with the list +outside of thread context. + +Reported-and_tested-by: Austin Schuh +Reported-and_tested-by: Mike Galbraith +Signed-off-by: Thomas Gleixner +Link: http://vger.kernel.org/r/alpine.DEB.2.10.1406271249510.5170@nanos +Cc: Richard Weinberger +Cc: Steven Rostedt +--- + kernel/sched/core.c | 6 +++-- + kernel/workqueue.c | 60 +++++++++++++++++++++++++++++++++++---------- + 2 files changed, 51 insertions(+), 15 deletions(-) + +diff --git a/kernel/sched/core.c b/kernel/sched/core.c +index 0995748a3a1d..feaf4d5683af 100644 +--- a/kernel/sched/core.c ++++ b/kernel/sched/core.c +@@ -3615,9 +3615,8 @@ void __noreturn do_task_dead(void) + + static inline void sched_submit_work(struct task_struct *tsk) + { +- if (!tsk->state || tsk_is_pi_blocked(tsk)) ++ if (!tsk->state) + return; +- + /* + * If a worker went to sleep, notify and ask workqueue whether + * it wants to wake up a task to maintain concurrency. +@@ -3631,6 +3630,9 @@ static inline void sched_submit_work(struct task_struct *tsk) + preempt_enable_no_resched(); + } + ++ if (tsk_is_pi_blocked(tsk)) ++ return; ++ + /* + * If we are going to sleep and we have plugged IO queued, + * make sure to submit it to avoid deadlocks. +diff --git a/kernel/workqueue.c b/kernel/workqueue.c +index 0c529f920232..91f5696cf335 100644 +--- a/kernel/workqueue.c ++++ b/kernel/workqueue.c +@@ -126,6 +126,11 @@ enum { + * cpu or grabbing pool->lock is enough for read access. If + * POOL_DISASSOCIATED is set, it's identical to L. + * ++ * On RT we need the extra protection via rt_lock_idle_list() for ++ * the list manipulations against read access from ++ * wq_worker_sleeping(). All other places are nicely serialized via ++ * pool->lock. ++ * + * A: wq_pool_attach_mutex protected. + * + * PL: wq_pool_mutex protected. +@@ -431,6 +436,31 @@ static void workqueue_sysfs_unregister(struct workqueue_struct *wq); + if (({ assert_rcu_or_wq_mutex(wq); false; })) { } \ + else + ++#ifdef CONFIG_PREEMPT_RT_BASE ++static inline void rt_lock_idle_list(struct worker_pool *pool) ++{ ++ preempt_disable(); ++} ++static inline void rt_unlock_idle_list(struct worker_pool *pool) ++{ ++ preempt_enable(); ++} ++static inline void sched_lock_idle_list(struct worker_pool *pool) { } ++static inline void sched_unlock_idle_list(struct worker_pool *pool) { } ++#else ++static inline void rt_lock_idle_list(struct worker_pool *pool) { } ++static inline void rt_unlock_idle_list(struct worker_pool *pool) { } ++static inline void sched_lock_idle_list(struct worker_pool *pool) ++{ ++ spin_lock_irq(&pool->lock); ++} ++static inline void sched_unlock_idle_list(struct worker_pool *pool) ++{ ++ spin_unlock_irq(&pool->lock); ++} ++#endif ++ ++ + #ifdef CONFIG_DEBUG_OBJECTS_WORK + + static struct debug_obj_descr work_debug_descr; +@@ -837,10 +867,16 @@ static struct worker *first_idle_worker(struct worker_pool *pool) + */ + static void wake_up_worker(struct worker_pool *pool) + { +- struct worker *worker = first_idle_worker(pool); ++ struct worker *worker; ++ ++ rt_lock_idle_list(pool); ++ ++ worker = first_idle_worker(pool); + + if (likely(worker)) + wake_up_process(worker->task); ++ ++ rt_unlock_idle_list(pool); + } + + /** +@@ -869,7 +905,7 @@ void wq_worker_running(struct task_struct *task) + */ + void wq_worker_sleeping(struct task_struct *task) + { +- struct worker *next, *worker = kthread_data(task); ++ struct worker *worker = kthread_data(task); + struct worker_pool *pool; + + /* +@@ -886,26 +922,18 @@ void wq_worker_sleeping(struct task_struct *task) + return; + + worker->sleeping = 1; +- spin_lock_irq(&pool->lock); + + /* + * The counterpart of the following dec_and_test, implied mb, + * worklist not empty test sequence is in insert_work(). + * Please read comment there. +- * +- * NOT_RUNNING is clear. This means that we're bound to and +- * running on the local cpu w/ rq lock held and preemption +- * disabled, which in turn means that none else could be +- * manipulating idle_list, so dereferencing idle_list without pool +- * lock is safe. + */ + if (atomic_dec_and_test(&pool->nr_running) && + !list_empty(&pool->worklist)) { +- next = first_idle_worker(pool); +- if (next) +- wake_up_process(next->task); ++ sched_lock_idle_list(pool); ++ wake_up_worker(pool); ++ sched_unlock_idle_list(pool); + } +- spin_unlock_irq(&pool->lock); + } + + /** +@@ -1678,7 +1706,9 @@ static void worker_enter_idle(struct worker *worker) + worker->last_active = jiffies; + + /* idle_list is LIFO */ ++ rt_lock_idle_list(pool); + list_add(&worker->entry, &pool->idle_list); ++ rt_unlock_idle_list(pool); + + if (too_many_workers(pool) && !timer_pending(&pool->idle_timer)) + mod_timer(&pool->idle_timer, jiffies + IDLE_WORKER_TIMEOUT); +@@ -1711,7 +1741,9 @@ static void worker_leave_idle(struct worker *worker) + return; + worker_clr_flags(worker, WORKER_IDLE); + pool->nr_idle--; ++ rt_lock_idle_list(pool); + list_del_init(&worker->entry); ++ rt_unlock_idle_list(pool); + } + + static struct worker *alloc_worker(int node) +@@ -1876,7 +1908,9 @@ static void destroy_worker(struct worker *worker) + pool->nr_workers--; + pool->nr_idle--; + ++ rt_lock_idle_list(pool); + list_del_init(&worker->entry); ++ rt_unlock_idle_list(pool); + worker->flags |= WORKER_DIE; + wake_up_process(worker->task); + } diff --git a/debian/patches-rt/0258-signals-Allow-rt-tasks-to-cache-one-sigqueue-struct.patch b/debian/patches-rt/0258-signals-Allow-rt-tasks-to-cache-one-sigqueue-struct.patch new file mode 100644 index 000000000..b4b502df1 --- /dev/null +++ b/debian/patches-rt/0258-signals-Allow-rt-tasks-to-cache-one-sigqueue-struct.patch @@ -0,0 +1,209 @@ +From: Thomas Gleixner +Date: Fri, 3 Jul 2009 08:44:56 -0500 +Subject: [PATCH 258/342] signals: Allow rt tasks to cache one sigqueue struct +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=5aac397e1ae3068a8bef5c75bbfbdb268c95b2c5 + +To avoid allocation allow rt tasks to cache one sigqueue struct in +task struct. + +Signed-off-by: Thomas Gleixner +--- + include/linux/sched.h | 2 ++ + include/linux/signal.h | 1 + + kernel/exit.c | 2 +- + kernel/fork.c | 1 + + kernel/signal.c | 69 +++++++++++++++++++++++++++++++++++++++--- + 5 files changed, 70 insertions(+), 5 deletions(-) + +diff --git a/include/linux/sched.h b/include/linux/sched.h +index 044bebd3d16f..e567fe2d7058 100644 +--- a/include/linux/sched.h ++++ b/include/linux/sched.h +@@ -895,6 +895,8 @@ struct task_struct { + /* Signal handlers: */ + struct signal_struct *signal; + struct sighand_struct *sighand; ++ struct sigqueue *sigqueue_cache; ++ + sigset_t blocked; + sigset_t real_blocked; + /* Restored if set_restore_sigmask() was used: */ +diff --git a/include/linux/signal.h b/include/linux/signal.h +index 0be5ce2375cb..6495fda18c2c 100644 +--- a/include/linux/signal.h ++++ b/include/linux/signal.h +@@ -245,6 +245,7 @@ static inline void init_sigpending(struct sigpending *sig) + } + + extern void flush_sigqueue(struct sigpending *queue); ++extern void flush_task_sigqueue(struct task_struct *tsk); + + /* Test if 'sig' is valid signal. Use this instead of testing _NSIG directly */ + static inline int valid_signal(unsigned long sig) +diff --git a/kernel/exit.c b/kernel/exit.c +index 908e7a33e1fc..2a414fc71b87 100644 +--- a/kernel/exit.c ++++ b/kernel/exit.c +@@ -160,7 +160,7 @@ static void __exit_signal(struct task_struct *tsk) + * Do this under ->siglock, we can race with another thread + * doing sigqueue_free() if we have SIGQUEUE_PREALLOC signals. + */ +- flush_sigqueue(&tsk->pending); ++ flush_task_sigqueue(tsk); + tsk->sighand = NULL; + spin_unlock(&sighand->siglock); + +diff --git a/kernel/fork.c b/kernel/fork.c +index 51ec12803c0b..fdc61ac6a748 100644 +--- a/kernel/fork.c ++++ b/kernel/fork.c +@@ -1848,6 +1848,7 @@ static __latent_entropy struct task_struct *copy_process( + spin_lock_init(&p->alloc_lock); + + init_sigpending(&p->pending); ++ p->sigqueue_cache = NULL; + + p->utime = p->stime = p->gtime = 0; + #ifdef CONFIG_ARCH_HAS_SCALED_CPUTIME +diff --git a/kernel/signal.c b/kernel/signal.c +index 708ee1bd4059..730ac7ff4637 100644 +--- a/kernel/signal.c ++++ b/kernel/signal.c +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -398,13 +399,30 @@ void task_join_group_stop(struct task_struct *task) + task_set_jobctl_pending(task, mask | JOBCTL_STOP_PENDING); + } + ++static inline struct sigqueue *get_task_cache(struct task_struct *t) ++{ ++ struct sigqueue *q = t->sigqueue_cache; ++ ++ if (cmpxchg(&t->sigqueue_cache, q, NULL) != q) ++ return NULL; ++ return q; ++} ++ ++static inline int put_task_cache(struct task_struct *t, struct sigqueue *q) ++{ ++ if (cmpxchg(&t->sigqueue_cache, NULL, q) == NULL) ++ return 0; ++ return 1; ++} ++ + /* + * allocate a new signal queue record + * - this may be called without locks if and only if t == current, otherwise an + * appropriate lock must be held to stop the target task from exiting + */ + static struct sigqueue * +-__sigqueue_alloc(int sig, struct task_struct *t, gfp_t flags, int override_rlimit) ++__sigqueue_do_alloc(int sig, struct task_struct *t, gfp_t flags, ++ int override_rlimit, int fromslab) + { + struct sigqueue *q = NULL; + struct user_struct *user; +@@ -426,7 +444,10 @@ __sigqueue_alloc(int sig, struct task_struct *t, gfp_t flags, int override_rlimi + rcu_read_unlock(); + + if (override_rlimit || likely(sigpending <= task_rlimit(t, RLIMIT_SIGPENDING))) { +- q = kmem_cache_alloc(sigqueue_cachep, flags); ++ if (!fromslab) ++ q = get_task_cache(t); ++ if (!q) ++ q = kmem_cache_alloc(sigqueue_cachep, flags); + } else { + print_dropped_signal(sig); + } +@@ -443,6 +464,13 @@ __sigqueue_alloc(int sig, struct task_struct *t, gfp_t flags, int override_rlimi + return q; + } + ++static struct sigqueue * ++__sigqueue_alloc(int sig, struct task_struct *t, gfp_t flags, ++ int override_rlimit) ++{ ++ return __sigqueue_do_alloc(sig, t, flags, override_rlimit, 0); ++} ++ + static void __sigqueue_free(struct sigqueue *q) + { + if (q->flags & SIGQUEUE_PREALLOC) +@@ -452,6 +480,21 @@ static void __sigqueue_free(struct sigqueue *q) + kmem_cache_free(sigqueue_cachep, q); + } + ++static void sigqueue_free_current(struct sigqueue *q) ++{ ++ struct user_struct *up; ++ ++ if (q->flags & SIGQUEUE_PREALLOC) ++ return; ++ ++ up = q->user; ++ if (rt_prio(current->normal_prio) && !put_task_cache(current, q)) { ++ atomic_dec(&up->sigpending); ++ free_uid(up); ++ } else ++ __sigqueue_free(q); ++} ++ + void flush_sigqueue(struct sigpending *queue) + { + struct sigqueue *q; +@@ -464,6 +507,21 @@ void flush_sigqueue(struct sigpending *queue) + } + } + ++/* ++ * Called from __exit_signal. Flush tsk->pending and ++ * tsk->sigqueue_cache ++ */ ++void flush_task_sigqueue(struct task_struct *tsk) ++{ ++ struct sigqueue *q; ++ ++ flush_sigqueue(&tsk->pending); ++ ++ q = get_task_cache(tsk); ++ if (q) ++ kmem_cache_free(sigqueue_cachep, q); ++} ++ + /* + * Flush all pending signals for this kthread. + */ +@@ -587,7 +645,7 @@ static void collect_signal(int sig, struct sigpending *list, siginfo_t *info, + (info->si_code == SI_TIMER) && + (info->si_sys_private); + +- __sigqueue_free(first); ++ sigqueue_free_current(first); + } else { + /* + * Ok, it wasn't in the queue. This must be +@@ -624,6 +682,8 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info) + bool resched_timer = false; + int signr; + ++ WARN_ON_ONCE(tsk != current); ++ + /* We only dequeue private signals from ourselves, we don't let + * signalfd steal them + */ +@@ -1762,7 +1822,8 @@ EXPORT_SYMBOL(kill_pid); + */ + struct sigqueue *sigqueue_alloc(void) + { +- struct sigqueue *q = __sigqueue_alloc(-1, current, GFP_KERNEL, 0); ++ /* Preallocated sigqueue objects always from the slabcache ! */ ++ struct sigqueue *q = __sigqueue_do_alloc(-1, current, GFP_KERNEL, 0, 1); + + if (q) + q->flags |= SIGQUEUE_PREALLOC; diff --git a/debian/patches-rt/0258-workqueue-Prevent-deadlock-stall-on-RT.patch b/debian/patches-rt/0258-workqueue-Prevent-deadlock-stall-on-RT.patch deleted file mode 100644 index 10fe17fc0..000000000 --- a/debian/patches-rt/0258-workqueue-Prevent-deadlock-stall-on-RT.patch +++ /dev/null @@ -1,207 +0,0 @@ -From 95516b448b8dcc30ac9e5fc0e38c1c3d3f8ef930 Mon Sep 17 00:00:00 2001 -From: Thomas Gleixner -Date: Fri, 27 Jun 2014 16:24:52 +0200 -Subject: [PATCH 258/347] workqueue: Prevent deadlock/stall on RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -Austin reported a XFS deadlock/stall on RT where scheduled work gets -never exececuted and tasks are waiting for each other for ever. - -The underlying problem is the modification of the RT code to the -handling of workers which are about to go to sleep. In mainline a -worker thread which goes to sleep wakes an idle worker if there is -more work to do. This happens from the guts of the schedule() -function. On RT this must be outside and the accessed data structures -are not protected against scheduling due to the spinlock to rtmutex -conversion. So the naive solution to this was to move the code outside -of the scheduler and protect the data structures by the pool -lock. That approach turned out to be a little naive as we cannot call -into that code when the thread blocks on a lock, as it is not allowed -to block on two locks in parallel. So we dont call into the worker -wakeup magic when the worker is blocked on a lock, which causes the -deadlock/stall observed by Austin and Mike. - -Looking deeper into that worker code it turns out that the only -relevant data structure which needs to be protected is the list of -idle workers which can be woken up. - -So the solution is to protect the list manipulation operations with -preempt_enable/disable pairs on RT and call unconditionally into the -worker code even when the worker is blocked on a lock. The preemption -protection is safe as there is nothing which can fiddle with the list -outside of thread context. - -Reported-and_tested-by: Austin Schuh -Reported-and_tested-by: Mike Galbraith -Signed-off-by: Thomas Gleixner -Link: http://vger.kernel.org/r/alpine.DEB.2.10.1406271249510.5170@nanos -Cc: Richard Weinberger -Cc: Steven Rostedt ---- - kernel/sched/core.c | 6 +++-- - kernel/workqueue.c | 60 +++++++++++++++++++++++++++++++++++---------- - 2 files changed, 51 insertions(+), 15 deletions(-) - -diff --git a/kernel/sched/core.c b/kernel/sched/core.c -index 0995748a3a1d..feaf4d5683af 100644 ---- a/kernel/sched/core.c -+++ b/kernel/sched/core.c -@@ -3615,9 +3615,8 @@ void __noreturn do_task_dead(void) - - static inline void sched_submit_work(struct task_struct *tsk) - { -- if (!tsk->state || tsk_is_pi_blocked(tsk)) -+ if (!tsk->state) - return; -- - /* - * If a worker went to sleep, notify and ask workqueue whether - * it wants to wake up a task to maintain concurrency. -@@ -3631,6 +3630,9 @@ static inline void sched_submit_work(struct task_struct *tsk) - preempt_enable_no_resched(); - } - -+ if (tsk_is_pi_blocked(tsk)) -+ return; -+ - /* - * If we are going to sleep and we have plugged IO queued, - * make sure to submit it to avoid deadlocks. -diff --git a/kernel/workqueue.c b/kernel/workqueue.c -index 0c529f920232..91f5696cf335 100644 ---- a/kernel/workqueue.c -+++ b/kernel/workqueue.c -@@ -126,6 +126,11 @@ enum { - * cpu or grabbing pool->lock is enough for read access. If - * POOL_DISASSOCIATED is set, it's identical to L. - * -+ * On RT we need the extra protection via rt_lock_idle_list() for -+ * the list manipulations against read access from -+ * wq_worker_sleeping(). All other places are nicely serialized via -+ * pool->lock. -+ * - * A: wq_pool_attach_mutex protected. - * - * PL: wq_pool_mutex protected. -@@ -431,6 +436,31 @@ static void workqueue_sysfs_unregister(struct workqueue_struct *wq); - if (({ assert_rcu_or_wq_mutex(wq); false; })) { } \ - else - -+#ifdef CONFIG_PREEMPT_RT_BASE -+static inline void rt_lock_idle_list(struct worker_pool *pool) -+{ -+ preempt_disable(); -+} -+static inline void rt_unlock_idle_list(struct worker_pool *pool) -+{ -+ preempt_enable(); -+} -+static inline void sched_lock_idle_list(struct worker_pool *pool) { } -+static inline void sched_unlock_idle_list(struct worker_pool *pool) { } -+#else -+static inline void rt_lock_idle_list(struct worker_pool *pool) { } -+static inline void rt_unlock_idle_list(struct worker_pool *pool) { } -+static inline void sched_lock_idle_list(struct worker_pool *pool) -+{ -+ spin_lock_irq(&pool->lock); -+} -+static inline void sched_unlock_idle_list(struct worker_pool *pool) -+{ -+ spin_unlock_irq(&pool->lock); -+} -+#endif -+ -+ - #ifdef CONFIG_DEBUG_OBJECTS_WORK - - static struct debug_obj_descr work_debug_descr; -@@ -837,10 +867,16 @@ static struct worker *first_idle_worker(struct worker_pool *pool) - */ - static void wake_up_worker(struct worker_pool *pool) - { -- struct worker *worker = first_idle_worker(pool); -+ struct worker *worker; -+ -+ rt_lock_idle_list(pool); -+ -+ worker = first_idle_worker(pool); - - if (likely(worker)) - wake_up_process(worker->task); -+ -+ rt_unlock_idle_list(pool); - } - - /** -@@ -869,7 +905,7 @@ void wq_worker_running(struct task_struct *task) - */ - void wq_worker_sleeping(struct task_struct *task) - { -- struct worker *next, *worker = kthread_data(task); -+ struct worker *worker = kthread_data(task); - struct worker_pool *pool; - - /* -@@ -886,26 +922,18 @@ void wq_worker_sleeping(struct task_struct *task) - return; - - worker->sleeping = 1; -- spin_lock_irq(&pool->lock); - - /* - * The counterpart of the following dec_and_test, implied mb, - * worklist not empty test sequence is in insert_work(). - * Please read comment there. -- * -- * NOT_RUNNING is clear. This means that we're bound to and -- * running on the local cpu w/ rq lock held and preemption -- * disabled, which in turn means that none else could be -- * manipulating idle_list, so dereferencing idle_list without pool -- * lock is safe. - */ - if (atomic_dec_and_test(&pool->nr_running) && - !list_empty(&pool->worklist)) { -- next = first_idle_worker(pool); -- if (next) -- wake_up_process(next->task); -+ sched_lock_idle_list(pool); -+ wake_up_worker(pool); -+ sched_unlock_idle_list(pool); - } -- spin_unlock_irq(&pool->lock); - } - - /** -@@ -1678,7 +1706,9 @@ static void worker_enter_idle(struct worker *worker) - worker->last_active = jiffies; - - /* idle_list is LIFO */ -+ rt_lock_idle_list(pool); - list_add(&worker->entry, &pool->idle_list); -+ rt_unlock_idle_list(pool); - - if (too_many_workers(pool) && !timer_pending(&pool->idle_timer)) - mod_timer(&pool->idle_timer, jiffies + IDLE_WORKER_TIMEOUT); -@@ -1711,7 +1741,9 @@ static void worker_leave_idle(struct worker *worker) - return; - worker_clr_flags(worker, WORKER_IDLE); - pool->nr_idle--; -+ rt_lock_idle_list(pool); - list_del_init(&worker->entry); -+ rt_unlock_idle_list(pool); - } - - static struct worker *alloc_worker(int node) -@@ -1876,7 +1908,9 @@ static void destroy_worker(struct worker *worker) - pool->nr_workers--; - pool->nr_idle--; - -+ rt_lock_idle_list(pool); - list_del_init(&worker->entry); -+ rt_unlock_idle_list(pool); - worker->flags |= WORKER_DIE; - wake_up_process(worker->task); - } --- -2.36.1 - diff --git a/debian/patches-rt/0259-Add-localversion-for-RT-release.patch b/debian/patches-rt/0259-Add-localversion-for-RT-release.patch new file mode 100644 index 000000000..9b39dc39c --- /dev/null +++ b/debian/patches-rt/0259-Add-localversion-for-RT-release.patch @@ -0,0 +1,18 @@ +From: Thomas Gleixner +Date: Fri, 8 Jul 2011 20:25:16 +0200 +Subject: [PATCH 259/342] Add localversion for -RT release +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=830df089aa5bd42afcc7733ada793ae405e532b0 + +Signed-off-by: Thomas Gleixner +--- + localversion-rt | 1 + + 1 file changed, 1 insertion(+) + create mode 100644 localversion-rt + +diff --git a/localversion-rt b/localversion-rt +new file mode 100644 +index 000000000000..1199ebade17b +--- /dev/null ++++ b/localversion-rt +@@ -0,0 +1 @@ ++-rt16 diff --git a/debian/patches-rt/0259-signals-Allow-rt-tasks-to-cache-one-sigqueue-struct.patch b/debian/patches-rt/0259-signals-Allow-rt-tasks-to-cache-one-sigqueue-struct.patch deleted file mode 100644 index 271df4103..000000000 --- a/debian/patches-rt/0259-signals-Allow-rt-tasks-to-cache-one-sigqueue-struct.patch +++ /dev/null @@ -1,213 +0,0 @@ -From 257506013947ed8b9b81885786294572a53a0a59 Mon Sep 17 00:00:00 2001 -From: Thomas Gleixner -Date: Fri, 3 Jul 2009 08:44:56 -0500 -Subject: [PATCH 259/347] signals: Allow rt tasks to cache one sigqueue struct -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -To avoid allocation allow rt tasks to cache one sigqueue struct in -task struct. - -Signed-off-by: Thomas Gleixner ---- - include/linux/sched.h | 2 ++ - include/linux/signal.h | 1 + - kernel/exit.c | 2 +- - kernel/fork.c | 1 + - kernel/signal.c | 69 +++++++++++++++++++++++++++++++++++++++--- - 5 files changed, 70 insertions(+), 5 deletions(-) - -diff --git a/include/linux/sched.h b/include/linux/sched.h -index 044bebd3d16f..e567fe2d7058 100644 ---- a/include/linux/sched.h -+++ b/include/linux/sched.h -@@ -895,6 +895,8 @@ struct task_struct { - /* Signal handlers: */ - struct signal_struct *signal; - struct sighand_struct *sighand; -+ struct sigqueue *sigqueue_cache; -+ - sigset_t blocked; - sigset_t real_blocked; - /* Restored if set_restore_sigmask() was used: */ -diff --git a/include/linux/signal.h b/include/linux/signal.h -index 0be5ce2375cb..6495fda18c2c 100644 ---- a/include/linux/signal.h -+++ b/include/linux/signal.h -@@ -245,6 +245,7 @@ static inline void init_sigpending(struct sigpending *sig) - } - - extern void flush_sigqueue(struct sigpending *queue); -+extern void flush_task_sigqueue(struct task_struct *tsk); - - /* Test if 'sig' is valid signal. Use this instead of testing _NSIG directly */ - static inline int valid_signal(unsigned long sig) -diff --git a/kernel/exit.c b/kernel/exit.c -index 908e7a33e1fc..2a414fc71b87 100644 ---- a/kernel/exit.c -+++ b/kernel/exit.c -@@ -160,7 +160,7 @@ static void __exit_signal(struct task_struct *tsk) - * Do this under ->siglock, we can race with another thread - * doing sigqueue_free() if we have SIGQUEUE_PREALLOC signals. - */ -- flush_sigqueue(&tsk->pending); -+ flush_task_sigqueue(tsk); - tsk->sighand = NULL; - spin_unlock(&sighand->siglock); - -diff --git a/kernel/fork.c b/kernel/fork.c -index 51ec12803c0b..fdc61ac6a748 100644 ---- a/kernel/fork.c -+++ b/kernel/fork.c -@@ -1848,6 +1848,7 @@ static __latent_entropy struct task_struct *copy_process( - spin_lock_init(&p->alloc_lock); - - init_sigpending(&p->pending); -+ p->sigqueue_cache = NULL; - - p->utime = p->stime = p->gtime = 0; - #ifdef CONFIG_ARCH_HAS_SCALED_CPUTIME -diff --git a/kernel/signal.c b/kernel/signal.c -index 58bd3b3dd499..74f807bba0b8 100644 ---- a/kernel/signal.c -+++ b/kernel/signal.c -@@ -19,6 +19,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -398,13 +399,30 @@ void task_join_group_stop(struct task_struct *task) - task_set_jobctl_pending(task, mask | JOBCTL_STOP_PENDING); - } - -+static inline struct sigqueue *get_task_cache(struct task_struct *t) -+{ -+ struct sigqueue *q = t->sigqueue_cache; -+ -+ if (cmpxchg(&t->sigqueue_cache, q, NULL) != q) -+ return NULL; -+ return q; -+} -+ -+static inline int put_task_cache(struct task_struct *t, struct sigqueue *q) -+{ -+ if (cmpxchg(&t->sigqueue_cache, NULL, q) == NULL) -+ return 0; -+ return 1; -+} -+ - /* - * allocate a new signal queue record - * - this may be called without locks if and only if t == current, otherwise an - * appropriate lock must be held to stop the target task from exiting - */ - static struct sigqueue * --__sigqueue_alloc(int sig, struct task_struct *t, gfp_t flags, int override_rlimit) -+__sigqueue_do_alloc(int sig, struct task_struct *t, gfp_t flags, -+ int override_rlimit, int fromslab) - { - struct sigqueue *q = NULL; - struct user_struct *user; -@@ -426,7 +444,10 @@ __sigqueue_alloc(int sig, struct task_struct *t, gfp_t flags, int override_rlimi - rcu_read_unlock(); - - if (override_rlimit || likely(sigpending <= task_rlimit(t, RLIMIT_SIGPENDING))) { -- q = kmem_cache_alloc(sigqueue_cachep, flags); -+ if (!fromslab) -+ q = get_task_cache(t); -+ if (!q) -+ q = kmem_cache_alloc(sigqueue_cachep, flags); - } else { - print_dropped_signal(sig); - } -@@ -443,6 +464,13 @@ __sigqueue_alloc(int sig, struct task_struct *t, gfp_t flags, int override_rlimi - return q; - } - -+static struct sigqueue * -+__sigqueue_alloc(int sig, struct task_struct *t, gfp_t flags, -+ int override_rlimit) -+{ -+ return __sigqueue_do_alloc(sig, t, flags, override_rlimit, 0); -+} -+ - static void __sigqueue_free(struct sigqueue *q) - { - if (q->flags & SIGQUEUE_PREALLOC) -@@ -452,6 +480,21 @@ static void __sigqueue_free(struct sigqueue *q) - kmem_cache_free(sigqueue_cachep, q); - } - -+static void sigqueue_free_current(struct sigqueue *q) -+{ -+ struct user_struct *up; -+ -+ if (q->flags & SIGQUEUE_PREALLOC) -+ return; -+ -+ up = q->user; -+ if (rt_prio(current->normal_prio) && !put_task_cache(current, q)) { -+ atomic_dec(&up->sigpending); -+ free_uid(up); -+ } else -+ __sigqueue_free(q); -+} -+ - void flush_sigqueue(struct sigpending *queue) - { - struct sigqueue *q; -@@ -464,6 +507,21 @@ void flush_sigqueue(struct sigpending *queue) - } - } - -+/* -+ * Called from __exit_signal. Flush tsk->pending and -+ * tsk->sigqueue_cache -+ */ -+void flush_task_sigqueue(struct task_struct *tsk) -+{ -+ struct sigqueue *q; -+ -+ flush_sigqueue(&tsk->pending); -+ -+ q = get_task_cache(tsk); -+ if (q) -+ kmem_cache_free(sigqueue_cachep, q); -+} -+ - /* - * Flush all pending signals for this kthread. - */ -@@ -587,7 +645,7 @@ static void collect_signal(int sig, struct sigpending *list, siginfo_t *info, - (info->si_code == SI_TIMER) && - (info->si_sys_private); - -- __sigqueue_free(first); -+ sigqueue_free_current(first); - } else { - /* - * Ok, it wasn't in the queue. This must be -@@ -624,6 +682,8 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info) - bool resched_timer = false; - int signr; - -+ WARN_ON_ONCE(tsk != current); -+ - /* We only dequeue private signals from ourselves, we don't let - * signalfd steal them - */ -@@ -1762,7 +1822,8 @@ EXPORT_SYMBOL(kill_pid); - */ - struct sigqueue *sigqueue_alloc(void) - { -- struct sigqueue *q = __sigqueue_alloc(-1, current, GFP_KERNEL, 0); -+ /* Preallocated sigqueue objects always from the slabcache ! */ -+ struct sigqueue *q = __sigqueue_do_alloc(-1, current, GFP_KERNEL, 0, 1); - - if (q) - q->flags |= SIGQUEUE_PREALLOC; --- -2.36.1 - diff --git a/debian/patches-rt/0260-Add-localversion-for-RT-release.patch b/debian/patches-rt/0260-Add-localversion-for-RT-release.patch deleted file mode 100644 index b4212f0a6..000000000 --- a/debian/patches-rt/0260-Add-localversion-for-RT-release.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 0146607e465af932fed9f14bc6c3bd83e1723699 Mon Sep 17 00:00:00 2001 -From: Thomas Gleixner -Date: Fri, 8 Jul 2011 20:25:16 +0200 -Subject: [PATCH 260/347] Add localversion for -RT release -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -Signed-off-by: Thomas Gleixner ---- - localversion-rt | 1 + - 1 file changed, 1 insertion(+) - create mode 100644 localversion-rt - -diff --git a/localversion-rt b/localversion-rt -new file mode 100644 -index 000000000000..1199ebade17b ---- /dev/null -+++ b/localversion-rt -@@ -0,0 +1 @@ -+-rt16 --- -2.36.1 - diff --git a/debian/patches-rt/0260-powerpc-pseries-iommu-Use-a-locallock-instead-local_.patch b/debian/patches-rt/0260-powerpc-pseries-iommu-Use-a-locallock-instead-local_.patch new file mode 100644 index 000000000..b5d7da2d1 --- /dev/null +++ b/debian/patches-rt/0260-powerpc-pseries-iommu-Use-a-locallock-instead-local_.patch @@ -0,0 +1,93 @@ +From: Sebastian Andrzej Siewior +Date: Tue, 26 Mar 2019 18:31:54 +0100 +Subject: [PATCH 260/342] powerpc/pseries/iommu: Use a locallock instead + local_irq_save() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=8c0eed1d8e078239e15aeb6ebf028c167f62c92f + +The locallock protects the per-CPU variable tce_page. The function +attempts to allocate memory while tce_page is protected (by disabling +interrupts). + +Use local_irq_save() instead of local_irq_disable(). + +Cc: stable-rt@vger.kernel.org +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + arch/powerpc/platforms/pseries/iommu.c | 16 ++++++++++------ + 1 file changed, 10 insertions(+), 6 deletions(-) + +diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c +index b1a08cb760e0..8ef818ad83ec 100644 +--- a/arch/powerpc/platforms/pseries/iommu.c ++++ b/arch/powerpc/platforms/pseries/iommu.c +@@ -38,6 +38,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -212,6 +213,7 @@ static int tce_build_pSeriesLP(unsigned long liobn, long tcenum, long tceshift, + } + + static DEFINE_PER_CPU(__be64 *, tce_page); ++static DEFINE_LOCAL_IRQ_LOCK(tcp_page_lock); + + static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum, + long npages, unsigned long uaddr, +@@ -233,7 +235,8 @@ static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum, + direction, attrs); + } + +- local_irq_save(flags); /* to protect tcep and the page behind it */ ++ /* to protect tcep and the page behind it */ ++ local_lock_irqsave(tcp_page_lock, flags); + + tcep = __this_cpu_read(tce_page); + +@@ -244,7 +247,7 @@ static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum, + tcep = (__be64 *)__get_free_page(GFP_ATOMIC); + /* If allocation fails, fall back to the loop implementation */ + if (!tcep) { +- local_irq_restore(flags); ++ local_unlock_irqrestore(tcp_page_lock, flags); + return tce_build_pSeriesLP(tbl->it_index, tcenum, + tbl->it_page_shift, + npages, uaddr, direction, attrs); +@@ -279,7 +282,7 @@ static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum, + tcenum += limit; + } while (npages > 0 && !rc); + +- local_irq_restore(flags); ++ local_unlock_irqrestore(tcp_page_lock, flags); + + if (unlikely(rc == H_NOT_ENOUGH_RESOURCES)) { + ret = (int)rc; +@@ -450,13 +453,14 @@ static int tce_setrange_multi_pSeriesLP(unsigned long start_pfn, + DMA_BIDIRECTIONAL, 0); + } + +- local_irq_disable(); /* to protect tcep and the page behind it */ ++ /* to protect tcep and the page behind it */ ++ local_lock_irq(tcp_page_lock); + tcep = __this_cpu_read(tce_page); + + if (!tcep) { + tcep = (__be64 *)__get_free_page(GFP_ATOMIC); + if (!tcep) { +- local_irq_enable(); ++ local_unlock_irq(tcp_page_lock); + return -ENOMEM; + } + __this_cpu_write(tce_page, tcep); +@@ -502,7 +506,7 @@ static int tce_setrange_multi_pSeriesLP(unsigned long start_pfn, + + /* error cleanup: caller will clear whole range */ + +- local_irq_enable(); ++ local_unlock_irq(tcp_page_lock); + return rc; + } + diff --git a/debian/patches-rt/0261-powerpc-pseries-iommu-Use-a-locallock-instead-local_.patch b/debian/patches-rt/0261-powerpc-pseries-iommu-Use-a-locallock-instead-local_.patch deleted file mode 100644 index f86ebc321..000000000 --- a/debian/patches-rt/0261-powerpc-pseries-iommu-Use-a-locallock-instead-local_.patch +++ /dev/null @@ -1,97 +0,0 @@ -From 0e0334043fc179c95449e93c201474b96f1f8656 Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Tue, 26 Mar 2019 18:31:54 +0100 -Subject: [PATCH 261/347] powerpc/pseries/iommu: Use a locallock instead - local_irq_save() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -The locallock protects the per-CPU variable tce_page. The function -attempts to allocate memory while tce_page is protected (by disabling -interrupts). - -Use local_irq_save() instead of local_irq_disable(). - -Cc: stable-rt@vger.kernel.org -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - arch/powerpc/platforms/pseries/iommu.c | 16 ++++++++++------ - 1 file changed, 10 insertions(+), 6 deletions(-) - -diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c -index b1a08cb760e0..8ef818ad83ec 100644 ---- a/arch/powerpc/platforms/pseries/iommu.c -+++ b/arch/powerpc/platforms/pseries/iommu.c -@@ -38,6 +38,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -212,6 +213,7 @@ static int tce_build_pSeriesLP(unsigned long liobn, long tcenum, long tceshift, - } - - static DEFINE_PER_CPU(__be64 *, tce_page); -+static DEFINE_LOCAL_IRQ_LOCK(tcp_page_lock); - - static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum, - long npages, unsigned long uaddr, -@@ -233,7 +235,8 @@ static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum, - direction, attrs); - } - -- local_irq_save(flags); /* to protect tcep and the page behind it */ -+ /* to protect tcep and the page behind it */ -+ local_lock_irqsave(tcp_page_lock, flags); - - tcep = __this_cpu_read(tce_page); - -@@ -244,7 +247,7 @@ static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum, - tcep = (__be64 *)__get_free_page(GFP_ATOMIC); - /* If allocation fails, fall back to the loop implementation */ - if (!tcep) { -- local_irq_restore(flags); -+ local_unlock_irqrestore(tcp_page_lock, flags); - return tce_build_pSeriesLP(tbl->it_index, tcenum, - tbl->it_page_shift, - npages, uaddr, direction, attrs); -@@ -279,7 +282,7 @@ static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum, - tcenum += limit; - } while (npages > 0 && !rc); - -- local_irq_restore(flags); -+ local_unlock_irqrestore(tcp_page_lock, flags); - - if (unlikely(rc == H_NOT_ENOUGH_RESOURCES)) { - ret = (int)rc; -@@ -450,13 +453,14 @@ static int tce_setrange_multi_pSeriesLP(unsigned long start_pfn, - DMA_BIDIRECTIONAL, 0); - } - -- local_irq_disable(); /* to protect tcep and the page behind it */ -+ /* to protect tcep and the page behind it */ -+ local_lock_irq(tcp_page_lock); - tcep = __this_cpu_read(tce_page); - - if (!tcep) { - tcep = (__be64 *)__get_free_page(GFP_ATOMIC); - if (!tcep) { -- local_irq_enable(); -+ local_unlock_irq(tcp_page_lock); - return -ENOMEM; - } - __this_cpu_write(tce_page, tcep); -@@ -502,7 +506,7 @@ static int tce_setrange_multi_pSeriesLP(unsigned long start_pfn, - - /* error cleanup: caller will clear whole range */ - -- local_irq_enable(); -+ local_unlock_irq(tcp_page_lock); - return rc; - } - --- -2.36.1 - diff --git a/debian/patches-rt/0261-powerpc-reshuffle-TIF-bits.patch b/debian/patches-rt/0261-powerpc-reshuffle-TIF-bits.patch new file mode 100644 index 000000000..dd5e0dafe --- /dev/null +++ b/debian/patches-rt/0261-powerpc-reshuffle-TIF-bits.patch @@ -0,0 +1,148 @@ +From: Sebastian Andrzej Siewior +Date: Fri, 22 Mar 2019 17:15:58 +0100 +Subject: [PATCH 261/342] powerpc: reshuffle TIF bits +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=e383507c4f1cd7ac67d8fa323e18757106326c37 + +Powerpc32/64 does not compile because TIF_SYSCALL_TRACE's bit is higher +than 15 and the assembly instructions don't expect that. + +Move TIF_RESTOREALL, TIF_NOERROR to the higher bits and keep +TIF_NEED_RESCHED_LAZY in the lower range. As a result one split load is +needed and otherwise we can use immediates. + +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + arch/powerpc/include/asm/thread_info.h | 11 +++++++---- + arch/powerpc/kernel/entry_32.S | 12 +++++++----- + arch/powerpc/kernel/entry_64.S | 12 +++++++----- + 3 files changed, 21 insertions(+), 14 deletions(-) + +diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h +index ce316076bc52..64c3d1a720e2 100644 +--- a/arch/powerpc/include/asm/thread_info.h ++++ b/arch/powerpc/include/asm/thread_info.h +@@ -83,18 +83,18 @@ extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src + #define TIF_SIGPENDING 1 /* signal pending */ + #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ + #define TIF_FSCHECK 3 /* Check FS is USER_DS on return */ +-#define TIF_NEED_RESCHED_LAZY 4 /* lazy rescheduling necessary */ + #define TIF_RESTORE_TM 5 /* need to restore TM FP/VEC/VSX */ + #define TIF_PATCH_PENDING 6 /* pending live patching update */ + #define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */ + #define TIF_SINGLESTEP 8 /* singlestepping active */ + #define TIF_NOHZ 9 /* in adaptive nohz mode */ + #define TIF_SECCOMP 10 /* secure computing */ +-#define TIF_RESTOREALL 11 /* Restore all regs (implies NOERROR) */ +-#define TIF_NOERROR 12 /* Force successful syscall return */ ++ ++#define TIF_NEED_RESCHED_LAZY 11 /* lazy rescheduling necessary */ ++#define TIF_SYSCALL_TRACEPOINT 12 /* syscall tracepoint instrumentation */ ++ + #define TIF_NOTIFY_RESUME 13 /* callback before returning to user */ + #define TIF_UPROBE 14 /* breakpointed or single-stepping */ +-#define TIF_SYSCALL_TRACEPOINT 15 /* syscall tracepoint instrumentation */ + #define TIF_EMULATE_STACK_STORE 16 /* Is an instruction emulation + for stack store? */ + #define TIF_MEMDIE 17 /* is terminating due to OOM killer */ +@@ -103,6 +103,9 @@ extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src + #endif + #define TIF_POLLING_NRFLAG 19 /* true if poll_idle() is polling TIF_NEED_RESCHED */ + #define TIF_32BIT 20 /* 32 bit binary */ ++#define TIF_RESTOREALL 21 /* Restore all regs (implies NOERROR) */ ++#define TIF_NOERROR 22 /* Force successful syscall return */ ++ + + /* as above, but as bit values */ + #define _TIF_SYSCALL_TRACE (1< -Date: Fri, 22 Mar 2019 17:15:58 +0100 -Subject: [PATCH 262/347] powerpc: reshuffle TIF bits -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -Powerpc32/64 does not compile because TIF_SYSCALL_TRACE's bit is higher -than 15 and the assembly instructions don't expect that. - -Move TIF_RESTOREALL, TIF_NOERROR to the higher bits and keep -TIF_NEED_RESCHED_LAZY in the lower range. As a result one split load is -needed and otherwise we can use immediates. - -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - arch/powerpc/include/asm/thread_info.h | 11 +++++++---- - arch/powerpc/kernel/entry_32.S | 12 +++++++----- - arch/powerpc/kernel/entry_64.S | 12 +++++++----- - 3 files changed, 21 insertions(+), 14 deletions(-) - -diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h -index ce316076bc52..64c3d1a720e2 100644 ---- a/arch/powerpc/include/asm/thread_info.h -+++ b/arch/powerpc/include/asm/thread_info.h -@@ -83,18 +83,18 @@ extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src - #define TIF_SIGPENDING 1 /* signal pending */ - #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ - #define TIF_FSCHECK 3 /* Check FS is USER_DS on return */ --#define TIF_NEED_RESCHED_LAZY 4 /* lazy rescheduling necessary */ - #define TIF_RESTORE_TM 5 /* need to restore TM FP/VEC/VSX */ - #define TIF_PATCH_PENDING 6 /* pending live patching update */ - #define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */ - #define TIF_SINGLESTEP 8 /* singlestepping active */ - #define TIF_NOHZ 9 /* in adaptive nohz mode */ - #define TIF_SECCOMP 10 /* secure computing */ --#define TIF_RESTOREALL 11 /* Restore all regs (implies NOERROR) */ --#define TIF_NOERROR 12 /* Force successful syscall return */ -+ -+#define TIF_NEED_RESCHED_LAZY 11 /* lazy rescheduling necessary */ -+#define TIF_SYSCALL_TRACEPOINT 12 /* syscall tracepoint instrumentation */ -+ - #define TIF_NOTIFY_RESUME 13 /* callback before returning to user */ - #define TIF_UPROBE 14 /* breakpointed or single-stepping */ --#define TIF_SYSCALL_TRACEPOINT 15 /* syscall tracepoint instrumentation */ - #define TIF_EMULATE_STACK_STORE 16 /* Is an instruction emulation - for stack store? */ - #define TIF_MEMDIE 17 /* is terminating due to OOM killer */ -@@ -103,6 +103,9 @@ extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src - #endif - #define TIF_POLLING_NRFLAG 19 /* true if poll_idle() is polling TIF_NEED_RESCHED */ - #define TIF_32BIT 20 /* 32 bit binary */ -+#define TIF_RESTOREALL 21 /* Restore all regs (implies NOERROR) */ -+#define TIF_NOERROR 22 /* Force successful syscall return */ -+ - - /* as above, but as bit values */ - #define _TIF_SYSCALL_TRACE (1< +Date: Wed, 13 Mar 2019 11:40:34 +0000 +Subject: [PATCH 262/342] tty/sysrq: Convert show_lock to raw_spinlock_t +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=bc471880b65be979c4ee19553ef62c6ab0af5b73 + +Systems which don't provide arch_trigger_cpumask_backtrace() will +invoke showacpu() from a smp_call_function() function which is invoked +with disabled interrupts even on -RT systems. + +The function acquires the show_lock lock which only purpose is to +ensure that the CPUs don't print simultaneously. Otherwise the +output would clash and it would be hard to tell the output from CPUx +apart from CPUy. + +On -RT the spin_lock() can not be acquired from this context. A +raw_spin_lock() is required. It will introduce the system's latency +by performing the sysrq request and other CPUs will block on the lock +until the request is done. This is okay because the user asked for a +backtrace of all active CPUs and under "normal circumstances in +production" this path should not be triggered. + +Signed-off-by: Julien Grall +Signed-off-by: Steven Rostedt (VMware) +[bigeasy@linuxtronix.de: commit description] +Signed-off-by: Sebastian Andrzej Siewior +Acked-by: Sebastian Andrzej Siewior +Signed-off-by: Greg Kroah-Hartman +Cc: stable-rt@vger.kernel.org +Signed-off-by: Sebastian Andrzej Siewior +--- + drivers/tty/sysrq.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c +index cee0274806c5..f785ca55fb85 100644 +--- a/drivers/tty/sysrq.c ++++ b/drivers/tty/sysrq.c +@@ -215,7 +215,7 @@ static struct sysrq_key_op sysrq_showlocks_op = { + #endif + + #ifdef CONFIG_SMP +-static DEFINE_SPINLOCK(show_lock); ++static DEFINE_RAW_SPINLOCK(show_lock); + + static void showacpu(void *dummy) + { +@@ -225,10 +225,10 @@ static void showacpu(void *dummy) + if (idle_cpu(smp_processor_id())) + return; + +- spin_lock_irqsave(&show_lock, flags); ++ raw_spin_lock_irqsave(&show_lock, flags); + pr_info("CPU%d:\n", smp_processor_id()); + show_stack(NULL, NULL); +- spin_unlock_irqrestore(&show_lock, flags); ++ raw_spin_unlock_irqrestore(&show_lock, flags); + } + + static void sysrq_showregs_othercpus(struct work_struct *dummy) diff --git a/debian/patches-rt/0263-drm-i915-Don-t-disable-interrupts-independently-of-t.patch b/debian/patches-rt/0263-drm-i915-Don-t-disable-interrupts-independently-of-t.patch new file mode 100644 index 000000000..5e76fee9c --- /dev/null +++ b/debian/patches-rt/0263-drm-i915-Don-t-disable-interrupts-independently-of-t.patch @@ -0,0 +1,47 @@ +From: Sebastian Andrzej Siewior +Date: Wed, 10 Apr 2019 11:01:37 +0200 +Subject: [PATCH 263/342] drm/i915: Don't disable interrupts independently of + the lock +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=11d12db319077ee47d28ed241e8947c5b86762b7 + +The locks (timeline->lock and rq->lock) need to be taken with disabled +interrupts. This is done in __retire_engine_request() by disabling the +interrupts independently of the locks itself. +While local_irq_disable()+spin_lock() equals spin_lock_irq() on vanilla +it does not on RT. Also, it is not obvious if there is a special reason +to why the interrupts are disabled independently of the lock. + +Enable/disable interrupts as part of the locking instruction. + +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + drivers/gpu/drm/i915/i915_request.c | 8 ++------ + 1 file changed, 2 insertions(+), 6 deletions(-) + +diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c +index 5c2c93cbab12..7124510b9131 100644 +--- a/drivers/gpu/drm/i915/i915_request.c ++++ b/drivers/gpu/drm/i915/i915_request.c +@@ -356,9 +356,7 @@ static void __retire_engine_request(struct intel_engine_cs *engine, + + GEM_BUG_ON(!i915_request_completed(rq)); + +- local_irq_disable(); +- +- spin_lock(&engine->timeline.lock); ++ spin_lock_irq(&engine->timeline.lock); + GEM_BUG_ON(!list_is_first(&rq->link, &engine->timeline.requests)); + list_del_init(&rq->link); + spin_unlock(&engine->timeline.lock); +@@ -372,9 +370,7 @@ static void __retire_engine_request(struct intel_engine_cs *engine, + GEM_BUG_ON(!atomic_read(&rq->i915->gt_pm.rps.num_waiters)); + atomic_dec(&rq->i915->gt_pm.rps.num_waiters); + } +- spin_unlock(&rq->lock); +- +- local_irq_enable(); ++ spin_unlock_irq(&rq->lock); + + /* + * The backing object for the context is done after switching to the diff --git a/debian/patches-rt/0263-tty-sysrq-Convert-show_lock-to-raw_spinlock_t.patch b/debian/patches-rt/0263-tty-sysrq-Convert-show_lock-to-raw_spinlock_t.patch deleted file mode 100644 index 25b626e50..000000000 --- a/debian/patches-rt/0263-tty-sysrq-Convert-show_lock-to-raw_spinlock_t.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 80d2475bc6d0eacb1cf634c16818c86554fcee0c Mon Sep 17 00:00:00 2001 -From: Julien Grall -Date: Wed, 13 Mar 2019 11:40:34 +0000 -Subject: [PATCH 263/347] tty/sysrq: Convert show_lock to raw_spinlock_t -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -Systems which don't provide arch_trigger_cpumask_backtrace() will -invoke showacpu() from a smp_call_function() function which is invoked -with disabled interrupts even on -RT systems. - -The function acquires the show_lock lock which only purpose is to -ensure that the CPUs don't print simultaneously. Otherwise the -output would clash and it would be hard to tell the output from CPUx -apart from CPUy. - -On -RT the spin_lock() can not be acquired from this context. A -raw_spin_lock() is required. It will introduce the system's latency -by performing the sysrq request and other CPUs will block on the lock -until the request is done. This is okay because the user asked for a -backtrace of all active CPUs and under "normal circumstances in -production" this path should not be triggered. - -Signed-off-by: Julien Grall -Signed-off-by: Steven Rostedt (VMware) -[bigeasy@linuxtronix.de: commit description] -Signed-off-by: Sebastian Andrzej Siewior -Acked-by: Sebastian Andrzej Siewior -Signed-off-by: Greg Kroah-Hartman -Cc: stable-rt@vger.kernel.org -Signed-off-by: Sebastian Andrzej Siewior ---- - drivers/tty/sysrq.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c -index cee0274806c5..f785ca55fb85 100644 ---- a/drivers/tty/sysrq.c -+++ b/drivers/tty/sysrq.c -@@ -215,7 +215,7 @@ static struct sysrq_key_op sysrq_showlocks_op = { - #endif - - #ifdef CONFIG_SMP --static DEFINE_SPINLOCK(show_lock); -+static DEFINE_RAW_SPINLOCK(show_lock); - - static void showacpu(void *dummy) - { -@@ -225,10 +225,10 @@ static void showacpu(void *dummy) - if (idle_cpu(smp_processor_id())) - return; - -- spin_lock_irqsave(&show_lock, flags); -+ raw_spin_lock_irqsave(&show_lock, flags); - pr_info("CPU%d:\n", smp_processor_id()); - show_stack(NULL, NULL); -- spin_unlock_irqrestore(&show_lock, flags); -+ raw_spin_unlock_irqrestore(&show_lock, flags); - } - - static void sysrq_showregs_othercpus(struct work_struct *dummy) --- -2.36.1 - diff --git a/debian/patches-rt/0264-drm-i915-Don-t-disable-interrupts-independently-of-t.patch b/debian/patches-rt/0264-drm-i915-Don-t-disable-interrupts-independently-of-t.patch deleted file mode 100644 index e95fb336e..000000000 --- a/debian/patches-rt/0264-drm-i915-Don-t-disable-interrupts-independently-of-t.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 31ae53586975d39dd03dabf5c944b498dcc73289 Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Wed, 10 Apr 2019 11:01:37 +0200 -Subject: [PATCH 264/347] drm/i915: Don't disable interrupts independently of - the lock -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -The locks (timeline->lock and rq->lock) need to be taken with disabled -interrupts. This is done in __retire_engine_request() by disabling the -interrupts independently of the locks itself. -While local_irq_disable()+spin_lock() equals spin_lock_irq() on vanilla -it does not on RT. Also, it is not obvious if there is a special reason -to why the interrupts are disabled independently of the lock. - -Enable/disable interrupts as part of the locking instruction. - -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - drivers/gpu/drm/i915/i915_request.c | 8 ++------ - 1 file changed, 2 insertions(+), 6 deletions(-) - -diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c -index 5c2c93cbab12..7124510b9131 100644 ---- a/drivers/gpu/drm/i915/i915_request.c -+++ b/drivers/gpu/drm/i915/i915_request.c -@@ -356,9 +356,7 @@ static void __retire_engine_request(struct intel_engine_cs *engine, - - GEM_BUG_ON(!i915_request_completed(rq)); - -- local_irq_disable(); -- -- spin_lock(&engine->timeline.lock); -+ spin_lock_irq(&engine->timeline.lock); - GEM_BUG_ON(!list_is_first(&rq->link, &engine->timeline.requests)); - list_del_init(&rq->link); - spin_unlock(&engine->timeline.lock); -@@ -372,9 +370,7 @@ static void __retire_engine_request(struct intel_engine_cs *engine, - GEM_BUG_ON(!atomic_read(&rq->i915->gt_pm.rps.num_waiters)); - atomic_dec(&rq->i915->gt_pm.rps.num_waiters); - } -- spin_unlock(&rq->lock); -- -- local_irq_enable(); -+ spin_unlock_irq(&rq->lock); - - /* - * The backing object for the context is done after switching to the --- -2.36.1 - diff --git a/debian/patches-rt/0264-sched-completion-Fix-a-lockup-in-wait_for_completion.patch b/debian/patches-rt/0264-sched-completion-Fix-a-lockup-in-wait_for_completion.patch new file mode 100644 index 000000000..4174df41c --- /dev/null +++ b/debian/patches-rt/0264-sched-completion-Fix-a-lockup-in-wait_for_completion.patch @@ -0,0 +1,65 @@ +From: Corey Minyard +Date: Thu, 9 May 2019 14:33:20 -0500 +Subject: [PATCH 264/342] sched/completion: Fix a lockup in + wait_for_completion() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=83dfd5e7c7759d10ab5260a4ed98cdd46efa7213 + +Consider following race: + + T0 T1 T2 + wait_for_completion() + do_wait_for_common() + __prepare_to_swait() + schedule() + complete() + x->done++ (0 -> 1) + raw_spin_lock_irqsave() + swake_up_locked() wait_for_completion() + wake_up_process(T0) + list_del_init() + raw_spin_unlock_irqrestore() + raw_spin_lock_irq(&x->wait.lock) + raw_spin_lock_irq(&x->wait.lock) x->done != UINT_MAX, 1 -> 0 + raw_spin_unlock_irq(&x->wait.lock) + return 1 + while (!x->done && timeout), + continue loop, not enqueued + on &x->wait + +Basically, the problem is that the original wait queues used in +completions did not remove the item from the queue in the wakeup +function, but swake_up_locked() does. + +Fix it by adding the thread to the wait queue inside the do loop. +The design of swait detects if it is already in the list and doesn't +do the list add again. + +Cc: stable-rt@vger.kernel.org +Fixes: a04ff6b4ec4ee7e ("completion: Use simple wait queues") +Signed-off-by: Corey Minyard +Acked-by: Steven Rostedt (VMware) +Signed-off-by: Steven Rostedt (VMware) +[bigeasy: shorten commit message ] +Signed-off-by: Sebastian Andrzej Siewior +--- + kernel/sched/completion.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/kernel/sched/completion.c b/kernel/sched/completion.c +index 755a58084978..49c14137988e 100644 +--- a/kernel/sched/completion.c ++++ b/kernel/sched/completion.c +@@ -72,12 +72,12 @@ do_wait_for_common(struct completion *x, + if (!x->done) { + DECLARE_SWAITQUEUE(wait); + +- __prepare_to_swait(&x->wait, &wait); + do { + if (signal_pending_state(state, current)) { + timeout = -ERESTARTSYS; + break; + } ++ __prepare_to_swait(&x->wait, &wait); + __set_current_state(state); + raw_spin_unlock_irq(&x->wait.lock); + timeout = action(timeout); diff --git a/debian/patches-rt/0265-kthread-add-a-global-worker-thread.patch b/debian/patches-rt/0265-kthread-add-a-global-worker-thread.patch new file mode 100644 index 000000000..304316c46 --- /dev/null +++ b/debian/patches-rt/0265-kthread-add-a-global-worker-thread.patch @@ -0,0 +1,176 @@ +From: Sebastian Andrzej Siewior +Date: Tue, 12 Feb 2019 15:09:38 +0100 +Subject: [PATCH 265/342] kthread: add a global worker thread. +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=a3be1221a15666a2cca554da5c38c39d106bcbdf + +[ Upstream commit 0532e87d9d44795221aa921ba7024bde689cc894 ] + +Add kthread_schedule_work() which uses a global kthread for all its +jobs. +Split the cgroup include to avoid recussive includes from interrupt.h. +Fixup everything that fails to build (and did not include all header). + +Signed-off-by: Sebastian Andrzej Siewior +[ + Fixed up include in blk-cgroup.h reported by Juri Lelli + http://lkml.kernel.org/r/20190722083009.GE25636@localhost.localdomain +] +Signed-off-by: Steven Rostedt (VMware) +--- + drivers/block/loop.c | 2 +- + drivers/spi/spi-rockchip.c | 1 + + include/linux/blk-cgroup.h | 2 +- + include/linux/kthread-cgroup.h | 17 +++++++++++++++++ + include/linux/kthread.h | 17 +++++++---------- + init/main.c | 1 + + kernel/kthread.c | 14 ++++++++++++++ + 7 files changed, 42 insertions(+), 12 deletions(-) + create mode 100644 include/linux/kthread-cgroup.h + +diff --git a/drivers/block/loop.c b/drivers/block/loop.c +index c31a76485c9c..d24660961343 100644 +--- a/drivers/block/loop.c ++++ b/drivers/block/loop.c +@@ -70,7 +70,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include +diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c +index 185bbdce62b1..63b10236eb05 100644 +--- a/drivers/spi/spi-rockchip.c ++++ b/drivers/spi/spi-rockchip.c +@@ -22,6 +22,7 @@ + #include + #include + #include ++#include + + #define DRIVER_NAME "rockchip-spi" + +diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h +index 8f1be8b49391..dc26ce6d840d 100644 +--- a/include/linux/blk-cgroup.h ++++ b/include/linux/blk-cgroup.h +@@ -14,7 +14,7 @@ + * Nauman Rafique + */ + +-#include ++#include + #include + #include + #include +diff --git a/include/linux/kthread-cgroup.h b/include/linux/kthread-cgroup.h +new file mode 100644 +index 000000000000..53d34bca9d72 +--- /dev/null ++++ b/include/linux/kthread-cgroup.h +@@ -0,0 +1,17 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++#ifndef _LINUX_KTHREAD_CGROUP_H ++#define _LINUX_KTHREAD_CGROUP_H ++#include ++#include ++ ++#ifdef CONFIG_BLK_CGROUP ++void kthread_associate_blkcg(struct cgroup_subsys_state *css); ++struct cgroup_subsys_state *kthread_blkcg(void); ++#else ++static inline void kthread_associate_blkcg(struct cgroup_subsys_state *css) { } ++static inline struct cgroup_subsys_state *kthread_blkcg(void) ++{ ++ return NULL; ++} ++#endif ++#endif +diff --git a/include/linux/kthread.h b/include/linux/kthread.h +index e0498e46d642..31140f0a6c2c 100644 +--- a/include/linux/kthread.h ++++ b/include/linux/kthread.h +@@ -4,7 +4,6 @@ + /* Simple interface for creating and stopping kernel threads without mess. */ + #include + #include +-#include + + __printf(4, 5) + struct task_struct *kthread_create_on_node(int (*threadfn)(void *data), +@@ -109,7 +108,7 @@ struct kthread_delayed_work { + }; + + #define KTHREAD_WORKER_INIT(worker) { \ +- .lock = __SPIN_LOCK_UNLOCKED((worker).lock), \ ++ .lock = __RAW_SPIN_LOCK_UNLOCKED((worker).lock), \ + .work_list = LIST_HEAD_INIT((worker).work_list), \ + .delayed_work_list = LIST_HEAD_INIT((worker).delayed_work_list),\ + } +@@ -201,14 +200,12 @@ bool kthread_cancel_delayed_work_sync(struct kthread_delayed_work *work); + + void kthread_destroy_worker(struct kthread_worker *worker); + +-#ifdef CONFIG_BLK_CGROUP +-void kthread_associate_blkcg(struct cgroup_subsys_state *css); +-struct cgroup_subsys_state *kthread_blkcg(void); +-#else +-static inline void kthread_associate_blkcg(struct cgroup_subsys_state *css) { } +-static inline struct cgroup_subsys_state *kthread_blkcg(void) ++extern struct kthread_worker kthread_global_worker; ++void kthread_init_global_worker(void); ++ ++static inline bool kthread_schedule_work(struct kthread_work *work) + { +- return NULL; ++ return kthread_queue_work(&kthread_global_worker, work); + } +-#endif ++ + #endif /* _LINUX_KTHREAD_H */ +diff --git a/init/main.c b/init/main.c +index 703b627a6060..8555afc3f3e1 100644 +--- a/init/main.c ++++ b/init/main.c +@@ -1136,6 +1136,7 @@ static noinline void __init kernel_init_freeable(void) + smp_prepare_cpus(setup_max_cpus); + + workqueue_init(); ++ kthread_init_global_worker(); + + init_mm_internals(); + +diff --git a/kernel/kthread.c b/kernel/kthread.c +index c8cf4731ced8..6bbd391f0d9c 100644 +--- a/kernel/kthread.c ++++ b/kernel/kthread.c +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + #include + + static DEFINE_SPINLOCK(kthread_create_lock); +@@ -1244,6 +1245,19 @@ void kthread_destroy_worker(struct kthread_worker *worker) + } + EXPORT_SYMBOL(kthread_destroy_worker); + ++DEFINE_KTHREAD_WORKER(kthread_global_worker); ++EXPORT_SYMBOL(kthread_global_worker); ++ ++__init void kthread_init_global_worker(void) ++{ ++ kthread_global_worker.task = kthread_create(kthread_worker_fn, ++ &kthread_global_worker, ++ "kswork"); ++ if (WARN_ON(IS_ERR(kthread_global_worker.task))) ++ return; ++ wake_up_process(kthread_global_worker.task); ++} ++ + #ifdef CONFIG_BLK_CGROUP + /** + * kthread_associate_blkcg - associate blkcg to current kthread diff --git a/debian/patches-rt/0265-sched-completion-Fix-a-lockup-in-wait_for_completion.patch b/debian/patches-rt/0265-sched-completion-Fix-a-lockup-in-wait_for_completion.patch deleted file mode 100644 index bf5c14343..000000000 --- a/debian/patches-rt/0265-sched-completion-Fix-a-lockup-in-wait_for_completion.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 055b27065070862af1438159975c51c824ed6db1 Mon Sep 17 00:00:00 2001 -From: Corey Minyard -Date: Thu, 9 May 2019 14:33:20 -0500 -Subject: [PATCH 265/347] sched/completion: Fix a lockup in - wait_for_completion() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -Consider following race: - - T0 T1 T2 - wait_for_completion() - do_wait_for_common() - __prepare_to_swait() - schedule() - complete() - x->done++ (0 -> 1) - raw_spin_lock_irqsave() - swake_up_locked() wait_for_completion() - wake_up_process(T0) - list_del_init() - raw_spin_unlock_irqrestore() - raw_spin_lock_irq(&x->wait.lock) - raw_spin_lock_irq(&x->wait.lock) x->done != UINT_MAX, 1 -> 0 - raw_spin_unlock_irq(&x->wait.lock) - return 1 - while (!x->done && timeout), - continue loop, not enqueued - on &x->wait - -Basically, the problem is that the original wait queues used in -completions did not remove the item from the queue in the wakeup -function, but swake_up_locked() does. - -Fix it by adding the thread to the wait queue inside the do loop. -The design of swait detects if it is already in the list and doesn't -do the list add again. - -Cc: stable-rt@vger.kernel.org -Fixes: a04ff6b4ec4ee7e ("completion: Use simple wait queues") -Signed-off-by: Corey Minyard -Acked-by: Steven Rostedt (VMware) -Signed-off-by: Steven Rostedt (VMware) -[bigeasy: shorten commit message ] -Signed-off-by: Sebastian Andrzej Siewior ---- - kernel/sched/completion.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/kernel/sched/completion.c b/kernel/sched/completion.c -index 755a58084978..49c14137988e 100644 ---- a/kernel/sched/completion.c -+++ b/kernel/sched/completion.c -@@ -72,12 +72,12 @@ do_wait_for_common(struct completion *x, - if (!x->done) { - DECLARE_SWAITQUEUE(wait); - -- __prepare_to_swait(&x->wait, &wait); - do { - if (signal_pending_state(state, current)) { - timeout = -ERESTARTSYS; - break; - } -+ __prepare_to_swait(&x->wait, &wait); - __set_current_state(state); - raw_spin_unlock_irq(&x->wait.lock); - timeout = action(timeout); --- -2.36.1 - diff --git a/debian/patches-rt/0266-arm-imx6-cpuidle-Use-raw_spinlock_t.patch b/debian/patches-rt/0266-arm-imx6-cpuidle-Use-raw_spinlock_t.patch new file mode 100644 index 000000000..f4ab668e2 --- /dev/null +++ b/debian/patches-rt/0266-arm-imx6-cpuidle-Use-raw_spinlock_t.patch @@ -0,0 +1,48 @@ +From: Sebastian Andrzej Siewior +Date: Tue, 14 May 2019 17:07:44 +0200 +Subject: [PATCH 266/342] arm: imx6: cpuidle: Use raw_spinlock_t +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=18215a774fb6f25e6044f44d0bb7285b03a1e151 + +[ Upstream commit 40d0332ec8312e9c090f0a5414d9c90e12b13611 ] + +The idle call back is invoked with disabled interrupts and requires +raw_spinlock_t locks to work. + +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + arch/arm/mach-imx/cpuidle-imx6q.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/arch/arm/mach-imx/cpuidle-imx6q.c b/arch/arm/mach-imx/cpuidle-imx6q.c +index 326e870d7123..d9ac80aa1eb0 100644 +--- a/arch/arm/mach-imx/cpuidle-imx6q.c ++++ b/arch/arm/mach-imx/cpuidle-imx6q.c +@@ -17,22 +17,22 @@ + #include "hardware.h" + + static int num_idle_cpus = 0; +-static DEFINE_SPINLOCK(cpuidle_lock); ++static DEFINE_RAW_SPINLOCK(cpuidle_lock); + + static int imx6q_enter_wait(struct cpuidle_device *dev, + struct cpuidle_driver *drv, int index) + { +- spin_lock(&cpuidle_lock); ++ raw_spin_lock(&cpuidle_lock); + if (++num_idle_cpus == num_online_cpus()) + imx6_set_lpm(WAIT_UNCLOCKED); +- spin_unlock(&cpuidle_lock); ++ raw_spin_unlock(&cpuidle_lock); + + cpu_do_idle(); + +- spin_lock(&cpuidle_lock); ++ raw_spin_lock(&cpuidle_lock); + if (num_idle_cpus-- == num_online_cpus()) + imx6_set_lpm(WAIT_CLOCKED); +- spin_unlock(&cpuidle_lock); ++ raw_spin_unlock(&cpuidle_lock); + + return index; + } diff --git a/debian/patches-rt/0266-kthread-add-a-global-worker-thread.patch b/debian/patches-rt/0266-kthread-add-a-global-worker-thread.patch deleted file mode 100644 index 467bba0ef..000000000 --- a/debian/patches-rt/0266-kthread-add-a-global-worker-thread.patch +++ /dev/null @@ -1,180 +0,0 @@ -From 840c9b4ba91e8486a177aafa9089c694248955c7 Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Tue, 12 Feb 2019 15:09:38 +0100 -Subject: [PATCH 266/347] kthread: add a global worker thread. -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 0532e87d9d44795221aa921ba7024bde689cc894 ] - -Add kthread_schedule_work() which uses a global kthread for all its -jobs. -Split the cgroup include to avoid recussive includes from interrupt.h. -Fixup everything that fails to build (and did not include all header). - -Signed-off-by: Sebastian Andrzej Siewior -[ - Fixed up include in blk-cgroup.h reported by Juri Lelli - http://lkml.kernel.org/r/20190722083009.GE25636@localhost.localdomain -] -Signed-off-by: Steven Rostedt (VMware) ---- - drivers/block/loop.c | 2 +- - drivers/spi/spi-rockchip.c | 1 + - include/linux/blk-cgroup.h | 2 +- - include/linux/kthread-cgroup.h | 17 +++++++++++++++++ - include/linux/kthread.h | 17 +++++++---------- - init/main.c | 1 + - kernel/kthread.c | 14 ++++++++++++++ - 7 files changed, 42 insertions(+), 12 deletions(-) - create mode 100644 include/linux/kthread-cgroup.h - -diff --git a/drivers/block/loop.c b/drivers/block/loop.c -index c31a76485c9c..d24660961343 100644 ---- a/drivers/block/loop.c -+++ b/drivers/block/loop.c -@@ -70,7 +70,7 @@ - #include - #include - #include --#include -+#include - #include - #include - #include -diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c -index 185bbdce62b1..63b10236eb05 100644 ---- a/drivers/spi/spi-rockchip.c -+++ b/drivers/spi/spi-rockchip.c -@@ -22,6 +22,7 @@ - #include - #include - #include -+#include - - #define DRIVER_NAME "rockchip-spi" - -diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h -index 8f1be8b49391..dc26ce6d840d 100644 ---- a/include/linux/blk-cgroup.h -+++ b/include/linux/blk-cgroup.h -@@ -14,7 +14,7 @@ - * Nauman Rafique - */ - --#include -+#include - #include - #include - #include -diff --git a/include/linux/kthread-cgroup.h b/include/linux/kthread-cgroup.h -new file mode 100644 -index 000000000000..53d34bca9d72 ---- /dev/null -+++ b/include/linux/kthread-cgroup.h -@@ -0,0 +1,17 @@ -+/* SPDX-License-Identifier: GPL-2.0 */ -+#ifndef _LINUX_KTHREAD_CGROUP_H -+#define _LINUX_KTHREAD_CGROUP_H -+#include -+#include -+ -+#ifdef CONFIG_BLK_CGROUP -+void kthread_associate_blkcg(struct cgroup_subsys_state *css); -+struct cgroup_subsys_state *kthread_blkcg(void); -+#else -+static inline void kthread_associate_blkcg(struct cgroup_subsys_state *css) { } -+static inline struct cgroup_subsys_state *kthread_blkcg(void) -+{ -+ return NULL; -+} -+#endif -+#endif -diff --git a/include/linux/kthread.h b/include/linux/kthread.h -index e0498e46d642..31140f0a6c2c 100644 ---- a/include/linux/kthread.h -+++ b/include/linux/kthread.h -@@ -4,7 +4,6 @@ - /* Simple interface for creating and stopping kernel threads without mess. */ - #include - #include --#include - - __printf(4, 5) - struct task_struct *kthread_create_on_node(int (*threadfn)(void *data), -@@ -109,7 +108,7 @@ struct kthread_delayed_work { - }; - - #define KTHREAD_WORKER_INIT(worker) { \ -- .lock = __SPIN_LOCK_UNLOCKED((worker).lock), \ -+ .lock = __RAW_SPIN_LOCK_UNLOCKED((worker).lock), \ - .work_list = LIST_HEAD_INIT((worker).work_list), \ - .delayed_work_list = LIST_HEAD_INIT((worker).delayed_work_list),\ - } -@@ -201,14 +200,12 @@ bool kthread_cancel_delayed_work_sync(struct kthread_delayed_work *work); - - void kthread_destroy_worker(struct kthread_worker *worker); - --#ifdef CONFIG_BLK_CGROUP --void kthread_associate_blkcg(struct cgroup_subsys_state *css); --struct cgroup_subsys_state *kthread_blkcg(void); --#else --static inline void kthread_associate_blkcg(struct cgroup_subsys_state *css) { } --static inline struct cgroup_subsys_state *kthread_blkcg(void) -+extern struct kthread_worker kthread_global_worker; -+void kthread_init_global_worker(void); -+ -+static inline bool kthread_schedule_work(struct kthread_work *work) - { -- return NULL; -+ return kthread_queue_work(&kthread_global_worker, work); - } --#endif -+ - #endif /* _LINUX_KTHREAD_H */ -diff --git a/init/main.c b/init/main.c -index 0d5763c5da28..f5d0917a4d4b 100644 ---- a/init/main.c -+++ b/init/main.c -@@ -1132,6 +1132,7 @@ static noinline void __init kernel_init_freeable(void) - smp_prepare_cpus(setup_max_cpus); - - workqueue_init(); -+ kthread_init_global_worker(); - - init_mm_internals(); - -diff --git a/kernel/kthread.c b/kernel/kthread.c -index c8cf4731ced8..6bbd391f0d9c 100644 ---- a/kernel/kthread.c -+++ b/kernel/kthread.c -@@ -20,6 +20,7 @@ - #include - #include - #include -+#include - #include - - static DEFINE_SPINLOCK(kthread_create_lock); -@@ -1244,6 +1245,19 @@ void kthread_destroy_worker(struct kthread_worker *worker) - } - EXPORT_SYMBOL(kthread_destroy_worker); - -+DEFINE_KTHREAD_WORKER(kthread_global_worker); -+EXPORT_SYMBOL(kthread_global_worker); -+ -+__init void kthread_init_global_worker(void) -+{ -+ kthread_global_worker.task = kthread_create(kthread_worker_fn, -+ &kthread_global_worker, -+ "kswork"); -+ if (WARN_ON(IS_ERR(kthread_global_worker.task))) -+ return; -+ wake_up_process(kthread_global_worker.task); -+} -+ - #ifdef CONFIG_BLK_CGROUP - /** - * kthread_associate_blkcg - associate blkcg to current kthread --- -2.36.1 - diff --git a/debian/patches-rt/0267-arm-imx6-cpuidle-Use-raw_spinlock_t.patch b/debian/patches-rt/0267-arm-imx6-cpuidle-Use-raw_spinlock_t.patch deleted file mode 100644 index 469d00fed..000000000 --- a/debian/patches-rt/0267-arm-imx6-cpuidle-Use-raw_spinlock_t.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 2fba570810dc44f1b4e171167882ff311417e129 Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Tue, 14 May 2019 17:07:44 +0200 -Subject: [PATCH 267/347] arm: imx6: cpuidle: Use raw_spinlock_t -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 40d0332ec8312e9c090f0a5414d9c90e12b13611 ] - -The idle call back is invoked with disabled interrupts and requires -raw_spinlock_t locks to work. - -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - arch/arm/mach-imx/cpuidle-imx6q.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/arch/arm/mach-imx/cpuidle-imx6q.c b/arch/arm/mach-imx/cpuidle-imx6q.c -index 326e870d7123..d9ac80aa1eb0 100644 ---- a/arch/arm/mach-imx/cpuidle-imx6q.c -+++ b/arch/arm/mach-imx/cpuidle-imx6q.c -@@ -17,22 +17,22 @@ - #include "hardware.h" - - static int num_idle_cpus = 0; --static DEFINE_SPINLOCK(cpuidle_lock); -+static DEFINE_RAW_SPINLOCK(cpuidle_lock); - - static int imx6q_enter_wait(struct cpuidle_device *dev, - struct cpuidle_driver *drv, int index) - { -- spin_lock(&cpuidle_lock); -+ raw_spin_lock(&cpuidle_lock); - if (++num_idle_cpus == num_online_cpus()) - imx6_set_lpm(WAIT_UNCLOCKED); -- spin_unlock(&cpuidle_lock); -+ raw_spin_unlock(&cpuidle_lock); - - cpu_do_idle(); - -- spin_lock(&cpuidle_lock); -+ raw_spin_lock(&cpuidle_lock); - if (num_idle_cpus-- == num_online_cpus()) - imx6_set_lpm(WAIT_CLOCKED); -- spin_unlock(&cpuidle_lock); -+ raw_spin_unlock(&cpuidle_lock); - - return index; - } --- -2.36.1 - diff --git a/debian/patches-rt/0267-rcu-Don-t-allow-to-change-rcu_normal_after_boot-on-R.patch b/debian/patches-rt/0267-rcu-Don-t-allow-to-change-rcu_normal_after_boot-on-R.patch new file mode 100644 index 000000000..6d0413f44 --- /dev/null +++ b/debian/patches-rt/0267-rcu-Don-t-allow-to-change-rcu_normal_after_boot-on-R.patch @@ -0,0 +1,32 @@ +From: Sebastian Andrzej Siewior +Date: Mon, 24 Jun 2019 18:29:13 +0200 +Subject: [PATCH 267/342] rcu: Don't allow to change rcu_normal_after_boot on + RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=ab3e64d17f40661769b76ad4ec295ced23d15efd + +[ Upstream commit c6c058c10577815a2491ce661876cff00a4c3b15 ] + +On RT rcu_normal_after_boot is enabled by default. +Don't allow to disable it on RT because the "expedited rcu" would +introduce latency spikes. + +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + kernel/rcu/update.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/kernel/rcu/update.c b/kernel/rcu/update.c +index 16d8dba23329..ed75addd3ccd 100644 +--- a/kernel/rcu/update.c ++++ b/kernel/rcu/update.c +@@ -69,7 +69,9 @@ module_param(rcu_expedited, int, 0); + extern int rcu_normal; /* from sysctl */ + module_param(rcu_normal, int, 0); + static int rcu_normal_after_boot = IS_ENABLED(CONFIG_PREEMPT_RT_FULL); ++#ifndef CONFIG_PREEMPT_RT_FULL + module_param(rcu_normal_after_boot, int, 0); ++#endif + #endif /* #ifndef CONFIG_TINY_RCU */ + + #ifdef CONFIG_DEBUG_LOCK_ALLOC diff --git a/debian/patches-rt/0268-pci-switchtec-fix-stream_open.cocci-warnings.patch b/debian/patches-rt/0268-pci-switchtec-fix-stream_open.cocci-warnings.patch new file mode 100644 index 000000000..b31baf7b4 --- /dev/null +++ b/debian/patches-rt/0268-pci-switchtec-fix-stream_open.cocci-warnings.patch @@ -0,0 +1,36 @@ +From: kbuild test robot +Date: Sat, 13 Apr 2019 11:22:51 +0800 +Subject: [PATCH 268/342] pci/switchtec: fix stream_open.cocci warnings +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=69a465fae034c3aa1f134b2802bc4edfa7b60016 + +[ Upstream commit 9462c69e29307adc95c289f50839d5d683973891 ] + +drivers/pci/switch/switchtec.c:395:1-17: ERROR: switchtec_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix. + +Generated by: scripts/coccinelle/api/stream_open.cocci + +Cc: Kirill Smelkov +Cc: Julia Lawall +Fixes: 8a29a3bae2a2 ("pci/switchtec: Don't use completion's wait queue") +Cc: stable-rt@vger.kernel.org # where it applies to +Link: https://lkml.kernel.org/r/alpine.DEB.2.21.1904131849350.2536@hadrien +Signed-off-by: kbuild test robot +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + drivers/pci/switch/switchtec.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c +index a8df847bedee..25d1f96cddc1 100644 +--- a/drivers/pci/switch/switchtec.c ++++ b/drivers/pci/switch/switchtec.c +@@ -356,7 +356,7 @@ static int switchtec_dev_open(struct inode *inode, struct file *filp) + return PTR_ERR(stuser); + + filp->private_data = stuser; +- nonseekable_open(inode, filp); ++ stream_open(inode, filp); + + dev_dbg(&stdev->dev, "%s: %p\n", __func__, stuser); + diff --git a/debian/patches-rt/0268-rcu-Don-t-allow-to-change-rcu_normal_after_boot-on-R.patch b/debian/patches-rt/0268-rcu-Don-t-allow-to-change-rcu_normal_after_boot-on-R.patch deleted file mode 100644 index 3e9b760d5..000000000 --- a/debian/patches-rt/0268-rcu-Don-t-allow-to-change-rcu_normal_after_boot-on-R.patch +++ /dev/null @@ -1,36 +0,0 @@ -From c06c2524bbfc1d9e9531a571fb86a03cd7965bd3 Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Mon, 24 Jun 2019 18:29:13 +0200 -Subject: [PATCH 268/347] rcu: Don't allow to change rcu_normal_after_boot on - RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit c6c058c10577815a2491ce661876cff00a4c3b15 ] - -On RT rcu_normal_after_boot is enabled by default. -Don't allow to disable it on RT because the "expedited rcu" would -introduce latency spikes. - -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - kernel/rcu/update.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/kernel/rcu/update.c b/kernel/rcu/update.c -index 16d8dba23329..ed75addd3ccd 100644 ---- a/kernel/rcu/update.c -+++ b/kernel/rcu/update.c -@@ -69,7 +69,9 @@ module_param(rcu_expedited, int, 0); - extern int rcu_normal; /* from sysctl */ - module_param(rcu_normal, int, 0); - static int rcu_normal_after_boot = IS_ENABLED(CONFIG_PREEMPT_RT_FULL); -+#ifndef CONFIG_PREEMPT_RT_FULL - module_param(rcu_normal_after_boot, int, 0); -+#endif - #endif /* #ifndef CONFIG_TINY_RCU */ - - #ifdef CONFIG_DEBUG_LOCK_ALLOC --- -2.36.1 - diff --git a/debian/patches-rt/0269-pci-switchtec-fix-stream_open.cocci-warnings.patch b/debian/patches-rt/0269-pci-switchtec-fix-stream_open.cocci-warnings.patch deleted file mode 100644 index b754add55..000000000 --- a/debian/patches-rt/0269-pci-switchtec-fix-stream_open.cocci-warnings.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 088093ff4b48997a7b7ee99d8dcdfd02b47bf472 Mon Sep 17 00:00:00 2001 -From: kbuild test robot -Date: Sat, 13 Apr 2019 11:22:51 +0800 -Subject: [PATCH 269/347] pci/switchtec: fix stream_open.cocci warnings -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 9462c69e29307adc95c289f50839d5d683973891 ] - -drivers/pci/switch/switchtec.c:395:1-17: ERROR: switchtec_fops: .read() can deadlock .write(); change nonseekable_open -> stream_open to fix. - -Generated by: scripts/coccinelle/api/stream_open.cocci - -Cc: Kirill Smelkov -Cc: Julia Lawall -Fixes: 8a29a3bae2a2 ("pci/switchtec: Don't use completion's wait queue") -Cc: stable-rt@vger.kernel.org # where it applies to -Link: https://lkml.kernel.org/r/alpine.DEB.2.21.1904131849350.2536@hadrien -Signed-off-by: kbuild test robot -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - drivers/pci/switch/switchtec.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c -index a8df847bedee..25d1f96cddc1 100644 ---- a/drivers/pci/switch/switchtec.c -+++ b/drivers/pci/switch/switchtec.c -@@ -356,7 +356,7 @@ static int switchtec_dev_open(struct inode *inode, struct file *filp) - return PTR_ERR(stuser); - - filp->private_data = stuser; -- nonseekable_open(inode, filp); -+ stream_open(inode, filp); - - dev_dbg(&stdev->dev, "%s: %p\n", __func__, stuser); - --- -2.36.1 - diff --git a/debian/patches-rt/0269-sched-core-Drop-a-preempt_disable_rt-statement.patch b/debian/patches-rt/0269-sched-core-Drop-a-preempt_disable_rt-statement.patch new file mode 100644 index 000000000..a4b7753db --- /dev/null +++ b/debian/patches-rt/0269-sched-core-Drop-a-preempt_disable_rt-statement.patch @@ -0,0 +1,46 @@ +From: Sebastian Andrzej Siewior +Date: Mon, 24 Jun 2019 19:33:16 +0200 +Subject: [PATCH 269/342] sched/core: Drop a preempt_disable_rt() statement +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=74d2e1a7300ec02a7bea54ed43fbabaa4e8e1193 + +[ Upstream commit 761126efdcbe3fa3e99c9079fa0ad6eca2f251f2 ] + +The caller holds a lock which already disables preemption. +Drop the preempt_disable_rt() statement in get_nohz_timer_target(). + +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + kernel/sched/core.c | 9 ++------- + 1 file changed, 2 insertions(+), 7 deletions(-) + +diff --git a/kernel/sched/core.c b/kernel/sched/core.c +index feaf4d5683af..3b0f62be3ece 100644 +--- a/kernel/sched/core.c ++++ b/kernel/sched/core.c +@@ -558,14 +558,11 @@ void resched_cpu(int cpu) + */ + int get_nohz_timer_target(void) + { +- int i, cpu; ++ int i, cpu = smp_processor_id(); + struct sched_domain *sd; + +- preempt_disable_rt(); +- cpu = smp_processor_id(); +- + if (!idle_cpu(cpu) && housekeeping_cpu(cpu, HK_FLAG_TIMER)) +- goto preempt_en_rt; ++ return cpu; + + rcu_read_lock(); + for_each_domain(cpu, sd) { +@@ -584,8 +581,6 @@ int get_nohz_timer_target(void) + cpu = housekeeping_any_cpu(HK_FLAG_TIMER); + unlock: + rcu_read_unlock(); +-preempt_en_rt: +- preempt_enable_rt(); + return cpu; + } + diff --git a/debian/patches-rt/0270-sched-core-Drop-a-preempt_disable_rt-statement.patch b/debian/patches-rt/0270-sched-core-Drop-a-preempt_disable_rt-statement.patch deleted file mode 100644 index c1c54692c..000000000 --- a/debian/patches-rt/0270-sched-core-Drop-a-preempt_disable_rt-statement.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 3b0ab176baa325b6e2d909c3d2ce7860873c1726 Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Mon, 24 Jun 2019 19:33:16 +0200 -Subject: [PATCH 270/347] sched/core: Drop a preempt_disable_rt() statement -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 761126efdcbe3fa3e99c9079fa0ad6eca2f251f2 ] - -The caller holds a lock which already disables preemption. -Drop the preempt_disable_rt() statement in get_nohz_timer_target(). - -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - kernel/sched/core.c | 9 ++------- - 1 file changed, 2 insertions(+), 7 deletions(-) - -diff --git a/kernel/sched/core.c b/kernel/sched/core.c -index feaf4d5683af..3b0f62be3ece 100644 ---- a/kernel/sched/core.c -+++ b/kernel/sched/core.c -@@ -558,14 +558,11 @@ void resched_cpu(int cpu) - */ - int get_nohz_timer_target(void) - { -- int i, cpu; -+ int i, cpu = smp_processor_id(); - struct sched_domain *sd; - -- preempt_disable_rt(); -- cpu = smp_processor_id(); -- - if (!idle_cpu(cpu) && housekeeping_cpu(cpu, HK_FLAG_TIMER)) -- goto preempt_en_rt; -+ return cpu; - - rcu_read_lock(); - for_each_domain(cpu, sd) { -@@ -584,8 +581,6 @@ int get_nohz_timer_target(void) - cpu = housekeeping_any_cpu(HK_FLAG_TIMER); - unlock: - rcu_read_unlock(); --preempt_en_rt: -- preempt_enable_rt(); - return cpu; - } - --- -2.36.1 - diff --git a/debian/patches-rt/0270-timers-Redo-the-notification-of-canceling-timers-on-.patch b/debian/patches-rt/0270-timers-Redo-the-notification-of-canceling-timers-on-.patch new file mode 100644 index 000000000..1f5b2ab81 --- /dev/null +++ b/debian/patches-rt/0270-timers-Redo-the-notification-of-canceling-timers-on-.patch @@ -0,0 +1,646 @@ +From: Sebastian Andrzej Siewior +Date: Mon, 24 Jun 2019 19:39:06 +0200 +Subject: [PATCH 270/342] timers: Redo the notification of canceling timers on + -RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=e0d1c4cbc44a31f090ff94e4c029f31c97d2391d + +[ Upstream commit c71273154c2ad12e13333aada340ff30e826a11b ] + +Rework of the hrtimer, timer and posix-timer cancelation interface +on -RT. Instead of the swait/schedule interface we now have locks +which are taken while timer is active. During the cancellation of an +active timer the lock is acquired. The lock will then either +PI-boost the timer or block and wait until the timer completed. +The new code looks simpler and does not trigger a warning from +rcu_note_context_switch() anymore like reported by Grygorii Strashko +and Daniel Wagner. +The patches were contributed by Anna-Maria Gleixner. + +This is an all in one commit of the following patches: +| [PATCH] timers: Introduce expiry spin lock +| [PATCH] timers: Drop expiry lock after each timer invocation +| [PATCH] hrtimer: Introduce expiry spin lock +| [PATCH] posix-timers: move rcu out of union +| [PATCH] posix-timers: Add expiry lock + +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + fs/timerfd.c | 5 +- + include/linux/hrtimer.h | 17 ++---- + include/linux/posix-timers.h | 1 + + kernel/time/alarmtimer.c | 2 +- + kernel/time/hrtimer.c | 36 ++++--------- + kernel/time/itimer.c | 2 +- + kernel/time/posix-cpu-timers.c | 23 ++++++++ + kernel/time/posix-timers.c | 69 ++++++++++-------------- + kernel/time/posix-timers.h | 2 + + kernel/time/timer.c | 96 ++++++++++++++++------------------ + 10 files changed, 118 insertions(+), 135 deletions(-) + +diff --git a/fs/timerfd.c b/fs/timerfd.c +index 82d0f52414a6..f845093466be 100644 +--- a/fs/timerfd.c ++++ b/fs/timerfd.c +@@ -471,10 +471,11 @@ static int do_timerfd_settime(int ufd, int flags, + break; + } + spin_unlock_irq(&ctx->wqh.lock); ++ + if (isalarm(ctx)) +- hrtimer_wait_for_timer(&ctx->t.alarm.timer); ++ hrtimer_grab_expiry_lock(&ctx->t.alarm.timer); + else +- hrtimer_wait_for_timer(&ctx->t.tmr); ++ hrtimer_grab_expiry_lock(&ctx->t.tmr); + } + + /* +diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h +index 082147c07831..aee31b1f0cc3 100644 +--- a/include/linux/hrtimer.h ++++ b/include/linux/hrtimer.h +@@ -22,7 +22,6 @@ + #include + #include + #include +-#include + + struct hrtimer_clock_base; + struct hrtimer_cpu_base; +@@ -193,6 +192,8 @@ enum hrtimer_base_type { + * @nr_retries: Total number of hrtimer interrupt retries + * @nr_hangs: Total number of hrtimer interrupt hangs + * @max_hang_time: Maximum time spent in hrtimer_interrupt ++ * @softirq_expiry_lock: Lock which is taken while softirq based hrtimer are ++ * expired + * @expires_next: absolute time of the next event, is required for remote + * hrtimer enqueue; it is the total first expiry time (hard + * and soft hrtimer are taken into account) +@@ -220,12 +221,10 @@ struct hrtimer_cpu_base { + unsigned short nr_hangs; + unsigned int max_hang_time; + #endif ++ spinlock_t softirq_expiry_lock; + ktime_t expires_next; + struct hrtimer *next_timer; + ktime_t softirq_expires_next; +-#ifdef CONFIG_PREEMPT_RT_BASE +- wait_queue_head_t wait; +-#endif + struct hrtimer *softirq_next_timer; + struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES]; + } ____cacheline_aligned; +@@ -426,6 +425,7 @@ static inline void hrtimer_start(struct hrtimer *timer, ktime_t tim, + + extern int hrtimer_cancel(struct hrtimer *timer); + extern int hrtimer_try_to_cancel(struct hrtimer *timer); ++extern void hrtimer_grab_expiry_lock(const struct hrtimer *timer); + + static inline void hrtimer_start_expires(struct hrtimer *timer, + enum hrtimer_mode mode) +@@ -443,13 +443,6 @@ static inline void hrtimer_restart(struct hrtimer *timer) + hrtimer_start_expires(timer, HRTIMER_MODE_ABS); + } + +-/* Softirq preemption could deadlock timer removal */ +-#ifdef CONFIG_PREEMPT_RT_BASE +- extern void hrtimer_wait_for_timer(const struct hrtimer *timer); +-#else +-# define hrtimer_wait_for_timer(timer) do { cpu_relax(); } while (0) +-#endif +- + /* Query timers: */ + extern ktime_t __hrtimer_get_remaining(const struct hrtimer *timer, bool adjust); + +@@ -481,7 +474,7 @@ static inline bool hrtimer_is_queued(struct hrtimer *timer) + * Helper function to check, whether the timer is running the callback + * function + */ +-static inline int hrtimer_callback_running(const struct hrtimer *timer) ++static inline int hrtimer_callback_running(struct hrtimer *timer) + { + return timer->base->running == timer; + } +diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h +index 0571b498db73..3e6c91bdf2ef 100644 +--- a/include/linux/posix-timers.h ++++ b/include/linux/posix-timers.h +@@ -15,6 +15,7 @@ struct cpu_timer_list { + u64 expires, incr; + struct task_struct *task; + int firing; ++ int firing_cpu; + }; + + /* +diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c +index f4c8cfde00b0..e7b983df6996 100644 +--- a/kernel/time/alarmtimer.c ++++ b/kernel/time/alarmtimer.c +@@ -438,7 +438,7 @@ int alarm_cancel(struct alarm *alarm) + int ret = alarm_try_to_cancel(alarm); + if (ret >= 0) + return ret; +- hrtimer_wait_for_timer(&alarm->timer); ++ hrtimer_grab_expiry_lock(&alarm->timer); + } + } + EXPORT_SYMBOL_GPL(alarm_cancel); +diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c +index aa8f3177580a..bbc408f24f5d 100644 +--- a/kernel/time/hrtimer.c ++++ b/kernel/time/hrtimer.c +@@ -981,33 +981,16 @@ u64 hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval) + } + EXPORT_SYMBOL_GPL(hrtimer_forward); + +-#ifdef CONFIG_PREEMPT_RT_BASE +-# define wake_up_timer_waiters(b) wake_up(&(b)->wait) +- +-/** +- * hrtimer_wait_for_timer - Wait for a running timer +- * +- * @timer: timer to wait for +- * +- * The function waits in case the timers callback function is +- * currently executed on the waitqueue of the timer base. The +- * waitqueue is woken up after the timer callback function has +- * finished execution. +- */ +-void hrtimer_wait_for_timer(const struct hrtimer *timer) ++void hrtimer_grab_expiry_lock(const struct hrtimer *timer) + { + struct hrtimer_clock_base *base = timer->base; + +- if (base && base->cpu_base && +- base->index >= HRTIMER_BASE_MONOTONIC_SOFT) +- wait_event(base->cpu_base->wait, +- !(hrtimer_callback_running(timer))); ++ if (base && base->cpu_base) { ++ spin_lock(&base->cpu_base->softirq_expiry_lock); ++ spin_unlock(&base->cpu_base->softirq_expiry_lock); ++ } + } + +-#else +-# define wake_up_timer_waiters(b) do { } while (0) +-#endif +- + /* + * enqueue_hrtimer - internal function to (re)start a timer + * +@@ -1291,7 +1274,7 @@ int hrtimer_cancel(struct hrtimer *timer) + + if (ret >= 0) + return ret; +- hrtimer_wait_for_timer(timer); ++ hrtimer_grab_expiry_lock(timer); + } + } + EXPORT_SYMBOL_GPL(hrtimer_cancel); +@@ -1595,6 +1578,7 @@ static __latent_entropy void hrtimer_run_softirq(struct softirq_action *h) + unsigned long flags; + ktime_t now; + ++ spin_lock(&cpu_base->softirq_expiry_lock); + raw_spin_lock_irqsave(&cpu_base->lock, flags); + + now = hrtimer_update_base(cpu_base); +@@ -1604,7 +1588,7 @@ static __latent_entropy void hrtimer_run_softirq(struct softirq_action *h) + hrtimer_update_softirq_timer(cpu_base, true); + + raw_spin_unlock_irqrestore(&cpu_base->lock, flags); +- wake_up_timer_waiters(cpu_base); ++ spin_unlock(&cpu_base->softirq_expiry_lock); + } + + #ifdef CONFIG_HIGH_RES_TIMERS +@@ -2014,9 +1998,7 @@ int hrtimers_prepare_cpu(unsigned int cpu) + cpu_base->softirq_next_timer = NULL; + cpu_base->expires_next = KTIME_MAX; + cpu_base->softirq_expires_next = KTIME_MAX; +-#ifdef CONFIG_PREEMPT_RT_BASE +- init_waitqueue_head(&cpu_base->wait); +-#endif ++ spin_lock_init(&cpu_base->softirq_expiry_lock); + return 0; + } + +diff --git a/kernel/time/itimer.c b/kernel/time/itimer.c +index 7650ee736964..48d977f947d9 100644 +--- a/kernel/time/itimer.c ++++ b/kernel/time/itimer.c +@@ -211,7 +211,7 @@ int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue) + /* We are sharing ->siglock with it_real_fn() */ + if (hrtimer_try_to_cancel(timer) < 0) { + spin_unlock_irq(&tsk->sighand->siglock); +- hrtimer_wait_for_timer(&tsk->signal->real_timer); ++ hrtimer_grab_expiry_lock(timer); + goto again; + } + expires = timeval_to_ktime(value->it_value); +diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c +index 2d29b269dc83..54632ed51c65 100644 +--- a/kernel/time/posix-cpu-timers.c ++++ b/kernel/time/posix-cpu-timers.c +@@ -792,6 +792,7 @@ check_timers_list(struct list_head *timers, + return t->expires; + + t->firing = 1; ++ t->firing_cpu = smp_processor_id(); + list_move_tail(&t->entry, firing); + } + +@@ -1138,6 +1139,20 @@ static inline int fastpath_timer_check(struct task_struct *tsk) + return 0; + } + ++static DEFINE_PER_CPU(spinlock_t, cpu_timer_expiry_lock) = __SPIN_LOCK_UNLOCKED(cpu_timer_expiry_lock); ++ ++void cpu_timers_grab_expiry_lock(struct k_itimer *timer) ++{ ++ int cpu = timer->it.cpu.firing_cpu; ++ ++ if (cpu >= 0) { ++ spinlock_t *expiry_lock = per_cpu_ptr(&cpu_timer_expiry_lock, cpu); ++ ++ spin_lock_irq(expiry_lock); ++ spin_unlock_irq(expiry_lock); ++ } ++} ++ + /* + * This is called from the timer interrupt handler. The irq handler has + * already updated our counts. We need to check if any timers fire now. +@@ -1148,6 +1163,7 @@ static void __run_posix_cpu_timers(struct task_struct *tsk) + LIST_HEAD(firing); + struct k_itimer *timer, *next; + unsigned long flags; ++ spinlock_t *expiry_lock; + + /* + * The fast path checks that there are no expired thread or thread +@@ -1156,6 +1172,9 @@ static void __run_posix_cpu_timers(struct task_struct *tsk) + if (!fastpath_timer_check(tsk)) + return; + ++ expiry_lock = this_cpu_ptr(&cpu_timer_expiry_lock); ++ spin_lock(expiry_lock); ++ + if (!lock_task_sighand(tsk, &flags)) + return; + /* +@@ -1190,6 +1209,7 @@ static void __run_posix_cpu_timers(struct task_struct *tsk) + list_del_init(&timer->it.cpu.entry); + cpu_firing = timer->it.cpu.firing; + timer->it.cpu.firing = 0; ++ timer->it.cpu.firing_cpu = -1; + /* + * The firing flag is -1 if we collided with a reset + * of the timer, which already reported this +@@ -1199,6 +1219,7 @@ static void __run_posix_cpu_timers(struct task_struct *tsk) + cpu_timer_fire(timer); + spin_unlock(&timer->it_lock); + } ++ spin_unlock(expiry_lock); + } + + #ifdef CONFIG_PREEMPT_RT_BASE +@@ -1466,6 +1487,8 @@ static int do_cpu_nanosleep(const clockid_t which_clock, int flags, + spin_unlock_irq(&timer.it_lock); + + while (error == TIMER_RETRY) { ++ ++ cpu_timers_grab_expiry_lock(&timer); + /* + * We need to handle case when timer was or is in the + * middle of firing. In other cases we already freed +diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c +index 2cf5aa704106..3fd433d2a767 100644 +--- a/kernel/time/posix-timers.c ++++ b/kernel/time/posix-timers.c +@@ -821,25 +821,20 @@ static void common_hrtimer_arm(struct k_itimer *timr, ktime_t expires, + hrtimer_start_expires(timer, HRTIMER_MODE_ABS); + } + +-/* +- * Protected by RCU! +- */ +-static void timer_wait_for_callback(const struct k_clock *kc, struct k_itimer *timr) ++static int common_hrtimer_try_to_cancel(struct k_itimer *timr) + { +-#ifdef CONFIG_PREEMPT_RT_FULL +- if (kc->timer_arm == common_hrtimer_arm) +- hrtimer_wait_for_timer(&timr->it.real.timer); +- else if (kc == &alarm_clock) +- hrtimer_wait_for_timer(&timr->it.alarm.alarmtimer.timer); +- else +- /* FIXME: Whacky hack for posix-cpu-timers */ +- schedule_timeout(1); +-#endif ++ return hrtimer_try_to_cancel(&timr->it.real.timer); + } + +-static int common_hrtimer_try_to_cancel(struct k_itimer *timr) ++static void timer_wait_for_callback(const struct k_clock *kc, struct k_itimer *timer) + { +- return hrtimer_try_to_cancel(&timr->it.real.timer); ++ if (kc->timer_arm == common_hrtimer_arm) ++ hrtimer_grab_expiry_lock(&timer->it.real.timer); ++ else if (kc == &alarm_clock) ++ hrtimer_grab_expiry_lock(&timer->it.alarm.alarmtimer.timer); ++ else ++ /* posix-cpu-timers */ ++ cpu_timers_grab_expiry_lock(timer); + } + + /* Set a POSIX.1b interval timer. */ +@@ -901,21 +896,21 @@ static int do_timer_settime(timer_t timer_id, int flags, + if (!timr) + return -EINVAL; + +- rcu_read_lock(); + kc = timr->kclock; + if (WARN_ON_ONCE(!kc || !kc->timer_set)) + error = -EINVAL; + else + error = kc->timer_set(timr, flags, new_spec64, old_spec64); + +- unlock_timer(timr, flag); + if (error == TIMER_RETRY) { ++ rcu_read_lock(); ++ unlock_timer(timr, flag); + timer_wait_for_callback(kc, timr); +- old_spec64 = NULL; // We already got the old time... + rcu_read_unlock(); ++ old_spec64 = NULL; // We already got the old time... + goto retry; + } +- rcu_read_unlock(); ++ unlock_timer(timr, flag); + + return error; + } +@@ -977,13 +972,21 @@ int common_timer_del(struct k_itimer *timer) + return 0; + } + +-static inline int timer_delete_hook(struct k_itimer *timer) ++static int timer_delete_hook(struct k_itimer *timer) + { + const struct k_clock *kc = timer->kclock; ++ int ret; + + if (WARN_ON_ONCE(!kc || !kc->timer_del)) + return -EINVAL; +- return kc->timer_del(timer); ++ ret = kc->timer_del(timer); ++ if (ret == TIMER_RETRY) { ++ rcu_read_lock(); ++ spin_unlock_irq(&timer->it_lock); ++ timer_wait_for_callback(kc, timer); ++ rcu_read_unlock(); ++ } ++ return ret; + } + + /* Delete a POSIX.1b interval timer. */ +@@ -997,15 +1000,8 @@ SYSCALL_DEFINE1(timer_delete, timer_t, timer_id) + if (!timer) + return -EINVAL; + +- rcu_read_lock(); +- if (timer_delete_hook(timer) == TIMER_RETRY) { +- unlock_timer(timer, flags); +- timer_wait_for_callback(clockid_to_kclock(timer->it_clock), +- timer); +- rcu_read_unlock(); ++ if (timer_delete_hook(timer) == TIMER_RETRY) + goto retry_delete; +- } +- rcu_read_unlock(); + + spin_lock(¤t->sighand->siglock); + list_del(&timer->list); +@@ -1031,20 +1027,9 @@ static void itimer_delete(struct k_itimer *timer) + retry_delete: + spin_lock_irqsave(&timer->it_lock, flags); + +- /* On RT we can race with a deletion */ +- if (!timer->it_signal) { +- unlock_timer(timer, flags); +- return; +- } +- +- if (timer_delete_hook(timer) == TIMER_RETRY) { +- rcu_read_lock(); +- unlock_timer(timer, flags); +- timer_wait_for_callback(clockid_to_kclock(timer->it_clock), +- timer); +- rcu_read_unlock(); ++ if (timer_delete_hook(timer) == TIMER_RETRY) + goto retry_delete; +- } ++ + list_del(&timer->list); + /* + * This keeps any tasks waiting on the spin lock from thinking +diff --git a/kernel/time/posix-timers.h b/kernel/time/posix-timers.h +index ddb21145211a..725bd230a8db 100644 +--- a/kernel/time/posix-timers.h ++++ b/kernel/time/posix-timers.h +@@ -32,6 +32,8 @@ extern const struct k_clock clock_process; + extern const struct k_clock clock_thread; + extern const struct k_clock alarm_clock; + ++extern void cpu_timers_grab_expiry_lock(struct k_itimer *timer); ++ + int posix_timer_event(struct k_itimer *timr, int si_private); + + void common_timer_get(struct k_itimer *timr, struct itimerspec64 *cur_setting); +diff --git a/kernel/time/timer.c b/kernel/time/timer.c +index c7bd68db6f63..a2be2277506d 100644 +--- a/kernel/time/timer.c ++++ b/kernel/time/timer.c +@@ -45,7 +45,6 @@ + #include + #include + #include +-#include + + #include + #include +@@ -199,9 +198,7 @@ EXPORT_SYMBOL(jiffies_64); + struct timer_base { + raw_spinlock_t lock; + struct timer_list *running_timer; +-#ifdef CONFIG_PREEMPT_RT_FULL +- struct swait_queue_head wait_for_running_timer; +-#endif ++ spinlock_t expiry_lock; + unsigned long clk; + unsigned long next_expiry; + unsigned int cpu; +@@ -1201,33 +1198,6 @@ void add_timer_on(struct timer_list *timer, int cpu) + } + EXPORT_SYMBOL_GPL(add_timer_on); + +-#ifdef CONFIG_PREEMPT_RT_FULL +-/* +- * Wait for a running timer +- */ +-static void wait_for_running_timer(struct timer_list *timer) +-{ +- struct timer_base *base; +- u32 tf = timer->flags; +- +- if (tf & TIMER_MIGRATING) +- return; +- +- base = get_timer_base(tf); +- swait_event_exclusive(base->wait_for_running_timer, +- base->running_timer != timer); +-} +- +-# define wakeup_timer_waiters(b) swake_up_all(&(b)->wait_for_running_timer) +-#else +-static inline void wait_for_running_timer(struct timer_list *timer) +-{ +- cpu_relax(); +-} +- +-# define wakeup_timer_waiters(b) do { } while (0) +-#endif +- + /** + * del_timer - deactivate a timer. + * @timer: the timer to be deactivated +@@ -1257,14 +1227,8 @@ int del_timer(struct timer_list *timer) + } + EXPORT_SYMBOL(del_timer); + +-/** +- * try_to_del_timer_sync - Try to deactivate a timer +- * @timer: timer to delete +- * +- * This function tries to deactivate a timer. Upon successful (ret >= 0) +- * exit the timer is not queued and the handler is not running on any CPU. +- */ +-int try_to_del_timer_sync(struct timer_list *timer) ++static int __try_to_del_timer_sync(struct timer_list *timer, ++ struct timer_base **basep) + { + struct timer_base *base; + unsigned long flags; +@@ -1272,7 +1236,7 @@ int try_to_del_timer_sync(struct timer_list *timer) + + debug_assert_init(timer); + +- base = lock_timer_base(timer, &flags); ++ *basep = base = lock_timer_base(timer, &flags); + + if (base->running_timer != timer) + ret = detach_if_pending(timer, base, true); +@@ -1281,9 +1245,42 @@ int try_to_del_timer_sync(struct timer_list *timer) + + return ret; + } ++ ++/** ++ * try_to_del_timer_sync - Try to deactivate a timer ++ * @timer: timer to delete ++ * ++ * This function tries to deactivate a timer. Upon successful (ret >= 0) ++ * exit the timer is not queued and the handler is not running on any CPU. ++ */ ++int try_to_del_timer_sync(struct timer_list *timer) ++{ ++ struct timer_base *base; ++ ++ return __try_to_del_timer_sync(timer, &base); ++} + EXPORT_SYMBOL(try_to_del_timer_sync); + + #if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT_FULL) ++static int __del_timer_sync(struct timer_list *timer) ++{ ++ struct timer_base *base; ++ int ret; ++ ++ for (;;) { ++ ret = __try_to_del_timer_sync(timer, &base); ++ if (ret >= 0) ++ return ret; ++ ++ /* ++ * When accessing the lock, timers of base are no longer expired ++ * and so timer is no longer running. ++ */ ++ spin_lock(&base->expiry_lock); ++ spin_unlock(&base->expiry_lock); ++ } ++} ++ + /** + * del_timer_sync - deactivate a timer and wait for the handler to finish. + * @timer: the timer to be deactivated +@@ -1339,12 +1336,8 @@ int del_timer_sync(struct timer_list *timer) + * could lead to deadlock. + */ + WARN_ON(in_irq() && !(timer->flags & TIMER_IRQSAFE)); +- for (;;) { +- int ret = try_to_del_timer_sync(timer); +- if (ret >= 0) +- return ret; +- wait_for_running_timer(timer); +- } ++ ++ return __del_timer_sync(timer); + } + EXPORT_SYMBOL(del_timer_sync); + #endif +@@ -1409,11 +1402,15 @@ static void expire_timers(struct timer_base *base, struct hlist_head *head) + raw_spin_unlock(&base->lock); + call_timer_fn(timer, fn); + base->running_timer = NULL; ++ spin_unlock(&base->expiry_lock); ++ spin_lock(&base->expiry_lock); + raw_spin_lock(&base->lock); + } else { + raw_spin_unlock_irq(&base->lock); + call_timer_fn(timer, fn); + base->running_timer = NULL; ++ spin_unlock(&base->expiry_lock); ++ spin_lock(&base->expiry_lock); + raw_spin_lock_irq(&base->lock); + } + } +@@ -1710,6 +1707,7 @@ static inline void __run_timers(struct timer_base *base) + if (!time_after_eq(jiffies, base->clk)) + return; + ++ spin_lock(&base->expiry_lock); + raw_spin_lock_irq(&base->lock); + + /* +@@ -1737,7 +1735,7 @@ static inline void __run_timers(struct timer_base *base) + expire_timers(base, heads + levels); + } + raw_spin_unlock_irq(&base->lock); +- wakeup_timer_waiters(base); ++ spin_unlock(&base->expiry_lock); + } + + /* +@@ -1984,9 +1982,7 @@ static void __init init_timer_cpu(int cpu) + base->cpu = cpu; + raw_spin_lock_init(&base->lock); + base->clk = jiffies; +-#ifdef CONFIG_PREEMPT_RT_FULL +- init_swait_queue_head(&base->wait_for_running_timer); +-#endif ++ spin_lock_init(&base->expiry_lock); + } + } + diff --git a/debian/patches-rt/0271-Revert-futex-Ensure-lock-unlock-symetry-versus-pi_lo.patch b/debian/patches-rt/0271-Revert-futex-Ensure-lock-unlock-symetry-versus-pi_lo.patch new file mode 100644 index 000000000..c4309368f --- /dev/null +++ b/debian/patches-rt/0271-Revert-futex-Ensure-lock-unlock-symetry-versus-pi_lo.patch @@ -0,0 +1,31 @@ +From: Sebastian Andrzej Siewior +Date: Wed, 26 Jun 2019 17:44:13 +0200 +Subject: [PATCH 271/342] Revert "futex: Ensure lock/unlock symetry versus + pi_lock and hash bucket lock" +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=d00bb8bbc139fe4cd03a34a820bc7ed395b791ea + +[ Upstream commit 6a773b70cf105b46298ed3b44e77c102ce31d9ec ] + +Drop the RT fixup, the futex code will be changed to avoid the need for +the workaround. + +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + kernel/futex.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/kernel/futex.c b/kernel/futex.c +index a5a263a3efbf..3449a716a378 100644 +--- a/kernel/futex.c ++++ b/kernel/futex.c +@@ -962,9 +962,7 @@ static void exit_pi_state_list(struct task_struct *curr) + if (head->next != next) { + /* retain curr->pi_lock for the loop invariant */ + raw_spin_unlock(&pi_state->pi_mutex.wait_lock); +- raw_spin_unlock_irq(&curr->pi_lock); + spin_unlock(&hb->lock); +- raw_spin_lock_irq(&curr->pi_lock); + put_pi_state(pi_state); + continue; + } diff --git a/debian/patches-rt/0271-timers-Redo-the-notification-of-canceling-timers-on-.patch b/debian/patches-rt/0271-timers-Redo-the-notification-of-canceling-timers-on-.patch deleted file mode 100644 index 46b7ac22c..000000000 --- a/debian/patches-rt/0271-timers-Redo-the-notification-of-canceling-timers-on-.patch +++ /dev/null @@ -1,650 +0,0 @@ -From abca2e3959b31be6e2cbc9d1e8d6ddebf31df3ea Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Mon, 24 Jun 2019 19:39:06 +0200 -Subject: [PATCH 271/347] timers: Redo the notification of canceling timers on - -RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit c71273154c2ad12e13333aada340ff30e826a11b ] - -Rework of the hrtimer, timer and posix-timer cancelation interface -on -RT. Instead of the swait/schedule interface we now have locks -which are taken while timer is active. During the cancellation of an -active timer the lock is acquired. The lock will then either -PI-boost the timer or block and wait until the timer completed. -The new code looks simpler and does not trigger a warning from -rcu_note_context_switch() anymore like reported by Grygorii Strashko -and Daniel Wagner. -The patches were contributed by Anna-Maria Gleixner. - -This is an all in one commit of the following patches: -| [PATCH] timers: Introduce expiry spin lock -| [PATCH] timers: Drop expiry lock after each timer invocation -| [PATCH] hrtimer: Introduce expiry spin lock -| [PATCH] posix-timers: move rcu out of union -| [PATCH] posix-timers: Add expiry lock - -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - fs/timerfd.c | 5 +- - include/linux/hrtimer.h | 17 ++---- - include/linux/posix-timers.h | 1 + - kernel/time/alarmtimer.c | 2 +- - kernel/time/hrtimer.c | 36 ++++--------- - kernel/time/itimer.c | 2 +- - kernel/time/posix-cpu-timers.c | 23 ++++++++ - kernel/time/posix-timers.c | 69 ++++++++++-------------- - kernel/time/posix-timers.h | 2 + - kernel/time/timer.c | 96 ++++++++++++++++------------------ - 10 files changed, 118 insertions(+), 135 deletions(-) - -diff --git a/fs/timerfd.c b/fs/timerfd.c -index 82d0f52414a6..f845093466be 100644 ---- a/fs/timerfd.c -+++ b/fs/timerfd.c -@@ -471,10 +471,11 @@ static int do_timerfd_settime(int ufd, int flags, - break; - } - spin_unlock_irq(&ctx->wqh.lock); -+ - if (isalarm(ctx)) -- hrtimer_wait_for_timer(&ctx->t.alarm.timer); -+ hrtimer_grab_expiry_lock(&ctx->t.alarm.timer); - else -- hrtimer_wait_for_timer(&ctx->t.tmr); -+ hrtimer_grab_expiry_lock(&ctx->t.tmr); - } - - /* -diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h -index 082147c07831..aee31b1f0cc3 100644 ---- a/include/linux/hrtimer.h -+++ b/include/linux/hrtimer.h -@@ -22,7 +22,6 @@ - #include - #include - #include --#include - - struct hrtimer_clock_base; - struct hrtimer_cpu_base; -@@ -193,6 +192,8 @@ enum hrtimer_base_type { - * @nr_retries: Total number of hrtimer interrupt retries - * @nr_hangs: Total number of hrtimer interrupt hangs - * @max_hang_time: Maximum time spent in hrtimer_interrupt -+ * @softirq_expiry_lock: Lock which is taken while softirq based hrtimer are -+ * expired - * @expires_next: absolute time of the next event, is required for remote - * hrtimer enqueue; it is the total first expiry time (hard - * and soft hrtimer are taken into account) -@@ -220,12 +221,10 @@ struct hrtimer_cpu_base { - unsigned short nr_hangs; - unsigned int max_hang_time; - #endif -+ spinlock_t softirq_expiry_lock; - ktime_t expires_next; - struct hrtimer *next_timer; - ktime_t softirq_expires_next; --#ifdef CONFIG_PREEMPT_RT_BASE -- wait_queue_head_t wait; --#endif - struct hrtimer *softirq_next_timer; - struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES]; - } ____cacheline_aligned; -@@ -426,6 +425,7 @@ static inline void hrtimer_start(struct hrtimer *timer, ktime_t tim, - - extern int hrtimer_cancel(struct hrtimer *timer); - extern int hrtimer_try_to_cancel(struct hrtimer *timer); -+extern void hrtimer_grab_expiry_lock(const struct hrtimer *timer); - - static inline void hrtimer_start_expires(struct hrtimer *timer, - enum hrtimer_mode mode) -@@ -443,13 +443,6 @@ static inline void hrtimer_restart(struct hrtimer *timer) - hrtimer_start_expires(timer, HRTIMER_MODE_ABS); - } - --/* Softirq preemption could deadlock timer removal */ --#ifdef CONFIG_PREEMPT_RT_BASE -- extern void hrtimer_wait_for_timer(const struct hrtimer *timer); --#else --# define hrtimer_wait_for_timer(timer) do { cpu_relax(); } while (0) --#endif -- - /* Query timers: */ - extern ktime_t __hrtimer_get_remaining(const struct hrtimer *timer, bool adjust); - -@@ -481,7 +474,7 @@ static inline bool hrtimer_is_queued(struct hrtimer *timer) - * Helper function to check, whether the timer is running the callback - * function - */ --static inline int hrtimer_callback_running(const struct hrtimer *timer) -+static inline int hrtimer_callback_running(struct hrtimer *timer) - { - return timer->base->running == timer; - } -diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h -index 0571b498db73..3e6c91bdf2ef 100644 ---- a/include/linux/posix-timers.h -+++ b/include/linux/posix-timers.h -@@ -15,6 +15,7 @@ struct cpu_timer_list { - u64 expires, incr; - struct task_struct *task; - int firing; -+ int firing_cpu; - }; - - /* -diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c -index f4c8cfde00b0..e7b983df6996 100644 ---- a/kernel/time/alarmtimer.c -+++ b/kernel/time/alarmtimer.c -@@ -438,7 +438,7 @@ int alarm_cancel(struct alarm *alarm) - int ret = alarm_try_to_cancel(alarm); - if (ret >= 0) - return ret; -- hrtimer_wait_for_timer(&alarm->timer); -+ hrtimer_grab_expiry_lock(&alarm->timer); - } - } - EXPORT_SYMBOL_GPL(alarm_cancel); -diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c -index aa8f3177580a..bbc408f24f5d 100644 ---- a/kernel/time/hrtimer.c -+++ b/kernel/time/hrtimer.c -@@ -981,33 +981,16 @@ u64 hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval) - } - EXPORT_SYMBOL_GPL(hrtimer_forward); - --#ifdef CONFIG_PREEMPT_RT_BASE --# define wake_up_timer_waiters(b) wake_up(&(b)->wait) -- --/** -- * hrtimer_wait_for_timer - Wait for a running timer -- * -- * @timer: timer to wait for -- * -- * The function waits in case the timers callback function is -- * currently executed on the waitqueue of the timer base. The -- * waitqueue is woken up after the timer callback function has -- * finished execution. -- */ --void hrtimer_wait_for_timer(const struct hrtimer *timer) -+void hrtimer_grab_expiry_lock(const struct hrtimer *timer) - { - struct hrtimer_clock_base *base = timer->base; - -- if (base && base->cpu_base && -- base->index >= HRTIMER_BASE_MONOTONIC_SOFT) -- wait_event(base->cpu_base->wait, -- !(hrtimer_callback_running(timer))); -+ if (base && base->cpu_base) { -+ spin_lock(&base->cpu_base->softirq_expiry_lock); -+ spin_unlock(&base->cpu_base->softirq_expiry_lock); -+ } - } - --#else --# define wake_up_timer_waiters(b) do { } while (0) --#endif -- - /* - * enqueue_hrtimer - internal function to (re)start a timer - * -@@ -1291,7 +1274,7 @@ int hrtimer_cancel(struct hrtimer *timer) - - if (ret >= 0) - return ret; -- hrtimer_wait_for_timer(timer); -+ hrtimer_grab_expiry_lock(timer); - } - } - EXPORT_SYMBOL_GPL(hrtimer_cancel); -@@ -1595,6 +1578,7 @@ static __latent_entropy void hrtimer_run_softirq(struct softirq_action *h) - unsigned long flags; - ktime_t now; - -+ spin_lock(&cpu_base->softirq_expiry_lock); - raw_spin_lock_irqsave(&cpu_base->lock, flags); - - now = hrtimer_update_base(cpu_base); -@@ -1604,7 +1588,7 @@ static __latent_entropy void hrtimer_run_softirq(struct softirq_action *h) - hrtimer_update_softirq_timer(cpu_base, true); - - raw_spin_unlock_irqrestore(&cpu_base->lock, flags); -- wake_up_timer_waiters(cpu_base); -+ spin_unlock(&cpu_base->softirq_expiry_lock); - } - - #ifdef CONFIG_HIGH_RES_TIMERS -@@ -2014,9 +1998,7 @@ int hrtimers_prepare_cpu(unsigned int cpu) - cpu_base->softirq_next_timer = NULL; - cpu_base->expires_next = KTIME_MAX; - cpu_base->softirq_expires_next = KTIME_MAX; --#ifdef CONFIG_PREEMPT_RT_BASE -- init_waitqueue_head(&cpu_base->wait); --#endif -+ spin_lock_init(&cpu_base->softirq_expiry_lock); - return 0; - } - -diff --git a/kernel/time/itimer.c b/kernel/time/itimer.c -index 7650ee736964..48d977f947d9 100644 ---- a/kernel/time/itimer.c -+++ b/kernel/time/itimer.c -@@ -211,7 +211,7 @@ int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue) - /* We are sharing ->siglock with it_real_fn() */ - if (hrtimer_try_to_cancel(timer) < 0) { - spin_unlock_irq(&tsk->sighand->siglock); -- hrtimer_wait_for_timer(&tsk->signal->real_timer); -+ hrtimer_grab_expiry_lock(timer); - goto again; - } - expires = timeval_to_ktime(value->it_value); -diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c -index 2d29b269dc83..54632ed51c65 100644 ---- a/kernel/time/posix-cpu-timers.c -+++ b/kernel/time/posix-cpu-timers.c -@@ -792,6 +792,7 @@ check_timers_list(struct list_head *timers, - return t->expires; - - t->firing = 1; -+ t->firing_cpu = smp_processor_id(); - list_move_tail(&t->entry, firing); - } - -@@ -1138,6 +1139,20 @@ static inline int fastpath_timer_check(struct task_struct *tsk) - return 0; - } - -+static DEFINE_PER_CPU(spinlock_t, cpu_timer_expiry_lock) = __SPIN_LOCK_UNLOCKED(cpu_timer_expiry_lock); -+ -+void cpu_timers_grab_expiry_lock(struct k_itimer *timer) -+{ -+ int cpu = timer->it.cpu.firing_cpu; -+ -+ if (cpu >= 0) { -+ spinlock_t *expiry_lock = per_cpu_ptr(&cpu_timer_expiry_lock, cpu); -+ -+ spin_lock_irq(expiry_lock); -+ spin_unlock_irq(expiry_lock); -+ } -+} -+ - /* - * This is called from the timer interrupt handler. The irq handler has - * already updated our counts. We need to check if any timers fire now. -@@ -1148,6 +1163,7 @@ static void __run_posix_cpu_timers(struct task_struct *tsk) - LIST_HEAD(firing); - struct k_itimer *timer, *next; - unsigned long flags; -+ spinlock_t *expiry_lock; - - /* - * The fast path checks that there are no expired thread or thread -@@ -1156,6 +1172,9 @@ static void __run_posix_cpu_timers(struct task_struct *tsk) - if (!fastpath_timer_check(tsk)) - return; - -+ expiry_lock = this_cpu_ptr(&cpu_timer_expiry_lock); -+ spin_lock(expiry_lock); -+ - if (!lock_task_sighand(tsk, &flags)) - return; - /* -@@ -1190,6 +1209,7 @@ static void __run_posix_cpu_timers(struct task_struct *tsk) - list_del_init(&timer->it.cpu.entry); - cpu_firing = timer->it.cpu.firing; - timer->it.cpu.firing = 0; -+ timer->it.cpu.firing_cpu = -1; - /* - * The firing flag is -1 if we collided with a reset - * of the timer, which already reported this -@@ -1199,6 +1219,7 @@ static void __run_posix_cpu_timers(struct task_struct *tsk) - cpu_timer_fire(timer); - spin_unlock(&timer->it_lock); - } -+ spin_unlock(expiry_lock); - } - - #ifdef CONFIG_PREEMPT_RT_BASE -@@ -1466,6 +1487,8 @@ static int do_cpu_nanosleep(const clockid_t which_clock, int flags, - spin_unlock_irq(&timer.it_lock); - - while (error == TIMER_RETRY) { -+ -+ cpu_timers_grab_expiry_lock(&timer); - /* - * We need to handle case when timer was or is in the - * middle of firing. In other cases we already freed -diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c -index 2cf5aa704106..3fd433d2a767 100644 ---- a/kernel/time/posix-timers.c -+++ b/kernel/time/posix-timers.c -@@ -821,25 +821,20 @@ static void common_hrtimer_arm(struct k_itimer *timr, ktime_t expires, - hrtimer_start_expires(timer, HRTIMER_MODE_ABS); - } - --/* -- * Protected by RCU! -- */ --static void timer_wait_for_callback(const struct k_clock *kc, struct k_itimer *timr) -+static int common_hrtimer_try_to_cancel(struct k_itimer *timr) - { --#ifdef CONFIG_PREEMPT_RT_FULL -- if (kc->timer_arm == common_hrtimer_arm) -- hrtimer_wait_for_timer(&timr->it.real.timer); -- else if (kc == &alarm_clock) -- hrtimer_wait_for_timer(&timr->it.alarm.alarmtimer.timer); -- else -- /* FIXME: Whacky hack for posix-cpu-timers */ -- schedule_timeout(1); --#endif -+ return hrtimer_try_to_cancel(&timr->it.real.timer); - } - --static int common_hrtimer_try_to_cancel(struct k_itimer *timr) -+static void timer_wait_for_callback(const struct k_clock *kc, struct k_itimer *timer) - { -- return hrtimer_try_to_cancel(&timr->it.real.timer); -+ if (kc->timer_arm == common_hrtimer_arm) -+ hrtimer_grab_expiry_lock(&timer->it.real.timer); -+ else if (kc == &alarm_clock) -+ hrtimer_grab_expiry_lock(&timer->it.alarm.alarmtimer.timer); -+ else -+ /* posix-cpu-timers */ -+ cpu_timers_grab_expiry_lock(timer); - } - - /* Set a POSIX.1b interval timer. */ -@@ -901,21 +896,21 @@ static int do_timer_settime(timer_t timer_id, int flags, - if (!timr) - return -EINVAL; - -- rcu_read_lock(); - kc = timr->kclock; - if (WARN_ON_ONCE(!kc || !kc->timer_set)) - error = -EINVAL; - else - error = kc->timer_set(timr, flags, new_spec64, old_spec64); - -- unlock_timer(timr, flag); - if (error == TIMER_RETRY) { -+ rcu_read_lock(); -+ unlock_timer(timr, flag); - timer_wait_for_callback(kc, timr); -- old_spec64 = NULL; // We already got the old time... - rcu_read_unlock(); -+ old_spec64 = NULL; // We already got the old time... - goto retry; - } -- rcu_read_unlock(); -+ unlock_timer(timr, flag); - - return error; - } -@@ -977,13 +972,21 @@ int common_timer_del(struct k_itimer *timer) - return 0; - } - --static inline int timer_delete_hook(struct k_itimer *timer) -+static int timer_delete_hook(struct k_itimer *timer) - { - const struct k_clock *kc = timer->kclock; -+ int ret; - - if (WARN_ON_ONCE(!kc || !kc->timer_del)) - return -EINVAL; -- return kc->timer_del(timer); -+ ret = kc->timer_del(timer); -+ if (ret == TIMER_RETRY) { -+ rcu_read_lock(); -+ spin_unlock_irq(&timer->it_lock); -+ timer_wait_for_callback(kc, timer); -+ rcu_read_unlock(); -+ } -+ return ret; - } - - /* Delete a POSIX.1b interval timer. */ -@@ -997,15 +1000,8 @@ SYSCALL_DEFINE1(timer_delete, timer_t, timer_id) - if (!timer) - return -EINVAL; - -- rcu_read_lock(); -- if (timer_delete_hook(timer) == TIMER_RETRY) { -- unlock_timer(timer, flags); -- timer_wait_for_callback(clockid_to_kclock(timer->it_clock), -- timer); -- rcu_read_unlock(); -+ if (timer_delete_hook(timer) == TIMER_RETRY) - goto retry_delete; -- } -- rcu_read_unlock(); - - spin_lock(¤t->sighand->siglock); - list_del(&timer->list); -@@ -1031,20 +1027,9 @@ static void itimer_delete(struct k_itimer *timer) - retry_delete: - spin_lock_irqsave(&timer->it_lock, flags); - -- /* On RT we can race with a deletion */ -- if (!timer->it_signal) { -- unlock_timer(timer, flags); -- return; -- } -- -- if (timer_delete_hook(timer) == TIMER_RETRY) { -- rcu_read_lock(); -- unlock_timer(timer, flags); -- timer_wait_for_callback(clockid_to_kclock(timer->it_clock), -- timer); -- rcu_read_unlock(); -+ if (timer_delete_hook(timer) == TIMER_RETRY) - goto retry_delete; -- } -+ - list_del(&timer->list); - /* - * This keeps any tasks waiting on the spin lock from thinking -diff --git a/kernel/time/posix-timers.h b/kernel/time/posix-timers.h -index ddb21145211a..725bd230a8db 100644 ---- a/kernel/time/posix-timers.h -+++ b/kernel/time/posix-timers.h -@@ -32,6 +32,8 @@ extern const struct k_clock clock_process; - extern const struct k_clock clock_thread; - extern const struct k_clock alarm_clock; - -+extern void cpu_timers_grab_expiry_lock(struct k_itimer *timer); -+ - int posix_timer_event(struct k_itimer *timr, int si_private); - - void common_timer_get(struct k_itimer *timr, struct itimerspec64 *cur_setting); -diff --git a/kernel/time/timer.c b/kernel/time/timer.c -index c7bd68db6f63..a2be2277506d 100644 ---- a/kernel/time/timer.c -+++ b/kernel/time/timer.c -@@ -45,7 +45,6 @@ - #include - #include - #include --#include - - #include - #include -@@ -199,9 +198,7 @@ EXPORT_SYMBOL(jiffies_64); - struct timer_base { - raw_spinlock_t lock; - struct timer_list *running_timer; --#ifdef CONFIG_PREEMPT_RT_FULL -- struct swait_queue_head wait_for_running_timer; --#endif -+ spinlock_t expiry_lock; - unsigned long clk; - unsigned long next_expiry; - unsigned int cpu; -@@ -1201,33 +1198,6 @@ void add_timer_on(struct timer_list *timer, int cpu) - } - EXPORT_SYMBOL_GPL(add_timer_on); - --#ifdef CONFIG_PREEMPT_RT_FULL --/* -- * Wait for a running timer -- */ --static void wait_for_running_timer(struct timer_list *timer) --{ -- struct timer_base *base; -- u32 tf = timer->flags; -- -- if (tf & TIMER_MIGRATING) -- return; -- -- base = get_timer_base(tf); -- swait_event_exclusive(base->wait_for_running_timer, -- base->running_timer != timer); --} -- --# define wakeup_timer_waiters(b) swake_up_all(&(b)->wait_for_running_timer) --#else --static inline void wait_for_running_timer(struct timer_list *timer) --{ -- cpu_relax(); --} -- --# define wakeup_timer_waiters(b) do { } while (0) --#endif -- - /** - * del_timer - deactivate a timer. - * @timer: the timer to be deactivated -@@ -1257,14 +1227,8 @@ int del_timer(struct timer_list *timer) - } - EXPORT_SYMBOL(del_timer); - --/** -- * try_to_del_timer_sync - Try to deactivate a timer -- * @timer: timer to delete -- * -- * This function tries to deactivate a timer. Upon successful (ret >= 0) -- * exit the timer is not queued and the handler is not running on any CPU. -- */ --int try_to_del_timer_sync(struct timer_list *timer) -+static int __try_to_del_timer_sync(struct timer_list *timer, -+ struct timer_base **basep) - { - struct timer_base *base; - unsigned long flags; -@@ -1272,7 +1236,7 @@ int try_to_del_timer_sync(struct timer_list *timer) - - debug_assert_init(timer); - -- base = lock_timer_base(timer, &flags); -+ *basep = base = lock_timer_base(timer, &flags); - - if (base->running_timer != timer) - ret = detach_if_pending(timer, base, true); -@@ -1281,9 +1245,42 @@ int try_to_del_timer_sync(struct timer_list *timer) - - return ret; - } -+ -+/** -+ * try_to_del_timer_sync - Try to deactivate a timer -+ * @timer: timer to delete -+ * -+ * This function tries to deactivate a timer. Upon successful (ret >= 0) -+ * exit the timer is not queued and the handler is not running on any CPU. -+ */ -+int try_to_del_timer_sync(struct timer_list *timer) -+{ -+ struct timer_base *base; -+ -+ return __try_to_del_timer_sync(timer, &base); -+} - EXPORT_SYMBOL(try_to_del_timer_sync); - - #if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT_FULL) -+static int __del_timer_sync(struct timer_list *timer) -+{ -+ struct timer_base *base; -+ int ret; -+ -+ for (;;) { -+ ret = __try_to_del_timer_sync(timer, &base); -+ if (ret >= 0) -+ return ret; -+ -+ /* -+ * When accessing the lock, timers of base are no longer expired -+ * and so timer is no longer running. -+ */ -+ spin_lock(&base->expiry_lock); -+ spin_unlock(&base->expiry_lock); -+ } -+} -+ - /** - * del_timer_sync - deactivate a timer and wait for the handler to finish. - * @timer: the timer to be deactivated -@@ -1339,12 +1336,8 @@ int del_timer_sync(struct timer_list *timer) - * could lead to deadlock. - */ - WARN_ON(in_irq() && !(timer->flags & TIMER_IRQSAFE)); -- for (;;) { -- int ret = try_to_del_timer_sync(timer); -- if (ret >= 0) -- return ret; -- wait_for_running_timer(timer); -- } -+ -+ return __del_timer_sync(timer); - } - EXPORT_SYMBOL(del_timer_sync); - #endif -@@ -1409,11 +1402,15 @@ static void expire_timers(struct timer_base *base, struct hlist_head *head) - raw_spin_unlock(&base->lock); - call_timer_fn(timer, fn); - base->running_timer = NULL; -+ spin_unlock(&base->expiry_lock); -+ spin_lock(&base->expiry_lock); - raw_spin_lock(&base->lock); - } else { - raw_spin_unlock_irq(&base->lock); - call_timer_fn(timer, fn); - base->running_timer = NULL; -+ spin_unlock(&base->expiry_lock); -+ spin_lock(&base->expiry_lock); - raw_spin_lock_irq(&base->lock); - } - } -@@ -1710,6 +1707,7 @@ static inline void __run_timers(struct timer_base *base) - if (!time_after_eq(jiffies, base->clk)) - return; - -+ spin_lock(&base->expiry_lock); - raw_spin_lock_irq(&base->lock); - - /* -@@ -1737,7 +1735,7 @@ static inline void __run_timers(struct timer_base *base) - expire_timers(base, heads + levels); - } - raw_spin_unlock_irq(&base->lock); -- wakeup_timer_waiters(base); -+ spin_unlock(&base->expiry_lock); - } - - /* -@@ -1984,9 +1982,7 @@ static void __init init_timer_cpu(int cpu) - base->cpu = cpu; - raw_spin_lock_init(&base->lock); - base->clk = jiffies; --#ifdef CONFIG_PREEMPT_RT_FULL -- init_swait_queue_head(&base->wait_for_running_timer); --#endif -+ spin_lock_init(&base->expiry_lock); - } - } - --- -2.36.1 - diff --git a/debian/patches-rt/0272-Revert-futex-Ensure-lock-unlock-symetry-versus-pi_lo.patch b/debian/patches-rt/0272-Revert-futex-Ensure-lock-unlock-symetry-versus-pi_lo.patch deleted file mode 100644 index 82f8bb5db..000000000 --- a/debian/patches-rt/0272-Revert-futex-Ensure-lock-unlock-symetry-versus-pi_lo.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 32f4aadb8254fd22b687cf1631c4859a2bf1b6bc Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Wed, 26 Jun 2019 17:44:13 +0200 -Subject: [PATCH 272/347] Revert "futex: Ensure lock/unlock symetry versus - pi_lock and hash bucket lock" -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 6a773b70cf105b46298ed3b44e77c102ce31d9ec ] - -Drop the RT fixup, the futex code will be changed to avoid the need for -the workaround. - -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - kernel/futex.c | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/kernel/futex.c b/kernel/futex.c -index a5a263a3efbf..3449a716a378 100644 ---- a/kernel/futex.c -+++ b/kernel/futex.c -@@ -962,9 +962,7 @@ static void exit_pi_state_list(struct task_struct *curr) - if (head->next != next) { - /* retain curr->pi_lock for the loop invariant */ - raw_spin_unlock(&pi_state->pi_mutex.wait_lock); -- raw_spin_unlock_irq(&curr->pi_lock); - spin_unlock(&hb->lock); -- raw_spin_lock_irq(&curr->pi_lock); - put_pi_state(pi_state); - continue; - } --- -2.36.1 - diff --git a/debian/patches-rt/0272-Revert-futex-Fix-bug-on-when-a-requeued-RT-task-time.patch b/debian/patches-rt/0272-Revert-futex-Fix-bug-on-when-a-requeued-RT-task-time.patch new file mode 100644 index 000000000..d622e9bf3 --- /dev/null +++ b/debian/patches-rt/0272-Revert-futex-Fix-bug-on-when-a-requeued-RT-task-time.patch @@ -0,0 +1,79 @@ +From: Sebastian Andrzej Siewior +Date: Wed, 26 Jun 2019 17:44:18 +0200 +Subject: [PATCH 272/342] Revert "futex: Fix bug on when a requeued RT task + times out" +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=424bdc4ecbdf891bb9781c66827c6552d45ec9c3 + +[ Upstream commit f1a170cb3289a48df26cae3c60d77608f7a988bb ] + +Drop the RT fixup, the futex code will be changed to avoid the need for +the workaround. + +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + kernel/locking/rtmutex.c | 31 +------------------------------ + kernel/locking/rtmutex_common.h | 1 - + 2 files changed, 1 insertion(+), 31 deletions(-) + +diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c +index ded2296f848a..a87b65447991 100644 +--- a/kernel/locking/rtmutex.c ++++ b/kernel/locking/rtmutex.c +@@ -144,8 +144,7 @@ static void fixup_rt_mutex_waiters(struct rt_mutex *lock) + + static int rt_mutex_real_waiter(struct rt_mutex_waiter *waiter) + { +- return waiter && waiter != PI_WAKEUP_INPROGRESS && +- waiter != PI_REQUEUE_INPROGRESS; ++ return waiter && waiter != PI_WAKEUP_INPROGRESS; + } + + /* +@@ -2349,34 +2348,6 @@ int __rt_mutex_start_proxy_lock(struct rt_mutex *lock, + if (try_to_take_rt_mutex(lock, task, NULL)) + return 1; + +-#ifdef CONFIG_PREEMPT_RT_FULL +- /* +- * In PREEMPT_RT there's an added race. +- * If the task, that we are about to requeue, times out, +- * it can set the PI_WAKEUP_INPROGRESS. This tells the requeue +- * to skip this task. But right after the task sets +- * its pi_blocked_on to PI_WAKEUP_INPROGRESS it can then +- * block on the spin_lock(&hb->lock), which in RT is an rtmutex. +- * This will replace the PI_WAKEUP_INPROGRESS with the actual +- * lock that it blocks on. We *must not* place this task +- * on this proxy lock in that case. +- * +- * To prevent this race, we first take the task's pi_lock +- * and check if it has updated its pi_blocked_on. If it has, +- * we assume that it woke up and we return -EAGAIN. +- * Otherwise, we set the task's pi_blocked_on to +- * PI_REQUEUE_INPROGRESS, so that if the task is waking up +- * it will know that we are in the process of requeuing it. +- */ +- raw_spin_lock(&task->pi_lock); +- if (task->pi_blocked_on) { +- raw_spin_unlock(&task->pi_lock); +- return -EAGAIN; +- } +- task->pi_blocked_on = PI_REQUEUE_INPROGRESS; +- raw_spin_unlock(&task->pi_lock); +-#endif +- + /* We enforce deadlock detection for futexes */ + ret = task_blocks_on_rt_mutex(lock, waiter, task, + RT_MUTEX_FULL_CHAINWALK); +diff --git a/kernel/locking/rtmutex_common.h b/kernel/locking/rtmutex_common.h +index 8e0c592273e6..627340e7427e 100644 +--- a/kernel/locking/rtmutex_common.h ++++ b/kernel/locking/rtmutex_common.h +@@ -133,7 +133,6 @@ enum rtmutex_chainwalk { + * PI-futex support (proxy locking functions, etc.): + */ + #define PI_WAKEUP_INPROGRESS ((struct rt_mutex_waiter *) 1) +-#define PI_REQUEUE_INPROGRESS ((struct rt_mutex_waiter *) 2) + + extern struct task_struct *rt_mutex_next_owner(struct rt_mutex *lock); + extern void rt_mutex_init_proxy_locked(struct rt_mutex *lock, diff --git a/debian/patches-rt/0273-Revert-futex-Fix-bug-on-when-a-requeued-RT-task-time.patch b/debian/patches-rt/0273-Revert-futex-Fix-bug-on-when-a-requeued-RT-task-time.patch deleted file mode 100644 index 8b7b98e81..000000000 --- a/debian/patches-rt/0273-Revert-futex-Fix-bug-on-when-a-requeued-RT-task-time.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 808788c03b3c849951c646819ad23ff2efaf78a9 Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Wed, 26 Jun 2019 17:44:18 +0200 -Subject: [PATCH 273/347] Revert "futex: Fix bug on when a requeued RT task - times out" -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit f1a170cb3289a48df26cae3c60d77608f7a988bb ] - -Drop the RT fixup, the futex code will be changed to avoid the need for -the workaround. - -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - kernel/locking/rtmutex.c | 31 +------------------------------ - kernel/locking/rtmutex_common.h | 1 - - 2 files changed, 1 insertion(+), 31 deletions(-) - -diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c -index ded2296f848a..a87b65447991 100644 ---- a/kernel/locking/rtmutex.c -+++ b/kernel/locking/rtmutex.c -@@ -144,8 +144,7 @@ static void fixup_rt_mutex_waiters(struct rt_mutex *lock) - - static int rt_mutex_real_waiter(struct rt_mutex_waiter *waiter) - { -- return waiter && waiter != PI_WAKEUP_INPROGRESS && -- waiter != PI_REQUEUE_INPROGRESS; -+ return waiter && waiter != PI_WAKEUP_INPROGRESS; - } - - /* -@@ -2349,34 +2348,6 @@ int __rt_mutex_start_proxy_lock(struct rt_mutex *lock, - if (try_to_take_rt_mutex(lock, task, NULL)) - return 1; - --#ifdef CONFIG_PREEMPT_RT_FULL -- /* -- * In PREEMPT_RT there's an added race. -- * If the task, that we are about to requeue, times out, -- * it can set the PI_WAKEUP_INPROGRESS. This tells the requeue -- * to skip this task. But right after the task sets -- * its pi_blocked_on to PI_WAKEUP_INPROGRESS it can then -- * block on the spin_lock(&hb->lock), which in RT is an rtmutex. -- * This will replace the PI_WAKEUP_INPROGRESS with the actual -- * lock that it blocks on. We *must not* place this task -- * on this proxy lock in that case. -- * -- * To prevent this race, we first take the task's pi_lock -- * and check if it has updated its pi_blocked_on. If it has, -- * we assume that it woke up and we return -EAGAIN. -- * Otherwise, we set the task's pi_blocked_on to -- * PI_REQUEUE_INPROGRESS, so that if the task is waking up -- * it will know that we are in the process of requeuing it. -- */ -- raw_spin_lock(&task->pi_lock); -- if (task->pi_blocked_on) { -- raw_spin_unlock(&task->pi_lock); -- return -EAGAIN; -- } -- task->pi_blocked_on = PI_REQUEUE_INPROGRESS; -- raw_spin_unlock(&task->pi_lock); --#endif -- - /* We enforce deadlock detection for futexes */ - ret = task_blocks_on_rt_mutex(lock, waiter, task, - RT_MUTEX_FULL_CHAINWALK); -diff --git a/kernel/locking/rtmutex_common.h b/kernel/locking/rtmutex_common.h -index 8e0c592273e6..627340e7427e 100644 ---- a/kernel/locking/rtmutex_common.h -+++ b/kernel/locking/rtmutex_common.h -@@ -133,7 +133,6 @@ enum rtmutex_chainwalk { - * PI-futex support (proxy locking functions, etc.): - */ - #define PI_WAKEUP_INPROGRESS ((struct rt_mutex_waiter *) 1) --#define PI_REQUEUE_INPROGRESS ((struct rt_mutex_waiter *) 2) - - extern struct task_struct *rt_mutex_next_owner(struct rt_mutex *lock); - extern void rt_mutex_init_proxy_locked(struct rt_mutex *lock, --- -2.36.1 - diff --git a/debian/patches-rt/0273-Revert-rtmutex-Handle-the-various-new-futex-race-con.patch b/debian/patches-rt/0273-Revert-rtmutex-Handle-the-various-new-futex-race-con.patch new file mode 100644 index 000000000..391c7c48c --- /dev/null +++ b/debian/patches-rt/0273-Revert-rtmutex-Handle-the-various-new-futex-race-con.patch @@ -0,0 +1,245 @@ +From: Sebastian Andrzej Siewior +Date: Wed, 26 Jun 2019 17:44:21 +0200 +Subject: [PATCH 273/342] Revert "rtmutex: Handle the various new futex race + conditions" +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=3cc6426a21b537ce05a7acb6a499a205559ae766 + +[ Upstream commit 9e0265c21af4d6388d47dcd5ce20f76ec3a2e468 ] + +Drop the RT fixup, the futex code will be changed to avoid the need for +the workaround. + +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + kernel/futex.c | 75 ++++++--------------------------- + kernel/locking/rtmutex.c | 36 +++------------- + kernel/locking/rtmutex_common.h | 2 - + 3 files changed, 20 insertions(+), 93 deletions(-) + +diff --git a/kernel/futex.c b/kernel/futex.c +index 3449a716a378..bcd01b5a47df 100644 +--- a/kernel/futex.c ++++ b/kernel/futex.c +@@ -2255,16 +2255,6 @@ static int futex_requeue(u32 __user *uaddr1, unsigned int flags, + requeue_pi_wake_futex(this, &key2, hb2); + drop_count++; + continue; +- } else if (ret == -EAGAIN) { +- /* +- * Waiter was woken by timeout or +- * signal and has set pi_blocked_on to +- * PI_WAKEUP_INPROGRESS before we +- * tried to enqueue it on the rtmutex. +- */ +- this->pi_state = NULL; +- put_pi_state(pi_state); +- continue; + } else if (ret) { + /* + * rt_mutex_start_proxy_lock() detected a +@@ -3343,7 +3333,7 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, + { + struct hrtimer_sleeper timeout, *to = NULL; + struct rt_mutex_waiter rt_waiter; +- struct futex_hash_bucket *hb, *hb2; ++ struct futex_hash_bucket *hb; + union futex_key key2 = FUTEX_KEY_INIT; + struct futex_q q = futex_q_init; + int res, ret; +@@ -3401,55 +3391,20 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, + /* Queue the futex_q, drop the hb lock, wait for wakeup. */ + futex_wait_queue_me(hb, &q, to); + +- /* +- * On RT we must avoid races with requeue and trying to block +- * on two mutexes (hb->lock and uaddr2's rtmutex) by +- * serializing access to pi_blocked_on with pi_lock. +- */ +- raw_spin_lock_irq(¤t->pi_lock); +- if (current->pi_blocked_on) { +- /* +- * We have been requeued or are in the process of +- * being requeued. +- */ +- raw_spin_unlock_irq(¤t->pi_lock); +- } else { +- /* +- * Setting pi_blocked_on to PI_WAKEUP_INPROGRESS +- * prevents a concurrent requeue from moving us to the +- * uaddr2 rtmutex. After that we can safely acquire +- * (and possibly block on) hb->lock. +- */ +- current->pi_blocked_on = PI_WAKEUP_INPROGRESS; +- raw_spin_unlock_irq(¤t->pi_lock); +- +- spin_lock(&hb->lock); +- +- /* +- * Clean up pi_blocked_on. We might leak it otherwise +- * when we succeeded with the hb->lock in the fast +- * path. +- */ +- raw_spin_lock_irq(¤t->pi_lock); +- current->pi_blocked_on = NULL; +- raw_spin_unlock_irq(¤t->pi_lock); +- +- ret = handle_early_requeue_pi_wakeup(hb, &q, &key2, to); +- spin_unlock(&hb->lock); +- if (ret) +- goto out_put_keys; +- } ++ spin_lock(&hb->lock); ++ ret = handle_early_requeue_pi_wakeup(hb, &q, &key2, to); ++ spin_unlock(&hb->lock); ++ if (ret) ++ goto out_put_keys; + + /* +- * In order to be here, we have either been requeued, are in +- * the process of being requeued, or requeue successfully +- * acquired uaddr2 on our behalf. If pi_blocked_on was +- * non-null above, we may be racing with a requeue. Do not +- * rely on q->lock_ptr to be hb2->lock until after blocking on +- * hb->lock or hb2->lock. The futex_requeue dropped our key1 +- * reference and incremented our key2 reference count. ++ * In order for us to be here, we know our q.key == key2, and since ++ * we took the hb->lock above, we also know that futex_requeue() has ++ * completed and we no longer have to concern ourselves with a wakeup ++ * race with the atomic proxy lock acquisition by the requeue code. The ++ * futex_requeue dropped our key1 reference and incremented our key2 ++ * reference count. + */ +- hb2 = hash_futex(&key2); + + /* Check if the requeue code acquired the second futex for us. */ + if (!q.rt_waiter) { +@@ -3458,8 +3413,7 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, + * did a lock-steal - fix up the PI-state in that case. + */ + if (q.pi_state && (q.pi_state->owner != current)) { +- spin_lock(&hb2->lock); +- BUG_ON(&hb2->lock != q.lock_ptr); ++ spin_lock(q.lock_ptr); + ret = fixup_pi_state_owner(uaddr2, &q, current); + /* + * Drop the reference to the pi state which +@@ -3485,8 +3439,7 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, + pi_mutex = &q.pi_state->pi_mutex; + ret = rt_mutex_wait_proxy_lock(pi_mutex, to, &rt_waiter); + +- spin_lock(&hb2->lock); +- BUG_ON(&hb2->lock != q.lock_ptr); ++ spin_lock(q.lock_ptr); + if (ret && !rt_mutex_cleanup_proxy_lock(pi_mutex, &rt_waiter)) + ret = 0; + +diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c +index a87b65447991..05fcf8a75a51 100644 +--- a/kernel/locking/rtmutex.c ++++ b/kernel/locking/rtmutex.c +@@ -142,11 +142,6 @@ static void fixup_rt_mutex_waiters(struct rt_mutex *lock) + WRITE_ONCE(*p, owner & ~RT_MUTEX_HAS_WAITERS); + } + +-static int rt_mutex_real_waiter(struct rt_mutex_waiter *waiter) +-{ +- return waiter && waiter != PI_WAKEUP_INPROGRESS; +-} +- + /* + * We can speed up the acquire/release, if there's no debugging state to be + * set up. +@@ -420,8 +415,7 @@ int max_lock_depth = 1024; + + static inline struct rt_mutex *task_blocked_on_lock(struct task_struct *p) + { +- return rt_mutex_real_waiter(p->pi_blocked_on) ? +- p->pi_blocked_on->lock : NULL; ++ return p->pi_blocked_on ? p->pi_blocked_on->lock : NULL; + } + + /* +@@ -557,7 +551,7 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task, + * reached or the state of the chain has changed while we + * dropped the locks. + */ +- if (!rt_mutex_real_waiter(waiter)) ++ if (!waiter) + goto out_unlock_pi; + + /* +@@ -1327,22 +1321,6 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock, + return -EDEADLK; + + raw_spin_lock(&task->pi_lock); +- /* +- * In the case of futex requeue PI, this will be a proxy +- * lock. The task will wake unaware that it is enqueueed on +- * this lock. Avoid blocking on two locks and corrupting +- * pi_blocked_on via the PI_WAKEUP_INPROGRESS +- * flag. futex_wait_requeue_pi() sets this when it wakes up +- * before requeue (due to a signal or timeout). Do not enqueue +- * the task if PI_WAKEUP_INPROGRESS is set. +- */ +- if (task != current && task->pi_blocked_on == PI_WAKEUP_INPROGRESS) { +- raw_spin_unlock(&task->pi_lock); +- return -EAGAIN; +- } +- +- BUG_ON(rt_mutex_real_waiter(task->pi_blocked_on)); +- + waiter->task = task; + waiter->lock = lock; + waiter->prio = task->prio; +@@ -1366,7 +1344,7 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock, + rt_mutex_enqueue_pi(owner, waiter); + + rt_mutex_adjust_prio(owner); +- if (rt_mutex_real_waiter(owner->pi_blocked_on)) ++ if (owner->pi_blocked_on) + chain_walk = 1; + } else if (rt_mutex_cond_detect_deadlock(waiter, chwalk)) { + chain_walk = 1; +@@ -1466,7 +1444,7 @@ static void remove_waiter(struct rt_mutex *lock, + { + bool is_top_waiter = (waiter == rt_mutex_top_waiter(lock)); + struct task_struct *owner = rt_mutex_owner(lock); +- struct rt_mutex *next_lock = NULL; ++ struct rt_mutex *next_lock; + + lockdep_assert_held(&lock->wait_lock); + +@@ -1492,8 +1470,7 @@ static void remove_waiter(struct rt_mutex *lock, + rt_mutex_adjust_prio(owner); + + /* Store the lock on which owner is blocked or NULL */ +- if (rt_mutex_real_waiter(owner->pi_blocked_on)) +- next_lock = task_blocked_on_lock(owner); ++ next_lock = task_blocked_on_lock(owner); + + raw_spin_unlock(&owner->pi_lock); + +@@ -1529,8 +1506,7 @@ void rt_mutex_adjust_pi(struct task_struct *task) + raw_spin_lock_irqsave(&task->pi_lock, flags); + + waiter = task->pi_blocked_on; +- if (!rt_mutex_real_waiter(waiter) || +- rt_mutex_waiter_equal(waiter, task_to_waiter(task))) { ++ if (!waiter || rt_mutex_waiter_equal(waiter, task_to_waiter(task))) { + raw_spin_unlock_irqrestore(&task->pi_lock, flags); + return; + } +diff --git a/kernel/locking/rtmutex_common.h b/kernel/locking/rtmutex_common.h +index 627340e7427e..f587e0422d23 100644 +--- a/kernel/locking/rtmutex_common.h ++++ b/kernel/locking/rtmutex_common.h +@@ -132,8 +132,6 @@ enum rtmutex_chainwalk { + /* + * PI-futex support (proxy locking functions, etc.): + */ +-#define PI_WAKEUP_INPROGRESS ((struct rt_mutex_waiter *) 1) +- + extern struct task_struct *rt_mutex_next_owner(struct rt_mutex *lock); + extern void rt_mutex_init_proxy_locked(struct rt_mutex *lock, + struct task_struct *proxy_owner); diff --git a/debian/patches-rt/0274-Revert-futex-workaround-migrate_disable-enable-in-di.patch b/debian/patches-rt/0274-Revert-futex-workaround-migrate_disable-enable-in-di.patch new file mode 100644 index 000000000..b2f940fe5 --- /dev/null +++ b/debian/patches-rt/0274-Revert-futex-workaround-migrate_disable-enable-in-di.patch @@ -0,0 +1,66 @@ +From: Sebastian Andrzej Siewior +Date: Wed, 26 Jun 2019 17:44:27 +0200 +Subject: [PATCH 274/342] Revert "futex: workaround migrate_disable/enable in + different context" +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=188a1d1aaac5e0288814560fad22b3c638bad3bd + +[ Upstream commit a71221d81cc4873891ae44f3aa02df596079b786 ] + +Drop the RT fixup, the futex code will be changed to avoid the need for +the workaround. + +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + kernel/futex.c | 19 ------------------- + 1 file changed, 19 deletions(-) + +diff --git a/kernel/futex.c b/kernel/futex.c +index bcd01b5a47df..9bcfdcffb2dd 100644 +--- a/kernel/futex.c ++++ b/kernel/futex.c +@@ -2998,14 +2998,6 @@ static int futex_lock_pi(u32 __user *uaddr, unsigned int flags, + * before __rt_mutex_start_proxy_lock() is done. + */ + raw_spin_lock_irq(&q.pi_state->pi_mutex.wait_lock); +- /* +- * the migrate_disable() here disables migration in the in_atomic() fast +- * path which is enabled again in the following spin_unlock(). We have +- * one migrate_disable() pending in the slow-path which is reversed +- * after the raw_spin_unlock_irq() where we leave the atomic context. +- */ +- migrate_disable(); +- + spin_unlock(q.lock_ptr); + /* + * __rt_mutex_start_proxy_lock() unconditionally enqueues the @rt_waiter +@@ -3014,7 +3006,6 @@ static int futex_lock_pi(u32 __user *uaddr, unsigned int flags, + */ + ret = __rt_mutex_start_proxy_lock(&q.pi_state->pi_mutex, &rt_waiter, current); + raw_spin_unlock_irq(&q.pi_state->pi_mutex.wait_lock); +- migrate_enable(); + + if (ret) { + if (ret == 1) +@@ -3149,21 +3140,11 @@ static int futex_unlock_pi(u32 __user *uaddr, unsigned int flags) + * rt_waiter. Also see the WARN in wake_futex_pi(). + */ + raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock); +- /* +- * Magic trickery for now to make the RT migrate disable +- * logic happy. The following spin_unlock() happens with +- * interrupts disabled so the internal migrate_enable() +- * won't undo the migrate_disable() which was issued when +- * locking hb->lock. +- */ +- migrate_disable(); + spin_unlock(&hb->lock); + + /* drops pi_state->pi_mutex.wait_lock */ + ret = wake_futex_pi(uaddr, uval, pi_state); + +- migrate_enable(); +- + put_pi_state(pi_state); + + /* diff --git a/debian/patches-rt/0274-Revert-rtmutex-Handle-the-various-new-futex-race-con.patch b/debian/patches-rt/0274-Revert-rtmutex-Handle-the-various-new-futex-race-con.patch deleted file mode 100644 index f8fd52438..000000000 --- a/debian/patches-rt/0274-Revert-rtmutex-Handle-the-various-new-futex-race-con.patch +++ /dev/null @@ -1,249 +0,0 @@ -From 206aee0eb3ade56ba7f62d90334791f6808738dc Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Wed, 26 Jun 2019 17:44:21 +0200 -Subject: [PATCH 274/347] Revert "rtmutex: Handle the various new futex race - conditions" -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 9e0265c21af4d6388d47dcd5ce20f76ec3a2e468 ] - -Drop the RT fixup, the futex code will be changed to avoid the need for -the workaround. - -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - kernel/futex.c | 75 ++++++--------------------------- - kernel/locking/rtmutex.c | 36 +++------------- - kernel/locking/rtmutex_common.h | 2 - - 3 files changed, 20 insertions(+), 93 deletions(-) - -diff --git a/kernel/futex.c b/kernel/futex.c -index 3449a716a378..bcd01b5a47df 100644 ---- a/kernel/futex.c -+++ b/kernel/futex.c -@@ -2255,16 +2255,6 @@ static int futex_requeue(u32 __user *uaddr1, unsigned int flags, - requeue_pi_wake_futex(this, &key2, hb2); - drop_count++; - continue; -- } else if (ret == -EAGAIN) { -- /* -- * Waiter was woken by timeout or -- * signal and has set pi_blocked_on to -- * PI_WAKEUP_INPROGRESS before we -- * tried to enqueue it on the rtmutex. -- */ -- this->pi_state = NULL; -- put_pi_state(pi_state); -- continue; - } else if (ret) { - /* - * rt_mutex_start_proxy_lock() detected a -@@ -3343,7 +3333,7 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, - { - struct hrtimer_sleeper timeout, *to = NULL; - struct rt_mutex_waiter rt_waiter; -- struct futex_hash_bucket *hb, *hb2; -+ struct futex_hash_bucket *hb; - union futex_key key2 = FUTEX_KEY_INIT; - struct futex_q q = futex_q_init; - int res, ret; -@@ -3401,55 +3391,20 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, - /* Queue the futex_q, drop the hb lock, wait for wakeup. */ - futex_wait_queue_me(hb, &q, to); - -- /* -- * On RT we must avoid races with requeue and trying to block -- * on two mutexes (hb->lock and uaddr2's rtmutex) by -- * serializing access to pi_blocked_on with pi_lock. -- */ -- raw_spin_lock_irq(¤t->pi_lock); -- if (current->pi_blocked_on) { -- /* -- * We have been requeued or are in the process of -- * being requeued. -- */ -- raw_spin_unlock_irq(¤t->pi_lock); -- } else { -- /* -- * Setting pi_blocked_on to PI_WAKEUP_INPROGRESS -- * prevents a concurrent requeue from moving us to the -- * uaddr2 rtmutex. After that we can safely acquire -- * (and possibly block on) hb->lock. -- */ -- current->pi_blocked_on = PI_WAKEUP_INPROGRESS; -- raw_spin_unlock_irq(¤t->pi_lock); -- -- spin_lock(&hb->lock); -- -- /* -- * Clean up pi_blocked_on. We might leak it otherwise -- * when we succeeded with the hb->lock in the fast -- * path. -- */ -- raw_spin_lock_irq(¤t->pi_lock); -- current->pi_blocked_on = NULL; -- raw_spin_unlock_irq(¤t->pi_lock); -- -- ret = handle_early_requeue_pi_wakeup(hb, &q, &key2, to); -- spin_unlock(&hb->lock); -- if (ret) -- goto out_put_keys; -- } -+ spin_lock(&hb->lock); -+ ret = handle_early_requeue_pi_wakeup(hb, &q, &key2, to); -+ spin_unlock(&hb->lock); -+ if (ret) -+ goto out_put_keys; - - /* -- * In order to be here, we have either been requeued, are in -- * the process of being requeued, or requeue successfully -- * acquired uaddr2 on our behalf. If pi_blocked_on was -- * non-null above, we may be racing with a requeue. Do not -- * rely on q->lock_ptr to be hb2->lock until after blocking on -- * hb->lock or hb2->lock. The futex_requeue dropped our key1 -- * reference and incremented our key2 reference count. -+ * In order for us to be here, we know our q.key == key2, and since -+ * we took the hb->lock above, we also know that futex_requeue() has -+ * completed and we no longer have to concern ourselves with a wakeup -+ * race with the atomic proxy lock acquisition by the requeue code. The -+ * futex_requeue dropped our key1 reference and incremented our key2 -+ * reference count. - */ -- hb2 = hash_futex(&key2); - - /* Check if the requeue code acquired the second futex for us. */ - if (!q.rt_waiter) { -@@ -3458,8 +3413,7 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, - * did a lock-steal - fix up the PI-state in that case. - */ - if (q.pi_state && (q.pi_state->owner != current)) { -- spin_lock(&hb2->lock); -- BUG_ON(&hb2->lock != q.lock_ptr); -+ spin_lock(q.lock_ptr); - ret = fixup_pi_state_owner(uaddr2, &q, current); - /* - * Drop the reference to the pi state which -@@ -3485,8 +3439,7 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, - pi_mutex = &q.pi_state->pi_mutex; - ret = rt_mutex_wait_proxy_lock(pi_mutex, to, &rt_waiter); - -- spin_lock(&hb2->lock); -- BUG_ON(&hb2->lock != q.lock_ptr); -+ spin_lock(q.lock_ptr); - if (ret && !rt_mutex_cleanup_proxy_lock(pi_mutex, &rt_waiter)) - ret = 0; - -diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c -index a87b65447991..05fcf8a75a51 100644 ---- a/kernel/locking/rtmutex.c -+++ b/kernel/locking/rtmutex.c -@@ -142,11 +142,6 @@ static void fixup_rt_mutex_waiters(struct rt_mutex *lock) - WRITE_ONCE(*p, owner & ~RT_MUTEX_HAS_WAITERS); - } - --static int rt_mutex_real_waiter(struct rt_mutex_waiter *waiter) --{ -- return waiter && waiter != PI_WAKEUP_INPROGRESS; --} -- - /* - * We can speed up the acquire/release, if there's no debugging state to be - * set up. -@@ -420,8 +415,7 @@ int max_lock_depth = 1024; - - static inline struct rt_mutex *task_blocked_on_lock(struct task_struct *p) - { -- return rt_mutex_real_waiter(p->pi_blocked_on) ? -- p->pi_blocked_on->lock : NULL; -+ return p->pi_blocked_on ? p->pi_blocked_on->lock : NULL; - } - - /* -@@ -557,7 +551,7 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task, - * reached or the state of the chain has changed while we - * dropped the locks. - */ -- if (!rt_mutex_real_waiter(waiter)) -+ if (!waiter) - goto out_unlock_pi; - - /* -@@ -1327,22 +1321,6 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock, - return -EDEADLK; - - raw_spin_lock(&task->pi_lock); -- /* -- * In the case of futex requeue PI, this will be a proxy -- * lock. The task will wake unaware that it is enqueueed on -- * this lock. Avoid blocking on two locks and corrupting -- * pi_blocked_on via the PI_WAKEUP_INPROGRESS -- * flag. futex_wait_requeue_pi() sets this when it wakes up -- * before requeue (due to a signal or timeout). Do not enqueue -- * the task if PI_WAKEUP_INPROGRESS is set. -- */ -- if (task != current && task->pi_blocked_on == PI_WAKEUP_INPROGRESS) { -- raw_spin_unlock(&task->pi_lock); -- return -EAGAIN; -- } -- -- BUG_ON(rt_mutex_real_waiter(task->pi_blocked_on)); -- - waiter->task = task; - waiter->lock = lock; - waiter->prio = task->prio; -@@ -1366,7 +1344,7 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock, - rt_mutex_enqueue_pi(owner, waiter); - - rt_mutex_adjust_prio(owner); -- if (rt_mutex_real_waiter(owner->pi_blocked_on)) -+ if (owner->pi_blocked_on) - chain_walk = 1; - } else if (rt_mutex_cond_detect_deadlock(waiter, chwalk)) { - chain_walk = 1; -@@ -1466,7 +1444,7 @@ static void remove_waiter(struct rt_mutex *lock, - { - bool is_top_waiter = (waiter == rt_mutex_top_waiter(lock)); - struct task_struct *owner = rt_mutex_owner(lock); -- struct rt_mutex *next_lock = NULL; -+ struct rt_mutex *next_lock; - - lockdep_assert_held(&lock->wait_lock); - -@@ -1492,8 +1470,7 @@ static void remove_waiter(struct rt_mutex *lock, - rt_mutex_adjust_prio(owner); - - /* Store the lock on which owner is blocked or NULL */ -- if (rt_mutex_real_waiter(owner->pi_blocked_on)) -- next_lock = task_blocked_on_lock(owner); -+ next_lock = task_blocked_on_lock(owner); - - raw_spin_unlock(&owner->pi_lock); - -@@ -1529,8 +1506,7 @@ void rt_mutex_adjust_pi(struct task_struct *task) - raw_spin_lock_irqsave(&task->pi_lock, flags); - - waiter = task->pi_blocked_on; -- if (!rt_mutex_real_waiter(waiter) || -- rt_mutex_waiter_equal(waiter, task_to_waiter(task))) { -+ if (!waiter || rt_mutex_waiter_equal(waiter, task_to_waiter(task))) { - raw_spin_unlock_irqrestore(&task->pi_lock, flags); - return; - } -diff --git a/kernel/locking/rtmutex_common.h b/kernel/locking/rtmutex_common.h -index 627340e7427e..f587e0422d23 100644 ---- a/kernel/locking/rtmutex_common.h -+++ b/kernel/locking/rtmutex_common.h -@@ -132,8 +132,6 @@ enum rtmutex_chainwalk { - /* - * PI-futex support (proxy locking functions, etc.): - */ --#define PI_WAKEUP_INPROGRESS ((struct rt_mutex_waiter *) 1) -- - extern struct task_struct *rt_mutex_next_owner(struct rt_mutex *lock); - extern void rt_mutex_init_proxy_locked(struct rt_mutex *lock, - struct task_struct *proxy_owner); --- -2.36.1 - diff --git a/debian/patches-rt/0275-Revert-futex-workaround-migrate_disable-enable-in-di.patch b/debian/patches-rt/0275-Revert-futex-workaround-migrate_disable-enable-in-di.patch deleted file mode 100644 index 6d5ad8916..000000000 --- a/debian/patches-rt/0275-Revert-futex-workaround-migrate_disable-enable-in-di.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 42f821c624f6605415eed76cbf5ece8a41b47ddf Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Wed, 26 Jun 2019 17:44:27 +0200 -Subject: [PATCH 275/347] Revert "futex: workaround migrate_disable/enable in - different context" -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit a71221d81cc4873891ae44f3aa02df596079b786 ] - -Drop the RT fixup, the futex code will be changed to avoid the need for -the workaround. - -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - kernel/futex.c | 19 ------------------- - 1 file changed, 19 deletions(-) - -diff --git a/kernel/futex.c b/kernel/futex.c -index bcd01b5a47df..9bcfdcffb2dd 100644 ---- a/kernel/futex.c -+++ b/kernel/futex.c -@@ -2998,14 +2998,6 @@ static int futex_lock_pi(u32 __user *uaddr, unsigned int flags, - * before __rt_mutex_start_proxy_lock() is done. - */ - raw_spin_lock_irq(&q.pi_state->pi_mutex.wait_lock); -- /* -- * the migrate_disable() here disables migration in the in_atomic() fast -- * path which is enabled again in the following spin_unlock(). We have -- * one migrate_disable() pending in the slow-path which is reversed -- * after the raw_spin_unlock_irq() where we leave the atomic context. -- */ -- migrate_disable(); -- - spin_unlock(q.lock_ptr); - /* - * __rt_mutex_start_proxy_lock() unconditionally enqueues the @rt_waiter -@@ -3014,7 +3006,6 @@ static int futex_lock_pi(u32 __user *uaddr, unsigned int flags, - */ - ret = __rt_mutex_start_proxy_lock(&q.pi_state->pi_mutex, &rt_waiter, current); - raw_spin_unlock_irq(&q.pi_state->pi_mutex.wait_lock); -- migrate_enable(); - - if (ret) { - if (ret == 1) -@@ -3149,21 +3140,11 @@ static int futex_unlock_pi(u32 __user *uaddr, unsigned int flags) - * rt_waiter. Also see the WARN in wake_futex_pi(). - */ - raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock); -- /* -- * Magic trickery for now to make the RT migrate disable -- * logic happy. The following spin_unlock() happens with -- * interrupts disabled so the internal migrate_enable() -- * won't undo the migrate_disable() which was issued when -- * locking hb->lock. -- */ -- migrate_disable(); - spin_unlock(&hb->lock); - - /* drops pi_state->pi_mutex.wait_lock */ - ret = wake_futex_pi(uaddr, uval, pi_state); - -- migrate_enable(); -- - put_pi_state(pi_state); - - /* --- -2.36.1 - diff --git a/debian/patches-rt/0275-futex-Make-the-futex_hash_bucket-lock-raw.patch b/debian/patches-rt/0275-futex-Make-the-futex_hash_bucket-lock-raw.patch new file mode 100644 index 000000000..b10825ac3 --- /dev/null +++ b/debian/patches-rt/0275-futex-Make-the-futex_hash_bucket-lock-raw.patch @@ -0,0 +1,336 @@ +From: Sebastian Andrzej Siewior +Date: Wed, 26 Jun 2019 11:59:44 +0200 +Subject: [PATCH 275/342] futex: Make the futex_hash_bucket lock raw +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=26753445b4537710a56a34c3e43828b16269f682 + +[ Upstream commit f646521aadedab78801c9befe193e2e8a0c99298 ] + +Since commit 1a1fb985f2e2b ("futex: Handle early deadlock return +correctly") we can deadlock while we attempt to acquire the HB lock if +we fail to acquire the lock. +The RT waiter (for the futex lock) is still enqueued and acquiring the +HB lock may build up a lock chain which leads to a deadlock if the owner +of the lock futex-lock holds the HB lock. + +Make the hash bucket lock raw so it does not participate in the +lockchain. + +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + kernel/futex.c | 86 +++++++++++++++++++++++++------------------------- + 1 file changed, 43 insertions(+), 43 deletions(-) + +diff --git a/kernel/futex.c b/kernel/futex.c +index 9bcfdcffb2dd..8a49dd71b233 100644 +--- a/kernel/futex.c ++++ b/kernel/futex.c +@@ -243,7 +243,7 @@ struct futex_q { + struct plist_node list; + + struct task_struct *task; +- spinlock_t *lock_ptr; ++ raw_spinlock_t *lock_ptr; + union futex_key key; + struct futex_pi_state *pi_state; + struct rt_mutex_waiter *rt_waiter; +@@ -264,7 +264,7 @@ static const struct futex_q futex_q_init = { + */ + struct futex_hash_bucket { + atomic_t waiters; +- spinlock_t lock; ++ raw_spinlock_t lock; + struct plist_head chain; + } ____cacheline_aligned_in_smp; + +@@ -952,7 +952,7 @@ static void exit_pi_state_list(struct task_struct *curr) + } + raw_spin_unlock_irq(&curr->pi_lock); + +- spin_lock(&hb->lock); ++ raw_spin_lock(&hb->lock); + raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock); + raw_spin_lock(&curr->pi_lock); + /* +@@ -962,7 +962,7 @@ static void exit_pi_state_list(struct task_struct *curr) + if (head->next != next) { + /* retain curr->pi_lock for the loop invariant */ + raw_spin_unlock(&pi_state->pi_mutex.wait_lock); +- spin_unlock(&hb->lock); ++ raw_spin_unlock(&hb->lock); + put_pi_state(pi_state); + continue; + } +@@ -974,7 +974,7 @@ static void exit_pi_state_list(struct task_struct *curr) + + raw_spin_unlock(&curr->pi_lock); + raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock); +- spin_unlock(&hb->lock); ++ raw_spin_unlock(&hb->lock); + + rt_mutex_futex_unlock(&pi_state->pi_mutex); + put_pi_state(pi_state); +@@ -1523,7 +1523,7 @@ static void __unqueue_futex(struct futex_q *q) + { + struct futex_hash_bucket *hb; + +- if (WARN_ON_SMP(!q->lock_ptr || !spin_is_locked(q->lock_ptr)) ++ if (WARN_ON_SMP(!q->lock_ptr || !raw_spin_is_locked(q->lock_ptr)) + || WARN_ON(plist_node_empty(&q->list))) + return; + +@@ -1643,21 +1643,21 @@ static inline void + double_lock_hb(struct futex_hash_bucket *hb1, struct futex_hash_bucket *hb2) + { + if (hb1 <= hb2) { +- spin_lock(&hb1->lock); ++ raw_spin_lock(&hb1->lock); + if (hb1 < hb2) +- spin_lock_nested(&hb2->lock, SINGLE_DEPTH_NESTING); ++ raw_spin_lock_nested(&hb2->lock, SINGLE_DEPTH_NESTING); + } else { /* hb1 > hb2 */ +- spin_lock(&hb2->lock); +- spin_lock_nested(&hb1->lock, SINGLE_DEPTH_NESTING); ++ raw_spin_lock(&hb2->lock); ++ raw_spin_lock_nested(&hb1->lock, SINGLE_DEPTH_NESTING); + } + } + + static inline void + double_unlock_hb(struct futex_hash_bucket *hb1, struct futex_hash_bucket *hb2) + { +- spin_unlock(&hb1->lock); ++ raw_spin_unlock(&hb1->lock); + if (hb1 != hb2) +- spin_unlock(&hb2->lock); ++ raw_spin_unlock(&hb2->lock); + } + + /* +@@ -1685,7 +1685,7 @@ futex_wake(u32 __user *uaddr, unsigned int flags, int nr_wake, u32 bitset) + if (!hb_waiters_pending(hb)) + goto out_put_key; + +- spin_lock(&hb->lock); ++ raw_spin_lock(&hb->lock); + + plist_for_each_entry_safe(this, next, &hb->chain, list) { + if (match_futex (&this->key, &key)) { +@@ -1704,7 +1704,7 @@ futex_wake(u32 __user *uaddr, unsigned int flags, int nr_wake, u32 bitset) + } + } + +- spin_unlock(&hb->lock); ++ raw_spin_unlock(&hb->lock); + wake_up_q(&wake_q); + out_put_key: + put_futex_key(&key); +@@ -2326,7 +2326,7 @@ static inline struct futex_hash_bucket *queue_lock(struct futex_q *q) + + q->lock_ptr = &hb->lock; + +- spin_lock(&hb->lock); /* implies smp_mb(); (A) */ ++ raw_spin_lock(&hb->lock); /* implies smp_mb(); (A) */ + return hb; + } + +@@ -2334,7 +2334,7 @@ static inline void + queue_unlock(struct futex_hash_bucket *hb) + __releases(&hb->lock) + { +- spin_unlock(&hb->lock); ++ raw_spin_unlock(&hb->lock); + hb_waiters_dec(hb); + } + +@@ -2373,7 +2373,7 @@ static inline void queue_me(struct futex_q *q, struct futex_hash_bucket *hb) + __releases(&hb->lock) + { + __queue_me(q, hb); +- spin_unlock(&hb->lock); ++ raw_spin_unlock(&hb->lock); + } + + /** +@@ -2389,41 +2389,41 @@ static inline void queue_me(struct futex_q *q, struct futex_hash_bucket *hb) + */ + static int unqueue_me(struct futex_q *q) + { +- spinlock_t *lock_ptr; ++ raw_spinlock_t *lock_ptr; + int ret = 0; + + /* In the common case we don't take the spinlock, which is nice. */ + retry: + /* +- * q->lock_ptr can change between this read and the following spin_lock. +- * Use READ_ONCE to forbid the compiler from reloading q->lock_ptr and +- * optimizing lock_ptr out of the logic below. ++ * q->lock_ptr can change between this read and the following ++ * raw_spin_lock. Use READ_ONCE to forbid the compiler from reloading ++ * q->lock_ptr and optimizing lock_ptr out of the logic below. + */ + lock_ptr = READ_ONCE(q->lock_ptr); + if (lock_ptr != NULL) { +- spin_lock(lock_ptr); ++ raw_spin_lock(lock_ptr); + /* + * q->lock_ptr can change between reading it and +- * spin_lock(), causing us to take the wrong lock. This ++ * raw_spin_lock(), causing us to take the wrong lock. This + * corrects the race condition. + * + * Reasoning goes like this: if we have the wrong lock, + * q->lock_ptr must have changed (maybe several times) +- * between reading it and the spin_lock(). It can +- * change again after the spin_lock() but only if it was +- * already changed before the spin_lock(). It cannot, ++ * between reading it and the raw_spin_lock(). It can ++ * change again after the raw_spin_lock() but only if it was ++ * already changed before the raw_spin_lock(). It cannot, + * however, change back to the original value. Therefore + * we can detect whether we acquired the correct lock. + */ + if (unlikely(lock_ptr != q->lock_ptr)) { +- spin_unlock(lock_ptr); ++ raw_spin_unlock(lock_ptr); + goto retry; + } + __unqueue_futex(q); + + BUG_ON(q->pi_state); + +- spin_unlock(lock_ptr); ++ raw_spin_unlock(lock_ptr); + ret = 1; + } + +@@ -2445,7 +2445,7 @@ static void unqueue_me_pi(struct futex_q *q) + put_pi_state(q->pi_state); + q->pi_state = NULL; + +- spin_unlock(q->lock_ptr); ++ raw_spin_unlock(q->lock_ptr); + } + + static int __fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, +@@ -2569,7 +2569,7 @@ static int __fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, + */ + handle_err: + raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock); +- spin_unlock(q->lock_ptr); ++ raw_spin_unlock(q->lock_ptr); + + switch (err) { + case -EFAULT: +@@ -2586,7 +2586,7 @@ static int __fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, + break; + } + +- spin_lock(q->lock_ptr); ++ raw_spin_lock(q->lock_ptr); + raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock); + + /* +@@ -2700,7 +2700,7 @@ static void futex_wait_queue_me(struct futex_hash_bucket *hb, struct futex_q *q, + /* + * The task state is guaranteed to be set before another task can + * wake it. set_current_state() is implemented using smp_store_mb() and +- * queue_me() calls spin_unlock() upon completion, both serializing ++ * queue_me() calls raw_spin_unlock() upon completion, both serializing + * access to the hash list and forcing another memory barrier. + */ + set_current_state(TASK_INTERRUPTIBLE); +@@ -2998,7 +2998,7 @@ static int futex_lock_pi(u32 __user *uaddr, unsigned int flags, + * before __rt_mutex_start_proxy_lock() is done. + */ + raw_spin_lock_irq(&q.pi_state->pi_mutex.wait_lock); +- spin_unlock(q.lock_ptr); ++ raw_spin_unlock(q.lock_ptr); + /* + * __rt_mutex_start_proxy_lock() unconditionally enqueues the @rt_waiter + * such that futex_unlock_pi() is guaranteed to observe the waiter when +@@ -3019,7 +3019,7 @@ static int futex_lock_pi(u32 __user *uaddr, unsigned int flags, + ret = rt_mutex_wait_proxy_lock(&q.pi_state->pi_mutex, to, &rt_waiter); + + cleanup: +- spin_lock(q.lock_ptr); ++ raw_spin_lock(q.lock_ptr); + /* + * If we failed to acquire the lock (deadlock/signal/timeout), we must + * first acquire the hb->lock before removing the lock from the +@@ -3106,7 +3106,7 @@ static int futex_unlock_pi(u32 __user *uaddr, unsigned int flags) + return ret; + + hb = hash_futex(&key); +- spin_lock(&hb->lock); ++ raw_spin_lock(&hb->lock); + + /* + * Check waiters first. We do not trust user space values at +@@ -3140,7 +3140,7 @@ static int futex_unlock_pi(u32 __user *uaddr, unsigned int flags) + * rt_waiter. Also see the WARN in wake_futex_pi(). + */ + raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock); +- spin_unlock(&hb->lock); ++ raw_spin_unlock(&hb->lock); + + /* drops pi_state->pi_mutex.wait_lock */ + ret = wake_futex_pi(uaddr, uval, pi_state); +@@ -3179,7 +3179,7 @@ static int futex_unlock_pi(u32 __user *uaddr, unsigned int flags) + * owner. + */ + if ((ret = cmpxchg_futex_value_locked(&curval, uaddr, uval, 0))) { +- spin_unlock(&hb->lock); ++ raw_spin_unlock(&hb->lock); + switch (ret) { + case -EFAULT: + goto pi_faulted; +@@ -3199,7 +3199,7 @@ static int futex_unlock_pi(u32 __user *uaddr, unsigned int flags) + ret = (curval == uval) ? 0 : -EAGAIN; + + out_unlock: +- spin_unlock(&hb->lock); ++ raw_spin_unlock(&hb->lock); + out_putkey: + put_futex_key(&key); + return ret; +@@ -3372,9 +3372,9 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, + /* Queue the futex_q, drop the hb lock, wait for wakeup. */ + futex_wait_queue_me(hb, &q, to); + +- spin_lock(&hb->lock); ++ raw_spin_lock(&hb->lock); + ret = handle_early_requeue_pi_wakeup(hb, &q, &key2, to); +- spin_unlock(&hb->lock); ++ raw_spin_unlock(&hb->lock); + if (ret) + goto out_put_keys; + +@@ -3394,7 +3394,7 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, + * did a lock-steal - fix up the PI-state in that case. + */ + if (q.pi_state && (q.pi_state->owner != current)) { +- spin_lock(q.lock_ptr); ++ raw_spin_lock(q.lock_ptr); + ret = fixup_pi_state_owner(uaddr2, &q, current); + /* + * Drop the reference to the pi state which +@@ -3420,7 +3420,7 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, + pi_mutex = &q.pi_state->pi_mutex; + ret = rt_mutex_wait_proxy_lock(pi_mutex, to, &rt_waiter); + +- spin_lock(q.lock_ptr); ++ raw_spin_lock(q.lock_ptr); + if (ret && !rt_mutex_cleanup_proxy_lock(pi_mutex, &rt_waiter)) + ret = 0; + +@@ -4179,7 +4179,7 @@ static int __init futex_init(void) + for (i = 0; i < futex_hashsize; i++) { + atomic_set(&futex_queues[i].waiters, 0); + plist_head_init(&futex_queues[i].chain); +- spin_lock_init(&futex_queues[i].lock); ++ raw_spin_lock_init(&futex_queues[i].lock); + } + + return 0; diff --git a/debian/patches-rt/0276-futex-Delay-deallocation-of-pi_state.patch b/debian/patches-rt/0276-futex-Delay-deallocation-of-pi_state.patch new file mode 100644 index 000000000..e041db583 --- /dev/null +++ b/debian/patches-rt/0276-futex-Delay-deallocation-of-pi_state.patch @@ -0,0 +1,178 @@ +From: Thomas Gleixner +Date: Wed, 26 Jun 2019 13:35:36 +0200 +Subject: [PATCH 276/342] futex: Delay deallocation of pi_state +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=47e8761ab84ff28b2cbff2d64018bdedb9be7d11 + +[ Upstream commit d7c7cf8cb68b7df17e6e50be1f25f35d83e686c7 ] + +On -RT we can't invoke kfree() in a non-preemptible context. + +Defer the deallocation of pi_state to preemptible context. + +Signed-off-by: Thomas Gleixner +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + kernel/futex.c | 55 ++++++++++++++++++++++++++++++++++++++++---------- + 1 file changed, 44 insertions(+), 11 deletions(-) + +diff --git a/kernel/futex.c b/kernel/futex.c +index 8a49dd71b233..2fc6bedb460e 100644 +--- a/kernel/futex.c ++++ b/kernel/futex.c +@@ -871,13 +871,13 @@ static void get_pi_state(struct futex_pi_state *pi_state) + * Drops a reference to the pi_state object and frees or caches it + * when the last reference is gone. + */ +-static void put_pi_state(struct futex_pi_state *pi_state) ++static struct futex_pi_state *__put_pi_state(struct futex_pi_state *pi_state) + { + if (!pi_state) +- return; ++ return NULL; + + if (!atomic_dec_and_test(&pi_state->refcount)) +- return; ++ return NULL; + + /* + * If pi_state->owner is NULL, the owner is most probably dying +@@ -892,9 +892,7 @@ static void put_pi_state(struct futex_pi_state *pi_state) + raw_spin_unlock_irqrestore(&pi_state->pi_mutex.wait_lock, flags); + } + +- if (current->pi_state_cache) { +- kfree(pi_state); +- } else { ++ if (!current->pi_state_cache) { + /* + * pi_state->list is already empty. + * clear pi_state->owner. +@@ -903,6 +901,30 @@ static void put_pi_state(struct futex_pi_state *pi_state) + pi_state->owner = NULL; + atomic_set(&pi_state->refcount, 1); + current->pi_state_cache = pi_state; ++ pi_state = NULL; ++ } ++ return pi_state; ++} ++ ++static void put_pi_state(struct futex_pi_state *pi_state) ++{ ++ kfree(__put_pi_state(pi_state)); ++} ++ ++static void put_pi_state_atomic(struct futex_pi_state *pi_state, ++ struct list_head *to_free) ++{ ++ if (__put_pi_state(pi_state)) ++ list_add(&pi_state->list, to_free); ++} ++ ++static void free_pi_state_list(struct list_head *to_free) ++{ ++ struct futex_pi_state *p, *next; ++ ++ list_for_each_entry_safe(p, next, to_free, list) { ++ list_del(&p->list); ++ kfree(p); + } + } + +@@ -919,6 +941,7 @@ static void exit_pi_state_list(struct task_struct *curr) + struct futex_pi_state *pi_state; + struct futex_hash_bucket *hb; + union futex_key key = FUTEX_KEY_INIT; ++ LIST_HEAD(to_free); + + if (!futex_cmpxchg_enabled) + return; +@@ -963,7 +986,7 @@ static void exit_pi_state_list(struct task_struct *curr) + /* retain curr->pi_lock for the loop invariant */ + raw_spin_unlock(&pi_state->pi_mutex.wait_lock); + raw_spin_unlock(&hb->lock); +- put_pi_state(pi_state); ++ put_pi_state_atomic(pi_state, &to_free); + continue; + } + +@@ -982,6 +1005,8 @@ static void exit_pi_state_list(struct task_struct *curr) + raw_spin_lock_irq(&curr->pi_lock); + } + raw_spin_unlock_irq(&curr->pi_lock); ++ ++ free_pi_state_list(&to_free); + } + #else + static inline void exit_pi_state_list(struct task_struct *curr) { } +@@ -2017,6 +2042,7 @@ static int futex_requeue(u32 __user *uaddr1, unsigned int flags, + struct futex_hash_bucket *hb1, *hb2; + struct futex_q *this, *next; + DEFINE_WAKE_Q(wake_q); ++ LIST_HEAD(to_free); + + if (nr_wake < 0 || nr_requeue < 0) + return -EINVAL; +@@ -2265,7 +2291,7 @@ static int futex_requeue(u32 __user *uaddr1, unsigned int flags, + * object. + */ + this->pi_state = NULL; +- put_pi_state(pi_state); ++ put_pi_state_atomic(pi_state, &to_free); + /* + * We stop queueing more waiters and let user + * space deal with the mess. +@@ -2282,7 +2308,7 @@ static int futex_requeue(u32 __user *uaddr1, unsigned int flags, + * in futex_proxy_trylock_atomic() or in lookup_pi_state(). We + * need to drop it here again. + */ +- put_pi_state(pi_state); ++ put_pi_state_atomic(pi_state, &to_free); + + out_unlock: + double_unlock_hb(hb1, hb2); +@@ -2303,6 +2329,7 @@ static int futex_requeue(u32 __user *uaddr1, unsigned int flags, + out_put_key1: + put_futex_key(&key1); + out: ++ free_pi_state_list(&to_free); + return ret ? ret : task_count; + } + +@@ -2439,13 +2466,16 @@ static int unqueue_me(struct futex_q *q) + static void unqueue_me_pi(struct futex_q *q) + __releases(q->lock_ptr) + { ++ struct futex_pi_state *ps; ++ + __unqueue_futex(q); + + BUG_ON(!q->pi_state); +- put_pi_state(q->pi_state); ++ ps = __put_pi_state(q->pi_state); + q->pi_state = NULL; + + raw_spin_unlock(q->lock_ptr); ++ kfree(ps); + } + + static int __fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, +@@ -3394,14 +3424,17 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, + * did a lock-steal - fix up the PI-state in that case. + */ + if (q.pi_state && (q.pi_state->owner != current)) { ++ struct futex_pi_state *ps_free; ++ + raw_spin_lock(q.lock_ptr); + ret = fixup_pi_state_owner(uaddr2, &q, current); + /* + * Drop the reference to the pi state which + * the requeue_pi() code acquired for us. + */ +- put_pi_state(q.pi_state); ++ ps_free = __put_pi_state(q.pi_state); + spin_unlock(&hb2->lock); ++ kfree(ps_free); + /* + * Adjust the return value. It's either -EFAULT or + * success (1) but the caller expects 0 for success. diff --git a/debian/patches-rt/0276-futex-Make-the-futex_hash_bucket-lock-raw.patch b/debian/patches-rt/0276-futex-Make-the-futex_hash_bucket-lock-raw.patch deleted file mode 100644 index da5c08609..000000000 --- a/debian/patches-rt/0276-futex-Make-the-futex_hash_bucket-lock-raw.patch +++ /dev/null @@ -1,340 +0,0 @@ -From 07c4f7b101fb3ad4704efeda1f43246b289b62ad Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Wed, 26 Jun 2019 11:59:44 +0200 -Subject: [PATCH 276/347] futex: Make the futex_hash_bucket lock raw -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit f646521aadedab78801c9befe193e2e8a0c99298 ] - -Since commit 1a1fb985f2e2b ("futex: Handle early deadlock return -correctly") we can deadlock while we attempt to acquire the HB lock if -we fail to acquire the lock. -The RT waiter (for the futex lock) is still enqueued and acquiring the -HB lock may build up a lock chain which leads to a deadlock if the owner -of the lock futex-lock holds the HB lock. - -Make the hash bucket lock raw so it does not participate in the -lockchain. - -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - kernel/futex.c | 86 +++++++++++++++++++++++++------------------------- - 1 file changed, 43 insertions(+), 43 deletions(-) - -diff --git a/kernel/futex.c b/kernel/futex.c -index 9bcfdcffb2dd..8a49dd71b233 100644 ---- a/kernel/futex.c -+++ b/kernel/futex.c -@@ -243,7 +243,7 @@ struct futex_q { - struct plist_node list; - - struct task_struct *task; -- spinlock_t *lock_ptr; -+ raw_spinlock_t *lock_ptr; - union futex_key key; - struct futex_pi_state *pi_state; - struct rt_mutex_waiter *rt_waiter; -@@ -264,7 +264,7 @@ static const struct futex_q futex_q_init = { - */ - struct futex_hash_bucket { - atomic_t waiters; -- spinlock_t lock; -+ raw_spinlock_t lock; - struct plist_head chain; - } ____cacheline_aligned_in_smp; - -@@ -952,7 +952,7 @@ static void exit_pi_state_list(struct task_struct *curr) - } - raw_spin_unlock_irq(&curr->pi_lock); - -- spin_lock(&hb->lock); -+ raw_spin_lock(&hb->lock); - raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock); - raw_spin_lock(&curr->pi_lock); - /* -@@ -962,7 +962,7 @@ static void exit_pi_state_list(struct task_struct *curr) - if (head->next != next) { - /* retain curr->pi_lock for the loop invariant */ - raw_spin_unlock(&pi_state->pi_mutex.wait_lock); -- spin_unlock(&hb->lock); -+ raw_spin_unlock(&hb->lock); - put_pi_state(pi_state); - continue; - } -@@ -974,7 +974,7 @@ static void exit_pi_state_list(struct task_struct *curr) - - raw_spin_unlock(&curr->pi_lock); - raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock); -- spin_unlock(&hb->lock); -+ raw_spin_unlock(&hb->lock); - - rt_mutex_futex_unlock(&pi_state->pi_mutex); - put_pi_state(pi_state); -@@ -1523,7 +1523,7 @@ static void __unqueue_futex(struct futex_q *q) - { - struct futex_hash_bucket *hb; - -- if (WARN_ON_SMP(!q->lock_ptr || !spin_is_locked(q->lock_ptr)) -+ if (WARN_ON_SMP(!q->lock_ptr || !raw_spin_is_locked(q->lock_ptr)) - || WARN_ON(plist_node_empty(&q->list))) - return; - -@@ -1643,21 +1643,21 @@ static inline void - double_lock_hb(struct futex_hash_bucket *hb1, struct futex_hash_bucket *hb2) - { - if (hb1 <= hb2) { -- spin_lock(&hb1->lock); -+ raw_spin_lock(&hb1->lock); - if (hb1 < hb2) -- spin_lock_nested(&hb2->lock, SINGLE_DEPTH_NESTING); -+ raw_spin_lock_nested(&hb2->lock, SINGLE_DEPTH_NESTING); - } else { /* hb1 > hb2 */ -- spin_lock(&hb2->lock); -- spin_lock_nested(&hb1->lock, SINGLE_DEPTH_NESTING); -+ raw_spin_lock(&hb2->lock); -+ raw_spin_lock_nested(&hb1->lock, SINGLE_DEPTH_NESTING); - } - } - - static inline void - double_unlock_hb(struct futex_hash_bucket *hb1, struct futex_hash_bucket *hb2) - { -- spin_unlock(&hb1->lock); -+ raw_spin_unlock(&hb1->lock); - if (hb1 != hb2) -- spin_unlock(&hb2->lock); -+ raw_spin_unlock(&hb2->lock); - } - - /* -@@ -1685,7 +1685,7 @@ futex_wake(u32 __user *uaddr, unsigned int flags, int nr_wake, u32 bitset) - if (!hb_waiters_pending(hb)) - goto out_put_key; - -- spin_lock(&hb->lock); -+ raw_spin_lock(&hb->lock); - - plist_for_each_entry_safe(this, next, &hb->chain, list) { - if (match_futex (&this->key, &key)) { -@@ -1704,7 +1704,7 @@ futex_wake(u32 __user *uaddr, unsigned int flags, int nr_wake, u32 bitset) - } - } - -- spin_unlock(&hb->lock); -+ raw_spin_unlock(&hb->lock); - wake_up_q(&wake_q); - out_put_key: - put_futex_key(&key); -@@ -2326,7 +2326,7 @@ static inline struct futex_hash_bucket *queue_lock(struct futex_q *q) - - q->lock_ptr = &hb->lock; - -- spin_lock(&hb->lock); /* implies smp_mb(); (A) */ -+ raw_spin_lock(&hb->lock); /* implies smp_mb(); (A) */ - return hb; - } - -@@ -2334,7 +2334,7 @@ static inline void - queue_unlock(struct futex_hash_bucket *hb) - __releases(&hb->lock) - { -- spin_unlock(&hb->lock); -+ raw_spin_unlock(&hb->lock); - hb_waiters_dec(hb); - } - -@@ -2373,7 +2373,7 @@ static inline void queue_me(struct futex_q *q, struct futex_hash_bucket *hb) - __releases(&hb->lock) - { - __queue_me(q, hb); -- spin_unlock(&hb->lock); -+ raw_spin_unlock(&hb->lock); - } - - /** -@@ -2389,41 +2389,41 @@ static inline void queue_me(struct futex_q *q, struct futex_hash_bucket *hb) - */ - static int unqueue_me(struct futex_q *q) - { -- spinlock_t *lock_ptr; -+ raw_spinlock_t *lock_ptr; - int ret = 0; - - /* In the common case we don't take the spinlock, which is nice. */ - retry: - /* -- * q->lock_ptr can change between this read and the following spin_lock. -- * Use READ_ONCE to forbid the compiler from reloading q->lock_ptr and -- * optimizing lock_ptr out of the logic below. -+ * q->lock_ptr can change between this read and the following -+ * raw_spin_lock. Use READ_ONCE to forbid the compiler from reloading -+ * q->lock_ptr and optimizing lock_ptr out of the logic below. - */ - lock_ptr = READ_ONCE(q->lock_ptr); - if (lock_ptr != NULL) { -- spin_lock(lock_ptr); -+ raw_spin_lock(lock_ptr); - /* - * q->lock_ptr can change between reading it and -- * spin_lock(), causing us to take the wrong lock. This -+ * raw_spin_lock(), causing us to take the wrong lock. This - * corrects the race condition. - * - * Reasoning goes like this: if we have the wrong lock, - * q->lock_ptr must have changed (maybe several times) -- * between reading it and the spin_lock(). It can -- * change again after the spin_lock() but only if it was -- * already changed before the spin_lock(). It cannot, -+ * between reading it and the raw_spin_lock(). It can -+ * change again after the raw_spin_lock() but only if it was -+ * already changed before the raw_spin_lock(). It cannot, - * however, change back to the original value. Therefore - * we can detect whether we acquired the correct lock. - */ - if (unlikely(lock_ptr != q->lock_ptr)) { -- spin_unlock(lock_ptr); -+ raw_spin_unlock(lock_ptr); - goto retry; - } - __unqueue_futex(q); - - BUG_ON(q->pi_state); - -- spin_unlock(lock_ptr); -+ raw_spin_unlock(lock_ptr); - ret = 1; - } - -@@ -2445,7 +2445,7 @@ static void unqueue_me_pi(struct futex_q *q) - put_pi_state(q->pi_state); - q->pi_state = NULL; - -- spin_unlock(q->lock_ptr); -+ raw_spin_unlock(q->lock_ptr); - } - - static int __fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, -@@ -2569,7 +2569,7 @@ static int __fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, - */ - handle_err: - raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock); -- spin_unlock(q->lock_ptr); -+ raw_spin_unlock(q->lock_ptr); - - switch (err) { - case -EFAULT: -@@ -2586,7 +2586,7 @@ static int __fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, - break; - } - -- spin_lock(q->lock_ptr); -+ raw_spin_lock(q->lock_ptr); - raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock); - - /* -@@ -2700,7 +2700,7 @@ static void futex_wait_queue_me(struct futex_hash_bucket *hb, struct futex_q *q, - /* - * The task state is guaranteed to be set before another task can - * wake it. set_current_state() is implemented using smp_store_mb() and -- * queue_me() calls spin_unlock() upon completion, both serializing -+ * queue_me() calls raw_spin_unlock() upon completion, both serializing - * access to the hash list and forcing another memory barrier. - */ - set_current_state(TASK_INTERRUPTIBLE); -@@ -2998,7 +2998,7 @@ static int futex_lock_pi(u32 __user *uaddr, unsigned int flags, - * before __rt_mutex_start_proxy_lock() is done. - */ - raw_spin_lock_irq(&q.pi_state->pi_mutex.wait_lock); -- spin_unlock(q.lock_ptr); -+ raw_spin_unlock(q.lock_ptr); - /* - * __rt_mutex_start_proxy_lock() unconditionally enqueues the @rt_waiter - * such that futex_unlock_pi() is guaranteed to observe the waiter when -@@ -3019,7 +3019,7 @@ static int futex_lock_pi(u32 __user *uaddr, unsigned int flags, - ret = rt_mutex_wait_proxy_lock(&q.pi_state->pi_mutex, to, &rt_waiter); - - cleanup: -- spin_lock(q.lock_ptr); -+ raw_spin_lock(q.lock_ptr); - /* - * If we failed to acquire the lock (deadlock/signal/timeout), we must - * first acquire the hb->lock before removing the lock from the -@@ -3106,7 +3106,7 @@ static int futex_unlock_pi(u32 __user *uaddr, unsigned int flags) - return ret; - - hb = hash_futex(&key); -- spin_lock(&hb->lock); -+ raw_spin_lock(&hb->lock); - - /* - * Check waiters first. We do not trust user space values at -@@ -3140,7 +3140,7 @@ static int futex_unlock_pi(u32 __user *uaddr, unsigned int flags) - * rt_waiter. Also see the WARN in wake_futex_pi(). - */ - raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock); -- spin_unlock(&hb->lock); -+ raw_spin_unlock(&hb->lock); - - /* drops pi_state->pi_mutex.wait_lock */ - ret = wake_futex_pi(uaddr, uval, pi_state); -@@ -3179,7 +3179,7 @@ static int futex_unlock_pi(u32 __user *uaddr, unsigned int flags) - * owner. - */ - if ((ret = cmpxchg_futex_value_locked(&curval, uaddr, uval, 0))) { -- spin_unlock(&hb->lock); -+ raw_spin_unlock(&hb->lock); - switch (ret) { - case -EFAULT: - goto pi_faulted; -@@ -3199,7 +3199,7 @@ static int futex_unlock_pi(u32 __user *uaddr, unsigned int flags) - ret = (curval == uval) ? 0 : -EAGAIN; - - out_unlock: -- spin_unlock(&hb->lock); -+ raw_spin_unlock(&hb->lock); - out_putkey: - put_futex_key(&key); - return ret; -@@ -3372,9 +3372,9 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, - /* Queue the futex_q, drop the hb lock, wait for wakeup. */ - futex_wait_queue_me(hb, &q, to); - -- spin_lock(&hb->lock); -+ raw_spin_lock(&hb->lock); - ret = handle_early_requeue_pi_wakeup(hb, &q, &key2, to); -- spin_unlock(&hb->lock); -+ raw_spin_unlock(&hb->lock); - if (ret) - goto out_put_keys; - -@@ -3394,7 +3394,7 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, - * did a lock-steal - fix up the PI-state in that case. - */ - if (q.pi_state && (q.pi_state->owner != current)) { -- spin_lock(q.lock_ptr); -+ raw_spin_lock(q.lock_ptr); - ret = fixup_pi_state_owner(uaddr2, &q, current); - /* - * Drop the reference to the pi state which -@@ -3420,7 +3420,7 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, - pi_mutex = &q.pi_state->pi_mutex; - ret = rt_mutex_wait_proxy_lock(pi_mutex, to, &rt_waiter); - -- spin_lock(q.lock_ptr); -+ raw_spin_lock(q.lock_ptr); - if (ret && !rt_mutex_cleanup_proxy_lock(pi_mutex, &rt_waiter)) - ret = 0; - -@@ -4179,7 +4179,7 @@ static int __init futex_init(void) - for (i = 0; i < futex_hashsize; i++) { - atomic_set(&futex_queues[i].waiters, 0); - plist_head_init(&futex_queues[i].chain); -- spin_lock_init(&futex_queues[i].lock); -+ raw_spin_lock_init(&futex_queues[i].lock); - } - - return 0; --- -2.36.1 - diff --git a/debian/patches-rt/0277-futex-Delay-deallocation-of-pi_state.patch b/debian/patches-rt/0277-futex-Delay-deallocation-of-pi_state.patch deleted file mode 100644 index d75a415e1..000000000 --- a/debian/patches-rt/0277-futex-Delay-deallocation-of-pi_state.patch +++ /dev/null @@ -1,182 +0,0 @@ -From 83bf13ff04d052ee07805956bae67c712bbb761b Mon Sep 17 00:00:00 2001 -From: Thomas Gleixner -Date: Wed, 26 Jun 2019 13:35:36 +0200 -Subject: [PATCH 277/347] futex: Delay deallocation of pi_state -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit d7c7cf8cb68b7df17e6e50be1f25f35d83e686c7 ] - -On -RT we can't invoke kfree() in a non-preemptible context. - -Defer the deallocation of pi_state to preemptible context. - -Signed-off-by: Thomas Gleixner -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - kernel/futex.c | 55 ++++++++++++++++++++++++++++++++++++++++---------- - 1 file changed, 44 insertions(+), 11 deletions(-) - -diff --git a/kernel/futex.c b/kernel/futex.c -index 8a49dd71b233..2fc6bedb460e 100644 ---- a/kernel/futex.c -+++ b/kernel/futex.c -@@ -871,13 +871,13 @@ static void get_pi_state(struct futex_pi_state *pi_state) - * Drops a reference to the pi_state object and frees or caches it - * when the last reference is gone. - */ --static void put_pi_state(struct futex_pi_state *pi_state) -+static struct futex_pi_state *__put_pi_state(struct futex_pi_state *pi_state) - { - if (!pi_state) -- return; -+ return NULL; - - if (!atomic_dec_and_test(&pi_state->refcount)) -- return; -+ return NULL; - - /* - * If pi_state->owner is NULL, the owner is most probably dying -@@ -892,9 +892,7 @@ static void put_pi_state(struct futex_pi_state *pi_state) - raw_spin_unlock_irqrestore(&pi_state->pi_mutex.wait_lock, flags); - } - -- if (current->pi_state_cache) { -- kfree(pi_state); -- } else { -+ if (!current->pi_state_cache) { - /* - * pi_state->list is already empty. - * clear pi_state->owner. -@@ -903,6 +901,30 @@ static void put_pi_state(struct futex_pi_state *pi_state) - pi_state->owner = NULL; - atomic_set(&pi_state->refcount, 1); - current->pi_state_cache = pi_state; -+ pi_state = NULL; -+ } -+ return pi_state; -+} -+ -+static void put_pi_state(struct futex_pi_state *pi_state) -+{ -+ kfree(__put_pi_state(pi_state)); -+} -+ -+static void put_pi_state_atomic(struct futex_pi_state *pi_state, -+ struct list_head *to_free) -+{ -+ if (__put_pi_state(pi_state)) -+ list_add(&pi_state->list, to_free); -+} -+ -+static void free_pi_state_list(struct list_head *to_free) -+{ -+ struct futex_pi_state *p, *next; -+ -+ list_for_each_entry_safe(p, next, to_free, list) { -+ list_del(&p->list); -+ kfree(p); - } - } - -@@ -919,6 +941,7 @@ static void exit_pi_state_list(struct task_struct *curr) - struct futex_pi_state *pi_state; - struct futex_hash_bucket *hb; - union futex_key key = FUTEX_KEY_INIT; -+ LIST_HEAD(to_free); - - if (!futex_cmpxchg_enabled) - return; -@@ -963,7 +986,7 @@ static void exit_pi_state_list(struct task_struct *curr) - /* retain curr->pi_lock for the loop invariant */ - raw_spin_unlock(&pi_state->pi_mutex.wait_lock); - raw_spin_unlock(&hb->lock); -- put_pi_state(pi_state); -+ put_pi_state_atomic(pi_state, &to_free); - continue; - } - -@@ -982,6 +1005,8 @@ static void exit_pi_state_list(struct task_struct *curr) - raw_spin_lock_irq(&curr->pi_lock); - } - raw_spin_unlock_irq(&curr->pi_lock); -+ -+ free_pi_state_list(&to_free); - } - #else - static inline void exit_pi_state_list(struct task_struct *curr) { } -@@ -2017,6 +2042,7 @@ static int futex_requeue(u32 __user *uaddr1, unsigned int flags, - struct futex_hash_bucket *hb1, *hb2; - struct futex_q *this, *next; - DEFINE_WAKE_Q(wake_q); -+ LIST_HEAD(to_free); - - if (nr_wake < 0 || nr_requeue < 0) - return -EINVAL; -@@ -2265,7 +2291,7 @@ static int futex_requeue(u32 __user *uaddr1, unsigned int flags, - * object. - */ - this->pi_state = NULL; -- put_pi_state(pi_state); -+ put_pi_state_atomic(pi_state, &to_free); - /* - * We stop queueing more waiters and let user - * space deal with the mess. -@@ -2282,7 +2308,7 @@ static int futex_requeue(u32 __user *uaddr1, unsigned int flags, - * in futex_proxy_trylock_atomic() or in lookup_pi_state(). We - * need to drop it here again. - */ -- put_pi_state(pi_state); -+ put_pi_state_atomic(pi_state, &to_free); - - out_unlock: - double_unlock_hb(hb1, hb2); -@@ -2303,6 +2329,7 @@ static int futex_requeue(u32 __user *uaddr1, unsigned int flags, - out_put_key1: - put_futex_key(&key1); - out: -+ free_pi_state_list(&to_free); - return ret ? ret : task_count; - } - -@@ -2439,13 +2466,16 @@ static int unqueue_me(struct futex_q *q) - static void unqueue_me_pi(struct futex_q *q) - __releases(q->lock_ptr) - { -+ struct futex_pi_state *ps; -+ - __unqueue_futex(q); - - BUG_ON(!q->pi_state); -- put_pi_state(q->pi_state); -+ ps = __put_pi_state(q->pi_state); - q->pi_state = NULL; - - raw_spin_unlock(q->lock_ptr); -+ kfree(ps); - } - - static int __fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, -@@ -3394,14 +3424,17 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, - * did a lock-steal - fix up the PI-state in that case. - */ - if (q.pi_state && (q.pi_state->owner != current)) { -+ struct futex_pi_state *ps_free; -+ - raw_spin_lock(q.lock_ptr); - ret = fixup_pi_state_owner(uaddr2, &q, current); - /* - * Drop the reference to the pi state which - * the requeue_pi() code acquired for us. - */ -- put_pi_state(q.pi_state); -+ ps_free = __put_pi_state(q.pi_state); - spin_unlock(&hb2->lock); -+ kfree(ps_free); - /* - * Adjust the return value. It's either -EFAULT or - * success (1) but the caller expects 0 for success. --- -2.36.1 - diff --git a/debian/patches-rt/0277-mm-zswap-Do-not-disable-preemption-in-zswap_frontswa.patch b/debian/patches-rt/0277-mm-zswap-Do-not-disable-preemption-in-zswap_frontswa.patch new file mode 100644 index 000000000..e85c24bc9 --- /dev/null +++ b/debian/patches-rt/0277-mm-zswap-Do-not-disable-preemption-in-zswap_frontswa.patch @@ -0,0 +1,123 @@ +From: "Luis Claudio R. Goncalves" +Date: Tue, 25 Jun 2019 11:28:04 -0300 +Subject: [PATCH 277/342] mm/zswap: Do not disable preemption in + zswap_frontswap_store() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=bf2f37b64408cdd6fd6be0309d0a7bfe88a20d29 + +[ Upstream commit 4e4cf4be79635e67144632d9135286381acbc95a ] + +Zswap causes "BUG: scheduling while atomic" by blocking on a rt_spin_lock() with +preemption disabled. The preemption is disabled by get_cpu_var() in +zswap_frontswap_store() to protect the access of the zswap_dstmem percpu variable. + +Use get_locked_var() to protect the percpu zswap_dstmem variable, making the +code preemptive. + +As get_cpu_ptr() also disables preemption, replace it by this_cpu_ptr() and +remove the counterpart put_cpu_ptr(). + +Steps to Reproduce: + + 1. # grubby --args "zswap.enabled=1" --update-kernel DEFAULT + 2. # reboot + 3. Calculate the amount o memory to be used by the test: + ---> grep MemAvailable /proc/meminfo + ---> Add 25% ~ 50% to that value + 4. # stress --vm 1 --vm-bytes ${MemAvailable+25%} --timeout 240s + +Usually, in less than 5 minutes the backtrace listed below appears, followed +by a kernel panic: + +| BUG: scheduling while atomic: kswapd1/181/0x00000002 +| +| Preemption disabled at: +| [] zswap_frontswap_store+0x21a/0x6e1 +| +| Kernel panic - not syncing: scheduling while atomic +| CPU: 14 PID: 181 Comm: kswapd1 Kdump: loaded Not tainted 5.0.14-rt9 #1 +| Hardware name: AMD Pence/Pence, BIOS WPN2321X_Weekly_12_03_21 03/19/2012 +| Call Trace: +| panic+0x106/0x2a7 +| __schedule_bug.cold+0x3f/0x51 +| __schedule+0x5cb/0x6f0 +| schedule+0x43/0xd0 +| rt_spin_lock_slowlock_locked+0x114/0x2b0 +| rt_spin_lock_slowlock+0x51/0x80 +| zbud_alloc+0x1da/0x2d0 +| zswap_frontswap_store+0x31a/0x6e1 +| __frontswap_store+0xab/0x130 +| swap_writepage+0x39/0x70 +| pageout.isra.0+0xe3/0x320 +| shrink_page_list+0xa8e/0xd10 +| shrink_inactive_list+0x251/0x840 +| shrink_node_memcg+0x213/0x770 +| shrink_node+0xd9/0x450 +| balance_pgdat+0x2d5/0x510 +| kswapd+0x218/0x470 +| kthread+0xfb/0x130 +| ret_from_fork+0x27/0x50 + +Cc: stable-rt@vger.kernel.org +Reported-by: Ping Fang +Signed-off-by: Luis Claudio R. Goncalves +Reviewed-by: Daniel Bristot de Oliveira +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + mm/zswap.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +diff --git a/mm/zswap.c b/mm/zswap.c +index cd91fd9d96b8..420225d3ff0b 100644 +--- a/mm/zswap.c ++++ b/mm/zswap.c +@@ -27,6 +27,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -990,6 +991,8 @@ static void zswap_fill_page(void *ptr, unsigned long value) + memset_l(page, value, PAGE_SIZE / sizeof(unsigned long)); + } + ++/* protect zswap_dstmem from concurrency */ ++static DEFINE_LOCAL_IRQ_LOCK(zswap_dstmem_lock); + /********************************* + * frontswap hooks + **********************************/ +@@ -1066,12 +1069,11 @@ static int zswap_frontswap_store(unsigned type, pgoff_t offset, + } + + /* compress */ +- dst = get_cpu_var(zswap_dstmem); +- tfm = *get_cpu_ptr(entry->pool->tfm); ++ dst = get_locked_var(zswap_dstmem_lock, zswap_dstmem); ++ tfm = *this_cpu_ptr(entry->pool->tfm); + src = kmap_atomic(page); + ret = crypto_comp_compress(tfm, src, PAGE_SIZE, dst, &dlen); + kunmap_atomic(src); +- put_cpu_ptr(entry->pool->tfm); + if (ret) { + ret = -EINVAL; + goto put_dstmem; +@@ -1094,7 +1096,7 @@ static int zswap_frontswap_store(unsigned type, pgoff_t offset, + memcpy(buf, &zhdr, hlen); + memcpy(buf + hlen, dst, dlen); + zpool_unmap_handle(entry->pool->zpool, handle); +- put_cpu_var(zswap_dstmem); ++ put_locked_var(zswap_dstmem_lock, zswap_dstmem); + + /* populate entry */ + entry->offset = offset; +@@ -1122,7 +1124,7 @@ static int zswap_frontswap_store(unsigned type, pgoff_t offset, + return 0; + + put_dstmem: +- put_cpu_var(zswap_dstmem); ++ put_locked_var(zswap_dstmem_lock, zswap_dstmem); + zswap_pool_put(entry->pool); + freepage: + zswap_entry_cache_free(entry); diff --git a/debian/patches-rt/0278-mm-zswap-Do-not-disable-preemption-in-zswap_frontswa.patch b/debian/patches-rt/0278-mm-zswap-Do-not-disable-preemption-in-zswap_frontswa.patch deleted file mode 100644 index b44e7ef6e..000000000 --- a/debian/patches-rt/0278-mm-zswap-Do-not-disable-preemption-in-zswap_frontswa.patch +++ /dev/null @@ -1,127 +0,0 @@ -From f41d5cdc361ba012b59e23b78fe3501b16cfda3d Mon Sep 17 00:00:00 2001 -From: "Luis Claudio R. Goncalves" -Date: Tue, 25 Jun 2019 11:28:04 -0300 -Subject: [PATCH 278/347] mm/zswap: Do not disable preemption in - zswap_frontswap_store() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 4e4cf4be79635e67144632d9135286381acbc95a ] - -Zswap causes "BUG: scheduling while atomic" by blocking on a rt_spin_lock() with -preemption disabled. The preemption is disabled by get_cpu_var() in -zswap_frontswap_store() to protect the access of the zswap_dstmem percpu variable. - -Use get_locked_var() to protect the percpu zswap_dstmem variable, making the -code preemptive. - -As get_cpu_ptr() also disables preemption, replace it by this_cpu_ptr() and -remove the counterpart put_cpu_ptr(). - -Steps to Reproduce: - - 1. # grubby --args "zswap.enabled=1" --update-kernel DEFAULT - 2. # reboot - 3. Calculate the amount o memory to be used by the test: - ---> grep MemAvailable /proc/meminfo - ---> Add 25% ~ 50% to that value - 4. # stress --vm 1 --vm-bytes ${MemAvailable+25%} --timeout 240s - -Usually, in less than 5 minutes the backtrace listed below appears, followed -by a kernel panic: - -| BUG: scheduling while atomic: kswapd1/181/0x00000002 -| -| Preemption disabled at: -| [] zswap_frontswap_store+0x21a/0x6e1 -| -| Kernel panic - not syncing: scheduling while atomic -| CPU: 14 PID: 181 Comm: kswapd1 Kdump: loaded Not tainted 5.0.14-rt9 #1 -| Hardware name: AMD Pence/Pence, BIOS WPN2321X_Weekly_12_03_21 03/19/2012 -| Call Trace: -| panic+0x106/0x2a7 -| __schedule_bug.cold+0x3f/0x51 -| __schedule+0x5cb/0x6f0 -| schedule+0x43/0xd0 -| rt_spin_lock_slowlock_locked+0x114/0x2b0 -| rt_spin_lock_slowlock+0x51/0x80 -| zbud_alloc+0x1da/0x2d0 -| zswap_frontswap_store+0x31a/0x6e1 -| __frontswap_store+0xab/0x130 -| swap_writepage+0x39/0x70 -| pageout.isra.0+0xe3/0x320 -| shrink_page_list+0xa8e/0xd10 -| shrink_inactive_list+0x251/0x840 -| shrink_node_memcg+0x213/0x770 -| shrink_node+0xd9/0x450 -| balance_pgdat+0x2d5/0x510 -| kswapd+0x218/0x470 -| kthread+0xfb/0x130 -| ret_from_fork+0x27/0x50 - -Cc: stable-rt@vger.kernel.org -Reported-by: Ping Fang -Signed-off-by: Luis Claudio R. Goncalves -Reviewed-by: Daniel Bristot de Oliveira -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - mm/zswap.c | 12 +++++++----- - 1 file changed, 7 insertions(+), 5 deletions(-) - -diff --git a/mm/zswap.c b/mm/zswap.c -index cd91fd9d96b8..420225d3ff0b 100644 ---- a/mm/zswap.c -+++ b/mm/zswap.c -@@ -27,6 +27,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -990,6 +991,8 @@ static void zswap_fill_page(void *ptr, unsigned long value) - memset_l(page, value, PAGE_SIZE / sizeof(unsigned long)); - } - -+/* protect zswap_dstmem from concurrency */ -+static DEFINE_LOCAL_IRQ_LOCK(zswap_dstmem_lock); - /********************************* - * frontswap hooks - **********************************/ -@@ -1066,12 +1069,11 @@ static int zswap_frontswap_store(unsigned type, pgoff_t offset, - } - - /* compress */ -- dst = get_cpu_var(zswap_dstmem); -- tfm = *get_cpu_ptr(entry->pool->tfm); -+ dst = get_locked_var(zswap_dstmem_lock, zswap_dstmem); -+ tfm = *this_cpu_ptr(entry->pool->tfm); - src = kmap_atomic(page); - ret = crypto_comp_compress(tfm, src, PAGE_SIZE, dst, &dlen); - kunmap_atomic(src); -- put_cpu_ptr(entry->pool->tfm); - if (ret) { - ret = -EINVAL; - goto put_dstmem; -@@ -1094,7 +1096,7 @@ static int zswap_frontswap_store(unsigned type, pgoff_t offset, - memcpy(buf, &zhdr, hlen); - memcpy(buf + hlen, dst, dlen); - zpool_unmap_handle(entry->pool->zpool, handle); -- put_cpu_var(zswap_dstmem); -+ put_locked_var(zswap_dstmem_lock, zswap_dstmem); - - /* populate entry */ - entry->offset = offset; -@@ -1122,7 +1124,7 @@ static int zswap_frontswap_store(unsigned type, pgoff_t offset, - return 0; - - put_dstmem: -- put_cpu_var(zswap_dstmem); -+ put_locked_var(zswap_dstmem_lock, zswap_dstmem); - zswap_pool_put(entry->pool); - freepage: - zswap_entry_cache_free(entry); --- -2.36.1 - diff --git a/debian/patches-rt/0278-revert-aio.patch b/debian/patches-rt/0278-revert-aio.patch new file mode 100644 index 000000000..6cca2777c --- /dev/null +++ b/debian/patches-rt/0278-revert-aio.patch @@ -0,0 +1,67 @@ +From: "Steven Rostedt (VMware)" +Date: Fri, 20 Sep 2019 17:50:53 -0400 +Subject: [PATCH 278/342] revert-aio +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=3385a4e70adb04e8ac905d0b889452f53b8348cd + +revert: fs/aio: simple simple work + +Signed-off-by: Steven Rostedt (VMware) +--- + fs/aio.c | 15 ++------------- + 1 file changed, 2 insertions(+), 13 deletions(-) + +diff --git a/fs/aio.c b/fs/aio.c +index 21eacb0f3f56..9635c29b83da 100644 +--- a/fs/aio.c ++++ b/fs/aio.c +@@ -42,7 +42,6 @@ + #include + #include + #include +-#include + + #include + #include +@@ -122,7 +121,6 @@ struct kioctx { + long nr_pages; + + struct rcu_work free_rwork; /* see free_ioctx() */ +- struct swork_event free_swork; /* see free_ioctx() */ + + /* + * signals when all in-flight requests are done +@@ -269,7 +267,6 @@ static int __init aio_setup(void) + .mount = aio_mount, + .kill_sb = kill_anon_super, + }; +- BUG_ON(swork_get()); + aio_mnt = kern_mount(&aio_fs); + if (IS_ERR(aio_mnt)) + panic("Failed to create aio fs mount."); +@@ -611,9 +608,9 @@ static void free_ioctx_reqs(struct percpu_ref *ref) + * and ctx->users has dropped to 0, so we know no more kiocbs can be submitted - + * now it's safe to cancel any that need to be. + */ +-static void free_ioctx_users_work(struct swork_event *sev) ++static void free_ioctx_users(struct percpu_ref *ref) + { +- struct kioctx *ctx = container_of(sev, struct kioctx, free_swork); ++ struct kioctx *ctx = container_of(ref, struct kioctx, users); + struct aio_kiocb *req; + + spin_lock_irq(&ctx->ctx_lock); +@@ -631,14 +628,6 @@ static void free_ioctx_users_work(struct swork_event *sev) + percpu_ref_put(&ctx->reqs); + } + +-static void free_ioctx_users(struct percpu_ref *ref) +-{ +- struct kioctx *ctx = container_of(ref, struct kioctx, users); +- +- INIT_SWORK(&ctx->free_swork, free_ioctx_users_work); +- swork_queue(&ctx->free_swork); +-} +- + static int ioctx_add_table(struct kioctx *ctx, struct mm_struct *mm) + { + unsigned i, new_nr; diff --git a/debian/patches-rt/0279-fs-aio-simple-simple-work.patch b/debian/patches-rt/0279-fs-aio-simple-simple-work.patch new file mode 100644 index 000000000..a7752d7d2 --- /dev/null +++ b/debian/patches-rt/0279-fs-aio-simple-simple-work.patch @@ -0,0 +1,72 @@ +From: Sebastian Andrzej Siewior +Date: Mon, 16 Feb 2015 18:49:10 +0100 +Subject: [PATCH 279/342] fs/aio: simple simple work +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=f620c96e59582f313de1000b3bebf41c6ee7d382 + +[ Upstream commit 1a142116f6435ef070ecebb66d2d599507c10601 ] + +|BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:768 +|in_atomic(): 1, irqs_disabled(): 0, pid: 26, name: rcuos/2 +|2 locks held by rcuos/2/26: +| #0: (rcu_callback){.+.+..}, at: [] rcu_nocb_kthread+0x1e2/0x380 +| #1: (rcu_read_lock_sched){.+.+..}, at: [] percpu_ref_kill_rcu+0xa6/0x1c0 +|Preemption disabled at:[] rcu_nocb_kthread+0x263/0x380 +|Call Trace: +| [] dump_stack+0x4e/0x9c +| [] __might_sleep+0xfb/0x170 +| [] rt_spin_lock+0x24/0x70 +| [] free_ioctx_users+0x30/0x130 +| [] percpu_ref_kill_rcu+0x1b4/0x1c0 +| [] rcu_nocb_kthread+0x263/0x380 +| [] kthread+0xd6/0xf0 +| [] ret_from_fork+0x7c/0xb0 + +replace this preempt_disable() friendly swork. + +Reported-By: Mike Galbraith +Suggested-by: Benjamin LaHaise +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + fs/aio.c | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +diff --git a/fs/aio.c b/fs/aio.c +index 9635c29b83da..303e85033965 100644 +--- a/fs/aio.c ++++ b/fs/aio.c +@@ -121,6 +121,7 @@ struct kioctx { + long nr_pages; + + struct rcu_work free_rwork; /* see free_ioctx() */ ++ struct kthread_work free_kwork; /* see free_ioctx() */ + + /* + * signals when all in-flight requests are done +@@ -608,9 +609,9 @@ static void free_ioctx_reqs(struct percpu_ref *ref) + * and ctx->users has dropped to 0, so we know no more kiocbs can be submitted - + * now it's safe to cancel any that need to be. + */ +-static void free_ioctx_users(struct percpu_ref *ref) ++static void free_ioctx_users_work(struct kthread_work *work) + { +- struct kioctx *ctx = container_of(ref, struct kioctx, users); ++ struct kioctx *ctx = container_of(work, struct kioctx, free_kwork); + struct aio_kiocb *req; + + spin_lock_irq(&ctx->ctx_lock); +@@ -628,6 +629,14 @@ static void free_ioctx_users(struct percpu_ref *ref) + percpu_ref_put(&ctx->reqs); + } + ++static void free_ioctx_users(struct percpu_ref *ref) ++{ ++ struct kioctx *ctx = container_of(ref, struct kioctx, users); ++ ++ kthread_init_work(&ctx->free_kwork, free_ioctx_users_work); ++ kthread_schedule_work(&ctx->free_kwork); ++} ++ + static int ioctx_add_table(struct kioctx *ctx, struct mm_struct *mm) + { + unsigned i, new_nr; diff --git a/debian/patches-rt/0279-revert-aio.patch b/debian/patches-rt/0279-revert-aio.patch deleted file mode 100644 index 2473add45..000000000 --- a/debian/patches-rt/0279-revert-aio.patch +++ /dev/null @@ -1,71 +0,0 @@ -From f543c9a26aefcba7e267ea5d79ee00bcf6679b50 Mon Sep 17 00:00:00 2001 -From: "Steven Rostedt (VMware)" -Date: Fri, 20 Sep 2019 17:50:53 -0400 -Subject: [PATCH 279/347] revert-aio -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -revert: fs/aio: simple simple work - -Signed-off-by: Steven Rostedt (VMware) ---- - fs/aio.c | 15 ++------------- - 1 file changed, 2 insertions(+), 13 deletions(-) - -diff --git a/fs/aio.c b/fs/aio.c -index 21eacb0f3f56..9635c29b83da 100644 ---- a/fs/aio.c -+++ b/fs/aio.c -@@ -42,7 +42,6 @@ - #include - #include - #include --#include - - #include - #include -@@ -122,7 +121,6 @@ struct kioctx { - long nr_pages; - - struct rcu_work free_rwork; /* see free_ioctx() */ -- struct swork_event free_swork; /* see free_ioctx() */ - - /* - * signals when all in-flight requests are done -@@ -269,7 +267,6 @@ static int __init aio_setup(void) - .mount = aio_mount, - .kill_sb = kill_anon_super, - }; -- BUG_ON(swork_get()); - aio_mnt = kern_mount(&aio_fs); - if (IS_ERR(aio_mnt)) - panic("Failed to create aio fs mount."); -@@ -611,9 +608,9 @@ static void free_ioctx_reqs(struct percpu_ref *ref) - * and ctx->users has dropped to 0, so we know no more kiocbs can be submitted - - * now it's safe to cancel any that need to be. - */ --static void free_ioctx_users_work(struct swork_event *sev) -+static void free_ioctx_users(struct percpu_ref *ref) - { -- struct kioctx *ctx = container_of(sev, struct kioctx, free_swork); -+ struct kioctx *ctx = container_of(ref, struct kioctx, users); - struct aio_kiocb *req; - - spin_lock_irq(&ctx->ctx_lock); -@@ -631,14 +628,6 @@ static void free_ioctx_users_work(struct swork_event *sev) - percpu_ref_put(&ctx->reqs); - } - --static void free_ioctx_users(struct percpu_ref *ref) --{ -- struct kioctx *ctx = container_of(ref, struct kioctx, users); -- -- INIT_SWORK(&ctx->free_swork, free_ioctx_users_work); -- swork_queue(&ctx->free_swork); --} -- - static int ioctx_add_table(struct kioctx *ctx, struct mm_struct *mm) - { - unsigned i, new_nr; --- -2.36.1 - diff --git a/debian/patches-rt/0280-fs-aio-simple-simple-work.patch b/debian/patches-rt/0280-fs-aio-simple-simple-work.patch deleted file mode 100644 index 8bbb8340f..000000000 --- a/debian/patches-rt/0280-fs-aio-simple-simple-work.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 238624153731bac8138142a9d688f5b51a5f70fe Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Mon, 16 Feb 2015 18:49:10 +0100 -Subject: [PATCH 280/347] fs/aio: simple simple work -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 1a142116f6435ef070ecebb66d2d599507c10601 ] - -|BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:768 -|in_atomic(): 1, irqs_disabled(): 0, pid: 26, name: rcuos/2 -|2 locks held by rcuos/2/26: -| #0: (rcu_callback){.+.+..}, at: [] rcu_nocb_kthread+0x1e2/0x380 -| #1: (rcu_read_lock_sched){.+.+..}, at: [] percpu_ref_kill_rcu+0xa6/0x1c0 -|Preemption disabled at:[] rcu_nocb_kthread+0x263/0x380 -|Call Trace: -| [] dump_stack+0x4e/0x9c -| [] __might_sleep+0xfb/0x170 -| [] rt_spin_lock+0x24/0x70 -| [] free_ioctx_users+0x30/0x130 -| [] percpu_ref_kill_rcu+0x1b4/0x1c0 -| [] rcu_nocb_kthread+0x263/0x380 -| [] kthread+0xd6/0xf0 -| [] ret_from_fork+0x7c/0xb0 - -replace this preempt_disable() friendly swork. - -Reported-By: Mike Galbraith -Suggested-by: Benjamin LaHaise -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - fs/aio.c | 13 +++++++++++-- - 1 file changed, 11 insertions(+), 2 deletions(-) - -diff --git a/fs/aio.c b/fs/aio.c -index 9635c29b83da..303e85033965 100644 ---- a/fs/aio.c -+++ b/fs/aio.c -@@ -121,6 +121,7 @@ struct kioctx { - long nr_pages; - - struct rcu_work free_rwork; /* see free_ioctx() */ -+ struct kthread_work free_kwork; /* see free_ioctx() */ - - /* - * signals when all in-flight requests are done -@@ -608,9 +609,9 @@ static void free_ioctx_reqs(struct percpu_ref *ref) - * and ctx->users has dropped to 0, so we know no more kiocbs can be submitted - - * now it's safe to cancel any that need to be. - */ --static void free_ioctx_users(struct percpu_ref *ref) -+static void free_ioctx_users_work(struct kthread_work *work) - { -- struct kioctx *ctx = container_of(ref, struct kioctx, users); -+ struct kioctx *ctx = container_of(work, struct kioctx, free_kwork); - struct aio_kiocb *req; - - spin_lock_irq(&ctx->ctx_lock); -@@ -628,6 +629,14 @@ static void free_ioctx_users(struct percpu_ref *ref) - percpu_ref_put(&ctx->reqs); - } - -+static void free_ioctx_users(struct percpu_ref *ref) -+{ -+ struct kioctx *ctx = container_of(ref, struct kioctx, users); -+ -+ kthread_init_work(&ctx->free_kwork, free_ioctx_users_work); -+ kthread_schedule_work(&ctx->free_kwork); -+} -+ - static int ioctx_add_table(struct kioctx *ctx, struct mm_struct *mm) - { - unsigned i, new_nr; --- -2.36.1 - diff --git a/debian/patches-rt/0280-revert-thermal.patch b/debian/patches-rt/0280-revert-thermal.patch new file mode 100644 index 000000000..ef4bca6e0 --- /dev/null +++ b/debian/patches-rt/0280-revert-thermal.patch @@ -0,0 +1,116 @@ +From: "Steven Rostedt (VMware)" +Date: Fri, 20 Sep 2019 17:50:53 -0400 +Subject: [PATCH 280/342] revert-thermal +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=889019b2cc23787f62b86f2a97fdb25dd13861d5 + +Revert: thermal: Defer thermal wakups to threads + +Signed-off-by: Steven Rostedt (VMware) +--- + drivers/thermal/x86_pkg_temp_thermal.c | 52 ++------------------------ + 1 file changed, 3 insertions(+), 49 deletions(-) + +diff --git a/drivers/thermal/x86_pkg_temp_thermal.c b/drivers/thermal/x86_pkg_temp_thermal.c +index a5991cbb408f..1ef937d799e4 100644 +--- a/drivers/thermal/x86_pkg_temp_thermal.c ++++ b/drivers/thermal/x86_pkg_temp_thermal.c +@@ -29,7 +29,6 @@ + #include + #include + #include +-#include + #include + #include + +@@ -330,7 +329,7 @@ static void pkg_thermal_schedule_work(int cpu, struct delayed_work *work) + schedule_delayed_work_on(cpu, work, ms); + } + +-static void pkg_thermal_notify_work(struct swork_event *event) ++static int pkg_thermal_notify(u64 msr_val) + { + int cpu = smp_processor_id(); + struct pkg_device *pkgdev; +@@ -349,47 +348,9 @@ static void pkg_thermal_notify_work(struct swork_event *event) + } + + spin_unlock_irqrestore(&pkg_temp_lock, flags); +-} +- +-#ifdef CONFIG_PREEMPT_RT_FULL +-static struct swork_event notify_work; +- +-static int pkg_thermal_notify_work_init(void) +-{ +- int err; +- +- err = swork_get(); +- if (err) +- return err; +- +- INIT_SWORK(¬ify_work, pkg_thermal_notify_work); + return 0; + } + +-static void pkg_thermal_notify_work_cleanup(void) +-{ +- swork_put(); +-} +- +-static int pkg_thermal_notify(u64 msr_val) +-{ +- swork_queue(¬ify_work); +- return 0; +-} +- +-#else /* !CONFIG_PREEMPT_RT_FULL */ +- +-static int pkg_thermal_notify_work_init(void) { return 0; } +- +-static void pkg_thermal_notify_work_cleanup(void) { } +- +-static int pkg_thermal_notify(u64 msr_val) +-{ +- pkg_thermal_notify_work(NULL); +- return 0; +-} +-#endif /* CONFIG_PREEMPT_RT_FULL */ +- + static int pkg_temp_thermal_device_add(unsigned int cpu) + { + int pkgid = topology_logical_package_id(cpu); +@@ -554,16 +515,11 @@ static int __init pkg_temp_thermal_init(void) + if (!x86_match_cpu(pkg_temp_thermal_ids)) + return -ENODEV; + +- if (!pkg_thermal_notify_work_init()) +- return -ENODEV; +- + max_packages = topology_max_packages(); + packages = kcalloc(max_packages, sizeof(struct pkg_device *), + GFP_KERNEL); +- if (!packages) { +- ret = -ENOMEM; +- goto err; +- } ++ if (!packages) ++ return -ENOMEM; + + ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "thermal/x86_pkg:online", + pkg_thermal_cpu_online, pkg_thermal_cpu_offline); +@@ -581,7 +537,6 @@ static int __init pkg_temp_thermal_init(void) + return 0; + + err: +- pkg_thermal_notify_work_cleanup(); + kfree(packages); + return ret; + } +@@ -595,7 +550,6 @@ static void __exit pkg_temp_thermal_exit(void) + cpuhp_remove_state(pkg_thermal_hp_state); + debugfs_remove_recursive(debugfs); + kfree(packages); +- pkg_thermal_notify_work_cleanup(); + } + module_exit(pkg_temp_thermal_exit) + diff --git a/debian/patches-rt/0281-revert-thermal.patch b/debian/patches-rt/0281-revert-thermal.patch deleted file mode 100644 index eb35b59a3..000000000 --- a/debian/patches-rt/0281-revert-thermal.patch +++ /dev/null @@ -1,120 +0,0 @@ -From 0e238fd1114bbb3f58ef4d2c32558d13f7ba6b75 Mon Sep 17 00:00:00 2001 -From: "Steven Rostedt (VMware)" -Date: Fri, 20 Sep 2019 17:50:53 -0400 -Subject: [PATCH 281/347] revert-thermal -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -Revert: thermal: Defer thermal wakups to threads - -Signed-off-by: Steven Rostedt (VMware) ---- - drivers/thermal/x86_pkg_temp_thermal.c | 52 ++------------------------ - 1 file changed, 3 insertions(+), 49 deletions(-) - -diff --git a/drivers/thermal/x86_pkg_temp_thermal.c b/drivers/thermal/x86_pkg_temp_thermal.c -index a5991cbb408f..1ef937d799e4 100644 ---- a/drivers/thermal/x86_pkg_temp_thermal.c -+++ b/drivers/thermal/x86_pkg_temp_thermal.c -@@ -29,7 +29,6 @@ - #include - #include - #include --#include - #include - #include - -@@ -330,7 +329,7 @@ static void pkg_thermal_schedule_work(int cpu, struct delayed_work *work) - schedule_delayed_work_on(cpu, work, ms); - } - --static void pkg_thermal_notify_work(struct swork_event *event) -+static int pkg_thermal_notify(u64 msr_val) - { - int cpu = smp_processor_id(); - struct pkg_device *pkgdev; -@@ -349,47 +348,9 @@ static void pkg_thermal_notify_work(struct swork_event *event) - } - - spin_unlock_irqrestore(&pkg_temp_lock, flags); --} -- --#ifdef CONFIG_PREEMPT_RT_FULL --static struct swork_event notify_work; -- --static int pkg_thermal_notify_work_init(void) --{ -- int err; -- -- err = swork_get(); -- if (err) -- return err; -- -- INIT_SWORK(¬ify_work, pkg_thermal_notify_work); - return 0; - } - --static void pkg_thermal_notify_work_cleanup(void) --{ -- swork_put(); --} -- --static int pkg_thermal_notify(u64 msr_val) --{ -- swork_queue(¬ify_work); -- return 0; --} -- --#else /* !CONFIG_PREEMPT_RT_FULL */ -- --static int pkg_thermal_notify_work_init(void) { return 0; } -- --static void pkg_thermal_notify_work_cleanup(void) { } -- --static int pkg_thermal_notify(u64 msr_val) --{ -- pkg_thermal_notify_work(NULL); -- return 0; --} --#endif /* CONFIG_PREEMPT_RT_FULL */ -- - static int pkg_temp_thermal_device_add(unsigned int cpu) - { - int pkgid = topology_logical_package_id(cpu); -@@ -554,16 +515,11 @@ static int __init pkg_temp_thermal_init(void) - if (!x86_match_cpu(pkg_temp_thermal_ids)) - return -ENODEV; - -- if (!pkg_thermal_notify_work_init()) -- return -ENODEV; -- - max_packages = topology_max_packages(); - packages = kcalloc(max_packages, sizeof(struct pkg_device *), - GFP_KERNEL); -- if (!packages) { -- ret = -ENOMEM; -- goto err; -- } -+ if (!packages) -+ return -ENOMEM; - - ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "thermal/x86_pkg:online", - pkg_thermal_cpu_online, pkg_thermal_cpu_offline); -@@ -581,7 +537,6 @@ static int __init pkg_temp_thermal_init(void) - return 0; - - err: -- pkg_thermal_notify_work_cleanup(); - kfree(packages); - return ret; - } -@@ -595,7 +550,6 @@ static void __exit pkg_temp_thermal_exit(void) - cpuhp_remove_state(pkg_thermal_hp_state); - debugfs_remove_recursive(debugfs); - kfree(packages); -- pkg_thermal_notify_work_cleanup(); - } - module_exit(pkg_temp_thermal_exit) - --- -2.36.1 - diff --git a/debian/patches-rt/0281-thermal-Defer-thermal-wakups-to-threads.patch b/debian/patches-rt/0281-thermal-Defer-thermal-wakups-to-threads.patch new file mode 100644 index 000000000..8f7a05e42 --- /dev/null +++ b/debian/patches-rt/0281-thermal-Defer-thermal-wakups-to-threads.patch @@ -0,0 +1,94 @@ +From: Daniel Wagner +Date: Tue, 17 Feb 2015 09:37:44 +0100 +Subject: [PATCH 281/342] thermal: Defer thermal wakups to threads +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=37fb59a4561847466dd2ca567dfab731f99f9611 + +[ Upstream commit ad2408dc248fe58536eef5b2b5734d8f9d3a280b ] + +On RT the spin lock in pkg_temp_thermal_platfrom_thermal_notify will +call schedule while we run in irq context. + +[] dump_stack+0x4e/0x8f +[] __schedule_bug+0xa6/0xb4 +[] __schedule+0x5b4/0x700 +[] schedule+0x2a/0x90 +[] rt_spin_lock_slowlock+0xe5/0x2d0 +[] rt_spin_lock+0x25/0x30 +[] pkg_temp_thermal_platform_thermal_notify+0x45/0x134 [x86_pkg_temp_thermal] +[] ? therm_throt_process+0x1b/0x160 +[] intel_thermal_interrupt+0x211/0x250 +[] smp_thermal_interrupt+0x21/0x40 +[] thermal_interrupt+0x6d/0x80 + +Let's defer the work to a kthread. + +Signed-off-by: Daniel Wagner +Signed-off-by: Steven Rostedt (VMware) +[bigeasy: reoder init/denit position. TODO: flush swork on exit] +Signed-off-by: Sebastian Andrzej Siewior +--- + drivers/thermal/x86_pkg_temp_thermal.c | 28 +++++++++++++++++++++++++- + 1 file changed, 27 insertions(+), 1 deletion(-) + +diff --git a/drivers/thermal/x86_pkg_temp_thermal.c b/drivers/thermal/x86_pkg_temp_thermal.c +index 1ef937d799e4..82f21fd4afb0 100644 +--- a/drivers/thermal/x86_pkg_temp_thermal.c ++++ b/drivers/thermal/x86_pkg_temp_thermal.c +@@ -29,6 +29,7 @@ + #include + #include + #include ++#include + #include + #include + +@@ -329,7 +330,7 @@ static void pkg_thermal_schedule_work(int cpu, struct delayed_work *work) + schedule_delayed_work_on(cpu, work, ms); + } + +-static int pkg_thermal_notify(u64 msr_val) ++static void pkg_thermal_notify_work(struct kthread_work *work) + { + int cpu = smp_processor_id(); + struct pkg_device *pkgdev; +@@ -348,8 +349,32 @@ static int pkg_thermal_notify(u64 msr_val) + } + + spin_unlock_irqrestore(&pkg_temp_lock, flags); ++} ++ ++#ifdef CONFIG_PREEMPT_RT_FULL ++static DEFINE_KTHREAD_WORK(notify_work, pkg_thermal_notify_work); ++ ++static int pkg_thermal_notify(u64 msr_val) ++{ ++ kthread_schedule_work(¬ify_work); ++ return 0; ++} ++ ++static void pkg_thermal_notify_flush(void) ++{ ++ kthread_flush_work(¬ify_work); ++} ++ ++#else /* !CONFIG_PREEMPT_RT_FULL */ ++ ++static void pkg_thermal_notify_flush(void) { } ++ ++static int pkg_thermal_notify(u64 msr_val) ++{ ++ pkg_thermal_notify_work(NULL); + return 0; + } ++#endif /* CONFIG_PREEMPT_RT_FULL */ + + static int pkg_temp_thermal_device_add(unsigned int cpu) + { +@@ -548,6 +573,7 @@ static void __exit pkg_temp_thermal_exit(void) + platform_thermal_package_rate_control = NULL; + + cpuhp_remove_state(pkg_thermal_hp_state); ++ pkg_thermal_notify_flush(); + debugfs_remove_recursive(debugfs); + kfree(packages); + } diff --git a/debian/patches-rt/0282-revert-block.patch b/debian/patches-rt/0282-revert-block.patch new file mode 100644 index 000000000..dd7be9b97 --- /dev/null +++ b/debian/patches-rt/0282-revert-block.patch @@ -0,0 +1,79 @@ +From: "Steven Rostedt (VMware)" +Date: Fri, 20 Sep 2019 17:50:54 -0400 +Subject: [PATCH 282/342] revert-block +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=e13e0ac0a7e8bc9f08dae4cab727db6ad6ee35a4 + +Revert swork version of: block: blk-mq: move blk_queue_usage_counter_release() into process context + +In order to switch to upstream, we need to revert the swork code. + +Signed-off-by: Steven Rostedt (VMware) +--- + block/blk-core.c | 14 +------------- + include/linux/blkdev.h | 2 -- + 2 files changed, 1 insertion(+), 15 deletions(-) + +diff --git a/block/blk-core.c b/block/blk-core.c +index 02835970ef1e..461a93c08c14 100644 +--- a/block/blk-core.c ++++ b/block/blk-core.c +@@ -973,21 +973,12 @@ void blk_queue_exit(struct request_queue *q) + percpu_ref_put(&q->q_usage_counter); + } + +-static void blk_queue_usage_counter_release_swork(struct swork_event *sev) +-{ +- struct request_queue *q = +- container_of(sev, struct request_queue, mq_pcpu_wake); +- +- wake_up_all(&q->mq_freeze_wq); +-} +- + static void blk_queue_usage_counter_release(struct percpu_ref *ref) + { + struct request_queue *q = + container_of(ref, struct request_queue, q_usage_counter); + +- if (wq_has_sleeper(&q->mq_freeze_wq)) +- swork_queue(&q->mq_pcpu_wake); ++ wake_up_all(&q->mq_freeze_wq); + } + + static void blk_rq_timed_out_timer(struct timer_list *t) +@@ -1087,7 +1078,6 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id, + queue_flag_set_unlocked(QUEUE_FLAG_BYPASS, q); + + init_waitqueue_head(&q->mq_freeze_wq); +- INIT_SWORK(&q->mq_pcpu_wake, blk_queue_usage_counter_release_swork); + + /* + * Init percpu_ref in atomic mode so that it's faster to shutdown. +@@ -3977,8 +3967,6 @@ int __init blk_dev_init(void) + if (!kblockd_workqueue) + panic("Failed to create kblockd\n"); + +- BUG_ON(swork_get()); +- + request_cachep = kmem_cache_create("blkdev_requests", + sizeof(struct request), 0, SLAB_PANIC, NULL); + +diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h +index 0313098a428d..39d90bf9b5fa 100644 +--- a/include/linux/blkdev.h ++++ b/include/linux/blkdev.h +@@ -27,7 +27,6 @@ + #include + #include + #include +-#include + + struct module; + struct scsi_ioctl_command; +@@ -665,7 +664,6 @@ struct request_queue { + #endif + struct rcu_head rcu_head; + wait_queue_head_t mq_freeze_wq; +- struct swork_event mq_pcpu_wake; + struct percpu_ref q_usage_counter; + struct list_head all_q_node; + diff --git a/debian/patches-rt/0282-thermal-Defer-thermal-wakups-to-threads.patch b/debian/patches-rt/0282-thermal-Defer-thermal-wakups-to-threads.patch deleted file mode 100644 index c87c2c1ee..000000000 --- a/debian/patches-rt/0282-thermal-Defer-thermal-wakups-to-threads.patch +++ /dev/null @@ -1,98 +0,0 @@ -From 260167472319caeab60ece36de5dcd04ef245df5 Mon Sep 17 00:00:00 2001 -From: Daniel Wagner -Date: Tue, 17 Feb 2015 09:37:44 +0100 -Subject: [PATCH 282/347] thermal: Defer thermal wakups to threads -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit ad2408dc248fe58536eef5b2b5734d8f9d3a280b ] - -On RT the spin lock in pkg_temp_thermal_platfrom_thermal_notify will -call schedule while we run in irq context. - -[] dump_stack+0x4e/0x8f -[] __schedule_bug+0xa6/0xb4 -[] __schedule+0x5b4/0x700 -[] schedule+0x2a/0x90 -[] rt_spin_lock_slowlock+0xe5/0x2d0 -[] rt_spin_lock+0x25/0x30 -[] pkg_temp_thermal_platform_thermal_notify+0x45/0x134 [x86_pkg_temp_thermal] -[] ? therm_throt_process+0x1b/0x160 -[] intel_thermal_interrupt+0x211/0x250 -[] smp_thermal_interrupt+0x21/0x40 -[] thermal_interrupt+0x6d/0x80 - -Let's defer the work to a kthread. - -Signed-off-by: Daniel Wagner -Signed-off-by: Steven Rostedt (VMware) -[bigeasy: reoder init/denit position. TODO: flush swork on exit] -Signed-off-by: Sebastian Andrzej Siewior ---- - drivers/thermal/x86_pkg_temp_thermal.c | 28 +++++++++++++++++++++++++- - 1 file changed, 27 insertions(+), 1 deletion(-) - -diff --git a/drivers/thermal/x86_pkg_temp_thermal.c b/drivers/thermal/x86_pkg_temp_thermal.c -index 1ef937d799e4..82f21fd4afb0 100644 ---- a/drivers/thermal/x86_pkg_temp_thermal.c -+++ b/drivers/thermal/x86_pkg_temp_thermal.c -@@ -29,6 +29,7 @@ - #include - #include - #include -+#include - #include - #include - -@@ -329,7 +330,7 @@ static void pkg_thermal_schedule_work(int cpu, struct delayed_work *work) - schedule_delayed_work_on(cpu, work, ms); - } - --static int pkg_thermal_notify(u64 msr_val) -+static void pkg_thermal_notify_work(struct kthread_work *work) - { - int cpu = smp_processor_id(); - struct pkg_device *pkgdev; -@@ -348,8 +349,32 @@ static int pkg_thermal_notify(u64 msr_val) - } - - spin_unlock_irqrestore(&pkg_temp_lock, flags); -+} -+ -+#ifdef CONFIG_PREEMPT_RT_FULL -+static DEFINE_KTHREAD_WORK(notify_work, pkg_thermal_notify_work); -+ -+static int pkg_thermal_notify(u64 msr_val) -+{ -+ kthread_schedule_work(¬ify_work); -+ return 0; -+} -+ -+static void pkg_thermal_notify_flush(void) -+{ -+ kthread_flush_work(¬ify_work); -+} -+ -+#else /* !CONFIG_PREEMPT_RT_FULL */ -+ -+static void pkg_thermal_notify_flush(void) { } -+ -+static int pkg_thermal_notify(u64 msr_val) -+{ -+ pkg_thermal_notify_work(NULL); - return 0; - } -+#endif /* CONFIG_PREEMPT_RT_FULL */ - - static int pkg_temp_thermal_device_add(unsigned int cpu) - { -@@ -548,6 +573,7 @@ static void __exit pkg_temp_thermal_exit(void) - platform_thermal_package_rate_control = NULL; - - cpuhp_remove_state(pkg_thermal_hp_state); -+ pkg_thermal_notify_flush(); - debugfs_remove_recursive(debugfs); - kfree(packages); - } --- -2.36.1 - diff --git a/debian/patches-rt/0283-block-blk-mq-move-blk_queue_usage_counter_release-in.patch b/debian/patches-rt/0283-block-blk-mq-move-blk_queue_usage_counter_release-in.patch new file mode 100644 index 000000000..957d8d5d8 --- /dev/null +++ b/debian/patches-rt/0283-block-blk-mq-move-blk_queue_usage_counter_release-in.patch @@ -0,0 +1,110 @@ +From: Sebastian Andrzej Siewior +Date: Tue, 13 Mar 2018 13:49:16 +0100 +Subject: [PATCH 283/342] block: blk-mq: move blk_queue_usage_counter_release() + into process context +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=99bc7e0dc93da8bfa71231dc359276a09819c7e6 + +[ Upstream commit 61c928ecf4fe200bda9b49a0813b5ba0f43995b5 ] + +| BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:914 +| in_atomic(): 1, irqs_disabled(): 0, pid: 255, name: kworker/u257:6 +| 5 locks held by kworker/u257:6/255: +| #0: ("events_unbound"){.+.+.+}, at: [] process_one_work+0x171/0x5e0 +| #1: ((&entry->work)){+.+.+.}, at: [] process_one_work+0x171/0x5e0 +| #2: (&shost->scan_mutex){+.+.+.}, at: [] __scsi_add_device+0xa3/0x130 [scsi_mod] +| #3: (&set->tag_list_lock){+.+...}, at: [] blk_mq_init_queue+0x96a/0xa50 +| #4: (rcu_read_lock_sched){......}, at: [] percpu_ref_kill_and_confirm+0x1d/0x120 +| Preemption disabled at:[] blk_mq_freeze_queue_start+0x56/0x70 +| +| CPU: 2 PID: 255 Comm: kworker/u257:6 Not tainted 3.18.7-rt0+ #1 +| Workqueue: events_unbound async_run_entry_fn +| 0000000000000003 ffff8800bc29f998 ffffffff815b3a12 0000000000000000 +| 0000000000000000 ffff8800bc29f9b8 ffffffff8109aa16 ffff8800bc29fa28 +| ffff8800bc5d1bc8 ffff8800bc29f9e8 ffffffff815b8dd4 ffff880000000000 +| Call Trace: +| [] dump_stack+0x4f/0x7c +| [] __might_sleep+0x116/0x190 +| [] rt_spin_lock+0x24/0x60 +| [] __wake_up+0x29/0x60 +| [] blk_mq_usage_counter_release+0x1e/0x20 +| [] percpu_ref_kill_and_confirm+0x106/0x120 +| [] blk_mq_freeze_queue_start+0x56/0x70 +| [] blk_mq_update_tag_set_depth+0x40/0xd0 +| [] blk_mq_init_queue+0x98c/0xa50 +| [] scsi_mq_alloc_queue+0x20/0x60 [scsi_mod] +| [] scsi_alloc_sdev+0x2f5/0x370 [scsi_mod] +| [] scsi_probe_and_add_lun+0x9e4/0xdd0 [scsi_mod] +| [] __scsi_add_device+0x126/0x130 [scsi_mod] +| [] ata_scsi_scan_host+0xaf/0x200 [libata] +| [] async_port_probe+0x46/0x60 [libata] +| [] async_run_entry_fn+0x3b/0xf0 +| [] process_one_work+0x201/0x5e0 + +percpu_ref_kill_and_confirm() invokes blk_mq_usage_counter_release() in +a rcu-sched region. swait based wake queue can't be used due to +wake_up_all() usage and disabled interrupts in !RT configs (as reported +by Corey Minyard). +The wq_has_sleeper() check has been suggested by Peter Zijlstra. + +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + block/blk-core.c | 12 +++++++++++- + include/linux/blkdev.h | 2 ++ + 2 files changed, 13 insertions(+), 1 deletion(-) + +diff --git a/block/blk-core.c b/block/blk-core.c +index 461a93c08c14..a67a50dd714a 100644 +--- a/block/blk-core.c ++++ b/block/blk-core.c +@@ -973,12 +973,21 @@ void blk_queue_exit(struct request_queue *q) + percpu_ref_put(&q->q_usage_counter); + } + ++static void blk_queue_usage_counter_release_wrk(struct kthread_work *work) ++{ ++ struct request_queue *q = ++ container_of(work, struct request_queue, mq_pcpu_wake); ++ ++ wake_up_all(&q->mq_freeze_wq); ++} ++ + static void blk_queue_usage_counter_release(struct percpu_ref *ref) + { + struct request_queue *q = + container_of(ref, struct request_queue, q_usage_counter); + +- wake_up_all(&q->mq_freeze_wq); ++ if (wq_has_sleeper(&q->mq_freeze_wq)) ++ kthread_schedule_work(&q->mq_pcpu_wake); + } + + static void blk_rq_timed_out_timer(struct timer_list *t) +@@ -1078,6 +1087,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id, + queue_flag_set_unlocked(QUEUE_FLAG_BYPASS, q); + + init_waitqueue_head(&q->mq_freeze_wq); ++ kthread_init_work(&q->mq_pcpu_wake, blk_queue_usage_counter_release_wrk); + + /* + * Init percpu_ref in atomic mode so that it's faster to shutdown. +diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h +index 39d90bf9b5fa..5566d0049c22 100644 +--- a/include/linux/blkdev.h ++++ b/include/linux/blkdev.h +@@ -13,6 +13,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -664,6 +665,7 @@ struct request_queue { + #endif + struct rcu_head rcu_head; + wait_queue_head_t mq_freeze_wq; ++ struct kthread_work mq_pcpu_wake; + struct percpu_ref q_usage_counter; + struct list_head all_q_node; + diff --git a/debian/patches-rt/0283-revert-block.patch b/debian/patches-rt/0283-revert-block.patch deleted file mode 100644 index 71ddf1806..000000000 --- a/debian/patches-rt/0283-revert-block.patch +++ /dev/null @@ -1,83 +0,0 @@ -From aceaba22f9a9db0bf15d1a63ca7d08080314f7b0 Mon Sep 17 00:00:00 2001 -From: "Steven Rostedt (VMware)" -Date: Fri, 20 Sep 2019 17:50:54 -0400 -Subject: [PATCH 283/347] revert-block -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -Revert swork version of: block: blk-mq: move blk_queue_usage_counter_release() into process context - -In order to switch to upstream, we need to revert the swork code. - -Signed-off-by: Steven Rostedt (VMware) ---- - block/blk-core.c | 14 +------------- - include/linux/blkdev.h | 2 -- - 2 files changed, 1 insertion(+), 15 deletions(-) - -diff --git a/block/blk-core.c b/block/blk-core.c -index 02835970ef1e..461a93c08c14 100644 ---- a/block/blk-core.c -+++ b/block/blk-core.c -@@ -973,21 +973,12 @@ void blk_queue_exit(struct request_queue *q) - percpu_ref_put(&q->q_usage_counter); - } - --static void blk_queue_usage_counter_release_swork(struct swork_event *sev) --{ -- struct request_queue *q = -- container_of(sev, struct request_queue, mq_pcpu_wake); -- -- wake_up_all(&q->mq_freeze_wq); --} -- - static void blk_queue_usage_counter_release(struct percpu_ref *ref) - { - struct request_queue *q = - container_of(ref, struct request_queue, q_usage_counter); - -- if (wq_has_sleeper(&q->mq_freeze_wq)) -- swork_queue(&q->mq_pcpu_wake); -+ wake_up_all(&q->mq_freeze_wq); - } - - static void blk_rq_timed_out_timer(struct timer_list *t) -@@ -1087,7 +1078,6 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id, - queue_flag_set_unlocked(QUEUE_FLAG_BYPASS, q); - - init_waitqueue_head(&q->mq_freeze_wq); -- INIT_SWORK(&q->mq_pcpu_wake, blk_queue_usage_counter_release_swork); - - /* - * Init percpu_ref in atomic mode so that it's faster to shutdown. -@@ -3977,8 +3967,6 @@ int __init blk_dev_init(void) - if (!kblockd_workqueue) - panic("Failed to create kblockd\n"); - -- BUG_ON(swork_get()); -- - request_cachep = kmem_cache_create("blkdev_requests", - sizeof(struct request), 0, SLAB_PANIC, NULL); - -diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h -index 0313098a428d..39d90bf9b5fa 100644 ---- a/include/linux/blkdev.h -+++ b/include/linux/blkdev.h -@@ -27,7 +27,6 @@ - #include - #include - #include --#include - - struct module; - struct scsi_ioctl_command; -@@ -665,7 +664,6 @@ struct request_queue { - #endif - struct rcu_head rcu_head; - wait_queue_head_t mq_freeze_wq; -- struct swork_event mq_pcpu_wake; - struct percpu_ref q_usage_counter; - struct list_head all_q_node; - --- -2.36.1 - diff --git a/debian/patches-rt/0284-block-blk-mq-move-blk_queue_usage_counter_release-in.patch b/debian/patches-rt/0284-block-blk-mq-move-blk_queue_usage_counter_release-in.patch deleted file mode 100644 index 97f2bf9b8..000000000 --- a/debian/patches-rt/0284-block-blk-mq-move-blk_queue_usage_counter_release-in.patch +++ /dev/null @@ -1,114 +0,0 @@ -From 8ba3db6f9244e6911ac88380cd133f39aaba95ab Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Tue, 13 Mar 2018 13:49:16 +0100 -Subject: [PATCH 284/347] block: blk-mq: move blk_queue_usage_counter_release() - into process context -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 61c928ecf4fe200bda9b49a0813b5ba0f43995b5 ] - -| BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:914 -| in_atomic(): 1, irqs_disabled(): 0, pid: 255, name: kworker/u257:6 -| 5 locks held by kworker/u257:6/255: -| #0: ("events_unbound"){.+.+.+}, at: [] process_one_work+0x171/0x5e0 -| #1: ((&entry->work)){+.+.+.}, at: [] process_one_work+0x171/0x5e0 -| #2: (&shost->scan_mutex){+.+.+.}, at: [] __scsi_add_device+0xa3/0x130 [scsi_mod] -| #3: (&set->tag_list_lock){+.+...}, at: [] blk_mq_init_queue+0x96a/0xa50 -| #4: (rcu_read_lock_sched){......}, at: [] percpu_ref_kill_and_confirm+0x1d/0x120 -| Preemption disabled at:[] blk_mq_freeze_queue_start+0x56/0x70 -| -| CPU: 2 PID: 255 Comm: kworker/u257:6 Not tainted 3.18.7-rt0+ #1 -| Workqueue: events_unbound async_run_entry_fn -| 0000000000000003 ffff8800bc29f998 ffffffff815b3a12 0000000000000000 -| 0000000000000000 ffff8800bc29f9b8 ffffffff8109aa16 ffff8800bc29fa28 -| ffff8800bc5d1bc8 ffff8800bc29f9e8 ffffffff815b8dd4 ffff880000000000 -| Call Trace: -| [] dump_stack+0x4f/0x7c -| [] __might_sleep+0x116/0x190 -| [] rt_spin_lock+0x24/0x60 -| [] __wake_up+0x29/0x60 -| [] blk_mq_usage_counter_release+0x1e/0x20 -| [] percpu_ref_kill_and_confirm+0x106/0x120 -| [] blk_mq_freeze_queue_start+0x56/0x70 -| [] blk_mq_update_tag_set_depth+0x40/0xd0 -| [] blk_mq_init_queue+0x98c/0xa50 -| [] scsi_mq_alloc_queue+0x20/0x60 [scsi_mod] -| [] scsi_alloc_sdev+0x2f5/0x370 [scsi_mod] -| [] scsi_probe_and_add_lun+0x9e4/0xdd0 [scsi_mod] -| [] __scsi_add_device+0x126/0x130 [scsi_mod] -| [] ata_scsi_scan_host+0xaf/0x200 [libata] -| [] async_port_probe+0x46/0x60 [libata] -| [] async_run_entry_fn+0x3b/0xf0 -| [] process_one_work+0x201/0x5e0 - -percpu_ref_kill_and_confirm() invokes blk_mq_usage_counter_release() in -a rcu-sched region. swait based wake queue can't be used due to -wake_up_all() usage and disabled interrupts in !RT configs (as reported -by Corey Minyard). -The wq_has_sleeper() check has been suggested by Peter Zijlstra. - -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - block/blk-core.c | 12 +++++++++++- - include/linux/blkdev.h | 2 ++ - 2 files changed, 13 insertions(+), 1 deletion(-) - -diff --git a/block/blk-core.c b/block/blk-core.c -index 461a93c08c14..a67a50dd714a 100644 ---- a/block/blk-core.c -+++ b/block/blk-core.c -@@ -973,12 +973,21 @@ void blk_queue_exit(struct request_queue *q) - percpu_ref_put(&q->q_usage_counter); - } - -+static void blk_queue_usage_counter_release_wrk(struct kthread_work *work) -+{ -+ struct request_queue *q = -+ container_of(work, struct request_queue, mq_pcpu_wake); -+ -+ wake_up_all(&q->mq_freeze_wq); -+} -+ - static void blk_queue_usage_counter_release(struct percpu_ref *ref) - { - struct request_queue *q = - container_of(ref, struct request_queue, q_usage_counter); - -- wake_up_all(&q->mq_freeze_wq); -+ if (wq_has_sleeper(&q->mq_freeze_wq)) -+ kthread_schedule_work(&q->mq_pcpu_wake); - } - - static void blk_rq_timed_out_timer(struct timer_list *t) -@@ -1078,6 +1087,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id, - queue_flag_set_unlocked(QUEUE_FLAG_BYPASS, q); - - init_waitqueue_head(&q->mq_freeze_wq); -+ kthread_init_work(&q->mq_pcpu_wake, blk_queue_usage_counter_release_wrk); - - /* - * Init percpu_ref in atomic mode so that it's faster to shutdown. -diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h -index 39d90bf9b5fa..5566d0049c22 100644 ---- a/include/linux/blkdev.h -+++ b/include/linux/blkdev.h -@@ -13,6 +13,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -664,6 +665,7 @@ struct request_queue { - #endif - struct rcu_head rcu_head; - wait_queue_head_t mq_freeze_wq; -+ struct kthread_work mq_pcpu_wake; - struct percpu_ref q_usage_counter; - struct list_head all_q_node; - --- -2.36.1 - diff --git a/debian/patches-rt/0284-workqueue-rework.patch b/debian/patches-rt/0284-workqueue-rework.patch new file mode 100644 index 000000000..ea00e194a --- /dev/null +++ b/debian/patches-rt/0284-workqueue-rework.patch @@ -0,0 +1,1460 @@ +From: Sebastian Andrzej Siewior +Date: Wed, 29 May 2019 18:52:27 +0200 +Subject: [PATCH 284/342] workqueue: rework +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=ef48b1fd6691fa627afcf72bba3295c66c23da41 + +[ Upstream commit d15a862f24df983458533aebd6fa207ecdd1095a ] + +This is an all-in change of the workqueue rework. +The worker_pool.lock is made to raw_spinlock_t. With this change we can +schedule workitems from preempt-disable sections and sections with disabled +interrupts. This change allows to remove all kthread_.* workarounds we used to +have. + +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + block/blk-core.c | 6 +- + drivers/block/loop.c | 2 +- + drivers/spi/spi-rockchip.c | 1 - + drivers/thermal/x86_pkg_temp_thermal.c | 28 +-- + fs/aio.c | 10 +- + include/linux/blk-cgroup.h | 2 +- + include/linux/blkdev.h | 2 +- + include/linux/kthread-cgroup.h | 17 -- + include/linux/kthread.h | 15 +- + include/linux/swait.h | 14 ++ + include/linux/workqueue.h | 4 - + init/main.c | 1 - + kernel/kthread.c | 14 -- + kernel/sched/core.c | 1 + + kernel/time/hrtimer.c | 24 -- + kernel/workqueue.c | 304 +++++++++++-------------- + 16 files changed, 163 insertions(+), 282 deletions(-) + delete mode 100644 include/linux/kthread-cgroup.h + +diff --git a/block/blk-core.c b/block/blk-core.c +index a67a50dd714a..ed6ae335756d 100644 +--- a/block/blk-core.c ++++ b/block/blk-core.c +@@ -973,7 +973,7 @@ void blk_queue_exit(struct request_queue *q) + percpu_ref_put(&q->q_usage_counter); + } + +-static void blk_queue_usage_counter_release_wrk(struct kthread_work *work) ++static void blk_queue_usage_counter_release_wrk(struct work_struct *work) + { + struct request_queue *q = + container_of(work, struct request_queue, mq_pcpu_wake); +@@ -987,7 +987,7 @@ static void blk_queue_usage_counter_release(struct percpu_ref *ref) + container_of(ref, struct request_queue, q_usage_counter); + + if (wq_has_sleeper(&q->mq_freeze_wq)) +- kthread_schedule_work(&q->mq_pcpu_wake); ++ schedule_work(&q->mq_pcpu_wake); + } + + static void blk_rq_timed_out_timer(struct timer_list *t) +@@ -1087,7 +1087,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id, + queue_flag_set_unlocked(QUEUE_FLAG_BYPASS, q); + + init_waitqueue_head(&q->mq_freeze_wq); +- kthread_init_work(&q->mq_pcpu_wake, blk_queue_usage_counter_release_wrk); ++ INIT_WORK(&q->mq_pcpu_wake, blk_queue_usage_counter_release_wrk); + + /* + * Init percpu_ref in atomic mode so that it's faster to shutdown. +diff --git a/drivers/block/loop.c b/drivers/block/loop.c +index d24660961343..c31a76485c9c 100644 +--- a/drivers/block/loop.c ++++ b/drivers/block/loop.c +@@ -70,7 +70,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include +diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c +index 63b10236eb05..185bbdce62b1 100644 +--- a/drivers/spi/spi-rockchip.c ++++ b/drivers/spi/spi-rockchip.c +@@ -22,7 +22,6 @@ + #include + #include + #include +-#include + + #define DRIVER_NAME "rockchip-spi" + +diff --git a/drivers/thermal/x86_pkg_temp_thermal.c b/drivers/thermal/x86_pkg_temp_thermal.c +index 82f21fd4afb0..1ef937d799e4 100644 +--- a/drivers/thermal/x86_pkg_temp_thermal.c ++++ b/drivers/thermal/x86_pkg_temp_thermal.c +@@ -29,7 +29,6 @@ + #include + #include + #include +-#include + #include + #include + +@@ -330,7 +329,7 @@ static void pkg_thermal_schedule_work(int cpu, struct delayed_work *work) + schedule_delayed_work_on(cpu, work, ms); + } + +-static void pkg_thermal_notify_work(struct kthread_work *work) ++static int pkg_thermal_notify(u64 msr_val) + { + int cpu = smp_processor_id(); + struct pkg_device *pkgdev; +@@ -349,32 +348,8 @@ static void pkg_thermal_notify_work(struct kthread_work *work) + } + + spin_unlock_irqrestore(&pkg_temp_lock, flags); +-} +- +-#ifdef CONFIG_PREEMPT_RT_FULL +-static DEFINE_KTHREAD_WORK(notify_work, pkg_thermal_notify_work); +- +-static int pkg_thermal_notify(u64 msr_val) +-{ +- kthread_schedule_work(¬ify_work); +- return 0; +-} +- +-static void pkg_thermal_notify_flush(void) +-{ +- kthread_flush_work(¬ify_work); +-} +- +-#else /* !CONFIG_PREEMPT_RT_FULL */ +- +-static void pkg_thermal_notify_flush(void) { } +- +-static int pkg_thermal_notify(u64 msr_val) +-{ +- pkg_thermal_notify_work(NULL); + return 0; + } +-#endif /* CONFIG_PREEMPT_RT_FULL */ + + static int pkg_temp_thermal_device_add(unsigned int cpu) + { +@@ -573,7 +548,6 @@ static void __exit pkg_temp_thermal_exit(void) + platform_thermal_package_rate_control = NULL; + + cpuhp_remove_state(pkg_thermal_hp_state); +- pkg_thermal_notify_flush(); + debugfs_remove_recursive(debugfs); + kfree(packages); + } +diff --git a/fs/aio.c b/fs/aio.c +index 303e85033965..6deff68b92c7 100644 +--- a/fs/aio.c ++++ b/fs/aio.c +@@ -121,7 +121,7 @@ struct kioctx { + long nr_pages; + + struct rcu_work free_rwork; /* see free_ioctx() */ +- struct kthread_work free_kwork; /* see free_ioctx() */ ++ struct work_struct free_work; /* see free_ioctx() */ + + /* + * signals when all in-flight requests are done +@@ -609,9 +609,9 @@ static void free_ioctx_reqs(struct percpu_ref *ref) + * and ctx->users has dropped to 0, so we know no more kiocbs can be submitted - + * now it's safe to cancel any that need to be. + */ +-static void free_ioctx_users_work(struct kthread_work *work) ++static void free_ioctx_users_work(struct work_struct *work) + { +- struct kioctx *ctx = container_of(work, struct kioctx, free_kwork); ++ struct kioctx *ctx = container_of(work, struct kioctx, free_work); + struct aio_kiocb *req; + + spin_lock_irq(&ctx->ctx_lock); +@@ -633,8 +633,8 @@ static void free_ioctx_users(struct percpu_ref *ref) + { + struct kioctx *ctx = container_of(ref, struct kioctx, users); + +- kthread_init_work(&ctx->free_kwork, free_ioctx_users_work); +- kthread_schedule_work(&ctx->free_kwork); ++ INIT_WORK(&ctx->free_work, free_ioctx_users_work); ++ schedule_work(&ctx->free_work); + } + + static int ioctx_add_table(struct kioctx *ctx, struct mm_struct *mm) +diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h +index dc26ce6d840d..53f63f18ecdf 100644 +--- a/include/linux/blk-cgroup.h ++++ b/include/linux/blk-cgroup.h +@@ -14,7 +14,7 @@ + * Nauman Rafique + */ + +-#include ++#include + #include + #include + #include +diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h +index 5566d0049c22..c01e5d9597f9 100644 +--- a/include/linux/blkdev.h ++++ b/include/linux/blkdev.h +@@ -665,7 +665,7 @@ struct request_queue { + #endif + struct rcu_head rcu_head; + wait_queue_head_t mq_freeze_wq; +- struct kthread_work mq_pcpu_wake; ++ struct work_struct mq_pcpu_wake; + struct percpu_ref q_usage_counter; + struct list_head all_q_node; + +diff --git a/include/linux/kthread-cgroup.h b/include/linux/kthread-cgroup.h +deleted file mode 100644 +index 53d34bca9d72..000000000000 +--- a/include/linux/kthread-cgroup.h ++++ /dev/null +@@ -1,17 +0,0 @@ +-/* SPDX-License-Identifier: GPL-2.0 */ +-#ifndef _LINUX_KTHREAD_CGROUP_H +-#define _LINUX_KTHREAD_CGROUP_H +-#include +-#include +- +-#ifdef CONFIG_BLK_CGROUP +-void kthread_associate_blkcg(struct cgroup_subsys_state *css); +-struct cgroup_subsys_state *kthread_blkcg(void); +-#else +-static inline void kthread_associate_blkcg(struct cgroup_subsys_state *css) { } +-static inline struct cgroup_subsys_state *kthread_blkcg(void) +-{ +- return NULL; +-} +-#endif +-#endif +diff --git a/include/linux/kthread.h b/include/linux/kthread.h +index 31140f0a6c2c..0e3b9b528c9e 100644 +--- a/include/linux/kthread.h ++++ b/include/linux/kthread.h +@@ -4,6 +4,7 @@ + /* Simple interface for creating and stopping kernel threads without mess. */ + #include + #include ++#include + + __printf(4, 5) + struct task_struct *kthread_create_on_node(int (*threadfn)(void *data), +@@ -200,12 +201,14 @@ bool kthread_cancel_delayed_work_sync(struct kthread_delayed_work *work); + + void kthread_destroy_worker(struct kthread_worker *worker); + +-extern struct kthread_worker kthread_global_worker; +-void kthread_init_global_worker(void); +- +-static inline bool kthread_schedule_work(struct kthread_work *work) ++#ifdef CONFIG_BLK_CGROUP ++void kthread_associate_blkcg(struct cgroup_subsys_state *css); ++struct cgroup_subsys_state *kthread_blkcg(void); ++#else ++static inline void kthread_associate_blkcg(struct cgroup_subsys_state *css) { } ++static inline struct cgroup_subsys_state *kthread_blkcg(void) + { +- return kthread_queue_work(&kthread_global_worker, work); ++ return NULL; + } +- ++#endif + #endif /* _LINUX_KTHREAD_H */ +diff --git a/include/linux/swait.h b/include/linux/swait.h +index f426a0661aa0..21ae66cd41d3 100644 +--- a/include/linux/swait.h ++++ b/include/linux/swait.h +@@ -299,4 +299,18 @@ do { \ + __ret; \ + }) + ++#define __swait_event_lock_irq(wq, condition, lock, cmd) \ ++ ___swait_event(wq, condition, TASK_UNINTERRUPTIBLE, 0, \ ++ raw_spin_unlock_irq(&lock); \ ++ cmd; \ ++ schedule(); \ ++ raw_spin_lock_irq(&lock)) ++ ++#define swait_event_lock_irq(wq_head, condition, lock) \ ++ do { \ ++ if (condition) \ ++ break; \ ++ __swait_event_lock_irq(wq_head, condition, lock, ); \ ++ } while (0) ++ + #endif /* _LINUX_SWAIT_H */ +diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h +index 60d673e15632..546aa73fba6a 100644 +--- a/include/linux/workqueue.h ++++ b/include/linux/workqueue.h +@@ -455,10 +455,6 @@ __alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active, + + extern void destroy_workqueue(struct workqueue_struct *wq); + +-struct workqueue_attrs *alloc_workqueue_attrs(gfp_t gfp_mask); +-void free_workqueue_attrs(struct workqueue_attrs *attrs); +-int apply_workqueue_attrs(struct workqueue_struct *wq, +- const struct workqueue_attrs *attrs); + int workqueue_set_unbound_cpumask(cpumask_var_t cpumask); + + extern bool queue_work_on(int cpu, struct workqueue_struct *wq, +diff --git a/init/main.c b/init/main.c +index 8555afc3f3e1..703b627a6060 100644 +--- a/init/main.c ++++ b/init/main.c +@@ -1136,7 +1136,6 @@ static noinline void __init kernel_init_freeable(void) + smp_prepare_cpus(setup_max_cpus); + + workqueue_init(); +- kthread_init_global_worker(); + + init_mm_internals(); + +diff --git a/kernel/kthread.c b/kernel/kthread.c +index 6bbd391f0d9c..c8cf4731ced8 100644 +--- a/kernel/kthread.c ++++ b/kernel/kthread.c +@@ -20,7 +20,6 @@ + #include + #include + #include +-#include + #include + + static DEFINE_SPINLOCK(kthread_create_lock); +@@ -1245,19 +1244,6 @@ void kthread_destroy_worker(struct kthread_worker *worker) + } + EXPORT_SYMBOL(kthread_destroy_worker); + +-DEFINE_KTHREAD_WORKER(kthread_global_worker); +-EXPORT_SYMBOL(kthread_global_worker); +- +-__init void kthread_init_global_worker(void) +-{ +- kthread_global_worker.task = kthread_create(kthread_worker_fn, +- &kthread_global_worker, +- "kswork"); +- if (WARN_ON(IS_ERR(kthread_global_worker.task))) +- return; +- wake_up_process(kthread_global_worker.task); +-} +- + #ifdef CONFIG_BLK_CGROUP + /** + * kthread_associate_blkcg - associate blkcg to current kthread +diff --git a/kernel/sched/core.c b/kernel/sched/core.c +index 3b0f62be3ece..1d4d4780dd79 100644 +--- a/kernel/sched/core.c ++++ b/kernel/sched/core.c +@@ -3612,6 +3612,7 @@ static inline void sched_submit_work(struct task_struct *tsk) + { + if (!tsk->state) + return; ++ + /* + * If a worker went to sleep, notify and ask workqueue whether + * it wants to wake up a task to maintain concurrency. +diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c +index bbc408f24f5d..eb2db7e6a241 100644 +--- a/kernel/time/hrtimer.c ++++ b/kernel/time/hrtimer.c +@@ -748,29 +748,6 @@ static void hrtimer_switch_to_hres(void) + retrigger_next_event(NULL); + } + +-#ifdef CONFIG_PREEMPT_RT_FULL +- +-static struct swork_event clock_set_delay_work; +- +-static void run_clock_set_delay(struct swork_event *event) +-{ +- clock_was_set(); +-} +- +-void clock_was_set_delayed(void) +-{ +- swork_queue(&clock_set_delay_work); +-} +- +-static __init int create_clock_set_delay_thread(void) +-{ +- WARN_ON(swork_get()); +- INIT_SWORK(&clock_set_delay_work, run_clock_set_delay); +- return 0; +-} +-early_initcall(create_clock_set_delay_thread); +-#else /* PREEMPT_RT_FULL */ +- + static void clock_was_set_work(struct work_struct *work) + { + clock_was_set(); +@@ -786,7 +763,6 @@ void clock_was_set_delayed(void) + { + schedule_work(&hrtimer_work); + } +-#endif + + #else + +diff --git a/kernel/workqueue.c b/kernel/workqueue.c +index 91f5696cf335..4ed22776b2ee 100644 +--- a/kernel/workqueue.c ++++ b/kernel/workqueue.c +@@ -50,8 +50,6 @@ + #include + #include + #include +-#include +-#include + + #include "workqueue_internal.h" + +@@ -126,11 +124,6 @@ enum { + * cpu or grabbing pool->lock is enough for read access. If + * POOL_DISASSOCIATED is set, it's identical to L. + * +- * On RT we need the extra protection via rt_lock_idle_list() for +- * the list manipulations against read access from +- * wq_worker_sleeping(). All other places are nicely serialized via +- * pool->lock. +- * + * A: wq_pool_attach_mutex protected. + * + * PL: wq_pool_mutex protected. +@@ -152,7 +145,7 @@ enum { + /* struct worker is defined in workqueue_internal.h */ + + struct worker_pool { +- spinlock_t lock; /* the pool lock */ ++ raw_spinlock_t lock; /* the pool lock */ + int cpu; /* I: the associated cpu */ + int node; /* I: the associated node ID */ + int id; /* I: pool ID */ +@@ -305,8 +298,8 @@ static struct workqueue_attrs *wq_update_unbound_numa_attrs_buf; + + static DEFINE_MUTEX(wq_pool_mutex); /* protects pools and workqueues list */ + static DEFINE_MUTEX(wq_pool_attach_mutex); /* protects worker attach/detach */ +-static DEFINE_SPINLOCK(wq_mayday_lock); /* protects wq->maydays list */ +-static DECLARE_WAIT_QUEUE_HEAD(wq_manager_wait); /* wait for manager to go away */ ++static DEFINE_RAW_SPINLOCK(wq_mayday_lock); /* protects wq->maydays list */ ++static DECLARE_SWAIT_QUEUE_HEAD(wq_manager_wait); /* wait for manager to go away */ + + static LIST_HEAD(workqueues); /* PR: list of all workqueues */ + static bool workqueue_freezing; /* PL: have wqs started freezing? */ +@@ -358,8 +351,6 @@ EXPORT_SYMBOL_GPL(system_power_efficient_wq); + struct workqueue_struct *system_freezable_power_efficient_wq __read_mostly; + EXPORT_SYMBOL_GPL(system_freezable_power_efficient_wq); + +-static DEFINE_LOCAL_IRQ_LOCK(pendingb_lock); +- + static int worker_thread(void *__worker); + static void workqueue_sysfs_unregister(struct workqueue_struct *wq); + +@@ -436,31 +427,6 @@ static void workqueue_sysfs_unregister(struct workqueue_struct *wq); + if (({ assert_rcu_or_wq_mutex(wq); false; })) { } \ + else + +-#ifdef CONFIG_PREEMPT_RT_BASE +-static inline void rt_lock_idle_list(struct worker_pool *pool) +-{ +- preempt_disable(); +-} +-static inline void rt_unlock_idle_list(struct worker_pool *pool) +-{ +- preempt_enable(); +-} +-static inline void sched_lock_idle_list(struct worker_pool *pool) { } +-static inline void sched_unlock_idle_list(struct worker_pool *pool) { } +-#else +-static inline void rt_lock_idle_list(struct worker_pool *pool) { } +-static inline void rt_unlock_idle_list(struct worker_pool *pool) { } +-static inline void sched_lock_idle_list(struct worker_pool *pool) +-{ +- spin_lock_irq(&pool->lock); +-} +-static inline void sched_unlock_idle_list(struct worker_pool *pool) +-{ +- spin_unlock_irq(&pool->lock); +-} +-#endif +- +- + #ifdef CONFIG_DEBUG_OBJECTS_WORK + + static struct debug_obj_descr work_debug_descr; +@@ -863,20 +829,14 @@ static struct worker *first_idle_worker(struct worker_pool *pool) + * Wake up the first idle worker of @pool. + * + * CONTEXT: +- * spin_lock_irq(pool->lock). ++ * raw_spin_lock_irq(pool->lock). + */ + static void wake_up_worker(struct worker_pool *pool) + { +- struct worker *worker; +- +- rt_lock_idle_list(pool); +- +- worker = first_idle_worker(pool); ++ struct worker *worker = first_idle_worker(pool); + + if (likely(worker)) + wake_up_process(worker->task); +- +- rt_unlock_idle_list(pool); + } + + /** +@@ -905,7 +865,7 @@ void wq_worker_running(struct task_struct *task) + */ + void wq_worker_sleeping(struct task_struct *task) + { +- struct worker *worker = kthread_data(task); ++ struct worker *next, *worker = kthread_data(task); + struct worker_pool *pool; + + /* +@@ -922,18 +882,26 @@ void wq_worker_sleeping(struct task_struct *task) + return; + + worker->sleeping = 1; ++ raw_spin_lock_irq(&pool->lock); + + /* + * The counterpart of the following dec_and_test, implied mb, + * worklist not empty test sequence is in insert_work(). + * Please read comment there. ++ * ++ * NOT_RUNNING is clear. This means that we're bound to and ++ * running on the local cpu w/ rq lock held and preemption ++ * disabled, which in turn means that none else could be ++ * manipulating idle_list, so dereferencing idle_list without pool ++ * lock is safe. + */ + if (atomic_dec_and_test(&pool->nr_running) && + !list_empty(&pool->worklist)) { +- sched_lock_idle_list(pool); +- wake_up_worker(pool); +- sched_unlock_idle_list(pool); ++ next = first_idle_worker(pool); ++ if (next) ++ wake_up_process(next->task); + } ++ raw_spin_unlock_irq(&pool->lock); + } + + /** +@@ -944,7 +912,7 @@ void wq_worker_sleeping(struct task_struct *task) + * Set @flags in @worker->flags and adjust nr_running accordingly. + * + * CONTEXT: +- * spin_lock_irq(pool->lock) ++ * raw_spin_lock_irq(pool->lock) + */ + static inline void worker_set_flags(struct worker *worker, unsigned int flags) + { +@@ -969,7 +937,7 @@ static inline void worker_set_flags(struct worker *worker, unsigned int flags) + * Clear @flags in @worker->flags and adjust nr_running accordingly. + * + * CONTEXT: +- * spin_lock_irq(pool->lock) ++ * raw_spin_lock_irq(pool->lock) + */ + static inline void worker_clr_flags(struct worker *worker, unsigned int flags) + { +@@ -1017,7 +985,7 @@ static inline void worker_clr_flags(struct worker *worker, unsigned int flags) + * actually occurs, it should be easy to locate the culprit work function. + * + * CONTEXT: +- * spin_lock_irq(pool->lock). ++ * raw_spin_lock_irq(pool->lock). + * + * Return: + * Pointer to worker which is executing @work if found, %NULL +@@ -1052,7 +1020,7 @@ static struct worker *find_worker_executing_work(struct worker_pool *pool, + * nested inside outer list_for_each_entry_safe(). + * + * CONTEXT: +- * spin_lock_irq(pool->lock). ++ * raw_spin_lock_irq(pool->lock). + */ + static void move_linked_works(struct work_struct *work, struct list_head *head, + struct work_struct **nextp) +@@ -1130,11 +1098,9 @@ static void put_pwq_unlocked(struct pool_workqueue *pwq) + * As both pwqs and pools are RCU protected, the + * following lock operations are safe. + */ +- rcu_read_lock(); +- local_spin_lock_irq(pendingb_lock, &pwq->pool->lock); ++ raw_spin_lock_irq(&pwq->pool->lock); + put_pwq(pwq); +- local_spin_unlock_irq(pendingb_lock, &pwq->pool->lock); +- rcu_read_unlock(); ++ raw_spin_unlock_irq(&pwq->pool->lock); + } + } + +@@ -1167,7 +1133,7 @@ static void pwq_activate_first_delayed(struct pool_workqueue *pwq) + * decrement nr_in_flight of its pwq and handle workqueue flushing. + * + * CONTEXT: +- * spin_lock_irq(pool->lock). ++ * raw_spin_lock_irq(pool->lock). + */ + static void pwq_dec_nr_in_flight(struct pool_workqueue *pwq, int color) + { +@@ -1238,7 +1204,7 @@ static int try_to_grab_pending(struct work_struct *work, bool is_dwork, + struct worker_pool *pool; + struct pool_workqueue *pwq; + +- local_lock_irqsave(pendingb_lock, *flags); ++ local_irq_save(*flags); + + /* try to steal the timer if it exists */ + if (is_dwork) { +@@ -1266,7 +1232,7 @@ static int try_to_grab_pending(struct work_struct *work, bool is_dwork, + if (!pool) + goto fail; + +- spin_lock(&pool->lock); ++ raw_spin_lock(&pool->lock); + /* + * work->data is guaranteed to point to pwq only while the work + * item is queued on pwq->wq, and both updating work->data to point +@@ -1295,17 +1261,17 @@ static int try_to_grab_pending(struct work_struct *work, bool is_dwork, + /* work->data points to pwq iff queued, point to pool */ + set_work_pool_and_keep_pending(work, pool->id); + +- spin_unlock(&pool->lock); ++ raw_spin_unlock(&pool->lock); + rcu_read_unlock(); + return 1; + } +- spin_unlock(&pool->lock); ++ raw_spin_unlock(&pool->lock); + fail: + rcu_read_unlock(); +- local_unlock_irqrestore(pendingb_lock, *flags); ++ local_irq_restore(*flags); + if (work_is_canceling(work)) + return -ENOENT; +- cpu_chill(); ++ cpu_relax(); + return -EAGAIN; + } + +@@ -1320,7 +1286,7 @@ static int try_to_grab_pending(struct work_struct *work, bool is_dwork, + * work_struct flags. + * + * CONTEXT: +- * spin_lock_irq(pool->lock). ++ * raw_spin_lock_irq(pool->lock). + */ + static void insert_work(struct pool_workqueue *pwq, struct work_struct *work, + struct list_head *head, unsigned int extra_flags) +@@ -1407,13 +1373,7 @@ static void __queue_work(int cpu, struct workqueue_struct *wq, + * queued or lose PENDING. Grabbing PENDING and queueing should + * happen with IRQ disabled. + */ +-#ifndef CONFIG_PREEMPT_RT_FULL +- /* +- * nort: On RT the "interrupts-disabled" rule has been replaced with +- * pendingb_lock. +- */ + lockdep_assert_irqs_disabled(); +-#endif + + + /* if draining, only works from the same workqueue are allowed */ +@@ -1442,7 +1402,7 @@ static void __queue_work(int cpu, struct workqueue_struct *wq, + if (last_pool && last_pool != pwq->pool) { + struct worker *worker; + +- spin_lock(&last_pool->lock); ++ raw_spin_lock(&last_pool->lock); + + worker = find_worker_executing_work(last_pool, work); + +@@ -1450,11 +1410,11 @@ static void __queue_work(int cpu, struct workqueue_struct *wq, + pwq = worker->current_pwq; + } else { + /* meh... not running there, queue here */ +- spin_unlock(&last_pool->lock); +- spin_lock(&pwq->pool->lock); ++ raw_spin_unlock(&last_pool->lock); ++ raw_spin_lock(&pwq->pool->lock); + } + } else { +- spin_lock(&pwq->pool->lock); ++ raw_spin_lock(&pwq->pool->lock); + } + + /* +@@ -1467,7 +1427,7 @@ static void __queue_work(int cpu, struct workqueue_struct *wq, + */ + if (unlikely(!pwq->refcnt)) { + if (wq->flags & WQ_UNBOUND) { +- spin_unlock(&pwq->pool->lock); ++ raw_spin_unlock(&pwq->pool->lock); + cpu_relax(); + goto retry; + } +@@ -1500,7 +1460,7 @@ static void __queue_work(int cpu, struct workqueue_struct *wq, + insert_work(pwq, work, worklist, work_flags); + + out: +- spin_unlock(&pwq->pool->lock); ++ raw_spin_unlock(&pwq->pool->lock); + rcu_read_unlock(); + } + +@@ -1521,14 +1481,14 @@ bool queue_work_on(int cpu, struct workqueue_struct *wq, + bool ret = false; + unsigned long flags; + +- local_lock_irqsave(pendingb_lock,flags); ++ local_irq_save(flags); + + if (!test_and_set_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(work))) { + __queue_work(cpu, wq, work); + ret = true; + } + +- local_unlock_irqrestore(pendingb_lock, flags); ++ local_irq_restore(flags); + return ret; + } + EXPORT_SYMBOL(queue_work_on); +@@ -1536,12 +1496,11 @@ EXPORT_SYMBOL(queue_work_on); + void delayed_work_timer_fn(struct timer_list *t) + { + struct delayed_work *dwork = from_timer(dwork, t, timer); ++ unsigned long flags; + +- /* XXX */ +- /* local_lock(pendingb_lock); */ +- /* should have been called from irqsafe timer with irq already off */ ++ local_irq_save(flags); + __queue_work(dwork->cpu, dwork->wq, &dwork->work); +- /* local_unlock(pendingb_lock); */ ++ local_irq_restore(flags); + } + EXPORT_SYMBOL(delayed_work_timer_fn); + +@@ -1596,14 +1555,14 @@ bool queue_delayed_work_on(int cpu, struct workqueue_struct *wq, + unsigned long flags; + + /* read the comment in __queue_work() */ +- local_lock_irqsave(pendingb_lock, flags); ++ local_irq_save(flags); + + if (!test_and_set_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(work))) { + __queue_delayed_work(cpu, wq, dwork, delay); + ret = true; + } + +- local_unlock_irqrestore(pendingb_lock, flags); ++ local_irq_restore(flags); + return ret; + } + EXPORT_SYMBOL(queue_delayed_work_on); +@@ -1638,7 +1597,7 @@ bool mod_delayed_work_on(int cpu, struct workqueue_struct *wq, + + if (likely(ret >= 0)) { + __queue_delayed_work(cpu, wq, dwork, delay); +- local_unlock_irqrestore(pendingb_lock, flags); ++ local_irq_restore(flags); + } + + /* -ENOENT from try_to_grab_pending() becomes %true */ +@@ -1649,12 +1608,11 @@ EXPORT_SYMBOL_GPL(mod_delayed_work_on); + static void rcu_work_rcufn(struct rcu_head *rcu) + { + struct rcu_work *rwork = container_of(rcu, struct rcu_work, rcu); +- unsigned long flags; + + /* read the comment in __queue_work() */ +- local_lock_irqsave(pendingb_lock, flags); ++ local_irq_disable(); + __queue_work(WORK_CPU_UNBOUND, rwork->wq, &rwork->work); +- local_unlock_irqrestore(pendingb_lock, flags); ++ local_irq_enable(); + } + + /** +@@ -1689,7 +1647,7 @@ EXPORT_SYMBOL(queue_rcu_work); + * necessary. + * + * LOCKING: +- * spin_lock_irq(pool->lock). ++ * raw_spin_lock_irq(pool->lock). + */ + static void worker_enter_idle(struct worker *worker) + { +@@ -1706,9 +1664,7 @@ static void worker_enter_idle(struct worker *worker) + worker->last_active = jiffies; + + /* idle_list is LIFO */ +- rt_lock_idle_list(pool); + list_add(&worker->entry, &pool->idle_list); +- rt_unlock_idle_list(pool); + + if (too_many_workers(pool) && !timer_pending(&pool->idle_timer)) + mod_timer(&pool->idle_timer, jiffies + IDLE_WORKER_TIMEOUT); +@@ -1731,7 +1687,7 @@ static void worker_enter_idle(struct worker *worker) + * @worker is leaving idle state. Update stats. + * + * LOCKING: +- * spin_lock_irq(pool->lock). ++ * raw_spin_lock_irq(pool->lock). + */ + static void worker_leave_idle(struct worker *worker) + { +@@ -1741,9 +1697,7 @@ static void worker_leave_idle(struct worker *worker) + return; + worker_clr_flags(worker, WORKER_IDLE); + pool->nr_idle--; +- rt_lock_idle_list(pool); + list_del_init(&worker->entry); +- rt_unlock_idle_list(pool); + } + + static struct worker *alloc_worker(int node) +@@ -1868,11 +1822,11 @@ static struct worker *create_worker(struct worker_pool *pool) + worker_attach_to_pool(worker, pool); + + /* start the newly created worker */ +- spin_lock_irq(&pool->lock); ++ raw_spin_lock_irq(&pool->lock); + worker->pool->nr_workers++; + worker_enter_idle(worker); + wake_up_process(worker->task); +- spin_unlock_irq(&pool->lock); ++ raw_spin_unlock_irq(&pool->lock); + + return worker; + +@@ -1891,7 +1845,7 @@ static struct worker *create_worker(struct worker_pool *pool) + * be idle. + * + * CONTEXT: +- * spin_lock_irq(pool->lock). ++ * raw_spin_lock_irq(pool->lock). + */ + static void destroy_worker(struct worker *worker) + { +@@ -1908,9 +1862,7 @@ static void destroy_worker(struct worker *worker) + pool->nr_workers--; + pool->nr_idle--; + +- rt_lock_idle_list(pool); + list_del_init(&worker->entry); +- rt_unlock_idle_list(pool); + worker->flags |= WORKER_DIE; + wake_up_process(worker->task); + } +@@ -1919,7 +1871,7 @@ static void idle_worker_timeout(struct timer_list *t) + { + struct worker_pool *pool = from_timer(pool, t, idle_timer); + +- spin_lock_irq(&pool->lock); ++ raw_spin_lock_irq(&pool->lock); + + while (too_many_workers(pool)) { + struct worker *worker; +@@ -1937,7 +1889,7 @@ static void idle_worker_timeout(struct timer_list *t) + destroy_worker(worker); + } + +- spin_unlock_irq(&pool->lock); ++ raw_spin_unlock_irq(&pool->lock); + } + + static void send_mayday(struct work_struct *work) +@@ -1968,8 +1920,8 @@ static void pool_mayday_timeout(struct timer_list *t) + struct worker_pool *pool = from_timer(pool, t, mayday_timer); + struct work_struct *work; + +- spin_lock_irq(&pool->lock); +- spin_lock(&wq_mayday_lock); /* for wq->maydays */ ++ raw_spin_lock_irq(&pool->lock); ++ raw_spin_lock(&wq_mayday_lock); /* for wq->maydays */ + + if (need_to_create_worker(pool)) { + /* +@@ -1982,8 +1934,8 @@ static void pool_mayday_timeout(struct timer_list *t) + send_mayday(work); + } + +- spin_unlock(&wq_mayday_lock); +- spin_unlock_irq(&pool->lock); ++ raw_spin_unlock(&wq_mayday_lock); ++ raw_spin_unlock_irq(&pool->lock); + + mod_timer(&pool->mayday_timer, jiffies + MAYDAY_INTERVAL); + } +@@ -2002,7 +1954,7 @@ static void pool_mayday_timeout(struct timer_list *t) + * may_start_working() %true. + * + * LOCKING: +- * spin_lock_irq(pool->lock) which may be released and regrabbed ++ * raw_spin_lock_irq(pool->lock) which may be released and regrabbed + * multiple times. Does GFP_KERNEL allocations. Called only from + * manager. + */ +@@ -2011,7 +1963,7 @@ __releases(&pool->lock) + __acquires(&pool->lock) + { + restart: +- spin_unlock_irq(&pool->lock); ++ raw_spin_unlock_irq(&pool->lock); + + /* if we don't make progress in MAYDAY_INITIAL_TIMEOUT, call for help */ + mod_timer(&pool->mayday_timer, jiffies + MAYDAY_INITIAL_TIMEOUT); +@@ -2027,7 +1979,7 @@ __acquires(&pool->lock) + } + + del_timer_sync(&pool->mayday_timer); +- spin_lock_irq(&pool->lock); ++ raw_spin_lock_irq(&pool->lock); + /* + * This is necessary even after a new worker was just successfully + * created as @pool->lock was dropped and the new worker might have +@@ -2050,7 +2002,7 @@ __acquires(&pool->lock) + * and may_start_working() is true. + * + * CONTEXT: +- * spin_lock_irq(pool->lock) which may be released and regrabbed ++ * raw_spin_lock_irq(pool->lock) which may be released and regrabbed + * multiple times. Does GFP_KERNEL allocations. + * + * Return: +@@ -2073,7 +2025,7 @@ static bool manage_workers(struct worker *worker) + + pool->manager = NULL; + pool->flags &= ~POOL_MANAGER_ACTIVE; +- wake_up(&wq_manager_wait); ++ swake_up_one(&wq_manager_wait); + return true; + } + +@@ -2089,7 +2041,7 @@ static bool manage_workers(struct worker *worker) + * call this function to process a work. + * + * CONTEXT: +- * spin_lock_irq(pool->lock) which is released and regrabbed. ++ * raw_spin_lock_irq(pool->lock) which is released and regrabbed. + */ + static void process_one_work(struct worker *worker, struct work_struct *work) + __releases(&pool->lock) +@@ -2171,7 +2123,7 @@ __acquires(&pool->lock) + */ + set_work_pool_and_clear_pending(work, pool->id); + +- spin_unlock_irq(&pool->lock); ++ raw_spin_unlock_irq(&pool->lock); + + lock_map_acquire(&pwq->wq->lockdep_map); + lock_map_acquire(&lockdep_map); +@@ -2226,7 +2178,7 @@ __acquires(&pool->lock) + */ + cond_resched(); + +- spin_lock_irq(&pool->lock); ++ raw_spin_lock_irq(&pool->lock); + + /* clear cpu intensive status */ + if (unlikely(cpu_intensive)) +@@ -2249,7 +2201,7 @@ __acquires(&pool->lock) + * fetches a work from the top and executes it. + * + * CONTEXT: +- * spin_lock_irq(pool->lock) which may be released and regrabbed ++ * raw_spin_lock_irq(pool->lock) which may be released and regrabbed + * multiple times. + */ + static void process_scheduled_works(struct worker *worker) +@@ -2291,11 +2243,11 @@ static int worker_thread(void *__worker) + /* tell the scheduler that this is a workqueue worker */ + set_pf_worker(true); + woke_up: +- spin_lock_irq(&pool->lock); ++ raw_spin_lock_irq(&pool->lock); + + /* am I supposed to die? */ + if (unlikely(worker->flags & WORKER_DIE)) { +- spin_unlock_irq(&pool->lock); ++ raw_spin_unlock_irq(&pool->lock); + WARN_ON_ONCE(!list_empty(&worker->entry)); + set_pf_worker(false); + +@@ -2361,7 +2313,7 @@ static int worker_thread(void *__worker) + */ + worker_enter_idle(worker); + __set_current_state(TASK_IDLE); +- spin_unlock_irq(&pool->lock); ++ raw_spin_unlock_irq(&pool->lock); + schedule(); + goto woke_up; + } +@@ -2415,7 +2367,7 @@ static int rescuer_thread(void *__rescuer) + should_stop = kthread_should_stop(); + + /* see whether any pwq is asking for help */ +- spin_lock_irq(&wq_mayday_lock); ++ raw_spin_lock_irq(&wq_mayday_lock); + + while (!list_empty(&wq->maydays)) { + struct pool_workqueue *pwq = list_first_entry(&wq->maydays, +@@ -2427,11 +2379,11 @@ static int rescuer_thread(void *__rescuer) + __set_current_state(TASK_RUNNING); + list_del_init(&pwq->mayday_node); + +- spin_unlock_irq(&wq_mayday_lock); ++ raw_spin_unlock_irq(&wq_mayday_lock); + + worker_attach_to_pool(rescuer, pool); + +- spin_lock_irq(&pool->lock); ++ raw_spin_lock_irq(&pool->lock); + + /* + * Slurp in all works issued via this workqueue and +@@ -2460,7 +2412,7 @@ static int rescuer_thread(void *__rescuer) + * incur MAYDAY_INTERVAL delay inbetween. + */ + if (need_to_create_worker(pool)) { +- spin_lock(&wq_mayday_lock); ++ raw_spin_lock(&wq_mayday_lock); + /* + * Queue iff we aren't racing destruction + * and somebody else hasn't queued it already. +@@ -2469,7 +2421,7 @@ static int rescuer_thread(void *__rescuer) + get_pwq(pwq); + list_add_tail(&pwq->mayday_node, &wq->maydays); + } +- spin_unlock(&wq_mayday_lock); ++ raw_spin_unlock(&wq_mayday_lock); + } + } + +@@ -2487,14 +2439,14 @@ static int rescuer_thread(void *__rescuer) + if (need_more_worker(pool)) + wake_up_worker(pool); + +- spin_unlock_irq(&pool->lock); ++ raw_spin_unlock_irq(&pool->lock); + + worker_detach_from_pool(rescuer); + +- spin_lock_irq(&wq_mayday_lock); ++ raw_spin_lock_irq(&wq_mayday_lock); + } + +- spin_unlock_irq(&wq_mayday_lock); ++ raw_spin_unlock_irq(&wq_mayday_lock); + + if (should_stop) { + __set_current_state(TASK_RUNNING); +@@ -2574,7 +2526,7 @@ static void wq_barrier_func(struct work_struct *work) + * underneath us, so we can't reliably determine pwq from @target. + * + * CONTEXT: +- * spin_lock_irq(pool->lock). ++ * raw_spin_lock_irq(pool->lock). + */ + static void insert_wq_barrier(struct pool_workqueue *pwq, + struct wq_barrier *barr, +@@ -2661,7 +2613,7 @@ static bool flush_workqueue_prep_pwqs(struct workqueue_struct *wq, + for_each_pwq(pwq, wq) { + struct worker_pool *pool = pwq->pool; + +- spin_lock_irq(&pool->lock); ++ raw_spin_lock_irq(&pool->lock); + + if (flush_color >= 0) { + WARN_ON_ONCE(pwq->flush_color != -1); +@@ -2678,7 +2630,7 @@ static bool flush_workqueue_prep_pwqs(struct workqueue_struct *wq, + pwq->work_color = work_color; + } + +- spin_unlock_irq(&pool->lock); ++ raw_spin_unlock_irq(&pool->lock); + } + + if (flush_color >= 0 && atomic_dec_and_test(&wq->nr_pwqs_to_flush)) +@@ -2878,9 +2830,9 @@ void drain_workqueue(struct workqueue_struct *wq) + for_each_pwq(pwq, wq) { + bool drained; + +- spin_lock_irq(&pwq->pool->lock); ++ raw_spin_lock_irq(&pwq->pool->lock); + drained = !pwq->nr_active && list_empty(&pwq->delayed_works); +- spin_unlock_irq(&pwq->pool->lock); ++ raw_spin_unlock_irq(&pwq->pool->lock); + + if (drained) + continue; +@@ -2916,7 +2868,7 @@ static bool start_flush_work(struct work_struct *work, struct wq_barrier *barr, + return false; + } + +- spin_lock_irq(&pool->lock); ++ raw_spin_lock_irq(&pool->lock); + /* see the comment in try_to_grab_pending() with the same code */ + pwq = get_work_pwq(work); + if (pwq) { +@@ -2932,7 +2884,7 @@ static bool start_flush_work(struct work_struct *work, struct wq_barrier *barr, + check_flush_dependency(pwq->wq, work); + + insert_wq_barrier(pwq, barr, work, worker); +- spin_unlock_irq(&pool->lock); ++ raw_spin_unlock_irq(&pool->lock); + + /* + * Force a lock recursion deadlock when using flush_work() inside a +@@ -2951,7 +2903,7 @@ static bool start_flush_work(struct work_struct *work, struct wq_barrier *barr, + rcu_read_unlock(); + return true; + already_gone: +- spin_unlock_irq(&pool->lock); ++ raw_spin_unlock_irq(&pool->lock); + rcu_read_unlock(); + return false; + } +@@ -3052,7 +3004,7 @@ static bool __cancel_work_timer(struct work_struct *work, bool is_dwork) + + /* tell other tasks trying to grab @work to back off */ + mark_work_canceling(work); +- local_unlock_irqrestore(pendingb_lock, flags); ++ local_irq_restore(flags); + + /* + * This allows canceling during early boot. We know that @work +@@ -3113,10 +3065,10 @@ EXPORT_SYMBOL_GPL(cancel_work_sync); + */ + bool flush_delayed_work(struct delayed_work *dwork) + { +- local_lock_irq(pendingb_lock); ++ local_irq_disable(); + if (del_timer_sync(&dwork->timer)) + __queue_work(dwork->cpu, dwork->wq, &dwork->work); +- local_unlock_irq(pendingb_lock); ++ local_irq_enable(); + return flush_work(&dwork->work); + } + EXPORT_SYMBOL(flush_delayed_work); +@@ -3154,7 +3106,7 @@ static bool __cancel_work(struct work_struct *work, bool is_dwork) + return false; + + set_work_pool_and_clear_pending(work, get_work_pool_id(work)); +- local_unlock_irqrestore(pendingb_lock, flags); ++ local_irq_restore(flags); + return ret; + } + +@@ -3264,7 +3216,7 @@ EXPORT_SYMBOL_GPL(execute_in_process_context); + * + * Undo alloc_workqueue_attrs(). + */ +-void free_workqueue_attrs(struct workqueue_attrs *attrs) ++static void free_workqueue_attrs(struct workqueue_attrs *attrs) + { + if (attrs) { + free_cpumask_var(attrs->cpumask); +@@ -3274,21 +3226,20 @@ void free_workqueue_attrs(struct workqueue_attrs *attrs) + + /** + * alloc_workqueue_attrs - allocate a workqueue_attrs +- * @gfp_mask: allocation mask to use + * + * Allocate a new workqueue_attrs, initialize with default settings and + * return it. + * + * Return: The allocated new workqueue_attr on success. %NULL on failure. + */ +-struct workqueue_attrs *alloc_workqueue_attrs(gfp_t gfp_mask) ++static struct workqueue_attrs *alloc_workqueue_attrs(void) + { + struct workqueue_attrs *attrs; + +- attrs = kzalloc(sizeof(*attrs), gfp_mask); ++ attrs = kzalloc(sizeof(*attrs), GFP_KERNEL); + if (!attrs) + goto fail; +- if (!alloc_cpumask_var(&attrs->cpumask, gfp_mask)) ++ if (!alloc_cpumask_var(&attrs->cpumask, GFP_KERNEL)) + goto fail; + + cpumask_copy(attrs->cpumask, cpu_possible_mask); +@@ -3345,7 +3296,7 @@ static bool wqattrs_equal(const struct workqueue_attrs *a, + */ + static int init_worker_pool(struct worker_pool *pool) + { +- spin_lock_init(&pool->lock); ++ raw_spin_lock_init(&pool->lock); + pool->id = -1; + pool->cpu = -1; + pool->node = NUMA_NO_NODE; +@@ -3366,7 +3317,7 @@ static int init_worker_pool(struct worker_pool *pool) + pool->refcnt = 1; + + /* shouldn't fail above this point */ +- pool->attrs = alloc_workqueue_attrs(GFP_KERNEL); ++ pool->attrs = alloc_workqueue_attrs(); + if (!pool->attrs) + return -ENOMEM; + return 0; +@@ -3431,15 +3382,15 @@ static void put_unbound_pool(struct worker_pool *pool) + * @pool's workers from blocking on attach_mutex. We're the last + * manager and @pool gets freed with the flag set. + */ +- spin_lock_irq(&pool->lock); +- wait_event_lock_irq(wq_manager_wait, ++ raw_spin_lock_irq(&pool->lock); ++ swait_event_lock_irq(wq_manager_wait, + !(pool->flags & POOL_MANAGER_ACTIVE), pool->lock); + pool->flags |= POOL_MANAGER_ACTIVE; + + while ((worker = first_idle_worker(pool))) + destroy_worker(worker); + WARN_ON(pool->nr_workers || pool->nr_idle); +- spin_unlock_irq(&pool->lock); ++ raw_spin_unlock_irq(&pool->lock); + + mutex_lock(&wq_pool_attach_mutex); + if (!list_empty(&pool->workers)) +@@ -3599,7 +3550,7 @@ static void pwq_adjust_max_active(struct pool_workqueue *pwq) + return; + + /* this function can be called during early boot w/ irq disabled */ +- spin_lock_irqsave(&pwq->pool->lock, flags); ++ raw_spin_lock_irqsave(&pwq->pool->lock, flags); + + /* + * During [un]freezing, the caller is responsible for ensuring that +@@ -3629,7 +3580,7 @@ static void pwq_adjust_max_active(struct pool_workqueue *pwq) + pwq->max_active = 0; + } + +- spin_unlock_irqrestore(&pwq->pool->lock, flags); ++ raw_spin_unlock_irqrestore(&pwq->pool->lock, flags); + } + + /* initialize newly alloced @pwq which is associated with @wq and @pool */ +@@ -3802,8 +3753,8 @@ apply_wqattrs_prepare(struct workqueue_struct *wq, + + ctx = kzalloc(struct_size(ctx, pwq_tbl, nr_node_ids), GFP_KERNEL); + +- new_attrs = alloc_workqueue_attrs(GFP_KERNEL); +- tmp_attrs = alloc_workqueue_attrs(GFP_KERNEL); ++ new_attrs = alloc_workqueue_attrs(); ++ tmp_attrs = alloc_workqueue_attrs(); + if (!ctx || !new_attrs || !tmp_attrs) + goto out_free; + +@@ -3939,7 +3890,7 @@ static int apply_workqueue_attrs_locked(struct workqueue_struct *wq, + * + * Return: 0 on success and -errno on failure. + */ +-int apply_workqueue_attrs(struct workqueue_struct *wq, ++static int apply_workqueue_attrs(struct workqueue_struct *wq, + const struct workqueue_attrs *attrs) + { + int ret; +@@ -3950,7 +3901,6 @@ int apply_workqueue_attrs(struct workqueue_struct *wq, + + return ret; + } +-EXPORT_SYMBOL_GPL(apply_workqueue_attrs); + + /** + * wq_update_unbound_numa - update NUMA affinity of a wq for CPU hot[un]plug +@@ -4028,9 +3978,9 @@ static void wq_update_unbound_numa(struct workqueue_struct *wq, int cpu, + + use_dfl_pwq: + mutex_lock(&wq->mutex); +- spin_lock_irq(&wq->dfl_pwq->pool->lock); ++ raw_spin_lock_irq(&wq->dfl_pwq->pool->lock); + get_pwq(wq->dfl_pwq); +- spin_unlock_irq(&wq->dfl_pwq->pool->lock); ++ raw_spin_unlock_irq(&wq->dfl_pwq->pool->lock); + old_pwq = numa_pwq_tbl_install(wq, node, wq->dfl_pwq); + out_unlock: + mutex_unlock(&wq->mutex); +@@ -4149,7 +4099,7 @@ struct workqueue_struct *__alloc_workqueue_key(const char *fmt, + return NULL; + + if (flags & WQ_UNBOUND) { +- wq->unbound_attrs = alloc_workqueue_attrs(GFP_KERNEL); ++ wq->unbound_attrs = alloc_workqueue_attrs(); + if (!wq->unbound_attrs) + goto err_free_wq; + } +@@ -4236,9 +4186,9 @@ void destroy_workqueue(struct workqueue_struct *wq) + struct worker *rescuer = wq->rescuer; + + /* this prevents new queueing */ +- spin_lock_irq(&wq_mayday_lock); ++ raw_spin_lock_irq(&wq_mayday_lock); + wq->rescuer = NULL; +- spin_unlock_irq(&wq_mayday_lock); ++ raw_spin_unlock_irq(&wq_mayday_lock); + + /* rescuer will empty maydays list before exiting */ + kthread_stop(rescuer->task); +@@ -4433,10 +4383,10 @@ unsigned int work_busy(struct work_struct *work) + rcu_read_lock(); + pool = get_work_pool(work); + if (pool) { +- spin_lock_irqsave(&pool->lock, flags); ++ raw_spin_lock_irqsave(&pool->lock, flags); + if (find_worker_executing_work(pool, work)) + ret |= WORK_BUSY_RUNNING; +- spin_unlock_irqrestore(&pool->lock, flags); ++ raw_spin_unlock_irqrestore(&pool->lock, flags); + } + rcu_read_unlock(); + +@@ -4643,10 +4593,10 @@ void show_workqueue_state(void) + pr_info("workqueue %s: flags=0x%x\n", wq->name, wq->flags); + + for_each_pwq(pwq, wq) { +- spin_lock_irqsave(&pwq->pool->lock, flags); ++ raw_spin_lock_irqsave(&pwq->pool->lock, flags); + if (pwq->nr_active || !list_empty(&pwq->delayed_works)) + show_pwq(pwq); +- spin_unlock_irqrestore(&pwq->pool->lock, flags); ++ raw_spin_unlock_irqrestore(&pwq->pool->lock, flags); + /* + * We could be printing a lot from atomic context, e.g. + * sysrq-t -> show_workqueue_state(). Avoid triggering +@@ -4660,7 +4610,7 @@ void show_workqueue_state(void) + struct worker *worker; + bool first = true; + +- spin_lock_irqsave(&pool->lock, flags); ++ raw_spin_lock_irqsave(&pool->lock, flags); + if (pool->nr_workers == pool->nr_idle) + goto next_pool; + +@@ -4679,7 +4629,7 @@ void show_workqueue_state(void) + } + pr_cont("\n"); + next_pool: +- spin_unlock_irqrestore(&pool->lock, flags); ++ raw_spin_unlock_irqrestore(&pool->lock, flags); + /* + * We could be printing a lot from atomic context, e.g. + * sysrq-t -> show_workqueue_state(). Avoid triggering +@@ -4709,7 +4659,7 @@ void wq_worker_comm(char *buf, size_t size, struct task_struct *task) + struct worker_pool *pool = worker->pool; + + if (pool) { +- spin_lock_irq(&pool->lock); ++ raw_spin_lock_irq(&pool->lock); + /* + * ->desc tracks information (wq name or + * set_worker_desc()) for the latest execution. If +@@ -4723,7 +4673,7 @@ void wq_worker_comm(char *buf, size_t size, struct task_struct *task) + scnprintf(buf + off, size - off, "-%s", + worker->desc); + } +- spin_unlock_irq(&pool->lock); ++ raw_spin_unlock_irq(&pool->lock); + } + } + +@@ -4754,7 +4704,7 @@ static void unbind_workers(int cpu) + + for_each_cpu_worker_pool(pool, cpu) { + mutex_lock(&wq_pool_attach_mutex); +- spin_lock_irq(&pool->lock); ++ raw_spin_lock_irq(&pool->lock); + + /* + * We've blocked all attach/detach operations. Make all workers +@@ -4768,7 +4718,7 @@ static void unbind_workers(int cpu) + + pool->flags |= POOL_DISASSOCIATED; + +- spin_unlock_irq(&pool->lock); ++ raw_spin_unlock_irq(&pool->lock); + mutex_unlock(&wq_pool_attach_mutex); + + /* +@@ -4794,9 +4744,9 @@ static void unbind_workers(int cpu) + * worker blocking could lead to lengthy stalls. Kick off + * unbound chain execution of currently pending work items. + */ +- spin_lock_irq(&pool->lock); ++ raw_spin_lock_irq(&pool->lock); + wake_up_worker(pool); +- spin_unlock_irq(&pool->lock); ++ raw_spin_unlock_irq(&pool->lock); + } + } + +@@ -4823,7 +4773,7 @@ static void rebind_workers(struct worker_pool *pool) + WARN_ON_ONCE(set_cpus_allowed_ptr(worker->task, + pool->attrs->cpumask) < 0); + +- spin_lock_irq(&pool->lock); ++ raw_spin_lock_irq(&pool->lock); + + pool->flags &= ~POOL_DISASSOCIATED; + +@@ -4862,7 +4812,7 @@ static void rebind_workers(struct worker_pool *pool) + WRITE_ONCE(worker->flags, worker_flags); + } + +- spin_unlock_irq(&pool->lock); ++ raw_spin_unlock_irq(&pool->lock); + } + + /** +@@ -5321,7 +5271,7 @@ static struct workqueue_attrs *wq_sysfs_prep_attrs(struct workqueue_struct *wq) + + lockdep_assert_held(&wq_pool_mutex); + +- attrs = alloc_workqueue_attrs(GFP_KERNEL); ++ attrs = alloc_workqueue_attrs(); + if (!attrs) + return NULL; + +@@ -5750,7 +5700,7 @@ static void __init wq_numa_init(void) + return; + } + +- wq_update_unbound_numa_attrs_buf = alloc_workqueue_attrs(GFP_KERNEL); ++ wq_update_unbound_numa_attrs_buf = alloc_workqueue_attrs(); + BUG_ON(!wq_update_unbound_numa_attrs_buf); + + /* +@@ -5825,7 +5775,7 @@ int __init workqueue_init_early(void) + for (i = 0; i < NR_STD_WORKER_POOLS; i++) { + struct workqueue_attrs *attrs; + +- BUG_ON(!(attrs = alloc_workqueue_attrs(GFP_KERNEL))); ++ BUG_ON(!(attrs = alloc_workqueue_attrs())); + attrs->nice = std_nice[i]; + unbound_std_wq_attrs[i] = attrs; + +@@ -5834,7 +5784,7 @@ int __init workqueue_init_early(void) + * guaranteed by max_active which is enforced by pwqs. + * Turn off NUMA so that dfl_pwq is used for all nodes. + */ +- BUG_ON(!(attrs = alloc_workqueue_attrs(GFP_KERNEL))); ++ BUG_ON(!(attrs = alloc_workqueue_attrs())); + attrs->nice = std_nice[i]; + attrs->no_numa = true; + ordered_wq_attrs[i] = attrs; diff --git a/debian/patches-rt/0285-i2c-exynos5-Remove-IRQF_ONESHOT.patch b/debian/patches-rt/0285-i2c-exynos5-Remove-IRQF_ONESHOT.patch new file mode 100644 index 000000000..8291cc7fa --- /dev/null +++ b/debian/patches-rt/0285-i2c-exynos5-Remove-IRQF_ONESHOT.patch @@ -0,0 +1,44 @@ +From: Sebastian Andrzej Siewior +Date: Tue, 13 Aug 2019 12:30:12 +0200 +Subject: [PATCH 285/342] i2c: exynos5: Remove IRQF_ONESHOT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=5d059b45c5670000931198afbd5e767ea166d2af + +[ Upstream commit 4b217df0ab3f7910c96e42091cc7d9f221d05f01 ] + +The drivers sets IRQF_ONESHOT and passes only a primary handler. The IRQ +is masked while the primary is handler is invoked independently of +IRQF_ONESHOT. +With IRQF_ONESHOT the core code will not force-thread the interrupt and +this is probably not intended. I *assume* that the original author copied +the IRQ registration from another driver which passed a primary and +secondary handler and removed the secondary handler but keeping the +ONESHOT flag. + +Remove IRQF_ONESHOT. + +Reported-by: Benjamin Rouxel +Tested-by: Benjamin Rouxel +Cc: Kukjin Kim +Cc: Krzysztof Kozlowski +Cc: linux-samsung-soc@vger.kernel.org +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + drivers/i2c/busses/i2c-exynos5.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-exynos5.c b/drivers/i2c/busses/i2c-exynos5.c +index c1ce2299a76e..5c57ecf4b79e 100644 +--- a/drivers/i2c/busses/i2c-exynos5.c ++++ b/drivers/i2c/busses/i2c-exynos5.c +@@ -800,9 +800,7 @@ static int exynos5_i2c_probe(struct platform_device *pdev) + } + + ret = devm_request_irq(&pdev->dev, i2c->irq, exynos5_i2c_irq, +- IRQF_NO_SUSPEND | IRQF_ONESHOT, +- dev_name(&pdev->dev), i2c); +- ++ IRQF_NO_SUSPEND, dev_name(&pdev->dev), i2c); + if (ret != 0) { + dev_err(&pdev->dev, "cannot request HS-I2C IRQ %d\n", i2c->irq); + goto err_clk; diff --git a/debian/patches-rt/0285-workqueue-rework.patch b/debian/patches-rt/0285-workqueue-rework.patch deleted file mode 100644 index 056eb3a62..000000000 --- a/debian/patches-rt/0285-workqueue-rework.patch +++ /dev/null @@ -1,1464 +0,0 @@ -From 6fb18a4e40f7937eb1d0ab9dd2929a50d30d91f7 Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Wed, 29 May 2019 18:52:27 +0200 -Subject: [PATCH 285/347] workqueue: rework -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit d15a862f24df983458533aebd6fa207ecdd1095a ] - -This is an all-in change of the workqueue rework. -The worker_pool.lock is made to raw_spinlock_t. With this change we can -schedule workitems from preempt-disable sections and sections with disabled -interrupts. This change allows to remove all kthread_.* workarounds we used to -have. - -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - block/blk-core.c | 6 +- - drivers/block/loop.c | 2 +- - drivers/spi/spi-rockchip.c | 1 - - drivers/thermal/x86_pkg_temp_thermal.c | 28 +-- - fs/aio.c | 10 +- - include/linux/blk-cgroup.h | 2 +- - include/linux/blkdev.h | 2 +- - include/linux/kthread-cgroup.h | 17 -- - include/linux/kthread.h | 15 +- - include/linux/swait.h | 14 ++ - include/linux/workqueue.h | 4 - - init/main.c | 1 - - kernel/kthread.c | 14 -- - kernel/sched/core.c | 1 + - kernel/time/hrtimer.c | 24 -- - kernel/workqueue.c | 304 +++++++++++-------------- - 16 files changed, 163 insertions(+), 282 deletions(-) - delete mode 100644 include/linux/kthread-cgroup.h - -diff --git a/block/blk-core.c b/block/blk-core.c -index a67a50dd714a..ed6ae335756d 100644 ---- a/block/blk-core.c -+++ b/block/blk-core.c -@@ -973,7 +973,7 @@ void blk_queue_exit(struct request_queue *q) - percpu_ref_put(&q->q_usage_counter); - } - --static void blk_queue_usage_counter_release_wrk(struct kthread_work *work) -+static void blk_queue_usage_counter_release_wrk(struct work_struct *work) - { - struct request_queue *q = - container_of(work, struct request_queue, mq_pcpu_wake); -@@ -987,7 +987,7 @@ static void blk_queue_usage_counter_release(struct percpu_ref *ref) - container_of(ref, struct request_queue, q_usage_counter); - - if (wq_has_sleeper(&q->mq_freeze_wq)) -- kthread_schedule_work(&q->mq_pcpu_wake); -+ schedule_work(&q->mq_pcpu_wake); - } - - static void blk_rq_timed_out_timer(struct timer_list *t) -@@ -1087,7 +1087,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id, - queue_flag_set_unlocked(QUEUE_FLAG_BYPASS, q); - - init_waitqueue_head(&q->mq_freeze_wq); -- kthread_init_work(&q->mq_pcpu_wake, blk_queue_usage_counter_release_wrk); -+ INIT_WORK(&q->mq_pcpu_wake, blk_queue_usage_counter_release_wrk); - - /* - * Init percpu_ref in atomic mode so that it's faster to shutdown. -diff --git a/drivers/block/loop.c b/drivers/block/loop.c -index d24660961343..c31a76485c9c 100644 ---- a/drivers/block/loop.c -+++ b/drivers/block/loop.c -@@ -70,7 +70,7 @@ - #include - #include - #include --#include -+#include - #include - #include - #include -diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c -index 63b10236eb05..185bbdce62b1 100644 ---- a/drivers/spi/spi-rockchip.c -+++ b/drivers/spi/spi-rockchip.c -@@ -22,7 +22,6 @@ - #include - #include - #include --#include - - #define DRIVER_NAME "rockchip-spi" - -diff --git a/drivers/thermal/x86_pkg_temp_thermal.c b/drivers/thermal/x86_pkg_temp_thermal.c -index 82f21fd4afb0..1ef937d799e4 100644 ---- a/drivers/thermal/x86_pkg_temp_thermal.c -+++ b/drivers/thermal/x86_pkg_temp_thermal.c -@@ -29,7 +29,6 @@ - #include - #include - #include --#include - #include - #include - -@@ -330,7 +329,7 @@ static void pkg_thermal_schedule_work(int cpu, struct delayed_work *work) - schedule_delayed_work_on(cpu, work, ms); - } - --static void pkg_thermal_notify_work(struct kthread_work *work) -+static int pkg_thermal_notify(u64 msr_val) - { - int cpu = smp_processor_id(); - struct pkg_device *pkgdev; -@@ -349,32 +348,8 @@ static void pkg_thermal_notify_work(struct kthread_work *work) - } - - spin_unlock_irqrestore(&pkg_temp_lock, flags); --} -- --#ifdef CONFIG_PREEMPT_RT_FULL --static DEFINE_KTHREAD_WORK(notify_work, pkg_thermal_notify_work); -- --static int pkg_thermal_notify(u64 msr_val) --{ -- kthread_schedule_work(¬ify_work); -- return 0; --} -- --static void pkg_thermal_notify_flush(void) --{ -- kthread_flush_work(¬ify_work); --} -- --#else /* !CONFIG_PREEMPT_RT_FULL */ -- --static void pkg_thermal_notify_flush(void) { } -- --static int pkg_thermal_notify(u64 msr_val) --{ -- pkg_thermal_notify_work(NULL); - return 0; - } --#endif /* CONFIG_PREEMPT_RT_FULL */ - - static int pkg_temp_thermal_device_add(unsigned int cpu) - { -@@ -573,7 +548,6 @@ static void __exit pkg_temp_thermal_exit(void) - platform_thermal_package_rate_control = NULL; - - cpuhp_remove_state(pkg_thermal_hp_state); -- pkg_thermal_notify_flush(); - debugfs_remove_recursive(debugfs); - kfree(packages); - } -diff --git a/fs/aio.c b/fs/aio.c -index 303e85033965..6deff68b92c7 100644 ---- a/fs/aio.c -+++ b/fs/aio.c -@@ -121,7 +121,7 @@ struct kioctx { - long nr_pages; - - struct rcu_work free_rwork; /* see free_ioctx() */ -- struct kthread_work free_kwork; /* see free_ioctx() */ -+ struct work_struct free_work; /* see free_ioctx() */ - - /* - * signals when all in-flight requests are done -@@ -609,9 +609,9 @@ static void free_ioctx_reqs(struct percpu_ref *ref) - * and ctx->users has dropped to 0, so we know no more kiocbs can be submitted - - * now it's safe to cancel any that need to be. - */ --static void free_ioctx_users_work(struct kthread_work *work) -+static void free_ioctx_users_work(struct work_struct *work) - { -- struct kioctx *ctx = container_of(work, struct kioctx, free_kwork); -+ struct kioctx *ctx = container_of(work, struct kioctx, free_work); - struct aio_kiocb *req; - - spin_lock_irq(&ctx->ctx_lock); -@@ -633,8 +633,8 @@ static void free_ioctx_users(struct percpu_ref *ref) - { - struct kioctx *ctx = container_of(ref, struct kioctx, users); - -- kthread_init_work(&ctx->free_kwork, free_ioctx_users_work); -- kthread_schedule_work(&ctx->free_kwork); -+ INIT_WORK(&ctx->free_work, free_ioctx_users_work); -+ schedule_work(&ctx->free_work); - } - - static int ioctx_add_table(struct kioctx *ctx, struct mm_struct *mm) -diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h -index dc26ce6d840d..53f63f18ecdf 100644 ---- a/include/linux/blk-cgroup.h -+++ b/include/linux/blk-cgroup.h -@@ -14,7 +14,7 @@ - * Nauman Rafique - */ - --#include -+#include - #include - #include - #include -diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h -index 5566d0049c22..c01e5d9597f9 100644 ---- a/include/linux/blkdev.h -+++ b/include/linux/blkdev.h -@@ -665,7 +665,7 @@ struct request_queue { - #endif - struct rcu_head rcu_head; - wait_queue_head_t mq_freeze_wq; -- struct kthread_work mq_pcpu_wake; -+ struct work_struct mq_pcpu_wake; - struct percpu_ref q_usage_counter; - struct list_head all_q_node; - -diff --git a/include/linux/kthread-cgroup.h b/include/linux/kthread-cgroup.h -deleted file mode 100644 -index 53d34bca9d72..000000000000 ---- a/include/linux/kthread-cgroup.h -+++ /dev/null -@@ -1,17 +0,0 @@ --/* SPDX-License-Identifier: GPL-2.0 */ --#ifndef _LINUX_KTHREAD_CGROUP_H --#define _LINUX_KTHREAD_CGROUP_H --#include --#include -- --#ifdef CONFIG_BLK_CGROUP --void kthread_associate_blkcg(struct cgroup_subsys_state *css); --struct cgroup_subsys_state *kthread_blkcg(void); --#else --static inline void kthread_associate_blkcg(struct cgroup_subsys_state *css) { } --static inline struct cgroup_subsys_state *kthread_blkcg(void) --{ -- return NULL; --} --#endif --#endif -diff --git a/include/linux/kthread.h b/include/linux/kthread.h -index 31140f0a6c2c..0e3b9b528c9e 100644 ---- a/include/linux/kthread.h -+++ b/include/linux/kthread.h -@@ -4,6 +4,7 @@ - /* Simple interface for creating and stopping kernel threads without mess. */ - #include - #include -+#include - - __printf(4, 5) - struct task_struct *kthread_create_on_node(int (*threadfn)(void *data), -@@ -200,12 +201,14 @@ bool kthread_cancel_delayed_work_sync(struct kthread_delayed_work *work); - - void kthread_destroy_worker(struct kthread_worker *worker); - --extern struct kthread_worker kthread_global_worker; --void kthread_init_global_worker(void); -- --static inline bool kthread_schedule_work(struct kthread_work *work) -+#ifdef CONFIG_BLK_CGROUP -+void kthread_associate_blkcg(struct cgroup_subsys_state *css); -+struct cgroup_subsys_state *kthread_blkcg(void); -+#else -+static inline void kthread_associate_blkcg(struct cgroup_subsys_state *css) { } -+static inline struct cgroup_subsys_state *kthread_blkcg(void) - { -- return kthread_queue_work(&kthread_global_worker, work); -+ return NULL; - } -- -+#endif - #endif /* _LINUX_KTHREAD_H */ -diff --git a/include/linux/swait.h b/include/linux/swait.h -index f426a0661aa0..21ae66cd41d3 100644 ---- a/include/linux/swait.h -+++ b/include/linux/swait.h -@@ -299,4 +299,18 @@ do { \ - __ret; \ - }) - -+#define __swait_event_lock_irq(wq, condition, lock, cmd) \ -+ ___swait_event(wq, condition, TASK_UNINTERRUPTIBLE, 0, \ -+ raw_spin_unlock_irq(&lock); \ -+ cmd; \ -+ schedule(); \ -+ raw_spin_lock_irq(&lock)) -+ -+#define swait_event_lock_irq(wq_head, condition, lock) \ -+ do { \ -+ if (condition) \ -+ break; \ -+ __swait_event_lock_irq(wq_head, condition, lock, ); \ -+ } while (0) -+ - #endif /* _LINUX_SWAIT_H */ -diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h -index 60d673e15632..546aa73fba6a 100644 ---- a/include/linux/workqueue.h -+++ b/include/linux/workqueue.h -@@ -455,10 +455,6 @@ __alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active, - - extern void destroy_workqueue(struct workqueue_struct *wq); - --struct workqueue_attrs *alloc_workqueue_attrs(gfp_t gfp_mask); --void free_workqueue_attrs(struct workqueue_attrs *attrs); --int apply_workqueue_attrs(struct workqueue_struct *wq, -- const struct workqueue_attrs *attrs); - int workqueue_set_unbound_cpumask(cpumask_var_t cpumask); - - extern bool queue_work_on(int cpu, struct workqueue_struct *wq, -diff --git a/init/main.c b/init/main.c -index f5d0917a4d4b..0d5763c5da28 100644 ---- a/init/main.c -+++ b/init/main.c -@@ -1132,7 +1132,6 @@ static noinline void __init kernel_init_freeable(void) - smp_prepare_cpus(setup_max_cpus); - - workqueue_init(); -- kthread_init_global_worker(); - - init_mm_internals(); - -diff --git a/kernel/kthread.c b/kernel/kthread.c -index 6bbd391f0d9c..c8cf4731ced8 100644 ---- a/kernel/kthread.c -+++ b/kernel/kthread.c -@@ -20,7 +20,6 @@ - #include - #include - #include --#include - #include - - static DEFINE_SPINLOCK(kthread_create_lock); -@@ -1245,19 +1244,6 @@ void kthread_destroy_worker(struct kthread_worker *worker) - } - EXPORT_SYMBOL(kthread_destroy_worker); - --DEFINE_KTHREAD_WORKER(kthread_global_worker); --EXPORT_SYMBOL(kthread_global_worker); -- --__init void kthread_init_global_worker(void) --{ -- kthread_global_worker.task = kthread_create(kthread_worker_fn, -- &kthread_global_worker, -- "kswork"); -- if (WARN_ON(IS_ERR(kthread_global_worker.task))) -- return; -- wake_up_process(kthread_global_worker.task); --} -- - #ifdef CONFIG_BLK_CGROUP - /** - * kthread_associate_blkcg - associate blkcg to current kthread -diff --git a/kernel/sched/core.c b/kernel/sched/core.c -index 3b0f62be3ece..1d4d4780dd79 100644 ---- a/kernel/sched/core.c -+++ b/kernel/sched/core.c -@@ -3612,6 +3612,7 @@ static inline void sched_submit_work(struct task_struct *tsk) - { - if (!tsk->state) - return; -+ - /* - * If a worker went to sleep, notify and ask workqueue whether - * it wants to wake up a task to maintain concurrency. -diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c -index bbc408f24f5d..eb2db7e6a241 100644 ---- a/kernel/time/hrtimer.c -+++ b/kernel/time/hrtimer.c -@@ -748,29 +748,6 @@ static void hrtimer_switch_to_hres(void) - retrigger_next_event(NULL); - } - --#ifdef CONFIG_PREEMPT_RT_FULL -- --static struct swork_event clock_set_delay_work; -- --static void run_clock_set_delay(struct swork_event *event) --{ -- clock_was_set(); --} -- --void clock_was_set_delayed(void) --{ -- swork_queue(&clock_set_delay_work); --} -- --static __init int create_clock_set_delay_thread(void) --{ -- WARN_ON(swork_get()); -- INIT_SWORK(&clock_set_delay_work, run_clock_set_delay); -- return 0; --} --early_initcall(create_clock_set_delay_thread); --#else /* PREEMPT_RT_FULL */ -- - static void clock_was_set_work(struct work_struct *work) - { - clock_was_set(); -@@ -786,7 +763,6 @@ void clock_was_set_delayed(void) - { - schedule_work(&hrtimer_work); - } --#endif - - #else - -diff --git a/kernel/workqueue.c b/kernel/workqueue.c -index 91f5696cf335..4ed22776b2ee 100644 ---- a/kernel/workqueue.c -+++ b/kernel/workqueue.c -@@ -50,8 +50,6 @@ - #include - #include - #include --#include --#include - - #include "workqueue_internal.h" - -@@ -126,11 +124,6 @@ enum { - * cpu or grabbing pool->lock is enough for read access. If - * POOL_DISASSOCIATED is set, it's identical to L. - * -- * On RT we need the extra protection via rt_lock_idle_list() for -- * the list manipulations against read access from -- * wq_worker_sleeping(). All other places are nicely serialized via -- * pool->lock. -- * - * A: wq_pool_attach_mutex protected. - * - * PL: wq_pool_mutex protected. -@@ -152,7 +145,7 @@ enum { - /* struct worker is defined in workqueue_internal.h */ - - struct worker_pool { -- spinlock_t lock; /* the pool lock */ -+ raw_spinlock_t lock; /* the pool lock */ - int cpu; /* I: the associated cpu */ - int node; /* I: the associated node ID */ - int id; /* I: pool ID */ -@@ -305,8 +298,8 @@ static struct workqueue_attrs *wq_update_unbound_numa_attrs_buf; - - static DEFINE_MUTEX(wq_pool_mutex); /* protects pools and workqueues list */ - static DEFINE_MUTEX(wq_pool_attach_mutex); /* protects worker attach/detach */ --static DEFINE_SPINLOCK(wq_mayday_lock); /* protects wq->maydays list */ --static DECLARE_WAIT_QUEUE_HEAD(wq_manager_wait); /* wait for manager to go away */ -+static DEFINE_RAW_SPINLOCK(wq_mayday_lock); /* protects wq->maydays list */ -+static DECLARE_SWAIT_QUEUE_HEAD(wq_manager_wait); /* wait for manager to go away */ - - static LIST_HEAD(workqueues); /* PR: list of all workqueues */ - static bool workqueue_freezing; /* PL: have wqs started freezing? */ -@@ -358,8 +351,6 @@ EXPORT_SYMBOL_GPL(system_power_efficient_wq); - struct workqueue_struct *system_freezable_power_efficient_wq __read_mostly; - EXPORT_SYMBOL_GPL(system_freezable_power_efficient_wq); - --static DEFINE_LOCAL_IRQ_LOCK(pendingb_lock); -- - static int worker_thread(void *__worker); - static void workqueue_sysfs_unregister(struct workqueue_struct *wq); - -@@ -436,31 +427,6 @@ static void workqueue_sysfs_unregister(struct workqueue_struct *wq); - if (({ assert_rcu_or_wq_mutex(wq); false; })) { } \ - else - --#ifdef CONFIG_PREEMPT_RT_BASE --static inline void rt_lock_idle_list(struct worker_pool *pool) --{ -- preempt_disable(); --} --static inline void rt_unlock_idle_list(struct worker_pool *pool) --{ -- preempt_enable(); --} --static inline void sched_lock_idle_list(struct worker_pool *pool) { } --static inline void sched_unlock_idle_list(struct worker_pool *pool) { } --#else --static inline void rt_lock_idle_list(struct worker_pool *pool) { } --static inline void rt_unlock_idle_list(struct worker_pool *pool) { } --static inline void sched_lock_idle_list(struct worker_pool *pool) --{ -- spin_lock_irq(&pool->lock); --} --static inline void sched_unlock_idle_list(struct worker_pool *pool) --{ -- spin_unlock_irq(&pool->lock); --} --#endif -- -- - #ifdef CONFIG_DEBUG_OBJECTS_WORK - - static struct debug_obj_descr work_debug_descr; -@@ -863,20 +829,14 @@ static struct worker *first_idle_worker(struct worker_pool *pool) - * Wake up the first idle worker of @pool. - * - * CONTEXT: -- * spin_lock_irq(pool->lock). -+ * raw_spin_lock_irq(pool->lock). - */ - static void wake_up_worker(struct worker_pool *pool) - { -- struct worker *worker; -- -- rt_lock_idle_list(pool); -- -- worker = first_idle_worker(pool); -+ struct worker *worker = first_idle_worker(pool); - - if (likely(worker)) - wake_up_process(worker->task); -- -- rt_unlock_idle_list(pool); - } - - /** -@@ -905,7 +865,7 @@ void wq_worker_running(struct task_struct *task) - */ - void wq_worker_sleeping(struct task_struct *task) - { -- struct worker *worker = kthread_data(task); -+ struct worker *next, *worker = kthread_data(task); - struct worker_pool *pool; - - /* -@@ -922,18 +882,26 @@ void wq_worker_sleeping(struct task_struct *task) - return; - - worker->sleeping = 1; -+ raw_spin_lock_irq(&pool->lock); - - /* - * The counterpart of the following dec_and_test, implied mb, - * worklist not empty test sequence is in insert_work(). - * Please read comment there. -+ * -+ * NOT_RUNNING is clear. This means that we're bound to and -+ * running on the local cpu w/ rq lock held and preemption -+ * disabled, which in turn means that none else could be -+ * manipulating idle_list, so dereferencing idle_list without pool -+ * lock is safe. - */ - if (atomic_dec_and_test(&pool->nr_running) && - !list_empty(&pool->worklist)) { -- sched_lock_idle_list(pool); -- wake_up_worker(pool); -- sched_unlock_idle_list(pool); -+ next = first_idle_worker(pool); -+ if (next) -+ wake_up_process(next->task); - } -+ raw_spin_unlock_irq(&pool->lock); - } - - /** -@@ -944,7 +912,7 @@ void wq_worker_sleeping(struct task_struct *task) - * Set @flags in @worker->flags and adjust nr_running accordingly. - * - * CONTEXT: -- * spin_lock_irq(pool->lock) -+ * raw_spin_lock_irq(pool->lock) - */ - static inline void worker_set_flags(struct worker *worker, unsigned int flags) - { -@@ -969,7 +937,7 @@ static inline void worker_set_flags(struct worker *worker, unsigned int flags) - * Clear @flags in @worker->flags and adjust nr_running accordingly. - * - * CONTEXT: -- * spin_lock_irq(pool->lock) -+ * raw_spin_lock_irq(pool->lock) - */ - static inline void worker_clr_flags(struct worker *worker, unsigned int flags) - { -@@ -1017,7 +985,7 @@ static inline void worker_clr_flags(struct worker *worker, unsigned int flags) - * actually occurs, it should be easy to locate the culprit work function. - * - * CONTEXT: -- * spin_lock_irq(pool->lock). -+ * raw_spin_lock_irq(pool->lock). - * - * Return: - * Pointer to worker which is executing @work if found, %NULL -@@ -1052,7 +1020,7 @@ static struct worker *find_worker_executing_work(struct worker_pool *pool, - * nested inside outer list_for_each_entry_safe(). - * - * CONTEXT: -- * spin_lock_irq(pool->lock). -+ * raw_spin_lock_irq(pool->lock). - */ - static void move_linked_works(struct work_struct *work, struct list_head *head, - struct work_struct **nextp) -@@ -1130,11 +1098,9 @@ static void put_pwq_unlocked(struct pool_workqueue *pwq) - * As both pwqs and pools are RCU protected, the - * following lock operations are safe. - */ -- rcu_read_lock(); -- local_spin_lock_irq(pendingb_lock, &pwq->pool->lock); -+ raw_spin_lock_irq(&pwq->pool->lock); - put_pwq(pwq); -- local_spin_unlock_irq(pendingb_lock, &pwq->pool->lock); -- rcu_read_unlock(); -+ raw_spin_unlock_irq(&pwq->pool->lock); - } - } - -@@ -1167,7 +1133,7 @@ static void pwq_activate_first_delayed(struct pool_workqueue *pwq) - * decrement nr_in_flight of its pwq and handle workqueue flushing. - * - * CONTEXT: -- * spin_lock_irq(pool->lock). -+ * raw_spin_lock_irq(pool->lock). - */ - static void pwq_dec_nr_in_flight(struct pool_workqueue *pwq, int color) - { -@@ -1238,7 +1204,7 @@ static int try_to_grab_pending(struct work_struct *work, bool is_dwork, - struct worker_pool *pool; - struct pool_workqueue *pwq; - -- local_lock_irqsave(pendingb_lock, *flags); -+ local_irq_save(*flags); - - /* try to steal the timer if it exists */ - if (is_dwork) { -@@ -1266,7 +1232,7 @@ static int try_to_grab_pending(struct work_struct *work, bool is_dwork, - if (!pool) - goto fail; - -- spin_lock(&pool->lock); -+ raw_spin_lock(&pool->lock); - /* - * work->data is guaranteed to point to pwq only while the work - * item is queued on pwq->wq, and both updating work->data to point -@@ -1295,17 +1261,17 @@ static int try_to_grab_pending(struct work_struct *work, bool is_dwork, - /* work->data points to pwq iff queued, point to pool */ - set_work_pool_and_keep_pending(work, pool->id); - -- spin_unlock(&pool->lock); -+ raw_spin_unlock(&pool->lock); - rcu_read_unlock(); - return 1; - } -- spin_unlock(&pool->lock); -+ raw_spin_unlock(&pool->lock); - fail: - rcu_read_unlock(); -- local_unlock_irqrestore(pendingb_lock, *flags); -+ local_irq_restore(*flags); - if (work_is_canceling(work)) - return -ENOENT; -- cpu_chill(); -+ cpu_relax(); - return -EAGAIN; - } - -@@ -1320,7 +1286,7 @@ static int try_to_grab_pending(struct work_struct *work, bool is_dwork, - * work_struct flags. - * - * CONTEXT: -- * spin_lock_irq(pool->lock). -+ * raw_spin_lock_irq(pool->lock). - */ - static void insert_work(struct pool_workqueue *pwq, struct work_struct *work, - struct list_head *head, unsigned int extra_flags) -@@ -1407,13 +1373,7 @@ static void __queue_work(int cpu, struct workqueue_struct *wq, - * queued or lose PENDING. Grabbing PENDING and queueing should - * happen with IRQ disabled. - */ --#ifndef CONFIG_PREEMPT_RT_FULL -- /* -- * nort: On RT the "interrupts-disabled" rule has been replaced with -- * pendingb_lock. -- */ - lockdep_assert_irqs_disabled(); --#endif - - - /* if draining, only works from the same workqueue are allowed */ -@@ -1442,7 +1402,7 @@ static void __queue_work(int cpu, struct workqueue_struct *wq, - if (last_pool && last_pool != pwq->pool) { - struct worker *worker; - -- spin_lock(&last_pool->lock); -+ raw_spin_lock(&last_pool->lock); - - worker = find_worker_executing_work(last_pool, work); - -@@ -1450,11 +1410,11 @@ static void __queue_work(int cpu, struct workqueue_struct *wq, - pwq = worker->current_pwq; - } else { - /* meh... not running there, queue here */ -- spin_unlock(&last_pool->lock); -- spin_lock(&pwq->pool->lock); -+ raw_spin_unlock(&last_pool->lock); -+ raw_spin_lock(&pwq->pool->lock); - } - } else { -- spin_lock(&pwq->pool->lock); -+ raw_spin_lock(&pwq->pool->lock); - } - - /* -@@ -1467,7 +1427,7 @@ static void __queue_work(int cpu, struct workqueue_struct *wq, - */ - if (unlikely(!pwq->refcnt)) { - if (wq->flags & WQ_UNBOUND) { -- spin_unlock(&pwq->pool->lock); -+ raw_spin_unlock(&pwq->pool->lock); - cpu_relax(); - goto retry; - } -@@ -1500,7 +1460,7 @@ static void __queue_work(int cpu, struct workqueue_struct *wq, - insert_work(pwq, work, worklist, work_flags); - - out: -- spin_unlock(&pwq->pool->lock); -+ raw_spin_unlock(&pwq->pool->lock); - rcu_read_unlock(); - } - -@@ -1521,14 +1481,14 @@ bool queue_work_on(int cpu, struct workqueue_struct *wq, - bool ret = false; - unsigned long flags; - -- local_lock_irqsave(pendingb_lock,flags); -+ local_irq_save(flags); - - if (!test_and_set_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(work))) { - __queue_work(cpu, wq, work); - ret = true; - } - -- local_unlock_irqrestore(pendingb_lock, flags); -+ local_irq_restore(flags); - return ret; - } - EXPORT_SYMBOL(queue_work_on); -@@ -1536,12 +1496,11 @@ EXPORT_SYMBOL(queue_work_on); - void delayed_work_timer_fn(struct timer_list *t) - { - struct delayed_work *dwork = from_timer(dwork, t, timer); -+ unsigned long flags; - -- /* XXX */ -- /* local_lock(pendingb_lock); */ -- /* should have been called from irqsafe timer with irq already off */ -+ local_irq_save(flags); - __queue_work(dwork->cpu, dwork->wq, &dwork->work); -- /* local_unlock(pendingb_lock); */ -+ local_irq_restore(flags); - } - EXPORT_SYMBOL(delayed_work_timer_fn); - -@@ -1596,14 +1555,14 @@ bool queue_delayed_work_on(int cpu, struct workqueue_struct *wq, - unsigned long flags; - - /* read the comment in __queue_work() */ -- local_lock_irqsave(pendingb_lock, flags); -+ local_irq_save(flags); - - if (!test_and_set_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(work))) { - __queue_delayed_work(cpu, wq, dwork, delay); - ret = true; - } - -- local_unlock_irqrestore(pendingb_lock, flags); -+ local_irq_restore(flags); - return ret; - } - EXPORT_SYMBOL(queue_delayed_work_on); -@@ -1638,7 +1597,7 @@ bool mod_delayed_work_on(int cpu, struct workqueue_struct *wq, - - if (likely(ret >= 0)) { - __queue_delayed_work(cpu, wq, dwork, delay); -- local_unlock_irqrestore(pendingb_lock, flags); -+ local_irq_restore(flags); - } - - /* -ENOENT from try_to_grab_pending() becomes %true */ -@@ -1649,12 +1608,11 @@ EXPORT_SYMBOL_GPL(mod_delayed_work_on); - static void rcu_work_rcufn(struct rcu_head *rcu) - { - struct rcu_work *rwork = container_of(rcu, struct rcu_work, rcu); -- unsigned long flags; - - /* read the comment in __queue_work() */ -- local_lock_irqsave(pendingb_lock, flags); -+ local_irq_disable(); - __queue_work(WORK_CPU_UNBOUND, rwork->wq, &rwork->work); -- local_unlock_irqrestore(pendingb_lock, flags); -+ local_irq_enable(); - } - - /** -@@ -1689,7 +1647,7 @@ EXPORT_SYMBOL(queue_rcu_work); - * necessary. - * - * LOCKING: -- * spin_lock_irq(pool->lock). -+ * raw_spin_lock_irq(pool->lock). - */ - static void worker_enter_idle(struct worker *worker) - { -@@ -1706,9 +1664,7 @@ static void worker_enter_idle(struct worker *worker) - worker->last_active = jiffies; - - /* idle_list is LIFO */ -- rt_lock_idle_list(pool); - list_add(&worker->entry, &pool->idle_list); -- rt_unlock_idle_list(pool); - - if (too_many_workers(pool) && !timer_pending(&pool->idle_timer)) - mod_timer(&pool->idle_timer, jiffies + IDLE_WORKER_TIMEOUT); -@@ -1731,7 +1687,7 @@ static void worker_enter_idle(struct worker *worker) - * @worker is leaving idle state. Update stats. - * - * LOCKING: -- * spin_lock_irq(pool->lock). -+ * raw_spin_lock_irq(pool->lock). - */ - static void worker_leave_idle(struct worker *worker) - { -@@ -1741,9 +1697,7 @@ static void worker_leave_idle(struct worker *worker) - return; - worker_clr_flags(worker, WORKER_IDLE); - pool->nr_idle--; -- rt_lock_idle_list(pool); - list_del_init(&worker->entry); -- rt_unlock_idle_list(pool); - } - - static struct worker *alloc_worker(int node) -@@ -1868,11 +1822,11 @@ static struct worker *create_worker(struct worker_pool *pool) - worker_attach_to_pool(worker, pool); - - /* start the newly created worker */ -- spin_lock_irq(&pool->lock); -+ raw_spin_lock_irq(&pool->lock); - worker->pool->nr_workers++; - worker_enter_idle(worker); - wake_up_process(worker->task); -- spin_unlock_irq(&pool->lock); -+ raw_spin_unlock_irq(&pool->lock); - - return worker; - -@@ -1891,7 +1845,7 @@ static struct worker *create_worker(struct worker_pool *pool) - * be idle. - * - * CONTEXT: -- * spin_lock_irq(pool->lock). -+ * raw_spin_lock_irq(pool->lock). - */ - static void destroy_worker(struct worker *worker) - { -@@ -1908,9 +1862,7 @@ static void destroy_worker(struct worker *worker) - pool->nr_workers--; - pool->nr_idle--; - -- rt_lock_idle_list(pool); - list_del_init(&worker->entry); -- rt_unlock_idle_list(pool); - worker->flags |= WORKER_DIE; - wake_up_process(worker->task); - } -@@ -1919,7 +1871,7 @@ static void idle_worker_timeout(struct timer_list *t) - { - struct worker_pool *pool = from_timer(pool, t, idle_timer); - -- spin_lock_irq(&pool->lock); -+ raw_spin_lock_irq(&pool->lock); - - while (too_many_workers(pool)) { - struct worker *worker; -@@ -1937,7 +1889,7 @@ static void idle_worker_timeout(struct timer_list *t) - destroy_worker(worker); - } - -- spin_unlock_irq(&pool->lock); -+ raw_spin_unlock_irq(&pool->lock); - } - - static void send_mayday(struct work_struct *work) -@@ -1968,8 +1920,8 @@ static void pool_mayday_timeout(struct timer_list *t) - struct worker_pool *pool = from_timer(pool, t, mayday_timer); - struct work_struct *work; - -- spin_lock_irq(&pool->lock); -- spin_lock(&wq_mayday_lock); /* for wq->maydays */ -+ raw_spin_lock_irq(&pool->lock); -+ raw_spin_lock(&wq_mayday_lock); /* for wq->maydays */ - - if (need_to_create_worker(pool)) { - /* -@@ -1982,8 +1934,8 @@ static void pool_mayday_timeout(struct timer_list *t) - send_mayday(work); - } - -- spin_unlock(&wq_mayday_lock); -- spin_unlock_irq(&pool->lock); -+ raw_spin_unlock(&wq_mayday_lock); -+ raw_spin_unlock_irq(&pool->lock); - - mod_timer(&pool->mayday_timer, jiffies + MAYDAY_INTERVAL); - } -@@ -2002,7 +1954,7 @@ static void pool_mayday_timeout(struct timer_list *t) - * may_start_working() %true. - * - * LOCKING: -- * spin_lock_irq(pool->lock) which may be released and regrabbed -+ * raw_spin_lock_irq(pool->lock) which may be released and regrabbed - * multiple times. Does GFP_KERNEL allocations. Called only from - * manager. - */ -@@ -2011,7 +1963,7 @@ __releases(&pool->lock) - __acquires(&pool->lock) - { - restart: -- spin_unlock_irq(&pool->lock); -+ raw_spin_unlock_irq(&pool->lock); - - /* if we don't make progress in MAYDAY_INITIAL_TIMEOUT, call for help */ - mod_timer(&pool->mayday_timer, jiffies + MAYDAY_INITIAL_TIMEOUT); -@@ -2027,7 +1979,7 @@ __acquires(&pool->lock) - } - - del_timer_sync(&pool->mayday_timer); -- spin_lock_irq(&pool->lock); -+ raw_spin_lock_irq(&pool->lock); - /* - * This is necessary even after a new worker was just successfully - * created as @pool->lock was dropped and the new worker might have -@@ -2050,7 +2002,7 @@ __acquires(&pool->lock) - * and may_start_working() is true. - * - * CONTEXT: -- * spin_lock_irq(pool->lock) which may be released and regrabbed -+ * raw_spin_lock_irq(pool->lock) which may be released and regrabbed - * multiple times. Does GFP_KERNEL allocations. - * - * Return: -@@ -2073,7 +2025,7 @@ static bool manage_workers(struct worker *worker) - - pool->manager = NULL; - pool->flags &= ~POOL_MANAGER_ACTIVE; -- wake_up(&wq_manager_wait); -+ swake_up_one(&wq_manager_wait); - return true; - } - -@@ -2089,7 +2041,7 @@ static bool manage_workers(struct worker *worker) - * call this function to process a work. - * - * CONTEXT: -- * spin_lock_irq(pool->lock) which is released and regrabbed. -+ * raw_spin_lock_irq(pool->lock) which is released and regrabbed. - */ - static void process_one_work(struct worker *worker, struct work_struct *work) - __releases(&pool->lock) -@@ -2171,7 +2123,7 @@ __acquires(&pool->lock) - */ - set_work_pool_and_clear_pending(work, pool->id); - -- spin_unlock_irq(&pool->lock); -+ raw_spin_unlock_irq(&pool->lock); - - lock_map_acquire(&pwq->wq->lockdep_map); - lock_map_acquire(&lockdep_map); -@@ -2226,7 +2178,7 @@ __acquires(&pool->lock) - */ - cond_resched(); - -- spin_lock_irq(&pool->lock); -+ raw_spin_lock_irq(&pool->lock); - - /* clear cpu intensive status */ - if (unlikely(cpu_intensive)) -@@ -2249,7 +2201,7 @@ __acquires(&pool->lock) - * fetches a work from the top and executes it. - * - * CONTEXT: -- * spin_lock_irq(pool->lock) which may be released and regrabbed -+ * raw_spin_lock_irq(pool->lock) which may be released and regrabbed - * multiple times. - */ - static void process_scheduled_works(struct worker *worker) -@@ -2291,11 +2243,11 @@ static int worker_thread(void *__worker) - /* tell the scheduler that this is a workqueue worker */ - set_pf_worker(true); - woke_up: -- spin_lock_irq(&pool->lock); -+ raw_spin_lock_irq(&pool->lock); - - /* am I supposed to die? */ - if (unlikely(worker->flags & WORKER_DIE)) { -- spin_unlock_irq(&pool->lock); -+ raw_spin_unlock_irq(&pool->lock); - WARN_ON_ONCE(!list_empty(&worker->entry)); - set_pf_worker(false); - -@@ -2361,7 +2313,7 @@ static int worker_thread(void *__worker) - */ - worker_enter_idle(worker); - __set_current_state(TASK_IDLE); -- spin_unlock_irq(&pool->lock); -+ raw_spin_unlock_irq(&pool->lock); - schedule(); - goto woke_up; - } -@@ -2415,7 +2367,7 @@ static int rescuer_thread(void *__rescuer) - should_stop = kthread_should_stop(); - - /* see whether any pwq is asking for help */ -- spin_lock_irq(&wq_mayday_lock); -+ raw_spin_lock_irq(&wq_mayday_lock); - - while (!list_empty(&wq->maydays)) { - struct pool_workqueue *pwq = list_first_entry(&wq->maydays, -@@ -2427,11 +2379,11 @@ static int rescuer_thread(void *__rescuer) - __set_current_state(TASK_RUNNING); - list_del_init(&pwq->mayday_node); - -- spin_unlock_irq(&wq_mayday_lock); -+ raw_spin_unlock_irq(&wq_mayday_lock); - - worker_attach_to_pool(rescuer, pool); - -- spin_lock_irq(&pool->lock); -+ raw_spin_lock_irq(&pool->lock); - - /* - * Slurp in all works issued via this workqueue and -@@ -2460,7 +2412,7 @@ static int rescuer_thread(void *__rescuer) - * incur MAYDAY_INTERVAL delay inbetween. - */ - if (need_to_create_worker(pool)) { -- spin_lock(&wq_mayday_lock); -+ raw_spin_lock(&wq_mayday_lock); - /* - * Queue iff we aren't racing destruction - * and somebody else hasn't queued it already. -@@ -2469,7 +2421,7 @@ static int rescuer_thread(void *__rescuer) - get_pwq(pwq); - list_add_tail(&pwq->mayday_node, &wq->maydays); - } -- spin_unlock(&wq_mayday_lock); -+ raw_spin_unlock(&wq_mayday_lock); - } - } - -@@ -2487,14 +2439,14 @@ static int rescuer_thread(void *__rescuer) - if (need_more_worker(pool)) - wake_up_worker(pool); - -- spin_unlock_irq(&pool->lock); -+ raw_spin_unlock_irq(&pool->lock); - - worker_detach_from_pool(rescuer); - -- spin_lock_irq(&wq_mayday_lock); -+ raw_spin_lock_irq(&wq_mayday_lock); - } - -- spin_unlock_irq(&wq_mayday_lock); -+ raw_spin_unlock_irq(&wq_mayday_lock); - - if (should_stop) { - __set_current_state(TASK_RUNNING); -@@ -2574,7 +2526,7 @@ static void wq_barrier_func(struct work_struct *work) - * underneath us, so we can't reliably determine pwq from @target. - * - * CONTEXT: -- * spin_lock_irq(pool->lock). -+ * raw_spin_lock_irq(pool->lock). - */ - static void insert_wq_barrier(struct pool_workqueue *pwq, - struct wq_barrier *barr, -@@ -2661,7 +2613,7 @@ static bool flush_workqueue_prep_pwqs(struct workqueue_struct *wq, - for_each_pwq(pwq, wq) { - struct worker_pool *pool = pwq->pool; - -- spin_lock_irq(&pool->lock); -+ raw_spin_lock_irq(&pool->lock); - - if (flush_color >= 0) { - WARN_ON_ONCE(pwq->flush_color != -1); -@@ -2678,7 +2630,7 @@ static bool flush_workqueue_prep_pwqs(struct workqueue_struct *wq, - pwq->work_color = work_color; - } - -- spin_unlock_irq(&pool->lock); -+ raw_spin_unlock_irq(&pool->lock); - } - - if (flush_color >= 0 && atomic_dec_and_test(&wq->nr_pwqs_to_flush)) -@@ -2878,9 +2830,9 @@ void drain_workqueue(struct workqueue_struct *wq) - for_each_pwq(pwq, wq) { - bool drained; - -- spin_lock_irq(&pwq->pool->lock); -+ raw_spin_lock_irq(&pwq->pool->lock); - drained = !pwq->nr_active && list_empty(&pwq->delayed_works); -- spin_unlock_irq(&pwq->pool->lock); -+ raw_spin_unlock_irq(&pwq->pool->lock); - - if (drained) - continue; -@@ -2916,7 +2868,7 @@ static bool start_flush_work(struct work_struct *work, struct wq_barrier *barr, - return false; - } - -- spin_lock_irq(&pool->lock); -+ raw_spin_lock_irq(&pool->lock); - /* see the comment in try_to_grab_pending() with the same code */ - pwq = get_work_pwq(work); - if (pwq) { -@@ -2932,7 +2884,7 @@ static bool start_flush_work(struct work_struct *work, struct wq_barrier *barr, - check_flush_dependency(pwq->wq, work); - - insert_wq_barrier(pwq, barr, work, worker); -- spin_unlock_irq(&pool->lock); -+ raw_spin_unlock_irq(&pool->lock); - - /* - * Force a lock recursion deadlock when using flush_work() inside a -@@ -2951,7 +2903,7 @@ static bool start_flush_work(struct work_struct *work, struct wq_barrier *barr, - rcu_read_unlock(); - return true; - already_gone: -- spin_unlock_irq(&pool->lock); -+ raw_spin_unlock_irq(&pool->lock); - rcu_read_unlock(); - return false; - } -@@ -3052,7 +3004,7 @@ static bool __cancel_work_timer(struct work_struct *work, bool is_dwork) - - /* tell other tasks trying to grab @work to back off */ - mark_work_canceling(work); -- local_unlock_irqrestore(pendingb_lock, flags); -+ local_irq_restore(flags); - - /* - * This allows canceling during early boot. We know that @work -@@ -3113,10 +3065,10 @@ EXPORT_SYMBOL_GPL(cancel_work_sync); - */ - bool flush_delayed_work(struct delayed_work *dwork) - { -- local_lock_irq(pendingb_lock); -+ local_irq_disable(); - if (del_timer_sync(&dwork->timer)) - __queue_work(dwork->cpu, dwork->wq, &dwork->work); -- local_unlock_irq(pendingb_lock); -+ local_irq_enable(); - return flush_work(&dwork->work); - } - EXPORT_SYMBOL(flush_delayed_work); -@@ -3154,7 +3106,7 @@ static bool __cancel_work(struct work_struct *work, bool is_dwork) - return false; - - set_work_pool_and_clear_pending(work, get_work_pool_id(work)); -- local_unlock_irqrestore(pendingb_lock, flags); -+ local_irq_restore(flags); - return ret; - } - -@@ -3264,7 +3216,7 @@ EXPORT_SYMBOL_GPL(execute_in_process_context); - * - * Undo alloc_workqueue_attrs(). - */ --void free_workqueue_attrs(struct workqueue_attrs *attrs) -+static void free_workqueue_attrs(struct workqueue_attrs *attrs) - { - if (attrs) { - free_cpumask_var(attrs->cpumask); -@@ -3274,21 +3226,20 @@ void free_workqueue_attrs(struct workqueue_attrs *attrs) - - /** - * alloc_workqueue_attrs - allocate a workqueue_attrs -- * @gfp_mask: allocation mask to use - * - * Allocate a new workqueue_attrs, initialize with default settings and - * return it. - * - * Return: The allocated new workqueue_attr on success. %NULL on failure. - */ --struct workqueue_attrs *alloc_workqueue_attrs(gfp_t gfp_mask) -+static struct workqueue_attrs *alloc_workqueue_attrs(void) - { - struct workqueue_attrs *attrs; - -- attrs = kzalloc(sizeof(*attrs), gfp_mask); -+ attrs = kzalloc(sizeof(*attrs), GFP_KERNEL); - if (!attrs) - goto fail; -- if (!alloc_cpumask_var(&attrs->cpumask, gfp_mask)) -+ if (!alloc_cpumask_var(&attrs->cpumask, GFP_KERNEL)) - goto fail; - - cpumask_copy(attrs->cpumask, cpu_possible_mask); -@@ -3345,7 +3296,7 @@ static bool wqattrs_equal(const struct workqueue_attrs *a, - */ - static int init_worker_pool(struct worker_pool *pool) - { -- spin_lock_init(&pool->lock); -+ raw_spin_lock_init(&pool->lock); - pool->id = -1; - pool->cpu = -1; - pool->node = NUMA_NO_NODE; -@@ -3366,7 +3317,7 @@ static int init_worker_pool(struct worker_pool *pool) - pool->refcnt = 1; - - /* shouldn't fail above this point */ -- pool->attrs = alloc_workqueue_attrs(GFP_KERNEL); -+ pool->attrs = alloc_workqueue_attrs(); - if (!pool->attrs) - return -ENOMEM; - return 0; -@@ -3431,15 +3382,15 @@ static void put_unbound_pool(struct worker_pool *pool) - * @pool's workers from blocking on attach_mutex. We're the last - * manager and @pool gets freed with the flag set. - */ -- spin_lock_irq(&pool->lock); -- wait_event_lock_irq(wq_manager_wait, -+ raw_spin_lock_irq(&pool->lock); -+ swait_event_lock_irq(wq_manager_wait, - !(pool->flags & POOL_MANAGER_ACTIVE), pool->lock); - pool->flags |= POOL_MANAGER_ACTIVE; - - while ((worker = first_idle_worker(pool))) - destroy_worker(worker); - WARN_ON(pool->nr_workers || pool->nr_idle); -- spin_unlock_irq(&pool->lock); -+ raw_spin_unlock_irq(&pool->lock); - - mutex_lock(&wq_pool_attach_mutex); - if (!list_empty(&pool->workers)) -@@ -3599,7 +3550,7 @@ static void pwq_adjust_max_active(struct pool_workqueue *pwq) - return; - - /* this function can be called during early boot w/ irq disabled */ -- spin_lock_irqsave(&pwq->pool->lock, flags); -+ raw_spin_lock_irqsave(&pwq->pool->lock, flags); - - /* - * During [un]freezing, the caller is responsible for ensuring that -@@ -3629,7 +3580,7 @@ static void pwq_adjust_max_active(struct pool_workqueue *pwq) - pwq->max_active = 0; - } - -- spin_unlock_irqrestore(&pwq->pool->lock, flags); -+ raw_spin_unlock_irqrestore(&pwq->pool->lock, flags); - } - - /* initialize newly alloced @pwq which is associated with @wq and @pool */ -@@ -3802,8 +3753,8 @@ apply_wqattrs_prepare(struct workqueue_struct *wq, - - ctx = kzalloc(struct_size(ctx, pwq_tbl, nr_node_ids), GFP_KERNEL); - -- new_attrs = alloc_workqueue_attrs(GFP_KERNEL); -- tmp_attrs = alloc_workqueue_attrs(GFP_KERNEL); -+ new_attrs = alloc_workqueue_attrs(); -+ tmp_attrs = alloc_workqueue_attrs(); - if (!ctx || !new_attrs || !tmp_attrs) - goto out_free; - -@@ -3939,7 +3890,7 @@ static int apply_workqueue_attrs_locked(struct workqueue_struct *wq, - * - * Return: 0 on success and -errno on failure. - */ --int apply_workqueue_attrs(struct workqueue_struct *wq, -+static int apply_workqueue_attrs(struct workqueue_struct *wq, - const struct workqueue_attrs *attrs) - { - int ret; -@@ -3950,7 +3901,6 @@ int apply_workqueue_attrs(struct workqueue_struct *wq, - - return ret; - } --EXPORT_SYMBOL_GPL(apply_workqueue_attrs); - - /** - * wq_update_unbound_numa - update NUMA affinity of a wq for CPU hot[un]plug -@@ -4028,9 +3978,9 @@ static void wq_update_unbound_numa(struct workqueue_struct *wq, int cpu, - - use_dfl_pwq: - mutex_lock(&wq->mutex); -- spin_lock_irq(&wq->dfl_pwq->pool->lock); -+ raw_spin_lock_irq(&wq->dfl_pwq->pool->lock); - get_pwq(wq->dfl_pwq); -- spin_unlock_irq(&wq->dfl_pwq->pool->lock); -+ raw_spin_unlock_irq(&wq->dfl_pwq->pool->lock); - old_pwq = numa_pwq_tbl_install(wq, node, wq->dfl_pwq); - out_unlock: - mutex_unlock(&wq->mutex); -@@ -4149,7 +4099,7 @@ struct workqueue_struct *__alloc_workqueue_key(const char *fmt, - return NULL; - - if (flags & WQ_UNBOUND) { -- wq->unbound_attrs = alloc_workqueue_attrs(GFP_KERNEL); -+ wq->unbound_attrs = alloc_workqueue_attrs(); - if (!wq->unbound_attrs) - goto err_free_wq; - } -@@ -4236,9 +4186,9 @@ void destroy_workqueue(struct workqueue_struct *wq) - struct worker *rescuer = wq->rescuer; - - /* this prevents new queueing */ -- spin_lock_irq(&wq_mayday_lock); -+ raw_spin_lock_irq(&wq_mayday_lock); - wq->rescuer = NULL; -- spin_unlock_irq(&wq_mayday_lock); -+ raw_spin_unlock_irq(&wq_mayday_lock); - - /* rescuer will empty maydays list before exiting */ - kthread_stop(rescuer->task); -@@ -4433,10 +4383,10 @@ unsigned int work_busy(struct work_struct *work) - rcu_read_lock(); - pool = get_work_pool(work); - if (pool) { -- spin_lock_irqsave(&pool->lock, flags); -+ raw_spin_lock_irqsave(&pool->lock, flags); - if (find_worker_executing_work(pool, work)) - ret |= WORK_BUSY_RUNNING; -- spin_unlock_irqrestore(&pool->lock, flags); -+ raw_spin_unlock_irqrestore(&pool->lock, flags); - } - rcu_read_unlock(); - -@@ -4643,10 +4593,10 @@ void show_workqueue_state(void) - pr_info("workqueue %s: flags=0x%x\n", wq->name, wq->flags); - - for_each_pwq(pwq, wq) { -- spin_lock_irqsave(&pwq->pool->lock, flags); -+ raw_spin_lock_irqsave(&pwq->pool->lock, flags); - if (pwq->nr_active || !list_empty(&pwq->delayed_works)) - show_pwq(pwq); -- spin_unlock_irqrestore(&pwq->pool->lock, flags); -+ raw_spin_unlock_irqrestore(&pwq->pool->lock, flags); - /* - * We could be printing a lot from atomic context, e.g. - * sysrq-t -> show_workqueue_state(). Avoid triggering -@@ -4660,7 +4610,7 @@ void show_workqueue_state(void) - struct worker *worker; - bool first = true; - -- spin_lock_irqsave(&pool->lock, flags); -+ raw_spin_lock_irqsave(&pool->lock, flags); - if (pool->nr_workers == pool->nr_idle) - goto next_pool; - -@@ -4679,7 +4629,7 @@ void show_workqueue_state(void) - } - pr_cont("\n"); - next_pool: -- spin_unlock_irqrestore(&pool->lock, flags); -+ raw_spin_unlock_irqrestore(&pool->lock, flags); - /* - * We could be printing a lot from atomic context, e.g. - * sysrq-t -> show_workqueue_state(). Avoid triggering -@@ -4709,7 +4659,7 @@ void wq_worker_comm(char *buf, size_t size, struct task_struct *task) - struct worker_pool *pool = worker->pool; - - if (pool) { -- spin_lock_irq(&pool->lock); -+ raw_spin_lock_irq(&pool->lock); - /* - * ->desc tracks information (wq name or - * set_worker_desc()) for the latest execution. If -@@ -4723,7 +4673,7 @@ void wq_worker_comm(char *buf, size_t size, struct task_struct *task) - scnprintf(buf + off, size - off, "-%s", - worker->desc); - } -- spin_unlock_irq(&pool->lock); -+ raw_spin_unlock_irq(&pool->lock); - } - } - -@@ -4754,7 +4704,7 @@ static void unbind_workers(int cpu) - - for_each_cpu_worker_pool(pool, cpu) { - mutex_lock(&wq_pool_attach_mutex); -- spin_lock_irq(&pool->lock); -+ raw_spin_lock_irq(&pool->lock); - - /* - * We've blocked all attach/detach operations. Make all workers -@@ -4768,7 +4718,7 @@ static void unbind_workers(int cpu) - - pool->flags |= POOL_DISASSOCIATED; - -- spin_unlock_irq(&pool->lock); -+ raw_spin_unlock_irq(&pool->lock); - mutex_unlock(&wq_pool_attach_mutex); - - /* -@@ -4794,9 +4744,9 @@ static void unbind_workers(int cpu) - * worker blocking could lead to lengthy stalls. Kick off - * unbound chain execution of currently pending work items. - */ -- spin_lock_irq(&pool->lock); -+ raw_spin_lock_irq(&pool->lock); - wake_up_worker(pool); -- spin_unlock_irq(&pool->lock); -+ raw_spin_unlock_irq(&pool->lock); - } - } - -@@ -4823,7 +4773,7 @@ static void rebind_workers(struct worker_pool *pool) - WARN_ON_ONCE(set_cpus_allowed_ptr(worker->task, - pool->attrs->cpumask) < 0); - -- spin_lock_irq(&pool->lock); -+ raw_spin_lock_irq(&pool->lock); - - pool->flags &= ~POOL_DISASSOCIATED; - -@@ -4862,7 +4812,7 @@ static void rebind_workers(struct worker_pool *pool) - WRITE_ONCE(worker->flags, worker_flags); - } - -- spin_unlock_irq(&pool->lock); -+ raw_spin_unlock_irq(&pool->lock); - } - - /** -@@ -5321,7 +5271,7 @@ static struct workqueue_attrs *wq_sysfs_prep_attrs(struct workqueue_struct *wq) - - lockdep_assert_held(&wq_pool_mutex); - -- attrs = alloc_workqueue_attrs(GFP_KERNEL); -+ attrs = alloc_workqueue_attrs(); - if (!attrs) - return NULL; - -@@ -5750,7 +5700,7 @@ static void __init wq_numa_init(void) - return; - } - -- wq_update_unbound_numa_attrs_buf = alloc_workqueue_attrs(GFP_KERNEL); -+ wq_update_unbound_numa_attrs_buf = alloc_workqueue_attrs(); - BUG_ON(!wq_update_unbound_numa_attrs_buf); - - /* -@@ -5825,7 +5775,7 @@ int __init workqueue_init_early(void) - for (i = 0; i < NR_STD_WORKER_POOLS; i++) { - struct workqueue_attrs *attrs; - -- BUG_ON(!(attrs = alloc_workqueue_attrs(GFP_KERNEL))); -+ BUG_ON(!(attrs = alloc_workqueue_attrs())); - attrs->nice = std_nice[i]; - unbound_std_wq_attrs[i] = attrs; - -@@ -5834,7 +5784,7 @@ int __init workqueue_init_early(void) - * guaranteed by max_active which is enforced by pwqs. - * Turn off NUMA so that dfl_pwq is used for all nodes. - */ -- BUG_ON(!(attrs = alloc_workqueue_attrs(GFP_KERNEL))); -+ BUG_ON(!(attrs = alloc_workqueue_attrs())); - attrs->nice = std_nice[i]; - attrs->no_numa = true; - ordered_wq_attrs[i] = attrs; --- -2.36.1 - diff --git a/debian/patches-rt/0286-i2c-exynos5-Remove-IRQF_ONESHOT.patch b/debian/patches-rt/0286-i2c-exynos5-Remove-IRQF_ONESHOT.patch deleted file mode 100644 index 077cdff08..000000000 --- a/debian/patches-rt/0286-i2c-exynos5-Remove-IRQF_ONESHOT.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 6a0747038b36d84b3cb51152e09dda7db35fd222 Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Tue, 13 Aug 2019 12:30:12 +0200 -Subject: [PATCH 286/347] i2c: exynos5: Remove IRQF_ONESHOT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 4b217df0ab3f7910c96e42091cc7d9f221d05f01 ] - -The drivers sets IRQF_ONESHOT and passes only a primary handler. The IRQ -is masked while the primary is handler is invoked independently of -IRQF_ONESHOT. -With IRQF_ONESHOT the core code will not force-thread the interrupt and -this is probably not intended. I *assume* that the original author copied -the IRQ registration from another driver which passed a primary and -secondary handler and removed the secondary handler but keeping the -ONESHOT flag. - -Remove IRQF_ONESHOT. - -Reported-by: Benjamin Rouxel -Tested-by: Benjamin Rouxel -Cc: Kukjin Kim -Cc: Krzysztof Kozlowski -Cc: linux-samsung-soc@vger.kernel.org -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - drivers/i2c/busses/i2c-exynos5.c | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - -diff --git a/drivers/i2c/busses/i2c-exynos5.c b/drivers/i2c/busses/i2c-exynos5.c -index c1ce2299a76e..5c57ecf4b79e 100644 ---- a/drivers/i2c/busses/i2c-exynos5.c -+++ b/drivers/i2c/busses/i2c-exynos5.c -@@ -800,9 +800,7 @@ static int exynos5_i2c_probe(struct platform_device *pdev) - } - - ret = devm_request_irq(&pdev->dev, i2c->irq, exynos5_i2c_irq, -- IRQF_NO_SUSPEND | IRQF_ONESHOT, -- dev_name(&pdev->dev), i2c); -- -+ IRQF_NO_SUSPEND, dev_name(&pdev->dev), i2c); - if (ret != 0) { - dev_err(&pdev->dev, "cannot request HS-I2C IRQ %d\n", i2c->irq); - goto err_clk; --- -2.36.1 - diff --git a/debian/patches-rt/0286-i2c-hix5hd2-Remove-IRQF_ONESHOT.patch b/debian/patches-rt/0286-i2c-hix5hd2-Remove-IRQF_ONESHOT.patch new file mode 100644 index 000000000..7ced2b106 --- /dev/null +++ b/debian/patches-rt/0286-i2c-hix5hd2-Remove-IRQF_ONESHOT.patch @@ -0,0 +1,38 @@ +From: Sebastian Andrzej Siewior +Date: Tue, 13 Aug 2019 12:30:37 +0200 +Subject: [PATCH 286/342] i2c: hix5hd2: Remove IRQF_ONESHOT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=de0840ad000a4cd09abdbf0beb44a736108ecbf5 + +[ Upstream commit e88b481f3f86f11e3243e0808a830e5ca5782a9d ] + +The drivers sets IRQF_ONESHOT and passes only a primary handler. The IRQ +is masked while the primary is handler is invoked independently of +IRQF_ONESHOT. +With IRQF_ONESHOT the core code will not force-thread the interrupt and +this is probably not intended. I *assume* that the original author copied +the IRQ registration from another driver which passed a primary and +secondary handler and removed the secondary handler but keeping the +ONESHOT flag. + +Remove IRQF_ONESHOT. + +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + drivers/i2c/busses/i2c-hix5hd2.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-hix5hd2.c b/drivers/i2c/busses/i2c-hix5hd2.c +index b5ad7696adf9..0f08ef1f7f41 100644 +--- a/drivers/i2c/busses/i2c-hix5hd2.c ++++ b/drivers/i2c/busses/i2c-hix5hd2.c +@@ -449,8 +449,7 @@ static int hix5hd2_i2c_probe(struct platform_device *pdev) + hix5hd2_i2c_init(priv); + + ret = devm_request_irq(&pdev->dev, irq, hix5hd2_i2c_irq, +- IRQF_NO_SUSPEND | IRQF_ONESHOT, +- dev_name(&pdev->dev), priv); ++ IRQF_NO_SUSPEND, dev_name(&pdev->dev), priv); + if (ret != 0) { + dev_err(&pdev->dev, "cannot request HS-I2C IRQ %d\n", irq); + goto err_clk; diff --git a/debian/patches-rt/0287-i2c-hix5hd2-Remove-IRQF_ONESHOT.patch b/debian/patches-rt/0287-i2c-hix5hd2-Remove-IRQF_ONESHOT.patch deleted file mode 100644 index 72f7695b6..000000000 --- a/debian/patches-rt/0287-i2c-hix5hd2-Remove-IRQF_ONESHOT.patch +++ /dev/null @@ -1,42 +0,0 @@ -From d269babaefa33b4ea277b2a6033637b320c77f6f Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Tue, 13 Aug 2019 12:30:37 +0200 -Subject: [PATCH 287/347] i2c: hix5hd2: Remove IRQF_ONESHOT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit e88b481f3f86f11e3243e0808a830e5ca5782a9d ] - -The drivers sets IRQF_ONESHOT and passes only a primary handler. The IRQ -is masked while the primary is handler is invoked independently of -IRQF_ONESHOT. -With IRQF_ONESHOT the core code will not force-thread the interrupt and -this is probably not intended. I *assume* that the original author copied -the IRQ registration from another driver which passed a primary and -secondary handler and removed the secondary handler but keeping the -ONESHOT flag. - -Remove IRQF_ONESHOT. - -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - drivers/i2c/busses/i2c-hix5hd2.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/drivers/i2c/busses/i2c-hix5hd2.c b/drivers/i2c/busses/i2c-hix5hd2.c -index b5ad7696adf9..0f08ef1f7f41 100644 ---- a/drivers/i2c/busses/i2c-hix5hd2.c -+++ b/drivers/i2c/busses/i2c-hix5hd2.c -@@ -449,8 +449,7 @@ static int hix5hd2_i2c_probe(struct platform_device *pdev) - hix5hd2_i2c_init(priv); - - ret = devm_request_irq(&pdev->dev, irq, hix5hd2_i2c_irq, -- IRQF_NO_SUSPEND | IRQF_ONESHOT, -- dev_name(&pdev->dev), priv); -+ IRQF_NO_SUSPEND, dev_name(&pdev->dev), priv); - if (ret != 0) { - dev_err(&pdev->dev, "cannot request HS-I2C IRQ %d\n", irq); - goto err_clk; --- -2.36.1 - diff --git a/debian/patches-rt/0287-sched-deadline-Ensure-inactive_timer-runs-in-hardirq.patch b/debian/patches-rt/0287-sched-deadline-Ensure-inactive_timer-runs-in-hardirq.patch new file mode 100644 index 000000000..b3668b2fe --- /dev/null +++ b/debian/patches-rt/0287-sched-deadline-Ensure-inactive_timer-runs-in-hardirq.patch @@ -0,0 +1,46 @@ +From: Juri Lelli +Date: Wed, 31 Jul 2019 12:37:15 +0200 +Subject: [PATCH 287/342] sched/deadline: Ensure inactive_timer runs in hardirq + context +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=428e3bd4726ac6ebbd987f67871d11fcb95f8369 + +[ Upstream commit ba94e7aed7405c58251b1380e6e7d73aa8284b41 ] + +SCHED_DEADLINE inactive timer needs to run in hardirq context (as +dl_task_timer already does) on PREEMPT_RT + +Change the mode to HRTIMER_MODE_REL_HARD. + +[ tglx: Fixed up the start site, so mode debugging works ] + +Signed-off-by: Juri Lelli +Signed-off-by: Thomas Gleixner +Link: https://lkml.kernel.org/r/20190731103715.4047-1-juri.lelli@redhat.com +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + kernel/sched/deadline.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c +index 1a285367081c..0bc1bad199c1 100644 +--- a/kernel/sched/deadline.c ++++ b/kernel/sched/deadline.c +@@ -287,7 +287,7 @@ static void task_non_contending(struct task_struct *p) + + dl_se->dl_non_contending = 1; + get_task_struct(p); +- hrtimer_start(timer, ns_to_ktime(zerolag_time), HRTIMER_MODE_REL); ++ hrtimer_start(timer, ns_to_ktime(zerolag_time), HRTIMER_MODE_REL_HARD); + } + + static void task_contending(struct sched_dl_entity *dl_se, int flags) +@@ -1325,7 +1325,7 @@ void init_dl_inactive_task_timer(struct sched_dl_entity *dl_se) + { + struct hrtimer *timer = &dl_se->inactive_timer; + +- hrtimer_init(timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); ++ hrtimer_init(timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD); + timer->function = inactive_task_timer; + } + diff --git a/debian/patches-rt/0288-sched-deadline-Ensure-inactive_timer-runs-in-hardirq.patch b/debian/patches-rt/0288-sched-deadline-Ensure-inactive_timer-runs-in-hardirq.patch deleted file mode 100644 index 8e5e4c8de..000000000 --- a/debian/patches-rt/0288-sched-deadline-Ensure-inactive_timer-runs-in-hardirq.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 8161b3a85bed84a4cc75f68d048b35c2e09442ed Mon Sep 17 00:00:00 2001 -From: Juri Lelli -Date: Wed, 31 Jul 2019 12:37:15 +0200 -Subject: [PATCH 288/347] sched/deadline: Ensure inactive_timer runs in hardirq - context -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit ba94e7aed7405c58251b1380e6e7d73aa8284b41 ] - -SCHED_DEADLINE inactive timer needs to run in hardirq context (as -dl_task_timer already does) on PREEMPT_RT - -Change the mode to HRTIMER_MODE_REL_HARD. - -[ tglx: Fixed up the start site, so mode debugging works ] - -Signed-off-by: Juri Lelli -Signed-off-by: Thomas Gleixner -Link: https://lkml.kernel.org/r/20190731103715.4047-1-juri.lelli@redhat.com -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - kernel/sched/deadline.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c -index 1a285367081c..0bc1bad199c1 100644 ---- a/kernel/sched/deadline.c -+++ b/kernel/sched/deadline.c -@@ -287,7 +287,7 @@ static void task_non_contending(struct task_struct *p) - - dl_se->dl_non_contending = 1; - get_task_struct(p); -- hrtimer_start(timer, ns_to_ktime(zerolag_time), HRTIMER_MODE_REL); -+ hrtimer_start(timer, ns_to_ktime(zerolag_time), HRTIMER_MODE_REL_HARD); - } - - static void task_contending(struct sched_dl_entity *dl_se, int flags) -@@ -1325,7 +1325,7 @@ void init_dl_inactive_task_timer(struct sched_dl_entity *dl_se) - { - struct hrtimer *timer = &dl_se->inactive_timer; - -- hrtimer_init(timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); -+ hrtimer_init(timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD); - timer->function = inactive_task_timer; - } - --- -2.36.1 - diff --git a/debian/patches-rt/0288-thermal-x86_pkg_temp-make-pkg_temp_lock-a-raw-spinlo.patch b/debian/patches-rt/0288-thermal-x86_pkg_temp-make-pkg_temp_lock-a-raw-spinlo.patch new file mode 100644 index 000000000..889c850ef --- /dev/null +++ b/debian/patches-rt/0288-thermal-x86_pkg_temp-make-pkg_temp_lock-a-raw-spinlo.patch @@ -0,0 +1,116 @@ +From: Clark Williams +Date: Mon, 15 Jul 2019 15:25:00 -0500 +Subject: [PATCH 288/342] thermal/x86_pkg_temp: make pkg_temp_lock a raw + spinlock +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=592471e36b3b2ac61c32c4b93503fccbb7adab5b + +[ Upstream commit 8b03bb3ea7861b70b506199a69b1c8f81fe2d4d0 ] + +The spinlock pkg_temp_lock has the potential of being taken in atomic +context on v5.2-rt PREEMPT_RT. It's static and limited scope so +go ahead and make it a raw spinlock. + +Signed-off-by: Clark Williams +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + drivers/thermal/x86_pkg_temp_thermal.c | 24 ++++++++++++------------ + 1 file changed, 12 insertions(+), 12 deletions(-) + +diff --git a/drivers/thermal/x86_pkg_temp_thermal.c b/drivers/thermal/x86_pkg_temp_thermal.c +index 1ef937d799e4..540becb78a0f 100644 +--- a/drivers/thermal/x86_pkg_temp_thermal.c ++++ b/drivers/thermal/x86_pkg_temp_thermal.c +@@ -75,7 +75,7 @@ static int max_packages __read_mostly; + /* Array of package pointers */ + static struct pkg_device **packages; + /* Serializes interrupt notification, work and hotplug */ +-static DEFINE_SPINLOCK(pkg_temp_lock); ++static DEFINE_RAW_SPINLOCK(pkg_temp_lock); + /* Protects zone operation in the work function against hotplug removal */ + static DEFINE_MUTEX(thermal_zone_mutex); + +@@ -291,12 +291,12 @@ static void pkg_temp_thermal_threshold_work_fn(struct work_struct *work) + u64 msr_val, wr_val; + + mutex_lock(&thermal_zone_mutex); +- spin_lock_irq(&pkg_temp_lock); ++ raw_spin_lock_irq(&pkg_temp_lock); + ++pkg_work_cnt; + + pkgdev = pkg_temp_thermal_get_dev(cpu); + if (!pkgdev) { +- spin_unlock_irq(&pkg_temp_lock); ++ raw_spin_unlock_irq(&pkg_temp_lock); + mutex_unlock(&thermal_zone_mutex); + return; + } +@@ -310,7 +310,7 @@ static void pkg_temp_thermal_threshold_work_fn(struct work_struct *work) + } + + enable_pkg_thres_interrupt(); +- spin_unlock_irq(&pkg_temp_lock); ++ raw_spin_unlock_irq(&pkg_temp_lock); + + /* + * If tzone is not NULL, then thermal_zone_mutex will prevent the +@@ -335,7 +335,7 @@ static int pkg_thermal_notify(u64 msr_val) + struct pkg_device *pkgdev; + unsigned long flags; + +- spin_lock_irqsave(&pkg_temp_lock, flags); ++ raw_spin_lock_irqsave(&pkg_temp_lock, flags); + ++pkg_interrupt_cnt; + + disable_pkg_thres_interrupt(); +@@ -347,7 +347,7 @@ static int pkg_thermal_notify(u64 msr_val) + pkg_thermal_schedule_work(pkgdev->cpu, &pkgdev->work); + } + +- spin_unlock_irqrestore(&pkg_temp_lock, flags); ++ raw_spin_unlock_irqrestore(&pkg_temp_lock, flags); + return 0; + } + +@@ -393,9 +393,9 @@ static int pkg_temp_thermal_device_add(unsigned int cpu) + pkgdev->msr_pkg_therm_high); + + cpumask_set_cpu(cpu, &pkgdev->cpumask); +- spin_lock_irq(&pkg_temp_lock); ++ raw_spin_lock_irq(&pkg_temp_lock); + packages[pkgid] = pkgdev; +- spin_unlock_irq(&pkg_temp_lock); ++ raw_spin_unlock_irq(&pkg_temp_lock); + return 0; + } + +@@ -432,7 +432,7 @@ static int pkg_thermal_cpu_offline(unsigned int cpu) + } + + /* Protect against work and interrupts */ +- spin_lock_irq(&pkg_temp_lock); ++ raw_spin_lock_irq(&pkg_temp_lock); + + /* + * Check whether this cpu was the current target and store the new +@@ -464,9 +464,9 @@ static int pkg_thermal_cpu_offline(unsigned int cpu) + * To cancel the work we need to drop the lock, otherwise + * we might deadlock if the work needs to be flushed. + */ +- spin_unlock_irq(&pkg_temp_lock); ++ raw_spin_unlock_irq(&pkg_temp_lock); + cancel_delayed_work_sync(&pkgdev->work); +- spin_lock_irq(&pkg_temp_lock); ++ raw_spin_lock_irq(&pkg_temp_lock); + /* + * If this is not the last cpu in the package and the work + * did not run after we dropped the lock above, then we +@@ -477,7 +477,7 @@ static int pkg_thermal_cpu_offline(unsigned int cpu) + pkg_thermal_schedule_work(target, &pkgdev->work); + } + +- spin_unlock_irq(&pkg_temp_lock); ++ raw_spin_unlock_irq(&pkg_temp_lock); + + /* Final cleanup if this is the last cpu */ + if (lastcpu) diff --git a/debian/patches-rt/0289-dma-buf-Use-seqlock_t-instread-disabling-preemption.patch b/debian/patches-rt/0289-dma-buf-Use-seqlock_t-instread-disabling-preemption.patch new file mode 100644 index 000000000..aef963401 --- /dev/null +++ b/debian/patches-rt/0289-dma-buf-Use-seqlock_t-instread-disabling-preemption.patch @@ -0,0 +1,292 @@ +From: Sebastian Andrzej Siewior +Date: Wed, 14 Aug 2019 16:38:43 +0200 +Subject: [PATCH 289/342] dma-buf: Use seqlock_t instread disabling preemption +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=540c895b043eda1c43ae57fff6829d6e210ca69e + +[ Upstream commit 240610aa31094f51f299f06eb8dae8d4cd8d4500 ] + +"dma reservation" disables preemption while acquiring the write access +for "seqcount" and then may acquire a spinlock_t. + +Replace the seqcount with a seqlock_t which provides seqcount like +semantic and lock for writer. + +Link: https://lkml.kernel.org/r/f410b429-db86-f81c-7c67-f563fa808b62@free.fr +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + drivers/dma-buf/dma-buf.c | 8 ++-- + drivers/dma-buf/reservation.c | 43 +++++++------------ + .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 6 +-- + drivers/gpu/drm/i915/i915_gem.c | 10 ++--- + include/linux/reservation.h | 4 +- + 5 files changed, 29 insertions(+), 42 deletions(-) + +diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c +index 69842145c223..4c3ef46e7149 100644 +--- a/drivers/dma-buf/dma-buf.c ++++ b/drivers/dma-buf/dma-buf.c +@@ -179,7 +179,7 @@ static __poll_t dma_buf_poll(struct file *file, poll_table *poll) + return 0; + + retry: +- seq = read_seqcount_begin(&resv->seq); ++ seq = read_seqbegin(&resv->seq); + rcu_read_lock(); + + fobj = rcu_dereference(resv->fence); +@@ -188,7 +188,7 @@ static __poll_t dma_buf_poll(struct file *file, poll_table *poll) + else + shared_count = 0; + fence_excl = rcu_dereference(resv->fence_excl); +- if (read_seqcount_retry(&resv->seq, seq)) { ++ if (read_seqretry(&resv->seq, seq)) { + rcu_read_unlock(); + goto retry; + } +@@ -1046,12 +1046,12 @@ static int dma_buf_debug_show(struct seq_file *s, void *unused) + + robj = buf_obj->resv; + while (true) { +- seq = read_seqcount_begin(&robj->seq); ++ seq = read_seqbegin(&robj->seq); + rcu_read_lock(); + fobj = rcu_dereference(robj->fence); + shared_count = fobj ? fobj->shared_count : 0; + fence = rcu_dereference(robj->fence_excl); +- if (!read_seqcount_retry(&robj->seq, seq)) ++ if (!read_seqretry(&robj->seq, seq)) + break; + rcu_read_unlock(); + } +diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c +index 49ab09468ba1..f11d58492216 100644 +--- a/drivers/dma-buf/reservation.c ++++ b/drivers/dma-buf/reservation.c +@@ -109,8 +109,7 @@ reservation_object_add_shared_inplace(struct reservation_object *obj, + + dma_fence_get(fence); + +- preempt_disable(); +- write_seqcount_begin(&obj->seq); ++ write_seqlock(&obj->seq); + + for (i = 0; i < fobj->shared_count; ++i) { + struct dma_fence *old_fence; +@@ -121,8 +120,7 @@ reservation_object_add_shared_inplace(struct reservation_object *obj, + if (old_fence->context == fence->context) { + /* memory barrier is added by write_seqcount_begin */ + RCU_INIT_POINTER(fobj->shared[i], fence); +- write_seqcount_end(&obj->seq); +- preempt_enable(); ++ write_sequnlock(&obj->seq); + + dma_fence_put(old_fence); + return; +@@ -146,8 +144,7 @@ reservation_object_add_shared_inplace(struct reservation_object *obj, + fobj->shared_count++; + } + +- write_seqcount_end(&obj->seq); +- preempt_enable(); ++ write_sequnlock(&obj->seq); + + dma_fence_put(signaled); + } +@@ -191,15 +188,13 @@ reservation_object_add_shared_replace(struct reservation_object *obj, + fobj->shared_count++; + + done: +- preempt_disable(); +- write_seqcount_begin(&obj->seq); ++ write_seqlock(&obj->seq); + /* + * RCU_INIT_POINTER can be used here, + * seqcount provides the necessary barriers + */ + RCU_INIT_POINTER(obj->fence, fobj); +- write_seqcount_end(&obj->seq); +- preempt_enable(); ++ write_sequnlock(&obj->seq); + + if (!old) + return; +@@ -259,14 +254,11 @@ void reservation_object_add_excl_fence(struct reservation_object *obj, + if (fence) + dma_fence_get(fence); + +- preempt_disable(); +- write_seqcount_begin(&obj->seq); +- /* write_seqcount_begin provides the necessary memory barrier */ ++ write_seqlock(&obj->seq); + RCU_INIT_POINTER(obj->fence_excl, fence); + if (old) + old->shared_count = 0; +- write_seqcount_end(&obj->seq); +- preempt_enable(); ++ write_sequnlock(&obj->seq); + + /* inplace update, no shared fences */ + while (i--) +@@ -349,13 +341,10 @@ int reservation_object_copy_fences(struct reservation_object *dst, + src_list = reservation_object_get_list(dst); + old = reservation_object_get_excl(dst); + +- preempt_disable(); +- write_seqcount_begin(&dst->seq); +- /* write_seqcount_begin provides the necessary memory barrier */ ++ write_seqlock(&dst->seq); + RCU_INIT_POINTER(dst->fence_excl, new); + RCU_INIT_POINTER(dst->fence, dst_list); +- write_seqcount_end(&dst->seq); +- preempt_enable(); ++ write_sequnlock(&dst->seq); + + if (src_list) + kfree_rcu(src_list, rcu); +@@ -396,7 +385,7 @@ int reservation_object_get_fences_rcu(struct reservation_object *obj, + shared_count = i = 0; + + rcu_read_lock(); +- seq = read_seqcount_begin(&obj->seq); ++ seq = read_seqbegin(&obj->seq); + + fence_excl = rcu_dereference(obj->fence_excl); + if (fence_excl && !dma_fence_get_rcu(fence_excl)) +@@ -445,7 +434,7 @@ int reservation_object_get_fences_rcu(struct reservation_object *obj, + } + } + +- if (i != shared_count || read_seqcount_retry(&obj->seq, seq)) { ++ if (i != shared_count || read_seqretry(&obj->seq, seq)) { + while (i--) + dma_fence_put(shared[i]); + dma_fence_put(fence_excl); +@@ -494,7 +483,7 @@ long reservation_object_wait_timeout_rcu(struct reservation_object *obj, + + retry: + shared_count = 0; +- seq = read_seqcount_begin(&obj->seq); ++ seq = read_seqbegin(&obj->seq); + rcu_read_lock(); + i = -1; + +@@ -541,7 +530,7 @@ long reservation_object_wait_timeout_rcu(struct reservation_object *obj, + + rcu_read_unlock(); + if (fence) { +- if (read_seqcount_retry(&obj->seq, seq)) { ++ if (read_seqretry(&obj->seq, seq)) { + dma_fence_put(fence); + goto retry; + } +@@ -597,7 +586,7 @@ bool reservation_object_test_signaled_rcu(struct reservation_object *obj, + retry: + ret = true; + shared_count = 0; +- seq = read_seqcount_begin(&obj->seq); ++ seq = read_seqbegin(&obj->seq); + + if (test_all) { + unsigned i; +@@ -618,7 +607,7 @@ bool reservation_object_test_signaled_rcu(struct reservation_object *obj, + break; + } + +- if (read_seqcount_retry(&obj->seq, seq)) ++ if (read_seqretry(&obj->seq, seq)) + goto retry; + } + +@@ -631,7 +620,7 @@ bool reservation_object_test_signaled_rcu(struct reservation_object *obj, + if (ret < 0) + goto retry; + +- if (read_seqcount_retry(&obj->seq, seq)) ++ if (read_seqretry(&obj->seq, seq)) + goto retry; + } + } +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +index 4488aad64643..f22feb25eba9 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +@@ -261,11 +261,9 @@ static int amdgpu_amdkfd_remove_eviction_fence(struct amdgpu_bo *bo, + } + + /* Install the new fence list, seqcount provides the barriers */ +- preempt_disable(); +- write_seqcount_begin(&resv->seq); ++ write_seqlock(&resv->seq); + RCU_INIT_POINTER(resv->fence, new); +- write_seqcount_end(&resv->seq); +- preempt_enable(); ++ write_sequnlock(&resv->seq); + + /* Drop the references to the removed fences or move them to ef_list */ + for (i = j, k = 0; i < old->shared_count; ++i) { +diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c +index 5b0d6d8b3ab8..3fe4a1e93a1a 100644 +--- a/drivers/gpu/drm/i915/i915_gem.c ++++ b/drivers/gpu/drm/i915/i915_gem.c +@@ -516,7 +516,7 @@ i915_gem_object_wait_reservation(struct reservation_object *resv, + long timeout, + struct intel_rps_client *rps_client) + { +- unsigned int seq = __read_seqcount_begin(&resv->seq); ++ unsigned int seq = read_seqbegin(&resv->seq); + struct dma_fence *excl; + bool prune_fences = false; + +@@ -569,9 +569,9 @@ i915_gem_object_wait_reservation(struct reservation_object *resv, + * signaled and that the reservation object has not been changed (i.e. + * no new fences have been added). + */ +- if (prune_fences && !__read_seqcount_retry(&resv->seq, seq)) { ++ if (prune_fences && !read_seqretry(&resv->seq, seq)) { + if (reservation_object_trylock(resv)) { +- if (!__read_seqcount_retry(&resv->seq, seq)) ++ if (!read_seqretry(&resv->seq, seq)) + reservation_object_add_excl_fence(resv, NULL); + reservation_object_unlock(resv); + } +@@ -4696,7 +4696,7 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data, + * + */ + retry: +- seq = raw_read_seqcount(&obj->resv->seq); ++ seq = read_seqbegin(&obj->resv->seq); + + /* Translate the exclusive fence to the READ *and* WRITE engine */ + args->busy = busy_check_writer(rcu_dereference(obj->resv->fence_excl)); +@@ -4714,7 +4714,7 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data, + } + } + +- if (args->busy && read_seqcount_retry(&obj->resv->seq, seq)) ++ if (args->busy && read_seqretry(&obj->resv->seq, seq)) + goto retry; + + err = 0; +diff --git a/include/linux/reservation.h b/include/linux/reservation.h +index 02166e815afb..0b31df1af698 100644 +--- a/include/linux/reservation.h ++++ b/include/linux/reservation.h +@@ -72,7 +72,7 @@ struct reservation_object_list { + */ + struct reservation_object { + struct ww_mutex lock; +- seqcount_t seq; ++ seqlock_t seq; + + struct dma_fence __rcu *fence_excl; + struct reservation_object_list __rcu *fence; +@@ -92,7 +92,7 @@ reservation_object_init(struct reservation_object *obj) + { + ww_mutex_init(&obj->lock, &reservation_ww_class); + +- __seqcount_init(&obj->seq, reservation_seqcount_string, &reservation_seqcount_class); ++ seqlock_init(&obj->seq); + RCU_INIT_POINTER(obj->fence, NULL); + RCU_INIT_POINTER(obj->fence_excl, NULL); + obj->staged = NULL; diff --git a/debian/patches-rt/0289-thermal-x86_pkg_temp-make-pkg_temp_lock-a-raw-spinlo.patch b/debian/patches-rt/0289-thermal-x86_pkg_temp-make-pkg_temp_lock-a-raw-spinlo.patch deleted file mode 100644 index 3fe37ca3c..000000000 --- a/debian/patches-rt/0289-thermal-x86_pkg_temp-make-pkg_temp_lock-a-raw-spinlo.patch +++ /dev/null @@ -1,120 +0,0 @@ -From 402252a8f4f986a5eb23639e3b9a1d9df4902d27 Mon Sep 17 00:00:00 2001 -From: Clark Williams -Date: Mon, 15 Jul 2019 15:25:00 -0500 -Subject: [PATCH 289/347] thermal/x86_pkg_temp: make pkg_temp_lock a raw - spinlock -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 8b03bb3ea7861b70b506199a69b1c8f81fe2d4d0 ] - -The spinlock pkg_temp_lock has the potential of being taken in atomic -context on v5.2-rt PREEMPT_RT. It's static and limited scope so -go ahead and make it a raw spinlock. - -Signed-off-by: Clark Williams -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - drivers/thermal/x86_pkg_temp_thermal.c | 24 ++++++++++++------------ - 1 file changed, 12 insertions(+), 12 deletions(-) - -diff --git a/drivers/thermal/x86_pkg_temp_thermal.c b/drivers/thermal/x86_pkg_temp_thermal.c -index 1ef937d799e4..540becb78a0f 100644 ---- a/drivers/thermal/x86_pkg_temp_thermal.c -+++ b/drivers/thermal/x86_pkg_temp_thermal.c -@@ -75,7 +75,7 @@ static int max_packages __read_mostly; - /* Array of package pointers */ - static struct pkg_device **packages; - /* Serializes interrupt notification, work and hotplug */ --static DEFINE_SPINLOCK(pkg_temp_lock); -+static DEFINE_RAW_SPINLOCK(pkg_temp_lock); - /* Protects zone operation in the work function against hotplug removal */ - static DEFINE_MUTEX(thermal_zone_mutex); - -@@ -291,12 +291,12 @@ static void pkg_temp_thermal_threshold_work_fn(struct work_struct *work) - u64 msr_val, wr_val; - - mutex_lock(&thermal_zone_mutex); -- spin_lock_irq(&pkg_temp_lock); -+ raw_spin_lock_irq(&pkg_temp_lock); - ++pkg_work_cnt; - - pkgdev = pkg_temp_thermal_get_dev(cpu); - if (!pkgdev) { -- spin_unlock_irq(&pkg_temp_lock); -+ raw_spin_unlock_irq(&pkg_temp_lock); - mutex_unlock(&thermal_zone_mutex); - return; - } -@@ -310,7 +310,7 @@ static void pkg_temp_thermal_threshold_work_fn(struct work_struct *work) - } - - enable_pkg_thres_interrupt(); -- spin_unlock_irq(&pkg_temp_lock); -+ raw_spin_unlock_irq(&pkg_temp_lock); - - /* - * If tzone is not NULL, then thermal_zone_mutex will prevent the -@@ -335,7 +335,7 @@ static int pkg_thermal_notify(u64 msr_val) - struct pkg_device *pkgdev; - unsigned long flags; - -- spin_lock_irqsave(&pkg_temp_lock, flags); -+ raw_spin_lock_irqsave(&pkg_temp_lock, flags); - ++pkg_interrupt_cnt; - - disable_pkg_thres_interrupt(); -@@ -347,7 +347,7 @@ static int pkg_thermal_notify(u64 msr_val) - pkg_thermal_schedule_work(pkgdev->cpu, &pkgdev->work); - } - -- spin_unlock_irqrestore(&pkg_temp_lock, flags); -+ raw_spin_unlock_irqrestore(&pkg_temp_lock, flags); - return 0; - } - -@@ -393,9 +393,9 @@ static int pkg_temp_thermal_device_add(unsigned int cpu) - pkgdev->msr_pkg_therm_high); - - cpumask_set_cpu(cpu, &pkgdev->cpumask); -- spin_lock_irq(&pkg_temp_lock); -+ raw_spin_lock_irq(&pkg_temp_lock); - packages[pkgid] = pkgdev; -- spin_unlock_irq(&pkg_temp_lock); -+ raw_spin_unlock_irq(&pkg_temp_lock); - return 0; - } - -@@ -432,7 +432,7 @@ static int pkg_thermal_cpu_offline(unsigned int cpu) - } - - /* Protect against work and interrupts */ -- spin_lock_irq(&pkg_temp_lock); -+ raw_spin_lock_irq(&pkg_temp_lock); - - /* - * Check whether this cpu was the current target and store the new -@@ -464,9 +464,9 @@ static int pkg_thermal_cpu_offline(unsigned int cpu) - * To cancel the work we need to drop the lock, otherwise - * we might deadlock if the work needs to be flushed. - */ -- spin_unlock_irq(&pkg_temp_lock); -+ raw_spin_unlock_irq(&pkg_temp_lock); - cancel_delayed_work_sync(&pkgdev->work); -- spin_lock_irq(&pkg_temp_lock); -+ raw_spin_lock_irq(&pkg_temp_lock); - /* - * If this is not the last cpu in the package and the work - * did not run after we dropped the lock above, then we -@@ -477,7 +477,7 @@ static int pkg_thermal_cpu_offline(unsigned int cpu) - pkg_thermal_schedule_work(target, &pkgdev->work); - } - -- spin_unlock_irq(&pkg_temp_lock); -+ raw_spin_unlock_irq(&pkg_temp_lock); - - /* Final cleanup if this is the last cpu */ - if (lastcpu) --- -2.36.1 - diff --git a/debian/patches-rt/0290-KVM-arm-arm64-Let-the-timer-expire-in-hardirq-contex.patch b/debian/patches-rt/0290-KVM-arm-arm64-Let-the-timer-expire-in-hardirq-contex.patch new file mode 100644 index 000000000..8ce7e3d98 --- /dev/null +++ b/debian/patches-rt/0290-KVM-arm-arm64-Let-the-timer-expire-in-hardirq-contex.patch @@ -0,0 +1,50 @@ +From: Thomas Gleixner +Date: Tue, 13 Aug 2019 14:29:41 +0200 +Subject: [PATCH 290/342] KVM: arm/arm64: Let the timer expire in hardirq + context on RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=ee72e57437b6b664bd7784277353a5dfd529c67e + +[ Upstream commit 719cc080c914045a6e35787bf4dc3ba91cfd3efb ] + +The timers are canceled from an preempt-notifier which is invoked with +disabled preemption which is not allowed on PREEMPT_RT. +The timer callback is short so in could be invoked in hard-IRQ context +on -RT. + +Let the timer expire on hard-IRQ context even on -RT. + +Signed-off-by: Thomas Gleixner +Acked-by: Marc Zyngier +Tested-by: Julien Grall +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + virt/kvm/arm/arch_timer.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c +index 17cecc96f735..217d39f40393 100644 +--- a/virt/kvm/arm/arch_timer.c ++++ b/virt/kvm/arm/arch_timer.c +@@ -67,7 +67,7 @@ static inline bool userspace_irqchip(struct kvm *kvm) + static void soft_timer_start(struct hrtimer *hrt, u64 ns) + { + hrtimer_start(hrt, ktime_add_ns(ktime_get(), ns), +- HRTIMER_MODE_ABS); ++ HRTIMER_MODE_ABS_HARD); + } + + static void soft_timer_cancel(struct hrtimer *hrt, struct work_struct *work) +@@ -638,10 +638,10 @@ void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu) + vcpu_ptimer(vcpu)->cntvoff = 0; + + INIT_WORK(&timer->expired, kvm_timer_inject_irq_work); +- hrtimer_init(&timer->bg_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); ++ hrtimer_init(&timer->bg_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_HARD); + timer->bg_timer.function = kvm_bg_timer_expire; + +- hrtimer_init(&timer->phys_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); ++ hrtimer_init(&timer->phys_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_HARD); + timer->phys_timer.function = kvm_phys_timer_expire; + + vtimer->irq.irq = default_vtimer_irq.irq; diff --git a/debian/patches-rt/0290-dma-buf-Use-seqlock_t-instread-disabling-preemption.patch b/debian/patches-rt/0290-dma-buf-Use-seqlock_t-instread-disabling-preemption.patch deleted file mode 100644 index 5376a0901..000000000 --- a/debian/patches-rt/0290-dma-buf-Use-seqlock_t-instread-disabling-preemption.patch +++ /dev/null @@ -1,296 +0,0 @@ -From f2b7bfd175503ed854870b368aaa9e1be2159cab Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Wed, 14 Aug 2019 16:38:43 +0200 -Subject: [PATCH 290/347] dma-buf: Use seqlock_t instread disabling preemption -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 240610aa31094f51f299f06eb8dae8d4cd8d4500 ] - -"dma reservation" disables preemption while acquiring the write access -for "seqcount" and then may acquire a spinlock_t. - -Replace the seqcount with a seqlock_t which provides seqcount like -semantic and lock for writer. - -Link: https://lkml.kernel.org/r/f410b429-db86-f81c-7c67-f563fa808b62@free.fr -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - drivers/dma-buf/dma-buf.c | 8 ++-- - drivers/dma-buf/reservation.c | 43 +++++++------------ - .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 6 +-- - drivers/gpu/drm/i915/i915_gem.c | 10 ++--- - include/linux/reservation.h | 4 +- - 5 files changed, 29 insertions(+), 42 deletions(-) - -diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c -index 69842145c223..4c3ef46e7149 100644 ---- a/drivers/dma-buf/dma-buf.c -+++ b/drivers/dma-buf/dma-buf.c -@@ -179,7 +179,7 @@ static __poll_t dma_buf_poll(struct file *file, poll_table *poll) - return 0; - - retry: -- seq = read_seqcount_begin(&resv->seq); -+ seq = read_seqbegin(&resv->seq); - rcu_read_lock(); - - fobj = rcu_dereference(resv->fence); -@@ -188,7 +188,7 @@ static __poll_t dma_buf_poll(struct file *file, poll_table *poll) - else - shared_count = 0; - fence_excl = rcu_dereference(resv->fence_excl); -- if (read_seqcount_retry(&resv->seq, seq)) { -+ if (read_seqretry(&resv->seq, seq)) { - rcu_read_unlock(); - goto retry; - } -@@ -1046,12 +1046,12 @@ static int dma_buf_debug_show(struct seq_file *s, void *unused) - - robj = buf_obj->resv; - while (true) { -- seq = read_seqcount_begin(&robj->seq); -+ seq = read_seqbegin(&robj->seq); - rcu_read_lock(); - fobj = rcu_dereference(robj->fence); - shared_count = fobj ? fobj->shared_count : 0; - fence = rcu_dereference(robj->fence_excl); -- if (!read_seqcount_retry(&robj->seq, seq)) -+ if (!read_seqretry(&robj->seq, seq)) - break; - rcu_read_unlock(); - } -diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c -index 49ab09468ba1..f11d58492216 100644 ---- a/drivers/dma-buf/reservation.c -+++ b/drivers/dma-buf/reservation.c -@@ -109,8 +109,7 @@ reservation_object_add_shared_inplace(struct reservation_object *obj, - - dma_fence_get(fence); - -- preempt_disable(); -- write_seqcount_begin(&obj->seq); -+ write_seqlock(&obj->seq); - - for (i = 0; i < fobj->shared_count; ++i) { - struct dma_fence *old_fence; -@@ -121,8 +120,7 @@ reservation_object_add_shared_inplace(struct reservation_object *obj, - if (old_fence->context == fence->context) { - /* memory barrier is added by write_seqcount_begin */ - RCU_INIT_POINTER(fobj->shared[i], fence); -- write_seqcount_end(&obj->seq); -- preempt_enable(); -+ write_sequnlock(&obj->seq); - - dma_fence_put(old_fence); - return; -@@ -146,8 +144,7 @@ reservation_object_add_shared_inplace(struct reservation_object *obj, - fobj->shared_count++; - } - -- write_seqcount_end(&obj->seq); -- preempt_enable(); -+ write_sequnlock(&obj->seq); - - dma_fence_put(signaled); - } -@@ -191,15 +188,13 @@ reservation_object_add_shared_replace(struct reservation_object *obj, - fobj->shared_count++; - - done: -- preempt_disable(); -- write_seqcount_begin(&obj->seq); -+ write_seqlock(&obj->seq); - /* - * RCU_INIT_POINTER can be used here, - * seqcount provides the necessary barriers - */ - RCU_INIT_POINTER(obj->fence, fobj); -- write_seqcount_end(&obj->seq); -- preempt_enable(); -+ write_sequnlock(&obj->seq); - - if (!old) - return; -@@ -259,14 +254,11 @@ void reservation_object_add_excl_fence(struct reservation_object *obj, - if (fence) - dma_fence_get(fence); - -- preempt_disable(); -- write_seqcount_begin(&obj->seq); -- /* write_seqcount_begin provides the necessary memory barrier */ -+ write_seqlock(&obj->seq); - RCU_INIT_POINTER(obj->fence_excl, fence); - if (old) - old->shared_count = 0; -- write_seqcount_end(&obj->seq); -- preempt_enable(); -+ write_sequnlock(&obj->seq); - - /* inplace update, no shared fences */ - while (i--) -@@ -349,13 +341,10 @@ int reservation_object_copy_fences(struct reservation_object *dst, - src_list = reservation_object_get_list(dst); - old = reservation_object_get_excl(dst); - -- preempt_disable(); -- write_seqcount_begin(&dst->seq); -- /* write_seqcount_begin provides the necessary memory barrier */ -+ write_seqlock(&dst->seq); - RCU_INIT_POINTER(dst->fence_excl, new); - RCU_INIT_POINTER(dst->fence, dst_list); -- write_seqcount_end(&dst->seq); -- preempt_enable(); -+ write_sequnlock(&dst->seq); - - if (src_list) - kfree_rcu(src_list, rcu); -@@ -396,7 +385,7 @@ int reservation_object_get_fences_rcu(struct reservation_object *obj, - shared_count = i = 0; - - rcu_read_lock(); -- seq = read_seqcount_begin(&obj->seq); -+ seq = read_seqbegin(&obj->seq); - - fence_excl = rcu_dereference(obj->fence_excl); - if (fence_excl && !dma_fence_get_rcu(fence_excl)) -@@ -445,7 +434,7 @@ int reservation_object_get_fences_rcu(struct reservation_object *obj, - } - } - -- if (i != shared_count || read_seqcount_retry(&obj->seq, seq)) { -+ if (i != shared_count || read_seqretry(&obj->seq, seq)) { - while (i--) - dma_fence_put(shared[i]); - dma_fence_put(fence_excl); -@@ -494,7 +483,7 @@ long reservation_object_wait_timeout_rcu(struct reservation_object *obj, - - retry: - shared_count = 0; -- seq = read_seqcount_begin(&obj->seq); -+ seq = read_seqbegin(&obj->seq); - rcu_read_lock(); - i = -1; - -@@ -541,7 +530,7 @@ long reservation_object_wait_timeout_rcu(struct reservation_object *obj, - - rcu_read_unlock(); - if (fence) { -- if (read_seqcount_retry(&obj->seq, seq)) { -+ if (read_seqretry(&obj->seq, seq)) { - dma_fence_put(fence); - goto retry; - } -@@ -597,7 +586,7 @@ bool reservation_object_test_signaled_rcu(struct reservation_object *obj, - retry: - ret = true; - shared_count = 0; -- seq = read_seqcount_begin(&obj->seq); -+ seq = read_seqbegin(&obj->seq); - - if (test_all) { - unsigned i; -@@ -618,7 +607,7 @@ bool reservation_object_test_signaled_rcu(struct reservation_object *obj, - break; - } - -- if (read_seqcount_retry(&obj->seq, seq)) -+ if (read_seqretry(&obj->seq, seq)) - goto retry; - } - -@@ -631,7 +620,7 @@ bool reservation_object_test_signaled_rcu(struct reservation_object *obj, - if (ret < 0) - goto retry; - -- if (read_seqcount_retry(&obj->seq, seq)) -+ if (read_seqretry(&obj->seq, seq)) - goto retry; - } - } -diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c -index 4488aad64643..f22feb25eba9 100644 ---- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c -+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c -@@ -261,11 +261,9 @@ static int amdgpu_amdkfd_remove_eviction_fence(struct amdgpu_bo *bo, - } - - /* Install the new fence list, seqcount provides the barriers */ -- preempt_disable(); -- write_seqcount_begin(&resv->seq); -+ write_seqlock(&resv->seq); - RCU_INIT_POINTER(resv->fence, new); -- write_seqcount_end(&resv->seq); -- preempt_enable(); -+ write_sequnlock(&resv->seq); - - /* Drop the references to the removed fences or move them to ef_list */ - for (i = j, k = 0; i < old->shared_count; ++i) { -diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c -index 5b0d6d8b3ab8..3fe4a1e93a1a 100644 ---- a/drivers/gpu/drm/i915/i915_gem.c -+++ b/drivers/gpu/drm/i915/i915_gem.c -@@ -516,7 +516,7 @@ i915_gem_object_wait_reservation(struct reservation_object *resv, - long timeout, - struct intel_rps_client *rps_client) - { -- unsigned int seq = __read_seqcount_begin(&resv->seq); -+ unsigned int seq = read_seqbegin(&resv->seq); - struct dma_fence *excl; - bool prune_fences = false; - -@@ -569,9 +569,9 @@ i915_gem_object_wait_reservation(struct reservation_object *resv, - * signaled and that the reservation object has not been changed (i.e. - * no new fences have been added). - */ -- if (prune_fences && !__read_seqcount_retry(&resv->seq, seq)) { -+ if (prune_fences && !read_seqretry(&resv->seq, seq)) { - if (reservation_object_trylock(resv)) { -- if (!__read_seqcount_retry(&resv->seq, seq)) -+ if (!read_seqretry(&resv->seq, seq)) - reservation_object_add_excl_fence(resv, NULL); - reservation_object_unlock(resv); - } -@@ -4696,7 +4696,7 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data, - * - */ - retry: -- seq = raw_read_seqcount(&obj->resv->seq); -+ seq = read_seqbegin(&obj->resv->seq); - - /* Translate the exclusive fence to the READ *and* WRITE engine */ - args->busy = busy_check_writer(rcu_dereference(obj->resv->fence_excl)); -@@ -4714,7 +4714,7 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data, - } - } - -- if (args->busy && read_seqcount_retry(&obj->resv->seq, seq)) -+ if (args->busy && read_seqretry(&obj->resv->seq, seq)) - goto retry; - - err = 0; -diff --git a/include/linux/reservation.h b/include/linux/reservation.h -index 02166e815afb..0b31df1af698 100644 ---- a/include/linux/reservation.h -+++ b/include/linux/reservation.h -@@ -72,7 +72,7 @@ struct reservation_object_list { - */ - struct reservation_object { - struct ww_mutex lock; -- seqcount_t seq; -+ seqlock_t seq; - - struct dma_fence __rcu *fence_excl; - struct reservation_object_list __rcu *fence; -@@ -92,7 +92,7 @@ reservation_object_init(struct reservation_object *obj) - { - ww_mutex_init(&obj->lock, &reservation_ww_class); - -- __seqcount_init(&obj->seq, reservation_seqcount_string, &reservation_seqcount_class); -+ seqlock_init(&obj->seq); - RCU_INIT_POINTER(obj->fence, NULL); - RCU_INIT_POINTER(obj->fence_excl, NULL); - obj->staged = NULL; --- -2.36.1 - diff --git a/debian/patches-rt/0291-KVM-arm-arm64-Let-the-timer-expire-in-hardirq-contex.patch b/debian/patches-rt/0291-KVM-arm-arm64-Let-the-timer-expire-in-hardirq-contex.patch deleted file mode 100644 index d290086bf..000000000 --- a/debian/patches-rt/0291-KVM-arm-arm64-Let-the-timer-expire-in-hardirq-contex.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 1e93492b5c8f5b655d5c6e7c3867eef80ef38223 Mon Sep 17 00:00:00 2001 -From: Thomas Gleixner -Date: Tue, 13 Aug 2019 14:29:41 +0200 -Subject: [PATCH 291/347] KVM: arm/arm64: Let the timer expire in hardirq - context on RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 719cc080c914045a6e35787bf4dc3ba91cfd3efb ] - -The timers are canceled from an preempt-notifier which is invoked with -disabled preemption which is not allowed on PREEMPT_RT. -The timer callback is short so in could be invoked in hard-IRQ context -on -RT. - -Let the timer expire on hard-IRQ context even on -RT. - -Signed-off-by: Thomas Gleixner -Acked-by: Marc Zyngier -Tested-by: Julien Grall -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - virt/kvm/arm/arch_timer.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c -index 17cecc96f735..217d39f40393 100644 ---- a/virt/kvm/arm/arch_timer.c -+++ b/virt/kvm/arm/arch_timer.c -@@ -67,7 +67,7 @@ static inline bool userspace_irqchip(struct kvm *kvm) - static void soft_timer_start(struct hrtimer *hrt, u64 ns) - { - hrtimer_start(hrt, ktime_add_ns(ktime_get(), ns), -- HRTIMER_MODE_ABS); -+ HRTIMER_MODE_ABS_HARD); - } - - static void soft_timer_cancel(struct hrtimer *hrt, struct work_struct *work) -@@ -638,10 +638,10 @@ void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu) - vcpu_ptimer(vcpu)->cntvoff = 0; - - INIT_WORK(&timer->expired, kvm_timer_inject_irq_work); -- hrtimer_init(&timer->bg_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); -+ hrtimer_init(&timer->bg_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_HARD); - timer->bg_timer.function = kvm_bg_timer_expire; - -- hrtimer_init(&timer->phys_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); -+ hrtimer_init(&timer->phys_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_HARD); - timer->phys_timer.function = kvm_phys_timer_expire; - - vtimer->irq.irq = default_vtimer_irq.irq; --- -2.36.1 - diff --git a/debian/patches-rt/0291-x86-preempt-Check-preemption-level-before-looking-at.patch b/debian/patches-rt/0291-x86-preempt-Check-preemption-level-before-looking-at.patch new file mode 100644 index 000000000..0101e802e --- /dev/null +++ b/debian/patches-rt/0291-x86-preempt-Check-preemption-level-before-looking-at.patch @@ -0,0 +1,30 @@ +From: Sebastian Andrzej Siewior +Date: Wed, 14 Aug 2019 17:08:58 +0200 +Subject: [PATCH 291/342] x86: preempt: Check preemption level before looking + at lazy-preempt +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=cbcd32705234c16095b150867b2191151ca8a9be + +[ Upstream commit 19fc8557f2323c52b26561651ed4d51fc688a740 ] + +Before evaluating the lazy-preempt state it must be ensure that the +preempt-count is zero. + +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + arch/x86/include/asm/preempt.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/x86/include/asm/preempt.h b/arch/x86/include/asm/preempt.h +index f66708779274..afa0e42ccdd1 100644 +--- a/arch/x86/include/asm/preempt.h ++++ b/arch/x86/include/asm/preempt.h +@@ -96,6 +96,8 @@ static __always_inline bool __preempt_count_dec_and_test(void) + if (____preempt_count_dec_and_test()) + return true; + #ifdef CONFIG_PREEMPT_LAZY ++ if (preempt_count()) ++ return false; + if (current_thread_info()->preempt_lazy_count) + return false; + return test_thread_flag(TIF_NEED_RESCHED_LAZY); diff --git a/debian/patches-rt/0292-hrtimer-Use-READ_ONCE-to-access-timer-base-in-hrimer.patch b/debian/patches-rt/0292-hrtimer-Use-READ_ONCE-to-access-timer-base-in-hrimer.patch new file mode 100644 index 000000000..96b0c6320 --- /dev/null +++ b/debian/patches-rt/0292-hrtimer-Use-READ_ONCE-to-access-timer-base-in-hrimer.patch @@ -0,0 +1,38 @@ +From: Julien Grall +Date: Wed, 21 Aug 2019 10:24:07 +0100 +Subject: [PATCH 292/342] hrtimer: Use READ_ONCE to access timer->base in + hrimer_grab_expiry_lock() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=651af665014e442103551831276cb17778ec5ffa + +[ Upstream commit 2c8fdbe7ef0ad06c1a326886c5954e117b5657d6 ] + +The update to timer->base is protected by the base->cpu_base->lock(). +However, hrtimer_grab_expirty_lock() does not access it with the lock. + +So it would theorically be possible to have timer->base changed under +our feet. We need to prevent the compiler to refetch timer->base so the +check and the access is performed on the same base. + +Other access of timer->base are either done with a lock or protected +with READ_ONCE(). So use READ_ONCE() in hrtimer_grab_expirty_lock(). + +Signed-off-by: Julien Grall +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + kernel/time/hrtimer.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c +index eb2db7e6a241..dff440fd968b 100644 +--- a/kernel/time/hrtimer.c ++++ b/kernel/time/hrtimer.c +@@ -959,7 +959,7 @@ EXPORT_SYMBOL_GPL(hrtimer_forward); + + void hrtimer_grab_expiry_lock(const struct hrtimer *timer) + { +- struct hrtimer_clock_base *base = timer->base; ++ struct hrtimer_clock_base *base = READ_ONCE(timer->base); + + if (base && base->cpu_base) { + spin_lock(&base->cpu_base->softirq_expiry_lock); diff --git a/debian/patches-rt/0292-x86-preempt-Check-preemption-level-before-looking-at.patch b/debian/patches-rt/0292-x86-preempt-Check-preemption-level-before-looking-at.patch deleted file mode 100644 index df53f3dd7..000000000 --- a/debian/patches-rt/0292-x86-preempt-Check-preemption-level-before-looking-at.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 3a7e827c42b01480e35997bdc722eaaa457840d1 Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Wed, 14 Aug 2019 17:08:58 +0200 -Subject: [PATCH 292/347] x86: preempt: Check preemption level before looking - at lazy-preempt -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 19fc8557f2323c52b26561651ed4d51fc688a740 ] - -Before evaluating the lazy-preempt state it must be ensure that the -preempt-count is zero. - -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - arch/x86/include/asm/preempt.h | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/arch/x86/include/asm/preempt.h b/arch/x86/include/asm/preempt.h -index f66708779274..afa0e42ccdd1 100644 ---- a/arch/x86/include/asm/preempt.h -+++ b/arch/x86/include/asm/preempt.h -@@ -96,6 +96,8 @@ static __always_inline bool __preempt_count_dec_and_test(void) - if (____preempt_count_dec_and_test()) - return true; - #ifdef CONFIG_PREEMPT_LAZY -+ if (preempt_count()) -+ return false; - if (current_thread_info()->preempt_lazy_count) - return false; - return test_thread_flag(TIF_NEED_RESCHED_LAZY); --- -2.36.1 - diff --git a/debian/patches-rt/0293-hrtimer-Don-t-grab-the-expiry-lock-for-non-soft-hrti.patch b/debian/patches-rt/0293-hrtimer-Don-t-grab-the-expiry-lock-for-non-soft-hrti.patch new file mode 100644 index 000000000..74c1274db --- /dev/null +++ b/debian/patches-rt/0293-hrtimer-Don-t-grab-the-expiry-lock-for-non-soft-hrti.patch @@ -0,0 +1,37 @@ +From: Julien Grall +Date: Wed, 21 Aug 2019 10:24:08 +0100 +Subject: [PATCH 293/342] hrtimer: Don't grab the expiry lock for non-soft + hrtimer +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=c08561e4507bece7acce0e54872524c3c670260c + +[ Upstream commit fd420354bea2f57c11f3de191dffdeea76531e76 ] + +Acquiring the lock in hrtimer_grab_expiry_lock() is designed for +sleeping-locks and should not be used with disabled interrupts. +hrtimer_cancel() may invoke hrtimer_grab_expiry_lock() also for locks +which expire in hard-IRQ context. + +Let hrtimer_cancel() invoke hrtimer_grab_expiry_lock() only for locks +which expire in softirq context. + +Signed-off-by: Julien Grall +Signed-off-by: Steven Rostedt (VMware) +[bigeasy: rewrite changelog] +Signed-off-by: Sebastian Andrzej Siewior +--- + kernel/time/hrtimer.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c +index dff440fd968b..24bfae0e92e2 100644 +--- a/kernel/time/hrtimer.c ++++ b/kernel/time/hrtimer.c +@@ -961,7 +961,7 @@ void hrtimer_grab_expiry_lock(const struct hrtimer *timer) + { + struct hrtimer_clock_base *base = READ_ONCE(timer->base); + +- if (base && base->cpu_base) { ++ if (timer->is_soft && base && base->cpu_base) { + spin_lock(&base->cpu_base->softirq_expiry_lock); + spin_unlock(&base->cpu_base->softirq_expiry_lock); + } diff --git a/debian/patches-rt/0293-hrtimer-Use-READ_ONCE-to-access-timer-base-in-hrimer.patch b/debian/patches-rt/0293-hrtimer-Use-READ_ONCE-to-access-timer-base-in-hrimer.patch deleted file mode 100644 index 2f06144ba..000000000 --- a/debian/patches-rt/0293-hrtimer-Use-READ_ONCE-to-access-timer-base-in-hrimer.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 656b33d3842f931f31f5149e458db52b85c4af3e Mon Sep 17 00:00:00 2001 -From: Julien Grall -Date: Wed, 21 Aug 2019 10:24:07 +0100 -Subject: [PATCH 293/347] hrtimer: Use READ_ONCE to access timer->base in - hrimer_grab_expiry_lock() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 2c8fdbe7ef0ad06c1a326886c5954e117b5657d6 ] - -The update to timer->base is protected by the base->cpu_base->lock(). -However, hrtimer_grab_expirty_lock() does not access it with the lock. - -So it would theorically be possible to have timer->base changed under -our feet. We need to prevent the compiler to refetch timer->base so the -check and the access is performed on the same base. - -Other access of timer->base are either done with a lock or protected -with READ_ONCE(). So use READ_ONCE() in hrtimer_grab_expirty_lock(). - -Signed-off-by: Julien Grall -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - kernel/time/hrtimer.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c -index eb2db7e6a241..dff440fd968b 100644 ---- a/kernel/time/hrtimer.c -+++ b/kernel/time/hrtimer.c -@@ -959,7 +959,7 @@ EXPORT_SYMBOL_GPL(hrtimer_forward); - - void hrtimer_grab_expiry_lock(const struct hrtimer *timer) - { -- struct hrtimer_clock_base *base = timer->base; -+ struct hrtimer_clock_base *base = READ_ONCE(timer->base); - - if (base && base->cpu_base) { - spin_lock(&base->cpu_base->softirq_expiry_lock); --- -2.36.1 - diff --git a/debian/patches-rt/0294-hrtimer-Don-t-grab-the-expiry-lock-for-non-soft-hrti.patch b/debian/patches-rt/0294-hrtimer-Don-t-grab-the-expiry-lock-for-non-soft-hrti.patch deleted file mode 100644 index 2d81ae91d..000000000 --- a/debian/patches-rt/0294-hrtimer-Don-t-grab-the-expiry-lock-for-non-soft-hrti.patch +++ /dev/null @@ -1,41 +0,0 @@ -From cec8a994798fd0bebd900d555590ab684d4c7edc Mon Sep 17 00:00:00 2001 -From: Julien Grall -Date: Wed, 21 Aug 2019 10:24:08 +0100 -Subject: [PATCH 294/347] hrtimer: Don't grab the expiry lock for non-soft - hrtimer -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit fd420354bea2f57c11f3de191dffdeea76531e76 ] - -Acquiring the lock in hrtimer_grab_expiry_lock() is designed for -sleeping-locks and should not be used with disabled interrupts. -hrtimer_cancel() may invoke hrtimer_grab_expiry_lock() also for locks -which expire in hard-IRQ context. - -Let hrtimer_cancel() invoke hrtimer_grab_expiry_lock() only for locks -which expire in softirq context. - -Signed-off-by: Julien Grall -Signed-off-by: Steven Rostedt (VMware) -[bigeasy: rewrite changelog] -Signed-off-by: Sebastian Andrzej Siewior ---- - kernel/time/hrtimer.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c -index dff440fd968b..24bfae0e92e2 100644 ---- a/kernel/time/hrtimer.c -+++ b/kernel/time/hrtimer.c -@@ -961,7 +961,7 @@ void hrtimer_grab_expiry_lock(const struct hrtimer *timer) - { - struct hrtimer_clock_base *base = READ_ONCE(timer->base); - -- if (base && base->cpu_base) { -+ if (timer->is_soft && base && base->cpu_base) { - spin_lock(&base->cpu_base->softirq_expiry_lock); - spin_unlock(&base->cpu_base->softirq_expiry_lock); - } --- -2.36.1 - diff --git a/debian/patches-rt/0294-hrtimer-Prevent-using-hrtimer_grab_expiry_lock-on-mi.patch b/debian/patches-rt/0294-hrtimer-Prevent-using-hrtimer_grab_expiry_lock-on-mi.patch new file mode 100644 index 000000000..8618d61b5 --- /dev/null +++ b/debian/patches-rt/0294-hrtimer-Prevent-using-hrtimer_grab_expiry_lock-on-mi.patch @@ -0,0 +1,39 @@ +From: Julien Grall +Date: Wed, 21 Aug 2019 10:24:09 +0100 +Subject: [PATCH 294/342] hrtimer: Prevent using hrtimer_grab_expiry_lock() on + migration_base +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=93b879f6d94c9ca346d233d70a5afdb03d97355f + +[ Upstream commit cef1b87f98823af923a386f3f69149acb212d4a1 ] + +As tglx puts it: +|If base == migration_base then there is no point to lock soft_expiry_lock +|simply because the timer is not executing the callback in soft irq context +|and the whole lock/unlock dance can be avoided. + +Furthermore, all the path leading to hrtimer_grab_expiry_lock() assumes +timer->base and timer->base->cpu_base are always non-NULL. So it is safe +to remove the NULL checks here. + +Signed-off-by: Julien Grall +Link: https://lkml.kernel.org/r/alpine.DEB.2.21.1908211557420.2223@nanos.tec.linutronix.de +Signed-off-by: Steven Rostedt (VMware) +[bigeasy: rewrite changelog] +Signed-off-by: Sebastian Andrzej Siewior +--- + kernel/time/hrtimer.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c +index 24bfae0e92e2..3f9d156c36f1 100644 +--- a/kernel/time/hrtimer.c ++++ b/kernel/time/hrtimer.c +@@ -961,7 +961,7 @@ void hrtimer_grab_expiry_lock(const struct hrtimer *timer) + { + struct hrtimer_clock_base *base = READ_ONCE(timer->base); + +- if (timer->is_soft && base && base->cpu_base) { ++ if (timer->is_soft && base != &migration_base) { + spin_lock(&base->cpu_base->softirq_expiry_lock); + spin_unlock(&base->cpu_base->softirq_expiry_lock); + } diff --git a/debian/patches-rt/0295-hrtimer-Add-a-missing-bracket-and-hide-migration_bas.patch b/debian/patches-rt/0295-hrtimer-Add-a-missing-bracket-and-hide-migration_bas.patch new file mode 100644 index 000000000..f24fd1199 --- /dev/null +++ b/debian/patches-rt/0295-hrtimer-Add-a-missing-bracket-and-hide-migration_bas.patch @@ -0,0 +1,71 @@ +From: Sebastian Andrzej Siewior +Date: Wed, 4 Sep 2019 16:55:27 +0200 +Subject: [PATCH 295/342] hrtimer: Add a missing bracket and hide + `migration_base' on !SMP +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=44e95bce9a5f97221e79be2d034fafe617dff0f7 + +[ Upstream commit 47b6de0b7f22c28b40275aeede3993d807668c3b ] + +[ Upstream commit 5d2295f3a93b04986d069ebeaf5b07725f9096c1 ] + +The recent change to avoid taking the expiry lock when a timer is currently +migrated missed to add a bracket at the end of the if statement leading to +compile errors. Since that commit the variable `migration_base' is always +used but it is only available on SMP configuration thus leading to another +compile error. The changelog says "The timer base and base->cpu_base +cannot be NULL in the code path", so it is safe to limit this check to SMP +configurations only. + +Add the missing bracket to the if statement and hide `migration_base' +behind CONFIG_SMP bars. + +[ tglx: Mark the functions inline ... ] + +Fixes: 68b2c8c1e4210 ("hrtimer: Don't take expiry_lock when timer is currently migrated") +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Thomas Gleixner +Link: https://lkml.kernel.org/r/20190904145527.eah7z56ntwobqm6j@linutronix.de +Signed-off-by: Steven Rostedt (VMware) +[bigeasy: port back to RT] +Signed-off-by: Sebastian Andrzej Siewior +--- + kernel/time/hrtimer.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c +index 3f9d156c36f1..0f841f18c363 100644 +--- a/kernel/time/hrtimer.c ++++ b/kernel/time/hrtimer.c +@@ -150,6 +150,11 @@ static struct hrtimer_cpu_base migration_cpu_base = { + + #define migration_base migration_cpu_base.clock_base[0] + ++static inline bool is_migration_base(struct hrtimer_clock_base *base) ++{ ++ return base == &migration_base; ++} ++ + /* + * We are using hashed locking: holding per_cpu(hrtimer_bases)[n].lock + * means that all timers which are tied to this base via timer->base are +@@ -274,6 +279,11 @@ switch_hrtimer_base(struct hrtimer *timer, struct hrtimer_clock_base *base, + + #else /* CONFIG_SMP */ + ++static inline bool is_migration_base(struct hrtimer_clock_base *base) ++{ ++ return false; ++} ++ + static inline struct hrtimer_clock_base * + lock_hrtimer_base(const struct hrtimer *timer, unsigned long *flags) + { +@@ -961,7 +971,7 @@ void hrtimer_grab_expiry_lock(const struct hrtimer *timer) + { + struct hrtimer_clock_base *base = READ_ONCE(timer->base); + +- if (timer->is_soft && base != &migration_base) { ++ if (timer->is_soft && is_migration_base(base)) { + spin_lock(&base->cpu_base->softirq_expiry_lock); + spin_unlock(&base->cpu_base->softirq_expiry_lock); + } diff --git a/debian/patches-rt/0295-hrtimer-Prevent-using-hrtimer_grab_expiry_lock-on-mi.patch b/debian/patches-rt/0295-hrtimer-Prevent-using-hrtimer_grab_expiry_lock-on-mi.patch deleted file mode 100644 index 66133c2af..000000000 --- a/debian/patches-rt/0295-hrtimer-Prevent-using-hrtimer_grab_expiry_lock-on-mi.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 7e9203de23a787ac491b8114acaf5a8c37f60d36 Mon Sep 17 00:00:00 2001 -From: Julien Grall -Date: Wed, 21 Aug 2019 10:24:09 +0100 -Subject: [PATCH 295/347] hrtimer: Prevent using hrtimer_grab_expiry_lock() on - migration_base -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit cef1b87f98823af923a386f3f69149acb212d4a1 ] - -As tglx puts it: -|If base == migration_base then there is no point to lock soft_expiry_lock -|simply because the timer is not executing the callback in soft irq context -|and the whole lock/unlock dance can be avoided. - -Furthermore, all the path leading to hrtimer_grab_expiry_lock() assumes -timer->base and timer->base->cpu_base are always non-NULL. So it is safe -to remove the NULL checks here. - -Signed-off-by: Julien Grall -Link: https://lkml.kernel.org/r/alpine.DEB.2.21.1908211557420.2223@nanos.tec.linutronix.de -Signed-off-by: Steven Rostedt (VMware) -[bigeasy: rewrite changelog] -Signed-off-by: Sebastian Andrzej Siewior ---- - kernel/time/hrtimer.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c -index 24bfae0e92e2..3f9d156c36f1 100644 ---- a/kernel/time/hrtimer.c -+++ b/kernel/time/hrtimer.c -@@ -961,7 +961,7 @@ void hrtimer_grab_expiry_lock(const struct hrtimer *timer) - { - struct hrtimer_clock_base *base = READ_ONCE(timer->base); - -- if (timer->is_soft && base && base->cpu_base) { -+ if (timer->is_soft && base != &migration_base) { - spin_lock(&base->cpu_base->softirq_expiry_lock); - spin_unlock(&base->cpu_base->softirq_expiry_lock); - } --- -2.36.1 - diff --git a/debian/patches-rt/0296-hrtimer-Add-a-missing-bracket-and-hide-migration_bas.patch b/debian/patches-rt/0296-hrtimer-Add-a-missing-bracket-and-hide-migration_bas.patch deleted file mode 100644 index 54806bcb2..000000000 --- a/debian/patches-rt/0296-hrtimer-Add-a-missing-bracket-and-hide-migration_bas.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 1f69d8dae481d24ebdbd40717196cc8e36553976 Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Wed, 4 Sep 2019 16:55:27 +0200 -Subject: [PATCH 296/347] hrtimer: Add a missing bracket and hide - `migration_base' on !SMP -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 47b6de0b7f22c28b40275aeede3993d807668c3b ] - -[ Upstream commit 5d2295f3a93b04986d069ebeaf5b07725f9096c1 ] - -The recent change to avoid taking the expiry lock when a timer is currently -migrated missed to add a bracket at the end of the if statement leading to -compile errors. Since that commit the variable `migration_base' is always -used but it is only available on SMP configuration thus leading to another -compile error. The changelog says "The timer base and base->cpu_base -cannot be NULL in the code path", so it is safe to limit this check to SMP -configurations only. - -Add the missing bracket to the if statement and hide `migration_base' -behind CONFIG_SMP bars. - -[ tglx: Mark the functions inline ... ] - -Fixes: 68b2c8c1e4210 ("hrtimer: Don't take expiry_lock when timer is currently migrated") -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Thomas Gleixner -Link: https://lkml.kernel.org/r/20190904145527.eah7z56ntwobqm6j@linutronix.de -Signed-off-by: Steven Rostedt (VMware) -[bigeasy: port back to RT] -Signed-off-by: Sebastian Andrzej Siewior ---- - kernel/time/hrtimer.c | 12 +++++++++++- - 1 file changed, 11 insertions(+), 1 deletion(-) - -diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c -index 3f9d156c36f1..0f841f18c363 100644 ---- a/kernel/time/hrtimer.c -+++ b/kernel/time/hrtimer.c -@@ -150,6 +150,11 @@ static struct hrtimer_cpu_base migration_cpu_base = { - - #define migration_base migration_cpu_base.clock_base[0] - -+static inline bool is_migration_base(struct hrtimer_clock_base *base) -+{ -+ return base == &migration_base; -+} -+ - /* - * We are using hashed locking: holding per_cpu(hrtimer_bases)[n].lock - * means that all timers which are tied to this base via timer->base are -@@ -274,6 +279,11 @@ switch_hrtimer_base(struct hrtimer *timer, struct hrtimer_clock_base *base, - - #else /* CONFIG_SMP */ - -+static inline bool is_migration_base(struct hrtimer_clock_base *base) -+{ -+ return false; -+} -+ - static inline struct hrtimer_clock_base * - lock_hrtimer_base(const struct hrtimer *timer, unsigned long *flags) - { -@@ -961,7 +971,7 @@ void hrtimer_grab_expiry_lock(const struct hrtimer *timer) - { - struct hrtimer_clock_base *base = READ_ONCE(timer->base); - -- if (timer->is_soft && base != &migration_base) { -+ if (timer->is_soft && is_migration_base(base)) { - spin_lock(&base->cpu_base->softirq_expiry_lock); - spin_unlock(&base->cpu_base->softirq_expiry_lock); - } --- -2.36.1 - diff --git a/debian/patches-rt/0296-posix-timers-Unlock-expiry-lock-in-the-early-return.patch b/debian/patches-rt/0296-posix-timers-Unlock-expiry-lock-in-the-early-return.patch new file mode 100644 index 000000000..c5827397e --- /dev/null +++ b/debian/patches-rt/0296-posix-timers-Unlock-expiry-lock-in-the-early-return.patch @@ -0,0 +1,37 @@ +From: Sebastian Andrzej Siewior +Date: Mon, 16 Sep 2019 12:33:59 +0200 +Subject: [PATCH 296/342] posix-timers: Unlock expiry lock in the early return +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=6d94a6b1400f572d9acbb7e045afb65c8d8fa530 + +[ Upstream commit 356a2781375ec58521a9bc3f500488745990c242 ] + +Patch ("posix-timers: Add expiry lock") acquired a lock in +run_posix_cpu_timers() but didn't drop the lock in the early return. + +Unlock the lock in the early return path. + +Reported-by: kbuild test robot +Reported-by: Dan Carpenter +Reviewed-by: Thomas Gleixner +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + kernel/time/posix-cpu-timers.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c +index 54632ed51c65..b9e4ccbb60f3 100644 +--- a/kernel/time/posix-cpu-timers.c ++++ b/kernel/time/posix-cpu-timers.c +@@ -1175,8 +1175,10 @@ static void __run_posix_cpu_timers(struct task_struct *tsk) + expiry_lock = this_cpu_ptr(&cpu_timer_expiry_lock); + spin_lock(expiry_lock); + +- if (!lock_task_sighand(tsk, &flags)) ++ if (!lock_task_sighand(tsk, &flags)) { ++ spin_unlock(expiry_lock); + return; ++ } + /* + * Here we take off tsk->signal->cpu_timers[N] and + * tsk->cpu_timers[N] all the timers that are firing, and diff --git a/debian/patches-rt/0297-posix-timers-Unlock-expiry-lock-in-the-early-return.patch b/debian/patches-rt/0297-posix-timers-Unlock-expiry-lock-in-the-early-return.patch deleted file mode 100644 index 001c07c9c..000000000 --- a/debian/patches-rt/0297-posix-timers-Unlock-expiry-lock-in-the-early-return.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 89d528d5fab49f30a5cbd2ef13e19d488a6e21ae Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Mon, 16 Sep 2019 12:33:59 +0200 -Subject: [PATCH 297/347] posix-timers: Unlock expiry lock in the early return -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 356a2781375ec58521a9bc3f500488745990c242 ] - -Patch ("posix-timers: Add expiry lock") acquired a lock in -run_posix_cpu_timers() but didn't drop the lock in the early return. - -Unlock the lock in the early return path. - -Reported-by: kbuild test robot -Reported-by: Dan Carpenter -Reviewed-by: Thomas Gleixner -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - kernel/time/posix-cpu-timers.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c -index 54632ed51c65..b9e4ccbb60f3 100644 ---- a/kernel/time/posix-cpu-timers.c -+++ b/kernel/time/posix-cpu-timers.c -@@ -1175,8 +1175,10 @@ static void __run_posix_cpu_timers(struct task_struct *tsk) - expiry_lock = this_cpu_ptr(&cpu_timer_expiry_lock); - spin_lock(expiry_lock); - -- if (!lock_task_sighand(tsk, &flags)) -+ if (!lock_task_sighand(tsk, &flags)) { -+ spin_unlock(expiry_lock); - return; -+ } - /* - * Here we take off tsk->signal->cpu_timers[N] and - * tsk->cpu_timers[N] all the timers that are firing, and --- -2.36.1 - diff --git a/debian/patches-rt/0297-sched-migrate_dis-enable-Use-sleeping_lock-to-annota.patch b/debian/patches-rt/0297-sched-migrate_dis-enable-Use-sleeping_lock-to-annota.patch new file mode 100644 index 000000000..11ce037e5 --- /dev/null +++ b/debian/patches-rt/0297-sched-migrate_dis-enable-Use-sleeping_lock-to-annota.patch @@ -0,0 +1,54 @@ +From: Scott Wood +Date: Tue, 24 Sep 2019 14:36:41 +0200 +Subject: [PATCH 297/342] =?UTF-8?q?sched:=20migrate=5Fdis/enable:=20Use=20?= + =?UTF-8?q?sleeping=5Flock=E2=80=A6()=20to=20annotate=20sleeping=20points?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=cb7f34c0ba155510ebd0db8410614eca88812750 + +[ Upstream commit 4230dd3824c3e1785504e6f757ce79a4b55651fa ] + +Without this, rcu_note_context_switch() will complain if an RCU read lock +is held when migrate_enable() calls stop_one_cpu(). Likewise when +migrate_disable() calls pin_current_cpu() which calls __read_rt_lock() -- +which bypasses the part of the mutex code that calls sleeping_lock_inc(). + +Signed-off-by: Scott Wood +Signed-off-by: Steven Rostedt (VMware) +[bigeasy: use sleeping_lock_…() ] +Signed-off-by: Sebastian Andrzej Siewior +--- + kernel/cpu.c | 2 ++ + kernel/sched/core.c | 3 +++ + 2 files changed, 5 insertions(+) + +diff --git a/kernel/cpu.c b/kernel/cpu.c +index 396394ebbc5b..4bf82665f28c 100644 +--- a/kernel/cpu.c ++++ b/kernel/cpu.c +@@ -310,7 +310,9 @@ void pin_current_cpu(void) + preempt_lazy_enable(); + preempt_enable(); + ++ sleeping_lock_inc(); + __read_rt_lock(cpuhp_pin); ++ sleeping_lock_dec(); + + preempt_disable(); + preempt_lazy_disable(); +diff --git a/kernel/sched/core.c b/kernel/sched/core.c +index 1d4d4780dd79..33c1ae19410e 100644 +--- a/kernel/sched/core.c ++++ b/kernel/sched/core.c +@@ -7366,7 +7366,10 @@ void migrate_enable(void) + unpin_current_cpu(); + preempt_lazy_enable(); + preempt_enable(); ++ ++ sleeping_lock_inc(); + stop_one_cpu(task_cpu(p), migration_cpu_stop, &arg); ++ sleeping_lock_dec(); + tlb_migrate_finish(p->mm); + + return; diff --git a/debian/patches-rt/0298-sched-__set_cpus_allowed_ptr-Check-cpus_mask-not-cpu.patch b/debian/patches-rt/0298-sched-__set_cpus_allowed_ptr-Check-cpus_mask-not-cpu.patch new file mode 100644 index 000000000..91f4c497c --- /dev/null +++ b/debian/patches-rt/0298-sched-__set_cpus_allowed_ptr-Check-cpus_mask-not-cpu.patch @@ -0,0 +1,35 @@ +From: Scott Wood +Date: Sat, 27 Jul 2019 00:56:32 -0500 +Subject: [PATCH 298/342] sched: __set_cpus_allowed_ptr: Check cpus_mask, not + cpus_ptr +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=1cc9480667aa314a5de466bc624262f1aa2cf19a + +[ Upstream commit e5606fb7b042db634ed62b4dd733d62e050e468f ] + +This function is concerned with the long-term cpu mask, not the +transitory mask the task might have while migrate disabled. Before +this patch, if a task was migrate disabled at the time +__set_cpus_allowed_ptr() was called, and the new mask happened to be +equal to the cpu that the task was running on, then the mask update +would be lost. + +Signed-off-by: Scott Wood +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + kernel/sched/core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/kernel/sched/core.c b/kernel/sched/core.c +index 33c1ae19410e..4f5242c9ca78 100644 +--- a/kernel/sched/core.c ++++ b/kernel/sched/core.c +@@ -1157,7 +1157,7 @@ static int __set_cpus_allowed_ptr(struct task_struct *p, + goto out; + } + +- if (cpumask_equal(p->cpus_ptr, new_mask)) ++ if (cpumask_equal(&p->cpus_mask, new_mask)) + goto out; + + dest_cpu = cpumask_any_and(cpu_valid_mask, new_mask); diff --git a/debian/patches-rt/0298-sched-migrate_dis-enable-Use-sleeping_lock-to-annota.patch b/debian/patches-rt/0298-sched-migrate_dis-enable-Use-sleeping_lock-to-annota.patch deleted file mode 100644 index 6c1157424..000000000 --- a/debian/patches-rt/0298-sched-migrate_dis-enable-Use-sleeping_lock-to-annota.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 813c54ab7d391f197cafdfef09b14958da328122 Mon Sep 17 00:00:00 2001 -From: Scott Wood -Date: Tue, 24 Sep 2019 14:36:41 +0200 -Subject: [PATCH 298/347] =?UTF-8?q?sched:=20migrate=5Fdis/enable:=20Use=20?= - =?UTF-8?q?sleeping=5Flock=E2=80=A6()=20to=20annotate=20sleeping=20points?= -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 4230dd3824c3e1785504e6f757ce79a4b55651fa ] - -Without this, rcu_note_context_switch() will complain if an RCU read lock -is held when migrate_enable() calls stop_one_cpu(). Likewise when -migrate_disable() calls pin_current_cpu() which calls __read_rt_lock() -- -which bypasses the part of the mutex code that calls sleeping_lock_inc(). - -Signed-off-by: Scott Wood -Signed-off-by: Steven Rostedt (VMware) -[bigeasy: use sleeping_lock_…() ] -Signed-off-by: Sebastian Andrzej Siewior ---- - kernel/cpu.c | 2 ++ - kernel/sched/core.c | 3 +++ - 2 files changed, 5 insertions(+) - -diff --git a/kernel/cpu.c b/kernel/cpu.c -index 11f48774b129..c84a93f84164 100644 ---- a/kernel/cpu.c -+++ b/kernel/cpu.c -@@ -309,7 +309,9 @@ void pin_current_cpu(void) - preempt_lazy_enable(); - preempt_enable(); - -+ sleeping_lock_inc(); - __read_rt_lock(cpuhp_pin); -+ sleeping_lock_dec(); - - preempt_disable(); - preempt_lazy_disable(); -diff --git a/kernel/sched/core.c b/kernel/sched/core.c -index 1d4d4780dd79..33c1ae19410e 100644 ---- a/kernel/sched/core.c -+++ b/kernel/sched/core.c -@@ -7366,7 +7366,10 @@ void migrate_enable(void) - unpin_current_cpu(); - preempt_lazy_enable(); - preempt_enable(); -+ -+ sleeping_lock_inc(); - stop_one_cpu(task_cpu(p), migration_cpu_stop, &arg); -+ sleeping_lock_dec(); - tlb_migrate_finish(p->mm); - - return; --- -2.36.1 - diff --git a/debian/patches-rt/0299-sched-Remove-dead-__migrate_disabled-check.patch b/debian/patches-rt/0299-sched-Remove-dead-__migrate_disabled-check.patch new file mode 100644 index 000000000..11109f24e --- /dev/null +++ b/debian/patches-rt/0299-sched-Remove-dead-__migrate_disabled-check.patch @@ -0,0 +1,35 @@ +From: Scott Wood +Date: Sat, 27 Jul 2019 00:56:33 -0500 +Subject: [PATCH 299/342] sched: Remove dead __migrate_disabled() check +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=4abc9fbc0662890ad6eecb6b9daaf7d0544c7d22 + +[ Upstream commit 14d9272d534ea91262e15db99443fc5995c7c016 ] + +This code was unreachable given the __migrate_disabled() branch +to "out" immediately beforehand. + +Signed-off-by: Scott Wood +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + kernel/sched/core.c | 7 ------- + 1 file changed, 7 deletions(-) + +diff --git a/kernel/sched/core.c b/kernel/sched/core.c +index 4f5242c9ca78..e64d2b2b3a69 100644 +--- a/kernel/sched/core.c ++++ b/kernel/sched/core.c +@@ -1182,13 +1182,6 @@ static int __set_cpus_allowed_ptr(struct task_struct *p, + if (cpumask_test_cpu(task_cpu(p), new_mask) || __migrate_disabled(p)) + goto out; + +-#if defined(CONFIG_SMP) && defined(CONFIG_PREEMPT_RT_BASE) +- if (__migrate_disabled(p)) { +- p->migrate_disable_update = 1; +- goto out; +- } +-#endif +- + if (task_running(rq, p) || p->state == TASK_WAKING) { + struct migration_arg arg = { p, dest_cpu }; + /* Need help from migration thread: drop lock and wait. */ diff --git a/debian/patches-rt/0299-sched-__set_cpus_allowed_ptr-Check-cpus_mask-not-cpu.patch b/debian/patches-rt/0299-sched-__set_cpus_allowed_ptr-Check-cpus_mask-not-cpu.patch deleted file mode 100644 index 693556876..000000000 --- a/debian/patches-rt/0299-sched-__set_cpus_allowed_ptr-Check-cpus_mask-not-cpu.patch +++ /dev/null @@ -1,39 +0,0 @@ -From a1f857c1918e1e9cf21358347d4f0bbd0c6da587 Mon Sep 17 00:00:00 2001 -From: Scott Wood -Date: Sat, 27 Jul 2019 00:56:32 -0500 -Subject: [PATCH 299/347] sched: __set_cpus_allowed_ptr: Check cpus_mask, not - cpus_ptr -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit e5606fb7b042db634ed62b4dd733d62e050e468f ] - -This function is concerned with the long-term cpu mask, not the -transitory mask the task might have while migrate disabled. Before -this patch, if a task was migrate disabled at the time -__set_cpus_allowed_ptr() was called, and the new mask happened to be -equal to the cpu that the task was running on, then the mask update -would be lost. - -Signed-off-by: Scott Wood -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - kernel/sched/core.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/kernel/sched/core.c b/kernel/sched/core.c -index 33c1ae19410e..4f5242c9ca78 100644 ---- a/kernel/sched/core.c -+++ b/kernel/sched/core.c -@@ -1157,7 +1157,7 @@ static int __set_cpus_allowed_ptr(struct task_struct *p, - goto out; - } - -- if (cpumask_equal(p->cpus_ptr, new_mask)) -+ if (cpumask_equal(&p->cpus_mask, new_mask)) - goto out; - - dest_cpu = cpumask_any_and(cpu_valid_mask, new_mask); --- -2.36.1 - diff --git a/debian/patches-rt/0300-sched-Remove-dead-__migrate_disabled-check.patch b/debian/patches-rt/0300-sched-Remove-dead-__migrate_disabled-check.patch deleted file mode 100644 index 156d1ac5b..000000000 --- a/debian/patches-rt/0300-sched-Remove-dead-__migrate_disabled-check.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 5090ad8fa345caac33cc1dbdc60002b7264b8b59 Mon Sep 17 00:00:00 2001 -From: Scott Wood -Date: Sat, 27 Jul 2019 00:56:33 -0500 -Subject: [PATCH 300/347] sched: Remove dead __migrate_disabled() check -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 14d9272d534ea91262e15db99443fc5995c7c016 ] - -This code was unreachable given the __migrate_disabled() branch -to "out" immediately beforehand. - -Signed-off-by: Scott Wood -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - kernel/sched/core.c | 7 ------- - 1 file changed, 7 deletions(-) - -diff --git a/kernel/sched/core.c b/kernel/sched/core.c -index 4f5242c9ca78..e64d2b2b3a69 100644 ---- a/kernel/sched/core.c -+++ b/kernel/sched/core.c -@@ -1182,13 +1182,6 @@ static int __set_cpus_allowed_ptr(struct task_struct *p, - if (cpumask_test_cpu(task_cpu(p), new_mask) || __migrate_disabled(p)) - goto out; - --#if defined(CONFIG_SMP) && defined(CONFIG_PREEMPT_RT_BASE) -- if (__migrate_disabled(p)) { -- p->migrate_disable_update = 1; -- goto out; -- } --#endif -- - if (task_running(rq, p) || p->state == TASK_WAKING) { - struct migration_arg arg = { p, dest_cpu }; - /* Need help from migration thread: drop lock and wait. */ --- -2.36.1 - diff --git a/debian/patches-rt/0300-sched-migrate-disable-Protect-cpus_ptr-with-lock.patch b/debian/patches-rt/0300-sched-migrate-disable-Protect-cpus_ptr-with-lock.patch new file mode 100644 index 000000000..98a2369c2 --- /dev/null +++ b/debian/patches-rt/0300-sched-migrate-disable-Protect-cpus_ptr-with-lock.patch @@ -0,0 +1,43 @@ +From: Scott Wood +Date: Sat, 27 Jul 2019 00:56:34 -0500 +Subject: [PATCH 300/342] sched: migrate disable: Protect cpus_ptr with lock +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=51a9977c0b69716f9a2ca78d92686b134d5fe5e3 + +[ Upstream commit 27ee52a891ed2c7e2e2c8332ccae0de7c2674b09 ] + +Various places assume that cpus_ptr is protected by rq/pi locks, +so don't change it before grabbing those locks. + +Signed-off-by: Scott Wood +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + kernel/sched/core.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/kernel/sched/core.c b/kernel/sched/core.c +index e64d2b2b3a69..6f91ee2b7e91 100644 +--- a/kernel/sched/core.c ++++ b/kernel/sched/core.c +@@ -7244,9 +7244,8 @@ migrate_disable_update_cpus_allowed(struct task_struct *p) + struct rq *rq; + struct rq_flags rf; + +- p->cpus_ptr = cpumask_of(smp_processor_id()); +- + rq = task_rq_lock(p, &rf); ++ p->cpus_ptr = cpumask_of(smp_processor_id()); + update_nr_migratory(p, -1); + p->nr_cpus_allowed = 1; + task_rq_unlock(rq, p, &rf); +@@ -7258,9 +7257,8 @@ migrate_enable_update_cpus_allowed(struct task_struct *p) + struct rq *rq; + struct rq_flags rf; + +- p->cpus_ptr = &p->cpus_mask; +- + rq = task_rq_lock(p, &rf); ++ p->cpus_ptr = &p->cpus_mask; + p->nr_cpus_allowed = cpumask_weight(&p->cpus_mask); + update_nr_migratory(p, 1); + task_rq_unlock(rq, p, &rf); diff --git a/debian/patches-rt/0301-lib-smp_processor_id-Don-t-use-cpumask_equal.patch b/debian/patches-rt/0301-lib-smp_processor_id-Don-t-use-cpumask_equal.patch new file mode 100644 index 000000000..456e9caae --- /dev/null +++ b/debian/patches-rt/0301-lib-smp_processor_id-Don-t-use-cpumask_equal.patch @@ -0,0 +1,41 @@ +From: Waiman Long +Date: Thu, 3 Oct 2019 16:36:08 -0400 +Subject: [PATCH 301/342] lib/smp_processor_id: Don't use cpumask_equal() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=83c7d978aa1fe629e0c8c48204de93e5555cdc24 + +[ Upstream commit 659252061477862f45b79e1de169e6030f5c8918 ] + +The check_preemption_disabled() function uses cpumask_equal() to see +if the task is bounded to the current CPU only. cpumask_equal() calls +memcmp() to do the comparison. As x86 doesn't have __HAVE_ARCH_MEMCMP, +the slow memcmp() function in lib/string.c is used. + +On a RT kernel that call check_preemption_disabled() very frequently, +below is the perf-record output of a certain microbenchmark: + + 42.75% 2.45% testpmd [kernel.kallsyms] [k] check_preemption_disabled + 40.01% 39.97% testpmd [kernel.kallsyms] [k] memcmp + +We should avoid calling memcmp() in performance critical path. So the +cpumask_equal() call is now replaced with an equivalent simpler check. + +Signed-off-by: Waiman Long +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + lib/smp_processor_id.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/smp_processor_id.c b/lib/smp_processor_id.c +index fb35c45b9421..b8a8a8db2d75 100644 +--- a/lib/smp_processor_id.c ++++ b/lib/smp_processor_id.c +@@ -22,7 +22,7 @@ notrace static unsigned int check_preemption_disabled(const char *what1, + * Kernel threads bound to a single CPU can safely use + * smp_processor_id(): + */ +- if (cpumask_equal(current->cpus_ptr, cpumask_of(this_cpu))) ++ if (current->nr_cpus_allowed == 1) + goto out; + + /* diff --git a/debian/patches-rt/0301-sched-migrate-disable-Protect-cpus_ptr-with-lock.patch b/debian/patches-rt/0301-sched-migrate-disable-Protect-cpus_ptr-with-lock.patch deleted file mode 100644 index 1f1822daf..000000000 --- a/debian/patches-rt/0301-sched-migrate-disable-Protect-cpus_ptr-with-lock.patch +++ /dev/null @@ -1,47 +0,0 @@ -From c4c6908e112c8368299d23485a921dcc83876ec2 Mon Sep 17 00:00:00 2001 -From: Scott Wood -Date: Sat, 27 Jul 2019 00:56:34 -0500 -Subject: [PATCH 301/347] sched: migrate disable: Protect cpus_ptr with lock -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 27ee52a891ed2c7e2e2c8332ccae0de7c2674b09 ] - -Various places assume that cpus_ptr is protected by rq/pi locks, -so don't change it before grabbing those locks. - -Signed-off-by: Scott Wood -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - kernel/sched/core.c | 6 ++---- - 1 file changed, 2 insertions(+), 4 deletions(-) - -diff --git a/kernel/sched/core.c b/kernel/sched/core.c -index e64d2b2b3a69..6f91ee2b7e91 100644 ---- a/kernel/sched/core.c -+++ b/kernel/sched/core.c -@@ -7244,9 +7244,8 @@ migrate_disable_update_cpus_allowed(struct task_struct *p) - struct rq *rq; - struct rq_flags rf; - -- p->cpus_ptr = cpumask_of(smp_processor_id()); -- - rq = task_rq_lock(p, &rf); -+ p->cpus_ptr = cpumask_of(smp_processor_id()); - update_nr_migratory(p, -1); - p->nr_cpus_allowed = 1; - task_rq_unlock(rq, p, &rf); -@@ -7258,9 +7257,8 @@ migrate_enable_update_cpus_allowed(struct task_struct *p) - struct rq *rq; - struct rq_flags rf; - -- p->cpus_ptr = &p->cpus_mask; -- - rq = task_rq_lock(p, &rf); -+ p->cpus_ptr = &p->cpus_mask; - p->nr_cpus_allowed = cpumask_weight(&p->cpus_mask); - update_nr_migratory(p, 1); - task_rq_unlock(rq, p, &rf); --- -2.36.1 - diff --git a/debian/patches-rt/0302-futex-Make-the-futex_hash_bucket-spinlock_t-again-an.patch b/debian/patches-rt/0302-futex-Make-the-futex_hash_bucket-spinlock_t-again-an.patch new file mode 100644 index 000000000..224b6a81a --- /dev/null +++ b/debian/patches-rt/0302-futex-Make-the-futex_hash_bucket-spinlock_t-again-an.patch @@ -0,0 +1,731 @@ +From: Sebastian Andrzej Siewior +Date: Mon, 7 Oct 2019 16:45:18 +0200 +Subject: [PATCH 302/342] futex: Make the futex_hash_bucket spinlock_t again + and bring back its old state +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=db07179f5403257fab1645f3d1b5016389d2d3bb + +[ Upstream commit 954ad80c23edfe71f4e8ce70b961eac884320c3a ] + +This is an all-in-one patch that reverts the patches: + futex: Make the futex_hash_bucket lock raw + futex: Delay deallocation of pi_state + +and adds back the old patches we had: + futex: workaround migrate_disable/enable in different context + rtmutex: Handle the various new futex race conditions + futex: Fix bug on when a requeued RT task times out + futex: Ensure lock/unlock symetry versus pi_lock and hash bucket lock + +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + kernel/futex.c | 228 ++++++++++++++++++-------------- + kernel/locking/rtmutex.c | 65 ++++++++- + kernel/locking/rtmutex_common.h | 3 + + 3 files changed, 193 insertions(+), 103 deletions(-) + +diff --git a/kernel/futex.c b/kernel/futex.c +index 2fc6bedb460e..81090f7a3ed9 100644 +--- a/kernel/futex.c ++++ b/kernel/futex.c +@@ -243,7 +243,7 @@ struct futex_q { + struct plist_node list; + + struct task_struct *task; +- raw_spinlock_t *lock_ptr; ++ spinlock_t *lock_ptr; + union futex_key key; + struct futex_pi_state *pi_state; + struct rt_mutex_waiter *rt_waiter; +@@ -264,7 +264,7 @@ static const struct futex_q futex_q_init = { + */ + struct futex_hash_bucket { + atomic_t waiters; +- raw_spinlock_t lock; ++ spinlock_t lock; + struct plist_head chain; + } ____cacheline_aligned_in_smp; + +@@ -871,13 +871,13 @@ static void get_pi_state(struct futex_pi_state *pi_state) + * Drops a reference to the pi_state object and frees or caches it + * when the last reference is gone. + */ +-static struct futex_pi_state *__put_pi_state(struct futex_pi_state *pi_state) ++static void put_pi_state(struct futex_pi_state *pi_state) + { + if (!pi_state) +- return NULL; ++ return; + + if (!atomic_dec_and_test(&pi_state->refcount)) +- return NULL; ++ return; + + /* + * If pi_state->owner is NULL, the owner is most probably dying +@@ -892,7 +892,9 @@ static struct futex_pi_state *__put_pi_state(struct futex_pi_state *pi_state) + raw_spin_unlock_irqrestore(&pi_state->pi_mutex.wait_lock, flags); + } + +- if (!current->pi_state_cache) { ++ if (current->pi_state_cache) { ++ kfree(pi_state); ++ } else { + /* + * pi_state->list is already empty. + * clear pi_state->owner. +@@ -901,30 +903,6 @@ static struct futex_pi_state *__put_pi_state(struct futex_pi_state *pi_state) + pi_state->owner = NULL; + atomic_set(&pi_state->refcount, 1); + current->pi_state_cache = pi_state; +- pi_state = NULL; +- } +- return pi_state; +-} +- +-static void put_pi_state(struct futex_pi_state *pi_state) +-{ +- kfree(__put_pi_state(pi_state)); +-} +- +-static void put_pi_state_atomic(struct futex_pi_state *pi_state, +- struct list_head *to_free) +-{ +- if (__put_pi_state(pi_state)) +- list_add(&pi_state->list, to_free); +-} +- +-static void free_pi_state_list(struct list_head *to_free) +-{ +- struct futex_pi_state *p, *next; +- +- list_for_each_entry_safe(p, next, to_free, list) { +- list_del(&p->list); +- kfree(p); + } + } + +@@ -941,7 +919,6 @@ static void exit_pi_state_list(struct task_struct *curr) + struct futex_pi_state *pi_state; + struct futex_hash_bucket *hb; + union futex_key key = FUTEX_KEY_INIT; +- LIST_HEAD(to_free); + + if (!futex_cmpxchg_enabled) + return; +@@ -975,7 +952,7 @@ static void exit_pi_state_list(struct task_struct *curr) + } + raw_spin_unlock_irq(&curr->pi_lock); + +- raw_spin_lock(&hb->lock); ++ spin_lock(&hb->lock); + raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock); + raw_spin_lock(&curr->pi_lock); + /* +@@ -985,8 +962,10 @@ static void exit_pi_state_list(struct task_struct *curr) + if (head->next != next) { + /* retain curr->pi_lock for the loop invariant */ + raw_spin_unlock(&pi_state->pi_mutex.wait_lock); +- raw_spin_unlock(&hb->lock); +- put_pi_state_atomic(pi_state, &to_free); ++ raw_spin_unlock_irq(&curr->pi_lock); ++ spin_unlock(&hb->lock); ++ raw_spin_lock_irq(&curr->pi_lock); ++ put_pi_state(pi_state); + continue; + } + +@@ -997,7 +976,7 @@ static void exit_pi_state_list(struct task_struct *curr) + + raw_spin_unlock(&curr->pi_lock); + raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock); +- raw_spin_unlock(&hb->lock); ++ spin_unlock(&hb->lock); + + rt_mutex_futex_unlock(&pi_state->pi_mutex); + put_pi_state(pi_state); +@@ -1005,8 +984,6 @@ static void exit_pi_state_list(struct task_struct *curr) + raw_spin_lock_irq(&curr->pi_lock); + } + raw_spin_unlock_irq(&curr->pi_lock); +- +- free_pi_state_list(&to_free); + } + #else + static inline void exit_pi_state_list(struct task_struct *curr) { } +@@ -1548,7 +1525,7 @@ static void __unqueue_futex(struct futex_q *q) + { + struct futex_hash_bucket *hb; + +- if (WARN_ON_SMP(!q->lock_ptr || !raw_spin_is_locked(q->lock_ptr)) ++ if (WARN_ON_SMP(!q->lock_ptr || !spin_is_locked(q->lock_ptr)) + || WARN_ON(plist_node_empty(&q->list))) + return; + +@@ -1668,21 +1645,21 @@ static inline void + double_lock_hb(struct futex_hash_bucket *hb1, struct futex_hash_bucket *hb2) + { + if (hb1 <= hb2) { +- raw_spin_lock(&hb1->lock); ++ spin_lock(&hb1->lock); + if (hb1 < hb2) +- raw_spin_lock_nested(&hb2->lock, SINGLE_DEPTH_NESTING); ++ spin_lock_nested(&hb2->lock, SINGLE_DEPTH_NESTING); + } else { /* hb1 > hb2 */ +- raw_spin_lock(&hb2->lock); +- raw_spin_lock_nested(&hb1->lock, SINGLE_DEPTH_NESTING); ++ spin_lock(&hb2->lock); ++ spin_lock_nested(&hb1->lock, SINGLE_DEPTH_NESTING); + } + } + + static inline void + double_unlock_hb(struct futex_hash_bucket *hb1, struct futex_hash_bucket *hb2) + { +- raw_spin_unlock(&hb1->lock); ++ spin_unlock(&hb1->lock); + if (hb1 != hb2) +- raw_spin_unlock(&hb2->lock); ++ spin_unlock(&hb2->lock); + } + + /* +@@ -1710,7 +1687,7 @@ futex_wake(u32 __user *uaddr, unsigned int flags, int nr_wake, u32 bitset) + if (!hb_waiters_pending(hb)) + goto out_put_key; + +- raw_spin_lock(&hb->lock); ++ spin_lock(&hb->lock); + + plist_for_each_entry_safe(this, next, &hb->chain, list) { + if (match_futex (&this->key, &key)) { +@@ -1729,7 +1706,7 @@ futex_wake(u32 __user *uaddr, unsigned int flags, int nr_wake, u32 bitset) + } + } + +- raw_spin_unlock(&hb->lock); ++ spin_unlock(&hb->lock); + wake_up_q(&wake_q); + out_put_key: + put_futex_key(&key); +@@ -2042,7 +2019,6 @@ static int futex_requeue(u32 __user *uaddr1, unsigned int flags, + struct futex_hash_bucket *hb1, *hb2; + struct futex_q *this, *next; + DEFINE_WAKE_Q(wake_q); +- LIST_HEAD(to_free); + + if (nr_wake < 0 || nr_requeue < 0) + return -EINVAL; +@@ -2281,6 +2257,16 @@ static int futex_requeue(u32 __user *uaddr1, unsigned int flags, + requeue_pi_wake_futex(this, &key2, hb2); + drop_count++; + continue; ++ } else if (ret == -EAGAIN) { ++ /* ++ * Waiter was woken by timeout or ++ * signal and has set pi_blocked_on to ++ * PI_WAKEUP_INPROGRESS before we ++ * tried to enqueue it on the rtmutex. ++ */ ++ this->pi_state = NULL; ++ put_pi_state(pi_state); ++ continue; + } else if (ret) { + /* + * rt_mutex_start_proxy_lock() detected a +@@ -2291,7 +2277,7 @@ static int futex_requeue(u32 __user *uaddr1, unsigned int flags, + * object. + */ + this->pi_state = NULL; +- put_pi_state_atomic(pi_state, &to_free); ++ put_pi_state(pi_state); + /* + * We stop queueing more waiters and let user + * space deal with the mess. +@@ -2308,7 +2294,7 @@ static int futex_requeue(u32 __user *uaddr1, unsigned int flags, + * in futex_proxy_trylock_atomic() or in lookup_pi_state(). We + * need to drop it here again. + */ +- put_pi_state_atomic(pi_state, &to_free); ++ put_pi_state(pi_state); + + out_unlock: + double_unlock_hb(hb1, hb2); +@@ -2329,7 +2315,6 @@ static int futex_requeue(u32 __user *uaddr1, unsigned int flags, + out_put_key1: + put_futex_key(&key1); + out: +- free_pi_state_list(&to_free); + return ret ? ret : task_count; + } + +@@ -2353,7 +2338,7 @@ static inline struct futex_hash_bucket *queue_lock(struct futex_q *q) + + q->lock_ptr = &hb->lock; + +- raw_spin_lock(&hb->lock); /* implies smp_mb(); (A) */ ++ spin_lock(&hb->lock); /* implies smp_mb(); (A) */ + return hb; + } + +@@ -2361,7 +2346,7 @@ static inline void + queue_unlock(struct futex_hash_bucket *hb) + __releases(&hb->lock) + { +- raw_spin_unlock(&hb->lock); ++ spin_unlock(&hb->lock); + hb_waiters_dec(hb); + } + +@@ -2400,7 +2385,7 @@ static inline void queue_me(struct futex_q *q, struct futex_hash_bucket *hb) + __releases(&hb->lock) + { + __queue_me(q, hb); +- raw_spin_unlock(&hb->lock); ++ spin_unlock(&hb->lock); + } + + /** +@@ -2416,41 +2401,41 @@ static inline void queue_me(struct futex_q *q, struct futex_hash_bucket *hb) + */ + static int unqueue_me(struct futex_q *q) + { +- raw_spinlock_t *lock_ptr; ++ spinlock_t *lock_ptr; + int ret = 0; + + /* In the common case we don't take the spinlock, which is nice. */ + retry: + /* +- * q->lock_ptr can change between this read and the following +- * raw_spin_lock. Use READ_ONCE to forbid the compiler from reloading +- * q->lock_ptr and optimizing lock_ptr out of the logic below. ++ * q->lock_ptr can change between this read and the following spin_lock. ++ * Use READ_ONCE to forbid the compiler from reloading q->lock_ptr and ++ * optimizing lock_ptr out of the logic below. + */ + lock_ptr = READ_ONCE(q->lock_ptr); + if (lock_ptr != NULL) { +- raw_spin_lock(lock_ptr); ++ spin_lock(lock_ptr); + /* + * q->lock_ptr can change between reading it and +- * raw_spin_lock(), causing us to take the wrong lock. This ++ * spin_lock(), causing us to take the wrong lock. This + * corrects the race condition. + * + * Reasoning goes like this: if we have the wrong lock, + * q->lock_ptr must have changed (maybe several times) +- * between reading it and the raw_spin_lock(). It can +- * change again after the raw_spin_lock() but only if it was +- * already changed before the raw_spin_lock(). It cannot, ++ * between reading it and the spin_lock(). It can ++ * change again after the spin_lock() but only if it was ++ * already changed before the spin_lock(). It cannot, + * however, change back to the original value. Therefore + * we can detect whether we acquired the correct lock. + */ + if (unlikely(lock_ptr != q->lock_ptr)) { +- raw_spin_unlock(lock_ptr); ++ spin_unlock(lock_ptr); + goto retry; + } + __unqueue_futex(q); + + BUG_ON(q->pi_state); + +- raw_spin_unlock(lock_ptr); ++ spin_unlock(lock_ptr); + ret = 1; + } + +@@ -2466,16 +2451,13 @@ static int unqueue_me(struct futex_q *q) + static void unqueue_me_pi(struct futex_q *q) + __releases(q->lock_ptr) + { +- struct futex_pi_state *ps; +- + __unqueue_futex(q); + + BUG_ON(!q->pi_state); +- ps = __put_pi_state(q->pi_state); ++ put_pi_state(q->pi_state); + q->pi_state = NULL; + +- raw_spin_unlock(q->lock_ptr); +- kfree(ps); ++ spin_unlock(q->lock_ptr); + } + + static int __fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, +@@ -2599,7 +2581,7 @@ static int __fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, + */ + handle_err: + raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock); +- raw_spin_unlock(q->lock_ptr); ++ spin_unlock(q->lock_ptr); + + switch (err) { + case -EFAULT: +@@ -2616,7 +2598,7 @@ static int __fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, + break; + } + +- raw_spin_lock(q->lock_ptr); ++ spin_lock(q->lock_ptr); + raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock); + + /* +@@ -2730,7 +2712,7 @@ static void futex_wait_queue_me(struct futex_hash_bucket *hb, struct futex_q *q, + /* + * The task state is guaranteed to be set before another task can + * wake it. set_current_state() is implemented using smp_store_mb() and +- * queue_me() calls raw_spin_unlock() upon completion, both serializing ++ * queue_me() calls spin_unlock() upon completion, both serializing + * access to the hash list and forcing another memory barrier. + */ + set_current_state(TASK_INTERRUPTIBLE); +@@ -3028,7 +3010,15 @@ static int futex_lock_pi(u32 __user *uaddr, unsigned int flags, + * before __rt_mutex_start_proxy_lock() is done. + */ + raw_spin_lock_irq(&q.pi_state->pi_mutex.wait_lock); +- raw_spin_unlock(q.lock_ptr); ++ /* ++ * the migrate_disable() here disables migration in the in_atomic() fast ++ * path which is enabled again in the following spin_unlock(). We have ++ * one migrate_disable() pending in the slow-path which is reversed ++ * after the raw_spin_unlock_irq() where we leave the atomic context. ++ */ ++ migrate_disable(); ++ ++ spin_unlock(q.lock_ptr); + /* + * __rt_mutex_start_proxy_lock() unconditionally enqueues the @rt_waiter + * such that futex_unlock_pi() is guaranteed to observe the waiter when +@@ -3036,6 +3026,7 @@ static int futex_lock_pi(u32 __user *uaddr, unsigned int flags, + */ + ret = __rt_mutex_start_proxy_lock(&q.pi_state->pi_mutex, &rt_waiter, current); + raw_spin_unlock_irq(&q.pi_state->pi_mutex.wait_lock); ++ migrate_enable(); + + if (ret) { + if (ret == 1) +@@ -3049,7 +3040,7 @@ static int futex_lock_pi(u32 __user *uaddr, unsigned int flags, + ret = rt_mutex_wait_proxy_lock(&q.pi_state->pi_mutex, to, &rt_waiter); + + cleanup: +- raw_spin_lock(q.lock_ptr); ++ spin_lock(q.lock_ptr); + /* + * If we failed to acquire the lock (deadlock/signal/timeout), we must + * first acquire the hb->lock before removing the lock from the +@@ -3136,7 +3127,7 @@ static int futex_unlock_pi(u32 __user *uaddr, unsigned int flags) + return ret; + + hb = hash_futex(&key); +- raw_spin_lock(&hb->lock); ++ spin_lock(&hb->lock); + + /* + * Check waiters first. We do not trust user space values at +@@ -3170,10 +3161,19 @@ static int futex_unlock_pi(u32 __user *uaddr, unsigned int flags) + * rt_waiter. Also see the WARN in wake_futex_pi(). + */ + raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock); +- raw_spin_unlock(&hb->lock); ++ /* ++ * Magic trickery for now to make the RT migrate disable ++ * logic happy. The following spin_unlock() happens with ++ * interrupts disabled so the internal migrate_enable() ++ * won't undo the migrate_disable() which was issued when ++ * locking hb->lock. ++ */ ++ migrate_disable(); ++ spin_unlock(&hb->lock); + + /* drops pi_state->pi_mutex.wait_lock */ + ret = wake_futex_pi(uaddr, uval, pi_state); ++ migrate_enable(); + + put_pi_state(pi_state); + +@@ -3209,7 +3209,7 @@ static int futex_unlock_pi(u32 __user *uaddr, unsigned int flags) + * owner. + */ + if ((ret = cmpxchg_futex_value_locked(&curval, uaddr, uval, 0))) { +- raw_spin_unlock(&hb->lock); ++ spin_unlock(&hb->lock); + switch (ret) { + case -EFAULT: + goto pi_faulted; +@@ -3229,7 +3229,7 @@ static int futex_unlock_pi(u32 __user *uaddr, unsigned int flags) + ret = (curval == uval) ? 0 : -EAGAIN; + + out_unlock: +- raw_spin_unlock(&hb->lock); ++ spin_unlock(&hb->lock); + out_putkey: + put_futex_key(&key); + return ret; +@@ -3344,7 +3344,7 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, + { + struct hrtimer_sleeper timeout, *to = NULL; + struct rt_mutex_waiter rt_waiter; +- struct futex_hash_bucket *hb; ++ struct futex_hash_bucket *hb, *hb2; + union futex_key key2 = FUTEX_KEY_INIT; + struct futex_q q = futex_q_init; + int res, ret; +@@ -3402,20 +3402,55 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, + /* Queue the futex_q, drop the hb lock, wait for wakeup. */ + futex_wait_queue_me(hb, &q, to); + +- raw_spin_lock(&hb->lock); +- ret = handle_early_requeue_pi_wakeup(hb, &q, &key2, to); +- raw_spin_unlock(&hb->lock); +- if (ret) +- goto out_put_keys; ++ /* ++ * On RT we must avoid races with requeue and trying to block ++ * on two mutexes (hb->lock and uaddr2's rtmutex) by ++ * serializing access to pi_blocked_on with pi_lock. ++ */ ++ raw_spin_lock_irq(¤t->pi_lock); ++ if (current->pi_blocked_on) { ++ /* ++ * We have been requeued or are in the process of ++ * being requeued. ++ */ ++ raw_spin_unlock_irq(¤t->pi_lock); ++ } else { ++ /* ++ * Setting pi_blocked_on to PI_WAKEUP_INPROGRESS ++ * prevents a concurrent requeue from moving us to the ++ * uaddr2 rtmutex. After that we can safely acquire ++ * (and possibly block on) hb->lock. ++ */ ++ current->pi_blocked_on = PI_WAKEUP_INPROGRESS; ++ raw_spin_unlock_irq(¤t->pi_lock); ++ ++ spin_lock(&hb->lock); ++ ++ /* ++ * Clean up pi_blocked_on. We might leak it otherwise ++ * when we succeeded with the hb->lock in the fast ++ * path. ++ */ ++ raw_spin_lock_irq(¤t->pi_lock); ++ current->pi_blocked_on = NULL; ++ raw_spin_unlock_irq(¤t->pi_lock); ++ ++ ret = handle_early_requeue_pi_wakeup(hb, &q, &key2, to); ++ spin_unlock(&hb->lock); ++ if (ret) ++ goto out_put_keys; ++ } + + /* +- * In order for us to be here, we know our q.key == key2, and since +- * we took the hb->lock above, we also know that futex_requeue() has +- * completed and we no longer have to concern ourselves with a wakeup +- * race with the atomic proxy lock acquisition by the requeue code. The +- * futex_requeue dropped our key1 reference and incremented our key2 +- * reference count. ++ * In order to be here, we have either been requeued, are in ++ * the process of being requeued, or requeue successfully ++ * acquired uaddr2 on our behalf. If pi_blocked_on was ++ * non-null above, we may be racing with a requeue. Do not ++ * rely on q->lock_ptr to be hb2->lock until after blocking on ++ * hb->lock or hb2->lock. The futex_requeue dropped our key1 ++ * reference and incremented our key2 reference count. + */ ++ hb2 = hash_futex(&key2); + + /* Check if the requeue code acquired the second futex for us. */ + if (!q.rt_waiter) { +@@ -3424,17 +3459,15 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, + * did a lock-steal - fix up the PI-state in that case. + */ + if (q.pi_state && (q.pi_state->owner != current)) { +- struct futex_pi_state *ps_free; +- +- raw_spin_lock(q.lock_ptr); ++ spin_lock(&hb2->lock); ++ BUG_ON(&hb2->lock != q.lock_ptr); + ret = fixup_pi_state_owner(uaddr2, &q, current); + /* + * Drop the reference to the pi state which + * the requeue_pi() code acquired for us. + */ +- ps_free = __put_pi_state(q.pi_state); ++ put_pi_state(q.pi_state); + spin_unlock(&hb2->lock); +- kfree(ps_free); + /* + * Adjust the return value. It's either -EFAULT or + * success (1) but the caller expects 0 for success. +@@ -3453,7 +3486,8 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, + pi_mutex = &q.pi_state->pi_mutex; + ret = rt_mutex_wait_proxy_lock(pi_mutex, to, &rt_waiter); + +- raw_spin_lock(q.lock_ptr); ++ spin_lock(&hb2->lock); ++ BUG_ON(&hb2->lock != q.lock_ptr); + if (ret && !rt_mutex_cleanup_proxy_lock(pi_mutex, &rt_waiter)) + ret = 0; + +@@ -4212,7 +4246,7 @@ static int __init futex_init(void) + for (i = 0; i < futex_hashsize; i++) { + atomic_set(&futex_queues[i].waiters, 0); + plist_head_init(&futex_queues[i].chain); +- raw_spin_lock_init(&futex_queues[i].lock); ++ spin_lock_init(&futex_queues[i].lock); + } + + return 0; +diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c +index 05fcf8a75a51..ded2296f848a 100644 +--- a/kernel/locking/rtmutex.c ++++ b/kernel/locking/rtmutex.c +@@ -142,6 +142,12 @@ static void fixup_rt_mutex_waiters(struct rt_mutex *lock) + WRITE_ONCE(*p, owner & ~RT_MUTEX_HAS_WAITERS); + } + ++static int rt_mutex_real_waiter(struct rt_mutex_waiter *waiter) ++{ ++ return waiter && waiter != PI_WAKEUP_INPROGRESS && ++ waiter != PI_REQUEUE_INPROGRESS; ++} ++ + /* + * We can speed up the acquire/release, if there's no debugging state to be + * set up. +@@ -415,7 +421,8 @@ int max_lock_depth = 1024; + + static inline struct rt_mutex *task_blocked_on_lock(struct task_struct *p) + { +- return p->pi_blocked_on ? p->pi_blocked_on->lock : NULL; ++ return rt_mutex_real_waiter(p->pi_blocked_on) ? ++ p->pi_blocked_on->lock : NULL; + } + + /* +@@ -551,7 +558,7 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task, + * reached or the state of the chain has changed while we + * dropped the locks. + */ +- if (!waiter) ++ if (!rt_mutex_real_waiter(waiter)) + goto out_unlock_pi; + + /* +@@ -1321,6 +1328,22 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock, + return -EDEADLK; + + raw_spin_lock(&task->pi_lock); ++ /* ++ * In the case of futex requeue PI, this will be a proxy ++ * lock. The task will wake unaware that it is enqueueed on ++ * this lock. Avoid blocking on two locks and corrupting ++ * pi_blocked_on via the PI_WAKEUP_INPROGRESS ++ * flag. futex_wait_requeue_pi() sets this when it wakes up ++ * before requeue (due to a signal or timeout). Do not enqueue ++ * the task if PI_WAKEUP_INPROGRESS is set. ++ */ ++ if (task != current && task->pi_blocked_on == PI_WAKEUP_INPROGRESS) { ++ raw_spin_unlock(&task->pi_lock); ++ return -EAGAIN; ++ } ++ ++ BUG_ON(rt_mutex_real_waiter(task->pi_blocked_on)); ++ + waiter->task = task; + waiter->lock = lock; + waiter->prio = task->prio; +@@ -1344,7 +1367,7 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock, + rt_mutex_enqueue_pi(owner, waiter); + + rt_mutex_adjust_prio(owner); +- if (owner->pi_blocked_on) ++ if (rt_mutex_real_waiter(owner->pi_blocked_on)) + chain_walk = 1; + } else if (rt_mutex_cond_detect_deadlock(waiter, chwalk)) { + chain_walk = 1; +@@ -1444,7 +1467,7 @@ static void remove_waiter(struct rt_mutex *lock, + { + bool is_top_waiter = (waiter == rt_mutex_top_waiter(lock)); + struct task_struct *owner = rt_mutex_owner(lock); +- struct rt_mutex *next_lock; ++ struct rt_mutex *next_lock = NULL; + + lockdep_assert_held(&lock->wait_lock); + +@@ -1470,7 +1493,8 @@ static void remove_waiter(struct rt_mutex *lock, + rt_mutex_adjust_prio(owner); + + /* Store the lock on which owner is blocked or NULL */ +- next_lock = task_blocked_on_lock(owner); ++ if (rt_mutex_real_waiter(owner->pi_blocked_on)) ++ next_lock = task_blocked_on_lock(owner); + + raw_spin_unlock(&owner->pi_lock); + +@@ -1506,7 +1530,8 @@ void rt_mutex_adjust_pi(struct task_struct *task) + raw_spin_lock_irqsave(&task->pi_lock, flags); + + waiter = task->pi_blocked_on; +- if (!waiter || rt_mutex_waiter_equal(waiter, task_to_waiter(task))) { ++ if (!rt_mutex_real_waiter(waiter) || ++ rt_mutex_waiter_equal(waiter, task_to_waiter(task))) { + raw_spin_unlock_irqrestore(&task->pi_lock, flags); + return; + } +@@ -2324,6 +2349,34 @@ int __rt_mutex_start_proxy_lock(struct rt_mutex *lock, + if (try_to_take_rt_mutex(lock, task, NULL)) + return 1; + ++#ifdef CONFIG_PREEMPT_RT_FULL ++ /* ++ * In PREEMPT_RT there's an added race. ++ * If the task, that we are about to requeue, times out, ++ * it can set the PI_WAKEUP_INPROGRESS. This tells the requeue ++ * to skip this task. But right after the task sets ++ * its pi_blocked_on to PI_WAKEUP_INPROGRESS it can then ++ * block on the spin_lock(&hb->lock), which in RT is an rtmutex. ++ * This will replace the PI_WAKEUP_INPROGRESS with the actual ++ * lock that it blocks on. We *must not* place this task ++ * on this proxy lock in that case. ++ * ++ * To prevent this race, we first take the task's pi_lock ++ * and check if it has updated its pi_blocked_on. If it has, ++ * we assume that it woke up and we return -EAGAIN. ++ * Otherwise, we set the task's pi_blocked_on to ++ * PI_REQUEUE_INPROGRESS, so that if the task is waking up ++ * it will know that we are in the process of requeuing it. ++ */ ++ raw_spin_lock(&task->pi_lock); ++ if (task->pi_blocked_on) { ++ raw_spin_unlock(&task->pi_lock); ++ return -EAGAIN; ++ } ++ task->pi_blocked_on = PI_REQUEUE_INPROGRESS; ++ raw_spin_unlock(&task->pi_lock); ++#endif ++ + /* We enforce deadlock detection for futexes */ + ret = task_blocks_on_rt_mutex(lock, waiter, task, + RT_MUTEX_FULL_CHAINWALK); +diff --git a/kernel/locking/rtmutex_common.h b/kernel/locking/rtmutex_common.h +index f587e0422d23..8e0c592273e6 100644 +--- a/kernel/locking/rtmutex_common.h ++++ b/kernel/locking/rtmutex_common.h +@@ -132,6 +132,9 @@ enum rtmutex_chainwalk { + /* + * PI-futex support (proxy locking functions, etc.): + */ ++#define PI_WAKEUP_INPROGRESS ((struct rt_mutex_waiter *) 1) ++#define PI_REQUEUE_INPROGRESS ((struct rt_mutex_waiter *) 2) ++ + extern struct task_struct *rt_mutex_next_owner(struct rt_mutex *lock); + extern void rt_mutex_init_proxy_locked(struct rt_mutex *lock, + struct task_struct *proxy_owner); diff --git a/debian/patches-rt/0302-lib-smp_processor_id-Don-t-use-cpumask_equal.patch b/debian/patches-rt/0302-lib-smp_processor_id-Don-t-use-cpumask_equal.patch deleted file mode 100644 index ce14d4f68..000000000 --- a/debian/patches-rt/0302-lib-smp_processor_id-Don-t-use-cpumask_equal.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 9f39347ad1257ec5ba912513bc7fda854af0bcd0 Mon Sep 17 00:00:00 2001 -From: Waiman Long -Date: Thu, 3 Oct 2019 16:36:08 -0400 -Subject: [PATCH 302/347] lib/smp_processor_id: Don't use cpumask_equal() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 659252061477862f45b79e1de169e6030f5c8918 ] - -The check_preemption_disabled() function uses cpumask_equal() to see -if the task is bounded to the current CPU only. cpumask_equal() calls -memcmp() to do the comparison. As x86 doesn't have __HAVE_ARCH_MEMCMP, -the slow memcmp() function in lib/string.c is used. - -On a RT kernel that call check_preemption_disabled() very frequently, -below is the perf-record output of a certain microbenchmark: - - 42.75% 2.45% testpmd [kernel.kallsyms] [k] check_preemption_disabled - 40.01% 39.97% testpmd [kernel.kallsyms] [k] memcmp - -We should avoid calling memcmp() in performance critical path. So the -cpumask_equal() call is now replaced with an equivalent simpler check. - -Signed-off-by: Waiman Long -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - lib/smp_processor_id.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/lib/smp_processor_id.c b/lib/smp_processor_id.c -index fb35c45b9421..b8a8a8db2d75 100644 ---- a/lib/smp_processor_id.c -+++ b/lib/smp_processor_id.c -@@ -22,7 +22,7 @@ notrace static unsigned int check_preemption_disabled(const char *what1, - * Kernel threads bound to a single CPU can safely use - * smp_processor_id(): - */ -- if (cpumask_equal(current->cpus_ptr, cpumask_of(this_cpu))) -+ if (current->nr_cpus_allowed == 1) - goto out; - - /* --- -2.36.1 - diff --git a/debian/patches-rt/0303-futex-Make-the-futex_hash_bucket-spinlock_t-again-an.patch b/debian/patches-rt/0303-futex-Make-the-futex_hash_bucket-spinlock_t-again-an.patch deleted file mode 100644 index 480218133..000000000 --- a/debian/patches-rt/0303-futex-Make-the-futex_hash_bucket-spinlock_t-again-an.patch +++ /dev/null @@ -1,735 +0,0 @@ -From f7a1b76e65c0d79612a6f81b5afc8558b6256242 Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Mon, 7 Oct 2019 16:45:18 +0200 -Subject: [PATCH 303/347] futex: Make the futex_hash_bucket spinlock_t again - and bring back its old state -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 954ad80c23edfe71f4e8ce70b961eac884320c3a ] - -This is an all-in-one patch that reverts the patches: - futex: Make the futex_hash_bucket lock raw - futex: Delay deallocation of pi_state - -and adds back the old patches we had: - futex: workaround migrate_disable/enable in different context - rtmutex: Handle the various new futex race conditions - futex: Fix bug on when a requeued RT task times out - futex: Ensure lock/unlock symetry versus pi_lock and hash bucket lock - -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - kernel/futex.c | 228 ++++++++++++++++++-------------- - kernel/locking/rtmutex.c | 65 ++++++++- - kernel/locking/rtmutex_common.h | 3 + - 3 files changed, 193 insertions(+), 103 deletions(-) - -diff --git a/kernel/futex.c b/kernel/futex.c -index 2fc6bedb460e..81090f7a3ed9 100644 ---- a/kernel/futex.c -+++ b/kernel/futex.c -@@ -243,7 +243,7 @@ struct futex_q { - struct plist_node list; - - struct task_struct *task; -- raw_spinlock_t *lock_ptr; -+ spinlock_t *lock_ptr; - union futex_key key; - struct futex_pi_state *pi_state; - struct rt_mutex_waiter *rt_waiter; -@@ -264,7 +264,7 @@ static const struct futex_q futex_q_init = { - */ - struct futex_hash_bucket { - atomic_t waiters; -- raw_spinlock_t lock; -+ spinlock_t lock; - struct plist_head chain; - } ____cacheline_aligned_in_smp; - -@@ -871,13 +871,13 @@ static void get_pi_state(struct futex_pi_state *pi_state) - * Drops a reference to the pi_state object and frees or caches it - * when the last reference is gone. - */ --static struct futex_pi_state *__put_pi_state(struct futex_pi_state *pi_state) -+static void put_pi_state(struct futex_pi_state *pi_state) - { - if (!pi_state) -- return NULL; -+ return; - - if (!atomic_dec_and_test(&pi_state->refcount)) -- return NULL; -+ return; - - /* - * If pi_state->owner is NULL, the owner is most probably dying -@@ -892,7 +892,9 @@ static struct futex_pi_state *__put_pi_state(struct futex_pi_state *pi_state) - raw_spin_unlock_irqrestore(&pi_state->pi_mutex.wait_lock, flags); - } - -- if (!current->pi_state_cache) { -+ if (current->pi_state_cache) { -+ kfree(pi_state); -+ } else { - /* - * pi_state->list is already empty. - * clear pi_state->owner. -@@ -901,30 +903,6 @@ static struct futex_pi_state *__put_pi_state(struct futex_pi_state *pi_state) - pi_state->owner = NULL; - atomic_set(&pi_state->refcount, 1); - current->pi_state_cache = pi_state; -- pi_state = NULL; -- } -- return pi_state; --} -- --static void put_pi_state(struct futex_pi_state *pi_state) --{ -- kfree(__put_pi_state(pi_state)); --} -- --static void put_pi_state_atomic(struct futex_pi_state *pi_state, -- struct list_head *to_free) --{ -- if (__put_pi_state(pi_state)) -- list_add(&pi_state->list, to_free); --} -- --static void free_pi_state_list(struct list_head *to_free) --{ -- struct futex_pi_state *p, *next; -- -- list_for_each_entry_safe(p, next, to_free, list) { -- list_del(&p->list); -- kfree(p); - } - } - -@@ -941,7 +919,6 @@ static void exit_pi_state_list(struct task_struct *curr) - struct futex_pi_state *pi_state; - struct futex_hash_bucket *hb; - union futex_key key = FUTEX_KEY_INIT; -- LIST_HEAD(to_free); - - if (!futex_cmpxchg_enabled) - return; -@@ -975,7 +952,7 @@ static void exit_pi_state_list(struct task_struct *curr) - } - raw_spin_unlock_irq(&curr->pi_lock); - -- raw_spin_lock(&hb->lock); -+ spin_lock(&hb->lock); - raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock); - raw_spin_lock(&curr->pi_lock); - /* -@@ -985,8 +962,10 @@ static void exit_pi_state_list(struct task_struct *curr) - if (head->next != next) { - /* retain curr->pi_lock for the loop invariant */ - raw_spin_unlock(&pi_state->pi_mutex.wait_lock); -- raw_spin_unlock(&hb->lock); -- put_pi_state_atomic(pi_state, &to_free); -+ raw_spin_unlock_irq(&curr->pi_lock); -+ spin_unlock(&hb->lock); -+ raw_spin_lock_irq(&curr->pi_lock); -+ put_pi_state(pi_state); - continue; - } - -@@ -997,7 +976,7 @@ static void exit_pi_state_list(struct task_struct *curr) - - raw_spin_unlock(&curr->pi_lock); - raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock); -- raw_spin_unlock(&hb->lock); -+ spin_unlock(&hb->lock); - - rt_mutex_futex_unlock(&pi_state->pi_mutex); - put_pi_state(pi_state); -@@ -1005,8 +984,6 @@ static void exit_pi_state_list(struct task_struct *curr) - raw_spin_lock_irq(&curr->pi_lock); - } - raw_spin_unlock_irq(&curr->pi_lock); -- -- free_pi_state_list(&to_free); - } - #else - static inline void exit_pi_state_list(struct task_struct *curr) { } -@@ -1548,7 +1525,7 @@ static void __unqueue_futex(struct futex_q *q) - { - struct futex_hash_bucket *hb; - -- if (WARN_ON_SMP(!q->lock_ptr || !raw_spin_is_locked(q->lock_ptr)) -+ if (WARN_ON_SMP(!q->lock_ptr || !spin_is_locked(q->lock_ptr)) - || WARN_ON(plist_node_empty(&q->list))) - return; - -@@ -1668,21 +1645,21 @@ static inline void - double_lock_hb(struct futex_hash_bucket *hb1, struct futex_hash_bucket *hb2) - { - if (hb1 <= hb2) { -- raw_spin_lock(&hb1->lock); -+ spin_lock(&hb1->lock); - if (hb1 < hb2) -- raw_spin_lock_nested(&hb2->lock, SINGLE_DEPTH_NESTING); -+ spin_lock_nested(&hb2->lock, SINGLE_DEPTH_NESTING); - } else { /* hb1 > hb2 */ -- raw_spin_lock(&hb2->lock); -- raw_spin_lock_nested(&hb1->lock, SINGLE_DEPTH_NESTING); -+ spin_lock(&hb2->lock); -+ spin_lock_nested(&hb1->lock, SINGLE_DEPTH_NESTING); - } - } - - static inline void - double_unlock_hb(struct futex_hash_bucket *hb1, struct futex_hash_bucket *hb2) - { -- raw_spin_unlock(&hb1->lock); -+ spin_unlock(&hb1->lock); - if (hb1 != hb2) -- raw_spin_unlock(&hb2->lock); -+ spin_unlock(&hb2->lock); - } - - /* -@@ -1710,7 +1687,7 @@ futex_wake(u32 __user *uaddr, unsigned int flags, int nr_wake, u32 bitset) - if (!hb_waiters_pending(hb)) - goto out_put_key; - -- raw_spin_lock(&hb->lock); -+ spin_lock(&hb->lock); - - plist_for_each_entry_safe(this, next, &hb->chain, list) { - if (match_futex (&this->key, &key)) { -@@ -1729,7 +1706,7 @@ futex_wake(u32 __user *uaddr, unsigned int flags, int nr_wake, u32 bitset) - } - } - -- raw_spin_unlock(&hb->lock); -+ spin_unlock(&hb->lock); - wake_up_q(&wake_q); - out_put_key: - put_futex_key(&key); -@@ -2042,7 +2019,6 @@ static int futex_requeue(u32 __user *uaddr1, unsigned int flags, - struct futex_hash_bucket *hb1, *hb2; - struct futex_q *this, *next; - DEFINE_WAKE_Q(wake_q); -- LIST_HEAD(to_free); - - if (nr_wake < 0 || nr_requeue < 0) - return -EINVAL; -@@ -2281,6 +2257,16 @@ static int futex_requeue(u32 __user *uaddr1, unsigned int flags, - requeue_pi_wake_futex(this, &key2, hb2); - drop_count++; - continue; -+ } else if (ret == -EAGAIN) { -+ /* -+ * Waiter was woken by timeout or -+ * signal and has set pi_blocked_on to -+ * PI_WAKEUP_INPROGRESS before we -+ * tried to enqueue it on the rtmutex. -+ */ -+ this->pi_state = NULL; -+ put_pi_state(pi_state); -+ continue; - } else if (ret) { - /* - * rt_mutex_start_proxy_lock() detected a -@@ -2291,7 +2277,7 @@ static int futex_requeue(u32 __user *uaddr1, unsigned int flags, - * object. - */ - this->pi_state = NULL; -- put_pi_state_atomic(pi_state, &to_free); -+ put_pi_state(pi_state); - /* - * We stop queueing more waiters and let user - * space deal with the mess. -@@ -2308,7 +2294,7 @@ static int futex_requeue(u32 __user *uaddr1, unsigned int flags, - * in futex_proxy_trylock_atomic() or in lookup_pi_state(). We - * need to drop it here again. - */ -- put_pi_state_atomic(pi_state, &to_free); -+ put_pi_state(pi_state); - - out_unlock: - double_unlock_hb(hb1, hb2); -@@ -2329,7 +2315,6 @@ static int futex_requeue(u32 __user *uaddr1, unsigned int flags, - out_put_key1: - put_futex_key(&key1); - out: -- free_pi_state_list(&to_free); - return ret ? ret : task_count; - } - -@@ -2353,7 +2338,7 @@ static inline struct futex_hash_bucket *queue_lock(struct futex_q *q) - - q->lock_ptr = &hb->lock; - -- raw_spin_lock(&hb->lock); /* implies smp_mb(); (A) */ -+ spin_lock(&hb->lock); /* implies smp_mb(); (A) */ - return hb; - } - -@@ -2361,7 +2346,7 @@ static inline void - queue_unlock(struct futex_hash_bucket *hb) - __releases(&hb->lock) - { -- raw_spin_unlock(&hb->lock); -+ spin_unlock(&hb->lock); - hb_waiters_dec(hb); - } - -@@ -2400,7 +2385,7 @@ static inline void queue_me(struct futex_q *q, struct futex_hash_bucket *hb) - __releases(&hb->lock) - { - __queue_me(q, hb); -- raw_spin_unlock(&hb->lock); -+ spin_unlock(&hb->lock); - } - - /** -@@ -2416,41 +2401,41 @@ static inline void queue_me(struct futex_q *q, struct futex_hash_bucket *hb) - */ - static int unqueue_me(struct futex_q *q) - { -- raw_spinlock_t *lock_ptr; -+ spinlock_t *lock_ptr; - int ret = 0; - - /* In the common case we don't take the spinlock, which is nice. */ - retry: - /* -- * q->lock_ptr can change between this read and the following -- * raw_spin_lock. Use READ_ONCE to forbid the compiler from reloading -- * q->lock_ptr and optimizing lock_ptr out of the logic below. -+ * q->lock_ptr can change between this read and the following spin_lock. -+ * Use READ_ONCE to forbid the compiler from reloading q->lock_ptr and -+ * optimizing lock_ptr out of the logic below. - */ - lock_ptr = READ_ONCE(q->lock_ptr); - if (lock_ptr != NULL) { -- raw_spin_lock(lock_ptr); -+ spin_lock(lock_ptr); - /* - * q->lock_ptr can change between reading it and -- * raw_spin_lock(), causing us to take the wrong lock. This -+ * spin_lock(), causing us to take the wrong lock. This - * corrects the race condition. - * - * Reasoning goes like this: if we have the wrong lock, - * q->lock_ptr must have changed (maybe several times) -- * between reading it and the raw_spin_lock(). It can -- * change again after the raw_spin_lock() but only if it was -- * already changed before the raw_spin_lock(). It cannot, -+ * between reading it and the spin_lock(). It can -+ * change again after the spin_lock() but only if it was -+ * already changed before the spin_lock(). It cannot, - * however, change back to the original value. Therefore - * we can detect whether we acquired the correct lock. - */ - if (unlikely(lock_ptr != q->lock_ptr)) { -- raw_spin_unlock(lock_ptr); -+ spin_unlock(lock_ptr); - goto retry; - } - __unqueue_futex(q); - - BUG_ON(q->pi_state); - -- raw_spin_unlock(lock_ptr); -+ spin_unlock(lock_ptr); - ret = 1; - } - -@@ -2466,16 +2451,13 @@ static int unqueue_me(struct futex_q *q) - static void unqueue_me_pi(struct futex_q *q) - __releases(q->lock_ptr) - { -- struct futex_pi_state *ps; -- - __unqueue_futex(q); - - BUG_ON(!q->pi_state); -- ps = __put_pi_state(q->pi_state); -+ put_pi_state(q->pi_state); - q->pi_state = NULL; - -- raw_spin_unlock(q->lock_ptr); -- kfree(ps); -+ spin_unlock(q->lock_ptr); - } - - static int __fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, -@@ -2599,7 +2581,7 @@ static int __fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, - */ - handle_err: - raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock); -- raw_spin_unlock(q->lock_ptr); -+ spin_unlock(q->lock_ptr); - - switch (err) { - case -EFAULT: -@@ -2616,7 +2598,7 @@ static int __fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, - break; - } - -- raw_spin_lock(q->lock_ptr); -+ spin_lock(q->lock_ptr); - raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock); - - /* -@@ -2730,7 +2712,7 @@ static void futex_wait_queue_me(struct futex_hash_bucket *hb, struct futex_q *q, - /* - * The task state is guaranteed to be set before another task can - * wake it. set_current_state() is implemented using smp_store_mb() and -- * queue_me() calls raw_spin_unlock() upon completion, both serializing -+ * queue_me() calls spin_unlock() upon completion, both serializing - * access to the hash list and forcing another memory barrier. - */ - set_current_state(TASK_INTERRUPTIBLE); -@@ -3028,7 +3010,15 @@ static int futex_lock_pi(u32 __user *uaddr, unsigned int flags, - * before __rt_mutex_start_proxy_lock() is done. - */ - raw_spin_lock_irq(&q.pi_state->pi_mutex.wait_lock); -- raw_spin_unlock(q.lock_ptr); -+ /* -+ * the migrate_disable() here disables migration in the in_atomic() fast -+ * path which is enabled again in the following spin_unlock(). We have -+ * one migrate_disable() pending in the slow-path which is reversed -+ * after the raw_spin_unlock_irq() where we leave the atomic context. -+ */ -+ migrate_disable(); -+ -+ spin_unlock(q.lock_ptr); - /* - * __rt_mutex_start_proxy_lock() unconditionally enqueues the @rt_waiter - * such that futex_unlock_pi() is guaranteed to observe the waiter when -@@ -3036,6 +3026,7 @@ static int futex_lock_pi(u32 __user *uaddr, unsigned int flags, - */ - ret = __rt_mutex_start_proxy_lock(&q.pi_state->pi_mutex, &rt_waiter, current); - raw_spin_unlock_irq(&q.pi_state->pi_mutex.wait_lock); -+ migrate_enable(); - - if (ret) { - if (ret == 1) -@@ -3049,7 +3040,7 @@ static int futex_lock_pi(u32 __user *uaddr, unsigned int flags, - ret = rt_mutex_wait_proxy_lock(&q.pi_state->pi_mutex, to, &rt_waiter); - - cleanup: -- raw_spin_lock(q.lock_ptr); -+ spin_lock(q.lock_ptr); - /* - * If we failed to acquire the lock (deadlock/signal/timeout), we must - * first acquire the hb->lock before removing the lock from the -@@ -3136,7 +3127,7 @@ static int futex_unlock_pi(u32 __user *uaddr, unsigned int flags) - return ret; - - hb = hash_futex(&key); -- raw_spin_lock(&hb->lock); -+ spin_lock(&hb->lock); - - /* - * Check waiters first. We do not trust user space values at -@@ -3170,10 +3161,19 @@ static int futex_unlock_pi(u32 __user *uaddr, unsigned int flags) - * rt_waiter. Also see the WARN in wake_futex_pi(). - */ - raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock); -- raw_spin_unlock(&hb->lock); -+ /* -+ * Magic trickery for now to make the RT migrate disable -+ * logic happy. The following spin_unlock() happens with -+ * interrupts disabled so the internal migrate_enable() -+ * won't undo the migrate_disable() which was issued when -+ * locking hb->lock. -+ */ -+ migrate_disable(); -+ spin_unlock(&hb->lock); - - /* drops pi_state->pi_mutex.wait_lock */ - ret = wake_futex_pi(uaddr, uval, pi_state); -+ migrate_enable(); - - put_pi_state(pi_state); - -@@ -3209,7 +3209,7 @@ static int futex_unlock_pi(u32 __user *uaddr, unsigned int flags) - * owner. - */ - if ((ret = cmpxchg_futex_value_locked(&curval, uaddr, uval, 0))) { -- raw_spin_unlock(&hb->lock); -+ spin_unlock(&hb->lock); - switch (ret) { - case -EFAULT: - goto pi_faulted; -@@ -3229,7 +3229,7 @@ static int futex_unlock_pi(u32 __user *uaddr, unsigned int flags) - ret = (curval == uval) ? 0 : -EAGAIN; - - out_unlock: -- raw_spin_unlock(&hb->lock); -+ spin_unlock(&hb->lock); - out_putkey: - put_futex_key(&key); - return ret; -@@ -3344,7 +3344,7 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, - { - struct hrtimer_sleeper timeout, *to = NULL; - struct rt_mutex_waiter rt_waiter; -- struct futex_hash_bucket *hb; -+ struct futex_hash_bucket *hb, *hb2; - union futex_key key2 = FUTEX_KEY_INIT; - struct futex_q q = futex_q_init; - int res, ret; -@@ -3402,20 +3402,55 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, - /* Queue the futex_q, drop the hb lock, wait for wakeup. */ - futex_wait_queue_me(hb, &q, to); - -- raw_spin_lock(&hb->lock); -- ret = handle_early_requeue_pi_wakeup(hb, &q, &key2, to); -- raw_spin_unlock(&hb->lock); -- if (ret) -- goto out_put_keys; -+ /* -+ * On RT we must avoid races with requeue and trying to block -+ * on two mutexes (hb->lock and uaddr2's rtmutex) by -+ * serializing access to pi_blocked_on with pi_lock. -+ */ -+ raw_spin_lock_irq(¤t->pi_lock); -+ if (current->pi_blocked_on) { -+ /* -+ * We have been requeued or are in the process of -+ * being requeued. -+ */ -+ raw_spin_unlock_irq(¤t->pi_lock); -+ } else { -+ /* -+ * Setting pi_blocked_on to PI_WAKEUP_INPROGRESS -+ * prevents a concurrent requeue from moving us to the -+ * uaddr2 rtmutex. After that we can safely acquire -+ * (and possibly block on) hb->lock. -+ */ -+ current->pi_blocked_on = PI_WAKEUP_INPROGRESS; -+ raw_spin_unlock_irq(¤t->pi_lock); -+ -+ spin_lock(&hb->lock); -+ -+ /* -+ * Clean up pi_blocked_on. We might leak it otherwise -+ * when we succeeded with the hb->lock in the fast -+ * path. -+ */ -+ raw_spin_lock_irq(¤t->pi_lock); -+ current->pi_blocked_on = NULL; -+ raw_spin_unlock_irq(¤t->pi_lock); -+ -+ ret = handle_early_requeue_pi_wakeup(hb, &q, &key2, to); -+ spin_unlock(&hb->lock); -+ if (ret) -+ goto out_put_keys; -+ } - - /* -- * In order for us to be here, we know our q.key == key2, and since -- * we took the hb->lock above, we also know that futex_requeue() has -- * completed and we no longer have to concern ourselves with a wakeup -- * race with the atomic proxy lock acquisition by the requeue code. The -- * futex_requeue dropped our key1 reference and incremented our key2 -- * reference count. -+ * In order to be here, we have either been requeued, are in -+ * the process of being requeued, or requeue successfully -+ * acquired uaddr2 on our behalf. If pi_blocked_on was -+ * non-null above, we may be racing with a requeue. Do not -+ * rely on q->lock_ptr to be hb2->lock until after blocking on -+ * hb->lock or hb2->lock. The futex_requeue dropped our key1 -+ * reference and incremented our key2 reference count. - */ -+ hb2 = hash_futex(&key2); - - /* Check if the requeue code acquired the second futex for us. */ - if (!q.rt_waiter) { -@@ -3424,17 +3459,15 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, - * did a lock-steal - fix up the PI-state in that case. - */ - if (q.pi_state && (q.pi_state->owner != current)) { -- struct futex_pi_state *ps_free; -- -- raw_spin_lock(q.lock_ptr); -+ spin_lock(&hb2->lock); -+ BUG_ON(&hb2->lock != q.lock_ptr); - ret = fixup_pi_state_owner(uaddr2, &q, current); - /* - * Drop the reference to the pi state which - * the requeue_pi() code acquired for us. - */ -- ps_free = __put_pi_state(q.pi_state); -+ put_pi_state(q.pi_state); - spin_unlock(&hb2->lock); -- kfree(ps_free); - /* - * Adjust the return value. It's either -EFAULT or - * success (1) but the caller expects 0 for success. -@@ -3453,7 +3486,8 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, - pi_mutex = &q.pi_state->pi_mutex; - ret = rt_mutex_wait_proxy_lock(pi_mutex, to, &rt_waiter); - -- raw_spin_lock(q.lock_ptr); -+ spin_lock(&hb2->lock); -+ BUG_ON(&hb2->lock != q.lock_ptr); - if (ret && !rt_mutex_cleanup_proxy_lock(pi_mutex, &rt_waiter)) - ret = 0; - -@@ -4212,7 +4246,7 @@ static int __init futex_init(void) - for (i = 0; i < futex_hashsize; i++) { - atomic_set(&futex_queues[i].waiters, 0); - plist_head_init(&futex_queues[i].chain); -- raw_spin_lock_init(&futex_queues[i].lock); -+ spin_lock_init(&futex_queues[i].lock); - } - - return 0; -diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c -index 05fcf8a75a51..ded2296f848a 100644 ---- a/kernel/locking/rtmutex.c -+++ b/kernel/locking/rtmutex.c -@@ -142,6 +142,12 @@ static void fixup_rt_mutex_waiters(struct rt_mutex *lock) - WRITE_ONCE(*p, owner & ~RT_MUTEX_HAS_WAITERS); - } - -+static int rt_mutex_real_waiter(struct rt_mutex_waiter *waiter) -+{ -+ return waiter && waiter != PI_WAKEUP_INPROGRESS && -+ waiter != PI_REQUEUE_INPROGRESS; -+} -+ - /* - * We can speed up the acquire/release, if there's no debugging state to be - * set up. -@@ -415,7 +421,8 @@ int max_lock_depth = 1024; - - static inline struct rt_mutex *task_blocked_on_lock(struct task_struct *p) - { -- return p->pi_blocked_on ? p->pi_blocked_on->lock : NULL; -+ return rt_mutex_real_waiter(p->pi_blocked_on) ? -+ p->pi_blocked_on->lock : NULL; - } - - /* -@@ -551,7 +558,7 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task, - * reached or the state of the chain has changed while we - * dropped the locks. - */ -- if (!waiter) -+ if (!rt_mutex_real_waiter(waiter)) - goto out_unlock_pi; - - /* -@@ -1321,6 +1328,22 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock, - return -EDEADLK; - - raw_spin_lock(&task->pi_lock); -+ /* -+ * In the case of futex requeue PI, this will be a proxy -+ * lock. The task will wake unaware that it is enqueueed on -+ * this lock. Avoid blocking on two locks and corrupting -+ * pi_blocked_on via the PI_WAKEUP_INPROGRESS -+ * flag. futex_wait_requeue_pi() sets this when it wakes up -+ * before requeue (due to a signal or timeout). Do not enqueue -+ * the task if PI_WAKEUP_INPROGRESS is set. -+ */ -+ if (task != current && task->pi_blocked_on == PI_WAKEUP_INPROGRESS) { -+ raw_spin_unlock(&task->pi_lock); -+ return -EAGAIN; -+ } -+ -+ BUG_ON(rt_mutex_real_waiter(task->pi_blocked_on)); -+ - waiter->task = task; - waiter->lock = lock; - waiter->prio = task->prio; -@@ -1344,7 +1367,7 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock, - rt_mutex_enqueue_pi(owner, waiter); - - rt_mutex_adjust_prio(owner); -- if (owner->pi_blocked_on) -+ if (rt_mutex_real_waiter(owner->pi_blocked_on)) - chain_walk = 1; - } else if (rt_mutex_cond_detect_deadlock(waiter, chwalk)) { - chain_walk = 1; -@@ -1444,7 +1467,7 @@ static void remove_waiter(struct rt_mutex *lock, - { - bool is_top_waiter = (waiter == rt_mutex_top_waiter(lock)); - struct task_struct *owner = rt_mutex_owner(lock); -- struct rt_mutex *next_lock; -+ struct rt_mutex *next_lock = NULL; - - lockdep_assert_held(&lock->wait_lock); - -@@ -1470,7 +1493,8 @@ static void remove_waiter(struct rt_mutex *lock, - rt_mutex_adjust_prio(owner); - - /* Store the lock on which owner is blocked or NULL */ -- next_lock = task_blocked_on_lock(owner); -+ if (rt_mutex_real_waiter(owner->pi_blocked_on)) -+ next_lock = task_blocked_on_lock(owner); - - raw_spin_unlock(&owner->pi_lock); - -@@ -1506,7 +1530,8 @@ void rt_mutex_adjust_pi(struct task_struct *task) - raw_spin_lock_irqsave(&task->pi_lock, flags); - - waiter = task->pi_blocked_on; -- if (!waiter || rt_mutex_waiter_equal(waiter, task_to_waiter(task))) { -+ if (!rt_mutex_real_waiter(waiter) || -+ rt_mutex_waiter_equal(waiter, task_to_waiter(task))) { - raw_spin_unlock_irqrestore(&task->pi_lock, flags); - return; - } -@@ -2324,6 +2349,34 @@ int __rt_mutex_start_proxy_lock(struct rt_mutex *lock, - if (try_to_take_rt_mutex(lock, task, NULL)) - return 1; - -+#ifdef CONFIG_PREEMPT_RT_FULL -+ /* -+ * In PREEMPT_RT there's an added race. -+ * If the task, that we are about to requeue, times out, -+ * it can set the PI_WAKEUP_INPROGRESS. This tells the requeue -+ * to skip this task. But right after the task sets -+ * its pi_blocked_on to PI_WAKEUP_INPROGRESS it can then -+ * block on the spin_lock(&hb->lock), which in RT is an rtmutex. -+ * This will replace the PI_WAKEUP_INPROGRESS with the actual -+ * lock that it blocks on. We *must not* place this task -+ * on this proxy lock in that case. -+ * -+ * To prevent this race, we first take the task's pi_lock -+ * and check if it has updated its pi_blocked_on. If it has, -+ * we assume that it woke up and we return -EAGAIN. -+ * Otherwise, we set the task's pi_blocked_on to -+ * PI_REQUEUE_INPROGRESS, so that if the task is waking up -+ * it will know that we are in the process of requeuing it. -+ */ -+ raw_spin_lock(&task->pi_lock); -+ if (task->pi_blocked_on) { -+ raw_spin_unlock(&task->pi_lock); -+ return -EAGAIN; -+ } -+ task->pi_blocked_on = PI_REQUEUE_INPROGRESS; -+ raw_spin_unlock(&task->pi_lock); -+#endif -+ - /* We enforce deadlock detection for futexes */ - ret = task_blocks_on_rt_mutex(lock, waiter, task, - RT_MUTEX_FULL_CHAINWALK); -diff --git a/kernel/locking/rtmutex_common.h b/kernel/locking/rtmutex_common.h -index f587e0422d23..8e0c592273e6 100644 ---- a/kernel/locking/rtmutex_common.h -+++ b/kernel/locking/rtmutex_common.h -@@ -132,6 +132,9 @@ enum rtmutex_chainwalk { - /* - * PI-futex support (proxy locking functions, etc.): - */ -+#define PI_WAKEUP_INPROGRESS ((struct rt_mutex_waiter *) 1) -+#define PI_REQUEUE_INPROGRESS ((struct rt_mutex_waiter *) 2) -+ - extern struct task_struct *rt_mutex_next_owner(struct rt_mutex *lock); - extern void rt_mutex_init_proxy_locked(struct rt_mutex *lock, - struct task_struct *proxy_owner); --- -2.36.1 - diff --git a/debian/patches-rt/0303-locking-rtmutex-Clean-pi_blocked_on-in-the-error-cas.patch b/debian/patches-rt/0303-locking-rtmutex-Clean-pi_blocked_on-in-the-error-cas.patch new file mode 100644 index 000000000..8ec5a16d0 --- /dev/null +++ b/debian/patches-rt/0303-locking-rtmutex-Clean-pi_blocked_on-in-the-error-cas.patch @@ -0,0 +1,98 @@ +From: Peter Zijlstra +Date: Mon, 30 Sep 2019 18:15:44 +0200 +Subject: [PATCH 303/342] locking/rtmutex: Clean ->pi_blocked_on in the error + case +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=aa4169c26b331ce5542238710c17b2bfe9cab704 + +[ Upstream commit 0be4ea6e3ce693101be0fbd55a0cc7ce238ab2eb ] + +The function rt_mutex_wait_proxy_lock() cleans ->pi_blocked_on in case +of failure (timeout, signal). The same cleanup is required in +__rt_mutex_start_proxy_lock(). +In both the cases the tasks was interrupted by a signal or timeout while +acquiring the lock and after the interruption it longer blocks on the +lock. + +Fixes: 1a1fb985f2e2b ("futex: Handle early deadlock return correctly") +Signed-off-by: Peter Zijlstra (Intel) +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + kernel/locking/rtmutex.c | 43 +++++++++++++++++++++++----------------- + 1 file changed, 25 insertions(+), 18 deletions(-) + +diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c +index ded2296f848a..dc95a81ae3a6 100644 +--- a/kernel/locking/rtmutex.c ++++ b/kernel/locking/rtmutex.c +@@ -2319,6 +2319,26 @@ void rt_mutex_proxy_unlock(struct rt_mutex *lock) + rt_mutex_set_owner(lock, NULL); + } + ++static void fixup_rt_mutex_blocked(struct rt_mutex *lock) ++{ ++ struct task_struct *tsk = current; ++ /* ++ * RT has a problem here when the wait got interrupted by a timeout ++ * or a signal. task->pi_blocked_on is still set. The task must ++ * acquire the hash bucket lock when returning from this function. ++ * ++ * If the hash bucket lock is contended then the ++ * BUG_ON(rt_mutex_real_waiter(task->pi_blocked_on)) in ++ * task_blocks_on_rt_mutex() will trigger. This can be avoided by ++ * clearing task->pi_blocked_on which removes the task from the ++ * boosting chain of the rtmutex. That's correct because the task ++ * is not longer blocked on it. ++ */ ++ raw_spin_lock(&tsk->pi_lock); ++ tsk->pi_blocked_on = NULL; ++ raw_spin_unlock(&tsk->pi_lock); ++} ++ + /** + * __rt_mutex_start_proxy_lock() - Start lock acquisition for another task + * @lock: the rt_mutex to take +@@ -2391,6 +2411,9 @@ int __rt_mutex_start_proxy_lock(struct rt_mutex *lock, + ret = 0; + } + ++ if (ret) ++ fixup_rt_mutex_blocked(lock); ++ + debug_rt_mutex_print_deadlock(waiter); + + return ret; +@@ -2471,7 +2494,6 @@ int rt_mutex_wait_proxy_lock(struct rt_mutex *lock, + struct hrtimer_sleeper *to, + struct rt_mutex_waiter *waiter) + { +- struct task_struct *tsk = current; + int ret; + + raw_spin_lock_irq(&lock->wait_lock); +@@ -2483,23 +2505,8 @@ int rt_mutex_wait_proxy_lock(struct rt_mutex *lock, + * have to fix that up. + */ + fixup_rt_mutex_waiters(lock); +- /* +- * RT has a problem here when the wait got interrupted by a timeout +- * or a signal. task->pi_blocked_on is still set. The task must +- * acquire the hash bucket lock when returning from this function. +- * +- * If the hash bucket lock is contended then the +- * BUG_ON(rt_mutex_real_waiter(task->pi_blocked_on)) in +- * task_blocks_on_rt_mutex() will trigger. This can be avoided by +- * clearing task->pi_blocked_on which removes the task from the +- * boosting chain of the rtmutex. That's correct because the task +- * is not longer blocked on it. +- */ +- if (ret) { +- raw_spin_lock(&tsk->pi_lock); +- tsk->pi_blocked_on = NULL; +- raw_spin_unlock(&tsk->pi_lock); +- } ++ if (ret) ++ fixup_rt_mutex_blocked(lock); + + raw_spin_unlock_irq(&lock->wait_lock); + diff --git a/debian/patches-rt/0304-lib-ubsan-Don-t-seralize-UBSAN-report.patch b/debian/patches-rt/0304-lib-ubsan-Don-t-seralize-UBSAN-report.patch new file mode 100644 index 000000000..d2b221679 --- /dev/null +++ b/debian/patches-rt/0304-lib-ubsan-Don-t-seralize-UBSAN-report.patch @@ -0,0 +1,304 @@ +From: Julien Grall +Date: Fri, 20 Sep 2019 11:08:35 +0100 +Subject: [PATCH 304/342] lib/ubsan: Don't seralize UBSAN report +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=9d8814df58e1f97746fa2da50d282d631c11542d + +[ Upstream commit 4702c28ac777b27acb499cbd5e8e787ce1a7d82d ] + +At the moment, UBSAN report will be serialized using a spin_lock(). On +RT-systems, spinlocks are turned to rt_spin_lock and may sleep. This will +result to the following splat if the undefined behavior is in a context +that can sleep: + +| BUG: sleeping function called from invalid context at /src/linux/kernel/locking/rtmutex.c:968 +| in_atomic(): 1, irqs_disabled(): 128, pid: 3447, name: make +| 1 lock held by make/3447: +| #0: 000000009a966332 (&mm->mmap_sem){++++}, at: do_page_fault+0x140/0x4f8 +| Preemption disabled at: +| [] rt_mutex_futex_unlock+0x4c/0xb0 +| CPU: 3 PID: 3447 Comm: make Tainted: G W 5.2.14-rt7-01890-ge6e057589653 #911 +| Call trace: +| dump_backtrace+0x0/0x148 +| show_stack+0x14/0x20 +| dump_stack+0xbc/0x104 +| ___might_sleep+0x154/0x210 +| rt_spin_lock+0x68/0xa0 +| ubsan_prologue+0x30/0x68 +| handle_overflow+0x64/0xe0 +| __ubsan_handle_add_overflow+0x10/0x18 +| __lock_acquire+0x1c28/0x2a28 +| lock_acquire+0xf0/0x370 +| _raw_spin_lock_irqsave+0x58/0x78 +| rt_mutex_futex_unlock+0x4c/0xb0 +| rt_spin_unlock+0x28/0x70 +| get_page_from_freelist+0x428/0x2b60 +| __alloc_pages_nodemask+0x174/0x1708 +| alloc_pages_vma+0x1ac/0x238 +| __handle_mm_fault+0x4ac/0x10b0 +| handle_mm_fault+0x1d8/0x3b0 +| do_page_fault+0x1c8/0x4f8 +| do_translation_fault+0xb8/0xe0 +| do_mem_abort+0x3c/0x98 +| el0_da+0x20/0x24 + +The spin_lock() will protect against multiple CPUs to output a report +together, I guess to prevent them to be interleaved. However, they can +still interleave with other messages (and even splat from __migth_sleep). + +So the lock usefulness seems pretty limited. Rather than trying to +accomodate RT-system by switching to a raw_spin_lock(), the lock is now +completely dropped. + +Link: https://lkml.kernel.org/r/20190920100835.14999-1-julien.grall@arm.com +Reported-by: Andre Przywara +Signed-off-by: Julien Grall +Acked-by: Andrey Ryabinin +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + lib/ubsan.c | 64 +++++++++++++++++++---------------------------------- + 1 file changed, 23 insertions(+), 41 deletions(-) + +diff --git a/lib/ubsan.c b/lib/ubsan.c +index 1e9e2ab25539..5830cc9a2164 100644 +--- a/lib/ubsan.c ++++ b/lib/ubsan.c +@@ -143,25 +143,21 @@ static void val_to_string(char *str, size_t size, struct type_descriptor *type, + } + } + +-static DEFINE_SPINLOCK(report_lock); +- +-static void ubsan_prologue(struct source_location *location, +- unsigned long *flags) ++static void ubsan_prologue(struct source_location *location) + { + current->in_ubsan++; +- spin_lock_irqsave(&report_lock, *flags); + + pr_err("========================================" + "========================================\n"); + print_source_location("UBSAN: Undefined behaviour in", location); + } + +-static void ubsan_epilogue(unsigned long *flags) ++static void ubsan_epilogue(void) + { + dump_stack(); + pr_err("========================================" + "========================================\n"); +- spin_unlock_irqrestore(&report_lock, *flags); ++ + current->in_ubsan--; + } + +@@ -170,14 +166,13 @@ static void handle_overflow(struct overflow_data *data, void *lhs, + { + + struct type_descriptor *type = data->type; +- unsigned long flags; + char lhs_val_str[VALUE_LENGTH]; + char rhs_val_str[VALUE_LENGTH]; + + if (suppress_report(&data->location)) + return; + +- ubsan_prologue(&data->location, &flags); ++ ubsan_prologue(&data->location); + + val_to_string(lhs_val_str, sizeof(lhs_val_str), type, lhs); + val_to_string(rhs_val_str, sizeof(rhs_val_str), type, rhs); +@@ -189,7 +184,7 @@ static void handle_overflow(struct overflow_data *data, void *lhs, + rhs_val_str, + type->type_name); + +- ubsan_epilogue(&flags); ++ ubsan_epilogue(); + } + + void __ubsan_handle_add_overflow(struct overflow_data *data, +@@ -217,20 +212,19 @@ EXPORT_SYMBOL(__ubsan_handle_mul_overflow); + void __ubsan_handle_negate_overflow(struct overflow_data *data, + void *old_val) + { +- unsigned long flags; + char old_val_str[VALUE_LENGTH]; + + if (suppress_report(&data->location)) + return; + +- ubsan_prologue(&data->location, &flags); ++ ubsan_prologue(&data->location); + + val_to_string(old_val_str, sizeof(old_val_str), data->type, old_val); + + pr_err("negation of %s cannot be represented in type %s:\n", + old_val_str, data->type->type_name); + +- ubsan_epilogue(&flags); ++ ubsan_epilogue(); + } + EXPORT_SYMBOL(__ubsan_handle_negate_overflow); + +@@ -238,13 +232,12 @@ EXPORT_SYMBOL(__ubsan_handle_negate_overflow); + void __ubsan_handle_divrem_overflow(struct overflow_data *data, + void *lhs, void *rhs) + { +- unsigned long flags; + char rhs_val_str[VALUE_LENGTH]; + + if (suppress_report(&data->location)) + return; + +- ubsan_prologue(&data->location, &flags); ++ ubsan_prologue(&data->location); + + val_to_string(rhs_val_str, sizeof(rhs_val_str), data->type, rhs); + +@@ -254,58 +247,52 @@ void __ubsan_handle_divrem_overflow(struct overflow_data *data, + else + pr_err("division by zero\n"); + +- ubsan_epilogue(&flags); ++ ubsan_epilogue(); + } + EXPORT_SYMBOL(__ubsan_handle_divrem_overflow); + + static void handle_null_ptr_deref(struct type_mismatch_data_common *data) + { +- unsigned long flags; +- + if (suppress_report(data->location)) + return; + +- ubsan_prologue(data->location, &flags); ++ ubsan_prologue(data->location); + + pr_err("%s null pointer of type %s\n", + type_check_kinds[data->type_check_kind], + data->type->type_name); + +- ubsan_epilogue(&flags); ++ ubsan_epilogue(); + } + + static void handle_misaligned_access(struct type_mismatch_data_common *data, + unsigned long ptr) + { +- unsigned long flags; +- + if (suppress_report(data->location)) + return; + +- ubsan_prologue(data->location, &flags); ++ ubsan_prologue(data->location); + + pr_err("%s misaligned address %p for type %s\n", + type_check_kinds[data->type_check_kind], + (void *)ptr, data->type->type_name); + pr_err("which requires %ld byte alignment\n", data->alignment); + +- ubsan_epilogue(&flags); ++ ubsan_epilogue(); + } + + static void handle_object_size_mismatch(struct type_mismatch_data_common *data, + unsigned long ptr) + { +- unsigned long flags; +- + if (suppress_report(data->location)) + return; + +- ubsan_prologue(data->location, &flags); ++ ubsan_prologue(data->location); + pr_err("%s address %p with insufficient space\n", + type_check_kinds[data->type_check_kind], + (void *) ptr); + pr_err("for an object of type %s\n", data->type->type_name); +- ubsan_epilogue(&flags); ++ ubsan_epilogue(); + } + + static void ubsan_type_mismatch_common(struct type_mismatch_data_common *data, +@@ -369,25 +356,23 @@ EXPORT_SYMBOL(__ubsan_handle_vla_bound_not_positive); + + void __ubsan_handle_out_of_bounds(struct out_of_bounds_data *data, void *index) + { +- unsigned long flags; + char index_str[VALUE_LENGTH]; + + if (suppress_report(&data->location)) + return; + +- ubsan_prologue(&data->location, &flags); ++ ubsan_prologue(&data->location); + + val_to_string(index_str, sizeof(index_str), data->index_type, index); + pr_err("index %s is out of range for type %s\n", index_str, + data->array_type->type_name); +- ubsan_epilogue(&flags); ++ ubsan_epilogue(); + } + EXPORT_SYMBOL(__ubsan_handle_out_of_bounds); + + void __ubsan_handle_shift_out_of_bounds(struct shift_out_of_bounds_data *data, + void *lhs, void *rhs) + { +- unsigned long flags; + struct type_descriptor *rhs_type = data->rhs_type; + struct type_descriptor *lhs_type = data->lhs_type; + char rhs_str[VALUE_LENGTH]; +@@ -396,7 +381,7 @@ void __ubsan_handle_shift_out_of_bounds(struct shift_out_of_bounds_data *data, + if (suppress_report(&data->location)) + return; + +- ubsan_prologue(&data->location, &flags); ++ ubsan_prologue(&data->location); + + val_to_string(rhs_str, sizeof(rhs_str), rhs_type, rhs); + val_to_string(lhs_str, sizeof(lhs_str), lhs_type, lhs); +@@ -419,18 +404,16 @@ void __ubsan_handle_shift_out_of_bounds(struct shift_out_of_bounds_data *data, + lhs_str, rhs_str, + lhs_type->type_name); + +- ubsan_epilogue(&flags); ++ ubsan_epilogue(); + } + EXPORT_SYMBOL(__ubsan_handle_shift_out_of_bounds); + + + void __ubsan_handle_builtin_unreachable(struct unreachable_data *data) + { +- unsigned long flags; +- +- ubsan_prologue(&data->location, &flags); ++ ubsan_prologue(&data->location); + pr_err("calling __builtin_unreachable()\n"); +- ubsan_epilogue(&flags); ++ ubsan_epilogue(); + panic("can't return from __builtin_unreachable()"); + } + EXPORT_SYMBOL(__ubsan_handle_builtin_unreachable); +@@ -438,19 +421,18 @@ EXPORT_SYMBOL(__ubsan_handle_builtin_unreachable); + void __ubsan_handle_load_invalid_value(struct invalid_value_data *data, + void *val) + { +- unsigned long flags; + char val_str[VALUE_LENGTH]; + + if (suppress_report(&data->location)) + return; + +- ubsan_prologue(&data->location, &flags); ++ ubsan_prologue(&data->location); + + val_to_string(val_str, sizeof(val_str), data->type, val); + + pr_err("load of value %s is not a valid value for type %s\n", + val_str, data->type->type_name); + +- ubsan_epilogue(&flags); ++ ubsan_epilogue(); + } + EXPORT_SYMBOL(__ubsan_handle_load_invalid_value); diff --git a/debian/patches-rt/0304-locking-rtmutex-Clean-pi_blocked_on-in-the-error-cas.patch b/debian/patches-rt/0304-locking-rtmutex-Clean-pi_blocked_on-in-the-error-cas.patch deleted file mode 100644 index 86fb4bb50..000000000 --- a/debian/patches-rt/0304-locking-rtmutex-Clean-pi_blocked_on-in-the-error-cas.patch +++ /dev/null @@ -1,102 +0,0 @@ -From 91bba7aa7f53d991fab4b00ba2bb333dc25dd2ee Mon Sep 17 00:00:00 2001 -From: Peter Zijlstra -Date: Mon, 30 Sep 2019 18:15:44 +0200 -Subject: [PATCH 304/347] locking/rtmutex: Clean ->pi_blocked_on in the error - case -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 0be4ea6e3ce693101be0fbd55a0cc7ce238ab2eb ] - -The function rt_mutex_wait_proxy_lock() cleans ->pi_blocked_on in case -of failure (timeout, signal). The same cleanup is required in -__rt_mutex_start_proxy_lock(). -In both the cases the tasks was interrupted by a signal or timeout while -acquiring the lock and after the interruption it longer blocks on the -lock. - -Fixes: 1a1fb985f2e2b ("futex: Handle early deadlock return correctly") -Signed-off-by: Peter Zijlstra (Intel) -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - kernel/locking/rtmutex.c | 43 +++++++++++++++++++++++----------------- - 1 file changed, 25 insertions(+), 18 deletions(-) - -diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c -index ded2296f848a..dc95a81ae3a6 100644 ---- a/kernel/locking/rtmutex.c -+++ b/kernel/locking/rtmutex.c -@@ -2319,6 +2319,26 @@ void rt_mutex_proxy_unlock(struct rt_mutex *lock) - rt_mutex_set_owner(lock, NULL); - } - -+static void fixup_rt_mutex_blocked(struct rt_mutex *lock) -+{ -+ struct task_struct *tsk = current; -+ /* -+ * RT has a problem here when the wait got interrupted by a timeout -+ * or a signal. task->pi_blocked_on is still set. The task must -+ * acquire the hash bucket lock when returning from this function. -+ * -+ * If the hash bucket lock is contended then the -+ * BUG_ON(rt_mutex_real_waiter(task->pi_blocked_on)) in -+ * task_blocks_on_rt_mutex() will trigger. This can be avoided by -+ * clearing task->pi_blocked_on which removes the task from the -+ * boosting chain of the rtmutex. That's correct because the task -+ * is not longer blocked on it. -+ */ -+ raw_spin_lock(&tsk->pi_lock); -+ tsk->pi_blocked_on = NULL; -+ raw_spin_unlock(&tsk->pi_lock); -+} -+ - /** - * __rt_mutex_start_proxy_lock() - Start lock acquisition for another task - * @lock: the rt_mutex to take -@@ -2391,6 +2411,9 @@ int __rt_mutex_start_proxy_lock(struct rt_mutex *lock, - ret = 0; - } - -+ if (ret) -+ fixup_rt_mutex_blocked(lock); -+ - debug_rt_mutex_print_deadlock(waiter); - - return ret; -@@ -2471,7 +2494,6 @@ int rt_mutex_wait_proxy_lock(struct rt_mutex *lock, - struct hrtimer_sleeper *to, - struct rt_mutex_waiter *waiter) - { -- struct task_struct *tsk = current; - int ret; - - raw_spin_lock_irq(&lock->wait_lock); -@@ -2483,23 +2505,8 @@ int rt_mutex_wait_proxy_lock(struct rt_mutex *lock, - * have to fix that up. - */ - fixup_rt_mutex_waiters(lock); -- /* -- * RT has a problem here when the wait got interrupted by a timeout -- * or a signal. task->pi_blocked_on is still set. The task must -- * acquire the hash bucket lock when returning from this function. -- * -- * If the hash bucket lock is contended then the -- * BUG_ON(rt_mutex_real_waiter(task->pi_blocked_on)) in -- * task_blocks_on_rt_mutex() will trigger. This can be avoided by -- * clearing task->pi_blocked_on which removes the task from the -- * boosting chain of the rtmutex. That's correct because the task -- * is not longer blocked on it. -- */ -- if (ret) { -- raw_spin_lock(&tsk->pi_lock); -- tsk->pi_blocked_on = NULL; -- raw_spin_unlock(&tsk->pi_lock); -- } -+ if (ret) -+ fixup_rt_mutex_blocked(lock); - - raw_spin_unlock_irq(&lock->wait_lock); - --- -2.36.1 - diff --git a/debian/patches-rt/0305-kmemleak-Change-the-lock-of-kmemleak_object-to-raw_s.patch b/debian/patches-rt/0305-kmemleak-Change-the-lock-of-kmemleak_object-to-raw_s.patch new file mode 100644 index 000000000..81533bee0 --- /dev/null +++ b/debian/patches-rt/0305-kmemleak-Change-the-lock-of-kmemleak_object-to-raw_s.patch @@ -0,0 +1,289 @@ +From: Liu Haitao +Date: Fri, 27 Sep 2019 16:22:30 +0800 +Subject: [PATCH 305/342] kmemleak: Change the lock of kmemleak_object to + raw_spinlock_t +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=6b143bcf21b5a432f5fd03c79ff17188dfb00790 + +[ Upstream commit 217847f57119b5fdd377bfa3d344613ddb98d9fc ] + +The commit ("kmemleak: Turn kmemleak_lock to raw spinlock on RT") +changed the kmemleak_lock to raw spinlock. However the +kmemleak_object->lock is held after the kmemleak_lock is held in +scan_block(). + +Make the object->lock a raw_spinlock_t. + +Cc: stable-rt@vger.kernel.org +Link: https://lkml.kernel.org/r/20190927082230.34152-1-yongxin.liu@windriver.com +Signed-off-by: Liu Haitao +Signed-off-by: Yongxin Liu +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + mm/kmemleak.c | 72 +++++++++++++++++++++++++-------------------------- + 1 file changed, 36 insertions(+), 36 deletions(-) + +diff --git a/mm/kmemleak.c b/mm/kmemleak.c +index 5b6718dd3a64..23e2837501d6 100644 +--- a/mm/kmemleak.c ++++ b/mm/kmemleak.c +@@ -147,7 +147,7 @@ struct kmemleak_scan_area { + * (use_count) and freed using the RCU mechanism. + */ + struct kmemleak_object { +- spinlock_t lock; ++ raw_spinlock_t lock; + unsigned int flags; /* object status flags */ + struct list_head object_list; + struct list_head gray_list; +@@ -561,7 +561,7 @@ static struct kmemleak_object *create_object(unsigned long ptr, size_t size, + INIT_LIST_HEAD(&object->object_list); + INIT_LIST_HEAD(&object->gray_list); + INIT_HLIST_HEAD(&object->area_list); +- spin_lock_init(&object->lock); ++ raw_spin_lock_init(&object->lock); + atomic_set(&object->use_count, 1); + object->flags = OBJECT_ALLOCATED; + object->pointer = ptr; +@@ -642,9 +642,9 @@ static void __delete_object(struct kmemleak_object *object) + * Locking here also ensures that the corresponding memory block + * cannot be freed when it is being scanned. + */ +- spin_lock_irqsave(&object->lock, flags); ++ raw_spin_lock_irqsave(&object->lock, flags); + object->flags &= ~OBJECT_ALLOCATED; +- spin_unlock_irqrestore(&object->lock, flags); ++ raw_spin_unlock_irqrestore(&object->lock, flags); + put_object(object); + } + +@@ -716,9 +716,9 @@ static void paint_it(struct kmemleak_object *object, int color) + { + unsigned long flags; + +- spin_lock_irqsave(&object->lock, flags); ++ raw_spin_lock_irqsave(&object->lock, flags); + __paint_it(object, color); +- spin_unlock_irqrestore(&object->lock, flags); ++ raw_spin_unlock_irqrestore(&object->lock, flags); + } + + static void paint_ptr(unsigned long ptr, int color) +@@ -778,7 +778,7 @@ static void add_scan_area(unsigned long ptr, size_t size, gfp_t gfp) + goto out; + } + +- spin_lock_irqsave(&object->lock, flags); ++ raw_spin_lock_irqsave(&object->lock, flags); + if (size == SIZE_MAX) { + size = object->pointer + object->size - ptr; + } else if (ptr + size > object->pointer + object->size) { +@@ -794,7 +794,7 @@ static void add_scan_area(unsigned long ptr, size_t size, gfp_t gfp) + + hlist_add_head(&area->node, &object->area_list); + out_unlock: +- spin_unlock_irqrestore(&object->lock, flags); ++ raw_spin_unlock_irqrestore(&object->lock, flags); + out: + put_object(object); + } +@@ -817,9 +817,9 @@ static void object_set_excess_ref(unsigned long ptr, unsigned long excess_ref) + return; + } + +- spin_lock_irqsave(&object->lock, flags); ++ raw_spin_lock_irqsave(&object->lock, flags); + object->excess_ref = excess_ref; +- spin_unlock_irqrestore(&object->lock, flags); ++ raw_spin_unlock_irqrestore(&object->lock, flags); + put_object(object); + } + +@@ -839,9 +839,9 @@ static void object_no_scan(unsigned long ptr) + return; + } + +- spin_lock_irqsave(&object->lock, flags); ++ raw_spin_lock_irqsave(&object->lock, flags); + object->flags |= OBJECT_NO_SCAN; +- spin_unlock_irqrestore(&object->lock, flags); ++ raw_spin_unlock_irqrestore(&object->lock, flags); + put_object(object); + } + +@@ -902,11 +902,11 @@ static void early_alloc(struct early_log *log) + log->min_count, GFP_ATOMIC); + if (!object) + goto out; +- spin_lock_irqsave(&object->lock, flags); ++ raw_spin_lock_irqsave(&object->lock, flags); + for (i = 0; i < log->trace_len; i++) + object->trace[i] = log->trace[i]; + object->trace_len = log->trace_len; +- spin_unlock_irqrestore(&object->lock, flags); ++ raw_spin_unlock_irqrestore(&object->lock, flags); + out: + rcu_read_unlock(); + } +@@ -1096,9 +1096,9 @@ void __ref kmemleak_update_trace(const void *ptr) + return; + } + +- spin_lock_irqsave(&object->lock, flags); ++ raw_spin_lock_irqsave(&object->lock, flags); + object->trace_len = __save_stack_trace(object->trace); +- spin_unlock_irqrestore(&object->lock, flags); ++ raw_spin_unlock_irqrestore(&object->lock, flags); + + put_object(object); + } +@@ -1344,7 +1344,7 @@ static void scan_block(void *_start, void *_end, + * previously acquired in scan_object(). These locks are + * enclosed by scan_mutex. + */ +- spin_lock_nested(&object->lock, SINGLE_DEPTH_NESTING); ++ raw_spin_lock_nested(&object->lock, SINGLE_DEPTH_NESTING); + /* only pass surplus references (object already gray) */ + if (color_gray(object)) { + excess_ref = object->excess_ref; +@@ -1353,7 +1353,7 @@ static void scan_block(void *_start, void *_end, + excess_ref = 0; + update_refs(object); + } +- spin_unlock(&object->lock); ++ raw_spin_unlock(&object->lock); + + if (excess_ref) { + object = lookup_object(excess_ref, 0); +@@ -1362,9 +1362,9 @@ static void scan_block(void *_start, void *_end, + if (object == scanned) + /* circular reference, ignore */ + continue; +- spin_lock_nested(&object->lock, SINGLE_DEPTH_NESTING); ++ raw_spin_lock_nested(&object->lock, SINGLE_DEPTH_NESTING); + update_refs(object); +- spin_unlock(&object->lock); ++ raw_spin_unlock(&object->lock); + } + } + raw_spin_unlock_irqrestore(&kmemleak_lock, flags); +@@ -1400,7 +1400,7 @@ static void scan_object(struct kmemleak_object *object) + * Once the object->lock is acquired, the corresponding memory block + * cannot be freed (the same lock is acquired in delete_object). + */ +- spin_lock_irqsave(&object->lock, flags); ++ raw_spin_lock_irqsave(&object->lock, flags); + if (object->flags & OBJECT_NO_SCAN) + goto out; + if (!(object->flags & OBJECT_ALLOCATED)) +@@ -1419,9 +1419,9 @@ static void scan_object(struct kmemleak_object *object) + if (start >= end) + break; + +- spin_unlock_irqrestore(&object->lock, flags); ++ raw_spin_unlock_irqrestore(&object->lock, flags); + cond_resched(); +- spin_lock_irqsave(&object->lock, flags); ++ raw_spin_lock_irqsave(&object->lock, flags); + } while (object->flags & OBJECT_ALLOCATED); + } else + hlist_for_each_entry(area, &object->area_list, node) +@@ -1429,7 +1429,7 @@ static void scan_object(struct kmemleak_object *object) + (void *)(area->start + area->size), + object); + out: +- spin_unlock_irqrestore(&object->lock, flags); ++ raw_spin_unlock_irqrestore(&object->lock, flags); + } + + /* +@@ -1482,7 +1482,7 @@ static void kmemleak_scan(void) + /* prepare the kmemleak_object's */ + rcu_read_lock(); + list_for_each_entry_rcu(object, &object_list, object_list) { +- spin_lock_irqsave(&object->lock, flags); ++ raw_spin_lock_irqsave(&object->lock, flags); + #ifdef DEBUG + /* + * With a few exceptions there should be a maximum of +@@ -1499,7 +1499,7 @@ static void kmemleak_scan(void) + if (color_gray(object) && get_object(object)) + list_add_tail(&object->gray_list, &gray_list); + +- spin_unlock_irqrestore(&object->lock, flags); ++ raw_spin_unlock_irqrestore(&object->lock, flags); + } + rcu_read_unlock(); + +@@ -1564,14 +1564,14 @@ static void kmemleak_scan(void) + */ + rcu_read_lock(); + list_for_each_entry_rcu(object, &object_list, object_list) { +- spin_lock_irqsave(&object->lock, flags); ++ raw_spin_lock_irqsave(&object->lock, flags); + if (color_white(object) && (object->flags & OBJECT_ALLOCATED) + && update_checksum(object) && get_object(object)) { + /* color it gray temporarily */ + object->count = object->min_count; + list_add_tail(&object->gray_list, &gray_list); + } +- spin_unlock_irqrestore(&object->lock, flags); ++ raw_spin_unlock_irqrestore(&object->lock, flags); + } + rcu_read_unlock(); + +@@ -1591,13 +1591,13 @@ static void kmemleak_scan(void) + */ + rcu_read_lock(); + list_for_each_entry_rcu(object, &object_list, object_list) { +- spin_lock_irqsave(&object->lock, flags); ++ raw_spin_lock_irqsave(&object->lock, flags); + if (unreferenced_object(object) && + !(object->flags & OBJECT_REPORTED)) { + object->flags |= OBJECT_REPORTED; + new_leaks++; + } +- spin_unlock_irqrestore(&object->lock, flags); ++ raw_spin_unlock_irqrestore(&object->lock, flags); + } + rcu_read_unlock(); + +@@ -1749,10 +1749,10 @@ static int kmemleak_seq_show(struct seq_file *seq, void *v) + struct kmemleak_object *object = v; + unsigned long flags; + +- spin_lock_irqsave(&object->lock, flags); ++ raw_spin_lock_irqsave(&object->lock, flags); + if ((object->flags & OBJECT_REPORTED) && unreferenced_object(object)) + print_unreferenced(seq, object); +- spin_unlock_irqrestore(&object->lock, flags); ++ raw_spin_unlock_irqrestore(&object->lock, flags); + return 0; + } + +@@ -1782,9 +1782,9 @@ static int dump_str_object_info(const char *str) + return -EINVAL; + } + +- spin_lock_irqsave(&object->lock, flags); ++ raw_spin_lock_irqsave(&object->lock, flags); + dump_object_info(object); +- spin_unlock_irqrestore(&object->lock, flags); ++ raw_spin_unlock_irqrestore(&object->lock, flags); + + put_object(object); + return 0; +@@ -1803,11 +1803,11 @@ static void kmemleak_clear(void) + + rcu_read_lock(); + list_for_each_entry_rcu(object, &object_list, object_list) { +- spin_lock_irqsave(&object->lock, flags); ++ raw_spin_lock_irqsave(&object->lock, flags); + if ((object->flags & OBJECT_REPORTED) && + unreferenced_object(object)) + __paint_it(object, KMEMLEAK_GREY); +- spin_unlock_irqrestore(&object->lock, flags); ++ raw_spin_unlock_irqrestore(&object->lock, flags); + } + rcu_read_unlock(); + diff --git a/debian/patches-rt/0305-lib-ubsan-Don-t-seralize-UBSAN-report.patch b/debian/patches-rt/0305-lib-ubsan-Don-t-seralize-UBSAN-report.patch deleted file mode 100644 index 0d8dba5e3..000000000 --- a/debian/patches-rt/0305-lib-ubsan-Don-t-seralize-UBSAN-report.patch +++ /dev/null @@ -1,308 +0,0 @@ -From 7310d776df7bc46b442c51d6b723b77ef6614830 Mon Sep 17 00:00:00 2001 -From: Julien Grall -Date: Fri, 20 Sep 2019 11:08:35 +0100 -Subject: [PATCH 305/347] lib/ubsan: Don't seralize UBSAN report -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 4702c28ac777b27acb499cbd5e8e787ce1a7d82d ] - -At the moment, UBSAN report will be serialized using a spin_lock(). On -RT-systems, spinlocks are turned to rt_spin_lock and may sleep. This will -result to the following splat if the undefined behavior is in a context -that can sleep: - -| BUG: sleeping function called from invalid context at /src/linux/kernel/locking/rtmutex.c:968 -| in_atomic(): 1, irqs_disabled(): 128, pid: 3447, name: make -| 1 lock held by make/3447: -| #0: 000000009a966332 (&mm->mmap_sem){++++}, at: do_page_fault+0x140/0x4f8 -| Preemption disabled at: -| [] rt_mutex_futex_unlock+0x4c/0xb0 -| CPU: 3 PID: 3447 Comm: make Tainted: G W 5.2.14-rt7-01890-ge6e057589653 #911 -| Call trace: -| dump_backtrace+0x0/0x148 -| show_stack+0x14/0x20 -| dump_stack+0xbc/0x104 -| ___might_sleep+0x154/0x210 -| rt_spin_lock+0x68/0xa0 -| ubsan_prologue+0x30/0x68 -| handle_overflow+0x64/0xe0 -| __ubsan_handle_add_overflow+0x10/0x18 -| __lock_acquire+0x1c28/0x2a28 -| lock_acquire+0xf0/0x370 -| _raw_spin_lock_irqsave+0x58/0x78 -| rt_mutex_futex_unlock+0x4c/0xb0 -| rt_spin_unlock+0x28/0x70 -| get_page_from_freelist+0x428/0x2b60 -| __alloc_pages_nodemask+0x174/0x1708 -| alloc_pages_vma+0x1ac/0x238 -| __handle_mm_fault+0x4ac/0x10b0 -| handle_mm_fault+0x1d8/0x3b0 -| do_page_fault+0x1c8/0x4f8 -| do_translation_fault+0xb8/0xe0 -| do_mem_abort+0x3c/0x98 -| el0_da+0x20/0x24 - -The spin_lock() will protect against multiple CPUs to output a report -together, I guess to prevent them to be interleaved. However, they can -still interleave with other messages (and even splat from __migth_sleep). - -So the lock usefulness seems pretty limited. Rather than trying to -accomodate RT-system by switching to a raw_spin_lock(), the lock is now -completely dropped. - -Link: https://lkml.kernel.org/r/20190920100835.14999-1-julien.grall@arm.com -Reported-by: Andre Przywara -Signed-off-by: Julien Grall -Acked-by: Andrey Ryabinin -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - lib/ubsan.c | 64 +++++++++++++++++++---------------------------------- - 1 file changed, 23 insertions(+), 41 deletions(-) - -diff --git a/lib/ubsan.c b/lib/ubsan.c -index 1e9e2ab25539..5830cc9a2164 100644 ---- a/lib/ubsan.c -+++ b/lib/ubsan.c -@@ -143,25 +143,21 @@ static void val_to_string(char *str, size_t size, struct type_descriptor *type, - } - } - --static DEFINE_SPINLOCK(report_lock); -- --static void ubsan_prologue(struct source_location *location, -- unsigned long *flags) -+static void ubsan_prologue(struct source_location *location) - { - current->in_ubsan++; -- spin_lock_irqsave(&report_lock, *flags); - - pr_err("========================================" - "========================================\n"); - print_source_location("UBSAN: Undefined behaviour in", location); - } - --static void ubsan_epilogue(unsigned long *flags) -+static void ubsan_epilogue(void) - { - dump_stack(); - pr_err("========================================" - "========================================\n"); -- spin_unlock_irqrestore(&report_lock, *flags); -+ - current->in_ubsan--; - } - -@@ -170,14 +166,13 @@ static void handle_overflow(struct overflow_data *data, void *lhs, - { - - struct type_descriptor *type = data->type; -- unsigned long flags; - char lhs_val_str[VALUE_LENGTH]; - char rhs_val_str[VALUE_LENGTH]; - - if (suppress_report(&data->location)) - return; - -- ubsan_prologue(&data->location, &flags); -+ ubsan_prologue(&data->location); - - val_to_string(lhs_val_str, sizeof(lhs_val_str), type, lhs); - val_to_string(rhs_val_str, sizeof(rhs_val_str), type, rhs); -@@ -189,7 +184,7 @@ static void handle_overflow(struct overflow_data *data, void *lhs, - rhs_val_str, - type->type_name); - -- ubsan_epilogue(&flags); -+ ubsan_epilogue(); - } - - void __ubsan_handle_add_overflow(struct overflow_data *data, -@@ -217,20 +212,19 @@ EXPORT_SYMBOL(__ubsan_handle_mul_overflow); - void __ubsan_handle_negate_overflow(struct overflow_data *data, - void *old_val) - { -- unsigned long flags; - char old_val_str[VALUE_LENGTH]; - - if (suppress_report(&data->location)) - return; - -- ubsan_prologue(&data->location, &flags); -+ ubsan_prologue(&data->location); - - val_to_string(old_val_str, sizeof(old_val_str), data->type, old_val); - - pr_err("negation of %s cannot be represented in type %s:\n", - old_val_str, data->type->type_name); - -- ubsan_epilogue(&flags); -+ ubsan_epilogue(); - } - EXPORT_SYMBOL(__ubsan_handle_negate_overflow); - -@@ -238,13 +232,12 @@ EXPORT_SYMBOL(__ubsan_handle_negate_overflow); - void __ubsan_handle_divrem_overflow(struct overflow_data *data, - void *lhs, void *rhs) - { -- unsigned long flags; - char rhs_val_str[VALUE_LENGTH]; - - if (suppress_report(&data->location)) - return; - -- ubsan_prologue(&data->location, &flags); -+ ubsan_prologue(&data->location); - - val_to_string(rhs_val_str, sizeof(rhs_val_str), data->type, rhs); - -@@ -254,58 +247,52 @@ void __ubsan_handle_divrem_overflow(struct overflow_data *data, - else - pr_err("division by zero\n"); - -- ubsan_epilogue(&flags); -+ ubsan_epilogue(); - } - EXPORT_SYMBOL(__ubsan_handle_divrem_overflow); - - static void handle_null_ptr_deref(struct type_mismatch_data_common *data) - { -- unsigned long flags; -- - if (suppress_report(data->location)) - return; - -- ubsan_prologue(data->location, &flags); -+ ubsan_prologue(data->location); - - pr_err("%s null pointer of type %s\n", - type_check_kinds[data->type_check_kind], - data->type->type_name); - -- ubsan_epilogue(&flags); -+ ubsan_epilogue(); - } - - static void handle_misaligned_access(struct type_mismatch_data_common *data, - unsigned long ptr) - { -- unsigned long flags; -- - if (suppress_report(data->location)) - return; - -- ubsan_prologue(data->location, &flags); -+ ubsan_prologue(data->location); - - pr_err("%s misaligned address %p for type %s\n", - type_check_kinds[data->type_check_kind], - (void *)ptr, data->type->type_name); - pr_err("which requires %ld byte alignment\n", data->alignment); - -- ubsan_epilogue(&flags); -+ ubsan_epilogue(); - } - - static void handle_object_size_mismatch(struct type_mismatch_data_common *data, - unsigned long ptr) - { -- unsigned long flags; -- - if (suppress_report(data->location)) - return; - -- ubsan_prologue(data->location, &flags); -+ ubsan_prologue(data->location); - pr_err("%s address %p with insufficient space\n", - type_check_kinds[data->type_check_kind], - (void *) ptr); - pr_err("for an object of type %s\n", data->type->type_name); -- ubsan_epilogue(&flags); -+ ubsan_epilogue(); - } - - static void ubsan_type_mismatch_common(struct type_mismatch_data_common *data, -@@ -369,25 +356,23 @@ EXPORT_SYMBOL(__ubsan_handle_vla_bound_not_positive); - - void __ubsan_handle_out_of_bounds(struct out_of_bounds_data *data, void *index) - { -- unsigned long flags; - char index_str[VALUE_LENGTH]; - - if (suppress_report(&data->location)) - return; - -- ubsan_prologue(&data->location, &flags); -+ ubsan_prologue(&data->location); - - val_to_string(index_str, sizeof(index_str), data->index_type, index); - pr_err("index %s is out of range for type %s\n", index_str, - data->array_type->type_name); -- ubsan_epilogue(&flags); -+ ubsan_epilogue(); - } - EXPORT_SYMBOL(__ubsan_handle_out_of_bounds); - - void __ubsan_handle_shift_out_of_bounds(struct shift_out_of_bounds_data *data, - void *lhs, void *rhs) - { -- unsigned long flags; - struct type_descriptor *rhs_type = data->rhs_type; - struct type_descriptor *lhs_type = data->lhs_type; - char rhs_str[VALUE_LENGTH]; -@@ -396,7 +381,7 @@ void __ubsan_handle_shift_out_of_bounds(struct shift_out_of_bounds_data *data, - if (suppress_report(&data->location)) - return; - -- ubsan_prologue(&data->location, &flags); -+ ubsan_prologue(&data->location); - - val_to_string(rhs_str, sizeof(rhs_str), rhs_type, rhs); - val_to_string(lhs_str, sizeof(lhs_str), lhs_type, lhs); -@@ -419,18 +404,16 @@ void __ubsan_handle_shift_out_of_bounds(struct shift_out_of_bounds_data *data, - lhs_str, rhs_str, - lhs_type->type_name); - -- ubsan_epilogue(&flags); -+ ubsan_epilogue(); - } - EXPORT_SYMBOL(__ubsan_handle_shift_out_of_bounds); - - - void __ubsan_handle_builtin_unreachable(struct unreachable_data *data) - { -- unsigned long flags; -- -- ubsan_prologue(&data->location, &flags); -+ ubsan_prologue(&data->location); - pr_err("calling __builtin_unreachable()\n"); -- ubsan_epilogue(&flags); -+ ubsan_epilogue(); - panic("can't return from __builtin_unreachable()"); - } - EXPORT_SYMBOL(__ubsan_handle_builtin_unreachable); -@@ -438,19 +421,18 @@ EXPORT_SYMBOL(__ubsan_handle_builtin_unreachable); - void __ubsan_handle_load_invalid_value(struct invalid_value_data *data, - void *val) - { -- unsigned long flags; - char val_str[VALUE_LENGTH]; - - if (suppress_report(&data->location)) - return; - -- ubsan_prologue(&data->location, &flags); -+ ubsan_prologue(&data->location); - - val_to_string(val_str, sizeof(val_str), data->type, val); - - pr_err("load of value %s is not a valid value for type %s\n", - val_str, data->type->type_name); - -- ubsan_epilogue(&flags); -+ ubsan_epilogue(); - } - EXPORT_SYMBOL(__ubsan_handle_load_invalid_value); --- -2.36.1 - diff --git a/debian/patches-rt/0306-kmemleak-Change-the-lock-of-kmemleak_object-to-raw_s.patch b/debian/patches-rt/0306-kmemleak-Change-the-lock-of-kmemleak_object-to-raw_s.patch deleted file mode 100644 index ca08e2aca..000000000 --- a/debian/patches-rt/0306-kmemleak-Change-the-lock-of-kmemleak_object-to-raw_s.patch +++ /dev/null @@ -1,293 +0,0 @@ -From 3d72712c05917c06303670565d51a308334595d6 Mon Sep 17 00:00:00 2001 -From: Liu Haitao -Date: Fri, 27 Sep 2019 16:22:30 +0800 -Subject: [PATCH 306/347] kmemleak: Change the lock of kmemleak_object to - raw_spinlock_t -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 217847f57119b5fdd377bfa3d344613ddb98d9fc ] - -The commit ("kmemleak: Turn kmemleak_lock to raw spinlock on RT") -changed the kmemleak_lock to raw spinlock. However the -kmemleak_object->lock is held after the kmemleak_lock is held in -scan_block(). - -Make the object->lock a raw_spinlock_t. - -Cc: stable-rt@vger.kernel.org -Link: https://lkml.kernel.org/r/20190927082230.34152-1-yongxin.liu@windriver.com -Signed-off-by: Liu Haitao -Signed-off-by: Yongxin Liu -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - mm/kmemleak.c | 72 +++++++++++++++++++++++++-------------------------- - 1 file changed, 36 insertions(+), 36 deletions(-) - -diff --git a/mm/kmemleak.c b/mm/kmemleak.c -index 5b6718dd3a64..23e2837501d6 100644 ---- a/mm/kmemleak.c -+++ b/mm/kmemleak.c -@@ -147,7 +147,7 @@ struct kmemleak_scan_area { - * (use_count) and freed using the RCU mechanism. - */ - struct kmemleak_object { -- spinlock_t lock; -+ raw_spinlock_t lock; - unsigned int flags; /* object status flags */ - struct list_head object_list; - struct list_head gray_list; -@@ -561,7 +561,7 @@ static struct kmemleak_object *create_object(unsigned long ptr, size_t size, - INIT_LIST_HEAD(&object->object_list); - INIT_LIST_HEAD(&object->gray_list); - INIT_HLIST_HEAD(&object->area_list); -- spin_lock_init(&object->lock); -+ raw_spin_lock_init(&object->lock); - atomic_set(&object->use_count, 1); - object->flags = OBJECT_ALLOCATED; - object->pointer = ptr; -@@ -642,9 +642,9 @@ static void __delete_object(struct kmemleak_object *object) - * Locking here also ensures that the corresponding memory block - * cannot be freed when it is being scanned. - */ -- spin_lock_irqsave(&object->lock, flags); -+ raw_spin_lock_irqsave(&object->lock, flags); - object->flags &= ~OBJECT_ALLOCATED; -- spin_unlock_irqrestore(&object->lock, flags); -+ raw_spin_unlock_irqrestore(&object->lock, flags); - put_object(object); - } - -@@ -716,9 +716,9 @@ static void paint_it(struct kmemleak_object *object, int color) - { - unsigned long flags; - -- spin_lock_irqsave(&object->lock, flags); -+ raw_spin_lock_irqsave(&object->lock, flags); - __paint_it(object, color); -- spin_unlock_irqrestore(&object->lock, flags); -+ raw_spin_unlock_irqrestore(&object->lock, flags); - } - - static void paint_ptr(unsigned long ptr, int color) -@@ -778,7 +778,7 @@ static void add_scan_area(unsigned long ptr, size_t size, gfp_t gfp) - goto out; - } - -- spin_lock_irqsave(&object->lock, flags); -+ raw_spin_lock_irqsave(&object->lock, flags); - if (size == SIZE_MAX) { - size = object->pointer + object->size - ptr; - } else if (ptr + size > object->pointer + object->size) { -@@ -794,7 +794,7 @@ static void add_scan_area(unsigned long ptr, size_t size, gfp_t gfp) - - hlist_add_head(&area->node, &object->area_list); - out_unlock: -- spin_unlock_irqrestore(&object->lock, flags); -+ raw_spin_unlock_irqrestore(&object->lock, flags); - out: - put_object(object); - } -@@ -817,9 +817,9 @@ static void object_set_excess_ref(unsigned long ptr, unsigned long excess_ref) - return; - } - -- spin_lock_irqsave(&object->lock, flags); -+ raw_spin_lock_irqsave(&object->lock, flags); - object->excess_ref = excess_ref; -- spin_unlock_irqrestore(&object->lock, flags); -+ raw_spin_unlock_irqrestore(&object->lock, flags); - put_object(object); - } - -@@ -839,9 +839,9 @@ static void object_no_scan(unsigned long ptr) - return; - } - -- spin_lock_irqsave(&object->lock, flags); -+ raw_spin_lock_irqsave(&object->lock, flags); - object->flags |= OBJECT_NO_SCAN; -- spin_unlock_irqrestore(&object->lock, flags); -+ raw_spin_unlock_irqrestore(&object->lock, flags); - put_object(object); - } - -@@ -902,11 +902,11 @@ static void early_alloc(struct early_log *log) - log->min_count, GFP_ATOMIC); - if (!object) - goto out; -- spin_lock_irqsave(&object->lock, flags); -+ raw_spin_lock_irqsave(&object->lock, flags); - for (i = 0; i < log->trace_len; i++) - object->trace[i] = log->trace[i]; - object->trace_len = log->trace_len; -- spin_unlock_irqrestore(&object->lock, flags); -+ raw_spin_unlock_irqrestore(&object->lock, flags); - out: - rcu_read_unlock(); - } -@@ -1096,9 +1096,9 @@ void __ref kmemleak_update_trace(const void *ptr) - return; - } - -- spin_lock_irqsave(&object->lock, flags); -+ raw_spin_lock_irqsave(&object->lock, flags); - object->trace_len = __save_stack_trace(object->trace); -- spin_unlock_irqrestore(&object->lock, flags); -+ raw_spin_unlock_irqrestore(&object->lock, flags); - - put_object(object); - } -@@ -1344,7 +1344,7 @@ static void scan_block(void *_start, void *_end, - * previously acquired in scan_object(). These locks are - * enclosed by scan_mutex. - */ -- spin_lock_nested(&object->lock, SINGLE_DEPTH_NESTING); -+ raw_spin_lock_nested(&object->lock, SINGLE_DEPTH_NESTING); - /* only pass surplus references (object already gray) */ - if (color_gray(object)) { - excess_ref = object->excess_ref; -@@ -1353,7 +1353,7 @@ static void scan_block(void *_start, void *_end, - excess_ref = 0; - update_refs(object); - } -- spin_unlock(&object->lock); -+ raw_spin_unlock(&object->lock); - - if (excess_ref) { - object = lookup_object(excess_ref, 0); -@@ -1362,9 +1362,9 @@ static void scan_block(void *_start, void *_end, - if (object == scanned) - /* circular reference, ignore */ - continue; -- spin_lock_nested(&object->lock, SINGLE_DEPTH_NESTING); -+ raw_spin_lock_nested(&object->lock, SINGLE_DEPTH_NESTING); - update_refs(object); -- spin_unlock(&object->lock); -+ raw_spin_unlock(&object->lock); - } - } - raw_spin_unlock_irqrestore(&kmemleak_lock, flags); -@@ -1400,7 +1400,7 @@ static void scan_object(struct kmemleak_object *object) - * Once the object->lock is acquired, the corresponding memory block - * cannot be freed (the same lock is acquired in delete_object). - */ -- spin_lock_irqsave(&object->lock, flags); -+ raw_spin_lock_irqsave(&object->lock, flags); - if (object->flags & OBJECT_NO_SCAN) - goto out; - if (!(object->flags & OBJECT_ALLOCATED)) -@@ -1419,9 +1419,9 @@ static void scan_object(struct kmemleak_object *object) - if (start >= end) - break; - -- spin_unlock_irqrestore(&object->lock, flags); -+ raw_spin_unlock_irqrestore(&object->lock, flags); - cond_resched(); -- spin_lock_irqsave(&object->lock, flags); -+ raw_spin_lock_irqsave(&object->lock, flags); - } while (object->flags & OBJECT_ALLOCATED); - } else - hlist_for_each_entry(area, &object->area_list, node) -@@ -1429,7 +1429,7 @@ static void scan_object(struct kmemleak_object *object) - (void *)(area->start + area->size), - object); - out: -- spin_unlock_irqrestore(&object->lock, flags); -+ raw_spin_unlock_irqrestore(&object->lock, flags); - } - - /* -@@ -1482,7 +1482,7 @@ static void kmemleak_scan(void) - /* prepare the kmemleak_object's */ - rcu_read_lock(); - list_for_each_entry_rcu(object, &object_list, object_list) { -- spin_lock_irqsave(&object->lock, flags); -+ raw_spin_lock_irqsave(&object->lock, flags); - #ifdef DEBUG - /* - * With a few exceptions there should be a maximum of -@@ -1499,7 +1499,7 @@ static void kmemleak_scan(void) - if (color_gray(object) && get_object(object)) - list_add_tail(&object->gray_list, &gray_list); - -- spin_unlock_irqrestore(&object->lock, flags); -+ raw_spin_unlock_irqrestore(&object->lock, flags); - } - rcu_read_unlock(); - -@@ -1564,14 +1564,14 @@ static void kmemleak_scan(void) - */ - rcu_read_lock(); - list_for_each_entry_rcu(object, &object_list, object_list) { -- spin_lock_irqsave(&object->lock, flags); -+ raw_spin_lock_irqsave(&object->lock, flags); - if (color_white(object) && (object->flags & OBJECT_ALLOCATED) - && update_checksum(object) && get_object(object)) { - /* color it gray temporarily */ - object->count = object->min_count; - list_add_tail(&object->gray_list, &gray_list); - } -- spin_unlock_irqrestore(&object->lock, flags); -+ raw_spin_unlock_irqrestore(&object->lock, flags); - } - rcu_read_unlock(); - -@@ -1591,13 +1591,13 @@ static void kmemleak_scan(void) - */ - rcu_read_lock(); - list_for_each_entry_rcu(object, &object_list, object_list) { -- spin_lock_irqsave(&object->lock, flags); -+ raw_spin_lock_irqsave(&object->lock, flags); - if (unreferenced_object(object) && - !(object->flags & OBJECT_REPORTED)) { - object->flags |= OBJECT_REPORTED; - new_leaks++; - } -- spin_unlock_irqrestore(&object->lock, flags); -+ raw_spin_unlock_irqrestore(&object->lock, flags); - } - rcu_read_unlock(); - -@@ -1749,10 +1749,10 @@ static int kmemleak_seq_show(struct seq_file *seq, void *v) - struct kmemleak_object *object = v; - unsigned long flags; - -- spin_lock_irqsave(&object->lock, flags); -+ raw_spin_lock_irqsave(&object->lock, flags); - if ((object->flags & OBJECT_REPORTED) && unreferenced_object(object)) - print_unreferenced(seq, object); -- spin_unlock_irqrestore(&object->lock, flags); -+ raw_spin_unlock_irqrestore(&object->lock, flags); - return 0; - } - -@@ -1782,9 +1782,9 @@ static int dump_str_object_info(const char *str) - return -EINVAL; - } - -- spin_lock_irqsave(&object->lock, flags); -+ raw_spin_lock_irqsave(&object->lock, flags); - dump_object_info(object); -- spin_unlock_irqrestore(&object->lock, flags); -+ raw_spin_unlock_irqrestore(&object->lock, flags); - - put_object(object); - return 0; -@@ -1803,11 +1803,11 @@ static void kmemleak_clear(void) - - rcu_read_lock(); - list_for_each_entry_rcu(object, &object_list, object_list) { -- spin_lock_irqsave(&object->lock, flags); -+ raw_spin_lock_irqsave(&object->lock, flags); - if ((object->flags & OBJECT_REPORTED) && - unreferenced_object(object)) - __paint_it(object, KMEMLEAK_GREY); -- spin_unlock_irqrestore(&object->lock, flags); -+ raw_spin_unlock_irqrestore(&object->lock, flags); - } - rcu_read_unlock(); - --- -2.36.1 - diff --git a/debian/patches-rt/0306-sched-migrate_enable-Use-select_fallback_rq.patch b/debian/patches-rt/0306-sched-migrate_enable-Use-select_fallback_rq.patch new file mode 100644 index 000000000..8177c1f0a --- /dev/null +++ b/debian/patches-rt/0306-sched-migrate_enable-Use-select_fallback_rq.patch @@ -0,0 +1,62 @@ +From: Scott Wood +Date: Sat, 12 Oct 2019 01:52:12 -0500 +Subject: [PATCH 306/342] sched: migrate_enable: Use select_fallback_rq() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=b19de5d2c7678334eef4c5e764fcbe08f4fce1f6 + +[ Upstream commit adfa969d4cfcc995a9d866020124e50f1827d2d1 ] + +migrate_enable() currently open-codes a variant of select_fallback_rq(). +However, it does not have the "No more Mr. Nice Guy" fallback and thus +it will pass an invalid CPU to the migration thread if cpus_mask only +contains a CPU that is !active. + +Signed-off-by: Scott Wood +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + kernel/sched/core.c | 25 ++++++++++--------------- + 1 file changed, 10 insertions(+), 15 deletions(-) + +diff --git a/kernel/sched/core.c b/kernel/sched/core.c +index 6f91ee2b7e91..7eb3037c0b35 100644 +--- a/kernel/sched/core.c ++++ b/kernel/sched/core.c +@@ -7329,6 +7329,7 @@ void migrate_enable(void) + if (p->migrate_disable_update) { + struct rq *rq; + struct rq_flags rf; ++ int cpu = task_cpu(p); + + rq = task_rq_lock(p, &rf); + update_rq_clock(rq); +@@ -7338,21 +7339,15 @@ void migrate_enable(void) + + p->migrate_disable_update = 0; + +- WARN_ON(smp_processor_id() != task_cpu(p)); +- if (!cpumask_test_cpu(task_cpu(p), &p->cpus_mask)) { +- const struct cpumask *cpu_valid_mask = cpu_active_mask; +- struct migration_arg arg; +- unsigned int dest_cpu; +- +- if (p->flags & PF_KTHREAD) { +- /* +- * Kernel threads are allowed on online && !active CPUs +- */ +- cpu_valid_mask = cpu_online_mask; +- } +- dest_cpu = cpumask_any_and(cpu_valid_mask, &p->cpus_mask); +- arg.task = p; +- arg.dest_cpu = dest_cpu; ++ WARN_ON(smp_processor_id() != cpu); ++ if (!cpumask_test_cpu(cpu, &p->cpus_mask)) { ++ struct migration_arg arg = { p }; ++ struct rq_flags rf; ++ ++ rq = task_rq_lock(p, &rf); ++ update_rq_clock(rq); ++ arg.dest_cpu = select_fallback_rq(cpu, p); ++ task_rq_unlock(rq, p, &rf); + + unpin_current_cpu(); + preempt_lazy_enable(); diff --git a/debian/patches-rt/0307-sched-Lazy-migrate_disable-processing.patch b/debian/patches-rt/0307-sched-Lazy-migrate_disable-processing.patch new file mode 100644 index 000000000..0db42edaa --- /dev/null +++ b/debian/patches-rt/0307-sched-Lazy-migrate_disable-processing.patch @@ -0,0 +1,612 @@ +From: Scott Wood +Date: Sat, 12 Oct 2019 01:52:13 -0500 +Subject: [PATCH 307/342] sched: Lazy migrate_disable processing +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=80bc8f45b65be158feec72e427e42b77fcf0745a + +[ Upstream commit 425c5b38779a860062aa62219dc920d374b13c17 ] + +Avoid overhead on the majority of migrate disable/enable sequences by +only manipulating scheduler data (and grabbing the relevant locks) when +the task actually schedules while migrate-disabled. A kernel build +showed around a 10% reduction in system time (with CONFIG_NR_CPUS=512). + +Instead of cpuhp_pin_lock, CPU hotplug is handled by keeping a per-CPU +count of the number of pinned tasks (including tasks which have not +scheduled in the migrate-disabled section); takedown_cpu() will +wait until that reaches zero (confirmed by take_cpu_down() in stop +machine context to deal with races) before migrating tasks off of the +cpu. + +To simplify synchronization, updating cpus_mask is no longer deferred +until migrate_enable(). This lets us not have to worry about +migrate_enable() missing the update if it's on the fast path (didn't +schedule during the migrate disabled section). It also makes the code +a bit simpler and reduces deviation from mainline. + +While the main motivation for this is the performance benefit, lazy +migrate disable also eliminates the restriction on calling +migrate_disable() while atomic but leaving the atomic region prior to +calling migrate_enable() -- though this won't help with local_bh_disable() +(and thus rcutorture) unless something similar is done with the recently +added local_lock. + +Signed-off-by: Scott Wood +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + include/linux/cpu.h | 4 - + include/linux/sched.h | 11 +-- + init/init_task.c | 4 + + kernel/cpu.c | 103 +++++++++-------------- + kernel/sched/core.c | 182 +++++++++++++++++------------------------ + kernel/sched/sched.h | 4 + + lib/smp_processor_id.c | 3 + + 7 files changed, 129 insertions(+), 182 deletions(-) + +diff --git a/include/linux/cpu.h b/include/linux/cpu.h +index a3c246214d28..81ce109caec3 100644 +--- a/include/linux/cpu.h ++++ b/include/linux/cpu.h +@@ -122,8 +122,6 @@ extern void cpu_hotplug_disable(void); + extern void cpu_hotplug_enable(void); + void clear_tasks_mm_cpumask(int cpu); + int cpu_down(unsigned int cpu); +-extern void pin_current_cpu(void); +-extern void unpin_current_cpu(void); + + #else /* CONFIG_HOTPLUG_CPU */ + +@@ -135,8 +133,6 @@ static inline int cpus_read_trylock(void) { return true; } + static inline void lockdep_assert_cpus_held(void) { } + static inline void cpu_hotplug_disable(void) { } + static inline void cpu_hotplug_enable(void) { } +-static inline void pin_current_cpu(void) { } +-static inline void unpin_current_cpu(void) { } + + #endif /* !CONFIG_HOTPLUG_CPU */ + +diff --git a/include/linux/sched.h b/include/linux/sched.h +index e567fe2d7058..65069db8923c 100644 +--- a/include/linux/sched.h ++++ b/include/linux/sched.h +@@ -227,6 +227,8 @@ extern void io_schedule_finish(int token); + extern long io_schedule_timeout(long timeout); + extern void io_schedule(void); + ++int cpu_nr_pinned(int cpu); ++ + /** + * struct prev_cputime - snapshot of system and user cputime + * @utime: time spent in user mode +@@ -670,16 +672,13 @@ struct task_struct { + cpumask_t cpus_mask; + #if defined(CONFIG_SMP) && defined(CONFIG_PREEMPT_RT_BASE) + int migrate_disable; +- int migrate_disable_update; +- int pinned_on_cpu; ++ bool migrate_disable_scheduled; + # ifdef CONFIG_SCHED_DEBUG +- int migrate_disable_atomic; ++ int pinned_on_cpu; + # endif +- + #elif !defined(CONFIG_SMP) && defined(CONFIG_PREEMPT_RT_BASE) + # ifdef CONFIG_SCHED_DEBUG + int migrate_disable; +- int migrate_disable_atomic; + # endif + #endif + #ifdef CONFIG_PREEMPT_RT_FULL +@@ -2058,4 +2057,6 @@ static inline void rseq_syscall(struct pt_regs *regs) + + #endif + ++extern struct task_struct *takedown_cpu_task; ++ + #endif +diff --git a/init/init_task.c b/init/init_task.c +index 634becebd713..45b84137c4b3 100644 +--- a/init/init_task.c ++++ b/init/init_task.c +@@ -80,6 +80,10 @@ struct task_struct init_task + .cpus_ptr = &init_task.cpus_mask, + .cpus_mask = CPU_MASK_ALL, + .nr_cpus_allowed= NR_CPUS, ++#if defined(CONFIG_SMP) && defined(CONFIG_PREEMPT_RT_BASE) && \ ++ defined(CONFIG_SCHED_DEBUG) ++ .pinned_on_cpu = -1, ++#endif + .mm = NULL, + .active_mm = &init_mm, + .restart_block = { +diff --git a/kernel/cpu.c b/kernel/cpu.c +index 4bf82665f28c..f603ea80af2e 100644 +--- a/kernel/cpu.c ++++ b/kernel/cpu.c +@@ -78,11 +78,6 @@ static DEFINE_PER_CPU(struct cpuhp_cpu_state, cpuhp_state) = { + .fail = CPUHP_INVALID, + }; + +-#if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PREEMPT_RT_FULL) +-static DEFINE_PER_CPU(struct rt_rw_lock, cpuhp_pin_lock) = \ +- __RWLOCK_RT_INITIALIZER(cpuhp_pin_lock); +-#endif +- + #if defined(CONFIG_LOCKDEP) && defined(CONFIG_SMP) + static struct lockdep_map cpuhp_state_up_map = + STATIC_LOCKDEP_MAP_INIT("cpuhp_state-up", &cpuhp_state_up_map); +@@ -289,57 +284,6 @@ static int cpu_hotplug_disabled; + + #ifdef CONFIG_HOTPLUG_CPU + +-/** +- * pin_current_cpu - Prevent the current cpu from being unplugged +- */ +-void pin_current_cpu(void) +-{ +-#ifdef CONFIG_PREEMPT_RT_FULL +- struct rt_rw_lock *cpuhp_pin; +- unsigned int cpu; +- int ret; +- +-again: +- cpuhp_pin = this_cpu_ptr(&cpuhp_pin_lock); +- ret = __read_rt_trylock(cpuhp_pin); +- if (ret) { +- current->pinned_on_cpu = smp_processor_id(); +- return; +- } +- cpu = smp_processor_id(); +- preempt_lazy_enable(); +- preempt_enable(); +- +- sleeping_lock_inc(); +- __read_rt_lock(cpuhp_pin); +- sleeping_lock_dec(); +- +- preempt_disable(); +- preempt_lazy_disable(); +- if (cpu != smp_processor_id()) { +- __read_rt_unlock(cpuhp_pin); +- goto again; +- } +- current->pinned_on_cpu = cpu; +-#endif +-} +- +-/** +- * unpin_current_cpu - Allow unplug of current cpu +- */ +-void unpin_current_cpu(void) +-{ +-#ifdef CONFIG_PREEMPT_RT_FULL +- struct rt_rw_lock *cpuhp_pin = this_cpu_ptr(&cpuhp_pin_lock); +- +- if (WARN_ON(current->pinned_on_cpu != smp_processor_id())) +- cpuhp_pin = per_cpu_ptr(&cpuhp_pin_lock, current->pinned_on_cpu); +- +- current->pinned_on_cpu = -1; +- __read_rt_unlock(cpuhp_pin); +-#endif +-} +- + DEFINE_STATIC_PERCPU_RWSEM(cpu_hotplug_lock); + + void cpus_read_lock(void) +@@ -933,6 +877,15 @@ static int take_cpu_down(void *_param) + int err, cpu = smp_processor_id(); + int ret; + ++#ifdef CONFIG_PREEMPT_RT_BASE ++ /* ++ * If any tasks disabled migration before we got here, ++ * go back and sleep again. ++ */ ++ if (cpu_nr_pinned(cpu)) ++ return -EAGAIN; ++#endif ++ + /* Ensure this CPU doesn't handle any more interrupts. */ + err = __cpu_disable(); + if (err < 0) +@@ -960,11 +913,10 @@ static int take_cpu_down(void *_param) + return 0; + } + ++struct task_struct *takedown_cpu_task; ++ + static int takedown_cpu(unsigned int cpu) + { +-#ifdef CONFIG_PREEMPT_RT_FULL +- struct rt_rw_lock *cpuhp_pin = per_cpu_ptr(&cpuhp_pin_lock, cpu); +-#endif + struct cpuhp_cpu_state *st = per_cpu_ptr(&cpuhp_state, cpu); + int err; + +@@ -977,17 +929,38 @@ static int takedown_cpu(unsigned int cpu) + */ + irq_lock_sparse(); + +-#ifdef CONFIG_PREEMPT_RT_FULL +- __write_rt_lock(cpuhp_pin); ++#ifdef CONFIG_PREEMPT_RT_BASE ++ WARN_ON_ONCE(takedown_cpu_task); ++ takedown_cpu_task = current; ++ ++again: ++ /* ++ * If a task pins this CPU after we pass this check, take_cpu_down ++ * will return -EAGAIN. ++ */ ++ for (;;) { ++ int nr_pinned; ++ ++ set_current_state(TASK_UNINTERRUPTIBLE); ++ nr_pinned = cpu_nr_pinned(cpu); ++ if (nr_pinned == 0) ++ break; ++ schedule(); ++ } ++ set_current_state(TASK_RUNNING); + #endif + + /* + * So now all preempt/rcu users must observe !cpu_active(). + */ + err = stop_machine_cpuslocked(take_cpu_down, NULL, cpumask_of(cpu)); ++#ifdef CONFIG_PREEMPT_RT_BASE ++ if (err == -EAGAIN) ++ goto again; ++#endif + if (err) { +-#ifdef CONFIG_PREEMPT_RT_FULL +- __write_rt_unlock(cpuhp_pin); ++#ifdef CONFIG_PREEMPT_RT_BASE ++ takedown_cpu_task = NULL; + #endif + /* CPU refused to die */ + irq_unlock_sparse(); +@@ -1007,8 +980,8 @@ static int takedown_cpu(unsigned int cpu) + wait_for_ap_thread(st, false); + BUG_ON(st->state != CPUHP_AP_IDLE_DEAD); + +-#ifdef CONFIG_PREEMPT_RT_FULL +- __write_rt_unlock(cpuhp_pin); ++#ifdef CONFIG_PREEMPT_RT_BASE ++ takedown_cpu_task = NULL; + #endif + /* Interrupts are moved away from the dying cpu, reenable alloc/free */ + irq_unlock_sparse(); +diff --git a/kernel/sched/core.c b/kernel/sched/core.c +index 7eb3037c0b35..de6514e13e0c 100644 +--- a/kernel/sched/core.c ++++ b/kernel/sched/core.c +@@ -1065,7 +1065,8 @@ static int migration_cpu_stop(void *data) + void set_cpus_allowed_common(struct task_struct *p, const struct cpumask *new_mask) + { + cpumask_copy(&p->cpus_mask, new_mask); +- p->nr_cpus_allowed = cpumask_weight(new_mask); ++ if (p->cpus_ptr == &p->cpus_mask) ++ p->nr_cpus_allowed = cpumask_weight(new_mask); + } + + #if defined(CONFIG_SMP) && defined(CONFIG_PREEMPT_RT_BASE) +@@ -1076,8 +1077,7 @@ int __migrate_disabled(struct task_struct *p) + EXPORT_SYMBOL_GPL(__migrate_disabled); + #endif + +-static void __do_set_cpus_allowed_tail(struct task_struct *p, +- const struct cpumask *new_mask) ++void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask) + { + struct rq *rq = task_rq(p); + bool queued, running; +@@ -1106,20 +1106,6 @@ static void __do_set_cpus_allowed_tail(struct task_struct *p, + set_curr_task(rq, p); + } + +-void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask) +-{ +-#if defined(CONFIG_SMP) && defined(CONFIG_PREEMPT_RT_BASE) +- if (__migrate_disabled(p)) { +- lockdep_assert_held(&p->pi_lock); +- +- cpumask_copy(&p->cpus_mask, new_mask); +- p->migrate_disable_update = 1; +- return; +- } +-#endif +- __do_set_cpus_allowed_tail(p, new_mask); +-} +- + /* + * Change a given task's CPU affinity. Migrate the thread to a + * proper CPU and schedule it away if the CPU it's executing on +@@ -1179,7 +1165,8 @@ static int __set_cpus_allowed_ptr(struct task_struct *p, + } + + /* Can the task run on the task's current CPU? If so, we're done */ +- if (cpumask_test_cpu(task_cpu(p), new_mask) || __migrate_disabled(p)) ++ if (cpumask_test_cpu(task_cpu(p), new_mask) || ++ p->cpus_ptr != &p->cpus_mask) + goto out; + + if (task_running(rq, p) || p->state == TASK_WAKING) { +@@ -3459,6 +3446,8 @@ pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf) + BUG(); + } + ++static void migrate_disabled_sched(struct task_struct *p); ++ + /* + * __schedule() is the main scheduler function. + * +@@ -3529,6 +3518,9 @@ static void __sched notrace __schedule(bool preempt) + rq_lock(rq, &rf); + smp_mb__after_spinlock(); + ++ if (__migrate_disabled(prev)) ++ migrate_disabled_sched(prev); ++ + /* Promote REQ to ACT */ + rq->clock_update_flags <<= 1; + update_rq_clock(rq); +@@ -5777,6 +5769,8 @@ static void migrate_tasks(struct rq *dead_rq, struct rq_flags *rf) + BUG_ON(!next); + put_prev_task(rq, next); + ++ WARN_ON_ONCE(__migrate_disabled(next)); ++ + /* + * Rules for changing task_struct::cpus_mask are holding + * both pi_lock and rq->lock, such that holding either +@@ -7241,14 +7235,9 @@ update_nr_migratory(struct task_struct *p, long delta) + static inline void + migrate_disable_update_cpus_allowed(struct task_struct *p) + { +- struct rq *rq; +- struct rq_flags rf; +- +- rq = task_rq_lock(p, &rf); + p->cpus_ptr = cpumask_of(smp_processor_id()); + update_nr_migratory(p, -1); + p->nr_cpus_allowed = 1; +- task_rq_unlock(rq, p, &rf); + } + + static inline void +@@ -7266,54 +7255,35 @@ migrate_enable_update_cpus_allowed(struct task_struct *p) + + void migrate_disable(void) + { +- struct task_struct *p = current; ++ preempt_disable(); + +- if (in_atomic() || irqs_disabled()) { ++ if (++current->migrate_disable == 1) { ++ this_rq()->nr_pinned++; ++ preempt_lazy_disable(); + #ifdef CONFIG_SCHED_DEBUG +- p->migrate_disable_atomic++; ++ WARN_ON_ONCE(current->pinned_on_cpu >= 0); ++ current->pinned_on_cpu = smp_processor_id(); + #endif +- return; +- } +-#ifdef CONFIG_SCHED_DEBUG +- if (unlikely(p->migrate_disable_atomic)) { +- tracing_off(); +- WARN_ON_ONCE(1); + } +-#endif + +- if (p->migrate_disable) { +- p->migrate_disable++; +- return; +- } ++ preempt_enable(); ++} ++EXPORT_SYMBOL(migrate_disable); + +- preempt_disable(); +- preempt_lazy_disable(); +- pin_current_cpu(); ++static void migrate_disabled_sched(struct task_struct *p) ++{ ++ if (p->migrate_disable_scheduled) ++ return; + + migrate_disable_update_cpus_allowed(p); +- p->migrate_disable = 1; +- +- preempt_enable(); ++ p->migrate_disable_scheduled = 1; + } +-EXPORT_SYMBOL(migrate_disable); + + void migrate_enable(void) + { + struct task_struct *p = current; +- +- if (in_atomic() || irqs_disabled()) { +-#ifdef CONFIG_SCHED_DEBUG +- p->migrate_disable_atomic--; +-#endif +- return; +- } +- +-#ifdef CONFIG_SCHED_DEBUG +- if (unlikely(p->migrate_disable_atomic)) { +- tracing_off(); +- WARN_ON_ONCE(1); +- } +-#endif ++ struct rq *rq = this_rq(); ++ int cpu = task_cpu(p); + + WARN_ON_ONCE(p->migrate_disable <= 0); + if (p->migrate_disable > 1) { +@@ -7323,67 +7293,69 @@ void migrate_enable(void) + + preempt_disable(); + ++#ifdef CONFIG_SCHED_DEBUG ++ WARN_ON_ONCE(current->pinned_on_cpu != cpu); ++ current->pinned_on_cpu = -1; ++#endif ++ ++ WARN_ON_ONCE(rq->nr_pinned < 1); ++ + p->migrate_disable = 0; ++ rq->nr_pinned--; ++ if (rq->nr_pinned == 0 && unlikely(!cpu_active(cpu)) && ++ takedown_cpu_task) ++ wake_up_process(takedown_cpu_task); ++ ++ if (!p->migrate_disable_scheduled) ++ goto out; ++ ++ p->migrate_disable_scheduled = 0; ++ + migrate_enable_update_cpus_allowed(p); + +- if (p->migrate_disable_update) { +- struct rq *rq; ++ WARN_ON(smp_processor_id() != cpu); ++ if (!is_cpu_allowed(p, cpu)) { ++ struct migration_arg arg = { p }; + struct rq_flags rf; +- int cpu = task_cpu(p); + + rq = task_rq_lock(p, &rf); + update_rq_clock(rq); +- +- __do_set_cpus_allowed_tail(p, &p->cpus_mask); ++ arg.dest_cpu = select_fallback_rq(cpu, p); + task_rq_unlock(rq, p, &rf); + +- p->migrate_disable_update = 0; +- +- WARN_ON(smp_processor_id() != cpu); +- if (!cpumask_test_cpu(cpu, &p->cpus_mask)) { +- struct migration_arg arg = { p }; +- struct rq_flags rf; ++ preempt_lazy_enable(); ++ preempt_enable(); + +- rq = task_rq_lock(p, &rf); +- update_rq_clock(rq); +- arg.dest_cpu = select_fallback_rq(cpu, p); +- task_rq_unlock(rq, p, &rf); +- +- unpin_current_cpu(); +- preempt_lazy_enable(); +- preempt_enable(); +- +- sleeping_lock_inc(); +- stop_one_cpu(task_cpu(p), migration_cpu_stop, &arg); +- sleeping_lock_dec(); +- tlb_migrate_finish(p->mm); ++ sleeping_lock_inc(); ++ stop_one_cpu(task_cpu(p), migration_cpu_stop, &arg); ++ sleeping_lock_dec(); ++ tlb_migrate_finish(p->mm); + +- return; +- } ++ return; + } +- unpin_current_cpu(); ++ ++out: + preempt_lazy_enable(); + preempt_enable(); + } + EXPORT_SYMBOL(migrate_enable); + +-#elif !defined(CONFIG_SMP) && defined(CONFIG_PREEMPT_RT_BASE) +-void migrate_disable(void) ++int cpu_nr_pinned(int cpu) + { +-#ifdef CONFIG_SCHED_DEBUG +- struct task_struct *p = current; ++ struct rq *rq = cpu_rq(cpu); + +- if (in_atomic() || irqs_disabled()) { +- p->migrate_disable_atomic++; +- return; +- } ++ return rq->nr_pinned; ++} + +- if (unlikely(p->migrate_disable_atomic)) { +- tracing_off(); +- WARN_ON_ONCE(1); +- } ++#elif !defined(CONFIG_SMP) && defined(CONFIG_PREEMPT_RT_BASE) ++static void migrate_disabled_sched(struct task_struct *p) ++{ ++} + +- p->migrate_disable++; ++void migrate_disable(void) ++{ ++#ifdef CONFIG_SCHED_DEBUG ++ current->migrate_disable++; + #endif + barrier(); + } +@@ -7394,20 +7366,14 @@ void migrate_enable(void) + #ifdef CONFIG_SCHED_DEBUG + struct task_struct *p = current; + +- if (in_atomic() || irqs_disabled()) { +- p->migrate_disable_atomic--; +- return; +- } +- +- if (unlikely(p->migrate_disable_atomic)) { +- tracing_off(); +- WARN_ON_ONCE(1); +- } +- + WARN_ON_ONCE(p->migrate_disable <= 0); + p->migrate_disable--; + #endif + barrier(); + } + EXPORT_SYMBOL(migrate_enable); ++#else ++static void migrate_disabled_sched(struct task_struct *p) ++{ ++} + #endif +diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h +index 87a05bb90124..45b3f135d205 100644 +--- a/kernel/sched/sched.h ++++ b/kernel/sched/sched.h +@@ -915,6 +915,10 @@ struct rq { + /* Must be inspected within a rcu lock section */ + struct cpuidle_state *idle_state; + #endif ++ ++#if defined(CONFIG_PREEMPT_RT_BASE) && defined(CONFIG_SMP) ++ int nr_pinned; ++#endif + }; + + static inline int cpu_of(struct rq *rq) +diff --git a/lib/smp_processor_id.c b/lib/smp_processor_id.c +index b8a8a8db2d75..0c80992aa337 100644 +--- a/lib/smp_processor_id.c ++++ b/lib/smp_processor_id.c +@@ -22,6 +22,9 @@ notrace static unsigned int check_preemption_disabled(const char *what1, + * Kernel threads bound to a single CPU can safely use + * smp_processor_id(): + */ ++ if (current->migrate_disable) ++ goto out; ++ + if (current->nr_cpus_allowed == 1) + goto out; + diff --git a/debian/patches-rt/0307-sched-migrate_enable-Use-select_fallback_rq.patch b/debian/patches-rt/0307-sched-migrate_enable-Use-select_fallback_rq.patch deleted file mode 100644 index 6de7f0383..000000000 --- a/debian/patches-rt/0307-sched-migrate_enable-Use-select_fallback_rq.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 86ff244b7222b5d5734b2c195ba28c7bbb5b6b0a Mon Sep 17 00:00:00 2001 -From: Scott Wood -Date: Sat, 12 Oct 2019 01:52:12 -0500 -Subject: [PATCH 307/347] sched: migrate_enable: Use select_fallback_rq() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit adfa969d4cfcc995a9d866020124e50f1827d2d1 ] - -migrate_enable() currently open-codes a variant of select_fallback_rq(). -However, it does not have the "No more Mr. Nice Guy" fallback and thus -it will pass an invalid CPU to the migration thread if cpus_mask only -contains a CPU that is !active. - -Signed-off-by: Scott Wood -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - kernel/sched/core.c | 25 ++++++++++--------------- - 1 file changed, 10 insertions(+), 15 deletions(-) - -diff --git a/kernel/sched/core.c b/kernel/sched/core.c -index 6f91ee2b7e91..7eb3037c0b35 100644 ---- a/kernel/sched/core.c -+++ b/kernel/sched/core.c -@@ -7329,6 +7329,7 @@ void migrate_enable(void) - if (p->migrate_disable_update) { - struct rq *rq; - struct rq_flags rf; -+ int cpu = task_cpu(p); - - rq = task_rq_lock(p, &rf); - update_rq_clock(rq); -@@ -7338,21 +7339,15 @@ void migrate_enable(void) - - p->migrate_disable_update = 0; - -- WARN_ON(smp_processor_id() != task_cpu(p)); -- if (!cpumask_test_cpu(task_cpu(p), &p->cpus_mask)) { -- const struct cpumask *cpu_valid_mask = cpu_active_mask; -- struct migration_arg arg; -- unsigned int dest_cpu; -- -- if (p->flags & PF_KTHREAD) { -- /* -- * Kernel threads are allowed on online && !active CPUs -- */ -- cpu_valid_mask = cpu_online_mask; -- } -- dest_cpu = cpumask_any_and(cpu_valid_mask, &p->cpus_mask); -- arg.task = p; -- arg.dest_cpu = dest_cpu; -+ WARN_ON(smp_processor_id() != cpu); -+ if (!cpumask_test_cpu(cpu, &p->cpus_mask)) { -+ struct migration_arg arg = { p }; -+ struct rq_flags rf; -+ -+ rq = task_rq_lock(p, &rf); -+ update_rq_clock(rq); -+ arg.dest_cpu = select_fallback_rq(cpu, p); -+ task_rq_unlock(rq, p, &rf); - - unpin_current_cpu(); - preempt_lazy_enable(); --- -2.36.1 - diff --git a/debian/patches-rt/0308-sched-Lazy-migrate_disable-processing.patch b/debian/patches-rt/0308-sched-Lazy-migrate_disable-processing.patch deleted file mode 100644 index 973b6e870..000000000 --- a/debian/patches-rt/0308-sched-Lazy-migrate_disable-processing.patch +++ /dev/null @@ -1,616 +0,0 @@ -From 34b182c6f6606c5a02a3ddea15356251ca28093b Mon Sep 17 00:00:00 2001 -From: Scott Wood -Date: Sat, 12 Oct 2019 01:52:13 -0500 -Subject: [PATCH 308/347] sched: Lazy migrate_disable processing -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 425c5b38779a860062aa62219dc920d374b13c17 ] - -Avoid overhead on the majority of migrate disable/enable sequences by -only manipulating scheduler data (and grabbing the relevant locks) when -the task actually schedules while migrate-disabled. A kernel build -showed around a 10% reduction in system time (with CONFIG_NR_CPUS=512). - -Instead of cpuhp_pin_lock, CPU hotplug is handled by keeping a per-CPU -count of the number of pinned tasks (including tasks which have not -scheduled in the migrate-disabled section); takedown_cpu() will -wait until that reaches zero (confirmed by take_cpu_down() in stop -machine context to deal with races) before migrating tasks off of the -cpu. - -To simplify synchronization, updating cpus_mask is no longer deferred -until migrate_enable(). This lets us not have to worry about -migrate_enable() missing the update if it's on the fast path (didn't -schedule during the migrate disabled section). It also makes the code -a bit simpler and reduces deviation from mainline. - -While the main motivation for this is the performance benefit, lazy -migrate disable also eliminates the restriction on calling -migrate_disable() while atomic but leaving the atomic region prior to -calling migrate_enable() -- though this won't help with local_bh_disable() -(and thus rcutorture) unless something similar is done with the recently -added local_lock. - -Signed-off-by: Scott Wood -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - include/linux/cpu.h | 4 - - include/linux/sched.h | 11 +-- - init/init_task.c | 4 + - kernel/cpu.c | 103 +++++++++-------------- - kernel/sched/core.c | 182 +++++++++++++++++------------------------ - kernel/sched/sched.h | 4 + - lib/smp_processor_id.c | 3 + - 7 files changed, 129 insertions(+), 182 deletions(-) - -diff --git a/include/linux/cpu.h b/include/linux/cpu.h -index e67645924404..87347ccbba0c 100644 ---- a/include/linux/cpu.h -+++ b/include/linux/cpu.h -@@ -118,8 +118,6 @@ extern void cpu_hotplug_disable(void); - extern void cpu_hotplug_enable(void); - void clear_tasks_mm_cpumask(int cpu); - int cpu_down(unsigned int cpu); --extern void pin_current_cpu(void); --extern void unpin_current_cpu(void); - - #else /* CONFIG_HOTPLUG_CPU */ - -@@ -131,8 +129,6 @@ static inline int cpus_read_trylock(void) { return true; } - static inline void lockdep_assert_cpus_held(void) { } - static inline void cpu_hotplug_disable(void) { } - static inline void cpu_hotplug_enable(void) { } --static inline void pin_current_cpu(void) { } --static inline void unpin_current_cpu(void) { } - - #endif /* !CONFIG_HOTPLUG_CPU */ - -diff --git a/include/linux/sched.h b/include/linux/sched.h -index e567fe2d7058..65069db8923c 100644 ---- a/include/linux/sched.h -+++ b/include/linux/sched.h -@@ -227,6 +227,8 @@ extern void io_schedule_finish(int token); - extern long io_schedule_timeout(long timeout); - extern void io_schedule(void); - -+int cpu_nr_pinned(int cpu); -+ - /** - * struct prev_cputime - snapshot of system and user cputime - * @utime: time spent in user mode -@@ -670,16 +672,13 @@ struct task_struct { - cpumask_t cpus_mask; - #if defined(CONFIG_SMP) && defined(CONFIG_PREEMPT_RT_BASE) - int migrate_disable; -- int migrate_disable_update; -- int pinned_on_cpu; -+ bool migrate_disable_scheduled; - # ifdef CONFIG_SCHED_DEBUG -- int migrate_disable_atomic; -+ int pinned_on_cpu; - # endif -- - #elif !defined(CONFIG_SMP) && defined(CONFIG_PREEMPT_RT_BASE) - # ifdef CONFIG_SCHED_DEBUG - int migrate_disable; -- int migrate_disable_atomic; - # endif - #endif - #ifdef CONFIG_PREEMPT_RT_FULL -@@ -2058,4 +2057,6 @@ static inline void rseq_syscall(struct pt_regs *regs) - - #endif - -+extern struct task_struct *takedown_cpu_task; -+ - #endif -diff --git a/init/init_task.c b/init/init_task.c -index 634becebd713..45b84137c4b3 100644 ---- a/init/init_task.c -+++ b/init/init_task.c -@@ -80,6 +80,10 @@ struct task_struct init_task - .cpus_ptr = &init_task.cpus_mask, - .cpus_mask = CPU_MASK_ALL, - .nr_cpus_allowed= NR_CPUS, -+#if defined(CONFIG_SMP) && defined(CONFIG_PREEMPT_RT_BASE) && \ -+ defined(CONFIG_SCHED_DEBUG) -+ .pinned_on_cpu = -1, -+#endif - .mm = NULL, - .active_mm = &init_mm, - .restart_block = { -diff --git a/kernel/cpu.c b/kernel/cpu.c -index c84a93f84164..edd4fd8da726 100644 ---- a/kernel/cpu.c -+++ b/kernel/cpu.c -@@ -77,11 +77,6 @@ static DEFINE_PER_CPU(struct cpuhp_cpu_state, cpuhp_state) = { - .fail = CPUHP_INVALID, - }; - --#if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PREEMPT_RT_FULL) --static DEFINE_PER_CPU(struct rt_rw_lock, cpuhp_pin_lock) = \ -- __RWLOCK_RT_INITIALIZER(cpuhp_pin_lock); --#endif -- - #if defined(CONFIG_LOCKDEP) && defined(CONFIG_SMP) - static struct lockdep_map cpuhp_state_up_map = - STATIC_LOCKDEP_MAP_INIT("cpuhp_state-up", &cpuhp_state_up_map); -@@ -288,57 +283,6 @@ static int cpu_hotplug_disabled; - - #ifdef CONFIG_HOTPLUG_CPU - --/** -- * pin_current_cpu - Prevent the current cpu from being unplugged -- */ --void pin_current_cpu(void) --{ --#ifdef CONFIG_PREEMPT_RT_FULL -- struct rt_rw_lock *cpuhp_pin; -- unsigned int cpu; -- int ret; -- --again: -- cpuhp_pin = this_cpu_ptr(&cpuhp_pin_lock); -- ret = __read_rt_trylock(cpuhp_pin); -- if (ret) { -- current->pinned_on_cpu = smp_processor_id(); -- return; -- } -- cpu = smp_processor_id(); -- preempt_lazy_enable(); -- preempt_enable(); -- -- sleeping_lock_inc(); -- __read_rt_lock(cpuhp_pin); -- sleeping_lock_dec(); -- -- preempt_disable(); -- preempt_lazy_disable(); -- if (cpu != smp_processor_id()) { -- __read_rt_unlock(cpuhp_pin); -- goto again; -- } -- current->pinned_on_cpu = cpu; --#endif --} -- --/** -- * unpin_current_cpu - Allow unplug of current cpu -- */ --void unpin_current_cpu(void) --{ --#ifdef CONFIG_PREEMPT_RT_FULL -- struct rt_rw_lock *cpuhp_pin = this_cpu_ptr(&cpuhp_pin_lock); -- -- if (WARN_ON(current->pinned_on_cpu != smp_processor_id())) -- cpuhp_pin = per_cpu_ptr(&cpuhp_pin_lock, current->pinned_on_cpu); -- -- current->pinned_on_cpu = -1; -- __read_rt_unlock(cpuhp_pin); --#endif --} -- - DEFINE_STATIC_PERCPU_RWSEM(cpu_hotplug_lock); - - void cpus_read_lock(void) -@@ -932,6 +876,15 @@ static int take_cpu_down(void *_param) - int err, cpu = smp_processor_id(); - int ret; - -+#ifdef CONFIG_PREEMPT_RT_BASE -+ /* -+ * If any tasks disabled migration before we got here, -+ * go back and sleep again. -+ */ -+ if (cpu_nr_pinned(cpu)) -+ return -EAGAIN; -+#endif -+ - /* Ensure this CPU doesn't handle any more interrupts. */ - err = __cpu_disable(); - if (err < 0) -@@ -959,11 +912,10 @@ static int take_cpu_down(void *_param) - return 0; - } - -+struct task_struct *takedown_cpu_task; -+ - static int takedown_cpu(unsigned int cpu) - { --#ifdef CONFIG_PREEMPT_RT_FULL -- struct rt_rw_lock *cpuhp_pin = per_cpu_ptr(&cpuhp_pin_lock, cpu); --#endif - struct cpuhp_cpu_state *st = per_cpu_ptr(&cpuhp_state, cpu); - int err; - -@@ -976,17 +928,38 @@ static int takedown_cpu(unsigned int cpu) - */ - irq_lock_sparse(); - --#ifdef CONFIG_PREEMPT_RT_FULL -- __write_rt_lock(cpuhp_pin); -+#ifdef CONFIG_PREEMPT_RT_BASE -+ WARN_ON_ONCE(takedown_cpu_task); -+ takedown_cpu_task = current; -+ -+again: -+ /* -+ * If a task pins this CPU after we pass this check, take_cpu_down -+ * will return -EAGAIN. -+ */ -+ for (;;) { -+ int nr_pinned; -+ -+ set_current_state(TASK_UNINTERRUPTIBLE); -+ nr_pinned = cpu_nr_pinned(cpu); -+ if (nr_pinned == 0) -+ break; -+ schedule(); -+ } -+ set_current_state(TASK_RUNNING); - #endif - - /* - * So now all preempt/rcu users must observe !cpu_active(). - */ - err = stop_machine_cpuslocked(take_cpu_down, NULL, cpumask_of(cpu)); -+#ifdef CONFIG_PREEMPT_RT_BASE -+ if (err == -EAGAIN) -+ goto again; -+#endif - if (err) { --#ifdef CONFIG_PREEMPT_RT_FULL -- __write_rt_unlock(cpuhp_pin); -+#ifdef CONFIG_PREEMPT_RT_BASE -+ takedown_cpu_task = NULL; - #endif - /* CPU refused to die */ - irq_unlock_sparse(); -@@ -1006,8 +979,8 @@ static int takedown_cpu(unsigned int cpu) - wait_for_ap_thread(st, false); - BUG_ON(st->state != CPUHP_AP_IDLE_DEAD); - --#ifdef CONFIG_PREEMPT_RT_FULL -- __write_rt_unlock(cpuhp_pin); -+#ifdef CONFIG_PREEMPT_RT_BASE -+ takedown_cpu_task = NULL; - #endif - /* Interrupts are moved away from the dying cpu, reenable alloc/free */ - irq_unlock_sparse(); -diff --git a/kernel/sched/core.c b/kernel/sched/core.c -index 7eb3037c0b35..de6514e13e0c 100644 ---- a/kernel/sched/core.c -+++ b/kernel/sched/core.c -@@ -1065,7 +1065,8 @@ static int migration_cpu_stop(void *data) - void set_cpus_allowed_common(struct task_struct *p, const struct cpumask *new_mask) - { - cpumask_copy(&p->cpus_mask, new_mask); -- p->nr_cpus_allowed = cpumask_weight(new_mask); -+ if (p->cpus_ptr == &p->cpus_mask) -+ p->nr_cpus_allowed = cpumask_weight(new_mask); - } - - #if defined(CONFIG_SMP) && defined(CONFIG_PREEMPT_RT_BASE) -@@ -1076,8 +1077,7 @@ int __migrate_disabled(struct task_struct *p) - EXPORT_SYMBOL_GPL(__migrate_disabled); - #endif - --static void __do_set_cpus_allowed_tail(struct task_struct *p, -- const struct cpumask *new_mask) -+void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask) - { - struct rq *rq = task_rq(p); - bool queued, running; -@@ -1106,20 +1106,6 @@ static void __do_set_cpus_allowed_tail(struct task_struct *p, - set_curr_task(rq, p); - } - --void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask) --{ --#if defined(CONFIG_SMP) && defined(CONFIG_PREEMPT_RT_BASE) -- if (__migrate_disabled(p)) { -- lockdep_assert_held(&p->pi_lock); -- -- cpumask_copy(&p->cpus_mask, new_mask); -- p->migrate_disable_update = 1; -- return; -- } --#endif -- __do_set_cpus_allowed_tail(p, new_mask); --} -- - /* - * Change a given task's CPU affinity. Migrate the thread to a - * proper CPU and schedule it away if the CPU it's executing on -@@ -1179,7 +1165,8 @@ static int __set_cpus_allowed_ptr(struct task_struct *p, - } - - /* Can the task run on the task's current CPU? If so, we're done */ -- if (cpumask_test_cpu(task_cpu(p), new_mask) || __migrate_disabled(p)) -+ if (cpumask_test_cpu(task_cpu(p), new_mask) || -+ p->cpus_ptr != &p->cpus_mask) - goto out; - - if (task_running(rq, p) || p->state == TASK_WAKING) { -@@ -3459,6 +3446,8 @@ pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf) - BUG(); - } - -+static void migrate_disabled_sched(struct task_struct *p); -+ - /* - * __schedule() is the main scheduler function. - * -@@ -3529,6 +3518,9 @@ static void __sched notrace __schedule(bool preempt) - rq_lock(rq, &rf); - smp_mb__after_spinlock(); - -+ if (__migrate_disabled(prev)) -+ migrate_disabled_sched(prev); -+ - /* Promote REQ to ACT */ - rq->clock_update_flags <<= 1; - update_rq_clock(rq); -@@ -5777,6 +5769,8 @@ static void migrate_tasks(struct rq *dead_rq, struct rq_flags *rf) - BUG_ON(!next); - put_prev_task(rq, next); - -+ WARN_ON_ONCE(__migrate_disabled(next)); -+ - /* - * Rules for changing task_struct::cpus_mask are holding - * both pi_lock and rq->lock, such that holding either -@@ -7241,14 +7235,9 @@ update_nr_migratory(struct task_struct *p, long delta) - static inline void - migrate_disable_update_cpus_allowed(struct task_struct *p) - { -- struct rq *rq; -- struct rq_flags rf; -- -- rq = task_rq_lock(p, &rf); - p->cpus_ptr = cpumask_of(smp_processor_id()); - update_nr_migratory(p, -1); - p->nr_cpus_allowed = 1; -- task_rq_unlock(rq, p, &rf); - } - - static inline void -@@ -7266,54 +7255,35 @@ migrate_enable_update_cpus_allowed(struct task_struct *p) - - void migrate_disable(void) - { -- struct task_struct *p = current; -+ preempt_disable(); - -- if (in_atomic() || irqs_disabled()) { -+ if (++current->migrate_disable == 1) { -+ this_rq()->nr_pinned++; -+ preempt_lazy_disable(); - #ifdef CONFIG_SCHED_DEBUG -- p->migrate_disable_atomic++; -+ WARN_ON_ONCE(current->pinned_on_cpu >= 0); -+ current->pinned_on_cpu = smp_processor_id(); - #endif -- return; -- } --#ifdef CONFIG_SCHED_DEBUG -- if (unlikely(p->migrate_disable_atomic)) { -- tracing_off(); -- WARN_ON_ONCE(1); - } --#endif - -- if (p->migrate_disable) { -- p->migrate_disable++; -- return; -- } -+ preempt_enable(); -+} -+EXPORT_SYMBOL(migrate_disable); - -- preempt_disable(); -- preempt_lazy_disable(); -- pin_current_cpu(); -+static void migrate_disabled_sched(struct task_struct *p) -+{ -+ if (p->migrate_disable_scheduled) -+ return; - - migrate_disable_update_cpus_allowed(p); -- p->migrate_disable = 1; -- -- preempt_enable(); -+ p->migrate_disable_scheduled = 1; - } --EXPORT_SYMBOL(migrate_disable); - - void migrate_enable(void) - { - struct task_struct *p = current; -- -- if (in_atomic() || irqs_disabled()) { --#ifdef CONFIG_SCHED_DEBUG -- p->migrate_disable_atomic--; --#endif -- return; -- } -- --#ifdef CONFIG_SCHED_DEBUG -- if (unlikely(p->migrate_disable_atomic)) { -- tracing_off(); -- WARN_ON_ONCE(1); -- } --#endif -+ struct rq *rq = this_rq(); -+ int cpu = task_cpu(p); - - WARN_ON_ONCE(p->migrate_disable <= 0); - if (p->migrate_disable > 1) { -@@ -7323,67 +7293,69 @@ void migrate_enable(void) - - preempt_disable(); - -+#ifdef CONFIG_SCHED_DEBUG -+ WARN_ON_ONCE(current->pinned_on_cpu != cpu); -+ current->pinned_on_cpu = -1; -+#endif -+ -+ WARN_ON_ONCE(rq->nr_pinned < 1); -+ - p->migrate_disable = 0; -+ rq->nr_pinned--; -+ if (rq->nr_pinned == 0 && unlikely(!cpu_active(cpu)) && -+ takedown_cpu_task) -+ wake_up_process(takedown_cpu_task); -+ -+ if (!p->migrate_disable_scheduled) -+ goto out; -+ -+ p->migrate_disable_scheduled = 0; -+ - migrate_enable_update_cpus_allowed(p); - -- if (p->migrate_disable_update) { -- struct rq *rq; -+ WARN_ON(smp_processor_id() != cpu); -+ if (!is_cpu_allowed(p, cpu)) { -+ struct migration_arg arg = { p }; - struct rq_flags rf; -- int cpu = task_cpu(p); - - rq = task_rq_lock(p, &rf); - update_rq_clock(rq); -- -- __do_set_cpus_allowed_tail(p, &p->cpus_mask); -+ arg.dest_cpu = select_fallback_rq(cpu, p); - task_rq_unlock(rq, p, &rf); - -- p->migrate_disable_update = 0; -- -- WARN_ON(smp_processor_id() != cpu); -- if (!cpumask_test_cpu(cpu, &p->cpus_mask)) { -- struct migration_arg arg = { p }; -- struct rq_flags rf; -+ preempt_lazy_enable(); -+ preempt_enable(); - -- rq = task_rq_lock(p, &rf); -- update_rq_clock(rq); -- arg.dest_cpu = select_fallback_rq(cpu, p); -- task_rq_unlock(rq, p, &rf); -- -- unpin_current_cpu(); -- preempt_lazy_enable(); -- preempt_enable(); -- -- sleeping_lock_inc(); -- stop_one_cpu(task_cpu(p), migration_cpu_stop, &arg); -- sleeping_lock_dec(); -- tlb_migrate_finish(p->mm); -+ sleeping_lock_inc(); -+ stop_one_cpu(task_cpu(p), migration_cpu_stop, &arg); -+ sleeping_lock_dec(); -+ tlb_migrate_finish(p->mm); - -- return; -- } -+ return; - } -- unpin_current_cpu(); -+ -+out: - preempt_lazy_enable(); - preempt_enable(); - } - EXPORT_SYMBOL(migrate_enable); - --#elif !defined(CONFIG_SMP) && defined(CONFIG_PREEMPT_RT_BASE) --void migrate_disable(void) -+int cpu_nr_pinned(int cpu) - { --#ifdef CONFIG_SCHED_DEBUG -- struct task_struct *p = current; -+ struct rq *rq = cpu_rq(cpu); - -- if (in_atomic() || irqs_disabled()) { -- p->migrate_disable_atomic++; -- return; -- } -+ return rq->nr_pinned; -+} - -- if (unlikely(p->migrate_disable_atomic)) { -- tracing_off(); -- WARN_ON_ONCE(1); -- } -+#elif !defined(CONFIG_SMP) && defined(CONFIG_PREEMPT_RT_BASE) -+static void migrate_disabled_sched(struct task_struct *p) -+{ -+} - -- p->migrate_disable++; -+void migrate_disable(void) -+{ -+#ifdef CONFIG_SCHED_DEBUG -+ current->migrate_disable++; - #endif - barrier(); - } -@@ -7394,20 +7366,14 @@ void migrate_enable(void) - #ifdef CONFIG_SCHED_DEBUG - struct task_struct *p = current; - -- if (in_atomic() || irqs_disabled()) { -- p->migrate_disable_atomic--; -- return; -- } -- -- if (unlikely(p->migrate_disable_atomic)) { -- tracing_off(); -- WARN_ON_ONCE(1); -- } -- - WARN_ON_ONCE(p->migrate_disable <= 0); - p->migrate_disable--; - #endif - barrier(); - } - EXPORT_SYMBOL(migrate_enable); -+#else -+static void migrate_disabled_sched(struct task_struct *p) -+{ -+} - #endif -diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h -index 87a05bb90124..45b3f135d205 100644 ---- a/kernel/sched/sched.h -+++ b/kernel/sched/sched.h -@@ -915,6 +915,10 @@ struct rq { - /* Must be inspected within a rcu lock section */ - struct cpuidle_state *idle_state; - #endif -+ -+#if defined(CONFIG_PREEMPT_RT_BASE) && defined(CONFIG_SMP) -+ int nr_pinned; -+#endif - }; - - static inline int cpu_of(struct rq *rq) -diff --git a/lib/smp_processor_id.c b/lib/smp_processor_id.c -index b8a8a8db2d75..0c80992aa337 100644 ---- a/lib/smp_processor_id.c -+++ b/lib/smp_processor_id.c -@@ -22,6 +22,9 @@ notrace static unsigned int check_preemption_disabled(const char *what1, - * Kernel threads bound to a single CPU can safely use - * smp_processor_id(): - */ -+ if (current->migrate_disable) -+ goto out; -+ - if (current->nr_cpus_allowed == 1) - goto out; - --- -2.36.1 - diff --git a/debian/patches-rt/0308-sched-migrate_enable-Use-stop_one_cpu_nowait.patch b/debian/patches-rt/0308-sched-migrate_enable-Use-stop_one_cpu_nowait.patch new file mode 100644 index 000000000..306caf6c4 --- /dev/null +++ b/debian/patches-rt/0308-sched-migrate_enable-Use-stop_one_cpu_nowait.patch @@ -0,0 +1,117 @@ +From: Scott Wood +Date: Sat, 12 Oct 2019 01:52:14 -0500 +Subject: [PATCH 308/342] sched: migrate_enable: Use stop_one_cpu_nowait() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=519fb3634f6b249f1ffe9e72c3df31ac00b7797e + +[ Upstream commit 6b39a1fa8c53cae08dc03afdae193b7d3a78a173 ] + +migrate_enable() can be called with current->state != TASK_RUNNING. +Avoid clobbering the existing state by using stop_one_cpu_nowait(). +Since we're stopping the current cpu, we know that we won't get +past __schedule() until migration_cpu_stop() has run (at least up to +the point of migrating us to another cpu). + +Signed-off-by: Scott Wood +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + include/linux/stop_machine.h | 2 ++ + kernel/sched/core.c | 23 +++++++++++++---------- + kernel/stop_machine.c | 7 +++++-- + 3 files changed, 20 insertions(+), 12 deletions(-) + +diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h +index ccdaa8fd5657..150e886ed83d 100644 +--- a/include/linux/stop_machine.h ++++ b/include/linux/stop_machine.h +@@ -26,6 +26,8 @@ struct cpu_stop_work { + cpu_stop_fn_t fn; + void *arg; + struct cpu_stop_done *done; ++ /* Did not run due to disabled stopper; for nowait debug checks */ ++ bool disabled; + }; + + int stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, void *arg); +diff --git a/kernel/sched/core.c b/kernel/sched/core.c +index de6514e13e0c..dff9d26a8625 100644 +--- a/kernel/sched/core.c ++++ b/kernel/sched/core.c +@@ -990,6 +990,7 @@ static struct rq *move_queued_task(struct rq *rq, struct rq_flags *rf, + struct migration_arg { + struct task_struct *task; + int dest_cpu; ++ bool done; + }; + + /* +@@ -1025,6 +1026,11 @@ static int migration_cpu_stop(void *data) + struct task_struct *p = arg->task; + struct rq *rq = this_rq(); + struct rq_flags rf; ++ int dest_cpu = arg->dest_cpu; ++ ++ /* We don't look at arg after this point. */ ++ smp_mb(); ++ arg->done = true; + + /* + * The original target CPU might have gone down and we might +@@ -1047,9 +1053,9 @@ static int migration_cpu_stop(void *data) + */ + if (task_rq(p) == rq) { + if (task_on_rq_queued(p)) +- rq = __migrate_task(rq, &rf, p, arg->dest_cpu); ++ rq = __migrate_task(rq, &rf, p, dest_cpu); + else +- p->wake_cpu = arg->dest_cpu; ++ p->wake_cpu = dest_cpu; + } + rq_unlock(rq, &rf); + raw_spin_unlock(&p->pi_lock); +@@ -7316,6 +7322,7 @@ void migrate_enable(void) + WARN_ON(smp_processor_id() != cpu); + if (!is_cpu_allowed(p, cpu)) { + struct migration_arg arg = { p }; ++ struct cpu_stop_work work; + struct rq_flags rf; + + rq = task_rq_lock(p, &rf); +@@ -7323,15 +7330,11 @@ void migrate_enable(void) + arg.dest_cpu = select_fallback_rq(cpu, p); + task_rq_unlock(rq, p, &rf); + +- preempt_lazy_enable(); +- preempt_enable(); +- +- sleeping_lock_inc(); +- stop_one_cpu(task_cpu(p), migration_cpu_stop, &arg); +- sleeping_lock_dec(); ++ stop_one_cpu_nowait(task_cpu(p), migration_cpu_stop, ++ &arg, &work); + tlb_migrate_finish(p->mm); +- +- return; ++ __schedule(true); ++ WARN_ON_ONCE(!arg.done && !work.disabled); + } + + out: +diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c +index 067cb83f37ea..2d15c0d50625 100644 +--- a/kernel/stop_machine.c ++++ b/kernel/stop_machine.c +@@ -86,8 +86,11 @@ static bool cpu_stop_queue_work(unsigned int cpu, struct cpu_stop_work *work) + enabled = stopper->enabled; + if (enabled) + __cpu_stop_queue_work(stopper, work, &wakeq); +- else if (work->done) +- cpu_stop_signal_done(work->done); ++ else { ++ work->disabled = true; ++ if (work->done) ++ cpu_stop_signal_done(work->done); ++ } + raw_spin_unlock_irqrestore(&stopper->lock, flags); + + wake_up_q(&wakeq); diff --git a/debian/patches-rt/0309-Revert-ARM-Initialize-split-page-table-locks-for-vec.patch b/debian/patches-rt/0309-Revert-ARM-Initialize-split-page-table-locks-for-vec.patch new file mode 100644 index 000000000..511698c42 --- /dev/null +++ b/debian/patches-rt/0309-Revert-ARM-Initialize-split-page-table-locks-for-vec.patch @@ -0,0 +1,83 @@ +From: Sebastian Andrzej Siewior +Date: Fri, 18 Oct 2019 13:04:15 +0200 +Subject: [PATCH 309/342] Revert "ARM: Initialize split page table locks for + vector page" +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=954608a19dde6afa6ee3fcbc50ad717c888a9050 + +[ Upstream commit 247074c44d8c3e619dfde6404a52295d8d671d38 ] + +I'm dropping this patch, with its original description: + +|ARM: Initialize split page table locks for vector page +| +|Without this patch, ARM can not use SPLIT_PTLOCK_CPUS if +|PREEMPT_RT_FULL=y because vectors_user_mapping() creates a +|VM_ALWAYSDUMP mapping of the vector page (address 0xffff0000), but no +|ptl->lock has been allocated for the page. An attempt to coredump +|that page will result in a kernel NULL pointer dereference when +|follow_page() attempts to lock the page. +| +|The call tree to the NULL pointer dereference is: +| +| do_notify_resume() +| get_signal_to_deliver() +| do_coredump() +| elf_core_dump() +| get_dump_page() +| __get_user_pages() +| follow_page() +| pte_offset_map_lock() <----- a #define +| ... +| rt_spin_lock() +| +|The underlying problem is exposed by mm-shrink-the-page-frame-to-rt-size.patch. + +The patch named mm-shrink-the-page-frame-to-rt-size.patch was dropped +from the RT queue once the SPLIT_PTLOCK_CPUS feature (in a slightly +different shape) went upstream (somewhere between v3.12 and v3.14). + +I can see that the patch still allocates a lock which wasn't there +before. However I can't trigger a kernel oops like described in the +patch by triggering a coredump. + +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + arch/arm/kernel/process.c | 24 ------------------------ + 1 file changed, 24 deletions(-) + +diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c +index 8d3c7ce34c24..82ab015bf42b 100644 +--- a/arch/arm/kernel/process.c ++++ b/arch/arm/kernel/process.c +@@ -324,30 +324,6 @@ unsigned long arch_randomize_brk(struct mm_struct *mm) + } + + #ifdef CONFIG_MMU +-/* +- * CONFIG_SPLIT_PTLOCK_CPUS results in a page->ptl lock. If the lock is not +- * initialized by pgtable_page_ctor() then a coredump of the vector page will +- * fail. +- */ +-static int __init vectors_user_mapping_init_page(void) +-{ +- struct page *page; +- unsigned long addr = 0xffff0000; +- pgd_t *pgd; +- pud_t *pud; +- pmd_t *pmd; +- +- pgd = pgd_offset_k(addr); +- pud = pud_offset(pgd, addr); +- pmd = pmd_offset(pud, addr); +- page = pmd_page(*(pmd)); +- +- pgtable_page_ctor(page); +- +- return 0; +-} +-late_initcall(vectors_user_mapping_init_page); +- + #ifdef CONFIG_KUSER_HELPERS + /* + * The vectors page is always readable from user space for the diff --git a/debian/patches-rt/0309-sched-migrate_enable-Use-stop_one_cpu_nowait.patch b/debian/patches-rt/0309-sched-migrate_enable-Use-stop_one_cpu_nowait.patch deleted file mode 100644 index 21108241b..000000000 --- a/debian/patches-rt/0309-sched-migrate_enable-Use-stop_one_cpu_nowait.patch +++ /dev/null @@ -1,121 +0,0 @@ -From 778702cffc4e8e3f002716b84944ddf23692639f Mon Sep 17 00:00:00 2001 -From: Scott Wood -Date: Sat, 12 Oct 2019 01:52:14 -0500 -Subject: [PATCH 309/347] sched: migrate_enable: Use stop_one_cpu_nowait() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 6b39a1fa8c53cae08dc03afdae193b7d3a78a173 ] - -migrate_enable() can be called with current->state != TASK_RUNNING. -Avoid clobbering the existing state by using stop_one_cpu_nowait(). -Since we're stopping the current cpu, we know that we won't get -past __schedule() until migration_cpu_stop() has run (at least up to -the point of migrating us to another cpu). - -Signed-off-by: Scott Wood -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - include/linux/stop_machine.h | 2 ++ - kernel/sched/core.c | 23 +++++++++++++---------- - kernel/stop_machine.c | 7 +++++-- - 3 files changed, 20 insertions(+), 12 deletions(-) - -diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h -index ccdaa8fd5657..150e886ed83d 100644 ---- a/include/linux/stop_machine.h -+++ b/include/linux/stop_machine.h -@@ -26,6 +26,8 @@ struct cpu_stop_work { - cpu_stop_fn_t fn; - void *arg; - struct cpu_stop_done *done; -+ /* Did not run due to disabled stopper; for nowait debug checks */ -+ bool disabled; - }; - - int stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, void *arg); -diff --git a/kernel/sched/core.c b/kernel/sched/core.c -index de6514e13e0c..dff9d26a8625 100644 ---- a/kernel/sched/core.c -+++ b/kernel/sched/core.c -@@ -990,6 +990,7 @@ static struct rq *move_queued_task(struct rq *rq, struct rq_flags *rf, - struct migration_arg { - struct task_struct *task; - int dest_cpu; -+ bool done; - }; - - /* -@@ -1025,6 +1026,11 @@ static int migration_cpu_stop(void *data) - struct task_struct *p = arg->task; - struct rq *rq = this_rq(); - struct rq_flags rf; -+ int dest_cpu = arg->dest_cpu; -+ -+ /* We don't look at arg after this point. */ -+ smp_mb(); -+ arg->done = true; - - /* - * The original target CPU might have gone down and we might -@@ -1047,9 +1053,9 @@ static int migration_cpu_stop(void *data) - */ - if (task_rq(p) == rq) { - if (task_on_rq_queued(p)) -- rq = __migrate_task(rq, &rf, p, arg->dest_cpu); -+ rq = __migrate_task(rq, &rf, p, dest_cpu); - else -- p->wake_cpu = arg->dest_cpu; -+ p->wake_cpu = dest_cpu; - } - rq_unlock(rq, &rf); - raw_spin_unlock(&p->pi_lock); -@@ -7316,6 +7322,7 @@ void migrate_enable(void) - WARN_ON(smp_processor_id() != cpu); - if (!is_cpu_allowed(p, cpu)) { - struct migration_arg arg = { p }; -+ struct cpu_stop_work work; - struct rq_flags rf; - - rq = task_rq_lock(p, &rf); -@@ -7323,15 +7330,11 @@ void migrate_enable(void) - arg.dest_cpu = select_fallback_rq(cpu, p); - task_rq_unlock(rq, p, &rf); - -- preempt_lazy_enable(); -- preempt_enable(); -- -- sleeping_lock_inc(); -- stop_one_cpu(task_cpu(p), migration_cpu_stop, &arg); -- sleeping_lock_dec(); -+ stop_one_cpu_nowait(task_cpu(p), migration_cpu_stop, -+ &arg, &work); - tlb_migrate_finish(p->mm); -- -- return; -+ __schedule(true); -+ WARN_ON_ONCE(!arg.done && !work.disabled); - } - - out: -diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c -index 067cb83f37ea..2d15c0d50625 100644 ---- a/kernel/stop_machine.c -+++ b/kernel/stop_machine.c -@@ -86,8 +86,11 @@ static bool cpu_stop_queue_work(unsigned int cpu, struct cpu_stop_work *work) - enabled = stopper->enabled; - if (enabled) - __cpu_stop_queue_work(stopper, work, &wakeq); -- else if (work->done) -- cpu_stop_signal_done(work->done); -+ else { -+ work->disabled = true; -+ if (work->done) -+ cpu_stop_signal_done(work->done); -+ } - raw_spin_unlock_irqrestore(&stopper->lock, flags); - - wake_up_q(&wakeq); --- -2.36.1 - diff --git a/debian/patches-rt/0310-Revert-ARM-Initialize-split-page-table-locks-for-vec.patch b/debian/patches-rt/0310-Revert-ARM-Initialize-split-page-table-locks-for-vec.patch deleted file mode 100644 index 92464be91..000000000 --- a/debian/patches-rt/0310-Revert-ARM-Initialize-split-page-table-locks-for-vec.patch +++ /dev/null @@ -1,87 +0,0 @@ -From 24329bb57c5b6fae2c3360adcb2c69bbcd4314f4 Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Fri, 18 Oct 2019 13:04:15 +0200 -Subject: [PATCH 310/347] Revert "ARM: Initialize split page table locks for - vector page" -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 247074c44d8c3e619dfde6404a52295d8d671d38 ] - -I'm dropping this patch, with its original description: - -|ARM: Initialize split page table locks for vector page -| -|Without this patch, ARM can not use SPLIT_PTLOCK_CPUS if -|PREEMPT_RT_FULL=y because vectors_user_mapping() creates a -|VM_ALWAYSDUMP mapping of the vector page (address 0xffff0000), but no -|ptl->lock has been allocated for the page. An attempt to coredump -|that page will result in a kernel NULL pointer dereference when -|follow_page() attempts to lock the page. -| -|The call tree to the NULL pointer dereference is: -| -| do_notify_resume() -| get_signal_to_deliver() -| do_coredump() -| elf_core_dump() -| get_dump_page() -| __get_user_pages() -| follow_page() -| pte_offset_map_lock() <----- a #define -| ... -| rt_spin_lock() -| -|The underlying problem is exposed by mm-shrink-the-page-frame-to-rt-size.patch. - -The patch named mm-shrink-the-page-frame-to-rt-size.patch was dropped -from the RT queue once the SPLIT_PTLOCK_CPUS feature (in a slightly -different shape) went upstream (somewhere between v3.12 and v3.14). - -I can see that the patch still allocates a lock which wasn't there -before. However I can't trigger a kernel oops like described in the -patch by triggering a coredump. - -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - arch/arm/kernel/process.c | 24 ------------------------ - 1 file changed, 24 deletions(-) - -diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c -index 8d3c7ce34c24..82ab015bf42b 100644 ---- a/arch/arm/kernel/process.c -+++ b/arch/arm/kernel/process.c -@@ -324,30 +324,6 @@ unsigned long arch_randomize_brk(struct mm_struct *mm) - } - - #ifdef CONFIG_MMU --/* -- * CONFIG_SPLIT_PTLOCK_CPUS results in a page->ptl lock. If the lock is not -- * initialized by pgtable_page_ctor() then a coredump of the vector page will -- * fail. -- */ --static int __init vectors_user_mapping_init_page(void) --{ -- struct page *page; -- unsigned long addr = 0xffff0000; -- pgd_t *pgd; -- pud_t *pud; -- pmd_t *pmd; -- -- pgd = pgd_offset_k(addr); -- pud = pud_offset(pgd, addr); -- pmd = pmd_offset(pud, addr); -- page = pmd_page(*(pmd)); -- -- pgtable_page_ctor(page); -- -- return 0; --} --late_initcall(vectors_user_mapping_init_page); -- - #ifdef CONFIG_KUSER_HELPERS - /* - * The vectors page is always readable from user space for the --- -2.36.1 - diff --git a/debian/patches-rt/0310-locking-Make-spinlock_t-and-rwlock_t-a-RCU-section-o.patch b/debian/patches-rt/0310-locking-Make-spinlock_t-and-rwlock_t-a-RCU-section-o.patch new file mode 100644 index 000000000..fa066cce6 --- /dev/null +++ b/debian/patches-rt/0310-locking-Make-spinlock_t-and-rwlock_t-a-RCU-section-o.patch @@ -0,0 +1,125 @@ +From: Sebastian Andrzej Siewior +Date: Tue, 19 Nov 2019 09:25:04 +0100 +Subject: [PATCH 310/342] locking: Make spinlock_t and rwlock_t a RCU section + on RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=5a4cb6344d94ce566d562e036d4fd69ead0338f3 + +[ Upstream commit 84440022a0e1c8c936d61f8f97593674a295d409 ] + +On !RT a locked spinlock_t and rwlock_t disables preemption which +implies a RCU read section. There is code that relies on that behaviour. + +Add an explicit RCU read section on RT while a sleeping lock (a lock +which would disables preemption on !RT) acquired. + +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + kernel/locking/rtmutex.c | 6 ++++++ + kernel/locking/rwlock-rt.c | 6 ++++++ + 2 files changed, 12 insertions(+) + +diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c +index dc95a81ae3a6..fe5153fc7665 100644 +--- a/kernel/locking/rtmutex.c ++++ b/kernel/locking/rtmutex.c +@@ -1142,6 +1142,7 @@ void __sched rt_spin_lock_slowunlock(struct rt_mutex *lock) + void __lockfunc rt_spin_lock(spinlock_t *lock) + { + sleeping_lock_inc(); ++ rcu_read_lock(); + migrate_disable(); + spin_acquire(&lock->dep_map, 0, 0, _RET_IP_); + rt_spin_lock_fastlock(&lock->lock, rt_spin_lock_slowlock); +@@ -1157,6 +1158,7 @@ void __lockfunc __rt_spin_lock(struct rt_mutex *lock) + void __lockfunc rt_spin_lock_nested(spinlock_t *lock, int subclass) + { + sleeping_lock_inc(); ++ rcu_read_lock(); + migrate_disable(); + spin_acquire(&lock->dep_map, subclass, 0, _RET_IP_); + rt_spin_lock_fastlock(&lock->lock, rt_spin_lock_slowlock); +@@ -1170,6 +1172,7 @@ void __lockfunc rt_spin_unlock(spinlock_t *lock) + spin_release(&lock->dep_map, 1, _RET_IP_); + rt_spin_lock_fastunlock(&lock->lock, rt_spin_lock_slowunlock); + migrate_enable(); ++ rcu_read_unlock(); + sleeping_lock_dec(); + } + EXPORT_SYMBOL(rt_spin_unlock); +@@ -1201,6 +1204,7 @@ int __lockfunc rt_spin_trylock(spinlock_t *lock) + ret = __rt_mutex_trylock(&lock->lock); + if (ret) { + spin_acquire(&lock->dep_map, 0, 1, _RET_IP_); ++ rcu_read_lock(); + } else { + migrate_enable(); + sleeping_lock_dec(); +@@ -1217,6 +1221,7 @@ int __lockfunc rt_spin_trylock_bh(spinlock_t *lock) + ret = __rt_mutex_trylock(&lock->lock); + if (ret) { + sleeping_lock_inc(); ++ rcu_read_lock(); + migrate_disable(); + spin_acquire(&lock->dep_map, 0, 1, _RET_IP_); + } else +@@ -1233,6 +1238,7 @@ int __lockfunc rt_spin_trylock_irqsave(spinlock_t *lock, unsigned long *flags) + ret = __rt_mutex_trylock(&lock->lock); + if (ret) { + sleeping_lock_inc(); ++ rcu_read_lock(); + migrate_disable(); + spin_acquire(&lock->dep_map, 0, 1, _RET_IP_); + } +diff --git a/kernel/locking/rwlock-rt.c b/kernel/locking/rwlock-rt.c +index c3b91205161c..0ae8c62ea832 100644 +--- a/kernel/locking/rwlock-rt.c ++++ b/kernel/locking/rwlock-rt.c +@@ -310,6 +310,7 @@ int __lockfunc rt_read_trylock(rwlock_t *rwlock) + ret = do_read_rt_trylock(rwlock); + if (ret) { + rwlock_acquire_read(&rwlock->dep_map, 0, 1, _RET_IP_); ++ rcu_read_lock(); + } else { + migrate_enable(); + sleeping_lock_dec(); +@@ -327,6 +328,7 @@ int __lockfunc rt_write_trylock(rwlock_t *rwlock) + ret = do_write_rt_trylock(rwlock); + if (ret) { + rwlock_acquire(&rwlock->dep_map, 0, 1, _RET_IP_); ++ rcu_read_lock(); + } else { + migrate_enable(); + sleeping_lock_dec(); +@@ -338,6 +340,7 @@ EXPORT_SYMBOL(rt_write_trylock); + void __lockfunc rt_read_lock(rwlock_t *rwlock) + { + sleeping_lock_inc(); ++ rcu_read_lock(); + migrate_disable(); + rwlock_acquire_read(&rwlock->dep_map, 0, 0, _RET_IP_); + do_read_rt_lock(rwlock); +@@ -347,6 +350,7 @@ EXPORT_SYMBOL(rt_read_lock); + void __lockfunc rt_write_lock(rwlock_t *rwlock) + { + sleeping_lock_inc(); ++ rcu_read_lock(); + migrate_disable(); + rwlock_acquire(&rwlock->dep_map, 0, 0, _RET_IP_); + do_write_rt_lock(rwlock); +@@ -358,6 +362,7 @@ void __lockfunc rt_read_unlock(rwlock_t *rwlock) + rwlock_release(&rwlock->dep_map, 1, _RET_IP_); + do_read_rt_unlock(rwlock); + migrate_enable(); ++ rcu_read_unlock(); + sleeping_lock_dec(); + } + EXPORT_SYMBOL(rt_read_unlock); +@@ -367,6 +372,7 @@ void __lockfunc rt_write_unlock(rwlock_t *rwlock) + rwlock_release(&rwlock->dep_map, 1, _RET_IP_); + do_write_rt_unlock(rwlock); + migrate_enable(); ++ rcu_read_unlock(); + sleeping_lock_dec(); + } + EXPORT_SYMBOL(rt_write_unlock); diff --git a/debian/patches-rt/0311-locking-Make-spinlock_t-and-rwlock_t-a-RCU-section-o.patch b/debian/patches-rt/0311-locking-Make-spinlock_t-and-rwlock_t-a-RCU-section-o.patch deleted file mode 100644 index b6096f1c2..000000000 --- a/debian/patches-rt/0311-locking-Make-spinlock_t-and-rwlock_t-a-RCU-section-o.patch +++ /dev/null @@ -1,129 +0,0 @@ -From c0b7b36cdce411ac0992029c343d9fb8eb65c305 Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Tue, 19 Nov 2019 09:25:04 +0100 -Subject: [PATCH 311/347] locking: Make spinlock_t and rwlock_t a RCU section - on RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 84440022a0e1c8c936d61f8f97593674a295d409 ] - -On !RT a locked spinlock_t and rwlock_t disables preemption which -implies a RCU read section. There is code that relies on that behaviour. - -Add an explicit RCU read section on RT while a sleeping lock (a lock -which would disables preemption on !RT) acquired. - -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - kernel/locking/rtmutex.c | 6 ++++++ - kernel/locking/rwlock-rt.c | 6 ++++++ - 2 files changed, 12 insertions(+) - -diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c -index dc95a81ae3a6..fe5153fc7665 100644 ---- a/kernel/locking/rtmutex.c -+++ b/kernel/locking/rtmutex.c -@@ -1142,6 +1142,7 @@ void __sched rt_spin_lock_slowunlock(struct rt_mutex *lock) - void __lockfunc rt_spin_lock(spinlock_t *lock) - { - sleeping_lock_inc(); -+ rcu_read_lock(); - migrate_disable(); - spin_acquire(&lock->dep_map, 0, 0, _RET_IP_); - rt_spin_lock_fastlock(&lock->lock, rt_spin_lock_slowlock); -@@ -1157,6 +1158,7 @@ void __lockfunc __rt_spin_lock(struct rt_mutex *lock) - void __lockfunc rt_spin_lock_nested(spinlock_t *lock, int subclass) - { - sleeping_lock_inc(); -+ rcu_read_lock(); - migrate_disable(); - spin_acquire(&lock->dep_map, subclass, 0, _RET_IP_); - rt_spin_lock_fastlock(&lock->lock, rt_spin_lock_slowlock); -@@ -1170,6 +1172,7 @@ void __lockfunc rt_spin_unlock(spinlock_t *lock) - spin_release(&lock->dep_map, 1, _RET_IP_); - rt_spin_lock_fastunlock(&lock->lock, rt_spin_lock_slowunlock); - migrate_enable(); -+ rcu_read_unlock(); - sleeping_lock_dec(); - } - EXPORT_SYMBOL(rt_spin_unlock); -@@ -1201,6 +1204,7 @@ int __lockfunc rt_spin_trylock(spinlock_t *lock) - ret = __rt_mutex_trylock(&lock->lock); - if (ret) { - spin_acquire(&lock->dep_map, 0, 1, _RET_IP_); -+ rcu_read_lock(); - } else { - migrate_enable(); - sleeping_lock_dec(); -@@ -1217,6 +1221,7 @@ int __lockfunc rt_spin_trylock_bh(spinlock_t *lock) - ret = __rt_mutex_trylock(&lock->lock); - if (ret) { - sleeping_lock_inc(); -+ rcu_read_lock(); - migrate_disable(); - spin_acquire(&lock->dep_map, 0, 1, _RET_IP_); - } else -@@ -1233,6 +1238,7 @@ int __lockfunc rt_spin_trylock_irqsave(spinlock_t *lock, unsigned long *flags) - ret = __rt_mutex_trylock(&lock->lock); - if (ret) { - sleeping_lock_inc(); -+ rcu_read_lock(); - migrate_disable(); - spin_acquire(&lock->dep_map, 0, 1, _RET_IP_); - } -diff --git a/kernel/locking/rwlock-rt.c b/kernel/locking/rwlock-rt.c -index c3b91205161c..0ae8c62ea832 100644 ---- a/kernel/locking/rwlock-rt.c -+++ b/kernel/locking/rwlock-rt.c -@@ -310,6 +310,7 @@ int __lockfunc rt_read_trylock(rwlock_t *rwlock) - ret = do_read_rt_trylock(rwlock); - if (ret) { - rwlock_acquire_read(&rwlock->dep_map, 0, 1, _RET_IP_); -+ rcu_read_lock(); - } else { - migrate_enable(); - sleeping_lock_dec(); -@@ -327,6 +328,7 @@ int __lockfunc rt_write_trylock(rwlock_t *rwlock) - ret = do_write_rt_trylock(rwlock); - if (ret) { - rwlock_acquire(&rwlock->dep_map, 0, 1, _RET_IP_); -+ rcu_read_lock(); - } else { - migrate_enable(); - sleeping_lock_dec(); -@@ -338,6 +340,7 @@ EXPORT_SYMBOL(rt_write_trylock); - void __lockfunc rt_read_lock(rwlock_t *rwlock) - { - sleeping_lock_inc(); -+ rcu_read_lock(); - migrate_disable(); - rwlock_acquire_read(&rwlock->dep_map, 0, 0, _RET_IP_); - do_read_rt_lock(rwlock); -@@ -347,6 +350,7 @@ EXPORT_SYMBOL(rt_read_lock); - void __lockfunc rt_write_lock(rwlock_t *rwlock) - { - sleeping_lock_inc(); -+ rcu_read_lock(); - migrate_disable(); - rwlock_acquire(&rwlock->dep_map, 0, 0, _RET_IP_); - do_write_rt_lock(rwlock); -@@ -358,6 +362,7 @@ void __lockfunc rt_read_unlock(rwlock_t *rwlock) - rwlock_release(&rwlock->dep_map, 1, _RET_IP_); - do_read_rt_unlock(rwlock); - migrate_enable(); -+ rcu_read_unlock(); - sleeping_lock_dec(); - } - EXPORT_SYMBOL(rt_read_unlock); -@@ -367,6 +372,7 @@ void __lockfunc rt_write_unlock(rwlock_t *rwlock) - rwlock_release(&rwlock->dep_map, 1, _RET_IP_); - do_write_rt_unlock(rwlock); - migrate_enable(); -+ rcu_read_unlock(); - sleeping_lock_dec(); - } - EXPORT_SYMBOL(rt_write_unlock); --- -2.36.1 - diff --git a/debian/patches-rt/0311-sched-core-migrate_enable-must-access-takedown_cpu_t.patch b/debian/patches-rt/0311-sched-core-migrate_enable-must-access-takedown_cpu_t.patch new file mode 100644 index 000000000..b616edaed --- /dev/null +++ b/debian/patches-rt/0311-sched-core-migrate_enable-must-access-takedown_cpu_t.patch @@ -0,0 +1,51 @@ +From: Sebastian Andrzej Siewior +Date: Fri, 29 Nov 2019 17:24:55 +0100 +Subject: [PATCH 311/342] sched/core: migrate_enable() must access + takedown_cpu_task on !HOTPLUG_CPU +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=ea00648e17779a1d2d3f7f21bcc8f1d0455f20d4 + +[ Upstream commit a61d1977f692e46bad99a100f264981ba08cb4bd ] + +The variable takedown_cpu_task is never declared/used on !HOTPLUG_CPU +except for migrate_enable(). This leads to a link error. + +Don't use takedown_cpu_task in !HOTPLUG_CPU. + +Reported-by: Dick Hollenbeck +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + kernel/cpu.c | 2 ++ + kernel/sched/core.c | 2 ++ + 2 files changed, 4 insertions(+) + +diff --git a/kernel/cpu.c b/kernel/cpu.c +index f603ea80af2e..57bd32c83c9e 100644 +--- a/kernel/cpu.c ++++ b/kernel/cpu.c +@@ -913,7 +913,9 @@ static int take_cpu_down(void *_param) + return 0; + } + ++#ifdef CONFIG_PREEMPT_RT_BASE + struct task_struct *takedown_cpu_task; ++#endif + + static int takedown_cpu(unsigned int cpu) + { +diff --git a/kernel/sched/core.c b/kernel/sched/core.c +index dff9d26a8625..270adb525d93 100644 +--- a/kernel/sched/core.c ++++ b/kernel/sched/core.c +@@ -7308,9 +7308,11 @@ void migrate_enable(void) + + p->migrate_disable = 0; + rq->nr_pinned--; ++#ifdef CONFIG_HOTPLUG_CPU + if (rq->nr_pinned == 0 && unlikely(!cpu_active(cpu)) && + takedown_cpu_task) + wake_up_process(takedown_cpu_task); ++#endif + + if (!p->migrate_disable_scheduled) + goto out; diff --git a/debian/patches-rt/0312-lib-smp_processor_id-Adjust-check_preemption_disable.patch b/debian/patches-rt/0312-lib-smp_processor_id-Adjust-check_preemption_disable.patch new file mode 100644 index 000000000..106756de0 --- /dev/null +++ b/debian/patches-rt/0312-lib-smp_processor_id-Adjust-check_preemption_disable.patch @@ -0,0 +1,37 @@ +From: Daniel Wagner +Date: Mon, 16 Dec 2019 16:15:57 +0100 +Subject: [PATCH 312/342] lib/smp_processor_id: Adjust + check_preemption_disabled() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=8234196f578cabadf98da643b83e2904de6a2ef4 + +[ Upstream commit af3c1c5fdf177870fb5e6e16b24e374696ab28f5 ] + +The current->migrate_disable counter is not always defined leading to +build failures with DEBUG_PREEMPT && !PREEMPT_RT_BASE. + +Restrict the access to ->migrate_disable to same set where +->migrate_disable is modified. + +Signed-off-by: Daniel Wagner +Signed-off-by: Steven Rostedt (VMware) +[bigeasy: adjust condition + description] +Signed-off-by: Sebastian Andrzej Siewior +--- + lib/smp_processor_id.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/lib/smp_processor_id.c b/lib/smp_processor_id.c +index 0c80992aa337..2e7398534b66 100644 +--- a/lib/smp_processor_id.c ++++ b/lib/smp_processor_id.c +@@ -22,8 +22,10 @@ notrace static unsigned int check_preemption_disabled(const char *what1, + * Kernel threads bound to a single CPU can safely use + * smp_processor_id(): + */ ++#if defined(CONFIG_PREEMPT_RT_BASE) && (defined(CONFIG_SMP) || defined(CONFIG_SCHED_DEBUG)) + if (current->migrate_disable) + goto out; ++#endif + + if (current->nr_cpus_allowed == 1) + goto out; diff --git a/debian/patches-rt/0312-sched-core-migrate_enable-must-access-takedown_cpu_t.patch b/debian/patches-rt/0312-sched-core-migrate_enable-must-access-takedown_cpu_t.patch deleted file mode 100644 index 2132d259a..000000000 --- a/debian/patches-rt/0312-sched-core-migrate_enable-must-access-takedown_cpu_t.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 01f24622e993de73c028f4eaa067c421e4e0d851 Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Fri, 29 Nov 2019 17:24:55 +0100 -Subject: [PATCH 312/347] sched/core: migrate_enable() must access - takedown_cpu_task on !HOTPLUG_CPU -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit a61d1977f692e46bad99a100f264981ba08cb4bd ] - -The variable takedown_cpu_task is never declared/used on !HOTPLUG_CPU -except for migrate_enable(). This leads to a link error. - -Don't use takedown_cpu_task in !HOTPLUG_CPU. - -Reported-by: Dick Hollenbeck -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - kernel/cpu.c | 2 ++ - kernel/sched/core.c | 2 ++ - 2 files changed, 4 insertions(+) - -diff --git a/kernel/cpu.c b/kernel/cpu.c -index edd4fd8da726..44245b35c09c 100644 ---- a/kernel/cpu.c -+++ b/kernel/cpu.c -@@ -912,7 +912,9 @@ static int take_cpu_down(void *_param) - return 0; - } - -+#ifdef CONFIG_PREEMPT_RT_BASE - struct task_struct *takedown_cpu_task; -+#endif - - static int takedown_cpu(unsigned int cpu) - { -diff --git a/kernel/sched/core.c b/kernel/sched/core.c -index dff9d26a8625..270adb525d93 100644 ---- a/kernel/sched/core.c -+++ b/kernel/sched/core.c -@@ -7308,9 +7308,11 @@ void migrate_enable(void) - - p->migrate_disable = 0; - rq->nr_pinned--; -+#ifdef CONFIG_HOTPLUG_CPU - if (rq->nr_pinned == 0 && unlikely(!cpu_active(cpu)) && - takedown_cpu_task) - wake_up_process(takedown_cpu_task); -+#endif - - if (!p->migrate_disable_scheduled) - goto out; --- -2.36.1 - diff --git a/debian/patches-rt/0313-lib-smp_processor_id-Adjust-check_preemption_disable.patch b/debian/patches-rt/0313-lib-smp_processor_id-Adjust-check_preemption_disable.patch deleted file mode 100644 index 54602a05d..000000000 --- a/debian/patches-rt/0313-lib-smp_processor_id-Adjust-check_preemption_disable.patch +++ /dev/null @@ -1,41 +0,0 @@ -From d66acdc1d09f10c3141286072a6c07ec47245926 Mon Sep 17 00:00:00 2001 -From: Daniel Wagner -Date: Mon, 16 Dec 2019 16:15:57 +0100 -Subject: [PATCH 313/347] lib/smp_processor_id: Adjust - check_preemption_disabled() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit af3c1c5fdf177870fb5e6e16b24e374696ab28f5 ] - -The current->migrate_disable counter is not always defined leading to -build failures with DEBUG_PREEMPT && !PREEMPT_RT_BASE. - -Restrict the access to ->migrate_disable to same set where -->migrate_disable is modified. - -Signed-off-by: Daniel Wagner -Signed-off-by: Steven Rostedt (VMware) -[bigeasy: adjust condition + description] -Signed-off-by: Sebastian Andrzej Siewior ---- - lib/smp_processor_id.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/lib/smp_processor_id.c b/lib/smp_processor_id.c -index 0c80992aa337..2e7398534b66 100644 ---- a/lib/smp_processor_id.c -+++ b/lib/smp_processor_id.c -@@ -22,8 +22,10 @@ notrace static unsigned int check_preemption_disabled(const char *what1, - * Kernel threads bound to a single CPU can safely use - * smp_processor_id(): - */ -+#if defined(CONFIG_PREEMPT_RT_BASE) && (defined(CONFIG_SMP) || defined(CONFIG_SCHED_DEBUG)) - if (current->migrate_disable) - goto out; -+#endif - - if (current->nr_cpus_allowed == 1) - goto out; --- -2.36.1 - diff --git a/debian/patches-rt/0313-sched-migrate_enable-Busy-loop-until-the-migration-r.patch b/debian/patches-rt/0313-sched-migrate_enable-Busy-loop-until-the-migration-r.patch new file mode 100644 index 000000000..fc1b7bd92 --- /dev/null +++ b/debian/patches-rt/0313-sched-migrate_enable-Busy-loop-until-the-migration-r.patch @@ -0,0 +1,53 @@ +From: Sebastian Andrzej Siewior +Date: Thu, 12 Dec 2019 10:53:59 +0100 +Subject: [PATCH 313/342] sched: migrate_enable: Busy loop until the migration + request is completed +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=f1f1be8e83c25527d3890d98c6e176bd41c63562 + +[ Upstream commit 140d7f54a5fff02898d2ca9802b39548bf7455f1 ] + +If user task changes the CPU affinity mask of a running task it will +dispatch migration request if the current CPU is no longer allowed. This +might happen shortly before a task enters a migrate_disable() section. +Upon leaving the migrate_disable() section, the task will notice that +the current CPU is no longer allowed and will will dispatch its own +migration request to move it off the current CPU. +While invoking __schedule() the first migration request will be +processed and the task returns on the "new" CPU with "arg.done = 0". Its +own migration request will be processed shortly after and will result in +memory corruption if the stack memory, designed for request, was used +otherwise in the meantime. + +Spin until the migration request has been processed if it was accepted. + +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + kernel/sched/core.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/kernel/sched/core.c b/kernel/sched/core.c +index 270adb525d93..d190d9e6b10f 100644 +--- a/kernel/sched/core.c ++++ b/kernel/sched/core.c +@@ -7323,7 +7323,7 @@ void migrate_enable(void) + + WARN_ON(smp_processor_id() != cpu); + if (!is_cpu_allowed(p, cpu)) { +- struct migration_arg arg = { p }; ++ struct migration_arg arg = { .task = p }; + struct cpu_stop_work work; + struct rq_flags rf; + +@@ -7336,7 +7336,10 @@ void migrate_enable(void) + &arg, &work); + tlb_migrate_finish(p->mm); + __schedule(true); +- WARN_ON_ONCE(!arg.done && !work.disabled); ++ if (!work.disabled) { ++ while (!arg.done) ++ cpu_relax(); ++ } + } + + out: diff --git a/debian/patches-rt/0314-sched-migrate_enable-Busy-loop-until-the-migration-r.patch b/debian/patches-rt/0314-sched-migrate_enable-Busy-loop-until-the-migration-r.patch deleted file mode 100644 index d51c9b637..000000000 --- a/debian/patches-rt/0314-sched-migrate_enable-Busy-loop-until-the-migration-r.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 090c26864ec17b496dea3397656b006550e31852 Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Thu, 12 Dec 2019 10:53:59 +0100 -Subject: [PATCH 314/347] sched: migrate_enable: Busy loop until the migration - request is completed -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 140d7f54a5fff02898d2ca9802b39548bf7455f1 ] - -If user task changes the CPU affinity mask of a running task it will -dispatch migration request if the current CPU is no longer allowed. This -might happen shortly before a task enters a migrate_disable() section. -Upon leaving the migrate_disable() section, the task will notice that -the current CPU is no longer allowed and will will dispatch its own -migration request to move it off the current CPU. -While invoking __schedule() the first migration request will be -processed and the task returns on the "new" CPU with "arg.done = 0". Its -own migration request will be processed shortly after and will result in -memory corruption if the stack memory, designed for request, was used -otherwise in the meantime. - -Spin until the migration request has been processed if it was accepted. - -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - kernel/sched/core.c | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -diff --git a/kernel/sched/core.c b/kernel/sched/core.c -index 270adb525d93..d190d9e6b10f 100644 ---- a/kernel/sched/core.c -+++ b/kernel/sched/core.c -@@ -7323,7 +7323,7 @@ void migrate_enable(void) - - WARN_ON(smp_processor_id() != cpu); - if (!is_cpu_allowed(p, cpu)) { -- struct migration_arg arg = { p }; -+ struct migration_arg arg = { .task = p }; - struct cpu_stop_work work; - struct rq_flags rf; - -@@ -7336,7 +7336,10 @@ void migrate_enable(void) - &arg, &work); - tlb_migrate_finish(p->mm); - __schedule(true); -- WARN_ON_ONCE(!arg.done && !work.disabled); -+ if (!work.disabled) { -+ while (!arg.done) -+ cpu_relax(); -+ } - } - - out: --- -2.36.1 - diff --git a/debian/patches-rt/0314-userfaultfd-Use-a-seqlock-instead-of-seqcount.patch b/debian/patches-rt/0314-userfaultfd-Use-a-seqlock-instead-of-seqcount.patch new file mode 100644 index 000000000..89cafe5b9 --- /dev/null +++ b/debian/patches-rt/0314-userfaultfd-Use-a-seqlock-instead-of-seqcount.patch @@ -0,0 +1,76 @@ +From: Sebastian Andrzej Siewior +Date: Wed, 18 Dec 2019 12:25:09 +0100 +Subject: [PATCH 314/342] userfaultfd: Use a seqlock instead of seqcount +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=3691ae6ce62505ebd9eaf9e6589a857b5eb5e4ea + +[ Upstream commit dc952a564d02997330654be9628bbe97ba2a05d3 ] + +On RT write_seqcount_begin() disables preemption which leads to warning +in add_wait_queue() while the spinlock_t is acquired. +The waitqueue can't be converted to swait_queue because +userfaultfd_wake_function() is used as a custom wake function. + +Use seqlock instead seqcount to avoid the preempt_disable() section +during add_wait_queue(). + +Cc: stable-rt@vger.kernel.org +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + fs/userfaultfd.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c +index 23c8efc967af..3f79609511da 100644 +--- a/fs/userfaultfd.c ++++ b/fs/userfaultfd.c +@@ -56,7 +56,7 @@ struct userfaultfd_ctx { + /* waitqueue head for events */ + wait_queue_head_t event_wqh; + /* a refile sequence protected by fault_pending_wqh lock */ +- struct seqcount refile_seq; ++ seqlock_t refile_seq; + /* pseudo fd refcounting */ + atomic_t refcount; + /* userfaultfd syscall flags */ +@@ -1059,7 +1059,7 @@ static ssize_t userfaultfd_ctx_read(struct userfaultfd_ctx *ctx, int no_wait, + * waitqueue could become empty if this is the + * only userfault. + */ +- write_seqcount_begin(&ctx->refile_seq); ++ write_seqlock(&ctx->refile_seq); + + /* + * The fault_pending_wqh.lock prevents the uwq +@@ -1085,7 +1085,7 @@ static ssize_t userfaultfd_ctx_read(struct userfaultfd_ctx *ctx, int no_wait, + list_del(&uwq->wq.entry); + add_wait_queue(&ctx->fault_wqh, &uwq->wq); + +- write_seqcount_end(&ctx->refile_seq); ++ write_sequnlock(&ctx->refile_seq); + + /* careful to always initialize msg if ret == 0 */ + *msg = uwq->msg; +@@ -1258,11 +1258,11 @@ static __always_inline void wake_userfault(struct userfaultfd_ctx *ctx, + * sure we've userfaults to wake. + */ + do { +- seq = read_seqcount_begin(&ctx->refile_seq); ++ seq = read_seqbegin(&ctx->refile_seq); + need_wakeup = waitqueue_active(&ctx->fault_pending_wqh) || + waitqueue_active(&ctx->fault_wqh); + cond_resched(); +- } while (read_seqcount_retry(&ctx->refile_seq, seq)); ++ } while (read_seqretry(&ctx->refile_seq, seq)); + if (need_wakeup) + __wake_userfault(ctx, range); + } +@@ -1936,7 +1936,7 @@ static void init_once_userfaultfd_ctx(void *mem) + init_waitqueue_head(&ctx->fault_wqh); + init_waitqueue_head(&ctx->event_wqh); + init_waitqueue_head(&ctx->fd_wqh); +- seqcount_init(&ctx->refile_seq); ++ seqlock_init(&ctx->refile_seq); + } + + SYSCALL_DEFINE1(userfaultfd, int, flags) diff --git a/debian/patches-rt/0315-sched-migrate_enable-Use-per-cpu-cpu_stop_work.patch b/debian/patches-rt/0315-sched-migrate_enable-Use-per-cpu-cpu_stop_work.patch new file mode 100644 index 000000000..e14b98f42 --- /dev/null +++ b/debian/patches-rt/0315-sched-migrate_enable-Use-per-cpu-cpu_stop_work.patch @@ -0,0 +1,79 @@ +From: Scott Wood +Date: Fri, 24 Jan 2020 06:11:46 -0500 +Subject: [PATCH 315/342] sched: migrate_enable: Use per-cpu cpu_stop_work +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=eb1e75f22c7c7fef03f9ff0441ae1e7d7275a470 + +[ Upstream commit 2dcd94b443c5dcbc20281666321b7f025f9cc85c ] + +Commit e6c287b1512d ("sched: migrate_enable: Use stop_one_cpu_nowait()") +adds a busy wait to deal with an edge case where the migrated thread +can resume running on another CPU before the stopper has consumed +cpu_stop_work. However, this is done with preemption disabled and can +potentially lead to deadlock. + +While it is not guaranteed that the cpu_stop_work will be consumed before +the migrating thread resumes and exits the stack frame, it is guaranteed +that nothing other than the stopper can run on the old cpu between the +migrating thread scheduling out and the cpu_stop_work being consumed. +Thus, we can store cpu_stop_work in per-cpu data without it being +reused too early. + +Fixes: e6c287b1512d ("sched: migrate_enable: Use stop_one_cpu_nowait()") +Suggested-by: Sebastian Andrzej Siewior +Signed-off-by: Scott Wood +Reviewed-by: Steven Rostedt (VMware) +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + kernel/sched/core.c | 22 ++++++++++++++-------- + 1 file changed, 14 insertions(+), 8 deletions(-) + +diff --git a/kernel/sched/core.c b/kernel/sched/core.c +index d190d9e6b10f..8b946353b1d7 100644 +--- a/kernel/sched/core.c ++++ b/kernel/sched/core.c +@@ -7285,6 +7285,9 @@ static void migrate_disabled_sched(struct task_struct *p) + p->migrate_disable_scheduled = 1; + } + ++static DEFINE_PER_CPU(struct cpu_stop_work, migrate_work); ++static DEFINE_PER_CPU(struct migration_arg, migrate_arg); ++ + void migrate_enable(void) + { + struct task_struct *p = current; +@@ -7323,23 +7326,26 @@ void migrate_enable(void) + + WARN_ON(smp_processor_id() != cpu); + if (!is_cpu_allowed(p, cpu)) { +- struct migration_arg arg = { .task = p }; +- struct cpu_stop_work work; ++ struct migration_arg __percpu *arg; ++ struct cpu_stop_work __percpu *work; + struct rq_flags rf; + ++ work = this_cpu_ptr(&migrate_work); ++ arg = this_cpu_ptr(&migrate_arg); ++ WARN_ON_ONCE(!arg->done && !work->disabled && work->arg); ++ ++ arg->task = p; ++ arg->done = false; ++ + rq = task_rq_lock(p, &rf); + update_rq_clock(rq); +- arg.dest_cpu = select_fallback_rq(cpu, p); ++ arg->dest_cpu = select_fallback_rq(cpu, p); + task_rq_unlock(rq, p, &rf); + + stop_one_cpu_nowait(task_cpu(p), migration_cpu_stop, +- &arg, &work); ++ arg, work); + tlb_migrate_finish(p->mm); + __schedule(true); +- if (!work.disabled) { +- while (!arg.done) +- cpu_relax(); +- } + } + + out: diff --git a/debian/patches-rt/0315-userfaultfd-Use-a-seqlock-instead-of-seqcount.patch b/debian/patches-rt/0315-userfaultfd-Use-a-seqlock-instead-of-seqcount.patch deleted file mode 100644 index 227e20afd..000000000 --- a/debian/patches-rt/0315-userfaultfd-Use-a-seqlock-instead-of-seqcount.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 4639984350d5520c7268c26b6454c2f47cf139e4 Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Wed, 18 Dec 2019 12:25:09 +0100 -Subject: [PATCH 315/347] userfaultfd: Use a seqlock instead of seqcount -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit dc952a564d02997330654be9628bbe97ba2a05d3 ] - -On RT write_seqcount_begin() disables preemption which leads to warning -in add_wait_queue() while the spinlock_t is acquired. -The waitqueue can't be converted to swait_queue because -userfaultfd_wake_function() is used as a custom wake function. - -Use seqlock instead seqcount to avoid the preempt_disable() section -during add_wait_queue(). - -Cc: stable-rt@vger.kernel.org -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - fs/userfaultfd.c | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c -index 23c8efc967af..3f79609511da 100644 ---- a/fs/userfaultfd.c -+++ b/fs/userfaultfd.c -@@ -56,7 +56,7 @@ struct userfaultfd_ctx { - /* waitqueue head for events */ - wait_queue_head_t event_wqh; - /* a refile sequence protected by fault_pending_wqh lock */ -- struct seqcount refile_seq; -+ seqlock_t refile_seq; - /* pseudo fd refcounting */ - atomic_t refcount; - /* userfaultfd syscall flags */ -@@ -1059,7 +1059,7 @@ static ssize_t userfaultfd_ctx_read(struct userfaultfd_ctx *ctx, int no_wait, - * waitqueue could become empty if this is the - * only userfault. - */ -- write_seqcount_begin(&ctx->refile_seq); -+ write_seqlock(&ctx->refile_seq); - - /* - * The fault_pending_wqh.lock prevents the uwq -@@ -1085,7 +1085,7 @@ static ssize_t userfaultfd_ctx_read(struct userfaultfd_ctx *ctx, int no_wait, - list_del(&uwq->wq.entry); - add_wait_queue(&ctx->fault_wqh, &uwq->wq); - -- write_seqcount_end(&ctx->refile_seq); -+ write_sequnlock(&ctx->refile_seq); - - /* careful to always initialize msg if ret == 0 */ - *msg = uwq->msg; -@@ -1258,11 +1258,11 @@ static __always_inline void wake_userfault(struct userfaultfd_ctx *ctx, - * sure we've userfaults to wake. - */ - do { -- seq = read_seqcount_begin(&ctx->refile_seq); -+ seq = read_seqbegin(&ctx->refile_seq); - need_wakeup = waitqueue_active(&ctx->fault_pending_wqh) || - waitqueue_active(&ctx->fault_wqh); - cond_resched(); -- } while (read_seqcount_retry(&ctx->refile_seq, seq)); -+ } while (read_seqretry(&ctx->refile_seq, seq)); - if (need_wakeup) - __wake_userfault(ctx, range); - } -@@ -1936,7 +1936,7 @@ static void init_once_userfaultfd_ctx(void *mem) - init_waitqueue_head(&ctx->fault_wqh); - init_waitqueue_head(&ctx->event_wqh); - init_waitqueue_head(&ctx->fd_wqh); -- seqcount_init(&ctx->refile_seq); -+ seqlock_init(&ctx->refile_seq); - } - - SYSCALL_DEFINE1(userfaultfd, int, flags) --- -2.36.1 - diff --git a/debian/patches-rt/0316-sched-migrate_enable-Remove-__schedule-call.patch b/debian/patches-rt/0316-sched-migrate_enable-Remove-__schedule-call.patch new file mode 100644 index 000000000..a47b24169 --- /dev/null +++ b/debian/patches-rt/0316-sched-migrate_enable-Remove-__schedule-call.patch @@ -0,0 +1,37 @@ +From: Scott Wood +Date: Fri, 24 Jan 2020 06:11:47 -0500 +Subject: [PATCH 316/342] sched: migrate_enable: Remove __schedule() call +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=f416311d786e940c55fab1dfcdbdd03188b6855f + +[ Upstream commit b8162e61e9a33bd1de6452eb838fbf50a93ddd9a ] + +We can rely on preempt_enable() to schedule. Besides simplifying the +code, this potentially allows sequences such as the following to be +permitted: + +migrate_disable(); +preempt_disable(); +migrate_enable(); +preempt_enable(); + +Suggested-by: Sebastian Andrzej Siewior +Signed-off-by: Scott Wood +Reviewed-by: Steven Rostedt (VMware) +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + kernel/sched/core.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/kernel/sched/core.c b/kernel/sched/core.c +index 8b946353b1d7..410882ff2007 100644 +--- a/kernel/sched/core.c ++++ b/kernel/sched/core.c +@@ -7345,7 +7345,6 @@ void migrate_enable(void) + stop_one_cpu_nowait(task_cpu(p), migration_cpu_stop, + arg, work); + tlb_migrate_finish(p->mm); +- __schedule(true); + } + + out: diff --git a/debian/patches-rt/0316-sched-migrate_enable-Use-per-cpu-cpu_stop_work.patch b/debian/patches-rt/0316-sched-migrate_enable-Use-per-cpu-cpu_stop_work.patch deleted file mode 100644 index fcff1b8a4..000000000 --- a/debian/patches-rt/0316-sched-migrate_enable-Use-per-cpu-cpu_stop_work.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 5595f7a45953987f56b3e64c3a20f6f90735d4a1 Mon Sep 17 00:00:00 2001 -From: Scott Wood -Date: Fri, 24 Jan 2020 06:11:46 -0500 -Subject: [PATCH 316/347] sched: migrate_enable: Use per-cpu cpu_stop_work -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 2dcd94b443c5dcbc20281666321b7f025f9cc85c ] - -Commit e6c287b1512d ("sched: migrate_enable: Use stop_one_cpu_nowait()") -adds a busy wait to deal with an edge case where the migrated thread -can resume running on another CPU before the stopper has consumed -cpu_stop_work. However, this is done with preemption disabled and can -potentially lead to deadlock. - -While it is not guaranteed that the cpu_stop_work will be consumed before -the migrating thread resumes and exits the stack frame, it is guaranteed -that nothing other than the stopper can run on the old cpu between the -migrating thread scheduling out and the cpu_stop_work being consumed. -Thus, we can store cpu_stop_work in per-cpu data without it being -reused too early. - -Fixes: e6c287b1512d ("sched: migrate_enable: Use stop_one_cpu_nowait()") -Suggested-by: Sebastian Andrzej Siewior -Signed-off-by: Scott Wood -Reviewed-by: Steven Rostedt (VMware) -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - kernel/sched/core.c | 22 ++++++++++++++-------- - 1 file changed, 14 insertions(+), 8 deletions(-) - -diff --git a/kernel/sched/core.c b/kernel/sched/core.c -index d190d9e6b10f..8b946353b1d7 100644 ---- a/kernel/sched/core.c -+++ b/kernel/sched/core.c -@@ -7285,6 +7285,9 @@ static void migrate_disabled_sched(struct task_struct *p) - p->migrate_disable_scheduled = 1; - } - -+static DEFINE_PER_CPU(struct cpu_stop_work, migrate_work); -+static DEFINE_PER_CPU(struct migration_arg, migrate_arg); -+ - void migrate_enable(void) - { - struct task_struct *p = current; -@@ -7323,23 +7326,26 @@ void migrate_enable(void) - - WARN_ON(smp_processor_id() != cpu); - if (!is_cpu_allowed(p, cpu)) { -- struct migration_arg arg = { .task = p }; -- struct cpu_stop_work work; -+ struct migration_arg __percpu *arg; -+ struct cpu_stop_work __percpu *work; - struct rq_flags rf; - -+ work = this_cpu_ptr(&migrate_work); -+ arg = this_cpu_ptr(&migrate_arg); -+ WARN_ON_ONCE(!arg->done && !work->disabled && work->arg); -+ -+ arg->task = p; -+ arg->done = false; -+ - rq = task_rq_lock(p, &rf); - update_rq_clock(rq); -- arg.dest_cpu = select_fallback_rq(cpu, p); -+ arg->dest_cpu = select_fallback_rq(cpu, p); - task_rq_unlock(rq, p, &rf); - - stop_one_cpu_nowait(task_cpu(p), migration_cpu_stop, -- &arg, &work); -+ arg, work); - tlb_migrate_finish(p->mm); - __schedule(true); -- if (!work.disabled) { -- while (!arg.done) -- cpu_relax(); -- } - } - - out: --- -2.36.1 - diff --git a/debian/patches-rt/0317-mm-memcontrol-Move-misplaced-local_unlock_irqrestore.patch b/debian/patches-rt/0317-mm-memcontrol-Move-misplaced-local_unlock_irqrestore.patch new file mode 100644 index 000000000..1ddd98611 --- /dev/null +++ b/debian/patches-rt/0317-mm-memcontrol-Move-misplaced-local_unlock_irqrestore.patch @@ -0,0 +1,38 @@ +From: Matt Fleming +Date: Sun, 26 Jan 2020 21:19:45 +0000 +Subject: [PATCH 317/342] mm/memcontrol: Move misplaced + local_unlock_irqrestore() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=e7a4f4c7b57d3592b7ea282256ec21e120299aae + +[ Upstream commit 071a1d6a6e14d0dec240a8c67b425140d7f92f6a ] + +The comment about local_lock_irqsave() mentions just the counters and +css_put_many()'s callback just invokes a worker so it is safe to move the +unlock function after memcg_check_events() so css_put_many() can be invoked +without the lock acquired. + +Cc: Daniel Wagner +Signed-off-by: Matt Fleming +Signed-off-by: Steven Rostedt (VMware) +[bigeasy: rewrote the patch description] +Signed-off-by: Sebastian Andrzej Siewior +--- + mm/memcontrol.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/mm/memcontrol.c b/mm/memcontrol.c +index 239fec6eac9f..d5bda1449fe3 100644 +--- a/mm/memcontrol.c ++++ b/mm/memcontrol.c +@@ -6541,10 +6541,10 @@ void mem_cgroup_swapout(struct page *page, swp_entry_t entry) + mem_cgroup_charge_statistics(memcg, page, PageTransHuge(page), + -nr_entries); + memcg_check_events(memcg, page); ++ local_unlock_irqrestore(event_lock, flags); + + if (!mem_cgroup_is_root(memcg)) + css_put_many(&memcg->css, nr_entries); +- local_unlock_irqrestore(event_lock, flags); + } + + /** diff --git a/debian/patches-rt/0317-sched-migrate_enable-Remove-__schedule-call.patch b/debian/patches-rt/0317-sched-migrate_enable-Remove-__schedule-call.patch deleted file mode 100644 index 2078fa5bb..000000000 --- a/debian/patches-rt/0317-sched-migrate_enable-Remove-__schedule-call.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 1742897c78e053379ae6bb15024026f01e0bac2d Mon Sep 17 00:00:00 2001 -From: Scott Wood -Date: Fri, 24 Jan 2020 06:11:47 -0500 -Subject: [PATCH 317/347] sched: migrate_enable: Remove __schedule() call -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit b8162e61e9a33bd1de6452eb838fbf50a93ddd9a ] - -We can rely on preempt_enable() to schedule. Besides simplifying the -code, this potentially allows sequences such as the following to be -permitted: - -migrate_disable(); -preempt_disable(); -migrate_enable(); -preempt_enable(); - -Suggested-by: Sebastian Andrzej Siewior -Signed-off-by: Scott Wood -Reviewed-by: Steven Rostedt (VMware) -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - kernel/sched/core.c | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/kernel/sched/core.c b/kernel/sched/core.c -index 8b946353b1d7..410882ff2007 100644 ---- a/kernel/sched/core.c -+++ b/kernel/sched/core.c -@@ -7345,7 +7345,6 @@ void migrate_enable(void) - stop_one_cpu_nowait(task_cpu(p), migration_cpu_stop, - arg, work); - tlb_migrate_finish(p->mm); -- __schedule(true); - } - - out: --- -2.36.1 - diff --git a/debian/patches-rt/0318-locallock-Include-header-for-the-current-macro.patch b/debian/patches-rt/0318-locallock-Include-header-for-the-current-macro.patch new file mode 100644 index 000000000..5308f4706 --- /dev/null +++ b/debian/patches-rt/0318-locallock-Include-header-for-the-current-macro.patch @@ -0,0 +1,28 @@ +From: Sebastian Andrzej Siewior +Date: Tue, 4 Feb 2020 13:29:50 +0100 +Subject: [PATCH 318/342] locallock: Include header for the `current' macro +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=4d1a63f5abebd6be6dcb7f06632d6c0970db1ce9 + +[ Upstream commit e693075a5fd852043fa8d2b0467e078d9e5cb782 ] + +Include the header for `current' macro so that +CONFIG_KERNEL_HEADER_TEST=y passes. + +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + include/linux/locallock.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/include/linux/locallock.h b/include/linux/locallock.h +index 921eab83cd34..81c89d87723b 100644 +--- a/include/linux/locallock.h ++++ b/include/linux/locallock.h +@@ -3,6 +3,7 @@ + + #include + #include ++#include + + #ifdef CONFIG_PREEMPT_RT_BASE + diff --git a/debian/patches-rt/0318-mm-memcontrol-Move-misplaced-local_unlock_irqrestore.patch b/debian/patches-rt/0318-mm-memcontrol-Move-misplaced-local_unlock_irqrestore.patch deleted file mode 100644 index 87fb2dcd0..000000000 --- a/debian/patches-rt/0318-mm-memcontrol-Move-misplaced-local_unlock_irqrestore.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 402c737918994231fbd205f2a7dcf06c5046a849 Mon Sep 17 00:00:00 2001 -From: Matt Fleming -Date: Sun, 26 Jan 2020 21:19:45 +0000 -Subject: [PATCH 318/347] mm/memcontrol: Move misplaced - local_unlock_irqrestore() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 071a1d6a6e14d0dec240a8c67b425140d7f92f6a ] - -The comment about local_lock_irqsave() mentions just the counters and -css_put_many()'s callback just invokes a worker so it is safe to move the -unlock function after memcg_check_events() so css_put_many() can be invoked -without the lock acquired. - -Cc: Daniel Wagner -Signed-off-by: Matt Fleming -Signed-off-by: Steven Rostedt (VMware) -[bigeasy: rewrote the patch description] -Signed-off-by: Sebastian Andrzej Siewior ---- - mm/memcontrol.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/mm/memcontrol.c b/mm/memcontrol.c -index 239fec6eac9f..d5bda1449fe3 100644 ---- a/mm/memcontrol.c -+++ b/mm/memcontrol.c -@@ -6541,10 +6541,10 @@ void mem_cgroup_swapout(struct page *page, swp_entry_t entry) - mem_cgroup_charge_statistics(memcg, page, PageTransHuge(page), - -nr_entries); - memcg_check_events(memcg, page); -+ local_unlock_irqrestore(event_lock, flags); - - if (!mem_cgroup_is_root(memcg)) - css_put_many(&memcg->css, nr_entries); -- local_unlock_irqrestore(event_lock, flags); - } - - /** --- -2.36.1 - diff --git a/debian/patches-rt/0319-drm-vmwgfx-Drop-preempt_disable-in-vmw_fifo_ping_hos.patch b/debian/patches-rt/0319-drm-vmwgfx-Drop-preempt_disable-in-vmw_fifo_ping_hos.patch new file mode 100644 index 000000000..016783a60 --- /dev/null +++ b/debian/patches-rt/0319-drm-vmwgfx-Drop-preempt_disable-in-vmw_fifo_ping_hos.patch @@ -0,0 +1,41 @@ +From: Sebastian Andrzej Siewior +Date: Fri, 21 Feb 2020 18:57:11 +0100 +Subject: [PATCH 319/342] drm/vmwgfx: Drop preempt_disable() in + vmw_fifo_ping_host() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=d41c023d443b698d184f54f642578b0c195f140c + +[ Upstream commit b901491e7b9b7a676818d84e482b69be72fc142f ] + +vmw_fifo_ping_host() disables preemption around a test and a register +write via vmw_write(). The write function acquires a spinlock_t typed +lock which is not allowed in a preempt_disable()ed section on +PREEMPT_RT. This has been reported in the bugzilla. + +It has been explained by Thomas Hellstrom that this preempt_disable()ed +section is not required for correctness. + +Remove the preempt_disable() section. + +Link: https://bugzilla.kernel.org/show_bug.cgi?id=206591 +Link: https://lkml.kernel.org/r/0b5e1c65d89951de993deab06d1d197b40fd67aa.camel@vmware.com +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c +index d0fd147ef75f..fb5a3461bb8c 100644 +--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c ++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c +@@ -167,10 +167,8 @@ void vmw_fifo_ping_host(struct vmw_private *dev_priv, uint32_t reason) + { + u32 *fifo_mem = dev_priv->mmio_virt; + +- preempt_disable(); + if (cmpxchg(fifo_mem + SVGA_FIFO_BUSY, 0, 1) == 0) + vmw_write(dev_priv, SVGA_REG_SYNC, reason); +- preempt_enable(); + } + + void vmw_fifo_release(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo) diff --git a/debian/patches-rt/0319-locallock-Include-header-for-the-current-macro.patch b/debian/patches-rt/0319-locallock-Include-header-for-the-current-macro.patch deleted file mode 100644 index ca93285f9..000000000 --- a/debian/patches-rt/0319-locallock-Include-header-for-the-current-macro.patch +++ /dev/null @@ -1,32 +0,0 @@ -From b075c120b3110dd2e9ef474ece2f4aade2d0a10c Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Tue, 4 Feb 2020 13:29:50 +0100 -Subject: [PATCH 319/347] locallock: Include header for the `current' macro -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit e693075a5fd852043fa8d2b0467e078d9e5cb782 ] - -Include the header for `current' macro so that -CONFIG_KERNEL_HEADER_TEST=y passes. - -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - include/linux/locallock.h | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/include/linux/locallock.h b/include/linux/locallock.h -index 921eab83cd34..81c89d87723b 100644 ---- a/include/linux/locallock.h -+++ b/include/linux/locallock.h -@@ -3,6 +3,7 @@ - - #include - #include -+#include - - #ifdef CONFIG_PREEMPT_RT_BASE - --- -2.36.1 - diff --git a/debian/patches-rt/0320-drm-vmwgfx-Drop-preempt_disable-in-vmw_fifo_ping_hos.patch b/debian/patches-rt/0320-drm-vmwgfx-Drop-preempt_disable-in-vmw_fifo_ping_hos.patch deleted file mode 100644 index 2dc30fc19..000000000 --- a/debian/patches-rt/0320-drm-vmwgfx-Drop-preempt_disable-in-vmw_fifo_ping_hos.patch +++ /dev/null @@ -1,45 +0,0 @@ -From fc0f8480da7d2d5927404e67031daba0ca53a1a2 Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Fri, 21 Feb 2020 18:57:11 +0100 -Subject: [PATCH 320/347] drm/vmwgfx: Drop preempt_disable() in - vmw_fifo_ping_host() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit b901491e7b9b7a676818d84e482b69be72fc142f ] - -vmw_fifo_ping_host() disables preemption around a test and a register -write via vmw_write(). The write function acquires a spinlock_t typed -lock which is not allowed in a preempt_disable()ed section on -PREEMPT_RT. This has been reported in the bugzilla. - -It has been explained by Thomas Hellstrom that this preempt_disable()ed -section is not required for correctness. - -Remove the preempt_disable() section. - -Link: https://bugzilla.kernel.org/show_bug.cgi?id=206591 -Link: https://lkml.kernel.org/r/0b5e1c65d89951de993deab06d1d197b40fd67aa.camel@vmware.com -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c -index d0fd147ef75f..fb5a3461bb8c 100644 ---- a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c -+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c -@@ -167,10 +167,8 @@ void vmw_fifo_ping_host(struct vmw_private *dev_priv, uint32_t reason) - { - u32 *fifo_mem = dev_priv->mmio_virt; - -- preempt_disable(); - if (cmpxchg(fifo_mem + SVGA_FIFO_BUSY, 0, 1) == 0) - vmw_write(dev_priv, SVGA_REG_SYNC, reason); -- preempt_enable(); - } - - void vmw_fifo_release(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo) --- -2.36.1 - diff --git a/debian/patches-rt/0320-tracing-make-preempt_lazy-and-migrate_disable-counte.patch b/debian/patches-rt/0320-tracing-make-preempt_lazy-and-migrate_disable-counte.patch new file mode 100644 index 000000000..d4c857412 --- /dev/null +++ b/debian/patches-rt/0320-tracing-make-preempt_lazy-and-migrate_disable-counte.patch @@ -0,0 +1,52 @@ +From: Sebastian Andrzej Siewior +Date: Fri, 21 Feb 2020 18:15:15 +0100 +Subject: [PATCH 320/342] tracing: make preempt_lazy and migrate_disable + counter smaller +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=023b81c02c171c25b54507f6e10f8627e4427041 + +[ Upstream commit dd430bf5ecb40f9a89679c85868826475d71de54 ] + +The migrate_disable counter should not exceed 255 so it is enough to +store it in an 8bit field. +With this change we can move the `preempt_lazy_count' member into the +gap so the whole struct shrinks by 4 bytes to 12 bytes in total. +Remove the `padding' field, it is not needed. +Update the tracing fields in trace_define_common_fields() (it was +missing the preempt_lazy_count field). + +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt (VMware) +--- + include/linux/trace_events.h | 3 +-- + kernel/trace/trace_events.c | 4 ++-- + 2 files changed, 3 insertions(+), 4 deletions(-) + +diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h +index 72864a11cec0..e26a85c1b7ba 100644 +--- a/include/linux/trace_events.h ++++ b/include/linux/trace_events.h +@@ -62,8 +62,7 @@ struct trace_entry { + unsigned char flags; + unsigned char preempt_count; + int pid; +- unsigned short migrate_disable; +- unsigned short padding; ++ unsigned char migrate_disable; + unsigned char preempt_lazy_count; + }; + +diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c +index fbb04cf1d5bc..9b1b1c6de2bd 100644 +--- a/kernel/trace/trace_events.c ++++ b/kernel/trace/trace_events.c +@@ -188,8 +188,8 @@ static int trace_define_common_fields(void) + __common_field(unsigned char, flags); + __common_field(unsigned char, preempt_count); + __common_field(int, pid); +- __common_field(unsigned short, migrate_disable); +- __common_field(unsigned short, padding); ++ __common_field(unsigned char, migrate_disable); ++ __common_field(unsigned char, preempt_lazy_count); + + return ret; + } diff --git a/debian/patches-rt/0321-lib-ubsan-Remove-flags-parameter-from-calls-to-ubsan.patch b/debian/patches-rt/0321-lib-ubsan-Remove-flags-parameter-from-calls-to-ubsan.patch new file mode 100644 index 000000000..ec71bc2b2 --- /dev/null +++ b/debian/patches-rt/0321-lib-ubsan-Remove-flags-parameter-from-calls-to-ubsan.patch @@ -0,0 +1,53 @@ +From: Tiejun Chen +Date: Mon, 30 Mar 2020 18:45:23 -0400 +Subject: [PATCH 321/342] lib/ubsan: Remove flags parameter from calls to + ubsan_prologue() and ubsan_epilogue() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=be2cad96ad54e4a1f5795790aad7ca8091567cce + +Fails to build with CONFIG_UBSAN=y + +lib/ubsan.c: In function '__ubsan_handle_vla_bound_not_positive': +lib/ubsan.c:348:2: error: too many arguments to function 'ubsan_prologue' + ubsan_prologue(&data->location, &flags); + ^~~~~~~~~~~~~~ +lib/ubsan.c:146:13: note: declared here + static void ubsan_prologue(struct source_location *location) + ^~~~~~~~~~~~~~ +lib/ubsan.c:353:2: error: too many arguments to function 'ubsan_epilogue' + ubsan_epilogue(&flags); + ^~~~~~~~~~~~~~ +lib/ubsan.c:155:13: note: declared here + static void ubsan_epilogue(void) + ^~~~~~~~~~~~~~ + +Signed-off-by: Tiejun Chen +Signed-off-by: Steven Rostedt (VMware) +--- + lib/ubsan.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/lib/ubsan.c b/lib/ubsan.c +index 5830cc9a2164..199c75e03469 100644 +--- a/lib/ubsan.c ++++ b/lib/ubsan.c +@@ -339,18 +339,17 @@ EXPORT_SYMBOL(__ubsan_handle_type_mismatch_v1); + void __ubsan_handle_vla_bound_not_positive(struct vla_bound_data *data, + void *bound) + { +- unsigned long flags; + char bound_str[VALUE_LENGTH]; + + if (suppress_report(&data->location)) + return; + +- ubsan_prologue(&data->location, &flags); ++ ubsan_prologue(&data->location); + + val_to_string(bound_str, sizeof(bound_str), data->type, bound); + pr_err("variable length array bound value %s <= 0\n", bound_str); + +- ubsan_epilogue(&flags); ++ ubsan_epilogue(); + } + EXPORT_SYMBOL(__ubsan_handle_vla_bound_not_positive); + diff --git a/debian/patches-rt/0321-tracing-make-preempt_lazy-and-migrate_disable-counte.patch b/debian/patches-rt/0321-tracing-make-preempt_lazy-and-migrate_disable-counte.patch deleted file mode 100644 index 937b26b3c..000000000 --- a/debian/patches-rt/0321-tracing-make-preempt_lazy-and-migrate_disable-counte.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 8f58969bec3bc125c8257b4aea667ebb352cc73a Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Fri, 21 Feb 2020 18:15:15 +0100 -Subject: [PATCH 321/347] tracing: make preempt_lazy and migrate_disable - counter smaller -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit dd430bf5ecb40f9a89679c85868826475d71de54 ] - -The migrate_disable counter should not exceed 255 so it is enough to -store it in an 8bit field. -With this change we can move the `preempt_lazy_count' member into the -gap so the whole struct shrinks by 4 bytes to 12 bytes in total. -Remove the `padding' field, it is not needed. -Update the tracing fields in trace_define_common_fields() (it was -missing the preempt_lazy_count field). - -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Steven Rostedt (VMware) ---- - include/linux/trace_events.h | 3 +-- - kernel/trace/trace_events.c | 4 ++-- - 2 files changed, 3 insertions(+), 4 deletions(-) - -diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h -index 72864a11cec0..e26a85c1b7ba 100644 ---- a/include/linux/trace_events.h -+++ b/include/linux/trace_events.h -@@ -62,8 +62,7 @@ struct trace_entry { - unsigned char flags; - unsigned char preempt_count; - int pid; -- unsigned short migrate_disable; -- unsigned short padding; -+ unsigned char migrate_disable; - unsigned char preempt_lazy_count; - }; - -diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c -index fbb04cf1d5bc..9b1b1c6de2bd 100644 ---- a/kernel/trace/trace_events.c -+++ b/kernel/trace/trace_events.c -@@ -188,8 +188,8 @@ static int trace_define_common_fields(void) - __common_field(unsigned char, flags); - __common_field(unsigned char, preempt_count); - __common_field(int, pid); -- __common_field(unsigned short, migrate_disable); -- __common_field(unsigned short, padding); -+ __common_field(unsigned char, migrate_disable); -+ __common_field(unsigned char, preempt_lazy_count); - - return ret; - } --- -2.36.1 - diff --git a/debian/patches-rt/0322-irq_work-Fix-checking-of-IRQ_WORK_LAZY-flag-set-on-n.patch b/debian/patches-rt/0322-irq_work-Fix-checking-of-IRQ_WORK_LAZY-flag-set-on-n.patch new file mode 100644 index 000000000..ce3238a88 --- /dev/null +++ b/debian/patches-rt/0322-irq_work-Fix-checking-of-IRQ_WORK_LAZY-flag-set-on-n.patch @@ -0,0 +1,68 @@ +From: "Steven Rostedt (VMware)" +Date: Sun, 22 Mar 2020 00:00:28 +0100 +Subject: [PATCH 322/342] irq_work: Fix checking of IRQ_WORK_LAZY flag set on + non PREEMPT_RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=7d8e3a7d353467d377d3b32fdf759c2c3171fb89 + +When CONFIG_PREEMPT_RT_FULL is not set, some of the checks for using +lazy_list are not properly made as the IRQ_WORK_LAZY is not checked. There's +two locations that need this update, so a use_lazy_list() helper function is +added and used in both locations. + +Link: https://lore.kernel.org/r/20200321230028.GA22058@duo.ucw.cz +Reported-by: Pavel Machek +Signed-off-by: Steven Rostedt (VMware) +--- + kernel/irq_work.c | 15 ++++++++------- + 1 file changed, 8 insertions(+), 7 deletions(-) + +diff --git a/kernel/irq_work.c b/kernel/irq_work.c +index 2940622da5b3..b6d9d35941ac 100644 +--- a/kernel/irq_work.c ++++ b/kernel/irq_work.c +@@ -70,6 +70,12 @@ static void __irq_work_queue_local(struct irq_work *work, struct llist_head *lis + arch_irq_work_raise(); + } + ++static inline bool use_lazy_list(struct irq_work *work) ++{ ++ return (IS_ENABLED(CONFIG_PREEMPT_RT_FULL) && !(work->flags & IRQ_WORK_HARD_IRQ)) ++ || (work->flags & IRQ_WORK_LAZY); ++} ++ + /* Enqueue the irq work @work on the current CPU */ + bool irq_work_queue(struct irq_work *work) + { +@@ -81,11 +87,10 @@ bool irq_work_queue(struct irq_work *work) + + /* Queue the entry and raise the IPI if needed. */ + preempt_disable(); +- if (IS_ENABLED(CONFIG_PREEMPT_RT_FULL) && !(work->flags & IRQ_WORK_HARD_IRQ)) ++ if (use_lazy_list(work)) + list = this_cpu_ptr(&lazy_list); + else + list = this_cpu_ptr(&raised_list); +- + __irq_work_queue_local(work, list); + preempt_enable(); + +@@ -106,7 +111,6 @@ bool irq_work_queue_on(struct irq_work *work, int cpu) + + #else /* CONFIG_SMP: */ + struct llist_head *list; +- bool lazy_work, realtime = IS_ENABLED(CONFIG_PREEMPT_RT_FULL); + + /* All work should have been flushed before going offline */ + WARN_ON_ONCE(cpu_is_offline(cpu)); +@@ -116,10 +120,7 @@ bool irq_work_queue_on(struct irq_work *work, int cpu) + return false; + + preempt_disable(); +- +- lazy_work = work->flags & IRQ_WORK_LAZY; +- +- if (lazy_work || (realtime && !(work->flags & IRQ_WORK_HARD_IRQ))) ++ if (use_lazy_list(work)) + list = &per_cpu(lazy_list, cpu); + else + list = &per_cpu(raised_list, cpu); diff --git a/debian/patches-rt/0322-lib-ubsan-Remove-flags-parameter-from-calls-to-ubsan.patch b/debian/patches-rt/0322-lib-ubsan-Remove-flags-parameter-from-calls-to-ubsan.patch deleted file mode 100644 index 709e7d601..000000000 --- a/debian/patches-rt/0322-lib-ubsan-Remove-flags-parameter-from-calls-to-ubsan.patch +++ /dev/null @@ -1,57 +0,0 @@ -From d107484fb77558e58c28e33e5642d7a11f05dfea Mon Sep 17 00:00:00 2001 -From: Tiejun Chen -Date: Mon, 30 Mar 2020 18:45:23 -0400 -Subject: [PATCH 322/347] lib/ubsan: Remove flags parameter from calls to - ubsan_prologue() and ubsan_epilogue() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -Fails to build with CONFIG_UBSAN=y - -lib/ubsan.c: In function '__ubsan_handle_vla_bound_not_positive': -lib/ubsan.c:348:2: error: too many arguments to function 'ubsan_prologue' - ubsan_prologue(&data->location, &flags); - ^~~~~~~~~~~~~~ -lib/ubsan.c:146:13: note: declared here - static void ubsan_prologue(struct source_location *location) - ^~~~~~~~~~~~~~ -lib/ubsan.c:353:2: error: too many arguments to function 'ubsan_epilogue' - ubsan_epilogue(&flags); - ^~~~~~~~~~~~~~ -lib/ubsan.c:155:13: note: declared here - static void ubsan_epilogue(void) - ^~~~~~~~~~~~~~ - -Signed-off-by: Tiejun Chen -Signed-off-by: Steven Rostedt (VMware) ---- - lib/ubsan.c | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) - -diff --git a/lib/ubsan.c b/lib/ubsan.c -index 5830cc9a2164..199c75e03469 100644 ---- a/lib/ubsan.c -+++ b/lib/ubsan.c -@@ -339,18 +339,17 @@ EXPORT_SYMBOL(__ubsan_handle_type_mismatch_v1); - void __ubsan_handle_vla_bound_not_positive(struct vla_bound_data *data, - void *bound) - { -- unsigned long flags; - char bound_str[VALUE_LENGTH]; - - if (suppress_report(&data->location)) - return; - -- ubsan_prologue(&data->location, &flags); -+ ubsan_prologue(&data->location); - - val_to_string(bound_str, sizeof(bound_str), data->type, bound); - pr_err("variable length array bound value %s <= 0\n", bound_str); - -- ubsan_epilogue(&flags); -+ ubsan_epilogue(); - } - EXPORT_SYMBOL(__ubsan_handle_vla_bound_not_positive); - --- -2.36.1 - diff --git a/debian/patches-rt/0323-irq_work-Fix-checking-of-IRQ_WORK_LAZY-flag-set-on-n.patch b/debian/patches-rt/0323-irq_work-Fix-checking-of-IRQ_WORK_LAZY-flag-set-on-n.patch deleted file mode 100644 index 972bc210f..000000000 --- a/debian/patches-rt/0323-irq_work-Fix-checking-of-IRQ_WORK_LAZY-flag-set-on-n.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 5b50540220e8d385682175fbc0b355e38289bbac Mon Sep 17 00:00:00 2001 -From: "Steven Rostedt (VMware)" -Date: Sun, 22 Mar 2020 00:00:28 +0100 -Subject: [PATCH 323/347] irq_work: Fix checking of IRQ_WORK_LAZY flag set on - non PREEMPT_RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -When CONFIG_PREEMPT_RT_FULL is not set, some of the checks for using -lazy_list are not properly made as the IRQ_WORK_LAZY is not checked. There's -two locations that need this update, so a use_lazy_list() helper function is -added and used in both locations. - -Link: https://lore.kernel.org/r/20200321230028.GA22058@duo.ucw.cz -Reported-by: Pavel Machek -Signed-off-by: Steven Rostedt (VMware) ---- - kernel/irq_work.c | 15 ++++++++------- - 1 file changed, 8 insertions(+), 7 deletions(-) - -diff --git a/kernel/irq_work.c b/kernel/irq_work.c -index 2940622da5b3..b6d9d35941ac 100644 ---- a/kernel/irq_work.c -+++ b/kernel/irq_work.c -@@ -70,6 +70,12 @@ static void __irq_work_queue_local(struct irq_work *work, struct llist_head *lis - arch_irq_work_raise(); - } - -+static inline bool use_lazy_list(struct irq_work *work) -+{ -+ return (IS_ENABLED(CONFIG_PREEMPT_RT_FULL) && !(work->flags & IRQ_WORK_HARD_IRQ)) -+ || (work->flags & IRQ_WORK_LAZY); -+} -+ - /* Enqueue the irq work @work on the current CPU */ - bool irq_work_queue(struct irq_work *work) - { -@@ -81,11 +87,10 @@ bool irq_work_queue(struct irq_work *work) - - /* Queue the entry and raise the IPI if needed. */ - preempt_disable(); -- if (IS_ENABLED(CONFIG_PREEMPT_RT_FULL) && !(work->flags & IRQ_WORK_HARD_IRQ)) -+ if (use_lazy_list(work)) - list = this_cpu_ptr(&lazy_list); - else - list = this_cpu_ptr(&raised_list); -- - __irq_work_queue_local(work, list); - preempt_enable(); - -@@ -106,7 +111,6 @@ bool irq_work_queue_on(struct irq_work *work, int cpu) - - #else /* CONFIG_SMP: */ - struct llist_head *list; -- bool lazy_work, realtime = IS_ENABLED(CONFIG_PREEMPT_RT_FULL); - - /* All work should have been flushed before going offline */ - WARN_ON_ONCE(cpu_is_offline(cpu)); -@@ -116,10 +120,7 @@ bool irq_work_queue_on(struct irq_work *work, int cpu) - return false; - - preempt_disable(); -- -- lazy_work = work->flags & IRQ_WORK_LAZY; -- -- if (lazy_work || (realtime && !(work->flags & IRQ_WORK_HARD_IRQ))) -+ if (use_lazy_list(work)) - list = &per_cpu(lazy_list, cpu); - else - list = &per_cpu(raised_list, cpu); --- -2.36.1 - diff --git a/debian/patches-rt/0323-tasklet-Address-a-race-resulting-in-double-enqueue.patch b/debian/patches-rt/0323-tasklet-Address-a-race-resulting-in-double-enqueue.patch new file mode 100644 index 000000000..7ebdfe086 --- /dev/null +++ b/debian/patches-rt/0323-tasklet-Address-a-race-resulting-in-double-enqueue.patch @@ -0,0 +1,116 @@ +From: Zhang Xiao +Date: Tue, 17 Mar 2020 12:47:43 +0100 +Subject: [PATCH 323/342] tasklet: Address a race resulting in double-enqueue +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=3f0945b4e8c94333caf5c9384103ebfc0a055375 + +The kernel bugzilla has the following race condition reported: + +CPU0 CPU1 CPU2 +------------------------------------------------ +test_set SCHED + test_set RUN + if SCHED + add_list + raise + clear RUN + +test_set RUN +test_clear SCHED + ->func + test_set SCHED +tasklet_try_unlock ->0 +test_clear SCHED + test_set SCHED + ->func +tasklet_try_unlock ->1 + test_set RUN + if SCHED + add list + raise + clear RUN + test_set RUN + if SCHED + add list + raise + clear RUN + +As a result the tasklet is enqueued on both CPUs and run on both CPUs. Due +to the nature of the list used here, it is possible that further +(different) tasklets, which are enqueued after this double-enqueued +tasklet, are scheduled on CPU2 but invoked on CPU1. It is also possible +that these tasklets won't be invoked at all, because during the second +enqueue process the t->next pointer is set to NULL - dropping everything +from the list. + +This race will trigger one or two of the WARN_ON() in +tasklet_action_common(). +The problem is that the tasklet may be invoked multiple times and clear +SCHED bit on each invocation. This makes it possible to enqueue the +very same tasklet on different CPUs. + +Current RT-devel is using the upstream implementation which does not +re-run tasklets if they have SCHED set again and so it does not clear +the SCHED bit multiple times on a single invocation. + +Introduce the CHAINED flag. The tasklet will only be enqueued if the +CHAINED flag has been set successfully. +If it is possible to exchange the flags (CHAINED | RUN) -> 0 then the +tasklet won't be re-run. Otherwise the possible SCHED flag is removed +and the tasklet is re-run again. + +Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=61451 +Not-signed-off-by: Zhang Xiao +[bigeasy: patch description] +Signed-off-by: Sebastian Andrzej Siewior + +Signed-off-by: Tom Zanussi +--- + include/linux/interrupt.h | 5 ++++- + kernel/softirq.c | 6 +++++- + 2 files changed, 9 insertions(+), 2 deletions(-) + +diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h +index 97d9ba26915e..a3b5edb26bc5 100644 +--- a/include/linux/interrupt.h ++++ b/include/linux/interrupt.h +@@ -579,12 +579,15 @@ enum + { + TASKLET_STATE_SCHED, /* Tasklet is scheduled for execution */ + TASKLET_STATE_RUN, /* Tasklet is running (SMP only) */ +- TASKLET_STATE_PENDING /* Tasklet is pending */ ++ TASKLET_STATE_PENDING, /* Tasklet is pending */ ++ TASKLET_STATE_CHAINED /* Tasklet is chained */ + }; + + #define TASKLET_STATEF_SCHED (1 << TASKLET_STATE_SCHED) + #define TASKLET_STATEF_RUN (1 << TASKLET_STATE_RUN) + #define TASKLET_STATEF_PENDING (1 << TASKLET_STATE_PENDING) ++#define TASKLET_STATEF_CHAINED (1 << TASKLET_STATE_CHAINED) ++#define TASKLET_STATEF_RC (TASKLET_STATEF_RUN | TASKLET_STATEF_CHAINED) + + #if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT_FULL) + static inline int tasklet_trylock(struct tasklet_struct *t) +diff --git a/kernel/softirq.c b/kernel/softirq.c +index 25bcf2f2714b..73dae64bfc9c 100644 +--- a/kernel/softirq.c ++++ b/kernel/softirq.c +@@ -947,6 +947,10 @@ static void __tasklet_schedule_common(struct tasklet_struct *t, + * is locked before adding it to the list. + */ + if (test_bit(TASKLET_STATE_SCHED, &t->state)) { ++ if (test_and_set_bit(TASKLET_STATE_CHAINED, &t->state)) { ++ tasklet_unlock(t); ++ return; ++ } + t->next = NULL; + *head->tail = t; + head->tail = &(t->next); +@@ -1040,7 +1044,7 @@ static void tasklet_action_common(struct softirq_action *a, + again: + t->func(t->data); + +- while (!tasklet_tryunlock(t)) { ++ while (cmpxchg(&t->state, TASKLET_STATEF_RC, 0) != TASKLET_STATEF_RC) { + /* + * If it got disabled meanwhile, bail out: + */ diff --git a/debian/patches-rt/0324-hrtimer-fix-logic-for-when-grabbing-softirq_expiry_l.patch b/debian/patches-rt/0324-hrtimer-fix-logic-for-when-grabbing-softirq_expiry_l.patch new file mode 100644 index 000000000..557ca56b3 --- /dev/null +++ b/debian/patches-rt/0324-hrtimer-fix-logic-for-when-grabbing-softirq_expiry_l.patch @@ -0,0 +1,46 @@ +From: Rasmus Villemoes +Date: Tue, 28 Apr 2020 16:40:26 +0200 +Subject: [PATCH 324/342] hrtimer: fix logic for when grabbing + softirq_expiry_lock can be elided +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=44b8364a13277bc84e81f619bd8db3c98cd5f63d + +Commit + + hrtimer: Add a missing bracket and hide `migration_base' on !SMP + +which is 47b6de0b7f22 in 5.2-rt and 40aae5708e7a in 4.19-rt, +inadvertently changed the logic from base != &migration_base to base +== &migration_base. + +On !CONFIG_SMP, the effect was to effectively always elide this +lock/unlock pair (since is_migration_base() is unconditionally false), +which for me consistently causes lockups during reboot, and reportedly +also often causes a hang during boot. + +Adding this logical negation (or, what is effectively the same thing +on !CONFIG_SMP, reverting the above commit as well as "hrtimer: +Prevent using hrtimer_grab_expiry_lock() on migration_base") fixes +that lockup. + +Fixes: 40aae5708e7a (hrtimer: Add a missing bracket and hide `migration_base' on !SMP) # 4.19-rt +Fixes: 47b6de0b7f22 (hrtimer: Add a missing bracket and hide `migration_base' on !SMP) # 5.2-rt +Signed-off-by: Rasmus Villemoes +Reviewed-by: Steven Rostedt (VMware) +Signed-off-by: Tom Zanussi +--- + kernel/time/hrtimer.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c +index 0f841f18c363..a84673149881 100644 +--- a/kernel/time/hrtimer.c ++++ b/kernel/time/hrtimer.c +@@ -971,7 +971,7 @@ void hrtimer_grab_expiry_lock(const struct hrtimer *timer) + { + struct hrtimer_clock_base *base = READ_ONCE(timer->base); + +- if (timer->is_soft && is_migration_base(base)) { ++ if (timer->is_soft && !is_migration_base(base)) { + spin_lock(&base->cpu_base->softirq_expiry_lock); + spin_unlock(&base->cpu_base->softirq_expiry_lock); + } diff --git a/debian/patches-rt/0324-tasklet-Address-a-race-resulting-in-double-enqueue.patch b/debian/patches-rt/0324-tasklet-Address-a-race-resulting-in-double-enqueue.patch deleted file mode 100644 index 70a6d70cb..000000000 --- a/debian/patches-rt/0324-tasklet-Address-a-race-resulting-in-double-enqueue.patch +++ /dev/null @@ -1,120 +0,0 @@ -From f9bcdc9de0ced2b99b351e226344eb1c0246dd5c Mon Sep 17 00:00:00 2001 -From: Zhang Xiao -Date: Tue, 17 Mar 2020 12:47:43 +0100 -Subject: [PATCH 324/347] tasklet: Address a race resulting in double-enqueue -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -The kernel bugzilla has the following race condition reported: - -CPU0 CPU1 CPU2 ------------------------------------------------- -test_set SCHED - test_set RUN - if SCHED - add_list - raise - clear RUN - -test_set RUN -test_clear SCHED - ->func - test_set SCHED -tasklet_try_unlock ->0 -test_clear SCHED - test_set SCHED - ->func -tasklet_try_unlock ->1 - test_set RUN - if SCHED - add list - raise - clear RUN - test_set RUN - if SCHED - add list - raise - clear RUN - -As a result the tasklet is enqueued on both CPUs and run on both CPUs. Due -to the nature of the list used here, it is possible that further -(different) tasklets, which are enqueued after this double-enqueued -tasklet, are scheduled on CPU2 but invoked on CPU1. It is also possible -that these tasklets won't be invoked at all, because during the second -enqueue process the t->next pointer is set to NULL - dropping everything -from the list. - -This race will trigger one or two of the WARN_ON() in -tasklet_action_common(). -The problem is that the tasklet may be invoked multiple times and clear -SCHED bit on each invocation. This makes it possible to enqueue the -very same tasklet on different CPUs. - -Current RT-devel is using the upstream implementation which does not -re-run tasklets if they have SCHED set again and so it does not clear -the SCHED bit multiple times on a single invocation. - -Introduce the CHAINED flag. The tasklet will only be enqueued if the -CHAINED flag has been set successfully. -If it is possible to exchange the flags (CHAINED | RUN) -> 0 then the -tasklet won't be re-run. Otherwise the possible SCHED flag is removed -and the tasklet is re-run again. - -Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=61451 -Not-signed-off-by: Zhang Xiao -[bigeasy: patch description] -Signed-off-by: Sebastian Andrzej Siewior - -Signed-off-by: Tom Zanussi ---- - include/linux/interrupt.h | 5 ++++- - kernel/softirq.c | 6 +++++- - 2 files changed, 9 insertions(+), 2 deletions(-) - -diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h -index 97d9ba26915e..a3b5edb26bc5 100644 ---- a/include/linux/interrupt.h -+++ b/include/linux/interrupt.h -@@ -579,12 +579,15 @@ enum - { - TASKLET_STATE_SCHED, /* Tasklet is scheduled for execution */ - TASKLET_STATE_RUN, /* Tasklet is running (SMP only) */ -- TASKLET_STATE_PENDING /* Tasklet is pending */ -+ TASKLET_STATE_PENDING, /* Tasklet is pending */ -+ TASKLET_STATE_CHAINED /* Tasklet is chained */ - }; - - #define TASKLET_STATEF_SCHED (1 << TASKLET_STATE_SCHED) - #define TASKLET_STATEF_RUN (1 << TASKLET_STATE_RUN) - #define TASKLET_STATEF_PENDING (1 << TASKLET_STATE_PENDING) -+#define TASKLET_STATEF_CHAINED (1 << TASKLET_STATE_CHAINED) -+#define TASKLET_STATEF_RC (TASKLET_STATEF_RUN | TASKLET_STATEF_CHAINED) - - #if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT_FULL) - static inline int tasklet_trylock(struct tasklet_struct *t) -diff --git a/kernel/softirq.c b/kernel/softirq.c -index 25bcf2f2714b..73dae64bfc9c 100644 ---- a/kernel/softirq.c -+++ b/kernel/softirq.c -@@ -947,6 +947,10 @@ static void __tasklet_schedule_common(struct tasklet_struct *t, - * is locked before adding it to the list. - */ - if (test_bit(TASKLET_STATE_SCHED, &t->state)) { -+ if (test_and_set_bit(TASKLET_STATE_CHAINED, &t->state)) { -+ tasklet_unlock(t); -+ return; -+ } - t->next = NULL; - *head->tail = t; - head->tail = &(t->next); -@@ -1040,7 +1044,7 @@ static void tasklet_action_common(struct softirq_action *a, - again: - t->func(t->data); - -- while (!tasklet_tryunlock(t)) { -+ while (cmpxchg(&t->state, TASKLET_STATEF_RC, 0) != TASKLET_STATEF_RC) { - /* - * If it got disabled meanwhile, bail out: - */ --- -2.36.1 - diff --git a/debian/patches-rt/0325-fs-dcache-Include-swait.h-header.patch b/debian/patches-rt/0325-fs-dcache-Include-swait.h-header.patch new file mode 100644 index 000000000..8aef11928 --- /dev/null +++ b/debian/patches-rt/0325-fs-dcache-Include-swait.h-header.patch @@ -0,0 +1,32 @@ +From: Sebastian Andrzej Siewior +Date: Thu, 16 Apr 2020 12:42:15 +0200 +Subject: [PATCH 325/342] fs/dcache: Include swait.h header +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=80f3096d3e0bf8ea0482b3c1dd1c3bb835580d7f + +[ Upstream commit 279f90ddf53cd6bd3c203fbbf488d642ea2603de ] + +Include the swait.h header so it compiles even if not all patches are +applied. + +Reported-by: kbuild test robot +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Tom Zanussi + + Conflicts: + fs/proc/base.c +--- + fs/proc/base.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/fs/proc/base.c b/fs/proc/base.c +index accc230079bb..8806344af241 100644 +--- a/fs/proc/base.c ++++ b/fs/proc/base.c +@@ -95,6 +95,7 @@ + #include + #include + #include ++#include + #include "internal.h" + #include "fd.h" + diff --git a/debian/patches-rt/0325-hrtimer-fix-logic-for-when-grabbing-softirq_expiry_l.patch b/debian/patches-rt/0325-hrtimer-fix-logic-for-when-grabbing-softirq_expiry_l.patch deleted file mode 100644 index f84843891..000000000 --- a/debian/patches-rt/0325-hrtimer-fix-logic-for-when-grabbing-softirq_expiry_l.patch +++ /dev/null @@ -1,50 +0,0 @@ -From f3c5f444176119ec51e092dc9b9edea7a679c55e Mon Sep 17 00:00:00 2001 -From: Rasmus Villemoes -Date: Tue, 28 Apr 2020 16:40:26 +0200 -Subject: [PATCH 325/347] hrtimer: fix logic for when grabbing - softirq_expiry_lock can be elided -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -Commit - - hrtimer: Add a missing bracket and hide `migration_base' on !SMP - -which is 47b6de0b7f22 in 5.2-rt and 40aae5708e7a in 4.19-rt, -inadvertently changed the logic from base != &migration_base to base -== &migration_base. - -On !CONFIG_SMP, the effect was to effectively always elide this -lock/unlock pair (since is_migration_base() is unconditionally false), -which for me consistently causes lockups during reboot, and reportedly -also often causes a hang during boot. - -Adding this logical negation (or, what is effectively the same thing -on !CONFIG_SMP, reverting the above commit as well as "hrtimer: -Prevent using hrtimer_grab_expiry_lock() on migration_base") fixes -that lockup. - -Fixes: 40aae5708e7a (hrtimer: Add a missing bracket and hide `migration_base' on !SMP) # 4.19-rt -Fixes: 47b6de0b7f22 (hrtimer: Add a missing bracket and hide `migration_base' on !SMP) # 5.2-rt -Signed-off-by: Rasmus Villemoes -Reviewed-by: Steven Rostedt (VMware) -Signed-off-by: Tom Zanussi ---- - kernel/time/hrtimer.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c -index 0f841f18c363..a84673149881 100644 ---- a/kernel/time/hrtimer.c -+++ b/kernel/time/hrtimer.c -@@ -971,7 +971,7 @@ void hrtimer_grab_expiry_lock(const struct hrtimer *timer) - { - struct hrtimer_clock_base *base = READ_ONCE(timer->base); - -- if (timer->is_soft && is_migration_base(base)) { -+ if (timer->is_soft && !is_migration_base(base)) { - spin_lock(&base->cpu_base->softirq_expiry_lock); - spin_unlock(&base->cpu_base->softirq_expiry_lock); - } --- -2.36.1 - diff --git a/debian/patches-rt/0326-fs-dcache-Include-swait.h-header.patch b/debian/patches-rt/0326-fs-dcache-Include-swait.h-header.patch deleted file mode 100644 index b1408b268..000000000 --- a/debian/patches-rt/0326-fs-dcache-Include-swait.h-header.patch +++ /dev/null @@ -1,36 +0,0 @@ -From ff692653d0de39bf90f5a339c17c880b5afa0777 Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Thu, 16 Apr 2020 12:42:15 +0200 -Subject: [PATCH 326/347] fs/dcache: Include swait.h header -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 279f90ddf53cd6bd3c203fbbf488d642ea2603de ] - -Include the swait.h header so it compiles even if not all patches are -applied. - -Reported-by: kbuild test robot -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Tom Zanussi - - Conflicts: - fs/proc/base.c ---- - fs/proc/base.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/fs/proc/base.c b/fs/proc/base.c -index accc230079bb..8806344af241 100644 ---- a/fs/proc/base.c -+++ b/fs/proc/base.c -@@ -95,6 +95,7 @@ - #include - #include - #include -+#include - #include "internal.h" - #include "fd.h" - --- -2.36.1 - diff --git a/debian/patches-rt/0326-mm-slub-Always-flush-the-delayed-empty-slubs-in-flus.patch b/debian/patches-rt/0326-mm-slub-Always-flush-the-delayed-empty-slubs-in-flus.patch new file mode 100644 index 000000000..e47281eae --- /dev/null +++ b/debian/patches-rt/0326-mm-slub-Always-flush-the-delayed-empty-slubs-in-flus.patch @@ -0,0 +1,60 @@ +From: Kevin Hao +Date: Mon, 4 May 2020 11:34:07 +0800 +Subject: [PATCH 326/342] mm: slub: Always flush the delayed empty slubs in + flush_all() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=e7c1ebce4ab716a7ddb59afbd334d1ab5b89c684 + +[ Upstream commit 23a2c31b19e99beaf5107071b0f32a596202cdae ] + +After commit f0b231101c94 ("mm/SLUB: delay giving back empty slubs to +IRQ enabled regions"), when the free_slab() is invoked with the IRQ +disabled, the empty slubs are moved to a per-CPU list and will be +freed after IRQ enabled later. But in the current codes, there is +a check to see if there really has the cpu slub on a specific cpu +before flushing the delayed empty slubs, this may cause a reference +of already released kmem_cache in a scenario like below: + cpu 0 cpu 1 + kmem_cache_destroy() + flush_all() + --->IPI flush_cpu_slab() + flush_slab() + deactivate_slab() + discard_slab() + free_slab() + c->page = NULL; + for_each_online_cpu(cpu) + if (!has_cpu_slab(1, s)) + continue + this skip to flush the delayed + empty slub released by cpu1 + kmem_cache_free(kmem_cache, s) + + kmalloc() + __slab_alloc() + free_delayed() + __free_slab() + reference to released kmem_cache + +Fixes: f0b231101c94 ("mm/SLUB: delay giving back empty slubs to IRQ enabled regions") +Signed-off-by: Kevin Hao +Signed-off-by: Sebastian Andrzej Siewior +Cc: stable-rt@vger.kernel.org +Signed-off-by: Tom Zanussi +--- + mm/slub.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/mm/slub.c b/mm/slub.c +index 676006f34077..de80b015fb99 100644 +--- a/mm/slub.c ++++ b/mm/slub.c +@@ -2375,9 +2375,6 @@ static void flush_all(struct kmem_cache *s) + for_each_online_cpu(cpu) { + struct slub_free_list *f; + +- if (!has_cpu_slab(cpu, s)) +- continue; +- + f = &per_cpu(slub_free_list, cpu); + raw_spin_lock_irq(&f->lock); + list_splice_init(&f->list, &tofree); diff --git a/debian/patches-rt/0327-mm-slub-Always-flush-the-delayed-empty-slubs-in-flus.patch b/debian/patches-rt/0327-mm-slub-Always-flush-the-delayed-empty-slubs-in-flus.patch deleted file mode 100644 index 870ba009b..000000000 --- a/debian/patches-rt/0327-mm-slub-Always-flush-the-delayed-empty-slubs-in-flus.patch +++ /dev/null @@ -1,64 +0,0 @@ -From b997a51c5b5970f8defda681658e94bb5612dd2f Mon Sep 17 00:00:00 2001 -From: Kevin Hao -Date: Mon, 4 May 2020 11:34:07 +0800 -Subject: [PATCH 327/347] mm: slub: Always flush the delayed empty slubs in - flush_all() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 23a2c31b19e99beaf5107071b0f32a596202cdae ] - -After commit f0b231101c94 ("mm/SLUB: delay giving back empty slubs to -IRQ enabled regions"), when the free_slab() is invoked with the IRQ -disabled, the empty slubs are moved to a per-CPU list and will be -freed after IRQ enabled later. But in the current codes, there is -a check to see if there really has the cpu slub on a specific cpu -before flushing the delayed empty slubs, this may cause a reference -of already released kmem_cache in a scenario like below: - cpu 0 cpu 1 - kmem_cache_destroy() - flush_all() - --->IPI flush_cpu_slab() - flush_slab() - deactivate_slab() - discard_slab() - free_slab() - c->page = NULL; - for_each_online_cpu(cpu) - if (!has_cpu_slab(1, s)) - continue - this skip to flush the delayed - empty slub released by cpu1 - kmem_cache_free(kmem_cache, s) - - kmalloc() - __slab_alloc() - free_delayed() - __free_slab() - reference to released kmem_cache - -Fixes: f0b231101c94 ("mm/SLUB: delay giving back empty slubs to IRQ enabled regions") -Signed-off-by: Kevin Hao -Signed-off-by: Sebastian Andrzej Siewior -Cc: stable-rt@vger.kernel.org -Signed-off-by: Tom Zanussi ---- - mm/slub.c | 3 --- - 1 file changed, 3 deletions(-) - -diff --git a/mm/slub.c b/mm/slub.c -index 3b1edb545215..497096152c39 100644 ---- a/mm/slub.c -+++ b/mm/slub.c -@@ -2376,9 +2376,6 @@ static void flush_all(struct kmem_cache *s) - for_each_online_cpu(cpu) { - struct slub_free_list *f; - -- if (!has_cpu_slab(cpu, s)) -- continue; -- - f = &per_cpu(slub_free_list, cpu); - raw_spin_lock_irq(&f->lock); - list_splice_init(&f->list, &tofree); --- -2.36.1 - diff --git a/debian/patches-rt/0327-tasklet-Fix-UP-case-for-tasklet-CHAINED-state.patch b/debian/patches-rt/0327-tasklet-Fix-UP-case-for-tasklet-CHAINED-state.patch new file mode 100644 index 000000000..448ee797a --- /dev/null +++ b/debian/patches-rt/0327-tasklet-Fix-UP-case-for-tasklet-CHAINED-state.patch @@ -0,0 +1,52 @@ +From: Tom Zanussi +Date: Tue, 9 Jun 2020 11:04:08 -0500 +Subject: [PATCH 327/342] tasklet: Fix UP case for tasklet CHAINED state +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=ca828148bcc43ec7ed745e6bb0c076441138f09f + +commit 62d0a2a30cd0 (tasklet: Address a race resulting in +double-enqueue) addresses a problem that can result in a tasklet being +enqueued on two cpus at the same time by combining the RUN flag with a +new CHAINED flag, and relies on the combination to be present in order +to zero it out, which can never happen on (!SMP and !PREEMPT_RT_FULL) +because the RUN flag is SMP/PREEMPT_RT_FULL-only. + +So make sure the above commit is only applied for the SMP || +PREEMPT_RT_FULL case. + +Fixes: 62d0a2a30cd0 ("tasklet: Address a race resulting in double-enqueue") +Signed-off-by: Tom Zanussi +Reported-by: Ramon Fried +Tested-By: Ramon Fried +--- + kernel/softirq.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/kernel/softirq.c b/kernel/softirq.c +index 73dae64bfc9c..9bad7a16dc61 100644 +--- a/kernel/softirq.c ++++ b/kernel/softirq.c +@@ -947,10 +947,12 @@ static void __tasklet_schedule_common(struct tasklet_struct *t, + * is locked before adding it to the list. + */ + if (test_bit(TASKLET_STATE_SCHED, &t->state)) { ++#if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT_FULL) + if (test_and_set_bit(TASKLET_STATE_CHAINED, &t->state)) { + tasklet_unlock(t); + return; + } ++#endif + t->next = NULL; + *head->tail = t; + head->tail = &(t->next); +@@ -1044,7 +1046,11 @@ static void tasklet_action_common(struct softirq_action *a, + again: + t->func(t->data); + ++#if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT_FULL) + while (cmpxchg(&t->state, TASKLET_STATEF_RC, 0) != TASKLET_STATEF_RC) { ++#else ++ while (!tasklet_tryunlock(t)) { ++#endif + /* + * If it got disabled meanwhile, bail out: + */ diff --git a/debian/patches-rt/0328-signal-Prevent-double-free-of-user-struct.patch b/debian/patches-rt/0328-signal-Prevent-double-free-of-user-struct.patch new file mode 100644 index 000000000..728a5ce48 --- /dev/null +++ b/debian/patches-rt/0328-signal-Prevent-double-free-of-user-struct.patch @@ -0,0 +1,51 @@ +From: Matt Fleming +Date: Tue, 7 Apr 2020 10:54:13 +0100 +Subject: [PATCH 328/342] signal: Prevent double-free of user struct +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=c247eea7618fab8dc4ca5b123a7708de3550a64b + +[ Upsteam commit 9567db2ebe566a93485e1a27d8759969d0002d7a ] + +The way user struct reference counting works changed significantly with, + + fda31c50292a ("signal: avoid double atomic counter increments for user accounting") + +Now user structs are only freed once the last pending signal is +dequeued. Make sigqueue_free_current() follow this new convention to +avoid freeing the user struct multiple times and triggering this +warning: + + refcount_t: underflow; use-after-free. + WARNING: CPU: 0 PID: 6794 at lib/refcount.c:288 refcount_dec_not_one+0x45/0x50 + Call Trace: + refcount_dec_and_lock_irqsave+0x16/0x60 + free_uid+0x31/0xa0 + __dequeue_signal+0x17c/0x190 + dequeue_signal+0x5a/0x1b0 + do_sigtimedwait+0x208/0x250 + __x64_sys_rt_sigtimedwait+0x6f/0xd0 + do_syscall_64+0x72/0x200 + entry_SYSCALL_64_after_hwframe+0x49/0xbe + +Signed-off-by: Matt Fleming +Reported-by: Daniel Wagner +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Tom Zanussi +--- + kernel/signal.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/kernel/signal.c b/kernel/signal.c +index 730ac7ff4637..0cabba4cfd7f 100644 +--- a/kernel/signal.c ++++ b/kernel/signal.c +@@ -489,8 +489,8 @@ static void sigqueue_free_current(struct sigqueue *q) + + up = q->user; + if (rt_prio(current->normal_prio) && !put_task_cache(current, q)) { +- atomic_dec(&up->sigpending); +- free_uid(up); ++ if (atomic_dec_and_test(&up->sigpending)) ++ free_uid(up); + } else + __sigqueue_free(q); + } diff --git a/debian/patches-rt/0328-tasklet-Fix-UP-case-for-tasklet-CHAINED-state.patch b/debian/patches-rt/0328-tasklet-Fix-UP-case-for-tasklet-CHAINED-state.patch deleted file mode 100644 index 704118247..000000000 --- a/debian/patches-rt/0328-tasklet-Fix-UP-case-for-tasklet-CHAINED-state.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 562e557f31503bcd1d37d5979221e28bd0328786 Mon Sep 17 00:00:00 2001 -From: Tom Zanussi -Date: Tue, 9 Jun 2020 11:04:08 -0500 -Subject: [PATCH 328/347] tasklet: Fix UP case for tasklet CHAINED state -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -commit 62d0a2a30cd0 (tasklet: Address a race resulting in -double-enqueue) addresses a problem that can result in a tasklet being -enqueued on two cpus at the same time by combining the RUN flag with a -new CHAINED flag, and relies on the combination to be present in order -to zero it out, which can never happen on (!SMP and !PREEMPT_RT_FULL) -because the RUN flag is SMP/PREEMPT_RT_FULL-only. - -So make sure the above commit is only applied for the SMP || -PREEMPT_RT_FULL case. - -Fixes: 62d0a2a30cd0 ("tasklet: Address a race resulting in double-enqueue") -Signed-off-by: Tom Zanussi -Reported-by: Ramon Fried -Tested-By: Ramon Fried ---- - kernel/softirq.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/kernel/softirq.c b/kernel/softirq.c -index 73dae64bfc9c..9bad7a16dc61 100644 ---- a/kernel/softirq.c -+++ b/kernel/softirq.c -@@ -947,10 +947,12 @@ static void __tasklet_schedule_common(struct tasklet_struct *t, - * is locked before adding it to the list. - */ - if (test_bit(TASKLET_STATE_SCHED, &t->state)) { -+#if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT_FULL) - if (test_and_set_bit(TASKLET_STATE_CHAINED, &t->state)) { - tasklet_unlock(t); - return; - } -+#endif - t->next = NULL; - *head->tail = t; - head->tail = &(t->next); -@@ -1044,7 +1046,11 @@ static void tasklet_action_common(struct softirq_action *a, - again: - t->func(t->data); - -+#if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT_FULL) - while (cmpxchg(&t->state, TASKLET_STATEF_RC, 0) != TASKLET_STATEF_RC) { -+#else -+ while (!tasklet_tryunlock(t)) { -+#endif - /* - * If it got disabled meanwhile, bail out: - */ --- -2.36.1 - diff --git a/debian/patches-rt/0329-Bluetooth-Acquire-sk_lock.slock-without-disabling-in.patch b/debian/patches-rt/0329-Bluetooth-Acquire-sk_lock.slock-without-disabling-in.patch new file mode 100644 index 000000000..662a647b7 --- /dev/null +++ b/debian/patches-rt/0329-Bluetooth-Acquire-sk_lock.slock-without-disabling-in.patch @@ -0,0 +1,61 @@ +From: Sebastian Andrzej Siewior +Date: Thu, 28 May 2020 14:35:12 +0200 +Subject: [PATCH 329/342] Bluetooth: Acquire sk_lock.slock without disabling + interrupts +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=2f70f452aa211f4c64f5a8cf1c8a97cf8d4f1f2b + +[ Upstream commit e6da0edc24eecef2f6964d92fa9044e1821deace ] + +There was a lockdep which led to commit + fad003b6c8e3d ("Bluetooth: Fix inconsistent lock state with RFCOMM") + +Lockdep noticed that `sk->sk_lock.slock' was acquired without disabling +the softirq while the lock was also used in softirq context. +Unfortunately the solution back then was to disable interrupts before +acquiring the lock which however made lockdep happy. +It would have been enough to simply disable the softirq. Disabling +interrupts before acquiring a spinlock_t is not allowed on PREEMPT_RT +because these locks are converted to 'sleeping' spinlocks. + +Use spin_lock_bh() in order to acquire the `sk_lock.slock'. + +Reported-by: Luis Claudio R. Goncalves +Reported-by: kbuild test robot [missing unlock] +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Marcel Holtmann +Signed-off-by: Tom Zanussi +--- + net/bluetooth/rfcomm/sock.c | 7 ++----- + 1 file changed, 2 insertions(+), 5 deletions(-) + +diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c +index 78830efe89d7..dd4b9a6f435e 100644 +--- a/net/bluetooth/rfcomm/sock.c ++++ b/net/bluetooth/rfcomm/sock.c +@@ -64,15 +64,13 @@ static void rfcomm_sk_data_ready(struct rfcomm_dlc *d, struct sk_buff *skb) + static void rfcomm_sk_state_change(struct rfcomm_dlc *d, int err) + { + struct sock *sk = d->owner, *parent; +- unsigned long flags; + + if (!sk) + return; + + BT_DBG("dlc %p state %ld err %d", d, d->state, err); + +- local_irq_save(flags); +- bh_lock_sock(sk); ++ spin_lock_bh(&sk->sk_lock.slock); + + if (err) + sk->sk_err = err; +@@ -93,8 +91,7 @@ static void rfcomm_sk_state_change(struct rfcomm_dlc *d, int err) + sk->sk_state_change(sk); + } + +- bh_unlock_sock(sk); +- local_irq_restore(flags); ++ spin_unlock_bh(&sk->sk_lock.slock); + + if (parent && sock_flag(sk, SOCK_ZAPPED)) { + /* We have to drop DLC lock here, otherwise diff --git a/debian/patches-rt/0329-signal-Prevent-double-free-of-user-struct.patch b/debian/patches-rt/0329-signal-Prevent-double-free-of-user-struct.patch deleted file mode 100644 index 253dc5c91..000000000 --- a/debian/patches-rt/0329-signal-Prevent-double-free-of-user-struct.patch +++ /dev/null @@ -1,55 +0,0 @@ -From a99e09659e6cd4b633c3689f2c3aa5f8a816fe5b Mon Sep 17 00:00:00 2001 -From: Matt Fleming -Date: Tue, 7 Apr 2020 10:54:13 +0100 -Subject: [PATCH 329/347] signal: Prevent double-free of user struct -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upsteam commit 9567db2ebe566a93485e1a27d8759969d0002d7a ] - -The way user struct reference counting works changed significantly with, - - fda31c50292a ("signal: avoid double atomic counter increments for user accounting") - -Now user structs are only freed once the last pending signal is -dequeued. Make sigqueue_free_current() follow this new convention to -avoid freeing the user struct multiple times and triggering this -warning: - - refcount_t: underflow; use-after-free. - WARNING: CPU: 0 PID: 6794 at lib/refcount.c:288 refcount_dec_not_one+0x45/0x50 - Call Trace: - refcount_dec_and_lock_irqsave+0x16/0x60 - free_uid+0x31/0xa0 - __dequeue_signal+0x17c/0x190 - dequeue_signal+0x5a/0x1b0 - do_sigtimedwait+0x208/0x250 - __x64_sys_rt_sigtimedwait+0x6f/0xd0 - do_syscall_64+0x72/0x200 - entry_SYSCALL_64_after_hwframe+0x49/0xbe - -Signed-off-by: Matt Fleming -Reported-by: Daniel Wagner -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Tom Zanussi ---- - kernel/signal.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/kernel/signal.c b/kernel/signal.c -index 74f807bba0b8..59294dfaa744 100644 ---- a/kernel/signal.c -+++ b/kernel/signal.c -@@ -489,8 +489,8 @@ static void sigqueue_free_current(struct sigqueue *q) - - up = q->user; - if (rt_prio(current->normal_prio) && !put_task_cache(current, q)) { -- atomic_dec(&up->sigpending); -- free_uid(up); -+ if (atomic_dec_and_test(&up->sigpending)) -+ free_uid(up); - } else - __sigqueue_free(q); - } --- -2.36.1 - diff --git a/debian/patches-rt/0330-Bluetooth-Acquire-sk_lock.slock-without-disabling-in.patch b/debian/patches-rt/0330-Bluetooth-Acquire-sk_lock.slock-without-disabling-in.patch deleted file mode 100644 index ff8d39cfc..000000000 --- a/debian/patches-rt/0330-Bluetooth-Acquire-sk_lock.slock-without-disabling-in.patch +++ /dev/null @@ -1,65 +0,0 @@ -From ba289a24015e6e110bcc57dad832a8094be6b955 Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Thu, 28 May 2020 14:35:12 +0200 -Subject: [PATCH 330/347] Bluetooth: Acquire sk_lock.slock without disabling - interrupts -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit e6da0edc24eecef2f6964d92fa9044e1821deace ] - -There was a lockdep which led to commit - fad003b6c8e3d ("Bluetooth: Fix inconsistent lock state with RFCOMM") - -Lockdep noticed that `sk->sk_lock.slock' was acquired without disabling -the softirq while the lock was also used in softirq context. -Unfortunately the solution back then was to disable interrupts before -acquiring the lock which however made lockdep happy. -It would have been enough to simply disable the softirq. Disabling -interrupts before acquiring a spinlock_t is not allowed on PREEMPT_RT -because these locks are converted to 'sleeping' spinlocks. - -Use spin_lock_bh() in order to acquire the `sk_lock.slock'. - -Reported-by: Luis Claudio R. Goncalves -Reported-by: kbuild test robot [missing unlock] -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Marcel Holtmann -Signed-off-by: Tom Zanussi ---- - net/bluetooth/rfcomm/sock.c | 7 ++----- - 1 file changed, 2 insertions(+), 5 deletions(-) - -diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c -index c044ff2f73e6..75bc8102cdd7 100644 ---- a/net/bluetooth/rfcomm/sock.c -+++ b/net/bluetooth/rfcomm/sock.c -@@ -64,15 +64,13 @@ static void rfcomm_sk_data_ready(struct rfcomm_dlc *d, struct sk_buff *skb) - static void rfcomm_sk_state_change(struct rfcomm_dlc *d, int err) - { - struct sock *sk = d->owner, *parent; -- unsigned long flags; - - if (!sk) - return; - - BT_DBG("dlc %p state %ld err %d", d, d->state, err); - -- local_irq_save(flags); -- bh_lock_sock(sk); -+ spin_lock_bh(&sk->sk_lock.slock); - - if (err) - sk->sk_err = err; -@@ -93,8 +91,7 @@ static void rfcomm_sk_state_change(struct rfcomm_dlc *d, int err) - sk->sk_state_change(sk); - } - -- bh_unlock_sock(sk); -- local_irq_restore(flags); -+ spin_unlock_bh(&sk->sk_lock.slock); - - if (parent && sock_flag(sk, SOCK_ZAPPED)) { - /* We have to drop DLC lock here, otherwise --- -2.36.1 - diff --git a/debian/patches-rt/0330-net-phy-fixed_phy-Remove-unused-seqcount.patch b/debian/patches-rt/0330-net-phy-fixed_phy-Remove-unused-seqcount.patch new file mode 100644 index 000000000..b69e98a7f --- /dev/null +++ b/debian/patches-rt/0330-net-phy-fixed_phy-Remove-unused-seqcount.patch @@ -0,0 +1,85 @@ +From: "Ahmed S. Darwish" +Date: Wed, 10 Jun 2020 12:53:00 +0200 +Subject: [PATCH 330/342] net: phy: fixed_phy: Remove unused seqcount +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=ac41b33982062b3bee7c5c1823f179d6fec787ad + +[ Upstream commit 6554eac9ef2bd1c968886b31cc7266b49258a463 ] + +Commit bf7afb29d545 ("phy: improve safety of fixed-phy MII register +reading") protected the fixed PHY status with a sequence counter. + +Two years later, commit d2b977939b18 ("net: phy: fixed-phy: remove +fixed_phy_update_state()") removed the sequence counter's write side +critical section -- neutralizing its read side retry loop. + +Remove the unused seqcount. + +Signed-off-by: Ahmed S. Darwish +Reviewed-by: Sebastian Andrzej Siewior +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +(cherry picked from v5.8-rc1 commit 79cbb6bc3332da7162c2581e151659ab8ebaa528) +Signed-off-by: Ahmed S. Darwish +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Tom Zanussi +--- + drivers/net/phy/fixed_phy.c | 25 +++++++++---------------- + 1 file changed, 9 insertions(+), 16 deletions(-) + +diff --git a/drivers/net/phy/fixed_phy.c b/drivers/net/phy/fixed_phy.c +index 59820164502e..953ff54dd5df 100644 +--- a/drivers/net/phy/fixed_phy.c ++++ b/drivers/net/phy/fixed_phy.c +@@ -23,7 +23,6 @@ + #include + #include + #include +-#include + #include + + #include "swphy.h" +@@ -36,7 +35,6 @@ struct fixed_mdio_bus { + struct fixed_phy { + int addr; + struct phy_device *phydev; +- seqcount_t seqcount; + struct fixed_phy_status status; + int (*link_update)(struct net_device *, struct fixed_phy_status *); + struct list_head node; +@@ -62,18 +60,15 @@ static int fixed_mdio_read(struct mii_bus *bus, int phy_addr, int reg_num) + list_for_each_entry(fp, &fmb->phys, node) { + if (fp->addr == phy_addr) { + struct fixed_phy_status state; +- int s; +- +- do { +- s = read_seqcount_begin(&fp->seqcount); +- /* Issue callback if user registered it. */ +- if (fp->link_update) +- fp->link_update(fp->phydev->attached_dev, +- &fp->status); +- /* Check the GPIO for change in status */ +- fixed_phy_update(fp); +- state = fp->status; +- } while (read_seqcount_retry(&fp->seqcount, s)); ++ ++ /* Issue callback if user registered it. */ ++ if (fp->link_update) ++ fp->link_update(fp->phydev->attached_dev, ++ &fp->status); ++ ++ /* Check the GPIO for change in status */ ++ fixed_phy_update(fp); ++ state = fp->status; + + return swphy_read_reg(reg_num, &state); + } +@@ -131,8 +126,6 @@ int fixed_phy_add(unsigned int irq, int phy_addr, + if (!fp) + return -ENOMEM; + +- seqcount_init(&fp->seqcount); +- + if (irq != PHY_POLL) + fmb->mii_bus->irq[phy_addr] = irq; + diff --git a/debian/patches-rt/0331-net-phy-fixed_phy-Remove-unused-seqcount.patch b/debian/patches-rt/0331-net-phy-fixed_phy-Remove-unused-seqcount.patch deleted file mode 100644 index ceacf6b1e..000000000 --- a/debian/patches-rt/0331-net-phy-fixed_phy-Remove-unused-seqcount.patch +++ /dev/null @@ -1,89 +0,0 @@ -From 1d956b22e273e7a1ce90b54cd84598e1a427f3f2 Mon Sep 17 00:00:00 2001 -From: "Ahmed S. Darwish" -Date: Wed, 10 Jun 2020 12:53:00 +0200 -Subject: [PATCH 331/347] net: phy: fixed_phy: Remove unused seqcount -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 6554eac9ef2bd1c968886b31cc7266b49258a463 ] - -Commit bf7afb29d545 ("phy: improve safety of fixed-phy MII register -reading") protected the fixed PHY status with a sequence counter. - -Two years later, commit d2b977939b18 ("net: phy: fixed-phy: remove -fixed_phy_update_state()") removed the sequence counter's write side -critical section -- neutralizing its read side retry loop. - -Remove the unused seqcount. - -Signed-off-by: Ahmed S. Darwish -Reviewed-by: Sebastian Andrzej Siewior -Reviewed-by: Andrew Lunn -Signed-off-by: David S. Miller -(cherry picked from v5.8-rc1 commit 79cbb6bc3332da7162c2581e151659ab8ebaa528) -Signed-off-by: Ahmed S. Darwish -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Tom Zanussi ---- - drivers/net/phy/fixed_phy.c | 25 +++++++++---------------- - 1 file changed, 9 insertions(+), 16 deletions(-) - -diff --git a/drivers/net/phy/fixed_phy.c b/drivers/net/phy/fixed_phy.c -index 59820164502e..953ff54dd5df 100644 ---- a/drivers/net/phy/fixed_phy.c -+++ b/drivers/net/phy/fixed_phy.c -@@ -23,7 +23,6 @@ - #include - #include - #include --#include - #include - - #include "swphy.h" -@@ -36,7 +35,6 @@ struct fixed_mdio_bus { - struct fixed_phy { - int addr; - struct phy_device *phydev; -- seqcount_t seqcount; - struct fixed_phy_status status; - int (*link_update)(struct net_device *, struct fixed_phy_status *); - struct list_head node; -@@ -62,18 +60,15 @@ static int fixed_mdio_read(struct mii_bus *bus, int phy_addr, int reg_num) - list_for_each_entry(fp, &fmb->phys, node) { - if (fp->addr == phy_addr) { - struct fixed_phy_status state; -- int s; -- -- do { -- s = read_seqcount_begin(&fp->seqcount); -- /* Issue callback if user registered it. */ -- if (fp->link_update) -- fp->link_update(fp->phydev->attached_dev, -- &fp->status); -- /* Check the GPIO for change in status */ -- fixed_phy_update(fp); -- state = fp->status; -- } while (read_seqcount_retry(&fp->seqcount, s)); -+ -+ /* Issue callback if user registered it. */ -+ if (fp->link_update) -+ fp->link_update(fp->phydev->attached_dev, -+ &fp->status); -+ -+ /* Check the GPIO for change in status */ -+ fixed_phy_update(fp); -+ state = fp->status; - - return swphy_read_reg(reg_num, &state); - } -@@ -131,8 +126,6 @@ int fixed_phy_add(unsigned int irq, int phy_addr, - if (!fp) - return -ENOMEM; - -- seqcount_init(&fp->seqcount); -- - if (irq != PHY_POLL) - fmb->mii_bus->irq[phy_addr] = irq; - --- -2.36.1 - diff --git a/debian/patches-rt/0331-net-xfrm-fix-compress-vs-decompress-serialization.patch b/debian/patches-rt/0331-net-xfrm-fix-compress-vs-decompress-serialization.patch new file mode 100644 index 000000000..7d3f711b4 --- /dev/null +++ b/debian/patches-rt/0331-net-xfrm-fix-compress-vs-decompress-serialization.patch @@ -0,0 +1,98 @@ +From: Davidlohr Bueso +Date: Tue, 18 Aug 2020 09:20:53 -0700 +Subject: [PATCH 331/342] net: xfrm: fix compress vs decompress serialization +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=232e27733feb20a490b99f63f08c073c9ed9e9d9 + +A crash was seen in xfrm when running ltp's 'tcp4_ipsec06' stresser on v4.x +based RT kernels. + +ipcomp_compress() will serialize access to the ipcomp_scratches percpu buffer by +disabling BH and preventing a softirq from coming in and running ipcom_decompress(), +which is never called from process context. This of course won't work on RT and +the buffer can get corrupted; there have been similar issues with in the past with +such assumptions, ie: ebf255ed6c44 (net: add back the missing serialization in +ip_send_unicast_reply()). + +Similarly, this patch addresses the issue with locallocks allowing RT to have a +percpu spinlock and do the correct serialization. + +Signed-off-by: Davidlohr Bueso +Signed-off-by: Tom Zanussi +--- + net/xfrm/xfrm_ipcomp.c | 21 +++++++++++++++------ + 1 file changed, 15 insertions(+), 6 deletions(-) + +diff --git a/net/xfrm/xfrm_ipcomp.c b/net/xfrm/xfrm_ipcomp.c +index a00ec715aa46..a97997385423 100644 +--- a/net/xfrm/xfrm_ipcomp.c ++++ b/net/xfrm/xfrm_ipcomp.c +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -36,6 +37,7 @@ struct ipcomp_tfms { + + static DEFINE_MUTEX(ipcomp_resource_mutex); + static void * __percpu *ipcomp_scratches; ++static DEFINE_LOCAL_IRQ_LOCK(ipcomp_scratches_lock); + static int ipcomp_scratch_users; + static LIST_HEAD(ipcomp_tfms_list); + +@@ -45,12 +47,15 @@ static int ipcomp_decompress(struct xfrm_state *x, struct sk_buff *skb) + const int plen = skb->len; + int dlen = IPCOMP_SCRATCH_SIZE; + const u8 *start = skb->data; +- const int cpu = get_cpu(); +- u8 *scratch = *per_cpu_ptr(ipcomp_scratches, cpu); +- struct crypto_comp *tfm = *per_cpu_ptr(ipcd->tfms, cpu); +- int err = crypto_comp_decompress(tfm, start, plen, scratch, &dlen); +- int len; ++ u8 *scratch; ++ struct crypto_comp *tfm; ++ int err, len; ++ ++ local_lock(ipcomp_scratches_lock); + ++ scratch = *this_cpu_ptr(ipcomp_scratches); ++ tfm = *this_cpu_ptr(ipcd->tfms); ++ err = crypto_comp_decompress(tfm, start, plen, scratch, &dlen); + if (err) + goto out; + +@@ -103,7 +108,7 @@ static int ipcomp_decompress(struct xfrm_state *x, struct sk_buff *skb) + err = 0; + + out: +- put_cpu(); ++ local_unlock(ipcomp_scratches_lock); + return err; + } + +@@ -146,6 +151,8 @@ static int ipcomp_compress(struct xfrm_state *x, struct sk_buff *skb) + int err; + + local_bh_disable(); ++ local_lock(ipcomp_scratches_lock); ++ + scratch = *this_cpu_ptr(ipcomp_scratches); + tfm = *this_cpu_ptr(ipcd->tfms); + err = crypto_comp_compress(tfm, start, plen, scratch, &dlen); +@@ -158,12 +165,14 @@ static int ipcomp_compress(struct xfrm_state *x, struct sk_buff *skb) + } + + memcpy(start + sizeof(struct ip_comp_hdr), scratch, dlen); ++ local_unlock(ipcomp_scratches_lock); + local_bh_enable(); + + pskb_trim(skb, dlen + sizeof(struct ip_comp_hdr)); + return 0; + + out: ++ local_unlock(ipcomp_scratches_lock); + local_bh_enable(); + return err; + } diff --git a/debian/patches-rt/0332-mm-memcontrol-Disable-preemption-in-__mod_memcg_lruv.patch b/debian/patches-rt/0332-mm-memcontrol-Disable-preemption-in-__mod_memcg_lruv.patch new file mode 100644 index 000000000..40b467019 --- /dev/null +++ b/debian/patches-rt/0332-mm-memcontrol-Disable-preemption-in-__mod_memcg_lruv.patch @@ -0,0 +1,46 @@ +From: Sebastian Andrzej Siewior +Date: Wed, 28 Oct 2020 18:15:32 +0100 +Subject: [PATCH 332/342] mm/memcontrol: Disable preemption in + __mod_memcg_lruvec_state() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=63d8d55e818822e2fbbcc26d07e498d22d21f001 + +[ Upstream commit 74858f0d38a8d3c069a0745ff53ae084c8e7cabb ] + +The callers expect disabled preemption/interrupts while invoking +__mod_memcg_lruvec_state(). This works mainline because a lock of +somekind is acquired. + +Use preempt_disable_rt() where per-CPU variables are accessed and a +stable pointer is expected. This is also done in __mod_zone_page_state() +for the same reason. + +Cc: stable-rt@vger.kernel.org +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Tom Zanussi + + Conflicts: + mm/memcontrol.c +--- + include/linux/memcontrol.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h +index cc6b6532eb56..dbb2c4e27277 100644 +--- a/include/linux/memcontrol.h ++++ b/include/linux/memcontrol.h +@@ -665,6 +665,7 @@ static inline void __mod_lruvec_state(struct lruvec *lruvec, + + pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec); + ++ preempt_disable_rt(); + /* Update memcg */ + __mod_memcg_state(pn->memcg, idx, val); + +@@ -675,6 +676,7 @@ static inline void __mod_lruvec_state(struct lruvec *lruvec, + x = 0; + } + __this_cpu_write(pn->lruvec_stat_cpu->count[idx], x); ++ preempt_enable_rt(); + } + + static inline void mod_lruvec_state(struct lruvec *lruvec, diff --git a/debian/patches-rt/0332-net-xfrm-fix-compress-vs-decompress-serialization.patch b/debian/patches-rt/0332-net-xfrm-fix-compress-vs-decompress-serialization.patch deleted file mode 100644 index 23117039c..000000000 --- a/debian/patches-rt/0332-net-xfrm-fix-compress-vs-decompress-serialization.patch +++ /dev/null @@ -1,102 +0,0 @@ -From 502a0ae30b2c2d53fde16d55fe8ae20312d4b520 Mon Sep 17 00:00:00 2001 -From: Davidlohr Bueso -Date: Tue, 18 Aug 2020 09:20:53 -0700 -Subject: [PATCH 332/347] net: xfrm: fix compress vs decompress serialization -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -A crash was seen in xfrm when running ltp's 'tcp4_ipsec06' stresser on v4.x -based RT kernels. - -ipcomp_compress() will serialize access to the ipcomp_scratches percpu buffer by -disabling BH and preventing a softirq from coming in and running ipcom_decompress(), -which is never called from process context. This of course won't work on RT and -the buffer can get corrupted; there have been similar issues with in the past with -such assumptions, ie: ebf255ed6c44 (net: add back the missing serialization in -ip_send_unicast_reply()). - -Similarly, this patch addresses the issue with locallocks allowing RT to have a -percpu spinlock and do the correct serialization. - -Signed-off-by: Davidlohr Bueso -Signed-off-by: Tom Zanussi ---- - net/xfrm/xfrm_ipcomp.c | 21 +++++++++++++++------ - 1 file changed, 15 insertions(+), 6 deletions(-) - -diff --git a/net/xfrm/xfrm_ipcomp.c b/net/xfrm/xfrm_ipcomp.c -index a00ec715aa46..a97997385423 100644 ---- a/net/xfrm/xfrm_ipcomp.c -+++ b/net/xfrm/xfrm_ipcomp.c -@@ -20,6 +20,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -36,6 +37,7 @@ struct ipcomp_tfms { - - static DEFINE_MUTEX(ipcomp_resource_mutex); - static void * __percpu *ipcomp_scratches; -+static DEFINE_LOCAL_IRQ_LOCK(ipcomp_scratches_lock); - static int ipcomp_scratch_users; - static LIST_HEAD(ipcomp_tfms_list); - -@@ -45,12 +47,15 @@ static int ipcomp_decompress(struct xfrm_state *x, struct sk_buff *skb) - const int plen = skb->len; - int dlen = IPCOMP_SCRATCH_SIZE; - const u8 *start = skb->data; -- const int cpu = get_cpu(); -- u8 *scratch = *per_cpu_ptr(ipcomp_scratches, cpu); -- struct crypto_comp *tfm = *per_cpu_ptr(ipcd->tfms, cpu); -- int err = crypto_comp_decompress(tfm, start, plen, scratch, &dlen); -- int len; -+ u8 *scratch; -+ struct crypto_comp *tfm; -+ int err, len; -+ -+ local_lock(ipcomp_scratches_lock); - -+ scratch = *this_cpu_ptr(ipcomp_scratches); -+ tfm = *this_cpu_ptr(ipcd->tfms); -+ err = crypto_comp_decompress(tfm, start, plen, scratch, &dlen); - if (err) - goto out; - -@@ -103,7 +108,7 @@ static int ipcomp_decompress(struct xfrm_state *x, struct sk_buff *skb) - err = 0; - - out: -- put_cpu(); -+ local_unlock(ipcomp_scratches_lock); - return err; - } - -@@ -146,6 +151,8 @@ static int ipcomp_compress(struct xfrm_state *x, struct sk_buff *skb) - int err; - - local_bh_disable(); -+ local_lock(ipcomp_scratches_lock); -+ - scratch = *this_cpu_ptr(ipcomp_scratches); - tfm = *this_cpu_ptr(ipcd->tfms); - err = crypto_comp_compress(tfm, start, plen, scratch, &dlen); -@@ -158,12 +165,14 @@ static int ipcomp_compress(struct xfrm_state *x, struct sk_buff *skb) - } - - memcpy(start + sizeof(struct ip_comp_hdr), scratch, dlen); -+ local_unlock(ipcomp_scratches_lock); - local_bh_enable(); - - pskb_trim(skb, dlen + sizeof(struct ip_comp_hdr)); - return 0; - - out: -+ local_unlock(ipcomp_scratches_lock); - local_bh_enable(); - return err; - } --- -2.36.1 - diff --git a/debian/patches-rt/0333-mm-memcontrol-Disable-preemption-in-__mod_memcg_lruv.patch b/debian/patches-rt/0333-mm-memcontrol-Disable-preemption-in-__mod_memcg_lruv.patch deleted file mode 100644 index 8c05dc952..000000000 --- a/debian/patches-rt/0333-mm-memcontrol-Disable-preemption-in-__mod_memcg_lruv.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 5e6613efc5bd79951fdfab9ce61217ba8480a0bc Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Wed, 28 Oct 2020 18:15:32 +0100 -Subject: [PATCH 333/347] mm/memcontrol: Disable preemption in - __mod_memcg_lruvec_state() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 74858f0d38a8d3c069a0745ff53ae084c8e7cabb ] - -The callers expect disabled preemption/interrupts while invoking -__mod_memcg_lruvec_state(). This works mainline because a lock of -somekind is acquired. - -Use preempt_disable_rt() where per-CPU variables are accessed and a -stable pointer is expected. This is also done in __mod_zone_page_state() -for the same reason. - -Cc: stable-rt@vger.kernel.org -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Tom Zanussi - - Conflicts: - mm/memcontrol.c ---- - include/linux/memcontrol.h | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h -index cc6b6532eb56..dbb2c4e27277 100644 ---- a/include/linux/memcontrol.h -+++ b/include/linux/memcontrol.h -@@ -665,6 +665,7 @@ static inline void __mod_lruvec_state(struct lruvec *lruvec, - - pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec); - -+ preempt_disable_rt(); - /* Update memcg */ - __mod_memcg_state(pn->memcg, idx, val); - -@@ -675,6 +676,7 @@ static inline void __mod_lruvec_state(struct lruvec *lruvec, - x = 0; - } - __this_cpu_write(pn->lruvec_stat_cpu->count[idx], x); -+ preempt_enable_rt(); - } - - static inline void mod_lruvec_state(struct lruvec *lruvec, --- -2.36.1 - diff --git a/debian/patches-rt/0333-ptrace-fix-ptrace_unfreeze_traced-race-with-rt-lock.patch b/debian/patches-rt/0333-ptrace-fix-ptrace_unfreeze_traced-race-with-rt-lock.patch new file mode 100644 index 000000000..a6f016150 --- /dev/null +++ b/debian/patches-rt/0333-ptrace-fix-ptrace_unfreeze_traced-race-with-rt-lock.patch @@ -0,0 +1,64 @@ +From: Oleg Nesterov +Date: Tue, 3 Nov 2020 12:39:01 +0100 +Subject: [PATCH 333/342] ptrace: fix ptrace_unfreeze_traced() race with + rt-lock +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=8b07e7ff85bd9cfa73d79f1f133ad4b96dc3369c + +[ Upstream commit 0fdc91971b34cf6857b4cfd8c322ae936cfc189b ] + +The patch "ptrace: fix ptrace vs tasklist_lock race" changed +ptrace_freeze_traced() to take task->saved_state into account, but +ptrace_unfreeze_traced() has the same problem and needs a similar fix: +it should check/update both ->state and ->saved_state. + +Reported-by: Luis Claudio R. Goncalves +Fixes: "ptrace: fix ptrace vs tasklist_lock race" +Signed-off-by: Oleg Nesterov +Signed-off-by: Sebastian Andrzej Siewior +Cc: stable-rt@vger.kernel.org +Signed-off-by: Tom Zanussi +--- + kernel/ptrace.c | 23 +++++++++++++++-------- + 1 file changed, 15 insertions(+), 8 deletions(-) + +diff --git a/kernel/ptrace.c b/kernel/ptrace.c +index 9078fdefc6e0..58d351fc04d2 100644 +--- a/kernel/ptrace.c ++++ b/kernel/ptrace.c +@@ -207,8 +207,8 @@ static bool ptrace_freeze_traced(struct task_struct *task) + + static void ptrace_unfreeze_traced(struct task_struct *task) + { +- if (task->state != __TASK_TRACED) +- return; ++ unsigned long flags; ++ bool frozen = true; + + WARN_ON(!task->ptrace || task->parent != current); + +@@ -217,12 +217,19 @@ static void ptrace_unfreeze_traced(struct task_struct *task) + * Recheck state under the lock to close this race. + */ + spin_lock_irq(&task->sighand->siglock); +- if (task->state == __TASK_TRACED) { +- if (__fatal_signal_pending(task)) +- wake_up_state(task, __TASK_TRACED); +- else +- task->state = TASK_TRACED; +- } ++ ++ raw_spin_lock_irqsave(&task->pi_lock, flags); ++ if (task->state == __TASK_TRACED) ++ task->state = TASK_TRACED; ++ else if (task->saved_state == __TASK_TRACED) ++ task->saved_state = TASK_TRACED; ++ else ++ frozen = false; ++ raw_spin_unlock_irqrestore(&task->pi_lock, flags); ++ ++ if (frozen && __fatal_signal_pending(task)) ++ wake_up_state(task, __TASK_TRACED); ++ + spin_unlock_irq(&task->sighand->siglock); + } + diff --git a/debian/patches-rt/0334-mm-slub-Don-t-resize-the-location-tracking-cache-on-.patch b/debian/patches-rt/0334-mm-slub-Don-t-resize-the-location-tracking-cache-on-.patch new file mode 100644 index 000000000..827afb4dd --- /dev/null +++ b/debian/patches-rt/0334-mm-slub-Don-t-resize-the-location-tracking-cache-on-.patch @@ -0,0 +1,34 @@ +From: Sebastian Andrzej Siewior +Date: Fri, 26 Feb 2021 17:26:04 +0100 +Subject: [PATCH 334/342] mm: slub: Don't resize the location tracking cache on + PREEMPT_RT +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=cbb851e2f49e471db5e2ea40478394b48139f4ca + +The location tracking cache has a size of a page and is resized if its +current size is too small. +This allocation happens with disabled interrupts and can't happen on +PREEMPT_RT. +Should one page be too small, then we have to allocate more at the +beginning. The only downside is that less callers will be visible. + +Signed-off-by: Sebastian Andrzej Siewior +(cherry picked from commit 87bd0bf324f4c5468ea3d1de0482589f491f3145) +Signed-off-by: Clark Williams +--- + mm/slub.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/mm/slub.c b/mm/slub.c +index de80b015fb99..46158ba761ce 100644 +--- a/mm/slub.c ++++ b/mm/slub.c +@@ -4591,6 +4591,9 @@ static int alloc_loc_track(struct loc_track *t, unsigned long max, gfp_t flags) + struct location *l; + int order; + ++ if (IS_ENABLED(CONFIG_PREEMPT_RT) && flags == GFP_ATOMIC) ++ return 0; ++ + order = get_order(sizeof(struct location) * max); + + l = (void *)__get_free_pages(flags, order); diff --git a/debian/patches-rt/0334-ptrace-fix-ptrace_unfreeze_traced-race-with-rt-lock.patch b/debian/patches-rt/0334-ptrace-fix-ptrace_unfreeze_traced-race-with-rt-lock.patch deleted file mode 100644 index ab3bf14d5..000000000 --- a/debian/patches-rt/0334-ptrace-fix-ptrace_unfreeze_traced-race-with-rt-lock.patch +++ /dev/null @@ -1,68 +0,0 @@ -From a888cf3e5934c79d8edfca69dfe7fbe8f52c7476 Mon Sep 17 00:00:00 2001 -From: Oleg Nesterov -Date: Tue, 3 Nov 2020 12:39:01 +0100 -Subject: [PATCH 334/347] ptrace: fix ptrace_unfreeze_traced() race with - rt-lock -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -[ Upstream commit 0fdc91971b34cf6857b4cfd8c322ae936cfc189b ] - -The patch "ptrace: fix ptrace vs tasklist_lock race" changed -ptrace_freeze_traced() to take task->saved_state into account, but -ptrace_unfreeze_traced() has the same problem and needs a similar fix: -it should check/update both ->state and ->saved_state. - -Reported-by: Luis Claudio R. Goncalves -Fixes: "ptrace: fix ptrace vs tasklist_lock race" -Signed-off-by: Oleg Nesterov -Signed-off-by: Sebastian Andrzej Siewior -Cc: stable-rt@vger.kernel.org -Signed-off-by: Tom Zanussi ---- - kernel/ptrace.c | 23 +++++++++++++++-------- - 1 file changed, 15 insertions(+), 8 deletions(-) - -diff --git a/kernel/ptrace.c b/kernel/ptrace.c -index 9c59e523f3cd..b7d2a22534da 100644 ---- a/kernel/ptrace.c -+++ b/kernel/ptrace.c -@@ -207,8 +207,8 @@ static bool ptrace_freeze_traced(struct task_struct *task) - - static void ptrace_unfreeze_traced(struct task_struct *task) - { -- if (task->state != __TASK_TRACED) -- return; -+ unsigned long flags; -+ bool frozen = true; - - WARN_ON(!task->ptrace || task->parent != current); - -@@ -217,12 +217,19 @@ static void ptrace_unfreeze_traced(struct task_struct *task) - * Recheck state under the lock to close this race. - */ - spin_lock_irq(&task->sighand->siglock); -- if (task->state == __TASK_TRACED) { -- if (__fatal_signal_pending(task)) -- wake_up_state(task, __TASK_TRACED); -- else -- task->state = TASK_TRACED; -- } -+ -+ raw_spin_lock_irqsave(&task->pi_lock, flags); -+ if (task->state == __TASK_TRACED) -+ task->state = TASK_TRACED; -+ else if (task->saved_state == __TASK_TRACED) -+ task->saved_state = TASK_TRACED; -+ else -+ frozen = false; -+ raw_spin_unlock_irqrestore(&task->pi_lock, flags); -+ -+ if (frozen && __fatal_signal_pending(task)) -+ wake_up_state(task, __TASK_TRACED); -+ - spin_unlock_irq(&task->sighand->siglock); - } - --- -2.36.1 - diff --git a/debian/patches-rt/0335-Linux-4.19.185-rt76-REBASE.patch b/debian/patches-rt/0335-Linux-4.19.185-rt76-REBASE.patch deleted file mode 100644 index d38a3565e..000000000 --- a/debian/patches-rt/0335-Linux-4.19.185-rt76-REBASE.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 6142a4642e9bcfd6fbbaf6cddd32841755deff8b Mon Sep 17 00:00:00 2001 -From: Clark Williams -Date: Mon, 12 Apr 2021 15:03:55 -0500 -Subject: [PATCH 335/347] Linux 4.19.185-rt76 REBASE -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -Signed-off-by: Clark Williams ---- - localversion-rt | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/localversion-rt b/localversion-rt -index 1199ebade17b..c1f2720eaf25 100644 ---- a/localversion-rt -+++ b/localversion-rt -@@ -1 +1 @@ ---rt16 -+-rt76 --- -2.36.1 - diff --git a/debian/patches-rt/0335-locking-rwsem_rt-Add-__down_read_interruptible.patch b/debian/patches-rt/0335-locking-rwsem_rt-Add-__down_read_interruptible.patch new file mode 100644 index 000000000..312f6f2ef --- /dev/null +++ b/debian/patches-rt/0335-locking-rwsem_rt-Add-__down_read_interruptible.patch @@ -0,0 +1,50 @@ +From: Sebastian Andrzej Siewior +Date: Tue, 19 Jan 2021 18:54:33 +0100 +Subject: [PATCH 335/342] locking/rwsem_rt: Add __down_read_interruptible() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=95f51b5f0caacd4978a39b16473ca035f8047fdf + +The stable backported a patch which adds __down_read_interruptible() for +the generic rwsem implementation. + +Add RT's version __down_read_interruptible(). + +Signed-off-by: Sebastian Andrzej Siewior +--- + include/linux/rwsem_rt.h | 1 + + kernel/locking/rwsem-rt.c | 11 +++++++++++ + 2 files changed, 12 insertions(+) + +diff --git a/include/linux/rwsem_rt.h b/include/linux/rwsem_rt.h +index 2018ff77904a..3fb092b7bcc0 100644 +--- a/include/linux/rwsem_rt.h ++++ b/include/linux/rwsem_rt.h +@@ -56,6 +56,7 @@ static inline int rwsem_is_contended(struct rw_semaphore *sem) + } + + extern void __down_read(struct rw_semaphore *sem); ++extern int __down_read_interruptible(struct rw_semaphore *sem); + extern int __down_read_killable(struct rw_semaphore *sem); + extern int __down_read_trylock(struct rw_semaphore *sem); + extern void __down_write(struct rw_semaphore *sem); +diff --git a/kernel/locking/rwsem-rt.c b/kernel/locking/rwsem-rt.c +index f518495bd6cc..19ea20be3fd7 100644 +--- a/kernel/locking/rwsem-rt.c ++++ b/kernel/locking/rwsem-rt.c +@@ -166,6 +166,17 @@ void __down_read(struct rw_semaphore *sem) + WARN_ON_ONCE(ret); + } + ++int __down_read_interruptible(struct rw_semaphore *sem) ++{ ++ int ret; ++ ++ ret = __down_read_common(sem, TASK_INTERRUPTIBLE); ++ if (likely(!ret)) ++ return ret; ++ WARN_ONCE(ret != -EINTR, "Unexpected state: %d\n", ret); ++ return -EINTR; ++} ++ + int __down_read_killable(struct rw_semaphore *sem) + { + int ret; diff --git a/debian/patches-rt/0336-locking-rwsem-rt-Remove-might_sleep-in-__up_read.patch b/debian/patches-rt/0336-locking-rwsem-rt-Remove-might_sleep-in-__up_read.patch new file mode 100644 index 000000000..1055aed23 --- /dev/null +++ b/debian/patches-rt/0336-locking-rwsem-rt-Remove-might_sleep-in-__up_read.patch @@ -0,0 +1,29 @@ +From: Andrew Halaney +Date: Tue, 6 Apr 2021 17:19:52 -0500 +Subject: [PATCH 336/342] locking/rwsem-rt: Remove might_sleep() in __up_read() +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=f4cae546c87033b52ee5a80dc860427ebd02568e + +There's no chance of sleeping here, the reader is giving up the +lock and possibly waking up the writer who is waiting on it. + +Reported-by: Chunyu Hu +Signed-off-by: Andrew Halaney +Signed-off-by: Steven Rostedt (VMware) +(cherry picked from commit b2ed0a4302faf2bb09e97529dd274233c082689b) +Signed-off-by: Clark Williams +--- + kernel/locking/rwsem-rt.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/kernel/locking/rwsem-rt.c b/kernel/locking/rwsem-rt.c +index 19ea20be3fd7..966946454ced 100644 +--- a/kernel/locking/rwsem-rt.c ++++ b/kernel/locking/rwsem-rt.c +@@ -200,7 +200,6 @@ void __up_read(struct rw_semaphore *sem) + if (!atomic_dec_and_test(&sem->readers)) + return; + +- might_sleep(); + raw_spin_lock_irq(&m->wait_lock); + /* + * Wake the writer, i.e. the rtmutex owner. It might release the diff --git a/debian/patches-rt/0336-mm-slub-Don-t-resize-the-location-tracking-cache-on-.patch b/debian/patches-rt/0336-mm-slub-Don-t-resize-the-location-tracking-cache-on-.patch deleted file mode 100644 index eaf171957..000000000 --- a/debian/patches-rt/0336-mm-slub-Don-t-resize-the-location-tracking-cache-on-.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 4da7dd5c5195e9f48a911e768ca8bd317f5c6b7f Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Fri, 26 Feb 2021 17:26:04 +0100 -Subject: [PATCH 336/347] mm: slub: Don't resize the location tracking cache on - PREEMPT_RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -The location tracking cache has a size of a page and is resized if its -current size is too small. -This allocation happens with disabled interrupts and can't happen on -PREEMPT_RT. -Should one page be too small, then we have to allocate more at the -beginning. The only downside is that less callers will be visible. - -Signed-off-by: Sebastian Andrzej Siewior -(cherry picked from commit 87bd0bf324f4c5468ea3d1de0482589f491f3145) -Signed-off-by: Clark Williams ---- - mm/slub.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/mm/slub.c b/mm/slub.c -index 497096152c39..6b9b894ba5bc 100644 ---- a/mm/slub.c -+++ b/mm/slub.c -@@ -4591,6 +4591,9 @@ static int alloc_loc_track(struct loc_track *t, unsigned long max, gfp_t flags) - struct location *l; - int order; - -+ if (IS_ENABLED(CONFIG_PREEMPT_RT) && flags == GFP_ATOMIC) -+ return 0; -+ - order = get_order(sizeof(struct location) * max); - - l = (void *)__get_free_pages(flags, order); --- -2.36.1 - diff --git a/debian/patches-rt/0337-fscache-fix-initialisation-of-cookie-hash-table-raw-.patch b/debian/patches-rt/0337-fscache-fix-initialisation-of-cookie-hash-table-raw-.patch new file mode 100644 index 000000000..8895d4c16 --- /dev/null +++ b/debian/patches-rt/0337-fscache-fix-initialisation-of-cookie-hash-table-raw-.patch @@ -0,0 +1,33 @@ +From: Gregor Beck +Date: Fri, 3 Sep 2021 14:19:11 +0200 +Subject: [PATCH 337/342] fscache: fix initialisation of cookie hash table raw + spinlocks +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=324135b9a8f1539dd356c377beaf882164634c5f + +The original patch, 602660600bcd ("fscache: initialize cookie hash +table raw spinlocks"), subtracted 1 from the shift and so still left +some spinlocks uninitialized. This fixes that. + +[zanussi: Added changelog text] + +Signed-off-by: Gregor Beck +Fixes: 602660600bcd ("fscache: initialize cookie hash table raw spinlocks") +Signed-off-by: Tom Zanussi +(cherry picked from commit 2cdede918a7b5f2b367e4839ad021e1d3b2479b1) +Signed-off-by: Clark Williams +--- + fs/fscache/cookie.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/fs/fscache/cookie.c b/fs/fscache/cookie.c +index b2b9a85a4ba5..84e57196a293 100644 +--- a/fs/fscache/cookie.c ++++ b/fs/fscache/cookie.c +@@ -955,6 +955,6 @@ void __init fscache_cookie_init(void) + { + int i; + +- for (i = 0; i < (1 << fscache_cookie_hash_shift) - 1; i++) ++ for (i = 0; i < ARRAY_SIZE(fscache_cookie_hash); i++) + INIT_HLIST_BL_HEAD(&fscache_cookie_hash[i]); + } diff --git a/debian/patches-rt/0337-locking-rwsem_rt-Add-__down_read_interruptible.patch b/debian/patches-rt/0337-locking-rwsem_rt-Add-__down_read_interruptible.patch deleted file mode 100644 index 32dbf855c..000000000 --- a/debian/patches-rt/0337-locking-rwsem_rt-Add-__down_read_interruptible.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 22e1c0d3e27bd960ae3561172ca15089721253c6 Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Tue, 19 Jan 2021 18:54:33 +0100 -Subject: [PATCH 337/347] locking/rwsem_rt: Add __down_read_interruptible() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -The stable backported a patch which adds __down_read_interruptible() for -the generic rwsem implementation. - -Add RT's version __down_read_interruptible(). - -Signed-off-by: Sebastian Andrzej Siewior ---- - include/linux/rwsem_rt.h | 1 + - kernel/locking/rwsem-rt.c | 11 +++++++++++ - 2 files changed, 12 insertions(+) - -diff --git a/include/linux/rwsem_rt.h b/include/linux/rwsem_rt.h -index 2018ff77904a..3fb092b7bcc0 100644 ---- a/include/linux/rwsem_rt.h -+++ b/include/linux/rwsem_rt.h -@@ -56,6 +56,7 @@ static inline int rwsem_is_contended(struct rw_semaphore *sem) - } - - extern void __down_read(struct rw_semaphore *sem); -+extern int __down_read_interruptible(struct rw_semaphore *sem); - extern int __down_read_killable(struct rw_semaphore *sem); - extern int __down_read_trylock(struct rw_semaphore *sem); - extern void __down_write(struct rw_semaphore *sem); -diff --git a/kernel/locking/rwsem-rt.c b/kernel/locking/rwsem-rt.c -index f518495bd6cc..19ea20be3fd7 100644 ---- a/kernel/locking/rwsem-rt.c -+++ b/kernel/locking/rwsem-rt.c -@@ -166,6 +166,17 @@ void __down_read(struct rw_semaphore *sem) - WARN_ON_ONCE(ret); - } - -+int __down_read_interruptible(struct rw_semaphore *sem) -+{ -+ int ret; -+ -+ ret = __down_read_common(sem, TASK_INTERRUPTIBLE); -+ if (likely(!ret)) -+ return ret; -+ WARN_ONCE(ret != -EINTR, "Unexpected state: %d\n", ret); -+ return -EINTR; -+} -+ - int __down_read_killable(struct rw_semaphore *sem) - { - int ret; --- -2.36.1 - diff --git a/debian/patches-rt/0338-Linux-4.19.206-rt87-REBASE.patch b/debian/patches-rt/0338-Linux-4.19.206-rt87-REBASE.patch deleted file mode 100644 index eb89fd8dd..000000000 --- a/debian/patches-rt/0338-Linux-4.19.206-rt87-REBASE.patch +++ /dev/null @@ -1,21 +0,0 @@ -From de4f10a80cbe40566ab9124766a9dce2d30fc651 Mon Sep 17 00:00:00 2001 -From: Clark Williams -Date: Fri, 3 Sep 2021 10:24:35 -0500 -Subject: [PATCH 338/347] Linux 4.19.206-rt87 REBASE -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -Signed-off-by: Clark Williams ---- - localversion-rt | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/localversion-rt b/localversion-rt -index c1f2720eaf25..bd5aee366a48 100644 ---- a/localversion-rt -+++ b/localversion-rt -@@ -1 +1 @@ ---rt76 -+-rt87 --- -2.36.1 - diff --git a/debian/patches-rt/0338-rt-PREEMPT_RT-safety-net-for-backported-patches.patch b/debian/patches-rt/0338-rt-PREEMPT_RT-safety-net-for-backported-patches.patch new file mode 100644 index 000000000..927d47cb0 --- /dev/null +++ b/debian/patches-rt/0338-rt-PREEMPT_RT-safety-net-for-backported-patches.patch @@ -0,0 +1,48 @@ +From: Clark Williams +Date: Sun, 30 Jan 2022 15:46:27 -0600 +Subject: [PATCH 338/342] rt: PREEMPT_RT safety net for backported patches +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=d7c847666d7341feb472045cb36e599fc76b63a6 + +While doing some 4.19-rt cleanup work, I stumbled across the fact that parts of +two backported patches were dependent on CONFIG_PREEMPT_RT, rather than +the CONFIG_PREEMPT_RT_FULL used in 4.19 and earlier RT series. The commits +in the linux-stable-rt v4.19-rt branch are: + +dad4c6a33bf4e mm: slub: Don't resize the location tracking cache on PREEMPT_RT +e626b6f873f2c net: Treat __napi_schedule_irqoff() as __napi_schedule() on PREEMPT_RT + +Discussing this at the Stable RT maintainers meeting, Steven Rostedt suggested that +we automagically select CONFIG_PREEMPT_RT if CONFIG_PREEMPT_RT_FULL is on, giving +us a safety net for any subsequently backported patches. Here's my first cut at +that patch. + +I suspect we'll need a similar patch for stable RT kernels < 4.19. + +Suggested-by: Steven Rostedt +Signed-off-by: Clark Williams +--- + kernel/Kconfig.preempt | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/kernel/Kconfig.preempt b/kernel/Kconfig.preempt +index 306567f72a3e..fd924c0bcea7 100644 +--- a/kernel/Kconfig.preempt ++++ b/kernel/Kconfig.preempt +@@ -6,6 +6,9 @@ config PREEMPT_RT_BASE + bool + select PREEMPT + ++config PREEMPT_RT ++ bool ++ + config HAVE_PREEMPT_LAZY + bool + +@@ -80,6 +83,7 @@ config PREEMPT_RT_FULL + depends on IRQ_FORCED_THREADING + select PREEMPT_RT_BASE + select PREEMPT_RCU ++ select PREEMPT_RT + help + All and everything + diff --git a/debian/patches-rt/0339-locking-rwsem-rt-Remove-might_sleep-in-__up_read.patch b/debian/patches-rt/0339-locking-rwsem-rt-Remove-might_sleep-in-__up_read.patch deleted file mode 100644 index 3edc4a486..000000000 --- a/debian/patches-rt/0339-locking-rwsem-rt-Remove-might_sleep-in-__up_read.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 339b3a147a8e17bd3c87f9c9b16ad2c3d8e517c9 Mon Sep 17 00:00:00 2001 -From: Andrew Halaney -Date: Tue, 6 Apr 2021 17:19:52 -0500 -Subject: [PATCH 339/347] locking/rwsem-rt: Remove might_sleep() in __up_read() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -There's no chance of sleeping here, the reader is giving up the -lock and possibly waking up the writer who is waiting on it. - -Reported-by: Chunyu Hu -Signed-off-by: Andrew Halaney -Signed-off-by: Steven Rostedt (VMware) -(cherry picked from commit b2ed0a4302faf2bb09e97529dd274233c082689b) -Signed-off-by: Clark Williams ---- - kernel/locking/rwsem-rt.c | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/kernel/locking/rwsem-rt.c b/kernel/locking/rwsem-rt.c -index 19ea20be3fd7..966946454ced 100644 ---- a/kernel/locking/rwsem-rt.c -+++ b/kernel/locking/rwsem-rt.c -@@ -200,7 +200,6 @@ void __up_read(struct rw_semaphore *sem) - if (!atomic_dec_and_test(&sem->readers)) - return; - -- might_sleep(); - raw_spin_lock_irq(&m->wait_lock); - /* - * Wake the writer, i.e. the rtmutex owner. It might release the --- -2.36.1 - diff --git a/debian/patches-rt/0339-net-Add-missing-xmit_lock_owner-hunks.patch b/debian/patches-rt/0339-net-Add-missing-xmit_lock_owner-hunks.patch new file mode 100644 index 000000000..c5bf85313 --- /dev/null +++ b/debian/patches-rt/0339-net-Add-missing-xmit_lock_owner-hunks.patch @@ -0,0 +1,113 @@ +From: Sebastian Andrzej Siewior +Date: Wed, 22 Dec 2021 20:35:22 +0100 +Subject: [PATCH 339/342] net: Add missing xmit_lock_owner hunks. +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=f9ce408f7c095f80030cfb2f6671eab84a42e643 + +The patch + net: move xmit_recursion to per-task variable on -RT + +lost a few hunks during its rebase. + +Add the `xmit_lock_owner' accessor/wrapper. + +Reported-by: Salvatore Bonaccorso +Signed-off-by: Sebastian Andrzej Siewior +--- + include/linux/netdevice.h | 29 +++++++++++++---------------- + 1 file changed, 13 insertions(+), 16 deletions(-) + +diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h +index c4713217b20e..bd73117e2636 100644 +--- a/include/linux/netdevice.h ++++ b/include/linux/netdevice.h +@@ -3885,17 +3885,17 @@ static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits) + #ifdef CONFIG_PREEMPT_RT_FULL + static inline void netdev_queue_set_owner(struct netdev_queue *txq, int cpu) + { +- txq->xmit_lock_owner = current; ++ WRITE_ONCE(txq->xmit_lock_owner, current); + } + + static inline void netdev_queue_clear_owner(struct netdev_queue *txq) + { +- txq->xmit_lock_owner = NULL; ++ WRITE_ONCE(txq->xmit_lock_owner, NULL); + } + + static inline bool netdev_queue_has_owner(struct netdev_queue *txq) + { +- if (txq->xmit_lock_owner != NULL) ++ if (READ_ONCE(txq->xmit_lock_owner) != NULL) + return true; + return false; + } +@@ -3904,17 +3904,19 @@ static inline bool netdev_queue_has_owner(struct netdev_queue *txq) + + static inline void netdev_queue_set_owner(struct netdev_queue *txq, int cpu) + { +- txq->xmit_lock_owner = cpu; ++ /* Pairs with READ_ONCE() in __dev_queue_xmit() */ ++ WRITE_ONCE(txq->xmit_lock_owner, cpu); + } + + static inline void netdev_queue_clear_owner(struct netdev_queue *txq) + { +- txq->xmit_lock_owner = -1; ++ /* Pairs with READ_ONCE() in __dev_queue_xmit() */ ++ WRITE_ONCE(txq->xmit_lock_owner, -1); + } + + static inline bool netdev_queue_has_owner(struct netdev_queue *txq) + { +- if (txq->xmit_lock_owner != -1) ++ if (READ_ONCE(txq->xmit_lock_owner) != -1) + return true; + return false; + } +@@ -3923,8 +3925,7 @@ static inline bool netdev_queue_has_owner(struct netdev_queue *txq) + static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu) + { + spin_lock(&txq->_xmit_lock); +- /* Pairs with READ_ONCE() in __dev_queue_xmit() */ +- WRITE_ONCE(txq->xmit_lock_owner, cpu); ++ netdev_queue_set_owner(txq, cpu); + } + + static inline bool __netif_tx_acquire(struct netdev_queue *txq) +@@ -3941,8 +3942,7 @@ static inline void __netif_tx_release(struct netdev_queue *txq) + static inline void __netif_tx_lock_bh(struct netdev_queue *txq) + { + spin_lock_bh(&txq->_xmit_lock); +- /* Pairs with READ_ONCE() in __dev_queue_xmit() */ +- WRITE_ONCE(txq->xmit_lock_owner, smp_processor_id()); ++ netdev_queue_set_owner(txq, smp_processor_id()); + } + + static inline bool __netif_tx_trylock(struct netdev_queue *txq) +@@ -3950,23 +3950,20 @@ static inline bool __netif_tx_trylock(struct netdev_queue *txq) + bool ok = spin_trylock(&txq->_xmit_lock); + + if (likely(ok)) { +- /* Pairs with READ_ONCE() in __dev_queue_xmit() */ +- WRITE_ONCE(txq->xmit_lock_owner, smp_processor_id()); ++ netdev_queue_set_owner(txq, smp_processor_id()); + } + return ok; + } + + static inline void __netif_tx_unlock(struct netdev_queue *txq) + { +- /* Pairs with READ_ONCE() in __dev_queue_xmit() */ +- WRITE_ONCE(txq->xmit_lock_owner, -1); ++ netdev_queue_clear_owner(txq); + spin_unlock(&txq->_xmit_lock); + } + + static inline void __netif_tx_unlock_bh(struct netdev_queue *txq) + { +- /* Pairs with READ_ONCE() in __dev_queue_xmit() */ +- WRITE_ONCE(txq->xmit_lock_owner, -1); ++ netdev_queue_clear_owner(txq); + spin_unlock_bh(&txq->_xmit_lock); + } + diff --git a/debian/patches-rt/0340-Linux-4.19.214-rt93-REBASE.patch b/debian/patches-rt/0340-Linux-4.19.214-rt93-REBASE.patch deleted file mode 100644 index 2529b908a..000000000 --- a/debian/patches-rt/0340-Linux-4.19.214-rt93-REBASE.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 10fb3965169bb32da6eddef5672ba845f4dd3a67 Mon Sep 17 00:00:00 2001 -From: Clark Williams -Date: Fri, 29 Oct 2021 09:49:56 -0500 -Subject: [PATCH 340/347] Linux 4.19.214-rt93 REBASE -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -Signed-off-by: Clark Williams ---- - localversion-rt | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/localversion-rt b/localversion-rt -index bd5aee366a48..e98a1fe050bd 100644 ---- a/localversion-rt -+++ b/localversion-rt -@@ -1 +1 @@ ---rt87 -+-rt93 --- -2.36.1 - diff --git a/debian/patches-rt/0340-genirq-Add-lost-hunk-to-irq_forced_thread_fn.patch b/debian/patches-rt/0340-genirq-Add-lost-hunk-to-irq_forced_thread_fn.patch new file mode 100644 index 000000000..7297c027c --- /dev/null +++ b/debian/patches-rt/0340-genirq-Add-lost-hunk-to-irq_forced_thread_fn.patch @@ -0,0 +1,37 @@ +From: Sebastian Andrzej Siewior +Date: Fri, 29 Apr 2022 11:02:18 -0500 +Subject: [PATCH 340/342] genirq: Add lost hunk to irq_forced_thread_fn(). +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=d872802a6e9cfbe98d85409cd78d88b6ea9ffc51 + +The irq_settings_no_softirq_call() related handling got lost in process, +here are the missing bits. + +Reported-by: Martin Kaistra +Fixes: b0cf5c230e2a0 ("Merge tag 'v4.19.183' into linux-4.19.y-rt") +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Clark Williams +--- + kernel/irq/manage.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c +index 683debac6759..6ee6d144060f 100644 +--- a/kernel/irq/manage.c ++++ b/kernel/irq/manage.c +@@ -998,7 +998,15 @@ irq_forced_thread_fn(struct irq_desc *desc, struct irqaction *action) + irq_finalize_oneshot(desc, action); + if (!IS_ENABLED(CONFIG_PREEMPT_RT_BASE)) + local_irq_enable(); +- local_bh_enable(); ++ /* ++ * Interrupts which have real time requirements can be set up ++ * to avoid softirq processing in the thread handler. This is ++ * safe as these interrupts do not raise soft interrupts. ++ */ ++ if (irq_settings_no_softirq_call(desc)) ++ _local_bh_enable(); ++ else ++ local_bh_enable(); + return ret; + } + diff --git a/debian/patches-rt/0341-fscache-fix-initialisation-of-cookie-hash-table-raw-.patch b/debian/patches-rt/0341-fscache-fix-initialisation-of-cookie-hash-table-raw-.patch deleted file mode 100644 index 3be61a807..000000000 --- a/debian/patches-rt/0341-fscache-fix-initialisation-of-cookie-hash-table-raw-.patch +++ /dev/null @@ -1,37 +0,0 @@ -From dc029afd264318942ce9a174edffa950f762e7f9 Mon Sep 17 00:00:00 2001 -From: Gregor Beck -Date: Fri, 3 Sep 2021 14:19:11 +0200 -Subject: [PATCH 341/347] fscache: fix initialisation of cookie hash table raw - spinlocks -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -The original patch, 602660600bcd ("fscache: initialize cookie hash -table raw spinlocks"), subtracted 1 from the shift and so still left -some spinlocks uninitialized. This fixes that. - -[zanussi: Added changelog text] - -Signed-off-by: Gregor Beck -Fixes: 602660600bcd ("fscache: initialize cookie hash table raw spinlocks") -Signed-off-by: Tom Zanussi -(cherry picked from commit 2cdede918a7b5f2b367e4839ad021e1d3b2479b1) -Signed-off-by: Clark Williams ---- - fs/fscache/cookie.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/fs/fscache/cookie.c b/fs/fscache/cookie.c -index b2b9a85a4ba5..84e57196a293 100644 ---- a/fs/fscache/cookie.c -+++ b/fs/fscache/cookie.c -@@ -955,6 +955,6 @@ void __init fscache_cookie_init(void) - { - int i; - -- for (i = 0; i < (1 << fscache_cookie_hash_shift) - 1; i++) -+ for (i = 0; i < ARRAY_SIZE(fscache_cookie_hash); i++) - INIT_HLIST_BL_HEAD(&fscache_cookie_hash[i]); - } --- -2.36.1 - diff --git a/debian/patches-rt/0341-random-Use-local-locks-for-crng-context-access.patch b/debian/patches-rt/0341-random-Use-local-locks-for-crng-context-access.patch new file mode 100644 index 000000000..acf66335b --- /dev/null +++ b/debian/patches-rt/0341-random-Use-local-locks-for-crng-context-access.patch @@ -0,0 +1,80 @@ +From: Daniel Wagner +Date: Wed, 13 Jul 2022 15:02:30 +0200 +Subject: [PATCH 341/342] random: Use local locks for crng context access +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=78c61f9bc5797149c2dfbd84ee4c5ee0fdd9ab6c + +The backport of 5f1bb112006b ("random: group initialization wait +functions") changed the upstream local locks to normal spin locks +because the local infrastructure in v4.19 is missing. As spin locks +are turned into sleeping locks for RT we have to add the local locks +back using the v4.19-rt API. + +Signed-off-by: Daniel Wagner +--- + drivers/char/random.c | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +diff --git a/drivers/char/random.c b/drivers/char/random.c +index 2be38780a7f7..c06705a32246 100644 +--- a/drivers/char/random.c ++++ b/drivers/char/random.c +@@ -53,6 +53,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -234,6 +235,7 @@ struct crng { + static DEFINE_PER_CPU(struct crng, crngs) = { + .generation = ULONG_MAX + }; ++DEFINE_LOCAL_IRQ_LOCK(crngs_lock); + + /* Used by crng_reseed() and crng_make_state() to extract a new seed from the input pool. */ + static void extract_entropy(void *buf, size_t len); +@@ -362,7 +364,7 @@ static void crng_make_state(u32 chacha_state[CHACHA20_BLOCK_SIZE / sizeof(u32)], + if (unlikely(crng_has_old_seed())) + crng_reseed(); + +- local_irq_save(flags); ++ local_lock_irqsave(crngs_lock, flags); + crng = raw_cpu_ptr(&crngs); + + /* +@@ -387,7 +389,7 @@ static void crng_make_state(u32 chacha_state[CHACHA20_BLOCK_SIZE / sizeof(u32)], + * should wind up here immediately. + */ + crng_fast_key_erasure(crng->key, chacha_state, random_data, random_data_len); +- local_irq_restore(flags); ++ local_unlock_irqrestore(crngs_lock, flags); + } + + static void _get_random_bytes(void *buf, size_t len) +@@ -512,6 +514,7 @@ struct batch_ ##type { \ + static DEFINE_PER_CPU(struct batch_ ##type, batched_entropy_ ##type) = { \ + .position = UINT_MAX \ + }; \ ++static DEFINE_LOCAL_IRQ_LOCK(batched_entropy_lock_ ##type); \ + \ + type get_random_ ##type(void) \ + { \ +@@ -527,7 +530,7 @@ type get_random_ ##type(void) \ + return ret; \ + } \ + \ +- local_irq_save(flags); \ ++ local_lock_irqsave(batched_entropy_lock_ ##type, flags); \ + batch = raw_cpu_ptr(&batched_entropy_##type); \ + \ + next_gen = READ_ONCE(base_crng.generation); \ +@@ -541,7 +544,7 @@ type get_random_ ##type(void) \ + ret = batch->entropy[batch->position]; \ + batch->entropy[batch->position] = 0; \ + ++batch->position; \ +- local_irq_restore(flags); \ ++ local_unlock_irqrestore(batched_entropy_lock_ ##type, flags); \ + return ret; \ + } \ + EXPORT_SYMBOL(get_random_ ##type); diff --git a/debian/patches-rt/0342-Linux-4.19.225-rt101-REBASE.patch b/debian/patches-rt/0342-Linux-4.19.225-rt101-REBASE.patch deleted file mode 100644 index c8fb23eed..000000000 --- a/debian/patches-rt/0342-Linux-4.19.225-rt101-REBASE.patch +++ /dev/null @@ -1,21 +0,0 @@ -From cc57b2b4fdc4b90708433ff46b962f99cbec2e6c Mon Sep 17 00:00:00 2001 -From: Clark Williams -Date: Wed, 12 Jan 2022 21:43:37 -0600 -Subject: [PATCH 342/347] Linux 4.19.225-rt101 REBASE -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -Signed-off-by: Clark Williams ---- - localversion-rt | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/localversion-rt b/localversion-rt -index e98a1fe050bd..9ea5981fa956 100644 ---- a/localversion-rt -+++ b/localversion-rt -@@ -1 +1 @@ ---rt93 -+-rt101 --- -2.36.1 - diff --git a/debian/patches-rt/0342-Linux-4.19.255-rt113-REBASE.patch b/debian/patches-rt/0342-Linux-4.19.255-rt113-REBASE.patch new file mode 100644 index 000000000..35ac2d84b --- /dev/null +++ b/debian/patches-rt/0342-Linux-4.19.255-rt113-REBASE.patch @@ -0,0 +1,17 @@ +From: Daniel Wagner +Date: Sat, 13 Aug 2022 18:54:48 +0200 +Subject: [PATCH 342/342] Linux 4.19.255-rt113 REBASE +Origin: https://git.kernel.org/cgit/linux/kernel/git/rt/linux-stable-rt.git/commit?id=f0d99014e3dd9542fa47ea03e0d4cde570e34928 + +Signed-off-by: Daniel Wagner +--- + localversion-rt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/localversion-rt b/localversion-rt +index 1199ebade17b..fdcd9167ca0b 100644 +--- a/localversion-rt ++++ b/localversion-rt +@@ -1 +1 @@ +--rt16 ++-rt113 diff --git a/debian/patches-rt/0343-rt-PREEMPT_RT-safety-net-for-backported-patches.patch b/debian/patches-rt/0343-rt-PREEMPT_RT-safety-net-for-backported-patches.patch deleted file mode 100644 index b4d67b156..000000000 --- a/debian/patches-rt/0343-rt-PREEMPT_RT-safety-net-for-backported-patches.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 8961a29e7aa52c929475c767559b23e018fe8b01 Mon Sep 17 00:00:00 2001 -From: Clark Williams -Date: Sun, 30 Jan 2022 15:46:27 -0600 -Subject: [PATCH 343/347] rt: PREEMPT_RT safety net for backported patches -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -While doing some 4.19-rt cleanup work, I stumbled across the fact that parts of -two backported patches were dependent on CONFIG_PREEMPT_RT, rather than -the CONFIG_PREEMPT_RT_FULL used in 4.19 and earlier RT series. The commits -in the linux-stable-rt v4.19-rt branch are: - -dad4c6a33bf4e mm: slub: Don't resize the location tracking cache on PREEMPT_RT -e626b6f873f2c net: Treat __napi_schedule_irqoff() as __napi_schedule() on PREEMPT_RT - -Discussing this at the Stable RT maintainers meeting, Steven Rostedt suggested that -we automagically select CONFIG_PREEMPT_RT if CONFIG_PREEMPT_RT_FULL is on, giving -us a safety net for any subsequently backported patches. Here's my first cut at -that patch. - -I suspect we'll need a similar patch for stable RT kernels < 4.19. - -Suggested-by: Steven Rostedt -Signed-off-by: Clark Williams ---- - kernel/Kconfig.preempt | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/kernel/Kconfig.preempt b/kernel/Kconfig.preempt -index 306567f72a3e..fd924c0bcea7 100644 ---- a/kernel/Kconfig.preempt -+++ b/kernel/Kconfig.preempt -@@ -6,6 +6,9 @@ config PREEMPT_RT_BASE - bool - select PREEMPT - -+config PREEMPT_RT -+ bool -+ - config HAVE_PREEMPT_LAZY - bool - -@@ -80,6 +83,7 @@ config PREEMPT_RT_FULL - depends on IRQ_FORCED_THREADING - select PREEMPT_RT_BASE - select PREEMPT_RCU -+ select PREEMPT_RT - help - All and everything - --- -2.36.1 - diff --git a/debian/patches-rt/0344-net-Add-missing-xmit_lock_owner-hunks.patch b/debian/patches-rt/0344-net-Add-missing-xmit_lock_owner-hunks.patch deleted file mode 100644 index 467bb1739..000000000 --- a/debian/patches-rt/0344-net-Add-missing-xmit_lock_owner-hunks.patch +++ /dev/null @@ -1,117 +0,0 @@ -From 1a0157a8d087c0c5bdf88ad97e2d4db77bee63aa Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Wed, 22 Dec 2021 20:35:22 +0100 -Subject: [PATCH 344/347] net: Add missing xmit_lock_owner hunks. -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -The patch - net: move xmit_recursion to per-task variable on -RT - -lost a few hunks during its rebase. - -Add the `xmit_lock_owner' accessor/wrapper. - -Reported-by: Salvatore Bonaccorso -Signed-off-by: Sebastian Andrzej Siewior ---- - include/linux/netdevice.h | 29 +++++++++++++---------------- - 1 file changed, 13 insertions(+), 16 deletions(-) - -diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h -index c4713217b20e..bd73117e2636 100644 ---- a/include/linux/netdevice.h -+++ b/include/linux/netdevice.h -@@ -3885,17 +3885,17 @@ static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits) - #ifdef CONFIG_PREEMPT_RT_FULL - static inline void netdev_queue_set_owner(struct netdev_queue *txq, int cpu) - { -- txq->xmit_lock_owner = current; -+ WRITE_ONCE(txq->xmit_lock_owner, current); - } - - static inline void netdev_queue_clear_owner(struct netdev_queue *txq) - { -- txq->xmit_lock_owner = NULL; -+ WRITE_ONCE(txq->xmit_lock_owner, NULL); - } - - static inline bool netdev_queue_has_owner(struct netdev_queue *txq) - { -- if (txq->xmit_lock_owner != NULL) -+ if (READ_ONCE(txq->xmit_lock_owner) != NULL) - return true; - return false; - } -@@ -3904,17 +3904,19 @@ static inline bool netdev_queue_has_owner(struct netdev_queue *txq) - - static inline void netdev_queue_set_owner(struct netdev_queue *txq, int cpu) - { -- txq->xmit_lock_owner = cpu; -+ /* Pairs with READ_ONCE() in __dev_queue_xmit() */ -+ WRITE_ONCE(txq->xmit_lock_owner, cpu); - } - - static inline void netdev_queue_clear_owner(struct netdev_queue *txq) - { -- txq->xmit_lock_owner = -1; -+ /* Pairs with READ_ONCE() in __dev_queue_xmit() */ -+ WRITE_ONCE(txq->xmit_lock_owner, -1); - } - - static inline bool netdev_queue_has_owner(struct netdev_queue *txq) - { -- if (txq->xmit_lock_owner != -1) -+ if (READ_ONCE(txq->xmit_lock_owner) != -1) - return true; - return false; - } -@@ -3923,8 +3925,7 @@ static inline bool netdev_queue_has_owner(struct netdev_queue *txq) - static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu) - { - spin_lock(&txq->_xmit_lock); -- /* Pairs with READ_ONCE() in __dev_queue_xmit() */ -- WRITE_ONCE(txq->xmit_lock_owner, cpu); -+ netdev_queue_set_owner(txq, cpu); - } - - static inline bool __netif_tx_acquire(struct netdev_queue *txq) -@@ -3941,8 +3942,7 @@ static inline void __netif_tx_release(struct netdev_queue *txq) - static inline void __netif_tx_lock_bh(struct netdev_queue *txq) - { - spin_lock_bh(&txq->_xmit_lock); -- /* Pairs with READ_ONCE() in __dev_queue_xmit() */ -- WRITE_ONCE(txq->xmit_lock_owner, smp_processor_id()); -+ netdev_queue_set_owner(txq, smp_processor_id()); - } - - static inline bool __netif_tx_trylock(struct netdev_queue *txq) -@@ -3950,23 +3950,20 @@ static inline bool __netif_tx_trylock(struct netdev_queue *txq) - bool ok = spin_trylock(&txq->_xmit_lock); - - if (likely(ok)) { -- /* Pairs with READ_ONCE() in __dev_queue_xmit() */ -- WRITE_ONCE(txq->xmit_lock_owner, smp_processor_id()); -+ netdev_queue_set_owner(txq, smp_processor_id()); - } - return ok; - } - - static inline void __netif_tx_unlock(struct netdev_queue *txq) - { -- /* Pairs with READ_ONCE() in __dev_queue_xmit() */ -- WRITE_ONCE(txq->xmit_lock_owner, -1); -+ netdev_queue_clear_owner(txq); - spin_unlock(&txq->_xmit_lock); - } - - static inline void __netif_tx_unlock_bh(struct netdev_queue *txq) - { -- /* Pairs with READ_ONCE() in __dev_queue_xmit() */ -- WRITE_ONCE(txq->xmit_lock_owner, -1); -+ netdev_queue_clear_owner(txq); - spin_unlock_bh(&txq->_xmit_lock); - } - --- -2.36.1 - diff --git a/debian/patches-rt/0345-Linux-4.19.237-rt107-REBASE.patch b/debian/patches-rt/0345-Linux-4.19.237-rt107-REBASE.patch deleted file mode 100644 index e38739169..000000000 --- a/debian/patches-rt/0345-Linux-4.19.237-rt107-REBASE.patch +++ /dev/null @@ -1,21 +0,0 @@ -From da237074d357316e91a363c91e29aeaaace6ce6c Mon Sep 17 00:00:00 2001 -From: Daniel Wagner -Date: Thu, 31 Mar 2022 20:37:13 +0200 -Subject: [PATCH 345/347] Linux 4.19.237-rt107 REBASE -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -Signed-off-by: Daniel Wagner ---- - localversion-rt | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/localversion-rt b/localversion-rt -index 9ea5981fa956..2e0a3c960575 100644 ---- a/localversion-rt -+++ b/localversion-rt -@@ -1 +1 @@ ---rt101 -+-rt107 --- -2.36.1 - diff --git a/debian/patches-rt/0346-genirq-Add-lost-hunk-to-irq_forced_thread_fn.patch b/debian/patches-rt/0346-genirq-Add-lost-hunk-to-irq_forced_thread_fn.patch deleted file mode 100644 index 0c8b0e14e..000000000 --- a/debian/patches-rt/0346-genirq-Add-lost-hunk-to-irq_forced_thread_fn.patch +++ /dev/null @@ -1,41 +0,0 @@ -From d379a82e852964afe457dcf44bf4a00fc59de389 Mon Sep 17 00:00:00 2001 -From: Sebastian Andrzej Siewior -Date: Fri, 29 Apr 2022 11:02:18 -0500 -Subject: [PATCH 346/347] genirq: Add lost hunk to irq_forced_thread_fn(). -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -The irq_settings_no_softirq_call() related handling got lost in process, -here are the missing bits. - -Reported-by: Martin Kaistra -Fixes: b0cf5c230e2a0 ("Merge tag 'v4.19.183' into linux-4.19.y-rt") -Signed-off-by: Sebastian Andrzej Siewior -Signed-off-by: Clark Williams ---- - kernel/irq/manage.c | 10 +++++++++- - 1 file changed, 9 insertions(+), 1 deletion(-) - -diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c -index 6c88d81399dd..8f710f1755d8 100644 ---- a/kernel/irq/manage.c -+++ b/kernel/irq/manage.c -@@ -998,7 +998,15 @@ irq_forced_thread_fn(struct irq_desc *desc, struct irqaction *action) - irq_finalize_oneshot(desc, action); - if (!IS_ENABLED(CONFIG_PREEMPT_RT_BASE)) - local_irq_enable(); -- local_bh_enable(); -+ /* -+ * Interrupts which have real time requirements can be set up -+ * to avoid softirq processing in the thread handler. This is -+ * safe as these interrupts do not raise soft interrupts. -+ */ -+ if (irq_settings_no_softirq_call(desc)) -+ _local_bh_enable(); -+ else -+ local_bh_enable(); - return ret; - } - --- -2.36.1 - diff --git a/debian/patches-rt/0347-Linux-4.19.246-rt110-REBASE.patch b/debian/patches-rt/0347-Linux-4.19.246-rt110-REBASE.patch deleted file mode 100644 index 746979875..000000000 --- a/debian/patches-rt/0347-Linux-4.19.246-rt110-REBASE.patch +++ /dev/null @@ -1,21 +0,0 @@ -From b7cf2f6b538ab97b989cbb2d10bf804994874ba5 Mon Sep 17 00:00:00 2001 -From: Daniel Wagner -Date: Tue, 14 Jun 2022 07:47:54 +0200 -Subject: [PATCH 347/347] Linux 4.19.246-rt110 REBASE -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz - -Signed-off-by: Daniel Wagner ---- - localversion-rt | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/localversion-rt b/localversion-rt -index 2e0a3c960575..b3e668a8fb94 100644 ---- a/localversion-rt -+++ b/localversion-rt -@@ -1 +1 @@ ---rt107 -+-rt110 --- -2.36.1 - diff --git a/debian/patches-rt/series b/debian/patches-rt/series index 8d7c2429b..1bf3392fd 100644 --- a/debian/patches-rt/series +++ b/debian/patches-rt/series @@ -224,123 +224,119 @@ 0224-crypto-cryptd-add-a-lock-instead-preempt_disable-loc.patch 0225-panic-skip-get_random_bytes-for-RT_FULL-in-init_oops.patch 0226-x86-stackprotector-Avoid-random-pool-on-rt.patch -0228-cpu-hotplug-Implement-CPU-pinning.patch -0229-sched-Allow-pinned-user-tasks-to-be-awakened-to-the-.patch -0230-hotplug-duct-tape-RT-rwlock-usage-for-non-RT.patch -0231-net-Remove-preemption-disabling-in-netif_rx.patch -0232-net-Another-local_irq_disable-kmalloc-headache.patch -0233-net-core-protect-users-of-napi_alloc_cache-against-r.patch -0234-net-netfilter-Serialize-xt_write_recseq-sections-on-.patch -0235-lockdep-selftest-Only-do-hardirq-context-test-for-ra.patch -0236-lockdep-selftest-fix-warnings-due-to-missing-PREEMPT.patch -0237-sched-Add-support-for-lazy-preemption.patch -0238-ftrace-Fix-trace-header-alignment.patch -0239-x86-Support-for-lazy-preemption.patch -0240-x86-lazy-preempt-properly-check-against-preempt-mask.patch -0241-x86-lazy-preempt-use-proper-return-label-on-32bit-x8.patch -0242-arm-Add-support-for-lazy-preemption.patch -0243-powerpc-Add-support-for-lazy-preemption.patch -0244-arch-arm64-Add-lazy-preempt-support.patch -0245-connector-cn_proc-Protect-send_msg-with-a-local-lock.patch -0246-drivers-block-zram-Replace-bit-spinlocks-with-rtmute.patch -0247-drivers-zram-Don-t-disable-preemption-in-zcomp_strea.patch -0248-drivers-zram-fix-zcomp_stream_get-smp_processor_id-u.patch -0249-tpm_tis-fix-stall-after-iowrite-s.patch -0250-watchdog-prevent-deferral-of-watchdogd-wakeup-on-RT.patch -0251-drm-radeon-i915-Use-preempt_disable-enable_rt-where-.patch -0252-drm-i915-Use-local_lock-unlock_irq-in-intel_pipe_upd.patch -0253-drm-i915-disable-tracing-on-RT.patch -0254-drm-i915-skip-DRM_I915_LOW_LEVEL_TRACEPOINTS-with-NO.patch -0255-cgroups-use-simple-wait-in-css_release.patch -0256-cpuset-Convert-callback_lock-to-raw_spinlock_t.patch -0257-apparmor-use-a-locallock-instead-preempt_disable.patch -0258-workqueue-Prevent-deadlock-stall-on-RT.patch -0259-signals-Allow-rt-tasks-to-cache-one-sigqueue-struct.patch -0260-Add-localversion-for-RT-release.patch -0261-powerpc-pseries-iommu-Use-a-locallock-instead-local_.patch -0262-powerpc-reshuffle-TIF-bits.patch -0263-tty-sysrq-Convert-show_lock-to-raw_spinlock_t.patch -0264-drm-i915-Don-t-disable-interrupts-independently-of-t.patch -0265-sched-completion-Fix-a-lockup-in-wait_for_completion.patch -0266-kthread-add-a-global-worker-thread.patch -0267-arm-imx6-cpuidle-Use-raw_spinlock_t.patch -0268-rcu-Don-t-allow-to-change-rcu_normal_after_boot-on-R.patch -0269-pci-switchtec-fix-stream_open.cocci-warnings.patch -0270-sched-core-Drop-a-preempt_disable_rt-statement.patch -0271-timers-Redo-the-notification-of-canceling-timers-on-.patch -0272-Revert-futex-Ensure-lock-unlock-symetry-versus-pi_lo.patch -0273-Revert-futex-Fix-bug-on-when-a-requeued-RT-task-time.patch -0274-Revert-rtmutex-Handle-the-various-new-futex-race-con.patch -0275-Revert-futex-workaround-migrate_disable-enable-in-di.patch -0276-futex-Make-the-futex_hash_bucket-lock-raw.patch -0277-futex-Delay-deallocation-of-pi_state.patch -0278-mm-zswap-Do-not-disable-preemption-in-zswap_frontswa.patch -0279-revert-aio.patch -0280-fs-aio-simple-simple-work.patch -0281-revert-thermal.patch -0282-thermal-Defer-thermal-wakups-to-threads.patch -0283-revert-block.patch -0284-block-blk-mq-move-blk_queue_usage_counter_release-in.patch -0285-workqueue-rework.patch -0286-i2c-exynos5-Remove-IRQF_ONESHOT.patch -0287-i2c-hix5hd2-Remove-IRQF_ONESHOT.patch -0288-sched-deadline-Ensure-inactive_timer-runs-in-hardirq.patch -0289-thermal-x86_pkg_temp-make-pkg_temp_lock-a-raw-spinlo.patch -0290-dma-buf-Use-seqlock_t-instread-disabling-preemption.patch -0291-KVM-arm-arm64-Let-the-timer-expire-in-hardirq-contex.patch -0292-x86-preempt-Check-preemption-level-before-looking-at.patch -0293-hrtimer-Use-READ_ONCE-to-access-timer-base-in-hrimer.patch -0294-hrtimer-Don-t-grab-the-expiry-lock-for-non-soft-hrti.patch -0295-hrtimer-Prevent-using-hrtimer_grab_expiry_lock-on-mi.patch -0296-hrtimer-Add-a-missing-bracket-and-hide-migration_bas.patch -0297-posix-timers-Unlock-expiry-lock-in-the-early-return.patch -0298-sched-migrate_dis-enable-Use-sleeping_lock-to-annota.patch -0299-sched-__set_cpus_allowed_ptr-Check-cpus_mask-not-cpu.patch -0300-sched-Remove-dead-__migrate_disabled-check.patch -0301-sched-migrate-disable-Protect-cpus_ptr-with-lock.patch -0302-lib-smp_processor_id-Don-t-use-cpumask_equal.patch -0303-futex-Make-the-futex_hash_bucket-spinlock_t-again-an.patch -0304-locking-rtmutex-Clean-pi_blocked_on-in-the-error-cas.patch -0305-lib-ubsan-Don-t-seralize-UBSAN-report.patch -0306-kmemleak-Change-the-lock-of-kmemleak_object-to-raw_s.patch -0307-sched-migrate_enable-Use-select_fallback_rq.patch -0308-sched-Lazy-migrate_disable-processing.patch -0309-sched-migrate_enable-Use-stop_one_cpu_nowait.patch -0310-Revert-ARM-Initialize-split-page-table-locks-for-vec.patch -0311-locking-Make-spinlock_t-and-rwlock_t-a-RCU-section-o.patch -0312-sched-core-migrate_enable-must-access-takedown_cpu_t.patch -0313-lib-smp_processor_id-Adjust-check_preemption_disable.patch -0314-sched-migrate_enable-Busy-loop-until-the-migration-r.patch -0315-userfaultfd-Use-a-seqlock-instead-of-seqcount.patch -0316-sched-migrate_enable-Use-per-cpu-cpu_stop_work.patch -0317-sched-migrate_enable-Remove-__schedule-call.patch -0318-mm-memcontrol-Move-misplaced-local_unlock_irqrestore.patch -0319-locallock-Include-header-for-the-current-macro.patch -0320-drm-vmwgfx-Drop-preempt_disable-in-vmw_fifo_ping_hos.patch -0321-tracing-make-preempt_lazy-and-migrate_disable-counte.patch -0322-lib-ubsan-Remove-flags-parameter-from-calls-to-ubsan.patch -0323-irq_work-Fix-checking-of-IRQ_WORK_LAZY-flag-set-on-n.patch -0324-tasklet-Address-a-race-resulting-in-double-enqueue.patch -0325-hrtimer-fix-logic-for-when-grabbing-softirq_expiry_l.patch -0326-fs-dcache-Include-swait.h-header.patch -0327-mm-slub-Always-flush-the-delayed-empty-slubs-in-flus.patch -0328-tasklet-Fix-UP-case-for-tasklet-CHAINED-state.patch -0329-signal-Prevent-double-free-of-user-struct.patch -0330-Bluetooth-Acquire-sk_lock.slock-without-disabling-in.patch -0331-net-phy-fixed_phy-Remove-unused-seqcount.patch -0332-net-xfrm-fix-compress-vs-decompress-serialization.patch -0333-mm-memcontrol-Disable-preemption-in-__mod_memcg_lruv.patch -0334-ptrace-fix-ptrace_unfreeze_traced-race-with-rt-lock.patch -0335-Linux-4.19.185-rt76-REBASE.patch -0336-mm-slub-Don-t-resize-the-location-tracking-cache-on-.patch -0337-locking-rwsem_rt-Add-__down_read_interruptible.patch -0338-Linux-4.19.206-rt87-REBASE.patch -0339-locking-rwsem-rt-Remove-might_sleep-in-__up_read.patch -0340-Linux-4.19.214-rt93-REBASE.patch -0341-fscache-fix-initialisation-of-cookie-hash-table-raw-.patch -0342-Linux-4.19.225-rt101-REBASE.patch -0343-rt-PREEMPT_RT-safety-net-for-backported-patches.patch -0344-net-Add-missing-xmit_lock_owner-hunks.patch -0345-Linux-4.19.237-rt107-REBASE.patch -0346-genirq-Add-lost-hunk-to-irq_forced_thread_fn.patch -0347-Linux-4.19.246-rt110-REBASE.patch +0227-cpu-hotplug-Implement-CPU-pinning.patch +0228-sched-Allow-pinned-user-tasks-to-be-awakened-to-the-.patch +0229-hotplug-duct-tape-RT-rwlock-usage-for-non-RT.patch +0230-net-Remove-preemption-disabling-in-netif_rx.patch +0231-net-Another-local_irq_disable-kmalloc-headache.patch +0232-net-core-protect-users-of-napi_alloc_cache-against-r.patch +0233-net-netfilter-Serialize-xt_write_recseq-sections-on-.patch +0234-lockdep-selftest-Only-do-hardirq-context-test-for-ra.patch +0235-lockdep-selftest-fix-warnings-due-to-missing-PREEMPT.patch +0236-sched-Add-support-for-lazy-preemption.patch +0237-ftrace-Fix-trace-header-alignment.patch +0238-x86-Support-for-lazy-preemption.patch +0239-x86-lazy-preempt-properly-check-against-preempt-mask.patch +0240-x86-lazy-preempt-use-proper-return-label-on-32bit-x8.patch +0241-arm-Add-support-for-lazy-preemption.patch +0242-powerpc-Add-support-for-lazy-preemption.patch +0243-arch-arm64-Add-lazy-preempt-support.patch +0244-connector-cn_proc-Protect-send_msg-with-a-local-lock.patch +0245-drivers-block-zram-Replace-bit-spinlocks-with-rtmute.patch +0246-drivers-zram-Don-t-disable-preemption-in-zcomp_strea.patch +0247-drivers-zram-fix-zcomp_stream_get-smp_processor_id-u.patch +0248-tpm_tis-fix-stall-after-iowrite-s.patch +0249-watchdog-prevent-deferral-of-watchdogd-wakeup-on-RT.patch +0250-drm-radeon-i915-Use-preempt_disable-enable_rt-where-.patch +0251-drm-i915-Use-local_lock-unlock_irq-in-intel_pipe_upd.patch +0252-drm-i915-disable-tracing-on-RT.patch +0253-drm-i915-skip-DRM_I915_LOW_LEVEL_TRACEPOINTS-with-NO.patch +0254-cgroups-use-simple-wait-in-css_release.patch +0255-cpuset-Convert-callback_lock-to-raw_spinlock_t.patch +0256-apparmor-use-a-locallock-instead-preempt_disable.patch +0257-workqueue-Prevent-deadlock-stall-on-RT.patch +0258-signals-Allow-rt-tasks-to-cache-one-sigqueue-struct.patch +0259-Add-localversion-for-RT-release.patch +0260-powerpc-pseries-iommu-Use-a-locallock-instead-local_.patch +0261-powerpc-reshuffle-TIF-bits.patch +0262-tty-sysrq-Convert-show_lock-to-raw_spinlock_t.patch +0263-drm-i915-Don-t-disable-interrupts-independently-of-t.patch +0264-sched-completion-Fix-a-lockup-in-wait_for_completion.patch +0265-kthread-add-a-global-worker-thread.patch +0266-arm-imx6-cpuidle-Use-raw_spinlock_t.patch +0267-rcu-Don-t-allow-to-change-rcu_normal_after_boot-on-R.patch +0268-pci-switchtec-fix-stream_open.cocci-warnings.patch +0269-sched-core-Drop-a-preempt_disable_rt-statement.patch +0270-timers-Redo-the-notification-of-canceling-timers-on-.patch +0271-Revert-futex-Ensure-lock-unlock-symetry-versus-pi_lo.patch +0272-Revert-futex-Fix-bug-on-when-a-requeued-RT-task-time.patch +0273-Revert-rtmutex-Handle-the-various-new-futex-race-con.patch +0274-Revert-futex-workaround-migrate_disable-enable-in-di.patch +0275-futex-Make-the-futex_hash_bucket-lock-raw.patch +0276-futex-Delay-deallocation-of-pi_state.patch +0277-mm-zswap-Do-not-disable-preemption-in-zswap_frontswa.patch +0278-revert-aio.patch +0279-fs-aio-simple-simple-work.patch +0280-revert-thermal.patch +0281-thermal-Defer-thermal-wakups-to-threads.patch +0282-revert-block.patch +0283-block-blk-mq-move-blk_queue_usage_counter_release-in.patch +0284-workqueue-rework.patch +0285-i2c-exynos5-Remove-IRQF_ONESHOT.patch +0286-i2c-hix5hd2-Remove-IRQF_ONESHOT.patch +0287-sched-deadline-Ensure-inactive_timer-runs-in-hardirq.patch +0288-thermal-x86_pkg_temp-make-pkg_temp_lock-a-raw-spinlo.patch +0289-dma-buf-Use-seqlock_t-instread-disabling-preemption.patch +0290-KVM-arm-arm64-Let-the-timer-expire-in-hardirq-contex.patch +0291-x86-preempt-Check-preemption-level-before-looking-at.patch +0292-hrtimer-Use-READ_ONCE-to-access-timer-base-in-hrimer.patch +0293-hrtimer-Don-t-grab-the-expiry-lock-for-non-soft-hrti.patch +0294-hrtimer-Prevent-using-hrtimer_grab_expiry_lock-on-mi.patch +0295-hrtimer-Add-a-missing-bracket-and-hide-migration_bas.patch +0296-posix-timers-Unlock-expiry-lock-in-the-early-return.patch +0297-sched-migrate_dis-enable-Use-sleeping_lock-to-annota.patch +0298-sched-__set_cpus_allowed_ptr-Check-cpus_mask-not-cpu.patch +0299-sched-Remove-dead-__migrate_disabled-check.patch +0300-sched-migrate-disable-Protect-cpus_ptr-with-lock.patch +0301-lib-smp_processor_id-Don-t-use-cpumask_equal.patch +0302-futex-Make-the-futex_hash_bucket-spinlock_t-again-an.patch +0303-locking-rtmutex-Clean-pi_blocked_on-in-the-error-cas.patch +0304-lib-ubsan-Don-t-seralize-UBSAN-report.patch +0305-kmemleak-Change-the-lock-of-kmemleak_object-to-raw_s.patch +0306-sched-migrate_enable-Use-select_fallback_rq.patch +0307-sched-Lazy-migrate_disable-processing.patch +0308-sched-migrate_enable-Use-stop_one_cpu_nowait.patch +0309-Revert-ARM-Initialize-split-page-table-locks-for-vec.patch +0310-locking-Make-spinlock_t-and-rwlock_t-a-RCU-section-o.patch +0311-sched-core-migrate_enable-must-access-takedown_cpu_t.patch +0312-lib-smp_processor_id-Adjust-check_preemption_disable.patch +0313-sched-migrate_enable-Busy-loop-until-the-migration-r.patch +0314-userfaultfd-Use-a-seqlock-instead-of-seqcount.patch +0315-sched-migrate_enable-Use-per-cpu-cpu_stop_work.patch +0316-sched-migrate_enable-Remove-__schedule-call.patch +0317-mm-memcontrol-Move-misplaced-local_unlock_irqrestore.patch +0318-locallock-Include-header-for-the-current-macro.patch +0319-drm-vmwgfx-Drop-preempt_disable-in-vmw_fifo_ping_hos.patch +0320-tracing-make-preempt_lazy-and-migrate_disable-counte.patch +0321-lib-ubsan-Remove-flags-parameter-from-calls-to-ubsan.patch +0322-irq_work-Fix-checking-of-IRQ_WORK_LAZY-flag-set-on-n.patch +0323-tasklet-Address-a-race-resulting-in-double-enqueue.patch +0324-hrtimer-fix-logic-for-when-grabbing-softirq_expiry_l.patch +0325-fs-dcache-Include-swait.h-header.patch +0326-mm-slub-Always-flush-the-delayed-empty-slubs-in-flus.patch +0327-tasklet-Fix-UP-case-for-tasklet-CHAINED-state.patch +0328-signal-Prevent-double-free-of-user-struct.patch +0329-Bluetooth-Acquire-sk_lock.slock-without-disabling-in.patch +0330-net-phy-fixed_phy-Remove-unused-seqcount.patch +0331-net-xfrm-fix-compress-vs-decompress-serialization.patch +0332-mm-memcontrol-Disable-preemption-in-__mod_memcg_lruv.patch +0333-ptrace-fix-ptrace_unfreeze_traced-race-with-rt-lock.patch +0334-mm-slub-Don-t-resize-the-location-tracking-cache-on-.patch +0335-locking-rwsem_rt-Add-__down_read_interruptible.patch +0336-locking-rwsem-rt-Remove-might_sleep-in-__up_read.patch +0337-fscache-fix-initialisation-of-cookie-hash-table-raw-.patch +0338-rt-PREEMPT_RT-safety-net-for-backported-patches.patch +0339-net-Add-missing-xmit_lock_owner-hunks.patch +0340-genirq-Add-lost-hunk-to-irq_forced_thread_fn.patch +0341-random-Use-local-locks-for-crng-context-access.patch +0342-Linux-4.19.255-rt113-REBASE.patch -- cgit v1.2.3