From aad68942e45b61cbbe397071529191732fe421b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Thu, 11 Aug 2016 21:43:09 +0200 Subject: [PATCH] [rt] Update to 4.6.5-rt10 --- debian/changelog | 3 + ...k-unlock-symetry-versus-pi_lock-and-.patch | 4 +- ...n-translation-section-permission-fau.patch | 2 +- .../rt/ARM-imx-always-use-TWD-on-IMX6Q.patch | 2 +- ...intk-drop-the-logbuf_lock-more-often.patch | 2 +- ...wngrade-preempt_disable-d-region-to-.patch | 8 +- ...-mark-LAPIC-timer-handler-as-irqsafe.patch | 2 +- ...acpi_gbl_hardware-lock-back-to-a-raw.patch | 2 +- .../arch-arm64-Add-lazy-preempt-support.patch | 8 +- ...reempt-add-TIF_NEED_RESCHED_LAZY-to-.patch | 2 +- ...ove-irq-handler-when-clock-is-unused.patch | 2 +- ...-tclib-default-to-tclib-timer-for-rt.patch | 2 +- .../all/rt/arm-convert-boot-lock-to-raw.patch | 2 +- .../all/rt/arm-enable-highmem-for-rt.patch | 2 +- .../rt/arm-highmem-flush-tlb-on-unmap.patch | 2 +- ...zy-preempt-correct-resched-condition.patch | 2 +- .../all/rt/arm-preempt-lazy-support.patch | 2 +- .../all/rt/arm-unwind-use_raw_lock.patch | 2 +- ...arm64-xen--Make-XEN-depend-on-non-rt.patch | 2 +- .../rt/at91_dont_enable_disable_clock.patch | 2 +- .../rt/ata-disable-interrupts-if-non-rt.patch | 2 +- ...ne-notifier-to-POST_D.patchto-POST_D.patch | 2 +- .../all/rt/block-blk-mq-use-swait.patch | 2 +- ...k-mq-don-t-complete-requests-via-IPI.patch | 2 +- .../rt/block-mq-drop-preempt-disable.patch | 2 +- .../all/rt/block-mq-use-cpu_light.patch | 2 +- ...k-shorten-interrupt-disabled-regions.patch | 2 +- .../features/all/rt/block-use-cpu-chill.patch | 2 +- .../all/rt/bug-rt-dependend-variants.patch | 2 +- ...heduling-while-atomic-in-cgroup-code.patch | 2 +- ...roups-use-simple-wait-in-css_release.patch | 2 +- ...ers-timer-atmel-pit-fix-double-free_.patch | 2 +- ...source-tclib-allow-higher-clockrates.patch | 2 +- .../completion-use-simple-wait-queues.patch | 2 +- .../all/rt/cond-resched-lock-rt-tweak.patch | 2 +- .../all/rt/cond-resched-softirq-rt.patch | 2 +- ...ument-why-PREEMPT_RT-uses-a-spinlock.patch | 2 +- ...tplug-lock-a-sleeping-spinlock-on-rt.patch | 2 +- .../all/rt/cpu-rt-rework-cpu-down.patch | 2 +- ...-a-UNINTERRUPTIBLE-hrtimer_nanosleep.patch | 2 +- .../cpu_down_move_migrate_enable_back.patch | 2 +- ...rop-K8-s-driver-from-beeing-selected.patch | 2 +- .../rt/cpumask-disable-offstack-on-rt.patch | 2 +- ...-preempt-disabled-regions-more-algos.patch | 2 +- .../crypto-ccp-remove-rwlocks_types.h.patch | 2 +- .../features/all/rt/debugobjects-rt.patch | 2 +- .../features/all/rt/dm-make-rt-aware.patch | 2 +- ...rnet-tile-Initialize-timer-as-pinned.patch | 41 + ...am-Replace-bit-spinlocks-with-rtmute.patch | 2 +- .../drivers-net-8139-disable-irq-nosync.patch | 2 +- .../rt/drivers-net-fix-livelock-issues.patch | 2 +- ...rivers-net-vortex-fix-locking-issues.patch | 2 +- ...andom-reduce-preempt-disabled-region.patch | 2 +- .../rt/drivers-tty-fix-omap-lock-crap.patch | 2 +- ...-metag_da-Initialize-timer-as-pinned.patch | 38 + ...ips_ejtag-Initialize-timer-as-pinned.patch | 41 + ...rivers-tty-pl011-irq-disable-madness.patch | 2 +- ...sistent-forcewake-auto-release-timeo.patch | 152 +++ ...op-trace_i915_gem_ring_dispatch-onrt.patch | 2 +- ...rq()_in_intel_pipe_update_startend().patch | 2 +- ...disableenable_rt()_where_recommended.patch | 2 +- ...on-t-disable-preemption-during-trace.patch | 2 +- .../all/rt/epoll-use-get-cpu-light.patch | 2 +- .../all/rt/fs-aio-simple-simple-work.patch | 2 +- .../features/all/rt/fs-block-rt-support.patch | 2 +- ...cache-use-cpu-chill-in-trylock-loops.patch | 2 +- .../all/rt/fs-jbd-replace-bh_state-lock.patch | 2 +- ...ull-your-plug-when-waiting-for-space.patch | 2 +- .../all/rt/fs-namespace-preemption-fix.patch | 2 +- .../rt/fs-ntfs-disable-interrupt-non-rt.patch | 2 +- .../fs-replace-bh_uptodate_lock-for-rt.patch | 2 +- .../rt/ftrace-migrate-disable-tracing.patch | 2 +- .../all/rt/futex-requeue-pi-fix.patch | 2 +- .../all/rt/genirq-disable-irqpoll-on-rt.patch | 2 +- ...voke-the-affinity-callback-via-a-wor.patch | 2 +- .../all/rt/genirq-force-threading.patch | 2 +- ...-irq_set_irqchip_state-documentation.patch | 2 +- ...st-Add-hlist_is_singular_node-helper.patch | 39 + ...cpus_allowed_ptr-in-sync_unplug_thre.patch | 2 +- .../rt/hotplug-light-get-online-cpus.patch | 2 +- ...ync_unplug-no-27-5cn-27-in-task-name.patch | 2 +- .../all/rt/hotplug-use-migrate-disable.patch | 2 +- ...-schedule_work-call-to-helper-thread.patch | 2 +- .../rt/hrtimer-enfore-64byte-alignment.patch | 2 +- ...timer-callback-changes-for-preempt-r.patch | 4 +- .../rt/hrtimers-prepare-full-preemption.patch | 2 +- ...on-t-ignore-threshold-module-paramet.patch | 2 +- ...pdate-hwlat_detector-to-add-outer-lo.patch | 2 +- ...r-Use-thread-instead-of-stop-machine.patch | 2 +- ...r-Use-trace_clock_local-if-available.patch | 2 +- .../patches/features/all/rt/hwlatdetect.patch | 2 +- ...-omap-drop-the-lock-hard-irq-context.patch | 2 +- ...ng-from-i915-when-running-on-PREEMPT.patch | 4 +- .../features/all/rt/i915_compile_fix.patch | 6 +- .../rt/ide-use-nort-local-irq-variants.patch | 2 +- .../idr-use-local-lock-for-protection.patch | 2 +- .../infiniband-mellanox-ib-use-nort-irq.patch | 2 +- ...finiband-ulp-ipoib-remove-pkey_mutex.patch | 2 +- .../rt/inpt-gameport-use-local-irq-nort.patch | 2 +- .../introduce_migrate_disable_cpu_light.patch | 2 +- .../all/rt/iommu-amd--Use-WARN_ON_NORT.patch | 2 +- ...Implement-lockless-pipelined-wakeups.patch | 2 +- .../rt/ipc-sem-rework-semaphore-wakeups.patch | 2 +- ...irq-processing-in-irq-thread-context.patch | 2 +- ...rk-Move-irq-safe-work-to-irq-context.patch | 12 +- ...-push_most_work_into_softirq_context.patch | 14 +- .../features/all/rt/jump-label-rt.patch | 2 +- .../rt/kconfig-disable-a-few-options-rt.patch | 2 +- .../all/rt/kconfig-preempt-rt-full.patch | 2 +- ...el-SRCU-provide-a-static-initializer.patch | 2 +- ...pu-down-problem-if-kthread-s-cpu-is-.patch | 2 +- ...restore-original-cpu-mask-oncpu-down.patch | 2 +- ...isable-do-fastpath-in-atomic-irqs-of.patch | 2 +- ...-perf_cpu_context-s-timer-as-irqsafe.patch | 2 +- ...n-t-try-to-print-from-IRQ-NMI-region.patch | 2 +- ...nly-warn-once-on-a-try-lock-from-bad.patch | 2 +- .../kernel-softirq-unlock-with-irqs-on.patch | 2 +- .../all/rt/kgb-serial-hackaround.patch | 2 +- .../features/all/rt/latency-hist.patch | 2 +- ...tency_hist-update-sched_wakeup-probe.patch | 2 +- .../rt/latencyhist-disable-jump-labels.patch | 2 +- ...ds-trigger-disable-CPU-trigger-on-RT.patch | 2 +- .../patches/features/all/rt/lglocks-rt.patch | 2 +- .../list_bl-fixup-bogus-lockdep-warning.patch | 2 +- ..._bl.h-make-list-head-locking-RT-safe.patch | 2 +- .../rt/local-irq-rt-depending-variants.patch | 2 +- .../all/rt/locallock-add-local_lock_on.patch | 2 +- .../features/all/rt/localversion.patch | 4 +- .../lockdep-no-softirq-accounting-on-rt.patch | 2 +- ...-fix-warnings-due-to-missing-PREEMPT.patch | 2 +- ...ardirq-context-test-for-raw-spinlock.patch | 2 +- ...ure-Do-NOT-include-rwlock.h-directly.patch | 2 +- ...()_in_lg_double_locklg_double_unlock.patch | 2 +- .../features/all/rt/md-disable-bcache.patch | 2 +- .../md-raid5-percpu-handling-rt-aware.patch | 2 +- .../all/rt/mips-disable-highmem-on-rt.patch | 2 +- ...--rt--Fix-generic-kmap_atomic-for-RT.patch | 2 +- ...on-t-disable-IRQs-in-wb_congested_pu.patch | 2 +- .../rt/mm-bounce-local-irq-save-nort.patch | 2 +- .../rt/mm-convert-swap-to-percpu-locked.patch | 2 +- .../features/all/rt/mm-disable-sloub-rt.patch | 2 +- .../features/all/rt/mm-enable-slub.patch | 2 +- .../all/rt/mm-make-vmstat-rt-aware.patch | 2 +- ...n-t-call-schedule_work_on-in-preempt.patch | 2 +- .../rt/mm-memcontrol-do_not_disable_irq.patch | 2 +- ...m_cgroup_migrate-replace-another-loc.patch | 2 +- ...e-alloc-use-local-lock-on-target-cpu.patch | 2 +- ...e_alloc-reduce-lock-sections-further.patch | 2 +- ...page_alloc-rt-friendly-per-cpu-pages.patch | 2 +- ...m-perform-lru_add_drain_all-remotely.patch | 2 +- .../rt/mm-protect-activate-switch-mm.patch | 2 +- .../all/rt/mm-rt-kmap-atomic-scheduling.patch | 2 +- ...-scatterlist-dont-disable-irqs-on-RT.patch | 2 +- .../all/rt/mm-vmalloc-use-get-cpu-light.patch | 2 +- ...-not-protect-workingset_shadow_nodes.patch | 2 +- ...get-put_cpu_light-in-zs_map_object-z.patch | 3 +- .../all/rt/mmci-remove-bogus-irq-save.patch | 2 +- .../move_sched_delayed_work_to_helper.patch | 2 +- .../features/all/rt/mutex-no-spin-on-rt.patch | 2 +- ...al-irq-disable-alloc-atomic-headache.patch | 2 +- ...tplug-drain-input_pkt_queue-lockless.patch | 2 +- ...-users-of-napi_alloc_cache-against-r.patch | 2 +- ...ake-qdisc-s-busylock-in-__dev_xmit_s.patch | 2 +- ...ble-xt-write-recseq-begin-rt-fallout.patch | 2 +- ...pv4-inet-Initialize-timers-as-pinned.patch | 66 + .../net-make-devnet_rename_seq-a-mutex.patch | 2 +- ...recursion-to-per-task-variable-on-RT.patch | 2 +- .../all/rt/net-prevent-abba-deadlock.patch | 2 +- ...y-to-delegate-processing-a-softirq-t.patch | 2 +- ...activate_many-use-msleep-1-instead-o.patch | 2 +- .../net-tx-action-avoid-livelock-on-rt.patch | 2 +- .../features/all/rt/net-use-cpu-chill.patch | 2 +- .../all/rt/net-wireless-warn-nort.patch | 2 +- ...-rcu_expedited_conditional-on-non-rt.patch | 2 +- .../features/all/rt/oleg-signal-rt-fix.patch | 2 +- .../all/rt/panic-disable-random-on-rt.patch | 2 +- ...ce-rcu-bh-qs-where-safe-from-softirq.patch | 2 +- .../pci-access-use-__wake_up_all_locked.patch | 2 +- .../all/rt/percpu_ida-use-locklocks.patch | 2 +- .../perf-make-swevent-hrtimer-irqsafe.patch | 2 +- .../all/rt/peter_zijlstra-frob-rcu.patch | 2 +- .../all/rt/peterz-srcu-crypto-chain.patch | 2 +- .../all/rt/pid.h-include-atomic.h.patch | 2 +- .../patches/features/all/rt/ping-sysrq.patch | 2 +- .../all/rt/posix-timers-no-broadcast.patch | 2 +- ...timers-thread-posix-cpu-timers-on-rt.patch | 2 +- .../all/rt/power-disable-highmem-on-rt.patch | 2 +- .../rt/power-use-generic-rwsem-on-rt.patch | 2 +- ...ble-in-kernel-MPIC-emulation-for-PRE.patch | 2 +- .../all/rt/powerpc-preempt-lazy-support.patch | 2 +- ...ce-init.c-adapt-to-completions-using.patch | 2 +- .../preempt-lazy-check-preempt_schedule.patch | 2 +- .../all/rt/preempt-lazy-support.patch | 18 +- .../all/rt/preempt-nort-rt-variants.patch | 2 +- ...27-boot-param-to-help-with-debugging.patch | 2 +- .../patches/features/all/rt/printk-kill.patch | 2 +- .../features/all/rt/printk-rt-aware.patch | 2 +- ...ace-fix-ptrace-vs-tasklist_lock-race.patch | 2 +- .../features/all/rt/radix-tree-rt-aware.patch | 2 +- .../all/rt/random-make-it-work-on-rt.patch | 2 +- ...nate-softirq-processing-from-rcutree.patch | 2 +- .../rt/rcu-disable-more-spots-of-rcu_bh.patch | 2 +- .../rt/rcu-disable-rcu-fast-no-hz-on-rt.patch | 2 +- .../rt/rcu-make-RCU_BOOST-default-on-RT.patch | 2 +- ...merge-rcu-bh-into-rcu-preempt-for-rt.patch | 2 +- ...nt-out-rcu_bh-ops-on-PREEMPT_RT_FULL.patch | 2 +- ...s-disable-irq-while-calling-rcu_pree.patch | 2 +- ...ate_disable-race-with-cpu-hotplug-3f.patch | 2 +- ...l-arm-coredump-fails-for-cpu-3e-3d-4.patch | 2 +- .../all/rt/relay-fix-timer-madness.patch | 2 +- ...function-called-from-invalid-context.patch | 2 +- .../features/all/rt/rt-add-rt-locks.patch | 10 +- .../all/rt/rt-introduce-cpu-chill.patch | 2 +- .../features/all/rt/rt-local-irq-lock.patch | 2 +- ...-Reenable-migration-accross-schedule.patch | 2 +- .../all/rt/rt-preempt-base-config.patch | 2 +- .../features/all/rt/rt-serial-warn-fix.patch | 2 +- ...ndle-non-enqueued-waiters-gracefully.patch | 2 +- ...tmutex-Use-chainwalking-control-enum.patch | 2 +- ...rtmutex-add-a-first-shot-of-ww_mutex.patch | 2 +- .../all/rt/rtmutex-avoid-include-hell.patch | 2 +- .../all/rt/rtmutex-futex-prepare-rt.patch | 12 +- .../all/rt/rtmutex-lock-killable.patch | 2 +- ...wn-migrate_disable-into-rt_spin_lock.patch | 2 +- .../rt/rtmutex-trylock-is-okay-on-RT.patch | 2 +- .../all/rt/rtmutex_dont_include_rcu.patch | 2 +- ...t-t-disable-interrupts-in-qc_issue-h.patch | 2 +- ...is7xx_Drop_bogus_use_of_IRQF_ONESHOT.patch | 2 +- ...line-dl_task_timer-has-to-be-irqsafe.patch | 2 +- .../all/rt/sched-delay-put-task.patch | 2 +- .../sched-disable-rt-group-sched-on-rt.patch | 2 +- .../all/rt/sched-disable-ttwu-queue.patch | 2 +- ...eempt-avoid-a-warning-in-the-RT-case.patch | 21 + .../all/rt/sched-limit-nr-migrate.patch | 2 +- ...might-sleep-do-not-account-rcu-depth.patch | 2 +- .../all/rt/sched-mmdrop-delayed.patch | 2 +- ...empt-Fix-preempt_count-manipulations.patch | 2 +- ...provide-a-tsk_nr_cpus_allowed-helper.patch | 2 +- .../all/rt/sched-rt-mutex-wakeup.patch | 2 +- ...twu-ensure-success-return-is-correct.patch | 2 +- ...us_allowed-instead-of-accessing-cpus.patch | 2 +- ...Only-wake-up-idle-workers-if-not-blo.patch | 2 +- ...t_cpu-put_cpu_light-imbalance-in-fco.patch | 28 + .../features/all/rt/scsi-fcoe-rt-aware.patch | 2 +- ...function-called-from-invalid-context.patch | 2 +- .../rt/seqlock-prevent-rt-starvation.patch | 2 +- .../signal-Use-hrtimer-for-sigtimedwait.patch | 78 ++ .../all/rt/signal-fix-up-rcu-wreckage.patch | 2 +- .../signal-revert-ptrace-preempt-magic.patch | 2 +- ...t-tasks-to-cache-one-sigqueue-struct.patch | 2 +- .../features/all/rt/skbufhead-raw-lock.patch | 4 +- .../rt/slub-disable-SLUB_CPU_PARTIAL.patch | 2 +- .../all/rt/slub-enable-irqs-for-no-wait.patch | 2 +- ...pcm_stream_lock-irqs_disabled-splats.patch | 2 +- ...oftirq-disable-softirq-stacks-for-rt.patch | 2 +- .../all/rt/softirq-preempt-fix-3-re.patch | 2 +- .../features/all/rt/softirq-split-locks.patch | 4 +- ...plit-timer-softirqs-out-of-ksoftirqd.patch | 2 +- ...arc64-use-generic-rwsem-spinlocks-rt.patch | 2 +- .../all/rt/spinlock-types-separate-raw.patch | 2 +- ...eate-lg_global_trylock_relax-primiti.patch | 2 +- ...e-lg_global_trylock_relax-to-dead-wi.patch | 2 +- .../all/rt/stop-machine-raw-lock.patch | 2 +- ...nvert-stop_machine_run-to-PREEMPT_RT.patch | 2 +- ...vc_xprt_do_enqueue-use-get_cpu_light.patch | 8 +- .../suspend-prevernt-might-sleep-splats.patch | 2 +- .../all/rt/sysfs-realtime-entry.patch | 2 +- ...-from-going-into-infinite-spin-in-rt.patch | 2 +- ...rmal-Defer-thermal-wakups-to-threads.patch | 2 +- ...tick-broadcast--Make-hrtimer-irqsafe.patch | 2 +- ...ched-Remove-pointless-empty-function.patch | 71 + .../rt/timekeeping-split-jiffies-lock.patch | 2 +- ...orward-wheel-clock-whenever-possible.patch | 241 ++++ ...few-structs-and-members-proper-names.patch | 422 ++++++ .../timer-Make-pinned-a-timer-property.patch | 145 ++ .../rt/timer-Move-__run_timers-function.patch | 92 ++ ...timer-Only-wake-softirq-if-necessary.patch | 35 + ...on-for-same-expiry-time-in-mod_timer.patch | 131 ++ ...mer-Optimize-collect-timers-for-NOHZ.patch | 129 ++ ...r-Reduce-the-CPU-index-space-to-256k.patch | 35 + .../rt/timer-Remove-mod_timer_pinned.patch | 117 ++ .../all/rt/timer-Remove-slack-leftovers.patch | 162 +++ .../timer-Split-out-index-calculation.patch | 106 ++ ...imer-Switch-to-a-non-cascading-wheel.patch | 1170 +++++++++++++++++ ...mer-add-setup_deferrable_timer-macro.patch | 27 + ...-waking-softirqs-from-the-jiffy-tick.patch | 4 +- .../all/rt/timer-fd-avoid-live-lock.patch | 2 +- .../all/rt/timer-make-the-base-lock-raw.patch | 181 +++ ...id-the-base-null-otptimization-on-rt.patch | 74 -- .../all/rt/timers-preempt-rt-support.patch | 55 - .../timers-prepare-for-full-preemption.patch | 87 +- ...f-by-one-while-recording-the-trace-e.patch | 50 - ...st-Consider-new-argument-when-probin.patch | 2 +- ...sion_for_preemptoff_hist_trace_point.patch | 2 +- ...-preempt-count-of-when-the-event-was.patch | 42 + ...-for-preempt-off-in-preempt_schedule.patch | 2 +- ...0-don-t-take-the-trylock-during-oops.patch | 3 +- ...ove-preemption-disabling-in-netif_rx.patch | 2 +- .../all/rt/usb-use-_nort-in-giveback.patch | 2 +- .../all/rt/user-use-local-irq-nort.patch | 2 +- .../all/rt/wait.h-include-atomic.h.patch | 2 +- ...rk-around-irqsafe-timer-optimization.patch | 2 +- ...mple-Simple-work-queue-implemenation.patch | 2 +- .../rt/workqueue-distangle-from-rq-lock.patch | 2 +- .../rt/workqueue-prevent-deadlock-stall.patch | 2 +- .../all/rt/workqueue-use-locallock.patch | 2 +- .../features/all/rt/workqueue-use-rcu.patch | 2 +- .../rt/x86-UV-raw_spinlock-conversion.patch | 2 +- ...6-apic-uv-Initialize-timer-as-pinned.patch | 41 + ...ypto-reduce-preempt-disabled-regions.patch | 2 +- ...highmem-add-a-already-used-pte-check.patch | 2 +- .../all/rt/x86-io-apic-migra-no-unmask.patch | 2 +- .../rt/x86-kvm-require-const-tsc-for-rt.patch | 2 +- .../x86-mce-Initialize-timer-as-pinned.patch | 41 + .../all/rt/x86-mce-timer-hrtimer.patch | 6 +- ...-mce-use-swait-queue-for-mce-wakeups.patch | 2 +- ...ble-preemption-during-CR3-read-write.patch | 68 + .../features/all/rt/x86-preempt-lazy.patch | 2 +- ...ignal-delay-calling-signals-on-32bit.patch | 2 +- .../rt/x86-stackprot-no-random-on-rt.patch | 2 +- .../rt/x86-use-gen-rwsem-spinlocks-rt.patch | 2 +- debian/patches/series-rt | 34 +- 322 files changed, 4178 insertions(+), 559 deletions(-) create mode 100644 debian/patches/features/all/rt/driver-net-ethernet-tile-Initialize-timer-as-pinned.patch create mode 100644 debian/patches/features/all/rt/drivers-tty-metag_da-Initialize-timer-as-pinned.patch create mode 100644 debian/patches/features/all/rt/drivers-tty-mips_ejtag-Initialize-timer-as-pinned.patch create mode 100644 debian/patches/features/all/rt/drm-i915-Use-consistent-forcewake-auto-release-timeo.patch create mode 100644 debian/patches/features/all/rt/hlist-Add-hlist_is_singular_node-helper.patch create mode 100644 debian/patches/features/all/rt/net-ipv4-inet-Initialize-timers-as-pinned.patch create mode 100644 debian/patches/features/all/rt/sched-lazy_preempt-avoid-a-warning-in-the-RT-case.patch create mode 100644 debian/patches/features/all/rt/scsi-fcoe-Fix-get_cpu-put_cpu_light-imbalance-in-fco.patch create mode 100644 debian/patches/features/all/rt/signal-Use-hrtimer-for-sigtimedwait.patch create mode 100644 debian/patches/features/all/rt/tick-sched-Remove-pointless-empty-function.patch create mode 100644 debian/patches/features/all/rt/timer-Forward-wheel-clock-whenever-possible.patch create mode 100644 debian/patches/features/all/rt/timer-Give-a-few-structs-and-members-proper-names.patch create mode 100644 debian/patches/features/all/rt/timer-Make-pinned-a-timer-property.patch create mode 100644 debian/patches/features/all/rt/timer-Move-__run_timers-function.patch create mode 100644 debian/patches/features/all/rt/timer-Only-wake-softirq-if-necessary.patch create mode 100644 debian/patches/features/all/rt/timer-Optimization-for-same-expiry-time-in-mod_timer.patch create mode 100644 debian/patches/features/all/rt/timer-Optimize-collect-timers-for-NOHZ.patch create mode 100644 debian/patches/features/all/rt/timer-Reduce-the-CPU-index-space-to-256k.patch create mode 100644 debian/patches/features/all/rt/timer-Remove-mod_timer_pinned.patch create mode 100644 debian/patches/features/all/rt/timer-Remove-slack-leftovers.patch create mode 100644 debian/patches/features/all/rt/timer-Split-out-index-calculation.patch create mode 100644 debian/patches/features/all/rt/timer-Switch-to-a-non-cascading-wheel.patch create mode 100644 debian/patches/features/all/rt/timer-add-setup_deferrable_timer-macro.patch create mode 100644 debian/patches/features/all/rt/timer-make-the-base-lock-raw.patch delete mode 100644 debian/patches/features/all/rt/timers-avoid-the-base-null-otptimization-on-rt.patch delete mode 100644 debian/patches/features/all/rt/timers-preempt-rt-support.patch delete mode 100644 debian/patches/features/all/rt/trace-correct-off-by-one-while-recording-the-trace-e.patch create mode 100644 debian/patches/features/all/rt/tracing-Show-the-preempt-count-of-when-the-event-was.patch create mode 100644 debian/patches/features/all/rt/x86-apic-uv-Initialize-timer-as-pinned.patch create mode 100644 debian/patches/features/all/rt/x86-mce-Initialize-timer-as-pinned.patch create mode 100644 debian/patches/features/all/rt/x86-mm-disable-preemption-during-CR3-read-write.patch diff --git a/debian/changelog b/debian/changelog index c1da5042fcfc..58e661e4878c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -311,6 +311,9 @@ linux (4.6.6-1) UNRELEASED; urgency=medium * linux-kbuild: Include headers_install.sh and unifdef (Closes: #832359) * Bump ABI to 2 + [ Uwe Kleine-König ] + * [rt] Update to 4.6.5-rt10 + -- Ben Hutchings Sat, 30 Jul 2016 14:23:58 +0100 linux (4.6.4-1) unstable; urgency=medium diff --git a/debian/patches/features/all/rt/0005-futex-Ensure-lock-unlock-symetry-versus-pi_lock-and-.patch b/debian/patches/features/all/rt/0005-futex-Ensure-lock-unlock-symetry-versus-pi_lock-and-.patch index fd7fd334e60d..b1065a9bad81 100644 --- a/debian/patches/features/all/rt/0005-futex-Ensure-lock-unlock-symetry-versus-pi_lock-and-.patch +++ b/debian/patches/features/all/rt/0005-futex-Ensure-lock-unlock-symetry-versus-pi_lock-and-.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Fri, 1 Mar 2013 11:17:42 +0100 Subject: futex: Ensure lock/unlock symetry versus pi_lock and hash bucket lock -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz In exit_pi_state_list() we have the following locking construct: @@ -31,7 +31,7 @@ Signed-off-by: Sebastian Andrzej Siewior --- a/kernel/futex.c +++ b/kernel/futex.c -@@ -866,7 +866,9 @@ void exit_pi_state_list(struct task_stru +@@ -874,7 +874,9 @@ void exit_pi_state_list(struct task_stru * task still owns the PI-state: */ if (head->next != next) { diff --git a/debian/patches/features/all/rt/ARM-enable-irq-in-translation-section-permission-fau.patch b/debian/patches/features/all/rt/ARM-enable-irq-in-translation-section-permission-fau.patch index dfe497d165ec..a629c87d4c63 100644 --- a/debian/patches/features/all/rt/ARM-enable-irq-in-translation-section-permission-fau.patch +++ b/debian/patches/features/all/rt/ARM-enable-irq-in-translation-section-permission-fau.patch @@ -1,7 +1,7 @@ From: "Yadi.hu" Date: Wed, 10 Dec 2014 10:32:09 +0800 Subject: ARM: enable irq in translation/section permission fault handlers -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Probably happens on all ARM, with CONFIG_PREEMPT_RT_FULL diff --git a/debian/patches/features/all/rt/ARM-imx-always-use-TWD-on-IMX6Q.patch b/debian/patches/features/all/rt/ARM-imx-always-use-TWD-on-IMX6Q.patch index b5e0435dbe76..7b66f2f621b2 100644 --- a/debian/patches/features/all/rt/ARM-imx-always-use-TWD-on-IMX6Q.patch +++ b/debian/patches/features/all/rt/ARM-imx-always-use-TWD-on-IMX6Q.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Wed, 6 Apr 2016 17:30:28 +0200 Subject: [PATCH] ARM: imx: always use TWD on IMX6Q -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz There is no reason to limit the TWD to be used on SMP kernels only if the hardware has it available. diff --git a/debian/patches/features/all/rt/HACK-printk-drop-the-logbuf_lock-more-often.patch b/debian/patches/features/all/rt/HACK-printk-drop-the-logbuf_lock-more-often.patch index e9326ab9573a..878da7604a0b 100644 --- a/debian/patches/features/all/rt/HACK-printk-drop-the-logbuf_lock-more-often.patch +++ b/debian/patches/features/all/rt/HACK-printk-drop-the-logbuf_lock-more-often.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Thu, 21 Mar 2013 19:01:05 +0100 Subject: printk: Drop the logbuf_lock more often -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz 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. diff --git a/debian/patches/features/all/rt/KVM-arm-arm64-downgrade-preempt_disable-d-region-to-.patch b/debian/patches/features/all/rt/KVM-arm-arm64-downgrade-preempt_disable-d-region-to-.patch index 186b12ce031b..61be4d21bda9 100644 --- a/debian/patches/features/all/rt/KVM-arm-arm64-downgrade-preempt_disable-d-region-to-.patch +++ b/debian/patches/features/all/rt/KVM-arm-arm64-downgrade-preempt_disable-d-region-to-.patch @@ -1,7 +1,7 @@ From: Josh Cartwright Date: Thu, 11 Feb 2016 11:54:01 -0600 Subject: KVM: arm/arm64: downgrade preempt_disable()d region to migrate_disable() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz 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 @@ -23,7 +23,7 @@ Signed-off-by: Sebastian Andrzej Siewior --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c -@@ -581,7 +581,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_v +@@ -582,7 +582,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_v * involves poking the GIC, which must be done in a * non-preemptible context. */ @@ -32,7 +32,7 @@ Signed-off-by: Sebastian Andrzej Siewior kvm_pmu_flush_hwstate(vcpu); kvm_timer_flush_hwstate(vcpu); kvm_vgic_flush_hwstate(vcpu); -@@ -602,7 +602,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_v +@@ -603,7 +603,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_v kvm_pmu_sync_hwstate(vcpu); kvm_timer_sync_hwstate(vcpu); kvm_vgic_sync_hwstate(vcpu); @@ -41,7 +41,7 @@ Signed-off-by: Sebastian Andrzej Siewior continue; } -@@ -658,7 +658,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_v +@@ -659,7 +659,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_v kvm_vgic_sync_hwstate(vcpu); diff --git a/debian/patches/features/all/rt/KVM-lapic-mark-LAPIC-timer-handler-as-irqsafe.patch b/debian/patches/features/all/rt/KVM-lapic-mark-LAPIC-timer-handler-as-irqsafe.patch index 48acfecc8f03..9705b82978a2 100644 --- a/debian/patches/features/all/rt/KVM-lapic-mark-LAPIC-timer-handler-as-irqsafe.patch +++ b/debian/patches/features/all/rt/KVM-lapic-mark-LAPIC-timer-handler-as-irqsafe.patch @@ -1,7 +1,7 @@ From: Marcelo Tosatti Date: Wed, 8 Apr 2015 20:33:25 -0300 Subject: KVM: lapic: mark LAPIC timer handler as irqsafe -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Since lapic timer handler only wakes up a simple waitqueue, it can be executed from hardirq context. diff --git a/debian/patches/features/all/rt/acpi-rt-Convert-acpi_gbl_hardware-lock-back-to-a-raw.patch b/debian/patches/features/all/rt/acpi-rt-Convert-acpi_gbl_hardware-lock-back-to-a-raw.patch index 2cddb598e174..21c9561d862b 100644 --- a/debian/patches/features/all/rt/acpi-rt-Convert-acpi_gbl_hardware-lock-back-to-a-raw.patch +++ b/debian/patches/features/all/rt/acpi-rt-Convert-acpi_gbl_hardware-lock-back-to-a-raw.patch @@ -1,7 +1,7 @@ From: Steven Rostedt Date: Wed, 13 Feb 2013 09:26:05 -0500 Subject: acpi/rt: Convert acpi_gbl_hardware lock back to a raw_spinlock_t -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz We hit the following bug with 3.6-rt: diff --git a/debian/patches/features/all/rt/arch-arm64-Add-lazy-preempt-support.patch b/debian/patches/features/all/rt/arch-arm64-Add-lazy-preempt-support.patch index 8dd24a45ecf8..ba38948f62f1 100644 --- a/debian/patches/features/all/rt/arch-arm64-Add-lazy-preempt-support.patch +++ b/debian/patches/features/all/rt/arch-arm64-Add-lazy-preempt-support.patch @@ -1,7 +1,7 @@ From: Anders Roxell Date: Thu, 14 May 2015 17:52:17 +0200 Subject: arch/arm64: Add lazy preempt support -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.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, @@ -66,7 +66,7 @@ Signed-off-by: Anders Roxell DEFINE(TI_CPU, offsetof(struct thread_info, cpu)); --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S -@@ -411,11 +411,16 @@ ENDPROC(el1_sync) +@@ -426,11 +426,16 @@ ENDPROC(el1_sync) #ifdef CONFIG_PREEMPT ldr w24, [tsk, #TI_PREEMPT] // get preempt count @@ -86,7 +86,7 @@ Signed-off-by: Anders Roxell #endif #ifdef CONFIG_TRACE_IRQFLAGS bl trace_hardirqs_on -@@ -429,6 +434,7 @@ ENDPROC(el1_irq) +@@ -444,6 +449,7 @@ ENDPROC(el1_irq) 1: bl preempt_schedule_irq // irq en/disable is done inside ldr x0, [tsk, #TI_FLAGS] // get new tasks TI_FLAGS tbnz x0, #TIF_NEED_RESCHED, 1b // needs rescheduling? @@ -94,7 +94,7 @@ Signed-off-by: Anders Roxell ret x24 #endif -@@ -675,6 +681,7 @@ ENDPROC(cpu_switch_to) +@@ -690,6 +696,7 @@ ENDPROC(cpu_switch_to) */ work_pending: tbnz x1, #TIF_NEED_RESCHED, work_resched diff --git a/debian/patches/features/all/rt/arm-arm64-lazy-preempt-add-TIF_NEED_RESCHED_LAZY-to-.patch b/debian/patches/features/all/rt/arm-arm64-lazy-preempt-add-TIF_NEED_RESCHED_LAZY-to-.patch index 5be06cb366c7..0dc16cf97e2e 100644 --- a/debian/patches/features/all/rt/arm-arm64-lazy-preempt-add-TIF_NEED_RESCHED_LAZY-to-.patch +++ b/debian/patches/features/all/rt/arm-arm64-lazy-preempt-add-TIF_NEED_RESCHED_LAZY-to-.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Fri, 22 Jan 2016 21:33:39 +0100 Subject: arm+arm64: lazy-preempt: add TIF_NEED_RESCHED_LAZY to _TIF_WORK_MASK -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz _TIF_WORK_MASK is used to check for TIF_NEED_RESCHED so we need to check for TIF_NEED_RESCHED_LAZY here, too. diff --git a/debian/patches/features/all/rt/arm-at91-pit-remove-irq-handler-when-clock-is-unused.patch b/debian/patches/features/all/rt/arm-at91-pit-remove-irq-handler-when-clock-is-unused.patch index 545c81b853c1..b512b280c0d3 100644 --- a/debian/patches/features/all/rt/arm-at91-pit-remove-irq-handler-when-clock-is-unused.patch +++ b/debian/patches/features/all/rt/arm-at91-pit-remove-irq-handler-when-clock-is-unused.patch @@ -1,7 +1,7 @@ From: Benedikt Spranger Date: Sat, 6 Mar 2010 17:47:10 +0100 Subject: ARM: AT91: PIT: Remove irq handler when clock event is unused -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Setup and remove the interrupt handler in clock event mode selection. This avoids calling the (shared) interrupt handler when the device is diff --git a/debian/patches/features/all/rt/arm-at91-tclib-default-to-tclib-timer-for-rt.patch b/debian/patches/features/all/rt/arm-at91-tclib-default-to-tclib-timer-for-rt.patch index 0e45aecab642..c813a96c80eb 100644 --- a/debian/patches/features/all/rt/arm-at91-tclib-default-to-tclib-timer-for-rt.patch +++ b/debian/patches/features/all/rt/arm-at91-tclib-default-to-tclib-timer-for-rt.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Sat, 1 May 2010 18:29:35 +0200 Subject: ARM: at91: tclib: Default to tclib timer for RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz RT is not too happy about the shared timer interrupt in AT91 devices. Default to tclib timer for RT. diff --git a/debian/patches/features/all/rt/arm-convert-boot-lock-to-raw.patch b/debian/patches/features/all/rt/arm-convert-boot-lock-to-raw.patch index 5ffc6041fbff..e083d163c441 100644 --- a/debian/patches/features/all/rt/arm-convert-boot-lock-to-raw.patch +++ b/debian/patches/features/all/rt/arm-convert-boot-lock-to-raw.patch @@ -1,7 +1,7 @@ From: Frank Rowand Date: Mon, 19 Sep 2011 14:51:14 -0700 Subject: arm: Convert arm boot_lock to raw -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz 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. diff --git a/debian/patches/features/all/rt/arm-enable-highmem-for-rt.patch b/debian/patches/features/all/rt/arm-enable-highmem-for-rt.patch index 4fc96bd7a9ab..5fa6dc1f60d1 100644 --- a/debian/patches/features/all/rt/arm-enable-highmem-for-rt.patch +++ b/debian/patches/features/all/rt/arm-enable-highmem-for-rt.patch @@ -1,7 +1,7 @@ Subject: arm: Enable highmem for rt From: Thomas Gleixner Date: Wed, 13 Feb 2013 11:03:11 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz fixup highmem for ARM. diff --git a/debian/patches/features/all/rt/arm-highmem-flush-tlb-on-unmap.patch b/debian/patches/features/all/rt/arm-highmem-flush-tlb-on-unmap.patch index 2ec5366910b5..6425b855e3ae 100644 --- a/debian/patches/features/all/rt/arm-highmem-flush-tlb-on-unmap.patch +++ b/debian/patches/features/all/rt/arm-highmem-flush-tlb-on-unmap.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Mon, 11 Mar 2013 21:37:27 +0100 Subject: arm/highmem: Flush tlb on unmap -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz 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 diff --git a/debian/patches/features/all/rt/arm-lazy-preempt-correct-resched-condition.patch b/debian/patches/features/all/rt/arm-lazy-preempt-correct-resched-condition.patch index e2f3d52f69da..7ab67699fb60 100644 --- a/debian/patches/features/all/rt/arm-lazy-preempt-correct-resched-condition.patch +++ b/debian/patches/features/all/rt/arm-lazy-preempt-correct-resched-condition.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Tue, 24 May 2016 12:56:38 +0200 Subject: [PATCH] arm: lazy preempt: correct resched condition -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz If we get out of preempt_schedule_irq() then we check for NEED_RESCHED and call the former function again if set because the preemption counter diff --git a/debian/patches/features/all/rt/arm-preempt-lazy-support.patch b/debian/patches/features/all/rt/arm-preempt-lazy-support.patch index a7cb3fc5f08f..788cefa27036 100644 --- a/debian/patches/features/all/rt/arm-preempt-lazy-support.patch +++ b/debian/patches/features/all/rt/arm-preempt-lazy-support.patch @@ -1,7 +1,7 @@ Subject: arm: Add support for lazy preemption From: Thomas Gleixner Date: Wed, 31 Oct 2012 12:04:11 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Implement the arm pieces for lazy preempt. diff --git a/debian/patches/features/all/rt/arm-unwind-use_raw_lock.patch b/debian/patches/features/all/rt/arm-unwind-use_raw_lock.patch index 5ebb22f7893a..0912c87d71f2 100644 --- a/debian/patches/features/all/rt/arm-unwind-use_raw_lock.patch +++ b/debian/patches/features/all/rt/arm-unwind-use_raw_lock.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Fri, 20 Sep 2013 14:31:54 +0200 Subject: arm/unwind: use a raw_spin_lock -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Mostly unwind is done with irqs enabled however SLUB may call it with irqs disabled while creating a new SLUB cache. diff --git a/debian/patches/features/all/rt/arm64-xen--Make-XEN-depend-on-non-rt.patch b/debian/patches/features/all/rt/arm64-xen--Make-XEN-depend-on-non-rt.patch index 570124fcd0d0..c9a272b5b5e1 100644 --- a/debian/patches/features/all/rt/arm64-xen--Make-XEN-depend-on-non-rt.patch +++ b/debian/patches/features/all/rt/arm64-xen--Make-XEN-depend-on-non-rt.patch @@ -1,7 +1,7 @@ Subject: arm64/xen: Make XEN depend on !RT From: Thomas Gleixner Date: Mon, 12 Oct 2015 11:18:40 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz It's not ready and probably never will be, unless xen folks have a look at it. diff --git a/debian/patches/features/all/rt/at91_dont_enable_disable_clock.patch b/debian/patches/features/all/rt/at91_dont_enable_disable_clock.patch index 4e29b6b32adb..2152c6575e06 100644 --- a/debian/patches/features/all/rt/at91_dont_enable_disable_clock.patch +++ b/debian/patches/features/all/rt/at91_dont_enable_disable_clock.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Wed, 09 Mar 2016 10:51:06 +0100 Subject: arm: at91: do not disable/enable clocks in a row -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Currently the driver will disable the clock and enable it one line later if it is switching from periodic mode into one shot. diff --git a/debian/patches/features/all/rt/ata-disable-interrupts-if-non-rt.patch b/debian/patches/features/all/rt/ata-disable-interrupts-if-non-rt.patch index 8aff62bef502..cf2d0f1c8324 100644 --- a/debian/patches/features/all/rt/ata-disable-interrupts-if-non-rt.patch +++ b/debian/patches/features/all/rt/ata-disable-interrupts-if-non-rt.patch @@ -1,7 +1,7 @@ From: Steven Rostedt Date: Fri, 3 Jul 2009 08:44:29 -0500 Subject: ata: Do not disable interrupts in ide code for preempt-rt -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Use the local_irq_*_nort variants. diff --git a/debian/patches/features/all/rt/blk-mq-revert-raw-locks-post-pone-notifier-to-POST_D.patchto-POST_D.patch b/debian/patches/features/all/rt/blk-mq-revert-raw-locks-post-pone-notifier-to-POST_D.patchto-POST_D.patch index dfd213f2e45d..e8aab9a9714a 100644 --- a/debian/patches/features/all/rt/blk-mq-revert-raw-locks-post-pone-notifier-to-POST_D.patchto-POST_D.patch +++ b/debian/patches/features/all/rt/blk-mq-revert-raw-locks-post-pone-notifier-to-POST_D.patchto-POST_D.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Sat, 3 May 2014 11:00:29 +0200 Subject: blk-mq: revert raw locks, post pone notifier to POST_DEAD -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz The blk_mq_cpu_notify_lock should be raw because some CPU down levels are called with interrupts off. The notifier itself calls currently one diff --git a/debian/patches/features/all/rt/block-blk-mq-use-swait.patch b/debian/patches/features/all/rt/block-blk-mq-use-swait.patch index ba8d98423de5..af6fd1c15d5d 100644 --- a/debian/patches/features/all/rt/block-blk-mq-use-swait.patch +++ b/debian/patches/features/all/rt/block-blk-mq-use-swait.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Fri, 13 Feb 2015 11:01:26 +0100 Subject: block: blk-mq: Use swait -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz | 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 diff --git a/debian/patches/features/all/rt/block-mq-don-t-complete-requests-via-IPI.patch b/debian/patches/features/all/rt/block-mq-don-t-complete-requests-via-IPI.patch index a0c60404d5f0..a46ad8833a7e 100644 --- a/debian/patches/features/all/rt/block-mq-don-t-complete-requests-via-IPI.patch +++ b/debian/patches/features/all/rt/block-mq-don-t-complete-requests-via-IPI.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Thu, 29 Jan 2015 15:10:08 +0100 Subject: block/mq: don't complete requests via IPI -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz The IPI runs in hardirq context and there are sleeping locks. This patch moves the completion into a workqueue. diff --git a/debian/patches/features/all/rt/block-mq-drop-preempt-disable.patch b/debian/patches/features/all/rt/block-mq-drop-preempt-disable.patch index df7b5cb66631..01e87f6381d7 100644 --- a/debian/patches/features/all/rt/block-mq-drop-preempt-disable.patch +++ b/debian/patches/features/all/rt/block-mq-drop-preempt-disable.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Tue, 14 Jul 2015 14:26:34 +0200 Subject: block/mq: do not invoke preempt_disable() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz preempt_disable() and get_cpu() don't play well together with the sleeping locks it tries to allocate later. diff --git a/debian/patches/features/all/rt/block-mq-use-cpu_light.patch b/debian/patches/features/all/rt/block-mq-use-cpu_light.patch index 72b29da4cd27..cc5ddf5ca327 100644 --- a/debian/patches/features/all/rt/block-mq-use-cpu_light.patch +++ b/debian/patches/features/all/rt/block-mq-use-cpu_light.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Wed, 9 Apr 2014 10:37:23 +0200 Subject: block: mq: use cpu_light() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz 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(). diff --git a/debian/patches/features/all/rt/block-shorten-interrupt-disabled-regions.patch b/debian/patches/features/all/rt/block-shorten-interrupt-disabled-regions.patch index 1247a840928e..888a0e09d718 100644 --- a/debian/patches/features/all/rt/block-shorten-interrupt-disabled-regions.patch +++ b/debian/patches/features/all/rt/block-shorten-interrupt-disabled-regions.patch @@ -1,7 +1,7 @@ Subject: block: Shorten interrupt disabled regions From: Thomas Gleixner Date: Wed, 22 Jun 2011 19:47:02 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Moving the blk_sched_flush_plug() call out of the interrupt/preempt disabled region in the scheduler allows us to replace diff --git a/debian/patches/features/all/rt/block-use-cpu-chill.patch b/debian/patches/features/all/rt/block-use-cpu-chill.patch index f3216b5652dc..f06ac034bf4f 100644 --- a/debian/patches/features/all/rt/block-use-cpu-chill.patch +++ b/debian/patches/features/all/rt/block-use-cpu-chill.patch @@ -1,7 +1,7 @@ Subject: block: Use cpu_chill() for retry loops From: Thomas Gleixner Date: Thu, 20 Dec 2012 18:28:26 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Retry loops on RT might loop forever when the modifying side was preempted. Steven also observed a live lock when there was a diff --git a/debian/patches/features/all/rt/bug-rt-dependend-variants.patch b/debian/patches/features/all/rt/bug-rt-dependend-variants.patch index 1d27409b395b..6d31f2b9a506 100644 --- a/debian/patches/features/all/rt/bug-rt-dependend-variants.patch +++ b/debian/patches/features/all/rt/bug-rt-dependend-variants.patch @@ -1,7 +1,7 @@ From: Ingo Molnar Date: Fri, 3 Jul 2009 08:29:58 -0500 Subject: bug: BUG_ON/WARN_ON variants dependend on RT/!RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Introduce RT/NON-RT WARN/BUG statements to avoid ifdefs in the code. diff --git a/debian/patches/features/all/rt/cgroups-scheduling-while-atomic-in-cgroup-code.patch b/debian/patches/features/all/rt/cgroups-scheduling-while-atomic-in-cgroup-code.patch index c4a6c8fcd726..065c737a8e20 100644 --- a/debian/patches/features/all/rt/cgroups-scheduling-while-atomic-in-cgroup-code.patch +++ b/debian/patches/features/all/rt/cgroups-scheduling-while-atomic-in-cgroup-code.patch @@ -1,7 +1,7 @@ From: Mike Galbraith Date: Sat, 21 Jun 2014 10:09:48 +0200 Subject: memcontrol: Prevent scheduling while atomic in cgroup code -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz mm, memcg: make refill_stock() use get_cpu_light() diff --git a/debian/patches/features/all/rt/cgroups-use-simple-wait-in-css_release.patch b/debian/patches/features/all/rt/cgroups-use-simple-wait-in-css_release.patch index 55fc22afbd7b..3e4285e8554e 100644 --- a/debian/patches/features/all/rt/cgroups-use-simple-wait-in-css_release.patch +++ b/debian/patches/features/all/rt/cgroups-use-simple-wait-in-css_release.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Fri, 13 Feb 2015 15:52:24 +0100 Subject: cgroups: use simple wait in css_release() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz To avoid: |BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:914 diff --git a/debian/patches/features/all/rt/clockevents-drivers-timer-atmel-pit-fix-double-free_.patch b/debian/patches/features/all/rt/clockevents-drivers-timer-atmel-pit-fix-double-free_.patch index f7690a992ae1..4cae35b31e0c 100644 --- a/debian/patches/features/all/rt/clockevents-drivers-timer-atmel-pit-fix-double-free_.patch +++ b/debian/patches/features/all/rt/clockevents-drivers-timer-atmel-pit-fix-double-free_.patch @@ -1,7 +1,7 @@ From: Alexandre Belloni Date: Thu, 17 Mar 2016 21:09:43 +0100 Subject: [PATCH] clockevents/drivers/timer-atmel-pit: fix double free_irq -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz clockevents_exchange_device() changes the state from detached to shutdown and so at that point the IRQ has not yet been requested. diff --git a/debian/patches/features/all/rt/clocksource-tclib-allow-higher-clockrates.patch b/debian/patches/features/all/rt/clocksource-tclib-allow-higher-clockrates.patch index 5cf93cde1782..dda923b5da67 100644 --- a/debian/patches/features/all/rt/clocksource-tclib-allow-higher-clockrates.patch +++ b/debian/patches/features/all/rt/clocksource-tclib-allow-higher-clockrates.patch @@ -1,7 +1,7 @@ From: Benedikt Spranger Date: Mon, 8 Mar 2010 18:57:04 +0100 Subject: clocksource: TCLIB: Allow higher clock rates for clock events -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz As default the TCLIB uses the 32KiHz base clock rate for clock events. Add a compile time selection to allow higher clock resulution. diff --git a/debian/patches/features/all/rt/completion-use-simple-wait-queues.patch b/debian/patches/features/all/rt/completion-use-simple-wait-queues.patch index 78de169070d3..ac8ed0a5fca3 100644 --- a/debian/patches/features/all/rt/completion-use-simple-wait-queues.patch +++ b/debian/patches/features/all/rt/completion-use-simple-wait-queues.patch @@ -1,7 +1,7 @@ Subject: completion: Use simple wait queues From: Thomas Gleixner Date: Fri, 11 Jan 2013 11:23:51 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Completions have no long lasting callbacks and therefor do not need the complex waitqueue variant. Use simple waitqueues which reduces the diff --git a/debian/patches/features/all/rt/cond-resched-lock-rt-tweak.patch b/debian/patches/features/all/rt/cond-resched-lock-rt-tweak.patch index 2d90137bdef2..af778f7f4f10 100644 --- a/debian/patches/features/all/rt/cond-resched-lock-rt-tweak.patch +++ b/debian/patches/features/all/rt/cond-resched-lock-rt-tweak.patch @@ -1,7 +1,7 @@ Subject: sched: Use the proper LOCK_OFFSET for cond_resched() From: Thomas Gleixner Date: Sun, 17 Jul 2011 22:51:33 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz RT does not increment preempt count when a 'sleeping' spinlock is locked. Update PREEMPT_LOCK_OFFSET for that case. diff --git a/debian/patches/features/all/rt/cond-resched-softirq-rt.patch b/debian/patches/features/all/rt/cond-resched-softirq-rt.patch index 97f8a6ebbdb8..bab32a4b757d 100644 --- a/debian/patches/features/all/rt/cond-resched-softirq-rt.patch +++ b/debian/patches/features/all/rt/cond-resched-softirq-rt.patch @@ -1,7 +1,7 @@ Subject: sched: Take RT softirq semantics into account in cond_resched() From: Thomas Gleixner Date: Thu, 14 Jul 2011 09:56:44 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz The softirq semantics work different on -RT. There is no SOFTIRQ_MASK in the preemption counter which leads to the BUG_ON() statement in diff --git a/debian/patches/features/all/rt/cpu-hotplug-Document-why-PREEMPT_RT-uses-a-spinlock.patch b/debian/patches/features/all/rt/cpu-hotplug-Document-why-PREEMPT_RT-uses-a-spinlock.patch index 0cd87b25f089..d97e2acbaf2a 100644 --- a/debian/patches/features/all/rt/cpu-hotplug-Document-why-PREEMPT_RT-uses-a-spinlock.patch +++ b/debian/patches/features/all/rt/cpu-hotplug-Document-why-PREEMPT_RT-uses-a-spinlock.patch @@ -1,7 +1,7 @@ From: Steven Rostedt Date: Thu, 5 Dec 2013 09:16:52 -0500 Subject: cpu hotplug: Document why PREEMPT_RT uses a spinlock -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz The patch: diff --git a/debian/patches/features/all/rt/cpu-rt-make-hotplug-lock-a-sleeping-spinlock-on-rt.patch b/debian/patches/features/all/rt/cpu-rt-make-hotplug-lock-a-sleeping-spinlock-on-rt.patch index 4fa6e2b69c9d..9fc8030e6019 100644 --- a/debian/patches/features/all/rt/cpu-rt-make-hotplug-lock-a-sleeping-spinlock-on-rt.patch +++ b/debian/patches/features/all/rt/cpu-rt-make-hotplug-lock-a-sleeping-spinlock-on-rt.patch @@ -1,7 +1,7 @@ Subject: cpu: Make hotplug.lock a "sleeping" spinlock on RT From: Steven Rostedt Date: Fri, 02 Mar 2012 10:36:57 -0500 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Tasks can block on hotplug.lock in pin_current_cpu(), but their state might be != RUNNING. So the mutex wakeup will set the state diff --git a/debian/patches/features/all/rt/cpu-rt-rework-cpu-down.patch b/debian/patches/features/all/rt/cpu-rt-rework-cpu-down.patch index 01ba45f824eb..1134c15541f3 100644 --- a/debian/patches/features/all/rt/cpu-rt-rework-cpu-down.patch +++ b/debian/patches/features/all/rt/cpu-rt-rework-cpu-down.patch @@ -1,7 +1,7 @@ From: Steven Rostedt Date: Mon, 16 Jul 2012 08:07:43 +0000 Subject: cpu/rt: Rework cpu down for PREEMPT_RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Bringing a CPU down is a pain with the PREEMPT_RT kernel because tasks can be preempted in many more places than in non-RT. In diff --git a/debian/patches/features/all/rt/cpu_chill-Add-a-UNINTERRUPTIBLE-hrtimer_nanosleep.patch b/debian/patches/features/all/rt/cpu_chill-Add-a-UNINTERRUPTIBLE-hrtimer_nanosleep.patch index 6ebd01d8d7b8..842193ac7cdd 100644 --- a/debian/patches/features/all/rt/cpu_chill-Add-a-UNINTERRUPTIBLE-hrtimer_nanosleep.patch +++ b/debian/patches/features/all/rt/cpu_chill-Add-a-UNINTERRUPTIBLE-hrtimer_nanosleep.patch @@ -1,7 +1,7 @@ From: Steven Rostedt Date: Tue, 4 Mar 2014 12:28:32 -0500 Subject: cpu_chill: Add a UNINTERRUPTIBLE hrtimer_nanosleep -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz We hit another bug that was caused by switching cpu_chill() from msleep() to hrtimer_nanosleep(). diff --git a/debian/patches/features/all/rt/cpu_down_move_migrate_enable_back.patch b/debian/patches/features/all/rt/cpu_down_move_migrate_enable_back.patch index 3c1738766265..f8b6ad6b89ba 100644 --- a/debian/patches/features/all/rt/cpu_down_move_migrate_enable_back.patch +++ b/debian/patches/features/all/rt/cpu_down_move_migrate_enable_back.patch @@ -1,7 +1,7 @@ From: Tiejun Chen Subject: cpu_down: move migrate_enable() back Date: Thu, 7 Nov 2013 10:06:07 +0800 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Commit 08c1ab68, "hotplug-use-migrate-disable.patch", intends to use migrate_enable()/migrate_disable() to replace that combination diff --git a/debian/patches/features/all/rt/cpufreq-drop-K8-s-driver-from-beeing-selected.patch b/debian/patches/features/all/rt/cpufreq-drop-K8-s-driver-from-beeing-selected.patch index 57527d9b8e8f..b9430efccfe2 100644 --- a/debian/patches/features/all/rt/cpufreq-drop-K8-s-driver-from-beeing-selected.patch +++ b/debian/patches/features/all/rt/cpufreq-drop-K8-s-driver-from-beeing-selected.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Thu, 9 Apr 2015 15:23:01 +0200 Subject: cpufreq: drop K8's driver from beeing selected -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Ralf posted a picture of a backtrace from diff --git a/debian/patches/features/all/rt/cpumask-disable-offstack-on-rt.patch b/debian/patches/features/all/rt/cpumask-disable-offstack-on-rt.patch index 2cf86a2aca34..e7ac97453f98 100644 --- a/debian/patches/features/all/rt/cpumask-disable-offstack-on-rt.patch +++ b/debian/patches/features/all/rt/cpumask-disable-offstack-on-rt.patch @@ -1,7 +1,7 @@ Subject: cpumask: Disable CONFIG_CPUMASK_OFFSTACK for RT From: Thomas Gleixner Date: Wed, 14 Dec 2011 01:03:49 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz We can't deal with the cpumask allocations which happen in atomic context (see arch/x86/kernel/apic/io_apic.c) on RT right now. diff --git a/debian/patches/features/all/rt/crypto-Reduce-preempt-disabled-regions-more-algos.patch b/debian/patches/features/all/rt/crypto-Reduce-preempt-disabled-regions-more-algos.patch index 184ece01ed6d..cf64cd96b37b 100644 --- a/debian/patches/features/all/rt/crypto-Reduce-preempt-disabled-regions-more-algos.patch +++ b/debian/patches/features/all/rt/crypto-Reduce-preempt-disabled-regions-more-algos.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Fri, 21 Feb 2014 17:24:04 +0100 Subject: crypto: Reduce preempt disabled regions, more algos -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Don Estabrook reported | kernel: WARNING: CPU: 2 PID: 858 at kernel/sched/core.c:2428 migrate_disable+0xed/0x100() diff --git a/debian/patches/features/all/rt/crypto-ccp-remove-rwlocks_types.h.patch b/debian/patches/features/all/rt/crypto-ccp-remove-rwlocks_types.h.patch index 4213dda5bb47..fb8dbfd331bc 100644 --- a/debian/patches/features/all/rt/crypto-ccp-remove-rwlocks_types.h.patch +++ b/debian/patches/features/all/rt/crypto-ccp-remove-rwlocks_types.h.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Wed, 11 May 2016 11:56:18 +0200 Subject: crypto/ccp: remove rwlocks_types.h -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Users of rwlocks should include spinlock.h instead including this header file. The current users of rwlocks_types.h are internal. diff --git a/debian/patches/features/all/rt/debugobjects-rt.patch b/debian/patches/features/all/rt/debugobjects-rt.patch index 547f5429deba..d3e73595cf2c 100644 --- a/debian/patches/features/all/rt/debugobjects-rt.patch +++ b/debian/patches/features/all/rt/debugobjects-rt.patch @@ -1,7 +1,7 @@ Subject: debugobjects: Make RT aware From: Thomas Gleixner Date: Sun, 17 Jul 2011 21:41:35 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Avoid filling the pool / allocating memory with irqs off(). diff --git a/debian/patches/features/all/rt/dm-make-rt-aware.patch b/debian/patches/features/all/rt/dm-make-rt-aware.patch index 9308093ea5bf..82477d2726fa 100644 --- a/debian/patches/features/all/rt/dm-make-rt-aware.patch +++ b/debian/patches/features/all/rt/dm-make-rt-aware.patch @@ -1,7 +1,7 @@ Subject: dm: Make rt aware From: Thomas Gleixner Date: Mon, 14 Nov 2011 23:06:09 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Use the BUG_ON_NORT variant for the irq_disabled() checks. RT has interrupts legitimately enabled here as we cant deadlock against the diff --git a/debian/patches/features/all/rt/driver-net-ethernet-tile-Initialize-timer-as-pinned.patch b/debian/patches/features/all/rt/driver-net-ethernet-tile-Initialize-timer-as-pinned.patch new file mode 100644 index 000000000000..a6b167e12c73 --- /dev/null +++ b/debian/patches/features/all/rt/driver-net-ethernet-tile-Initialize-timer-as-pinned.patch @@ -0,0 +1,41 @@ +From: Thomas Gleixner +Date: Mon, 4 Jul 2016 09:50:19 +0000 +Subject: [PATCH 05/22] driver/net/ethernet/tile: Initialize timer as pinned +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz + +Pinned timers must carry that attribute in the timer itself. No functional +change. + +Signed-off-by: Thomas Gleixner +Reviewed-by: Frederic Weisbecker +Cc: Peter Zijlstra +Cc: Chris Mason +Cc: Eric Dumazet +Cc: rt@linutronix.de +Cc: "Paul E. McKenney" +Cc: Arjan van de Ven +Signed-off-by: Sebastian Andrzej Siewior +--- + drivers/net/ethernet/tile/tilepro.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/tile/tilepro.c ++++ b/drivers/net/ethernet/tile/tilepro.c +@@ -588,7 +588,7 @@ static bool tile_net_lepp_free_comps(str + static void tile_net_schedule_egress_timer(struct tile_net_cpu *info) + { + if (!info->egress_timer_scheduled) { +- mod_timer_pinned(&info->egress_timer, jiffies + 1); ++ mod_timer(&info->egress_timer, jiffies + 1); + info->egress_timer_scheduled = true; + } + } +@@ -1004,7 +1004,7 @@ static void tile_net_register(void *dev_ + BUG(); + + /* Initialize the egress timer. */ +- init_timer(&info->egress_timer); ++ init_timer_pinned(&info->egress_timer); + info->egress_timer.data = (long)info; + info->egress_timer.function = tile_net_handle_egress_timer; + diff --git a/debian/patches/features/all/rt/drivers-block-zram-Replace-bit-spinlocks-with-rtmute.patch b/debian/patches/features/all/rt/drivers-block-zram-Replace-bit-spinlocks-with-rtmute.patch index 18a09b45691b..56b92a67f2b2 100644 --- a/debian/patches/features/all/rt/drivers-block-zram-Replace-bit-spinlocks-with-rtmute.patch +++ b/debian/patches/features/all/rt/drivers-block-zram-Replace-bit-spinlocks-with-rtmute.patch @@ -2,7 +2,7 @@ From: Mike Galbraith Date: Thu, 31 Mar 2016 04:08:28 +0200 Subject: [PATCH] drivers/block/zram: Replace bit spinlocks with rtmutex for -rt -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.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. diff --git a/debian/patches/features/all/rt/drivers-net-8139-disable-irq-nosync.patch b/debian/patches/features/all/rt/drivers-net-8139-disable-irq-nosync.patch index 55cc7c5b201a..37e95be254f9 100644 --- a/debian/patches/features/all/rt/drivers-net-8139-disable-irq-nosync.patch +++ b/debian/patches/features/all/rt/drivers-net-8139-disable-irq-nosync.patch @@ -1,7 +1,7 @@ From: Ingo Molnar Date: Fri, 3 Jul 2009 08:29:24 -0500 Subject: drivers/net: Use disable_irq_nosync() in 8139too -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Use disable_irq_nosync() instead of disable_irq() as this might be called in atomic context with netpoll. diff --git a/debian/patches/features/all/rt/drivers-net-fix-livelock-issues.patch b/debian/patches/features/all/rt/drivers-net-fix-livelock-issues.patch index 0c64128b7ecb..9bb899227408 100644 --- a/debian/patches/features/all/rt/drivers-net-fix-livelock-issues.patch +++ b/debian/patches/features/all/rt/drivers-net-fix-livelock-issues.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Sat, 20 Jun 2009 11:36:54 +0200 Subject: drivers/net: fix livelock issues -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Preempt-RT runs into a live lock issue with the NETDEV_TX_LOCKED micro optimization. The reason is that the softirq thread is rescheduling diff --git a/debian/patches/features/all/rt/drivers-net-vortex-fix-locking-issues.patch b/debian/patches/features/all/rt/drivers-net-vortex-fix-locking-issues.patch index 985e4b2ba2ee..fa77efbaeea7 100644 --- a/debian/patches/features/all/rt/drivers-net-vortex-fix-locking-issues.patch +++ b/debian/patches/features/all/rt/drivers-net-vortex-fix-locking-issues.patch @@ -1,7 +1,7 @@ From: Steven Rostedt Date: Fri, 3 Jul 2009 08:30:00 -0500 Subject: drivers/net: vortex fix locking issues -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Argh, cut and paste wasn't enough... diff --git a/debian/patches/features/all/rt/drivers-random-reduce-preempt-disabled-region.patch b/debian/patches/features/all/rt/drivers-random-reduce-preempt-disabled-region.patch index 6da114382dce..b4f8c658a5e1 100644 --- a/debian/patches/features/all/rt/drivers-random-reduce-preempt-disabled-region.patch +++ b/debian/patches/features/all/rt/drivers-random-reduce-preempt-disabled-region.patch @@ -1,7 +1,7 @@ From: Ingo Molnar Date: Fri, 3 Jul 2009 08:29:30 -0500 Subject: drivers: random: Reduce preempt disabled region -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz No need to keep preemption disabled across the whole function. diff --git a/debian/patches/features/all/rt/drivers-tty-fix-omap-lock-crap.patch b/debian/patches/features/all/rt/drivers-tty-fix-omap-lock-crap.patch index fd9b3c1c2fb6..896f81a73f4e 100644 --- a/debian/patches/features/all/rt/drivers-tty-fix-omap-lock-crap.patch +++ b/debian/patches/features/all/rt/drivers-tty-fix-omap-lock-crap.patch @@ -1,7 +1,7 @@ Subject: tty/serial/omap: Make the locking RT aware From: Thomas Gleixner Date: Thu, 28 Jul 2011 13:32:57 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz 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 diff --git a/debian/patches/features/all/rt/drivers-tty-metag_da-Initialize-timer-as-pinned.patch b/debian/patches/features/all/rt/drivers-tty-metag_da-Initialize-timer-as-pinned.patch new file mode 100644 index 000000000000..f53d20cd229f --- /dev/null +++ b/debian/patches/features/all/rt/drivers-tty-metag_da-Initialize-timer-as-pinned.patch @@ -0,0 +1,38 @@ +From: Thomas Gleixner +Date: Mon, 4 Jul 2016 09:50:21 +0000 +Subject: [PATCH 06/22] drivers/tty/metag_da: Initialize timer as pinned +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz + +Pinned timers must carry that attribute in the timer itself. No functional +change. + +Signed-off-by: Thomas Gleixner +Reviewed-by: Frederic Weisbecker +Cc: Peter Zijlstra +Cc: Chris Mason +Cc: Eric Dumazet +Cc: rt@linutronix.de +Cc: "Paul E. McKenney" +Cc: Arjan van de Ven +Signed-off-by: Sebastian Andrzej Siewior +--- + drivers/tty/metag_da.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/tty/metag_da.c ++++ b/drivers/tty/metag_da.c +@@ -323,12 +323,12 @@ static void dashtty_timer(unsigned long + if (channel >= 0) + fetch_data(channel); + +- mod_timer_pinned(&poll_timer, jiffies + DA_TTY_POLL); ++ mod_timer(&poll_timer, jiffies + DA_TTY_POLL); + } + + static void add_poll_timer(struct timer_list *poll_timer) + { +- setup_timer(poll_timer, dashtty_timer, 0); ++ setup_pinned_timer(poll_timer, dashtty_timer, 0); + poll_timer->expires = jiffies + DA_TTY_POLL; + + /* diff --git a/debian/patches/features/all/rt/drivers-tty-mips_ejtag-Initialize-timer-as-pinned.patch b/debian/patches/features/all/rt/drivers-tty-mips_ejtag-Initialize-timer-as-pinned.patch new file mode 100644 index 000000000000..09c7bacf47e0 --- /dev/null +++ b/debian/patches/features/all/rt/drivers-tty-mips_ejtag-Initialize-timer-as-pinned.patch @@ -0,0 +1,41 @@ +From: Thomas Gleixner +Date: Mon, 4 Jul 2016 09:50:22 +0000 +Subject: [PATCH 07/22] drivers/tty/mips_ejtag: Initialize timer as pinned +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz + +Pinned timers must carry that attribute in the timer itself. No functional +change. + +Signed-off-by: Thomas Gleixner +Reviewed-by: Frederic Weisbecker +Cc: Peter Zijlstra +Cc: Chris Mason +Cc: Eric Dumazet +Cc: rt@linutronix.de +Cc: "Paul E. McKenney" +Cc: Arjan van de Ven +Signed-off-by: Sebastian Andrzej Siewior +--- + drivers/tty/mips_ejtag_fdc.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/tty/mips_ejtag_fdc.c ++++ b/drivers/tty/mips_ejtag_fdc.c +@@ -689,7 +689,7 @@ static void mips_ejtag_fdc_tty_timer(uns + + mips_ejtag_fdc_handle(priv); + if (!priv->removing) +- mod_timer_pinned(&priv->poll_timer, jiffies + FDC_TTY_POLL); ++ mod_timer(&priv->poll_timer, jiffies + FDC_TTY_POLL); + } + + /* TTY Port operations */ +@@ -1002,7 +1002,7 @@ static int mips_ejtag_fdc_tty_probe(stru + raw_spin_unlock_irq(&priv->lock); + } else { + /* If we didn't get an usable IRQ, poll instead */ +- setup_timer(&priv->poll_timer, mips_ejtag_fdc_tty_timer, ++ setup_pinned_timer(&priv->poll_timer, mips_ejtag_fdc_tty_timer, + (unsigned long)priv); + priv->poll_timer.expires = jiffies + FDC_TTY_POLL; + /* diff --git a/debian/patches/features/all/rt/drivers-tty-pl011-irq-disable-madness.patch b/debian/patches/features/all/rt/drivers-tty-pl011-irq-disable-madness.patch index bbf3226e7da8..fcdd9b471850 100644 --- a/debian/patches/features/all/rt/drivers-tty-pl011-irq-disable-madness.patch +++ b/debian/patches/features/all/rt/drivers-tty-pl011-irq-disable-madness.patch @@ -1,7 +1,7 @@ Subject: tty/serial/pl011: Make the locking work on RT From: Thomas Gleixner Date: Tue, 08 Jan 2013 21:36:51 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz 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. diff --git a/debian/patches/features/all/rt/drm-i915-Use-consistent-forcewake-auto-release-timeo.patch b/debian/patches/features/all/rt/drm-i915-Use-consistent-forcewake-auto-release-timeo.patch new file mode 100644 index 000000000000..0be98c1ac3ca --- /dev/null +++ b/debian/patches/features/all/rt/drm-i915-Use-consistent-forcewake-auto-release-timeo.patch @@ -0,0 +1,152 @@ +From: Tvrtko Ursulin +Date: Thu, 7 Apr 2016 17:04:32 +0100 +Subject: [PATCH] drm/i915: Use consistent forcewake auto-release timeout + across kernel configs +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz + +Upstream commit fde61b596b994195b9dd83feb325df95d99702ce + +Because it is based on jiffies, current implementation releases the +forcewake at any time between straight away and between 1ms and 10ms, +depending on the kernel configuration (CONFIG_HZ). + +This is probably not what has been desired, since the dynamics of keeping +parts of the GPU awake should not be correlated with this kernel +configuration parameter. + +Change the auto-release mechanism to use hrtimers and set the timeout to +1ms with a 1ms of slack. This should make the GPU power consistent +across kernel configs, and timer slack should enable some timer coalescing +where multiple force-wake domains exist, or with unrelated timers. + +For GlBench/T-Rex this decreases the number of forcewake releases from +~480 to ~300 per second, and for a heavy combined OGL/OCL test from +~670 to ~360 (HZ=1000 kernel). + +Even though this reduction can be attributed to the average release period +extending from 0-1ms to 1-2ms, as discussed above, it will make the +forcewake timeout consistent for different CONFIG_HZ values. + +Real life measurements with the above workload has shown that, with this +patch, both manage to auto-release the forcewake between 2-4 times per +10ms, even though the number of forcewake gets is dramatically different. + +T-Rex requests between 5-10 explicit gets and 5-10 implict gets in each +10ms period, while the OGL/OCL test requests 250 and 380 times in the same +period. + +The two data points together suggest that the nature of the forwake +accesses is bursty and that further changes and potential timeout +extensions, or moving the start of timeout from the first to the last +automatic forcewake grab, should be carefully measured for power and +performance effects. + +v2: + * Commit spelling. (Dave Gordon) + * More discussion on numbers in the commit. (Chris Wilson) + +Signed-off-by: Tvrtko Ursulin +Reviewed-by: Dave Gordon +Cc: Chris Wilson +Reviewed-by: Chris Wilson +Signed-off-by: Sebastian Andrzej Siewior +--- + drivers/gpu/drm/i915/i915_drv.h | 2 +- + drivers/gpu/drm/i915/intel_uncore.c | 25 ++++++++++++++++--------- + 2 files changed, 17 insertions(+), 10 deletions(-) + +--- a/drivers/gpu/drm/i915/i915_drv.h ++++ b/drivers/gpu/drm/i915/i915_drv.h +@@ -714,7 +714,7 @@ struct intel_uncore { + struct drm_i915_private *i915; + enum forcewake_domain_id id; + unsigned wake_count; +- struct timer_list timer; ++ struct hrtimer timer; + i915_reg_t reg_set; + u32 val_set; + u32 val_clear; +--- a/drivers/gpu/drm/i915/intel_uncore.c ++++ b/drivers/gpu/drm/i915/intel_uncore.c +@@ -60,7 +60,11 @@ fw_domain_reset(const struct intel_uncor + static inline void + fw_domain_arm_timer(struct intel_uncore_forcewake_domain *d) + { +- mod_timer_pinned(&d->timer, jiffies + 1); ++ d->wake_count++; ++ hrtimer_start_range_ns(&d->timer, ++ ktime_set(0, NSEC_PER_MSEC), ++ NSEC_PER_MSEC, ++ HRTIMER_MODE_REL); + } + + static inline void +@@ -224,9 +228,11 @@ static int __gen6_gt_wait_for_fifo(struc + return ret; + } + +-static void intel_uncore_fw_release_timer(unsigned long arg) ++static enum hrtimer_restart ++intel_uncore_fw_release_timer(struct hrtimer *timer) + { +- struct intel_uncore_forcewake_domain *domain = (void *)arg; ++ struct intel_uncore_forcewake_domain *domain = ++ container_of(timer, struct intel_uncore_forcewake_domain, timer); + unsigned long irqflags; + + assert_rpm_device_not_suspended(domain->i915); +@@ -240,6 +246,8 @@ static void intel_uncore_fw_release_time + 1 << domain->id); + + spin_unlock_irqrestore(&domain->i915->uncore.lock, irqflags); ++ ++ return HRTIMER_NORESTART; + } + + void intel_uncore_forcewake_reset(struct drm_device *dev, bool restore) +@@ -259,16 +267,16 @@ void intel_uncore_forcewake_reset(struct + active_domains = 0; + + for_each_fw_domain(domain, dev_priv, id) { +- if (del_timer_sync(&domain->timer) == 0) ++ if (hrtimer_cancel(&domain->timer) == 0) + continue; + +- intel_uncore_fw_release_timer((unsigned long)domain); ++ intel_uncore_fw_release_timer(&domain->timer); + } + + spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); + + for_each_fw_domain(domain, dev_priv, id) { +- if (timer_pending(&domain->timer)) ++ if (hrtimer_active(&domain->timer)) + active_domains |= (1 << id); + } + +@@ -491,7 +499,6 @@ static void __intel_uncore_forcewake_put + if (--domain->wake_count) + continue; + +- domain->wake_count++; + fw_domain_arm_timer(domain); + } + } +@@ -732,7 +739,6 @@ static inline void __force_wake_get(stru + continue; + } + +- domain->wake_count++; + fw_domain_arm_timer(domain); + } + +@@ -1150,7 +1156,8 @@ static void fw_domain_init(struct drm_i9 + d->i915 = dev_priv; + d->id = domain_id; + +- setup_timer(&d->timer, intel_uncore_fw_release_timer, (unsigned long)d); ++ hrtimer_init(&d->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); ++ d->timer.function = intel_uncore_fw_release_timer; + + dev_priv->uncore.fw_domains |= (1 << domain_id); + diff --git a/debian/patches/features/all/rt/drm-i915-drop-trace_i915_gem_ring_dispatch-onrt.patch b/debian/patches/features/all/rt/drm-i915-drop-trace_i915_gem_ring_dispatch-onrt.patch index 234d82d76158..6a570bae883e 100644 --- a/debian/patches/features/all/rt/drm-i915-drop-trace_i915_gem_ring_dispatch-onrt.patch +++ b/debian/patches/features/all/rt/drm-i915-drop-trace_i915_gem_ring_dispatch-onrt.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Thu, 25 Apr 2013 18:12:52 +0200 Subject: drm/i915: drop trace_i915_gem_ring_dispatch on rt -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz This tracepoint is responsible for: diff --git a/debian/patches/features/all/rt/drmi915_Use_local_lockunlock_irq()_in_intel_pipe_update_startend().patch b/debian/patches/features/all/rt/drmi915_Use_local_lockunlock_irq()_in_intel_pipe_update_startend().patch index c30c5405d93d..7cd378bfa344 100644 --- a/debian/patches/features/all/rt/drmi915_Use_local_lockunlock_irq()_in_intel_pipe_update_startend().patch +++ b/debian/patches/features/all/rt/drmi915_Use_local_lockunlock_irq()_in_intel_pipe_update_startend().patch @@ -1,7 +1,7 @@ Subject: drm,i915: Use local_lock/unlock_irq() in intel_pipe_update_start/end() From: Mike Galbraith Date: Sat, 27 Feb 2016 09:01:42 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz [ 8.014039] BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:918 diff --git a/debian/patches/features/all/rt/drmradeoni915_Use_preempt_disableenable_rt()_where_recommended.patch b/debian/patches/features/all/rt/drmradeoni915_Use_preempt_disableenable_rt()_where_recommended.patch index 37da3ff303df..712938c2f8c4 100644 --- a/debian/patches/features/all/rt/drmradeoni915_Use_preempt_disableenable_rt()_where_recommended.patch +++ b/debian/patches/features/all/rt/drmradeoni915_Use_preempt_disableenable_rt()_where_recommended.patch @@ -1,7 +1,7 @@ Subject: drm,radeon,i915: Use preempt_disable/enable_rt() where recommended From: Mike Galbraith Date: Sat, 27 Feb 2016 08:09:11 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz DRM folks identified the spots, so use them. diff --git a/debian/patches/features/all/rt/dump-stack-don-t-disable-preemption-during-trace.patch b/debian/patches/features/all/rt/dump-stack-don-t-disable-preemption-during-trace.patch index 2fcd4a941deb..a6cd92bc75fe 100644 --- a/debian/patches/features/all/rt/dump-stack-don-t-disable-preemption-during-trace.patch +++ b/debian/patches/features/all/rt/dump-stack-don-t-disable-preemption-during-trace.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Sun, 16 Aug 2015 14:27:50 +0200 Subject: dump stack: don't disable preemption during trace -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz I see here large latencies during a stack dump on x86. The preempt_disable() and get_cpu() should forbid moving the task to another diff --git a/debian/patches/features/all/rt/epoll-use-get-cpu-light.patch b/debian/patches/features/all/rt/epoll-use-get-cpu-light.patch index ecbc3ccf4765..3cd104c15856 100644 --- a/debian/patches/features/all/rt/epoll-use-get-cpu-light.patch +++ b/debian/patches/features/all/rt/epoll-use-get-cpu-light.patch @@ -1,7 +1,7 @@ Subject: fs/epoll: Do not disable preemption on RT From: Thomas Gleixner Date: Fri, 08 Jul 2011 16:35:35 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz 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 diff --git a/debian/patches/features/all/rt/fs-aio-simple-simple-work.patch b/debian/patches/features/all/rt/fs-aio-simple-simple-work.patch index 36557450decb..89c141ef7e1a 100644 --- a/debian/patches/features/all/rt/fs-aio-simple-simple-work.patch +++ b/debian/patches/features/all/rt/fs-aio-simple-simple-work.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Mon, 16 Feb 2015 18:49:10 +0100 Subject: fs/aio: simple simple work -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz |BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:768 |in_atomic(): 1, irqs_disabled(): 0, pid: 26, name: rcuos/2 diff --git a/debian/patches/features/all/rt/fs-block-rt-support.patch b/debian/patches/features/all/rt/fs-block-rt-support.patch index c68362b7144e..3992e675e2e5 100644 --- a/debian/patches/features/all/rt/fs-block-rt-support.patch +++ b/debian/patches/features/all/rt/fs-block-rt-support.patch @@ -1,7 +1,7 @@ Subject: block: Turn off warning which is bogus on RT From: Thomas Gleixner Date: Tue, 14 Jun 2011 17:05:09 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz On -RT the context is always with IRQs enabled. Ignore this warning on -RT. diff --git a/debian/patches/features/all/rt/fs-dcache-use-cpu-chill-in-trylock-loops.patch b/debian/patches/features/all/rt/fs-dcache-use-cpu-chill-in-trylock-loops.patch index cc072c7ddbb9..5276cd4c5317 100644 --- a/debian/patches/features/all/rt/fs-dcache-use-cpu-chill-in-trylock-loops.patch +++ b/debian/patches/features/all/rt/fs-dcache-use-cpu-chill-in-trylock-loops.patch @@ -1,7 +1,7 @@ Subject: fs: dcache: Use cpu_chill() in trylock loops From: Thomas Gleixner Date: Wed, 07 Mar 2012 21:00:34 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Retry loops on RT might loop forever when the modifying side was preempted. Use cpu_chill() instead of cpu_relax() to let the system diff --git a/debian/patches/features/all/rt/fs-jbd-replace-bh_state-lock.patch b/debian/patches/features/all/rt/fs-jbd-replace-bh_state-lock.patch index f5a0f9442214..6aaddb5be220 100644 --- a/debian/patches/features/all/rt/fs-jbd-replace-bh_state-lock.patch +++ b/debian/patches/features/all/rt/fs-jbd-replace-bh_state-lock.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Fri, 18 Mar 2011 10:11:25 +0100 Subject: fs: jbd/jbd2: Make state lock and journal head lock rt safe -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz bit_spin_locks break under RT. diff --git a/debian/patches/features/all/rt/fs-jbd2-pull-your-plug-when-waiting-for-space.patch b/debian/patches/features/all/rt/fs-jbd2-pull-your-plug-when-waiting-for-space.patch index 108ebaa22513..c8ff77dec3f5 100644 --- a/debian/patches/features/all/rt/fs-jbd2-pull-your-plug-when-waiting-for-space.patch +++ b/debian/patches/features/all/rt/fs-jbd2-pull-your-plug-when-waiting-for-space.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Mon, 17 Feb 2014 17:30:03 +0100 Subject: fs: jbd2: pull your plug when waiting for space -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Two cps in parallel managed to stall the the ext4 fs. It seems that journal code is either waiting for locks or sleeping waiting for diff --git a/debian/patches/features/all/rt/fs-namespace-preemption-fix.patch b/debian/patches/features/all/rt/fs-namespace-preemption-fix.patch index b06479b8f82b..6365f87ec7a2 100644 --- a/debian/patches/features/all/rt/fs-namespace-preemption-fix.patch +++ b/debian/patches/features/all/rt/fs-namespace-preemption-fix.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Sun, 19 Jul 2009 08:44:27 -0500 Subject: fs: namespace preemption fix -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz On RT we cannot loop with preemption disabled here as mnt_make_readonly() might have been preempted. We can safely enable diff --git a/debian/patches/features/all/rt/fs-ntfs-disable-interrupt-non-rt.patch b/debian/patches/features/all/rt/fs-ntfs-disable-interrupt-non-rt.patch index b075bb61592d..1ace080415c8 100644 --- a/debian/patches/features/all/rt/fs-ntfs-disable-interrupt-non-rt.patch +++ b/debian/patches/features/all/rt/fs-ntfs-disable-interrupt-non-rt.patch @@ -1,7 +1,7 @@ From: Mike Galbraith Date: Fri, 3 Jul 2009 08:44:12 -0500 Subject: fs: ntfs: disable interrupt only on !RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz On Sat, 2007-10-27 at 11:44 +0200, Ingo Molnar wrote: > * Nick Piggin wrote: diff --git a/debian/patches/features/all/rt/fs-replace-bh_uptodate_lock-for-rt.patch b/debian/patches/features/all/rt/fs-replace-bh_uptodate_lock-for-rt.patch index 606c70499b96..4ff851a2fb0e 100644 --- a/debian/patches/features/all/rt/fs-replace-bh_uptodate_lock-for-rt.patch +++ b/debian/patches/features/all/rt/fs-replace-bh_uptodate_lock-for-rt.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Fri, 18 Mar 2011 09:18:52 +0100 Subject: buffer_head: Replace bh_uptodate_lock for -rt -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Wrap the bit_spin_lock calls into a separate inline and add the RT replacements with a real spinlock. diff --git a/debian/patches/features/all/rt/ftrace-migrate-disable-tracing.patch b/debian/patches/features/all/rt/ftrace-migrate-disable-tracing.patch index a81e61a28f57..e824f617e8c8 100644 --- a/debian/patches/features/all/rt/ftrace-migrate-disable-tracing.patch +++ b/debian/patches/features/all/rt/ftrace-migrate-disable-tracing.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Sun, 17 Jul 2011 21:56:42 +0200 Subject: trace: Add migrate-disabled counter to tracing output -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Signed-off-by: Thomas Gleixner --- diff --git a/debian/patches/features/all/rt/futex-requeue-pi-fix.patch b/debian/patches/features/all/rt/futex-requeue-pi-fix.patch index f1dcfd9034c7..721e4325b5bf 100644 --- a/debian/patches/features/all/rt/futex-requeue-pi-fix.patch +++ b/debian/patches/features/all/rt/futex-requeue-pi-fix.patch @@ -1,7 +1,7 @@ From: Steven Rostedt Date: Tue, 14 Jul 2015 14:26:34 +0200 Subject: futex: Fix bug on when a requeued RT task times out -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Requeue with timeout causes a bug with PREEMPT_RT_FULL. diff --git a/debian/patches/features/all/rt/genirq-disable-irqpoll-on-rt.patch b/debian/patches/features/all/rt/genirq-disable-irqpoll-on-rt.patch index 608589fce619..ea6cae6890de 100644 --- a/debian/patches/features/all/rt/genirq-disable-irqpoll-on-rt.patch +++ b/debian/patches/features/all/rt/genirq-disable-irqpoll-on-rt.patch @@ -1,7 +1,7 @@ From: Ingo Molnar Date: Fri, 3 Jul 2009 08:29:57 -0500 Subject: genirq: Disable irqpoll on -rt -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Creates long latencies for no value diff --git a/debian/patches/features/all/rt/genirq-do-not-invoke-the-affinity-callback-via-a-wor.patch b/debian/patches/features/all/rt/genirq-do-not-invoke-the-affinity-callback-via-a-wor.patch index 51fe968fd365..95c96ec26a0c 100644 --- a/debian/patches/features/all/rt/genirq-do-not-invoke-the-affinity-callback-via-a-wor.patch +++ b/debian/patches/features/all/rt/genirq-do-not-invoke-the-affinity-callback-via-a-wor.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Wed, 21 Aug 2013 17:48:46 +0200 Subject: genirq: Do not invoke the affinity callback via a workqueue on RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Joe Korty reported, that __irq_set_affinity_locked() schedules a workqueue while holding a rawlock which results in a might_sleep() diff --git a/debian/patches/features/all/rt/genirq-force-threading.patch b/debian/patches/features/all/rt/genirq-force-threading.patch index 9cbdd105cc31..2b670a84677c 100644 --- a/debian/patches/features/all/rt/genirq-force-threading.patch +++ b/debian/patches/features/all/rt/genirq-force-threading.patch @@ -1,7 +1,7 @@ Subject: genirq: Force interrupt thread on RT From: Thomas Gleixner Date: Sun, 03 Apr 2011 11:57:29 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Force threaded_irqs and optimize the code (force_irqthreads) in regard to this. diff --git a/debian/patches/features/all/rt/genirq-update-irq_set_irqchip_state-documentation.patch b/debian/patches/features/all/rt/genirq-update-irq_set_irqchip_state-documentation.patch index a225dea80483..202f1d33efbc 100644 --- a/debian/patches/features/all/rt/genirq-update-irq_set_irqchip_state-documentation.patch +++ b/debian/patches/features/all/rt/genirq-update-irq_set_irqchip_state-documentation.patch @@ -1,7 +1,7 @@ From: Josh Cartwright Date: Thu, 11 Feb 2016 11:54:00 -0600 Subject: genirq: update irq_set_irqchip_state documentation -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz On -rt kernels, the use of migrate_disable()/migrate_enable() is sufficient to guarantee a task isn't moved to another CPU. Update the diff --git a/debian/patches/features/all/rt/hlist-Add-hlist_is_singular_node-helper.patch b/debian/patches/features/all/rt/hlist-Add-hlist_is_singular_node-helper.patch new file mode 100644 index 000000000000..34c84c21199b --- /dev/null +++ b/debian/patches/features/all/rt/hlist-Add-hlist_is_singular_node-helper.patch @@ -0,0 +1,39 @@ +From: Thomas Gleixner +Date: Mon, 4 Jul 2016 09:50:27 +0000 +Subject: [PATCH 11/22] hlist: Add hlist_is_singular_node() helper +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz + +Required to figure out whether the entry is the only one in the hlist. + +Signed-off-by: Thomas Gleixner +Reviewed-by: Frederic Weisbecker +Cc: Peter Zijlstra +Cc: Chris Mason +Cc: Eric Dumazet +Cc: rt@linutronix.de +Cc: "Paul E. McKenney" +Cc: Arjan van de Ven +Signed-off-by: Sebastian Andrzej Siewior +--- + include/linux/list.h | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/include/linux/list.h ++++ b/include/linux/list.h +@@ -679,6 +679,16 @@ static inline bool hlist_fake(struct hli + } + + /* ++ * Check whether the node is the only node of the head without ++ * accessing head. ++ */ ++static inline bool hlist_is_singular_node(struct hlist_node *n, ++ struct hlist_head *h) ++{ ++ return !n->next && n->pprev == &h->first; ++} ++ ++/* + * Move a list from one list head to another. Fixup the pprev + * reference of the first entry if it exists. + */ diff --git a/debian/patches/features/all/rt/hotplug-Use-set_cpus_allowed_ptr-in-sync_unplug_thre.patch b/debian/patches/features/all/rt/hotplug-Use-set_cpus_allowed_ptr-in-sync_unplug_thre.patch index f021e1a80b8b..ad20d0ca002c 100644 --- a/debian/patches/features/all/rt/hotplug-Use-set_cpus_allowed_ptr-in-sync_unplug_thre.patch +++ b/debian/patches/features/all/rt/hotplug-Use-set_cpus_allowed_ptr-in-sync_unplug_thre.patch @@ -1,7 +1,7 @@ From: Mike Galbraith Date: Tue, 24 Mar 2015 08:14:49 +0100 Subject: hotplug: Use set_cpus_allowed_ptr() in sync_unplug_thread() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz do_set_cpus_allowed() is not safe vs ->sched_class change. diff --git a/debian/patches/features/all/rt/hotplug-light-get-online-cpus.patch b/debian/patches/features/all/rt/hotplug-light-get-online-cpus.patch index 4b63f2518907..9e36355cd70b 100644 --- a/debian/patches/features/all/rt/hotplug-light-get-online-cpus.patch +++ b/debian/patches/features/all/rt/hotplug-light-get-online-cpus.patch @@ -1,7 +1,7 @@ Subject: hotplug: Lightweight get online cpus From: Thomas Gleixner Date: Wed, 15 Jun 2011 12:36:06 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz get_online_cpus() is a heavy weight function which involves a global mutex. migrate_disable() wants a simpler construct which prevents only diff --git a/debian/patches/features/all/rt/hotplug-sync_unplug-no-27-5cn-27-in-task-name.patch b/debian/patches/features/all/rt/hotplug-sync_unplug-no-27-5cn-27-in-task-name.patch index 1b0f802f57ae..08b4811b4314 100644 --- a/debian/patches/features/all/rt/hotplug-sync_unplug-no-27-5cn-27-in-task-name.patch +++ b/debian/patches/features/all/rt/hotplug-sync_unplug-no-27-5cn-27-in-task-name.patch @@ -1,7 +1,7 @@ Subject: hotplug: sync_unplug: No "\n" in task name From: Yong Zhang Date: Sun, 16 Oct 2011 18:56:43 +0800 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Otherwise the output will look a little odd. diff --git a/debian/patches/features/all/rt/hotplug-use-migrate-disable.patch b/debian/patches/features/all/rt/hotplug-use-migrate-disable.patch index 90e621caaeb7..dab285666942 100644 --- a/debian/patches/features/all/rt/hotplug-use-migrate-disable.patch +++ b/debian/patches/features/all/rt/hotplug-use-migrate-disable.patch @@ -1,7 +1,7 @@ Subject: hotplug: Use migrate disable on unplug From: Thomas Gleixner Date: Sun, 17 Jul 2011 19:35:29 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Migration needs to be disabled accross the unplug handling to make sure that the unplug thread is off the unplugged cpu. diff --git a/debian/patches/features/all/rt/hrtimer-Move-schedule_work-call-to-helper-thread.patch b/debian/patches/features/all/rt/hrtimer-Move-schedule_work-call-to-helper-thread.patch index 92858ef2e548..af3060865934 100644 --- a/debian/patches/features/all/rt/hrtimer-Move-schedule_work-call-to-helper-thread.patch +++ b/debian/patches/features/all/rt/hrtimer-Move-schedule_work-call-to-helper-thread.patch @@ -1,7 +1,7 @@ From: Yang Shi Date: Mon, 16 Sep 2013 14:09:19 -0700 Subject: hrtimer: Move schedule_work call to helper thread -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz When run ltp leapsec_timer test, the following call trace is caught: diff --git a/debian/patches/features/all/rt/hrtimer-enfore-64byte-alignment.patch b/debian/patches/features/all/rt/hrtimer-enfore-64byte-alignment.patch index 2c90db0adb91..a70f5e4a18e5 100644 --- a/debian/patches/features/all/rt/hrtimer-enfore-64byte-alignment.patch +++ b/debian/patches/features/all/rt/hrtimer-enfore-64byte-alignment.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Wed, 23 Dec 2015 20:57:41 +0100 Subject: hrtimer: enfore 64byte alignment -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz The patch "hrtimer: Fixup hrtimer callback changes for preempt-rt" adds a list_head expired to struct hrtimer_clock_base and with it we run into diff --git a/debian/patches/features/all/rt/hrtimer-fixup-hrtimer-callback-changes-for-preempt-r.patch b/debian/patches/features/all/rt/hrtimer-fixup-hrtimer-callback-changes-for-preempt-r.patch index 3fcc676e7b84..3968fcab75ec 100644 --- a/debian/patches/features/all/rt/hrtimer-fixup-hrtimer-callback-changes-for-preempt-r.patch +++ b/debian/patches/features/all/rt/hrtimer-fixup-hrtimer-callback-changes-for-preempt-r.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Fri, 3 Jul 2009 08:44:31 -0500 Subject: hrtimer: Fixup hrtimer callback changes for preempt-rt -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz In preempt-rt we can not call the callbacks which take sleeping locks from the timer interrupt context. @@ -316,7 +316,7 @@ Signed-off-by: Ingo Molnar /** --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c -@@ -1213,6 +1213,7 @@ void tick_setup_sched_timer(void) +@@ -1194,6 +1194,7 @@ void tick_setup_sched_timer(void) * Emulate tick processing via per-CPU hrtimers: */ hrtimer_init(&ts->sched_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); diff --git a/debian/patches/features/all/rt/hrtimers-prepare-full-preemption.patch b/debian/patches/features/all/rt/hrtimers-prepare-full-preemption.patch index 85d153b508d4..4696584a38c3 100644 --- a/debian/patches/features/all/rt/hrtimers-prepare-full-preemption.patch +++ b/debian/patches/features/all/rt/hrtimers-prepare-full-preemption.patch @@ -1,7 +1,7 @@ From: Ingo Molnar Date: Fri, 3 Jul 2009 08:29:34 -0500 Subject: hrtimers: Prepare full preemption -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Make cancellation of a running callback in softirq context safe against preemption. diff --git a/debian/patches/features/all/rt/hwlat-detector-Don-t-ignore-threshold-module-paramet.patch b/debian/patches/features/all/rt/hwlat-detector-Don-t-ignore-threshold-module-paramet.patch index 7c324ce0f916..f4c16b7ddc94 100644 --- a/debian/patches/features/all/rt/hwlat-detector-Don-t-ignore-threshold-module-paramet.patch +++ b/debian/patches/features/all/rt/hwlat-detector-Don-t-ignore-threshold-module-paramet.patch @@ -1,7 +1,7 @@ From: Mike Galbraith Date: Fri, 30 Aug 2013 07:57:25 +0200 Subject: hwlat-detector: Don't ignore threshold module parameter -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz If the user specified a threshold at module load time, use it. diff --git a/debian/patches/features/all/rt/hwlat-detector-Update-hwlat_detector-to-add-outer-lo.patch b/debian/patches/features/all/rt/hwlat-detector-Update-hwlat_detector-to-add-outer-lo.patch index d779ab00632e..aca35439c858 100644 --- a/debian/patches/features/all/rt/hwlat-detector-Update-hwlat_detector-to-add-outer-lo.patch +++ b/debian/patches/features/all/rt/hwlat-detector-Update-hwlat_detector-to-add-outer-lo.patch @@ -1,7 +1,7 @@ From: Steven Rostedt Date: Mon, 19 Aug 2013 17:33:25 -0400 Subject: hwlat-detector: Update hwlat_detector to add outer loop detection -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz The hwlat_detector reads two timestamps in a row, then reports any gap between those calls. The problem is, it misses everything between diff --git a/debian/patches/features/all/rt/hwlat-detector-Use-thread-instead-of-stop-machine.patch b/debian/patches/features/all/rt/hwlat-detector-Use-thread-instead-of-stop-machine.patch index 12ca0224b75f..929425af1871 100644 --- a/debian/patches/features/all/rt/hwlat-detector-Use-thread-instead-of-stop-machine.patch +++ b/debian/patches/features/all/rt/hwlat-detector-Use-thread-instead-of-stop-machine.patch @@ -1,7 +1,7 @@ From: Steven Rostedt Date: Mon, 19 Aug 2013 17:33:27 -0400 Subject: hwlat-detector: Use thread instead of stop machine -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz There's no reason to use stop machine to search for hardware latency. Simply disabling interrupts while running the loop will do enough to diff --git a/debian/patches/features/all/rt/hwlat-detector-Use-trace_clock_local-if-available.patch b/debian/patches/features/all/rt/hwlat-detector-Use-trace_clock_local-if-available.patch index 469027822dfa..ddaf53a86bad 100644 --- a/debian/patches/features/all/rt/hwlat-detector-Use-trace_clock_local-if-available.patch +++ b/debian/patches/features/all/rt/hwlat-detector-Use-trace_clock_local-if-available.patch @@ -1,7 +1,7 @@ From: Steven Rostedt Date: Mon, 19 Aug 2013 17:33:26 -0400 Subject: hwlat-detector: Use trace_clock_local if available -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz As ktime_get() calls into the timing code which does a read_seq(), it may be affected by other CPUS that touch that lock. To remove this diff --git a/debian/patches/features/all/rt/hwlatdetect.patch b/debian/patches/features/all/rt/hwlatdetect.patch index 914bf818e0d9..612ad7fb0d5b 100644 --- a/debian/patches/features/all/rt/hwlatdetect.patch +++ b/debian/patches/features/all/rt/hwlatdetect.patch @@ -1,7 +1,7 @@ Subject: hwlatdetect.patch From: Carsten Emde Date: Tue, 19 Jul 2011 13:53:12 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Jon Masters developed this wonderful SMI detector. For details please consult Documentation/hwlat_detector.txt. It could be ported to Linux diff --git a/debian/patches/features/all/rt/i2c-omap-drop-the-lock-hard-irq-context.patch b/debian/patches/features/all/rt/i2c-omap-drop-the-lock-hard-irq-context.patch index 0bedb07cea5e..e29a6902c00e 100644 --- a/debian/patches/features/all/rt/i2c-omap-drop-the-lock-hard-irq-context.patch +++ b/debian/patches/features/all/rt/i2c-omap-drop-the-lock-hard-irq-context.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Thu, 21 Mar 2013 11:35:49 +0100 Subject: i2c/omap: drop the lock hard irq context -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz The lock is taken while reading two registers. On RT the first lock is taken in hard irq where it might sleep and in the threaded irq. diff --git a/debian/patches/features/all/rt/i915-bogus-warning-from-i915-when-running-on-PREEMPT.patch b/debian/patches/features/all/rt/i915-bogus-warning-from-i915-when-running-on-PREEMPT.patch index c426470d94c1..01d2239f596d 100644 --- a/debian/patches/features/all/rt/i915-bogus-warning-from-i915-when-running-on-PREEMPT.patch +++ b/debian/patches/features/all/rt/i915-bogus-warning-from-i915-when-running-on-PREEMPT.patch @@ -1,7 +1,7 @@ From: Clark Williams Date: Tue, 26 May 2015 10:43:43 -0500 Subject: i915: bogus warning from i915 when running on PREEMPT_RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz The i915 driver has a 'WARN_ON(!in_interrupt())' in the display handler, which whines constanly on the RT kernel (since the interrupt @@ -19,7 +19,7 @@ Signed-off-by: Sebastian Andrzej Siewior --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c -@@ -11476,7 +11476,7 @@ void intel_check_page_flip(struct drm_de +@@ -11496,7 +11496,7 @@ void intel_check_page_flip(struct drm_de struct intel_crtc *intel_crtc = to_intel_crtc(crtc); struct intel_unpin_work *work; diff --git a/debian/patches/features/all/rt/i915_compile_fix.patch b/debian/patches/features/all/rt/i915_compile_fix.patch index 8c2db21f0369..efd77fdc6e26 100644 --- a/debian/patches/features/all/rt/i915_compile_fix.patch +++ b/debian/patches/features/all/rt/i915_compile_fix.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Tue, 14 Jul 2015 14:26:34 +0200 Subject: gpu/i915: don't open code these things -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz The opencode part is gone in 1f83fee0 ("drm/i915: clear up wedged transitions") the owner check is still there. @@ -17,8 +17,8 @@ Signed-off-by: Sebastian Andrzej Siewior if (!mutex_is_locked(mutex)) return false; --#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_MUTEXES) -+#if (defined(CONFIG_SMP) || defined(CONFIG_DEBUG_MUTEXES)) && !defined(CONFIG_PREEMPT_RT_BASE) +-#if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_MUTEX_SPIN_ON_OWNER) ++#if (defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_MUTEX_SPIN_ON_OWNER)) && !defined(CONFIG_PREEMPT_RT_BASE) return mutex->owner == task; #else /* Since UP may be pre-empted, we cannot assume that we own the lock */ diff --git a/debian/patches/features/all/rt/ide-use-nort-local-irq-variants.patch b/debian/patches/features/all/rt/ide-use-nort-local-irq-variants.patch index f63cd6ecbadf..a6b994326338 100644 --- a/debian/patches/features/all/rt/ide-use-nort-local-irq-variants.patch +++ b/debian/patches/features/all/rt/ide-use-nort-local-irq-variants.patch @@ -1,7 +1,7 @@ From: Ingo Molnar Date: Fri, 3 Jul 2009 08:30:16 -0500 Subject: ide: Do not disable interrupts for PREEMPT-RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Use the local_irq_*_nort variants. diff --git a/debian/patches/features/all/rt/idr-use-local-lock-for-protection.patch b/debian/patches/features/all/rt/idr-use-local-lock-for-protection.patch index 66cd15cf33fe..f03d93e6ae2b 100644 --- a/debian/patches/features/all/rt/idr-use-local-lock-for-protection.patch +++ b/debian/patches/features/all/rt/idr-use-local-lock-for-protection.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Tue, 14 Jul 2015 14:26:34 +0200 Subject: idr: Use local lock instead of preempt enable/disable -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz We need to protect the per cpu variable and prevent migration. diff --git a/debian/patches/features/all/rt/infiniband-mellanox-ib-use-nort-irq.patch b/debian/patches/features/all/rt/infiniband-mellanox-ib-use-nort-irq.patch index 04c38f398e64..38a8f99e9225 100644 --- a/debian/patches/features/all/rt/infiniband-mellanox-ib-use-nort-irq.patch +++ b/debian/patches/features/all/rt/infiniband-mellanox-ib-use-nort-irq.patch @@ -1,7 +1,7 @@ From: Sven-Thorsten Dietrich Date: Fri, 3 Jul 2009 08:30:35 -0500 Subject: infiniband: Mellanox IB driver patch use _nort() primitives -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Fixes in_atomic stack-dump, when Mellanox module is loaded into the RT Kernel. diff --git a/debian/patches/features/all/rt/infiniband-ulp-ipoib-remove-pkey_mutex.patch b/debian/patches/features/all/rt/infiniband-ulp-ipoib-remove-pkey_mutex.patch index 58c2a7a406b7..257f856127d4 100644 --- a/debian/patches/features/all/rt/infiniband-ulp-ipoib-remove-pkey_mutex.patch +++ b/debian/patches/features/all/rt/infiniband-ulp-ipoib-remove-pkey_mutex.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Wed, 11 May 2016 11:52:23 +0200 Subject: infiniband/ulp/ipoib: remove pkey_mutex -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz The last user of pkey_mutex was removed in db84f8803759 ("IB/ipoib: Use P_Key change event instead of P_Key polling mechanism") but the lock diff --git a/debian/patches/features/all/rt/inpt-gameport-use-local-irq-nort.patch b/debian/patches/features/all/rt/inpt-gameport-use-local-irq-nort.patch index c9b745d1d717..fd917ef1aacf 100644 --- a/debian/patches/features/all/rt/inpt-gameport-use-local-irq-nort.patch +++ b/debian/patches/features/all/rt/inpt-gameport-use-local-irq-nort.patch @@ -1,7 +1,7 @@ From: Ingo Molnar Date: Fri, 3 Jul 2009 08:30:16 -0500 Subject: input: gameport: Do not disable interrupts on PREEMPT_RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Use the _nort() primitives. diff --git a/debian/patches/features/all/rt/introduce_migrate_disable_cpu_light.patch b/debian/patches/features/all/rt/introduce_migrate_disable_cpu_light.patch index 91610b201b82..5f2c91fc2ada 100644 --- a/debian/patches/features/all/rt/introduce_migrate_disable_cpu_light.patch +++ b/debian/patches/features/all/rt/introduce_migrate_disable_cpu_light.patch @@ -1,7 +1,7 @@ Subject: Intrduce migrate_disable() + cpu_light() From: Thomas Gleixner Date: Fri, 17 Jun 2011 15:42:38 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Introduce migrate_disable(). The task can't be pushed to another CPU but can be preempted. diff --git a/debian/patches/features/all/rt/iommu-amd--Use-WARN_ON_NORT.patch b/debian/patches/features/all/rt/iommu-amd--Use-WARN_ON_NORT.patch index 35dcbf2f4e16..5e3b415b2012 100644 --- a/debian/patches/features/all/rt/iommu-amd--Use-WARN_ON_NORT.patch +++ b/debian/patches/features/all/rt/iommu-amd--Use-WARN_ON_NORT.patch @@ -1,7 +1,7 @@ Subject: iommu/amd: Use WARN_ON_NORT in __attach_device() From: Thomas Gleixner Date: Sat, 27 Feb 2016 10:22:23 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz RT does not disable interrupts here, but the protection is still correct. Fixup the WARN_ON so it won't yell on RT. diff --git a/debian/patches/features/all/rt/ipc-msg-Implement-lockless-pipelined-wakeups.patch b/debian/patches/features/all/rt/ipc-msg-Implement-lockless-pipelined-wakeups.patch index b9fdddc0d1fd..a35f6f03741d 100644 --- a/debian/patches/features/all/rt/ipc-msg-Implement-lockless-pipelined-wakeups.patch +++ b/debian/patches/features/all/rt/ipc-msg-Implement-lockless-pipelined-wakeups.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Fri, 30 Oct 2015 11:59:07 +0100 Subject: ipc/msg: Implement lockless pipelined wakeups -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz This patch moves the wakeup_process() invocation so it is not done under the perm->lock by making use of a lockless wake_q. With this change, the diff --git a/debian/patches/features/all/rt/ipc-sem-rework-semaphore-wakeups.patch b/debian/patches/features/all/rt/ipc-sem-rework-semaphore-wakeups.patch index 6fe79037957d..b21074605077 100644 --- a/debian/patches/features/all/rt/ipc-sem-rework-semaphore-wakeups.patch +++ b/debian/patches/features/all/rt/ipc-sem-rework-semaphore-wakeups.patch @@ -1,7 +1,7 @@ Subject: ipc/sem: Rework semaphore wakeups From: Peter Zijlstra Date: Wed, 14 Sep 2011 11:57:04 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Current sysv sems have a weird ass wakeup scheme that involves keeping preemption disabled over a potential O(n^2) loop and busy waiting on diff --git a/debian/patches/features/all/rt/irq-allow-disabling-of-softirq-processing-in-irq-thread-context.patch b/debian/patches/features/all/rt/irq-allow-disabling-of-softirq-processing-in-irq-thread-context.patch index a5dede788b14..06a0f06e7b8f 100644 --- a/debian/patches/features/all/rt/irq-allow-disabling-of-softirq-processing-in-irq-thread-context.patch +++ b/debian/patches/features/all/rt/irq-allow-disabling-of-softirq-processing-in-irq-thread-context.patch @@ -1,7 +1,7 @@ Subject: genirq: Allow disabling of softirq processing in irq thread context From: Thomas Gleixner Date: Tue, 31 Jan 2012 13:01:27 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz 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 diff --git a/debian/patches/features/all/rt/irqwork-Move-irq-safe-work-to-irq-context.patch b/debian/patches/features/all/rt/irqwork-Move-irq-safe-work-to-irq-context.patch index efc60eb1680b..67e5269a66c7 100644 --- a/debian/patches/features/all/rt/irqwork-Move-irq-safe-work-to-irq-context.patch +++ b/debian/patches/features/all/rt/irqwork-Move-irq-safe-work-to-irq-context.patch @@ -1,7 +1,7 @@ Subject: irqwork: Move irq safe work to irq context From: Thomas Gleixner Date: Sun, 15 Nov 2015 18:40:17 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz On architectures where arch_irq_work_has_interrupt() returns false, we end up running the irq safe work from the softirq context. That @@ -56,7 +56,7 @@ Cc: stable-rt@vger.kernel.org * Synchronize against the irq_work @entry, ensures the entry is not --- a/kernel/time/timer.c +++ b/kernel/time/timer.c -@@ -1484,7 +1484,7 @@ void update_process_times(int user_tick) +@@ -1642,7 +1642,7 @@ void update_process_times(int user_tick) scheduler_tick(); run_local_timers(); rcu_check_callbacks(user_tick); @@ -65,14 +65,14 @@ Cc: stable-rt@vger.kernel.org if (in_irq()) irq_work_tick(); #endif -@@ -1498,9 +1498,7 @@ static void run_timer_softirq(struct sof +@@ -1682,9 +1682,7 @@ static void run_timer_softirq(struct sof { - struct tvec_base *base = this_cpu_ptr(&tvec_bases); + struct timer_base *base = this_cpu_ptr(&timer_bases[BASE_STD]); -#if defined(CONFIG_IRQ_WORK) && defined(CONFIG_PREEMPT_RT_FULL) - irq_work_tick(); -#endif + irq_work_tick_soft(); - if (time_after_eq(jiffies, base->timer_jiffies)) - __run_timers(base); + __run_timers(base); + if (IS_ENABLED(CONFIG_NO_HZ_COMMON) && base->nohz_active) diff --git a/debian/patches/features/all/rt/irqwork-push_most_work_into_softirq_context.patch b/debian/patches/features/all/rt/irqwork-push_most_work_into_softirq_context.patch index 47c131aa3f77..5492c7a11cd4 100644 --- a/debian/patches/features/all/rt/irqwork-push_most_work_into_softirq_context.patch +++ b/debian/patches/features/all/rt/irqwork-push_most_work_into_softirq_context.patch @@ -1,7 +1,7 @@ Subject: irqwork: push most work into softirq context From: Sebastian Andrzej Siewior Date: Tue, 23 Jun 2015 15:32:51 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz 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. @@ -164,7 +164,7 @@ Signed-off-by: Sebastian Andrzej Siewior /* --- a/kernel/time/timer.c +++ b/kernel/time/timer.c -@@ -1484,7 +1484,7 @@ void update_process_times(int user_tick) +@@ -1642,7 +1642,7 @@ void update_process_times(int user_tick) scheduler_tick(); run_local_timers(); rcu_check_callbacks(user_tick); @@ -173,14 +173,14 @@ Signed-off-by: Sebastian Andrzej Siewior if (in_irq()) irq_work_tick(); #endif -@@ -1498,6 +1498,10 @@ static void run_timer_softirq(struct sof +@@ -1682,6 +1682,10 @@ static void run_timer_softirq(struct sof { - struct tvec_base *base = this_cpu_ptr(&tvec_bases); + struct timer_base *base = this_cpu_ptr(&timer_bases[BASE_STD]); +#if defined(CONFIG_IRQ_WORK) && defined(CONFIG_PREEMPT_RT_FULL) + irq_work_tick(); +#endif + - if (time_after_eq(jiffies, base->timer_jiffies)) - __run_timers(base); - } + __run_timers(base); + if (IS_ENABLED(CONFIG_NO_HZ_COMMON) && base->nohz_active) + __run_timers(this_cpu_ptr(&timer_bases[BASE_DEF])); diff --git a/debian/patches/features/all/rt/jump-label-rt.patch b/debian/patches/features/all/rt/jump-label-rt.patch index bf538a91fdad..d6d89df40d1f 100644 --- a/debian/patches/features/all/rt/jump-label-rt.patch +++ b/debian/patches/features/all/rt/jump-label-rt.patch @@ -1,7 +1,7 @@ Subject: jump-label: disable if stop_machine() is used From: Thomas Gleixner Date: Wed, 08 Jul 2015 17:14:48 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Some architectures are using stop_machine() while switching the opcode which leads to latency spikes. diff --git a/debian/patches/features/all/rt/kconfig-disable-a-few-options-rt.patch b/debian/patches/features/all/rt/kconfig-disable-a-few-options-rt.patch index 010273ca5bc6..de6c835b2fc1 100644 --- a/debian/patches/features/all/rt/kconfig-disable-a-few-options-rt.patch +++ b/debian/patches/features/all/rt/kconfig-disable-a-few-options-rt.patch @@ -1,7 +1,7 @@ Subject: kconfig: Disable config options which are not RT compatible From: Thomas Gleixner Date: Sun, 24 Jul 2011 12:11:43 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Disable stuff which is known to have issues on RT diff --git a/debian/patches/features/all/rt/kconfig-preempt-rt-full.patch b/debian/patches/features/all/rt/kconfig-preempt-rt-full.patch index 02d763cd42ce..ba942776e8e6 100644 --- a/debian/patches/features/all/rt/kconfig-preempt-rt-full.patch +++ b/debian/patches/features/all/rt/kconfig-preempt-rt-full.patch @@ -1,7 +1,7 @@ Subject: kconfig: Add PREEMPT_RT_FULL From: Thomas Gleixner Date: Wed, 29 Jun 2011 14:58:57 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Introduce the final symbol for PREEMPT_RT_FULL. diff --git a/debian/patches/features/all/rt/kernel-SRCU-provide-a-static-initializer.patch b/debian/patches/features/all/rt/kernel-SRCU-provide-a-static-initializer.patch index aa53c1935e5a..02ed09d8225e 100644 --- a/debian/patches/features/all/rt/kernel-SRCU-provide-a-static-initializer.patch +++ b/debian/patches/features/all/rt/kernel-SRCU-provide-a-static-initializer.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Tue, 19 Mar 2013 14:44:30 +0100 Subject: kernel/SRCU: provide a static initializer -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz There are macros for static initializer for the three out of four possible notifier types, that are: diff --git a/debian/patches/features/all/rt/kernel-cpu-fix-cpu-down-problem-if-kthread-s-cpu-is-.patch b/debian/patches/features/all/rt/kernel-cpu-fix-cpu-down-problem-if-kthread-s-cpu-is-.patch index d64f92a1cae6..17b5b930739d 100644 --- a/debian/patches/features/all/rt/kernel-cpu-fix-cpu-down-problem-if-kthread-s-cpu-is-.patch +++ b/debian/patches/features/all/rt/kernel-cpu-fix-cpu-down-problem-if-kthread-s-cpu-is-.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Fri, 7 Jun 2013 22:37:06 +0200 Subject: kernel/cpu: fix cpu down problem if kthread's cpu is going down -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz If kthread is pinned to CPUx and CPUx is going down then we get into trouble: diff --git a/debian/patches/features/all/rt/kernel-hotplug-restore-original-cpu-mask-oncpu-down.patch b/debian/patches/features/all/rt/kernel-hotplug-restore-original-cpu-mask-oncpu-down.patch index 2a84cb1bb17e..6e1ef39a697b 100644 --- a/debian/patches/features/all/rt/kernel-hotplug-restore-original-cpu-mask-oncpu-down.patch +++ b/debian/patches/features/all/rt/kernel-hotplug-restore-original-cpu-mask-oncpu-down.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Fri, 14 Jun 2013 17:16:35 +0200 Subject: kernel/hotplug: restore original cpu mask oncpu/down -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz If a task which is allowed to run only on CPU X puts CPU Y down then it will be allowed on all CPUs but the on CPU Y after it comes back from diff --git a/debian/patches/features/all/rt/kernel-migrate_disable-do-fastpath-in-atomic-irqs-of.patch b/debian/patches/features/all/rt/kernel-migrate_disable-do-fastpath-in-atomic-irqs-of.patch index 9692883759b6..4f9eda8624fb 100644 --- a/debian/patches/features/all/rt/kernel-migrate_disable-do-fastpath-in-atomic-irqs-of.patch +++ b/debian/patches/features/all/rt/kernel-migrate_disable-do-fastpath-in-atomic-irqs-of.patch @@ -2,7 +2,7 @@ From: Sebastian Andrzej Siewior Date: Tue, 9 Feb 2016 18:18:01 +0100 Subject: kernel: migrate_disable() do fastpath in atomic & irqs-off -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz With interrupts off it makes no sense to do the long path since we can't leave the CPU anyway. Also we might end up in a recursion with lockdep. diff --git a/debian/patches/features/all/rt/kernel-perf-mark-perf_cpu_context-s-timer-as-irqsafe.patch b/debian/patches/features/all/rt/kernel-perf-mark-perf_cpu_context-s-timer-as-irqsafe.patch index 9c57cc53d6a7..3b42bcf1d93d 100644 --- a/debian/patches/features/all/rt/kernel-perf-mark-perf_cpu_context-s-timer-as-irqsafe.patch +++ b/debian/patches/features/all/rt/kernel-perf-mark-perf_cpu_context-s-timer-as-irqsafe.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Thu, 4 Feb 2016 16:38:10 +0100 Subject: [PATCH] kernel/perf: mark perf_cpu_context's timer as irqsafe -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Otherwise we get a WARN_ON() backtrace and some events are reported as "not counted". diff --git a/debian/patches/features/all/rt/kernel-printk-Don-t-try-to-print-from-IRQ-NMI-region.patch b/debian/patches/features/all/rt/kernel-printk-Don-t-try-to-print-from-IRQ-NMI-region.patch index 649ab35364b5..1a0387bdf5ce 100644 --- a/debian/patches/features/all/rt/kernel-printk-Don-t-try-to-print-from-IRQ-NMI-region.patch +++ b/debian/patches/features/all/rt/kernel-printk-Don-t-try-to-print-from-IRQ-NMI-region.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Thu, 19 May 2016 17:45:27 +0200 Subject: [PATCH] kernel/printk: Don't try to print from IRQ/NMI region -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz 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 diff --git a/debian/patches/features/all/rt/kernel-rtmutex-only-warn-once-on-a-try-lock-from-bad.patch b/debian/patches/features/all/rt/kernel-rtmutex-only-warn-once-on-a-try-lock-from-bad.patch index 8a12b4c1c251..86e917343628 100644 --- a/debian/patches/features/all/rt/kernel-rtmutex-only-warn-once-on-a-try-lock-from-bad.patch +++ b/debian/patches/features/all/rt/kernel-rtmutex-only-warn-once-on-a-try-lock-from-bad.patch @@ -2,7 +2,7 @@ From: Sebastian Andrzej Siewior Date: Thu, 19 May 2016 17:12:34 +0200 Subject: [PATCH] kernel/rtmutex: only warn once on a try lock from bad context -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz One warning should be enough to get one motivated to fix this. It is possible that this happens more than once and so starts flooding the diff --git a/debian/patches/features/all/rt/kernel-softirq-unlock-with-irqs-on.patch b/debian/patches/features/all/rt/kernel-softirq-unlock-with-irqs-on.patch index 360acdc7f4fd..8017f6e8e27f 100644 --- a/debian/patches/features/all/rt/kernel-softirq-unlock-with-irqs-on.patch +++ b/debian/patches/features/all/rt/kernel-softirq-unlock-with-irqs-on.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Tue, 9 Feb 2016 18:17:18 +0100 Subject: kernel: softirq: unlock with irqs on -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz We unlock the lock while the interrupts are off. This isn't a problem now but will get because the migrate_disable() + enable are not diff --git a/debian/patches/features/all/rt/kgb-serial-hackaround.patch b/debian/patches/features/all/rt/kgb-serial-hackaround.patch index 2a6b97dec4f5..6dd5dffdff17 100644 --- a/debian/patches/features/all/rt/kgb-serial-hackaround.patch +++ b/debian/patches/features/all/rt/kgb-serial-hackaround.patch @@ -1,7 +1,7 @@ From: Jason Wessel Date: Thu, 28 Jul 2011 12:42:23 -0500 Subject: kgdb/serial: Short term workaround -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz On 07/27/2011 04:37 PM, Thomas Gleixner wrote: > - KGDB (not yet disabled) is reportedly unusable on -rt right now due diff --git a/debian/patches/features/all/rt/latency-hist.patch b/debian/patches/features/all/rt/latency-hist.patch index 5067d8fa07b8..0bb51338843d 100644 --- a/debian/patches/features/all/rt/latency-hist.patch +++ b/debian/patches/features/all/rt/latency-hist.patch @@ -1,7 +1,7 @@ Subject: tracing: Add latency histograms From: Carsten Emde Date: Tue, 19 Jul 2011 14:03:41 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz This patch provides a recording mechanism to store data of potential sources of system latencies. The recordings separately determine the diff --git a/debian/patches/features/all/rt/latency_hist-update-sched_wakeup-probe.patch b/debian/patches/features/all/rt/latency_hist-update-sched_wakeup-probe.patch index d685a4d12dd1..0019eeb816f4 100644 --- a/debian/patches/features/all/rt/latency_hist-update-sched_wakeup-probe.patch +++ b/debian/patches/features/all/rt/latency_hist-update-sched_wakeup-probe.patch @@ -1,7 +1,7 @@ Subject: latency_hist: Update sched_wakeup probe From: Mathieu Desnoyers Date: Sun, 25 Oct 2015 18:06:05 -0400 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz "sched: Introduce the 'trace_sched_waking' tracepoint" introduces a prototype change for the sched_wakeup probe: the "success" argument is diff --git a/debian/patches/features/all/rt/latencyhist-disable-jump-labels.patch b/debian/patches/features/all/rt/latencyhist-disable-jump-labels.patch index a4bc29840817..9d0ffb0c8926 100644 --- a/debian/patches/features/all/rt/latencyhist-disable-jump-labels.patch +++ b/debian/patches/features/all/rt/latencyhist-disable-jump-labels.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Thu, 4 Feb 2016 14:08:06 +0100 Subject: latencyhist: disable jump-labels -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Atleast on X86 we die a recursive death diff --git a/debian/patches/features/all/rt/leds-trigger-disable-CPU-trigger-on-RT.patch b/debian/patches/features/all/rt/leds-trigger-disable-CPU-trigger-on-RT.patch index 7406b1022454..fcc2d6ce9f89 100644 --- a/debian/patches/features/all/rt/leds-trigger-disable-CPU-trigger-on-RT.patch +++ b/debian/patches/features/all/rt/leds-trigger-disable-CPU-trigger-on-RT.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Thu, 23 Jan 2014 14:45:59 +0100 Subject: leds: trigger: disable CPU trigger on -RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz as it triggers: |CPU: 0 PID: 0 Comm: swapper Not tainted 3.12.8-rt10 #141 diff --git a/debian/patches/features/all/rt/lglocks-rt.patch b/debian/patches/features/all/rt/lglocks-rt.patch index b996227b7e87..cd55f610ae33 100644 --- a/debian/patches/features/all/rt/lglocks-rt.patch +++ b/debian/patches/features/all/rt/lglocks-rt.patch @@ -1,7 +1,7 @@ Subject: lglocks: Provide a RT safe variant From: Thomas Gleixner Date: Wed, 15 Jun 2011 11:02:21 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz lglocks by itself will spin in order to get the lock. This will end up badly if a task with the highest priority keeps spinning while a task diff --git a/debian/patches/features/all/rt/list_bl-fixup-bogus-lockdep-warning.patch b/debian/patches/features/all/rt/list_bl-fixup-bogus-lockdep-warning.patch index 0583f01d684b..21ef5e4a7bed 100644 --- a/debian/patches/features/all/rt/list_bl-fixup-bogus-lockdep-warning.patch +++ b/debian/patches/features/all/rt/list_bl-fixup-bogus-lockdep-warning.patch @@ -1,7 +1,7 @@ From: Josh Cartwright Date: Thu, 31 Mar 2016 00:04:25 -0500 Subject: [PATCH] list_bl: fixup bogus lockdep warning -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz At first glance, the use of 'static inline' seems appropriate for INIT_HLIST_BL_HEAD(). diff --git a/debian/patches/features/all/rt/list_bl.h-make-list-head-locking-RT-safe.patch b/debian/patches/features/all/rt/list_bl.h-make-list-head-locking-RT-safe.patch index 295a12101e86..7808344cae14 100644 --- a/debian/patches/features/all/rt/list_bl.h-make-list-head-locking-RT-safe.patch +++ b/debian/patches/features/all/rt/list_bl.h-make-list-head-locking-RT-safe.patch @@ -1,7 +1,7 @@ From: Paul Gortmaker Date: Fri, 21 Jun 2013 15:07:25 -0400 Subject: list_bl: Make list head locking RT safe -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz 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 diff --git a/debian/patches/features/all/rt/local-irq-rt-depending-variants.patch b/debian/patches/features/all/rt/local-irq-rt-depending-variants.patch index 6b288f2fe988..20aba56f8892 100644 --- a/debian/patches/features/all/rt/local-irq-rt-depending-variants.patch +++ b/debian/patches/features/all/rt/local-irq-rt-depending-variants.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Tue, 21 Jul 2009 22:34:14 +0200 Subject: rt: local_irq_* variants depending on RT/!RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Add local_irq_*_(no)rt variant which are mainly used to break interrupt disabled sections on PREEMPT_RT or to explicitely disable diff --git a/debian/patches/features/all/rt/locallock-add-local_lock_on.patch b/debian/patches/features/all/rt/locallock-add-local_lock_on.patch index 53d1a9685a18..4f394951c98b 100644 --- a/debian/patches/features/all/rt/locallock-add-local_lock_on.patch +++ b/debian/patches/features/all/rt/locallock-add-local_lock_on.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Fri, 27 May 2016 15:11:51 +0200 Subject: [PATCH] locallock: add local_lock_on() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Signed-off-by: Sebastian Andrzej Siewior --- diff --git a/debian/patches/features/all/rt/localversion.patch b/debian/patches/features/all/rt/localversion.patch index 3ad783b488b0..8b998aad74fb 100644 --- a/debian/patches/features/all/rt/localversion.patch +++ b/debian/patches/features/all/rt/localversion.patch @@ -1,7 +1,7 @@ Subject: Add localversion for -RT release From: Thomas Gleixner Date: Fri, 08 Jul 2011 20:25:16 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Signed-off-by: Thomas Gleixner --- @@ -11,4 +11,4 @@ Signed-off-by: Thomas Gleixner --- /dev/null +++ b/localversion-rt @@ -0,0 +1 @@ -+-rt6 ++-rt10 diff --git a/debian/patches/features/all/rt/lockdep-no-softirq-accounting-on-rt.patch b/debian/patches/features/all/rt/lockdep-no-softirq-accounting-on-rt.patch index e13d722d911d..4b88127a7f0a 100644 --- a/debian/patches/features/all/rt/lockdep-no-softirq-accounting-on-rt.patch +++ b/debian/patches/features/all/rt/lockdep-no-softirq-accounting-on-rt.patch @@ -1,7 +1,7 @@ Subject: lockdep: Make it RT aware From: Thomas Gleixner Date: Sun, 17 Jul 2011 18:51:23 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz teach lockdep that we don't really do softirqs on -RT. diff --git a/debian/patches/features/all/rt/lockdep-selftest-fix-warnings-due-to-missing-PREEMPT.patch b/debian/patches/features/all/rt/lockdep-selftest-fix-warnings-due-to-missing-PREEMPT.patch index e7ee2c4078a6..d392ee9de223 100644 --- a/debian/patches/features/all/rt/lockdep-selftest-fix-warnings-due-to-missing-PREEMPT.patch +++ b/debian/patches/features/all/rt/lockdep-selftest-fix-warnings-due-to-missing-PREEMPT.patch @@ -1,7 +1,7 @@ From: Josh Cartwright Date: Wed, 28 Jan 2015 13:08:45 -0600 Subject: lockdep: selftest: fix warnings due to missing PREEMPT_RT conditionals -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz "lockdep: Selftest: Only do hardirq context test for raw spinlock" disabled the execution of certain tests with PREEMPT_RT_FULL, but did diff --git a/debian/patches/features/all/rt/lockdep-selftest-only-do-hardirq-context-test-for-raw-spinlock.patch b/debian/patches/features/all/rt/lockdep-selftest-only-do-hardirq-context-test-for-raw-spinlock.patch index 6e4b09893aa2..433490e5115c 100644 --- a/debian/patches/features/all/rt/lockdep-selftest-only-do-hardirq-context-test-for-raw-spinlock.patch +++ b/debian/patches/features/all/rt/lockdep-selftest-only-do-hardirq-context-test-for-raw-spinlock.patch @@ -1,7 +1,7 @@ Subject: lockdep: selftest: Only do hardirq context test for raw spinlock From: Yong Zhang Date: Mon, 16 Apr 2012 15:01:56 +0800 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz From: Yong Zhang diff --git a/debian/patches/features/all/rt/locking-locktorture-Do-NOT-include-rwlock.h-directly.patch b/debian/patches/features/all/rt/locking-locktorture-Do-NOT-include-rwlock.h-directly.patch index 02b723814586..eba7c7528992 100644 --- a/debian/patches/features/all/rt/locking-locktorture-Do-NOT-include-rwlock.h-directly.patch +++ b/debian/patches/features/all/rt/locking-locktorture-Do-NOT-include-rwlock.h-directly.patch @@ -1,7 +1,7 @@ From: "Wolfgang M. Reimer" Date: Tue, 21 Jul 2015 16:20:07 +0200 Subject: locking: locktorture: Do NOT include rwlock.h directly -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Including rwlock.h directly will cause kernel builds to fail if CONFIG_PREEMPT_RT_FULL is defined. The correct header file diff --git a/debian/patches/features/all/rt/lockinglglocks_Use_preempt_enabledisable_nort()_in_lg_double_locklg_double_unlock.patch b/debian/patches/features/all/rt/lockinglglocks_Use_preempt_enabledisable_nort()_in_lg_double_locklg_double_unlock.patch index d88423bf9f0f..1459b001bc8f 100644 --- a/debian/patches/features/all/rt/lockinglglocks_Use_preempt_enabledisable_nort()_in_lg_double_locklg_double_unlock.patch +++ b/debian/patches/features/all/rt/lockinglglocks_Use_preempt_enabledisable_nort()_in_lg_double_locklg_double_unlock.patch @@ -1,7 +1,7 @@ Subject: locking/lglocks: Use preempt_enable/disable_nort() in lg_double_[un]lock From: Mike Galbraith Date: Sat, 27 Feb 2016 08:34:43 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Let's not do that when snagging an rtmutex. diff --git a/debian/patches/features/all/rt/md-disable-bcache.patch b/debian/patches/features/all/rt/md-disable-bcache.patch index ab7b5e93f048..6090670cde7f 100644 --- a/debian/patches/features/all/rt/md-disable-bcache.patch +++ b/debian/patches/features/all/rt/md-disable-bcache.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Thu, 29 Aug 2013 11:48:57 +0200 Subject: md: disable bcache -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz It uses anon semaphores |drivers/md/bcache/request.c: In function ‘cached_dev_write_complete’: diff --git a/debian/patches/features/all/rt/md-raid5-percpu-handling-rt-aware.patch b/debian/patches/features/all/rt/md-raid5-percpu-handling-rt-aware.patch index 0d6ac7f73870..1d9938c803f1 100644 --- a/debian/patches/features/all/rt/md-raid5-percpu-handling-rt-aware.patch +++ b/debian/patches/features/all/rt/md-raid5-percpu-handling-rt-aware.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Tue, 6 Apr 2010 16:51:31 +0200 Subject: md: raid5: Make raid5_percpu handling RT aware -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz __raid_run_ops() disables preemption with get_cpu() around the access to the raid5_percpu variables. That causes scheduling while atomic diff --git a/debian/patches/features/all/rt/mips-disable-highmem-on-rt.patch b/debian/patches/features/all/rt/mips-disable-highmem-on-rt.patch index 4ae1f9ac6a37..e7ffc3d0f6c1 100644 --- a/debian/patches/features/all/rt/mips-disable-highmem-on-rt.patch +++ b/debian/patches/features/all/rt/mips-disable-highmem-on-rt.patch @@ -1,7 +1,7 @@ Subject: mips: Disable highmem on RT From: Thomas Gleixner Date: Mon, 18 Jul 2011 17:10:12 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz The current highmem handling on -RT is not compatible and needs fixups. diff --git a/debian/patches/features/all/rt/mm--rt--Fix-generic-kmap_atomic-for-RT.patch b/debian/patches/features/all/rt/mm--rt--Fix-generic-kmap_atomic-for-RT.patch index 2c59e6792d5a..82c80e6daa6f 100644 --- a/debian/patches/features/all/rt/mm--rt--Fix-generic-kmap_atomic-for-RT.patch +++ b/debian/patches/features/all/rt/mm--rt--Fix-generic-kmap_atomic-for-RT.patch @@ -1,7 +1,7 @@ Subject: mm: rt: Fix generic kmap_atomic for RT From: Thomas Gleixner Date: Sat, 19 Sep 2015 10:15:00 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz The update to 4.1 brought in the mainline variant of the pagefault disable distangling from preempt count. That introduced a diff --git a/debian/patches/features/all/rt/mm-backing-dev-don-t-disable-IRQs-in-wb_congested_pu.patch b/debian/patches/features/all/rt/mm-backing-dev-don-t-disable-IRQs-in-wb_congested_pu.patch index 57aa9deda515..5ec71597a552 100644 --- a/debian/patches/features/all/rt/mm-backing-dev-don-t-disable-IRQs-in-wb_congested_pu.patch +++ b/debian/patches/features/all/rt/mm-backing-dev-don-t-disable-IRQs-in-wb_congested_pu.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Fri, 5 Feb 2016 12:17:14 +0100 Subject: mm: backing-dev: don't disable IRQs in wb_congested_put() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz it triggers: |BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:930 diff --git a/debian/patches/features/all/rt/mm-bounce-local-irq-save-nort.patch b/debian/patches/features/all/rt/mm-bounce-local-irq-save-nort.patch index d1603873d2b6..b5fd801875b7 100644 --- a/debian/patches/features/all/rt/mm-bounce-local-irq-save-nort.patch +++ b/debian/patches/features/all/rt/mm-bounce-local-irq-save-nort.patch @@ -1,7 +1,7 @@ Subject: mm: bounce: Use local_irq_save_nort From: Thomas Gleixner Date: Wed, 09 Jan 2013 10:33:09 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz kmap_atomic() is preemptible on RT. diff --git a/debian/patches/features/all/rt/mm-convert-swap-to-percpu-locked.patch b/debian/patches/features/all/rt/mm-convert-swap-to-percpu-locked.patch index e23c8df565ee..7888bf4a25ab 100644 --- a/debian/patches/features/all/rt/mm-convert-swap-to-percpu-locked.patch +++ b/debian/patches/features/all/rt/mm-convert-swap-to-percpu-locked.patch @@ -1,7 +1,7 @@ From: Ingo Molnar Date: Fri, 3 Jul 2009 08:29:51 -0500 Subject: mm/swap: Convert to percpu locked -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Replace global locks (get_cpu + local_irq_save) with "local_locks()". Currently there is one of for "rotate" and one for "swap". diff --git a/debian/patches/features/all/rt/mm-disable-sloub-rt.patch b/debian/patches/features/all/rt/mm-disable-sloub-rt.patch index 679f7640ef82..4ccf80fea7e1 100644 --- a/debian/patches/features/all/rt/mm-disable-sloub-rt.patch +++ b/debian/patches/features/all/rt/mm-disable-sloub-rt.patch @@ -1,7 +1,7 @@ From: Ingo Molnar Date: Fri, 3 Jul 2009 08:44:03 -0500 Subject: mm: Allow only slub on RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Disable SLAB and SLOB on -RT. Only SLUB is adopted to -RT needs. diff --git a/debian/patches/features/all/rt/mm-enable-slub.patch b/debian/patches/features/all/rt/mm-enable-slub.patch index 6daf8f2b2c9d..4baee4958ede 100644 --- a/debian/patches/features/all/rt/mm-enable-slub.patch +++ b/debian/patches/features/all/rt/mm-enable-slub.patch @@ -1,7 +1,7 @@ Subject: mm: Enable SLUB for RT From: Thomas Gleixner Date: Thu, 25 Oct 2012 10:32:35 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Make SLUB RT aware by converting locks to raw and using free lists to move the freeing out of the lock held region. diff --git a/debian/patches/features/all/rt/mm-make-vmstat-rt-aware.patch b/debian/patches/features/all/rt/mm-make-vmstat-rt-aware.patch index 7154d678d405..7bfabec1d6cd 100644 --- a/debian/patches/features/all/rt/mm-make-vmstat-rt-aware.patch +++ b/debian/patches/features/all/rt/mm-make-vmstat-rt-aware.patch @@ -1,7 +1,7 @@ From: Ingo Molnar Date: Fri, 3 Jul 2009 08:30:13 -0500 Subject: mm/vmstat: Protect per cpu variables with preempt disable on RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz 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 diff --git a/debian/patches/features/all/rt/mm-memcontrol-Don-t-call-schedule_work_on-in-preempt.patch b/debian/patches/features/all/rt/mm-memcontrol-Don-t-call-schedule_work_on-in-preempt.patch index 7e8c8b86390c..1ed379d23543 100644 --- a/debian/patches/features/all/rt/mm-memcontrol-Don-t-call-schedule_work_on-in-preempt.patch +++ b/debian/patches/features/all/rt/mm-memcontrol-Don-t-call-schedule_work_on-in-preempt.patch @@ -1,7 +1,7 @@ From: Yang Shi Subject: mm/memcontrol: Don't call schedule_work_on in preemption disabled context Date: Wed, 30 Oct 2013 11:48:33 -0700 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz The following trace is triggered when running ltp oom test cases: diff --git a/debian/patches/features/all/rt/mm-memcontrol-do_not_disable_irq.patch b/debian/patches/features/all/rt/mm-memcontrol-do_not_disable_irq.patch index dea96f21d4c0..f3c5bb45b5c3 100644 --- a/debian/patches/features/all/rt/mm-memcontrol-do_not_disable_irq.patch +++ b/debian/patches/features/all/rt/mm-memcontrol-do_not_disable_irq.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Subject: mm/memcontrol: Replace local_irq_disable with local locks Date: Wed, 28 Jan 2015 17:14:16 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz There are a few local_irq_disable() which then take sleeping locks. This patch converts them local locks. diff --git a/debian/patches/features/all/rt/mm-memcontrol-mem_cgroup_migrate-replace-another-loc.patch b/debian/patches/features/all/rt/mm-memcontrol-mem_cgroup_migrate-replace-another-loc.patch index 59db85cf1210..f03225b23875 100644 --- a/debian/patches/features/all/rt/mm-memcontrol-mem_cgroup_migrate-replace-another-loc.patch +++ b/debian/patches/features/all/rt/mm-memcontrol-mem_cgroup_migrate-replace-another-loc.patch @@ -2,7 +2,7 @@ From: Mike Galbraith Date: Sun, 5 Jun 2016 08:11:13 +0200 Subject: [PATCH] mm/memcontrol: mem_cgroup_migrate() - replace another local_irq_disable() w. local_lock_irq() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz v4.6 grew a local_irq_disable() in mm/memcontrol.c::mem_cgroup_migrate(). Convert it to use the existing local lock (event_lock) like the others. diff --git a/debian/patches/features/all/rt/mm-page-alloc-use-local-lock-on-target-cpu.patch b/debian/patches/features/all/rt/mm-page-alloc-use-local-lock-on-target-cpu.patch index c79ae4264eed..c3b076a778c3 100644 --- a/debian/patches/features/all/rt/mm-page-alloc-use-local-lock-on-target-cpu.patch +++ b/debian/patches/features/all/rt/mm-page-alloc-use-local-lock-on-target-cpu.patch @@ -1,7 +1,7 @@ Subject: mm: page_alloc: Use local_lock_on() instead of plain spinlock From: Thomas Gleixner Date: Thu, 27 Sep 2012 11:11:46 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz The plain spinlock while sufficient does not update the local_lock internals. Use a proper local_lock function instead to ease debugging. diff --git a/debian/patches/features/all/rt/mm-page_alloc-reduce-lock-sections-further.patch b/debian/patches/features/all/rt/mm-page_alloc-reduce-lock-sections-further.patch index 070969bdc34a..c9c498900b98 100644 --- a/debian/patches/features/all/rt/mm-page_alloc-reduce-lock-sections-further.patch +++ b/debian/patches/features/all/rt/mm-page_alloc-reduce-lock-sections-further.patch @@ -1,7 +1,7 @@ From: Peter Zijlstra Date: Fri Jul 3 08:44:37 2009 -0500 Subject: mm: page_alloc: Reduce lock sections further -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Split out the pages which are to be freed into a separate list and call free_pages_bulk() outside of the percpu page allocator locks. diff --git a/debian/patches/features/all/rt/mm-page_alloc-rt-friendly-per-cpu-pages.patch b/debian/patches/features/all/rt/mm-page_alloc-rt-friendly-per-cpu-pages.patch index f1ee7ebfbfa8..b8e1738fda3a 100644 --- a/debian/patches/features/all/rt/mm-page_alloc-rt-friendly-per-cpu-pages.patch +++ b/debian/patches/features/all/rt/mm-page_alloc-rt-friendly-per-cpu-pages.patch @@ -1,7 +1,7 @@ From: Ingo Molnar Date: Fri, 3 Jul 2009 08:29:37 -0500 Subject: mm: page_alloc: rt-friendly per-cpu pages -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz rt-friendly per-cpu pages: convert the irqs-off per-cpu locking method into a preemptible, explicit-per-cpu-locks method. diff --git a/debian/patches/features/all/rt/mm-perform-lru_add_drain_all-remotely.patch b/debian/patches/features/all/rt/mm-perform-lru_add_drain_all-remotely.patch index 808fef2db086..8fc4f9074089 100644 --- a/debian/patches/features/all/rt/mm-perform-lru_add_drain_all-remotely.patch +++ b/debian/patches/features/all/rt/mm-perform-lru_add_drain_all-remotely.patch @@ -1,7 +1,7 @@ From: Luiz Capitulino Date: Fri, 27 May 2016 15:03:28 +0200 Subject: [PATCH] mm: perform lru_add_drain_all() remotely -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz 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 diff --git a/debian/patches/features/all/rt/mm-protect-activate-switch-mm.patch b/debian/patches/features/all/rt/mm-protect-activate-switch-mm.patch index ad843affd492..d4dc14678691 100644 --- a/debian/patches/features/all/rt/mm-protect-activate-switch-mm.patch +++ b/debian/patches/features/all/rt/mm-protect-activate-switch-mm.patch @@ -1,7 +1,7 @@ From: Yong Zhang Date: Tue, 15 May 2012 13:53:56 +0800 Subject: mm: Protect activate_mm() by preempt_[disable&enable]_rt() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz User preempt_*_rt instead of local_irq_*_rt or otherwise there will be warning on ARM like below: diff --git a/debian/patches/features/all/rt/mm-rt-kmap-atomic-scheduling.patch b/debian/patches/features/all/rt/mm-rt-kmap-atomic-scheduling.patch index e67745fc01be..9874b5f8a385 100644 --- a/debian/patches/features/all/rt/mm-rt-kmap-atomic-scheduling.patch +++ b/debian/patches/features/all/rt/mm-rt-kmap-atomic-scheduling.patch @@ -1,7 +1,7 @@ Subject: mm, rt: kmap_atomic scheduling From: Peter Zijlstra Date: Thu, 28 Jul 2011 10:43:51 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz In fact, with migrate_disable() existing one could play games with kmap_atomic. You could save/restore the kmap_atomic slots on context diff --git a/debian/patches/features/all/rt/mm-scatterlist-dont-disable-irqs-on-RT.patch b/debian/patches/features/all/rt/mm-scatterlist-dont-disable-irqs-on-RT.patch index 7bc8daa75dfd..ab1cfdd0c8c6 100644 --- a/debian/patches/features/all/rt/mm-scatterlist-dont-disable-irqs-on-RT.patch +++ b/debian/patches/features/all/rt/mm-scatterlist-dont-disable-irqs-on-RT.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Fri, 3 Jul 2009 08:44:34 -0500 Subject: mm/scatterlist: Do not disable irqs on RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz The local_irq_save() is not only used to get things done "fast" but also to ensure that in case of SG_MITER_ATOMIC we are in "atomic" diff --git a/debian/patches/features/all/rt/mm-vmalloc-use-get-cpu-light.patch b/debian/patches/features/all/rt/mm-vmalloc-use-get-cpu-light.patch index 4e0b1ebe3500..c822d7cd21cf 100644 --- a/debian/patches/features/all/rt/mm-vmalloc-use-get-cpu-light.patch +++ b/debian/patches/features/all/rt/mm-vmalloc-use-get-cpu-light.patch @@ -1,7 +1,7 @@ Subject: mm/vmalloc: Another preempt disable region which sucks From: Thomas Gleixner Date: Tue, 12 Jul 2011 11:39:36 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Avoid the preempt disable version of get_cpu_var(). The inner-lock should provide enough serialisation. diff --git a/debian/patches/features/all/rt/mm-workingset-do-not-protect-workingset_shadow_nodes.patch b/debian/patches/features/all/rt/mm-workingset-do-not-protect-workingset_shadow_nodes.patch index ead8e7226652..6105fa61de3a 100644 --- a/debian/patches/features/all/rt/mm-workingset-do-not-protect-workingset_shadow_nodes.patch +++ b/debian/patches/features/all/rt/mm-workingset-do-not-protect-workingset_shadow_nodes.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Thu, 29 Jan 2015 17:19:44 +0100 Subject: mm/workingset: Do not protect workingset_shadow_nodes with irq off -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz workingset_shadow_nodes is protected by local_irq_disable(). Some users use spin_lock_irq(). diff --git a/debian/patches/features/all/rt/mm-zsmalloc-Use-get-put_cpu_light-in-zs_map_object-z.patch b/debian/patches/features/all/rt/mm-zsmalloc-Use-get-put_cpu_light-in-zs_map_object-z.patch index 4564000b6465..4d8ff279c71f 100644 --- a/debian/patches/features/all/rt/mm-zsmalloc-Use-get-put_cpu_light-in-zs_map_object-z.patch +++ b/debian/patches/features/all/rt/mm-zsmalloc-Use-get-put_cpu_light-in-zs_map_object-z.patch @@ -1,9 +1,8 @@ -From 1fd1b32ad881496d3a3b4caac77965555cc021b0 Mon Sep 17 00:00:00 2001 From: Mike Galbraith Date: Tue, 22 Mar 2016 11:16:09 +0100 Subject: [PATCH] mm/zsmalloc: Use get/put_cpu_light in zs_map_object()/zs_unmap_object() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Otherwise, we get a ___might_sleep() splat. diff --git a/debian/patches/features/all/rt/mmci-remove-bogus-irq-save.patch b/debian/patches/features/all/rt/mmci-remove-bogus-irq-save.patch index 00587a3f7899..74ce792ab35d 100644 --- a/debian/patches/features/all/rt/mmci-remove-bogus-irq-save.patch +++ b/debian/patches/features/all/rt/mmci-remove-bogus-irq-save.patch @@ -1,7 +1,7 @@ Subject: mmci: Remove bogus local_irq_save() From: Thomas Gleixner Date: Wed, 09 Jan 2013 12:11:12 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz On !RT interrupt runs with interrupts disabled. On RT it's in a thread, so no need to disable interrupts at all. diff --git a/debian/patches/features/all/rt/move_sched_delayed_work_to_helper.patch b/debian/patches/features/all/rt/move_sched_delayed_work_to_helper.patch index 593473c789d5..692f016e26de 100644 --- a/debian/patches/features/all/rt/move_sched_delayed_work_to_helper.patch +++ b/debian/patches/features/all/rt/move_sched_delayed_work_to_helper.patch @@ -1,7 +1,7 @@ Date: Wed, 26 Jun 2013 15:28:11 -0400 From: Steven Rostedt Subject: rt,ntp: Move call to schedule_delayed_work() to helper thread -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz The ntp code for notify_cmos_timer() is called from a hard interrupt context. schedule_delayed_work() under PREEMPT_RT_FULL calls spinlocks diff --git a/debian/patches/features/all/rt/mutex-no-spin-on-rt.patch b/debian/patches/features/all/rt/mutex-no-spin-on-rt.patch index 73825fd769be..a3e9b053126b 100644 --- a/debian/patches/features/all/rt/mutex-no-spin-on-rt.patch +++ b/debian/patches/features/all/rt/mutex-no-spin-on-rt.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Sun, 17 Jul 2011 21:51:45 +0200 Subject: locking: Disable spin on owner for RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Drop spin on owner for mutex / rwsem. We are most likely not using it but… diff --git a/debian/patches/features/all/rt/net-another-local-irq-disable-alloc-atomic-headache.patch b/debian/patches/features/all/rt/net-another-local-irq-disable-alloc-atomic-headache.patch index 38184b5279e9..ef7b59ee45c6 100644 --- a/debian/patches/features/all/rt/net-another-local-irq-disable-alloc-atomic-headache.patch +++ b/debian/patches/features/all/rt/net-another-local-irq-disable-alloc-atomic-headache.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Wed, 26 Sep 2012 16:21:08 +0200 Subject: net: Another local_irq_disable/kmalloc headache -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Replace it by a local lock. Though that's pretty inefficient :( diff --git a/debian/patches/features/all/rt/net-core-cpuhotplug-drain-input_pkt_queue-lockless.patch b/debian/patches/features/all/rt/net-core-cpuhotplug-drain-input_pkt_queue-lockless.patch index 195fcec15970..c9c6eebab13f 100644 --- a/debian/patches/features/all/rt/net-core-cpuhotplug-drain-input_pkt_queue-lockless.patch +++ b/debian/patches/features/all/rt/net-core-cpuhotplug-drain-input_pkt_queue-lockless.patch @@ -1,7 +1,7 @@ Subject: net/core/cpuhotplug: Drain input_pkt_queue lockless From: Grygorii Strashko Date: Fri, 9 Oct 2015 09:25:49 -0500 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz I can constantly see below error report with 4.1 RT-kernel on TI ARM dra7-evm if I'm trying to unplug cpu1: diff --git a/debian/patches/features/all/rt/net-core-protect-users-of-napi_alloc_cache-against-r.patch b/debian/patches/features/all/rt/net-core-protect-users-of-napi_alloc_cache-against-r.patch index 615a2bb58461..0aa8b25d7066 100644 --- a/debian/patches/features/all/rt/net-core-protect-users-of-napi_alloc_cache-against-r.patch +++ b/debian/patches/features/all/rt/net-core-protect-users-of-napi_alloc_cache-against-r.patch @@ -2,7 +2,7 @@ From: Sebastian Andrzej Siewior Date: Fri, 15 Jan 2016 16:33:34 +0100 Subject: net/core: protect users of napi_alloc_cache against reentrance -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.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 diff --git a/debian/patches/features/all/rt/net-dev-always-take-qdisc-s-busylock-in-__dev_xmit_s.patch b/debian/patches/features/all/rt/net-dev-always-take-qdisc-s-busylock-in-__dev_xmit_s.patch index 0ee6aa211485..161309dc11d1 100644 --- a/debian/patches/features/all/rt/net-dev-always-take-qdisc-s-busylock-in-__dev_xmit_s.patch +++ b/debian/patches/features/all/rt/net-dev-always-take-qdisc-s-busylock-in-__dev_xmit_s.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Wed, 30 Mar 2016 13:36:29 +0200 Subject: [PATCH] net: dev: always take qdisc's busylock in __dev_xmit_skb() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz 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 diff --git a/debian/patches/features/all/rt/net-fix-iptable-xt-write-recseq-begin-rt-fallout.patch b/debian/patches/features/all/rt/net-fix-iptable-xt-write-recseq-begin-rt-fallout.patch index 28882f62bb7f..3750f5f05d42 100644 --- a/debian/patches/features/all/rt/net-fix-iptable-xt-write-recseq-begin-rt-fallout.patch +++ b/debian/patches/features/all/rt/net-fix-iptable-xt-write-recseq-begin-rt-fallout.patch @@ -1,7 +1,7 @@ Subject: net: netfilter: Serialize xt_write_recseq sections on RT From: Thomas Gleixner Date: Sun, 28 Oct 2012 11:18:08 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz The netfilter code relies only on the implicit semantics of local_bh_disable() for serializing wt_write_recseq sections. RT breaks diff --git a/debian/patches/features/all/rt/net-ipv4-inet-Initialize-timers-as-pinned.patch b/debian/patches/features/all/rt/net-ipv4-inet-Initialize-timers-as-pinned.patch new file mode 100644 index 000000000000..b2d3eb792e80 --- /dev/null +++ b/debian/patches/features/all/rt/net-ipv4-inet-Initialize-timers-as-pinned.patch @@ -0,0 +1,66 @@ +From: Thomas Gleixner +Date: Mon, 4 Jul 2016 09:50:23 +0000 +Subject: [PATCH 08/22] net/ipv4/inet: Initialize timers as pinned +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz + +Pinned timers must carry that attribute in the timer itself. No functional +change. + +Signed-off-by: Thomas Gleixner +Reviewed-by: Frederic Weisbecker +Cc: Peter Zijlstra +Cc: Chris Mason +Cc: Eric Dumazet +Cc: rt@linutronix.de +Cc: "Paul E. McKenney" +Cc: Arjan van de Ven +Signed-off-by: Sebastian Andrzej Siewior +--- + net/ipv4/inet_connection_sock.c | 7 ++++--- + net/ipv4/inet_timewait_sock.c | 5 +++-- + 2 files changed, 7 insertions(+), 5 deletions(-) + +--- a/net/ipv4/inet_connection_sock.c ++++ b/net/ipv4/inet_connection_sock.c +@@ -603,7 +603,7 @@ static void reqsk_timer_handler(unsigned + if (req->num_timeout++ == 0) + atomic_dec(&queue->young); + timeo = min(TCP_TIMEOUT_INIT << req->num_timeout, TCP_RTO_MAX); +- mod_timer_pinned(&req->rsk_timer, jiffies + timeo); ++ mod_timer(&req->rsk_timer, jiffies + timeo); + return; + } + drop: +@@ -617,8 +617,9 @@ static void reqsk_queue_hash_req(struct + req->num_timeout = 0; + req->sk = NULL; + +- setup_timer(&req->rsk_timer, reqsk_timer_handler, (unsigned long)req); +- mod_timer_pinned(&req->rsk_timer, jiffies + timeout); ++ setup_pinned_timer(&req->rsk_timer, reqsk_timer_handler, ++ (unsigned long)req); ++ mod_timer(&req->rsk_timer, jiffies + timeout); + + inet_ehash_insert(req_to_sk(req), NULL); + /* before letting lookups find us, make sure all req fields +--- a/net/ipv4/inet_timewait_sock.c ++++ b/net/ipv4/inet_timewait_sock.c +@@ -188,7 +188,8 @@ struct inet_timewait_sock *inet_twsk_all + tw->tw_prot = sk->sk_prot_creator; + atomic64_set(&tw->tw_cookie, atomic64_read(&sk->sk_cookie)); + twsk_net_set(tw, sock_net(sk)); +- setup_timer(&tw->tw_timer, tw_timer_handler, (unsigned long)tw); ++ setup_pinned_timer(&tw->tw_timer, tw_timer_handler, ++ (unsigned long)tw); + /* + * Because we use RCU lookups, we should not set tw_refcnt + * to a non null value before everything is setup for this +@@ -248,7 +249,7 @@ void __inet_twsk_schedule(struct inet_ti + + tw->tw_kill = timeo <= 4*HZ; + if (!rearm) { +- BUG_ON(mod_timer_pinned(&tw->tw_timer, jiffies + timeo)); ++ BUG_ON(mod_timer(&tw->tw_timer, jiffies + timeo)); + atomic_inc(&tw->tw_dr->tw_count); + } else { + mod_timer_pending(&tw->tw_timer, jiffies + timeo); diff --git a/debian/patches/features/all/rt/net-make-devnet_rename_seq-a-mutex.patch b/debian/patches/features/all/rt/net-make-devnet_rename_seq-a-mutex.patch index 7d780f8b392e..51e4d8cec1a4 100644 --- a/debian/patches/features/all/rt/net-make-devnet_rename_seq-a-mutex.patch +++ b/debian/patches/features/all/rt/net-make-devnet_rename_seq-a-mutex.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Wed, 20 Mar 2013 18:06:20 +0100 Subject: net: Add a mutex around devnet_rename_seq -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz On RT write_seqcount_begin() disables preemption and device_rename() allocates memory with GFP_KERNEL and grabs later the sysfs_mutex diff --git a/debian/patches/features/all/rt/net-move-xmit_recursion-to-per-task-variable-on-RT.patch b/debian/patches/features/all/rt/net-move-xmit_recursion-to-per-task-variable-on-RT.patch index 4d5f8ca9479b..63823e26d11c 100644 --- a/debian/patches/features/all/rt/net-move-xmit_recursion-to-per-task-variable-on-RT.patch +++ b/debian/patches/features/all/rt/net-move-xmit_recursion-to-per-task-variable-on-RT.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Wed, 13 Jan 2016 15:55:02 +0100 Subject: net: move xmit_recursion to per-task variable on -RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz A softirq on -RT can be preempted. That means one task is in __dev_queue_xmit(), gets preempted and another task may enter diff --git a/debian/patches/features/all/rt/net-prevent-abba-deadlock.patch b/debian/patches/features/all/rt/net-prevent-abba-deadlock.patch index 7a5457c19f0e..ea0e3c4daa69 100644 --- a/debian/patches/features/all/rt/net-prevent-abba-deadlock.patch +++ b/debian/patches/features/all/rt/net-prevent-abba-deadlock.patch @@ -1,7 +1,7 @@ Subject: net-flip-lock-dep-thingy.patch From: Thomas Gleixner Date: Tue, 28 Jun 2011 10:59:58 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz ======================================================= [ INFO: possible circular locking dependency detected ] diff --git a/debian/patches/features/all/rt/net-provide-a-way-to-delegate-processing-a-softirq-t.patch b/debian/patches/features/all/rt/net-provide-a-way-to-delegate-processing-a-softirq-t.patch index 7f06cf325eeb..e53c510e3868 100644 --- a/debian/patches/features/all/rt/net-provide-a-way-to-delegate-processing-a-softirq-t.patch +++ b/debian/patches/features/all/rt/net-provide-a-way-to-delegate-processing-a-softirq-t.patch @@ -2,7 +2,7 @@ From: Sebastian Andrzej Siewior Date: Wed, 20 Jan 2016 15:39:05 +0100 Subject: net: provide a way to delegate processing a softirq to ksoftirqd -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz 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 diff --git a/debian/patches/features/all/rt/net-sched-dev_deactivate_many-use-msleep-1-instead-o.patch b/debian/patches/features/all/rt/net-sched-dev_deactivate_many-use-msleep-1-instead-o.patch index 20f2d169b6c8..cc043c3244ef 100644 --- a/debian/patches/features/all/rt/net-sched-dev_deactivate_many-use-msleep-1-instead-o.patch +++ b/debian/patches/features/all/rt/net-sched-dev_deactivate_many-use-msleep-1-instead-o.patch @@ -1,7 +1,7 @@ From: Marc Kleine-Budde Date: Wed, 5 Mar 2014 00:49:47 +0100 Subject: net: sched: Use msleep() instead of yield() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz 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 diff --git a/debian/patches/features/all/rt/net-tx-action-avoid-livelock-on-rt.patch b/debian/patches/features/all/rt/net-tx-action-avoid-livelock-on-rt.patch index 45ce02c5c101..c6359bec8607 100644 --- a/debian/patches/features/all/rt/net-tx-action-avoid-livelock-on-rt.patch +++ b/debian/patches/features/all/rt/net-tx-action-avoid-livelock-on-rt.patch @@ -1,7 +1,7 @@ Subject: net: Avoid livelock in net_tx_action() on RT From: Steven Rostedt Date: Thu, 06 Oct 2011 10:48:39 -0400 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz qdisc_lock is taken w/o disabling interrupts or bottom halfs. So code holding a qdisc_lock() can be interrupted and softirqs can run on the diff --git a/debian/patches/features/all/rt/net-use-cpu-chill.patch b/debian/patches/features/all/rt/net-use-cpu-chill.patch index 485b48e78796..843eacb83bb8 100644 --- a/debian/patches/features/all/rt/net-use-cpu-chill.patch +++ b/debian/patches/features/all/rt/net-use-cpu-chill.patch @@ -1,7 +1,7 @@ Subject: net: Use cpu_chill() instead of cpu_relax() From: Thomas Gleixner Date: Wed, 07 Mar 2012 21:10:04 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Retry loops on RT might loop forever when the modifying side was preempted. Use cpu_chill() instead of cpu_relax() to let the system diff --git a/debian/patches/features/all/rt/net-wireless-warn-nort.patch b/debian/patches/features/all/rt/net-wireless-warn-nort.patch index 9273e42f5ed8..4382612f48ac 100644 --- a/debian/patches/features/all/rt/net-wireless-warn-nort.patch +++ b/debian/patches/features/all/rt/net-wireless-warn-nort.patch @@ -1,7 +1,7 @@ Subject: net/wireless: Use WARN_ON_NORT() From: Thomas Gleixner Date: Thu, 21 Jul 2011 21:05:33 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz The softirq counter is meaningless on RT, so the check triggers a false positive. diff --git a/debian/patches/features/all/rt/net__Make_synchronize-rcu_expedited_conditional-on-non-rt.patch b/debian/patches/features/all/rt/net__Make_synchronize-rcu_expedited_conditional-on-non-rt.patch index 97001d6e35c6..e5c5009625d8 100644 --- a/debian/patches/features/all/rt/net__Make_synchronize-rcu_expedited_conditional-on-non-rt.patch +++ b/debian/patches/features/all/rt/net__Make_synchronize-rcu_expedited_conditional-on-non-rt.patch @@ -1,7 +1,7 @@ Date: Tue, 27 Oct 2015 07:31:53 -0500 From: Josh Cartwright Subject: net: Make synchronize_rcu_expedited() conditional on !RT_FULL -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz While the use of synchronize_rcu_expedited() might make synchronize_net() "faster", it does so at significant cost on RT diff --git a/debian/patches/features/all/rt/oleg-signal-rt-fix.patch b/debian/patches/features/all/rt/oleg-signal-rt-fix.patch index 7dcf305b6f7e..082aa6d160b5 100644 --- a/debian/patches/features/all/rt/oleg-signal-rt-fix.patch +++ b/debian/patches/features/all/rt/oleg-signal-rt-fix.patch @@ -1,7 +1,7 @@ From: Oleg Nesterov Date: Tue, 14 Jul 2015 14:26:34 +0200 Subject: signal/x86: Delay calling signals in atomic -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz On x86_64 we must disable preemption before we enable interrupts for stack faults, int3 and debugging, because the current task is using diff --git a/debian/patches/features/all/rt/panic-disable-random-on-rt.patch b/debian/patches/features/all/rt/panic-disable-random-on-rt.patch index b3f6a8314380..080238861976 100644 --- a/debian/patches/features/all/rt/panic-disable-random-on-rt.patch +++ b/debian/patches/features/all/rt/panic-disable-random-on-rt.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Tue, 14 Jul 2015 14:26:34 +0200 Subject: panic: skip get_random_bytes for RT_FULL in init_oops_id -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Disable on -RT. If this is invoked from irq-context we will have problems to acquire the sleeping lock. diff --git a/debian/patches/features/all/rt/patch-to-introduce-rcu-bh-qs-where-safe-from-softirq.patch b/debian/patches/features/all/rt/patch-to-introduce-rcu-bh-qs-where-safe-from-softirq.patch index 667aefd2b07c..1b636ddb48ab 100644 --- a/debian/patches/features/all/rt/patch-to-introduce-rcu-bh-qs-where-safe-from-softirq.patch +++ b/debian/patches/features/all/rt/patch-to-introduce-rcu-bh-qs-where-safe-from-softirq.patch @@ -1,7 +1,7 @@ Subject: rcu: Make ksoftirqd do RCU quiescent states From: "Paul E. McKenney" Date: Wed, 5 Oct 2011 11:45:18 -0700 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Implementing RCU-bh in terms of RCU-preempt makes the system vulnerable to network-based denial-of-service attacks. This patch therefore diff --git a/debian/patches/features/all/rt/pci-access-use-__wake_up_all_locked.patch b/debian/patches/features/all/rt/pci-access-use-__wake_up_all_locked.patch index 4467840dbf7e..0ecf63d6b645 100644 --- a/debian/patches/features/all/rt/pci-access-use-__wake_up_all_locked.patch +++ b/debian/patches/features/all/rt/pci-access-use-__wake_up_all_locked.patch @@ -1,7 +1,7 @@ Subject: pci: Use __wake_up_all_locked in pci_unblock_user_cfg_access() From: Thomas Gleixner Date: Thu, 01 Dec 2011 00:07:16 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz The waitqueue is protected by the pci_lock, so we can just avoid to lock the waitqueue lock itself. That prevents the diff --git a/debian/patches/features/all/rt/percpu_ida-use-locklocks.patch b/debian/patches/features/all/rt/percpu_ida-use-locklocks.patch index 299266a4e346..c182cccd8758 100644 --- a/debian/patches/features/all/rt/percpu_ida-use-locklocks.patch +++ b/debian/patches/features/all/rt/percpu_ida-use-locklocks.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Wed, 9 Apr 2014 11:58:17 +0200 Subject: percpu_ida: Use local locks -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz the local_irq_save() + spin_lock() does not work that well on -RT diff --git a/debian/patches/features/all/rt/perf-make-swevent-hrtimer-irqsafe.patch b/debian/patches/features/all/rt/perf-make-swevent-hrtimer-irqsafe.patch index de9c8015441e..8404c0e03344 100644 --- a/debian/patches/features/all/rt/perf-make-swevent-hrtimer-irqsafe.patch +++ b/debian/patches/features/all/rt/perf-make-swevent-hrtimer-irqsafe.patch @@ -1,7 +1,7 @@ From: Yong Zhang Date: Wed, 11 Jul 2012 22:05:21 +0000 Subject: perf: Make swevent hrtimer run in irq instead of softirq -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Otherwise we get a deadlock like below: diff --git a/debian/patches/features/all/rt/peter_zijlstra-frob-rcu.patch b/debian/patches/features/all/rt/peter_zijlstra-frob-rcu.patch index de20edd28d1c..f26747eecb35 100644 --- a/debian/patches/features/all/rt/peter_zijlstra-frob-rcu.patch +++ b/debian/patches/features/all/rt/peter_zijlstra-frob-rcu.patch @@ -1,7 +1,7 @@ Subject: rcu: Frob softirq test From: Peter Zijlstra Date: Sat Aug 13 00:23:17 CEST 2011 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz With RT_FULL we get the below wreckage: diff --git a/debian/patches/features/all/rt/peterz-srcu-crypto-chain.patch b/debian/patches/features/all/rt/peterz-srcu-crypto-chain.patch index 50947e572a42..32554eaebfcf 100644 --- a/debian/patches/features/all/rt/peterz-srcu-crypto-chain.patch +++ b/debian/patches/features/all/rt/peterz-srcu-crypto-chain.patch @@ -1,7 +1,7 @@ Subject: crypto: Convert crypto notifier chain to SRCU From: Peter Zijlstra Date: Fri, 05 Oct 2012 09:03:24 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz The crypto notifier deadlocks on RT. Though this can be a real deadlock on mainline as well due to fifo fair rwsems. diff --git a/debian/patches/features/all/rt/pid.h-include-atomic.h.patch b/debian/patches/features/all/rt/pid.h-include-atomic.h.patch index cfccf24ac0b1..f049bb5d0eb1 100644 --- a/debian/patches/features/all/rt/pid.h-include-atomic.h.patch +++ b/debian/patches/features/all/rt/pid.h-include-atomic.h.patch @@ -1,7 +1,7 @@ From: Grygorii Strashko Date: Tue, 21 Jul 2015 19:43:56 +0300 Subject: pid.h: include atomic.h -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz This patch fixes build error: CC kernel/pid_namespace.o diff --git a/debian/patches/features/all/rt/ping-sysrq.patch b/debian/patches/features/all/rt/ping-sysrq.patch index c672d3d364db..7d24590131e1 100644 --- a/debian/patches/features/all/rt/ping-sysrq.patch +++ b/debian/patches/features/all/rt/ping-sysrq.patch @@ -1,7 +1,7 @@ Subject: net: sysrq via icmp From: Carsten Emde Date: Tue, 19 Jul 2011 13:51:17 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz There are (probably rare) situations when a system crashed and the system console becomes unresponsive but the network icmp layer still is alive. diff --git a/debian/patches/features/all/rt/posix-timers-no-broadcast.patch b/debian/patches/features/all/rt/posix-timers-no-broadcast.patch index 69ca5b4e5d50..0f8bd58a027c 100644 --- a/debian/patches/features/all/rt/posix-timers-no-broadcast.patch +++ b/debian/patches/features/all/rt/posix-timers-no-broadcast.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Fri, 3 Jul 2009 08:29:20 -0500 Subject: posix-timers: Prevent broadcast signals -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Posix timers should not send broadcast signals and kernel only signals. Prevent it. diff --git a/debian/patches/features/all/rt/posix-timers-thread-posix-cpu-timers-on-rt.patch b/debian/patches/features/all/rt/posix-timers-thread-posix-cpu-timers-on-rt.patch index b566bc33f5c8..780850e28abd 100644 --- a/debian/patches/features/all/rt/posix-timers-thread-posix-cpu-timers-on-rt.patch +++ b/debian/patches/features/all/rt/posix-timers-thread-posix-cpu-timers-on-rt.patch @@ -1,7 +1,7 @@ From: John Stultz Date: Fri, 3 Jul 2009 08:29:58 -0500 Subject: posix-timers: Thread posix-cpu-timers on -rt -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz posix-cpu-timer code takes non -rt safe locks in hard irq context. Move it to a thread. diff --git a/debian/patches/features/all/rt/power-disable-highmem-on-rt.patch b/debian/patches/features/all/rt/power-disable-highmem-on-rt.patch index 5904104cf00b..7de6b0fe3569 100644 --- a/debian/patches/features/all/rt/power-disable-highmem-on-rt.patch +++ b/debian/patches/features/all/rt/power-disable-highmem-on-rt.patch @@ -1,7 +1,7 @@ Subject: powerpc: Disable highmem on RT From: Thomas Gleixner Date: Mon, 18 Jul 2011 17:08:34 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz The current highmem handling on -RT is not compatible and needs fixups. diff --git a/debian/patches/features/all/rt/power-use-generic-rwsem-on-rt.patch b/debian/patches/features/all/rt/power-use-generic-rwsem-on-rt.patch index 909ffdef127f..554a6afe4aa5 100644 --- a/debian/patches/features/all/rt/power-use-generic-rwsem-on-rt.patch +++ b/debian/patches/features/all/rt/power-use-generic-rwsem-on-rt.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Tue, 14 Jul 2015 14:26:34 +0200 Subject: powerpc: Use generic rwsem on RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Use generic code which uses rtmutex diff --git a/debian/patches/features/all/rt/powerpc-kvm-Disable-in-kernel-MPIC-emulation-for-PRE.patch b/debian/patches/features/all/rt/powerpc-kvm-Disable-in-kernel-MPIC-emulation-for-PRE.patch index 3e92a67bb749..587aa37d90c2 100644 --- a/debian/patches/features/all/rt/powerpc-kvm-Disable-in-kernel-MPIC-emulation-for-PRE.patch +++ b/debian/patches/features/all/rt/powerpc-kvm-Disable-in-kernel-MPIC-emulation-for-PRE.patch @@ -1,7 +1,7 @@ From: Bogdan Purcareata Date: Fri, 24 Apr 2015 15:53:13 +0000 Subject: powerpc/kvm: Disable in-kernel MPIC emulation for PREEMPT_RT_FULL -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz 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 diff --git a/debian/patches/features/all/rt/powerpc-preempt-lazy-support.patch b/debian/patches/features/all/rt/powerpc-preempt-lazy-support.patch index f71cc98daed8..bd6d0fcbdab5 100644 --- a/debian/patches/features/all/rt/powerpc-preempt-lazy-support.patch +++ b/debian/patches/features/all/rt/powerpc-preempt-lazy-support.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Thu, 1 Nov 2012 10:14:11 +0100 Subject: powerpc: Add support for lazy preemption -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Implement the powerpc pieces for lazy preempt. diff --git a/debian/patches/features/all/rt/powerpc-ps3-device-init.c-adapt-to-completions-using.patch b/debian/patches/features/all/rt/powerpc-ps3-device-init.c-adapt-to-completions-using.patch index 39e891969552..af822f9e9615 100644 --- a/debian/patches/features/all/rt/powerpc-ps3-device-init.c-adapt-to-completions-using.patch +++ b/debian/patches/features/all/rt/powerpc-ps3-device-init.c-adapt-to-completions-using.patch @@ -1,7 +1,7 @@ From: Paul Gortmaker Date: Sun, 31 May 2015 14:44:42 -0400 Subject: powerpc: ps3/device-init.c - adapt to completions using swait vs wait -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz To fix: diff --git a/debian/patches/features/all/rt/preempt-lazy-check-preempt_schedule.patch b/debian/patches/features/all/rt/preempt-lazy-check-preempt_schedule.patch index 3ca6dce92bf4..f76b48eb6bdd 100644 --- a/debian/patches/features/all/rt/preempt-lazy-check-preempt_schedule.patch +++ b/debian/patches/features/all/rt/preempt-lazy-check-preempt_schedule.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Wed, 20 Jan 2016 15:13:30 +0100 Subject: preempt-lazy: Add the lazy-preemption check to preempt_schedule() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Probably in the rebase onto v4.1 this check got moved into less commonly used preempt_schedule_notrace(). This patch ensures that both functions use it. diff --git a/debian/patches/features/all/rt/preempt-lazy-support.patch b/debian/patches/features/all/rt/preempt-lazy-support.patch index 440aaf6c5b96..62f69bbc7538 100644 --- a/debian/patches/features/all/rt/preempt-lazy-support.patch +++ b/debian/patches/features/all/rt/preempt-lazy-support.patch @@ -1,7 +1,7 @@ Subject: sched: Add support for lazy preemption From: Thomas Gleixner Date: Fri, 26 Oct 2012 18:50:54 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz It has become an obsession to mitigate the determinism vs. throughput loss of RT. Looking at the mainline semantics of preemption points @@ -359,7 +359,7 @@ Signed-off-by: Thomas Gleixner */ --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c -@@ -3318,7 +3318,7 @@ check_preempt_tick(struct cfs_rq *cfs_rq +@@ -3335,7 +3335,7 @@ check_preempt_tick(struct cfs_rq *cfs_rq ideal_runtime = sched_slice(cfs_rq, curr); delta_exec = curr->sum_exec_runtime - curr->prev_sum_exec_runtime; if (delta_exec > ideal_runtime) { @@ -368,7 +368,7 @@ Signed-off-by: Thomas Gleixner /* * The current task ran long enough, ensure it doesn't get * re-elected due to buddy favours. -@@ -3342,7 +3342,7 @@ check_preempt_tick(struct cfs_rq *cfs_rq +@@ -3359,7 +3359,7 @@ check_preempt_tick(struct cfs_rq *cfs_rq return; if (delta > ideal_runtime) @@ -377,7 +377,7 @@ Signed-off-by: Thomas Gleixner } static void -@@ -3487,7 +3487,7 @@ entity_tick(struct cfs_rq *cfs_rq, struc +@@ -3504,7 +3504,7 @@ entity_tick(struct cfs_rq *cfs_rq, struc * validating it and just reschedule. */ if (queued) { @@ -386,7 +386,7 @@ Signed-off-by: Thomas Gleixner return; } /* -@@ -3669,7 +3669,7 @@ static void __account_cfs_rq_runtime(str +@@ -3686,7 +3686,7 @@ static void __account_cfs_rq_runtime(str * hierarchy can be throttled */ if (!assign_cfs_rq_runtime(cfs_rq) && likely(cfs_rq->curr)) @@ -395,7 +395,7 @@ Signed-off-by: Thomas Gleixner } static __always_inline -@@ -4281,7 +4281,7 @@ static void hrtick_start_fair(struct rq +@@ -4298,7 +4298,7 @@ static void hrtick_start_fair(struct rq if (delta < 0) { if (rq->curr == p) @@ -404,7 +404,7 @@ Signed-off-by: Thomas Gleixner return; } hrtick_start(rq, delta); -@@ -5421,7 +5421,7 @@ static void check_preempt_wakeup(struct +@@ -5438,7 +5438,7 @@ static void check_preempt_wakeup(struct return; preempt: @@ -413,7 +413,7 @@ Signed-off-by: Thomas Gleixner /* * Only set the backward buddy when the current task is still * on the rq. This can happen when a wakeup gets interleaved -@@ -8172,7 +8172,7 @@ static void task_fork_fair(struct task_s +@@ -8189,7 +8189,7 @@ static void task_fork_fair(struct task_s * 'current' within the tree based on its new key value. */ swap(curr->vruntime, se->vruntime); @@ -422,7 +422,7 @@ Signed-off-by: Thomas Gleixner } se->vruntime -= cfs_rq->min_vruntime; -@@ -8197,7 +8197,7 @@ prio_changed_fair(struct rq *rq, struct +@@ -8214,7 +8214,7 @@ prio_changed_fair(struct rq *rq, struct */ if (rq->curr == p) { if (p->prio > oldprio) diff --git a/debian/patches/features/all/rt/preempt-nort-rt-variants.patch b/debian/patches/features/all/rt/preempt-nort-rt-variants.patch index bb5df056380d..9fc0dc484233 100644 --- a/debian/patches/features/all/rt/preempt-nort-rt-variants.patch +++ b/debian/patches/features/all/rt/preempt-nort-rt-variants.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Fri, 24 Jul 2009 12:38:56 +0200 Subject: preempt: Provide preempt_*_(no)rt variants -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz RT needs a few preempt_disable/enable points which are not necessary otherwise. Implement variants to avoid #ifdeffery. diff --git a/debian/patches/features/all/rt/printk-27force_early_printk-27-boot-param-to-help-with-debugging.patch b/debian/patches/features/all/rt/printk-27force_early_printk-27-boot-param-to-help-with-debugging.patch index 69426d70ffa3..bd277b825f67 100644 --- a/debian/patches/features/all/rt/printk-27force_early_printk-27-boot-param-to-help-with-debugging.patch +++ b/debian/patches/features/all/rt/printk-27force_early_printk-27-boot-param-to-help-with-debugging.patch @@ -1,7 +1,7 @@ Subject: printk: Add "force_early_printk" boot param to help with debugging From: Peter Zijlstra Date: Fri, 02 Sep 2011 14:41:29 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Gives me an option to screw printk and actually see what the machine says. diff --git a/debian/patches/features/all/rt/printk-kill.patch b/debian/patches/features/all/rt/printk-kill.patch index 9bb998200e45..03730a169de5 100644 --- a/debian/patches/features/all/rt/printk-kill.patch +++ b/debian/patches/features/all/rt/printk-kill.patch @@ -1,7 +1,7 @@ Subject: printk: Add a printk kill switch From: Ingo Molnar Date: Fri, 22 Jul 2011 17:58:40 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Add a prinkt-kill-switch. This is used from (NMI) watchdog to ensure that it does not dead-lock with the early printk code. diff --git a/debian/patches/features/all/rt/printk-rt-aware.patch b/debian/patches/features/all/rt/printk-rt-aware.patch index 171814595a11..dcc433db018c 100644 --- a/debian/patches/features/all/rt/printk-rt-aware.patch +++ b/debian/patches/features/all/rt/printk-rt-aware.patch @@ -1,7 +1,7 @@ Subject: printk: Make rt aware From: Thomas Gleixner Date: Wed, 19 Sep 2012 14:50:37 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Drop the lock before calling the console driver and do not disable interrupts while printing to a serial console. diff --git a/debian/patches/features/all/rt/ptrace-fix-ptrace-vs-tasklist_lock-race.patch b/debian/patches/features/all/rt/ptrace-fix-ptrace-vs-tasklist_lock-race.patch index e23d8e363332..579597914fa0 100644 --- a/debian/patches/features/all/rt/ptrace-fix-ptrace-vs-tasklist_lock-race.patch +++ b/debian/patches/features/all/rt/ptrace-fix-ptrace-vs-tasklist_lock-race.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Thu, 29 Aug 2013 18:21:04 +0200 Subject: ptrace: fix ptrace vs tasklist_lock race -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz As explained by Alexander Fyodorov : diff --git a/debian/patches/features/all/rt/radix-tree-rt-aware.patch b/debian/patches/features/all/rt/radix-tree-rt-aware.patch index 200d165b7eaa..5b97aa0d6d4e 100644 --- a/debian/patches/features/all/rt/radix-tree-rt-aware.patch +++ b/debian/patches/features/all/rt/radix-tree-rt-aware.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Sun, 17 Jul 2011 21:33:18 +0200 Subject: radix-tree: Make RT aware -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Disable radix_tree_preload() on -RT. This functions returns with preemption disabled which may cause high latencies and breaks if the diff --git a/debian/patches/features/all/rt/random-make-it-work-on-rt.patch b/debian/patches/features/all/rt/random-make-it-work-on-rt.patch index 1c6752986a5e..8d9898556316 100644 --- a/debian/patches/features/all/rt/random-make-it-work-on-rt.patch +++ b/debian/patches/features/all/rt/random-make-it-work-on-rt.patch @@ -1,7 +1,7 @@ Subject: random: Make it work on rt From: Thomas Gleixner Date: Tue, 21 Aug 2012 20:38:50 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Delegate the random insertion to the forced threaded interrupt handler. Store the return IP of the hard interrupt handler in the irq diff --git a/debian/patches/features/all/rt/rcu-Eliminate-softirq-processing-from-rcutree.patch b/debian/patches/features/all/rt/rcu-Eliminate-softirq-processing-from-rcutree.patch index 530a2cfda2b5..dc3459513b2c 100644 --- a/debian/patches/features/all/rt/rcu-Eliminate-softirq-processing-from-rcutree.patch +++ b/debian/patches/features/all/rt/rcu-Eliminate-softirq-processing-from-rcutree.patch @@ -1,7 +1,7 @@ From: "Paul E. McKenney" Date: Mon, 4 Nov 2013 13:21:10 -0800 Subject: rcu: Eliminate softirq processing from rcutree -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Running RCU out of softirq is a problem for some workloads that would like to manage RCU core processing independently of other softirq work, diff --git a/debian/patches/features/all/rt/rcu-disable-more-spots-of-rcu_bh.patch b/debian/patches/features/all/rt/rcu-disable-more-spots-of-rcu_bh.patch index 48c17f077f59..5bebe8ad3dfc 100644 --- a/debian/patches/features/all/rt/rcu-disable-more-spots-of-rcu_bh.patch +++ b/debian/patches/features/all/rt/rcu-disable-more-spots-of-rcu_bh.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Wed, 10 Feb 2016 18:30:56 +0100 Subject: rcu: disable more spots of rcu_bh -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz We don't use ru_bh on -RT but we still fork a thread for it and keep it as a flavour. No more. diff --git a/debian/patches/features/all/rt/rcu-disable-rcu-fast-no-hz-on-rt.patch b/debian/patches/features/all/rt/rcu-disable-rcu-fast-no-hz-on-rt.patch index e0bdfd0af46d..cd183c1903d3 100644 --- a/debian/patches/features/all/rt/rcu-disable-rcu-fast-no-hz-on-rt.patch +++ b/debian/patches/features/all/rt/rcu-disable-rcu-fast-no-hz-on-rt.patch @@ -1,7 +1,7 @@ Subject: rcu: Disable RCU_FAST_NO_HZ on RT From: Thomas Gleixner Date: Sun, 28 Oct 2012 13:26:09 +0000 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz This uses a timer_list timer from the irq disabled guts of the idle code. Disable it for now to prevent wreckage. diff --git a/debian/patches/features/all/rt/rcu-make-RCU_BOOST-default-on-RT.patch b/debian/patches/features/all/rt/rcu-make-RCU_BOOST-default-on-RT.patch index 5aa4e7062509..0fc1562f7c76 100644 --- a/debian/patches/features/all/rt/rcu-make-RCU_BOOST-default-on-RT.patch +++ b/debian/patches/features/all/rt/rcu-make-RCU_BOOST-default-on-RT.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Fri, 21 Mar 2014 20:19:05 +0100 Subject: rcu: make RCU_BOOST default on RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz 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 diff --git a/debian/patches/features/all/rt/rcu-merge-rcu-bh-into-rcu-preempt-for-rt.patch b/debian/patches/features/all/rt/rcu-merge-rcu-bh-into-rcu-preempt-for-rt.patch index f61e2f2cff80..ca3be5c61249 100644 --- a/debian/patches/features/all/rt/rcu-merge-rcu-bh-into-rcu-preempt-for-rt.patch +++ b/debian/patches/features/all/rt/rcu-merge-rcu-bh-into-rcu-preempt-for-rt.patch @@ -1,7 +1,7 @@ Subject: rcu: Merge RCU-bh into RCU-preempt Date: Wed, 5 Oct 2011 11:59:38 -0700 From: Thomas Gleixner -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz The Linux kernel has long RCU-bh read-side critical sections that intolerably increase scheduling latency under mainline's RCU-bh rules, diff --git a/debian/patches/features/all/rt/rcutorture-comment-out-rcu_bh-ops-on-PREEMPT_RT_FULL.patch b/debian/patches/features/all/rt/rcutorture-comment-out-rcu_bh-ops-on-PREEMPT_RT_FULL.patch index 0797136b494e..b10cd22af95b 100644 --- a/debian/patches/features/all/rt/rcutorture-comment-out-rcu_bh-ops-on-PREEMPT_RT_FULL.patch +++ b/debian/patches/features/all/rt/rcutorture-comment-out-rcu_bh-ops-on-PREEMPT_RT_FULL.patch @@ -1,7 +1,7 @@ From: Clark Williams Date: Fri, 26 Feb 2016 13:19:20 -0600 Subject: rcu/torture: Comment out rcu_bh ops on PREEMPT_RT_FULL -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz RT has dropped support of rcu_bh, comment out in rcutorture. diff --git a/debian/patches/features/all/rt/rcutree-rcu_bh_qs-disable-irq-while-calling-rcu_pree.patch b/debian/patches/features/all/rt/rcutree-rcu_bh_qs-disable-irq-while-calling-rcu_pree.patch index 5e9719b51fc4..4bf53ca25a3a 100644 --- a/debian/patches/features/all/rt/rcutree-rcu_bh_qs-disable-irq-while-calling-rcu_pree.patch +++ b/debian/patches/features/all/rt/rcutree-rcu_bh_qs-disable-irq-while-calling-rcu_pree.patch @@ -1,7 +1,7 @@ From: Tiejun Chen Date: Wed, 18 Dec 2013 17:51:49 +0800 Subject: rcutree/rcu_bh_qs: Disable irq while calling rcu_preempt_qs() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Any callers to the function rcu_preempt_qs() must disable irqs in order to protect the assignment to ->rcu_read_unlock_special. In diff --git a/debian/patches/features/all/rt/re-migrate_disable-race-with-cpu-hotplug-3f.patch b/debian/patches/features/all/rt/re-migrate_disable-race-with-cpu-hotplug-3f.patch index 8e3c3178686f..060bc0a411d8 100644 --- a/debian/patches/features/all/rt/re-migrate_disable-race-with-cpu-hotplug-3f.patch +++ b/debian/patches/features/all/rt/re-migrate_disable-race-with-cpu-hotplug-3f.patch @@ -1,7 +1,7 @@ From: Yong Zhang Date: Thu, 28 Jul 2011 11:16:00 +0800 Subject: hotplug: Reread hotplug_pcp on pin_current_cpu() retry -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz When retry happens, it's likely that the task has been migrated to another cpu (except unplug failed), but it still derefernces the diff --git a/debian/patches/features/all/rt/re-preempt_rt_full-arm-coredump-fails-for-cpu-3e-3d-4.patch b/debian/patches/features/all/rt/re-preempt_rt_full-arm-coredump-fails-for-cpu-3e-3d-4.patch index 9125aaa57544..9a704809ba86 100644 --- a/debian/patches/features/all/rt/re-preempt_rt_full-arm-coredump-fails-for-cpu-3e-3d-4.patch +++ b/debian/patches/features/all/rt/re-preempt_rt_full-arm-coredump-fails-for-cpu-3e-3d-4.patch @@ -1,7 +1,7 @@ Subject: ARM: Initialize split page table locks for vector page From: Frank Rowand Date: Sat, 1 Oct 2011 18:58:13 -0700 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Without this patch, ARM can not use SPLIT_PTLOCK_CPUS if PREEMPT_RT_FULL=y because vectors_user_mapping() creates a diff --git a/debian/patches/features/all/rt/relay-fix-timer-madness.patch b/debian/patches/features/all/rt/relay-fix-timer-madness.patch index cf21d35e0092..bf2c5118945e 100644 --- a/debian/patches/features/all/rt/relay-fix-timer-madness.patch +++ b/debian/patches/features/all/rt/relay-fix-timer-madness.patch @@ -1,7 +1,7 @@ From: Ingo Molnar Date: Fri, 3 Jul 2009 08:44:07 -0500 Subject: relay: Fix timer madness -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz remove timer calls (!!!) from deep within the tracing infrastructure. This was totally bogus code that can cause lockups and worse. Poll diff --git a/debian/patches/features/all/rt/rfc-arm-smp-__cpu_disable-fix-sleeping-function-called-from-invalid-context.patch b/debian/patches/features/all/rt/rfc-arm-smp-__cpu_disable-fix-sleeping-function-called-from-invalid-context.patch index 1321ae3476e5..f357ce83d5d0 100644 --- a/debian/patches/features/all/rt/rfc-arm-smp-__cpu_disable-fix-sleeping-function-called-from-invalid-context.patch +++ b/debian/patches/features/all/rt/rfc-arm-smp-__cpu_disable-fix-sleeping-function-called-from-invalid-context.patch @@ -1,7 +1,7 @@ Subject: ARM: smp: Move clear_tasks_mm_cpumask() call to __cpu_die() From: Grygorii Strashko Date: Fri, 11 Sep 2015 21:21:23 +0300 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz When running with the RT-kernel (4.1.5-rt5) on TI OMAP dra7-evm and trying to do Suspend to RAM, the following backtrace occurs: diff --git a/debian/patches/features/all/rt/rt-add-rt-locks.patch b/debian/patches/features/all/rt/rt-add-rt-locks.patch index fc082e083949..8a9f323a609f 100644 --- a/debian/patches/features/all/rt/rt-add-rt-locks.patch +++ b/debian/patches/features/all/rt/rt-add-rt-locks.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Sun, 26 Jul 2009 19:39:56 +0200 Subject: rt: Add the preempt-rt lock replacement APIs -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Map spinlocks, rwlocks, rw_semaphores and semaphores to the rt_mutex based locking functions for preempt-rt. @@ -912,7 +912,7 @@ Signed-off-by: Thomas Gleixner +#endif --- a/kernel/futex.c +++ b/kernel/futex.c -@@ -1263,6 +1263,7 @@ static int wake_futex_pi(u32 __user *uad +@@ -1271,6 +1271,7 @@ static int wake_futex_pi(u32 __user *uad struct futex_pi_state *pi_state = this->pi_state; u32 uninitialized_var(curval), newval; WAKE_Q(wake_q); @@ -920,7 +920,7 @@ Signed-off-by: Thomas Gleixner bool deboost; int ret = 0; -@@ -1329,7 +1330,8 @@ static int wake_futex_pi(u32 __user *uad +@@ -1337,7 +1338,8 @@ static int wake_futex_pi(u32 __user *uad raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock); @@ -930,7 +930,7 @@ Signed-off-by: Thomas Gleixner /* * First unlock HB so the waiter does not spin on it once he got woken -@@ -1339,6 +1341,7 @@ static int wake_futex_pi(u32 __user *uad +@@ -1347,6 +1349,7 @@ static int wake_futex_pi(u32 __user *uad */ spin_unlock(&hb->lock); wake_up_q(&wake_q); @@ -938,7 +938,7 @@ Signed-off-by: Thomas Gleixner if (deboost) rt_mutex_adjust_prio(current); -@@ -2813,10 +2816,7 @@ static int futex_wait_requeue_pi(u32 __u +@@ -2821,10 +2824,7 @@ static int futex_wait_requeue_pi(u32 __u * The waiter is allocated on our stack, manipulated by the requeue * code while we sleep on uaddr. */ diff --git a/debian/patches/features/all/rt/rt-introduce-cpu-chill.patch b/debian/patches/features/all/rt/rt-introduce-cpu-chill.patch index 32d236811b01..a7d9d3c5c2ee 100644 --- a/debian/patches/features/all/rt/rt-introduce-cpu-chill.patch +++ b/debian/patches/features/all/rt/rt-introduce-cpu-chill.patch @@ -1,7 +1,7 @@ Subject: rt: Introduce cpu_chill() From: Thomas Gleixner Date: Wed, 07 Mar 2012 20:51:03 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Retry loops on RT might loop forever when the modifying side was preempted. Add cpu_chill() to replace cpu_relax(). cpu_chill() diff --git a/debian/patches/features/all/rt/rt-local-irq-lock.patch b/debian/patches/features/all/rt/rt-local-irq-lock.patch index ddb890c5c3ee..f523db5c698a 100644 --- a/debian/patches/features/all/rt/rt-local-irq-lock.patch +++ b/debian/patches/features/all/rt/rt-local-irq-lock.patch @@ -1,7 +1,7 @@ Subject: rt: Add local irq locks From: Thomas Gleixner Date: Mon, 20 Jun 2011 09:03:47 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Introduce locallock. For !RT this maps to preempt_disable()/ local_irq_disable() so there is not much that changes. For RT this will diff --git a/debian/patches/features/all/rt/rt-locking-Reenable-migration-accross-schedule.patch b/debian/patches/features/all/rt/rt-locking-Reenable-migration-accross-schedule.patch index 66b2ac63074e..af3dadcd6405 100644 --- a/debian/patches/features/all/rt/rt-locking-Reenable-migration-accross-schedule.patch +++ b/debian/patches/features/all/rt/rt-locking-Reenable-migration-accross-schedule.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Mon, 8 Feb 2016 16:15:28 +0100 Subject: rt/locking: Reenable migration accross schedule -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz We currently disable migration across lock acquisition. That includes the part where we block on the lock and schedule out. We cannot disable migration after diff --git a/debian/patches/features/all/rt/rt-preempt-base-config.patch b/debian/patches/features/all/rt/rt-preempt-base-config.patch index 56a41b020c80..d515e96e1ae9 100644 --- a/debian/patches/features/all/rt/rt-preempt-base-config.patch +++ b/debian/patches/features/all/rt/rt-preempt-base-config.patch @@ -1,7 +1,7 @@ Subject: rt: Provide PREEMPT_RT_BASE config switch From: Thomas Gleixner Date: Fri, 17 Jun 2011 12:39:57 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Introduce PREEMPT_RT_BASE which enables parts of PREEMPT_RT_FULL. Forces interrupt threading and enables some of the RT diff --git a/debian/patches/features/all/rt/rt-serial-warn-fix.patch b/debian/patches/features/all/rt/rt-serial-warn-fix.patch index efb9542a53f1..b123ca1ee66f 100644 --- a/debian/patches/features/all/rt/rt-serial-warn-fix.patch +++ b/debian/patches/features/all/rt/rt-serial-warn-fix.patch @@ -1,7 +1,7 @@ Subject: rt: Improve the serial console PASS_LIMIT From: Ingo Molnar Date: Wed Dec 14 13:05:54 CET 2011 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Beyond the warning: diff --git a/debian/patches/features/all/rt/rtmutex--Handle-non-enqueued-waiters-gracefully.patch b/debian/patches/features/all/rt/rtmutex--Handle-non-enqueued-waiters-gracefully.patch index 88226a138b9a..0d566340c2de 100644 --- a/debian/patches/features/all/rt/rtmutex--Handle-non-enqueued-waiters-gracefully.patch +++ b/debian/patches/features/all/rt/rtmutex--Handle-non-enqueued-waiters-gracefully.patch @@ -1,7 +1,7 @@ Subject: rtmutex: Handle non enqueued waiters gracefully From: Thomas Gleixner Date: Fri, 06 Nov 2015 18:51:03 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Yimin debugged that in case of a PI wakeup in progress when rt_mutex_start_proxy_lock() calls task_blocks_on_rt_mutex() the latter diff --git a/debian/patches/features/all/rt/rtmutex-Use-chainwalking-control-enum.patch b/debian/patches/features/all/rt/rtmutex-Use-chainwalking-control-enum.patch index a0322682c038..ca714da4e473 100644 --- a/debian/patches/features/all/rt/rtmutex-Use-chainwalking-control-enum.patch +++ b/debian/patches/features/all/rt/rtmutex-Use-chainwalking-control-enum.patch @@ -1,7 +1,7 @@ From: "bmouring@ni.com" Date: Tue, 15 Dec 2015 17:07:30 -0600 Subject: rtmutex: Use chainwalking control enum -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz In 8930ed80 (rtmutex: Cleanup deadlock detector debug logic), chainwalking control enums were introduced to limit the deadlock diff --git a/debian/patches/features/all/rt/rtmutex-add-a-first-shot-of-ww_mutex.patch b/debian/patches/features/all/rt/rtmutex-add-a-first-shot-of-ww_mutex.patch index 9161ed81ac0c..54fa7ac37005 100644 --- a/debian/patches/features/all/rt/rtmutex-add-a-first-shot-of-ww_mutex.patch +++ b/debian/patches/features/all/rt/rtmutex-add-a-first-shot-of-ww_mutex.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Mon, 28 Oct 2013 09:36:37 +0100 Subject: rtmutex: Add RT aware ww locks -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz lockdep says: | -------------------------------------------------------------------------- diff --git a/debian/patches/features/all/rt/rtmutex-avoid-include-hell.patch b/debian/patches/features/all/rt/rtmutex-avoid-include-hell.patch index f3ad3bddb854..2425e76e9642 100644 --- a/debian/patches/features/all/rt/rtmutex-avoid-include-hell.patch +++ b/debian/patches/features/all/rt/rtmutex-avoid-include-hell.patch @@ -1,7 +1,7 @@ Subject: rtmutex: Avoid include hell From: Thomas Gleixner Date: Wed, 29 Jun 2011 20:06:39 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Include only the required raw types. This avoids pulling in the complete spinlock header which in turn requires rtmutex.h at some point. diff --git a/debian/patches/features/all/rt/rtmutex-futex-prepare-rt.patch b/debian/patches/features/all/rt/rtmutex-futex-prepare-rt.patch index 98494514a61d..58c7e9614b21 100644 --- a/debian/patches/features/all/rt/rtmutex-futex-prepare-rt.patch +++ b/debian/patches/features/all/rt/rtmutex-futex-prepare-rt.patch @@ -1,7 +1,7 @@ Subject: rtmutex: Handle the various new futex race conditions From: Thomas Gleixner Date: Fri, 10 Jun 2011 11:04:15 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz RT opens a few new interesting race conditions in the rtmutex/futex combo due to futex hash bucket lock being a 'sleeping' spinlock and @@ -16,7 +16,7 @@ Signed-off-by: Thomas Gleixner --- a/kernel/futex.c +++ b/kernel/futex.c -@@ -1886,6 +1886,16 @@ static int futex_requeue(u32 __user *uad +@@ -1894,6 +1894,16 @@ static int futex_requeue(u32 __user *uad requeue_pi_wake_futex(this, &key2, hb2); drop_count++; continue; @@ -33,7 +33,7 @@ Signed-off-by: Thomas Gleixner } else if (ret) { /* * rt_mutex_start_proxy_lock() detected a -@@ -2776,7 +2786,7 @@ static int futex_wait_requeue_pi(u32 __u +@@ -2784,7 +2794,7 @@ static int futex_wait_requeue_pi(u32 __u struct hrtimer_sleeper timeout, *to = NULL; struct rt_mutex_waiter rt_waiter; struct rt_mutex *pi_mutex = NULL; @@ -42,7 +42,7 @@ Signed-off-by: Thomas Gleixner union futex_key key2 = FUTEX_KEY_INIT; struct futex_q q = futex_q_init; int res, ret; -@@ -2835,20 +2845,55 @@ static int futex_wait_requeue_pi(u32 __u +@@ -2843,20 +2853,55 @@ static int futex_wait_requeue_pi(u32 __u /* Queue the futex_q, drop the hb lock, wait for wakeup. */ futex_wait_queue_me(hb, &q, to); @@ -109,7 +109,7 @@ Signed-off-by: Thomas Gleixner /* Check if the requeue code acquired the second futex for us. */ if (!q.rt_waiter) { -@@ -2857,14 +2902,15 @@ static int futex_wait_requeue_pi(u32 __u +@@ -2865,14 +2910,15 @@ static int futex_wait_requeue_pi(u32 __u * did a lock-steal - fix up the PI-state in that case. */ if (q.pi_state && (q.pi_state->owner != current)) { @@ -127,7 +127,7 @@ Signed-off-by: Thomas Gleixner } } else { /* -@@ -2877,7 +2923,8 @@ static int futex_wait_requeue_pi(u32 __u +@@ -2885,7 +2931,8 @@ static int futex_wait_requeue_pi(u32 __u ret = rt_mutex_finish_proxy_lock(pi_mutex, to, &rt_waiter); debug_rt_mutex_free_waiter(&rt_waiter); diff --git a/debian/patches/features/all/rt/rtmutex-lock-killable.patch b/debian/patches/features/all/rt/rtmutex-lock-killable.patch index aeed7b5742cb..2159d22aa7de 100644 --- a/debian/patches/features/all/rt/rtmutex-lock-killable.patch +++ b/debian/patches/features/all/rt/rtmutex-lock-killable.patch @@ -1,7 +1,7 @@ Subject: rtmutex: Add rtmutex_lock_killable() From: Thomas Gleixner Date: Thu, 09 Jun 2011 11:43:52 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Add "killable" type to rtmutex. We need this since rtmutex are used as "normal" mutexes which do use this type. diff --git a/debian/patches/features/all/rt/rtmutex-push-down-migrate_disable-into-rt_spin_lock.patch b/debian/patches/features/all/rt/rtmutex-push-down-migrate_disable-into-rt_spin_lock.patch index d0cdbc8d4b73..3a519041c7b9 100644 --- a/debian/patches/features/all/rt/rtmutex-push-down-migrate_disable-into-rt_spin_lock.patch +++ b/debian/patches/features/all/rt/rtmutex-push-down-migrate_disable-into-rt_spin_lock.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Fri, 5 Feb 2016 18:26:11 +0100 Subject: rtmutex: push down migrate_disable() into rt_spin_lock() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz No point in having the migrate disable/enable invocations in all the macro/inlines. That's just more code for no win as we do a function diff --git a/debian/patches/features/all/rt/rtmutex-trylock-is-okay-on-RT.patch b/debian/patches/features/all/rt/rtmutex-trylock-is-okay-on-RT.patch index 3ec82dfbba5b..e2a7559fd6a3 100644 --- a/debian/patches/features/all/rt/rtmutex-trylock-is-okay-on-RT.patch +++ b/debian/patches/features/all/rt/rtmutex-trylock-is-okay-on-RT.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Wed 02 Dec 2015 11:34:07 +0100 Subject: rtmutex: trylock is okay on -RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz 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 diff --git a/debian/patches/features/all/rt/rtmutex_dont_include_rcu.patch b/debian/patches/features/all/rt/rtmutex_dont_include_rcu.patch index 70633f419286..543ef8ccd7b4 100644 --- a/debian/patches/features/all/rt/rtmutex_dont_include_rcu.patch +++ b/debian/patches/features/all/rt/rtmutex_dont_include_rcu.patch @@ -1,6 +1,6 @@ From: Sebastian Andrzej Siewior Subject: rbtree: don't include the rcu header -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz The RCU header pulls in spinlock.h and fails due not yet defined types: diff --git a/debian/patches/features/all/rt/sas-ata-isci-dont-t-disable-interrupts-in-qc_issue-h.patch b/debian/patches/features/all/rt/sas-ata-isci-dont-t-disable-interrupts-in-qc_issue-h.patch index a31dfec97be0..9a4a2c9bcdc6 100644 --- a/debian/patches/features/all/rt/sas-ata-isci-dont-t-disable-interrupts-in-qc_issue-h.patch +++ b/debian/patches/features/all/rt/sas-ata-isci-dont-t-disable-interrupts-in-qc_issue-h.patch @@ -1,7 +1,7 @@ From: Paul Gortmaker Date: Sat, 14 Feb 2015 11:01:16 -0500 Subject: sas-ata/isci: dont't disable interrupts in qc_issue handler -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz On 3.14-rt we see the following trace on Canoe Pass for SCSI_ISCI "Intel(R) C600 Series Chipset SAS Controller" diff --git a/debian/patches/features/all/rt/sc16is7xx_Drop_bogus_use_of_IRQF_ONESHOT.patch b/debian/patches/features/all/rt/sc16is7xx_Drop_bogus_use_of_IRQF_ONESHOT.patch index b94ac8a3755c..e7540a4f4383 100644 --- a/debian/patches/features/all/rt/sc16is7xx_Drop_bogus_use_of_IRQF_ONESHOT.patch +++ b/debian/patches/features/all/rt/sc16is7xx_Drop_bogus_use_of_IRQF_ONESHOT.patch @@ -1,7 +1,7 @@ Subject: sc16is7xx: Drop bogus use of IRQF_ONESHOT From: Josh Cartwright Date: Thu, 18 Feb 2016 11:26:12 -0600 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz The use of IRQF_ONESHOT when registering an interrupt handler with request_irq() is non-sensical. diff --git a/debian/patches/features/all/rt/sched-deadline-dl_task_timer-has-to-be-irqsafe.patch b/debian/patches/features/all/rt/sched-deadline-dl_task_timer-has-to-be-irqsafe.patch index 463fd1c71cd7..52cf6404508f 100644 --- a/debian/patches/features/all/rt/sched-deadline-dl_task_timer-has-to-be-irqsafe.patch +++ b/debian/patches/features/all/rt/sched-deadline-dl_task_timer-has-to-be-irqsafe.patch @@ -1,7 +1,7 @@ From: Juri Lelli Date: Tue, 13 May 2014 15:30:20 +0200 Subject: sched/deadline: dl_task_timer has to be irqsafe -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz As for rt_period_timer, dl_task_timer has to be irqsafe. diff --git a/debian/patches/features/all/rt/sched-delay-put-task.patch b/debian/patches/features/all/rt/sched-delay-put-task.patch index ab8dbc2231c1..9d14f19231c9 100644 --- a/debian/patches/features/all/rt/sched-delay-put-task.patch +++ b/debian/patches/features/all/rt/sched-delay-put-task.patch @@ -1,7 +1,7 @@ Subject: sched: Move task_struct cleanup to RCU From: Thomas Gleixner Date: Tue, 31 May 2011 16:59:16 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz __put_task_struct() does quite some expensive work. We don't want to burden random tasks with that. diff --git a/debian/patches/features/all/rt/sched-disable-rt-group-sched-on-rt.patch b/debian/patches/features/all/rt/sched-disable-rt-group-sched-on-rt.patch index a901eda5232e..fc1cc1899ce6 100644 --- a/debian/patches/features/all/rt/sched-disable-rt-group-sched-on-rt.patch +++ b/debian/patches/features/all/rt/sched-disable-rt-group-sched-on-rt.patch @@ -1,7 +1,7 @@ Subject: sched: Disable CONFIG_RT_GROUP_SCHED on RT From: Thomas Gleixner Date: Mon, 18 Jul 2011 17:03:52 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Carsten reported problems when running: diff --git a/debian/patches/features/all/rt/sched-disable-ttwu-queue.patch b/debian/patches/features/all/rt/sched-disable-ttwu-queue.patch index 235106f77b9f..ae41186f3a3f 100644 --- a/debian/patches/features/all/rt/sched-disable-ttwu-queue.patch +++ b/debian/patches/features/all/rt/sched-disable-ttwu-queue.patch @@ -1,7 +1,7 @@ Subject: sched: Disable TTWU_QUEUE on RT From: Thomas Gleixner Date: Tue, 13 Sep 2011 16:42:35 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz The queued remote wakeup mechanism can introduce rather large latencies if the number of migrated tasks is high. Disable it for RT. diff --git a/debian/patches/features/all/rt/sched-lazy_preempt-avoid-a-warning-in-the-RT-case.patch b/debian/patches/features/all/rt/sched-lazy_preempt-avoid-a-warning-in-the-RT-case.patch new file mode 100644 index 000000000000..cc179eed9e65 --- /dev/null +++ b/debian/patches/features/all/rt/sched-lazy_preempt-avoid-a-warning-in-the-RT-case.patch @@ -0,0 +1,21 @@ +From: Sebastian Andrzej Siewior +Date: Thu, 14 Jul 2016 14:57:07 +0200 +Subject: [PATCH] sched: lazy_preempt: avoid a warning in the !RT case +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz + +Signed-off-by: Sebastian Andrzej Siewior +--- + kernel/sched/core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/kernel/sched/core.c ++++ b/kernel/sched/core.c +@@ -3518,7 +3518,7 @@ static __always_inline int preemptible_l + + #else + +-static int preemptible_lazy(void) ++static inline int preemptible_lazy(void) + { + return 1; + } diff --git a/debian/patches/features/all/rt/sched-limit-nr-migrate.patch b/debian/patches/features/all/rt/sched-limit-nr-migrate.patch index 4eb11d9c2dbd..afc50efdf67e 100644 --- a/debian/patches/features/all/rt/sched-limit-nr-migrate.patch +++ b/debian/patches/features/all/rt/sched-limit-nr-migrate.patch @@ -1,7 +1,7 @@ Subject: sched: Limit the number of task migrations per batch From: Thomas Gleixner Date: Mon, 06 Jun 2011 12:12:51 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Put an upper limit on the number of tasks which are migrated per batch to avoid large latencies. diff --git a/debian/patches/features/all/rt/sched-might-sleep-do-not-account-rcu-depth.patch b/debian/patches/features/all/rt/sched-might-sleep-do-not-account-rcu-depth.patch index eb585c483dc1..115ee97d1a05 100644 --- a/debian/patches/features/all/rt/sched-might-sleep-do-not-account-rcu-depth.patch +++ b/debian/patches/features/all/rt/sched-might-sleep-do-not-account-rcu-depth.patch @@ -1,7 +1,7 @@ Subject: sched: Do not account rcu_preempt_depth on RT in might_sleep() From: Thomas Gleixner Date: Tue, 07 Jun 2011 09:19:06 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz RT changes the rcu_preempt_depth semantics, so we cannot check for it in might_sleep(). diff --git a/debian/patches/features/all/rt/sched-mmdrop-delayed.patch b/debian/patches/features/all/rt/sched-mmdrop-delayed.patch index faa23af9eeee..ad9c71842b14 100644 --- a/debian/patches/features/all/rt/sched-mmdrop-delayed.patch +++ b/debian/patches/features/all/rt/sched-mmdrop-delayed.patch @@ -1,7 +1,7 @@ Subject: sched: Move mmdrop to RCU on RT From: Thomas Gleixner Date: Mon, 06 Jun 2011 12:20:33 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Takes sleeping locks and calls into the memory allocator, so nothing we want to do in task switch and oder atomic contexts. diff --git a/debian/patches/features/all/rt/sched-preempt-Fix-preempt_count-manipulations.patch b/debian/patches/features/all/rt/sched-preempt-Fix-preempt_count-manipulations.patch index 9dd528ba150a..5892855aa926 100644 --- a/debian/patches/features/all/rt/sched-preempt-Fix-preempt_count-manipulations.patch +++ b/debian/patches/features/all/rt/sched-preempt-Fix-preempt_count-manipulations.patch @@ -1,7 +1,7 @@ From: Peter Zijlstra Date: Mon, 16 May 2016 15:01:11 +0200 Subject: [PATCH] sched,preempt: Fix preempt_count manipulations -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Vikram reported that his ARM64 compiler managed to 'optimize' away the preempt_count manipulations in code like: diff --git a/debian/patches/features/all/rt/sched-provide-a-tsk_nr_cpus_allowed-helper.patch b/debian/patches/features/all/rt/sched-provide-a-tsk_nr_cpus_allowed-helper.patch index 5ec43ab8abac..a4256ce33695 100644 --- a/debian/patches/features/all/rt/sched-provide-a-tsk_nr_cpus_allowed-helper.patch +++ b/debian/patches/features/all/rt/sched-provide-a-tsk_nr_cpus_allowed-helper.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Mon, 18 Jan 2016 17:21:59 +0100 Subject: sched: provide a tsk_nr_cpus_allowed() helper -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz tsk_nr_cpus_allowed() is an accessor for task->nr_cpus_allowed which allows us to change the representation of ->nr_cpus_allowed if required. diff --git a/debian/patches/features/all/rt/sched-rt-mutex-wakeup.patch b/debian/patches/features/all/rt/sched-rt-mutex-wakeup.patch index 9eacc8815ff1..fe6d7c2665e3 100644 --- a/debian/patches/features/all/rt/sched-rt-mutex-wakeup.patch +++ b/debian/patches/features/all/rt/sched-rt-mutex-wakeup.patch @@ -1,7 +1,7 @@ Subject: sched: Add saved_state for tasks blocked on sleeping locks From: Thomas Gleixner Date: Sat, 25 Jun 2011 09:21:04 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz 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 diff --git a/debian/patches/features/all/rt/sched-ttwu-ensure-success-return-is-correct.patch b/debian/patches/features/all/rt/sched-ttwu-ensure-success-return-is-correct.patch index bad92dcb7a27..d6b3e8f5c463 100644 --- a/debian/patches/features/all/rt/sched-ttwu-ensure-success-return-is-correct.patch +++ b/debian/patches/features/all/rt/sched-ttwu-ensure-success-return-is-correct.patch @@ -1,7 +1,7 @@ Subject: sched: ttwu: Return success when only changing the saved_state value From: Thomas Gleixner Date: Tue, 13 Dec 2011 21:42:19 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz When a task blocks on a rt lock, it saves the current state in p->saved_state, so a lock related wake up will not destroy the diff --git a/debian/patches/features/all/rt/sched-use-tsk_cpus_allowed-instead-of-accessing-cpus.patch b/debian/patches/features/all/rt/sched-use-tsk_cpus_allowed-instead-of-accessing-cpus.patch index ace33a324590..73aa39eb23b6 100644 --- a/debian/patches/features/all/rt/sched-use-tsk_cpus_allowed-instead-of-accessing-cpus.patch +++ b/debian/patches/features/all/rt/sched-use-tsk_cpus_allowed-instead-of-accessing-cpus.patch @@ -2,7 +2,7 @@ From: Thomas Gleixner Date: Mon, 18 Jan 2016 17:10:39 +0100 Subject: sched: use tsk_cpus_allowed() instead of accessing ->cpus_allowed -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Use the future-safe accessor for struct task_struct's. diff --git a/debian/patches/features/all/rt/sched-workqueue-Only-wake-up-idle-workers-if-not-blo.patch b/debian/patches/features/all/rt/sched-workqueue-Only-wake-up-idle-workers-if-not-blo.patch index a7578f215daa..f304c4680a87 100644 --- a/debian/patches/features/all/rt/sched-workqueue-Only-wake-up-idle-workers-if-not-blo.patch +++ b/debian/patches/features/all/rt/sched-workqueue-Only-wake-up-idle-workers-if-not-blo.patch @@ -1,7 +1,7 @@ From: Steven Rostedt Date: Mon, 18 Mar 2013 15:12:49 -0400 Subject: 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.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz In -rt, most spin_locks() turn into mutexes. One of these spin_lock conversions is performed on the workqueue gcwq->lock. When the idle diff --git a/debian/patches/features/all/rt/scsi-fcoe-Fix-get_cpu-put_cpu_light-imbalance-in-fco.patch b/debian/patches/features/all/rt/scsi-fcoe-Fix-get_cpu-put_cpu_light-imbalance-in-fco.patch new file mode 100644 index 000000000000..af104175ad69 --- /dev/null +++ b/debian/patches/features/all/rt/scsi-fcoe-Fix-get_cpu-put_cpu_light-imbalance-in-fco.patch @@ -0,0 +1,28 @@ +From: Mike Galbraith +Date: Thu, 28 Jul 2016 06:04:49 +0200 +Subject: [PATCH] scsi/fcoe: Fix get_cpu()/put_cpu_light() imbalance in + fcoe_recv_frame() +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz + +During master->rt merge, I stumbled across the buglet below. + +Fix get_cpu()/put_cpu_light() imbalance. + +Cc: stable-rt@vger.kernel.org +Signed-off-by: Mike Gabraith +Signed-off-by: Sebastian Andrzej Siewior +--- + drivers/scsi/fcoe/fcoe.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/scsi/fcoe/fcoe.c ++++ b/drivers/scsi/fcoe/fcoe.c +@@ -1814,7 +1814,7 @@ static void fcoe_recv_frame(struct sk_bu + */ + hp = (struct fcoe_hdr *) skb_network_header(skb); + +- stats = per_cpu_ptr(lport->stats, get_cpu()); ++ stats = per_cpu_ptr(lport->stats, get_cpu_light()); + if (unlikely(FC_FCOE_DECAPS_VER(hp) != FC_FCOE_VER)) { + if (stats->ErrorFrames < 5) + printk(KERN_WARNING "fcoe: FCoE version " diff --git a/debian/patches/features/all/rt/scsi-fcoe-rt-aware.patch b/debian/patches/features/all/rt/scsi-fcoe-rt-aware.patch index 04a1ea17b922..400c4f3343c5 100644 --- a/debian/patches/features/all/rt/scsi-fcoe-rt-aware.patch +++ b/debian/patches/features/all/rt/scsi-fcoe-rt-aware.patch @@ -1,7 +1,7 @@ Subject: scsi/fcoe: Make RT aware. From: Thomas Gleixner Date: Sat, 12 Nov 2011 14:00:48 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Do not disable preemption while taking sleeping locks. All user look safe for migrate_diable() only. diff --git a/debian/patches/features/all/rt/scsi-qla2xxx-fix-bug-sleeping-function-called-from-invalid-context.patch b/debian/patches/features/all/rt/scsi-qla2xxx-fix-bug-sleeping-function-called-from-invalid-context.patch index 7a6733933a0e..3e513bc86757 100644 --- a/debian/patches/features/all/rt/scsi-qla2xxx-fix-bug-sleeping-function-called-from-invalid-context.patch +++ b/debian/patches/features/all/rt/scsi-qla2xxx-fix-bug-sleeping-function-called-from-invalid-context.patch @@ -1,7 +1,7 @@ Subject: scsi: qla2xxx: Use local_irq_save_nort() in qla2x00_poll From: John Kacur Date: Fri, 27 Apr 2012 12:48:46 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz RT triggers the following: diff --git a/debian/patches/features/all/rt/seqlock-prevent-rt-starvation.patch b/debian/patches/features/all/rt/seqlock-prevent-rt-starvation.patch index 21258b87d2a4..430ff0c70d00 100644 --- a/debian/patches/features/all/rt/seqlock-prevent-rt-starvation.patch +++ b/debian/patches/features/all/rt/seqlock-prevent-rt-starvation.patch @@ -1,7 +1,7 @@ Subject: seqlock: Prevent rt starvation From: Thomas Gleixner Date: Wed, 22 Feb 2012 12:03:30 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz If a low prio writer gets preempted while holding the seqlock write locked, a high prio reader spins forever on RT. diff --git a/debian/patches/features/all/rt/signal-Use-hrtimer-for-sigtimedwait.patch b/debian/patches/features/all/rt/signal-Use-hrtimer-for-sigtimedwait.patch new file mode 100644 index 000000000000..a0aaa755247f --- /dev/null +++ b/debian/patches/features/all/rt/signal-Use-hrtimer-for-sigtimedwait.patch @@ -0,0 +1,78 @@ +From: Thomas Gleixner +Date: Mon, 4 Jul 2016 09:50:25 +0000 +Subject: [PATCH 10/22] signal: Use hrtimer for sigtimedwait +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz + +We've converted most timeout related syscalls to hrtimers. sigtimedwait() did +not get this treatment. Convert it so we get a reasonable accuracy and remove +the user space exposure to the timer wheel properties. + +Signed-off-by: Thomas Gleixner +Reviewed-by: Frederic Weisbecker +Cc: Cyril Hrubis +Signed-off-by: Sebastian Andrzej Siewior +--- + kernel/signal.c | 24 ++++++++++-------------- + 1 file changed, 10 insertions(+), 14 deletions(-) + +--- a/kernel/signal.c ++++ b/kernel/signal.c +@@ -2751,23 +2751,18 @@ int copy_siginfo_to_user(siginfo_t __use + * @ts: upper bound on process time suspension + */ + int do_sigtimedwait(const sigset_t *which, siginfo_t *info, +- const struct timespec *ts) ++ const struct timespec *ts) + { ++ ktime_t *to = NULL, timeout = { .tv64 = KTIME_MAX }; + struct task_struct *tsk = current; +- long timeout = MAX_SCHEDULE_TIMEOUT; + sigset_t mask = *which; +- int sig; ++ int sig, ret = 0; + + if (ts) { + if (!timespec_valid(ts)) + return -EINVAL; +- timeout = timespec_to_jiffies(ts); +- /* +- * We can be close to the next tick, add another one +- * to ensure we will wait at least the time asked for. +- */ +- if (ts->tv_sec || ts->tv_nsec) +- timeout++; ++ timeout = timespec_to_ktime(*ts); ++ to = &timeout; + } + + /* +@@ -2778,7 +2773,7 @@ int do_sigtimedwait(const sigset_t *whic + + spin_lock_irq(&tsk->sighand->siglock); + sig = dequeue_signal(tsk, &mask, info); +- if (!sig && timeout) { ++ if (!sig && timeout.tv64) { + /* + * None ready, temporarily unblock those we're interested + * while we are sleeping in so that we'll be awakened when +@@ -2790,8 +2785,9 @@ int do_sigtimedwait(const sigset_t *whic + recalc_sigpending(); + spin_unlock_irq(&tsk->sighand->siglock); + +- timeout = freezable_schedule_timeout_interruptible(timeout); +- ++ __set_current_state(TASK_INTERRUPTIBLE); ++ ret = freezable_schedule_hrtimeout_range(to, tsk->timer_slack_ns, ++ HRTIMER_MODE_REL); + spin_lock_irq(&tsk->sighand->siglock); + __set_task_blocked(tsk, &tsk->real_blocked); + sigemptyset(&tsk->real_blocked); +@@ -2801,7 +2797,7 @@ int do_sigtimedwait(const sigset_t *whic + + if (sig) + return sig; +- return timeout ? -EINTR : -EAGAIN; ++ return ret ? -EINTR : -EAGAIN; + } + + /** diff --git a/debian/patches/features/all/rt/signal-fix-up-rcu-wreckage.patch b/debian/patches/features/all/rt/signal-fix-up-rcu-wreckage.patch index ddd1cef0efb2..48c4a47424fc 100644 --- a/debian/patches/features/all/rt/signal-fix-up-rcu-wreckage.patch +++ b/debian/patches/features/all/rt/signal-fix-up-rcu-wreckage.patch @@ -1,7 +1,7 @@ Subject: signal: Make __lock_task_sighand() RT aware From: Thomas Gleixner Date: Fri, 22 Jul 2011 08:07:08 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz local_irq_save() + spin_lock(&sighand->siglock) does not work on -RT. Use the nort variants. diff --git a/debian/patches/features/all/rt/signal-revert-ptrace-preempt-magic.patch b/debian/patches/features/all/rt/signal-revert-ptrace-preempt-magic.patch index 583eb4857cd6..cd4094414ad3 100644 --- a/debian/patches/features/all/rt/signal-revert-ptrace-preempt-magic.patch +++ b/debian/patches/features/all/rt/signal-revert-ptrace-preempt-magic.patch @@ -1,7 +1,7 @@ Subject: signal: Revert ptrace preempt magic From: Thomas Gleixner Date: Wed, 21 Sep 2011 19:57:12 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Upstream commit '53da1d9456fe7f8 fix ptrace slowness' is nothing more than a bandaid around the ptrace design trainwreck. It's not a diff --git a/debian/patches/features/all/rt/signals-allow-rt-tasks-to-cache-one-sigqueue-struct.patch b/debian/patches/features/all/rt/signals-allow-rt-tasks-to-cache-one-sigqueue-struct.patch index eca4d9f63e7e..00cc24447487 100644 --- a/debian/patches/features/all/rt/signals-allow-rt-tasks-to-cache-one-sigqueue-struct.patch +++ b/debian/patches/features/all/rt/signals-allow-rt-tasks-to-cache-one-sigqueue-struct.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Fri, 3 Jul 2009 08:44:56 -0500 Subject: signals: Allow rt tasks to cache one sigqueue struct -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz To avoid allocation allow rt tasks to cache one sigqueue struct in task struct. diff --git a/debian/patches/features/all/rt/skbufhead-raw-lock.patch b/debian/patches/features/all/rt/skbufhead-raw-lock.patch index 7a50d360f38a..56bcca64e864 100644 --- a/debian/patches/features/all/rt/skbufhead-raw-lock.patch +++ b/debian/patches/features/all/rt/skbufhead-raw-lock.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Tue, 12 Jul 2011 15:38:34 +0200 Subject: net: Use skbufhead with raw lock -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz 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 @@ -34,7 +34,7 @@ Signed-off-by: Thomas Gleixner }; struct sk_buff; -@@ -1537,6 +1538,12 @@ static inline void skb_queue_head_init(s +@@ -1538,6 +1539,12 @@ static inline void skb_queue_head_init(s __skb_queue_head_init(list); } diff --git a/debian/patches/features/all/rt/slub-disable-SLUB_CPU_PARTIAL.patch b/debian/patches/features/all/rt/slub-disable-SLUB_CPU_PARTIAL.patch index 136f42dbfa3b..639c7988811b 100644 --- a/debian/patches/features/all/rt/slub-disable-SLUB_CPU_PARTIAL.patch +++ b/debian/patches/features/all/rt/slub-disable-SLUB_CPU_PARTIAL.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Wed, 15 Apr 2015 19:00:47 +0200 Subject: slub: Disable SLUB_CPU_PARTIAL -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz |BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:915 |in_atomic(): 1, irqs_disabled(): 0, pid: 87, name: rcuop/7 diff --git a/debian/patches/features/all/rt/slub-enable-irqs-for-no-wait.patch b/debian/patches/features/all/rt/slub-enable-irqs-for-no-wait.patch index 5d2ae91c4a15..fd3d4c538035 100644 --- a/debian/patches/features/all/rt/slub-enable-irqs-for-no-wait.patch +++ b/debian/patches/features/all/rt/slub-enable-irqs-for-no-wait.patch @@ -1,7 +1,7 @@ Subject: slub: Enable irqs for __GFP_WAIT From: Thomas Gleixner Date: Wed, 09 Jan 2013 12:08:15 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz SYSTEM_RUNNING might be too late for enabling interrupts. Allocations with GFP_WAIT can happen before that. So use this as an indicator. diff --git a/debian/patches/features/all/rt/snd-pcm-fix-snd_pcm_stream_lock-irqs_disabled-splats.patch b/debian/patches/features/all/rt/snd-pcm-fix-snd_pcm_stream_lock-irqs_disabled-splats.patch index 30efd9ee980a..413c49700cc5 100644 --- a/debian/patches/features/all/rt/snd-pcm-fix-snd_pcm_stream_lock-irqs_disabled-splats.patch +++ b/debian/patches/features/all/rt/snd-pcm-fix-snd_pcm_stream_lock-irqs_disabled-splats.patch @@ -1,7 +1,7 @@ From: Mike Galbraith Date: Wed, 18 Feb 2015 15:09:23 +0100 Subject: snd/pcm: fix snd_pcm_stream_lock*() irqs_disabled() splats -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Locking functions previously using read_lock_irq()/read_lock_irqsave() were changed to local_irq_disable/save(), leading to gripes. Use nort variants. diff --git a/debian/patches/features/all/rt/softirq-disable-softirq-stacks-for-rt.patch b/debian/patches/features/all/rt/softirq-disable-softirq-stacks-for-rt.patch index d6a46c904dc0..08c73a461738 100644 --- a/debian/patches/features/all/rt/softirq-disable-softirq-stacks-for-rt.patch +++ b/debian/patches/features/all/rt/softirq-disable-softirq-stacks-for-rt.patch @@ -1,7 +1,7 @@ Subject: softirq: Disable softirq stacks for RT From: Thomas Gleixner Date: Mon, 18 Jul 2011 13:59:17 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Disable extra stacks for softirqs. We want to preempt softirqs and having them on special IRQ-stack does not make this easier. diff --git a/debian/patches/features/all/rt/softirq-preempt-fix-3-re.patch b/debian/patches/features/all/rt/softirq-preempt-fix-3-re.patch index 1be6a9b24a8d..8c7362be9350 100644 --- a/debian/patches/features/all/rt/softirq-preempt-fix-3-re.patch +++ b/debian/patches/features/all/rt/softirq-preempt-fix-3-re.patch @@ -1,7 +1,7 @@ Subject: softirq: Check preemption after reenabling interrupts From: Thomas Gleixner Date: Sun, 13 Nov 2011 17:17:09 +0100 (CET) -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz raise_softirq_irqoff() disables interrupts and wakes the softirq daemon, but after reenabling interrupts there is no preemption check, diff --git a/debian/patches/features/all/rt/softirq-split-locks.patch b/debian/patches/features/all/rt/softirq-split-locks.patch index 37fa9d10b0da..d512ce0edd2f 100644 --- a/debian/patches/features/all/rt/softirq-split-locks.patch +++ b/debian/patches/features/all/rt/softirq-split-locks.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Thu, 04 Oct 2012 14:20:47 +0100 Subject: softirq: Split softirq locks -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz The 3.x RT series removed the split softirq implementation in favour of pushing softirq processing into the context of the thread which @@ -786,7 +786,7 @@ Signed-off-by: Thomas Gleixner .thread_comm = "ksoftirqd/%u", --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c -@@ -866,14 +866,7 @@ static bool can_stop_idle_tick(int cpu, +@@ -878,14 +878,7 @@ static bool can_stop_idle_tick(int cpu, return false; if (unlikely(local_softirq_pending() && cpu_online(cpu))) { diff --git a/debian/patches/features/all/rt/softirq-split-timer-softirqs-out-of-ksoftirqd.patch b/debian/patches/features/all/rt/softirq-split-timer-softirqs-out-of-ksoftirqd.patch index f142b9eaf1dd..1657e94cdbef 100644 --- a/debian/patches/features/all/rt/softirq-split-timer-softirqs-out-of-ksoftirqd.patch +++ b/debian/patches/features/all/rt/softirq-split-timer-softirqs-out-of-ksoftirqd.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Wed, 20 Jan 2016 16:34:17 +0100 Subject: softirq: split timer softirqs out of ksoftirqd -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz 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 diff --git a/debian/patches/features/all/rt/sparc64-use-generic-rwsem-spinlocks-rt.patch b/debian/patches/features/all/rt/sparc64-use-generic-rwsem-spinlocks-rt.patch index 1c64ac0ce195..ec40f30f5dd7 100644 --- a/debian/patches/features/all/rt/sparc64-use-generic-rwsem-spinlocks-rt.patch +++ b/debian/patches/features/all/rt/sparc64-use-generic-rwsem-spinlocks-rt.patch @@ -1,7 +1,7 @@ From: Allen Pais Date: Fri, 13 Dec 2013 09:44:41 +0530 Subject: sparc64: use generic rwsem spinlocks rt -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Signed-off-by: Allen Pais Signed-off-by: Sebastian Andrzej Siewior diff --git a/debian/patches/features/all/rt/spinlock-types-separate-raw.patch b/debian/patches/features/all/rt/spinlock-types-separate-raw.patch index eb678dd247dd..afabc5273fae 100644 --- a/debian/patches/features/all/rt/spinlock-types-separate-raw.patch +++ b/debian/patches/features/all/rt/spinlock-types-separate-raw.patch @@ -1,7 +1,7 @@ Subject: spinlock: Split the lock types header From: Thomas Gleixner Date: Wed, 29 Jun 2011 19:34:01 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz 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 diff --git a/debian/patches/features/all/rt/stomp-machine-create-lg_global_trylock_relax-primiti.patch b/debian/patches/features/all/rt/stomp-machine-create-lg_global_trylock_relax-primiti.patch index 16c73bc953ec..d5b164130900 100644 --- a/debian/patches/features/all/rt/stomp-machine-create-lg_global_trylock_relax-primiti.patch +++ b/debian/patches/features/all/rt/stomp-machine-create-lg_global_trylock_relax-primiti.patch @@ -1,7 +1,7 @@ From: Mike Galbraith Date: Fri, 2 May 2014 13:13:22 +0200 Subject: stomp-machine: create lg_global_trylock_relax() primitive -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Create lg_global_trylock_relax() for use by stopper thread when it cannot schedule, to deal with stop_cpus_lock, which is now an lglock. diff --git a/debian/patches/features/all/rt/stomp-machine-use-lg_global_trylock_relax-to-dead-wi.patch b/debian/patches/features/all/rt/stomp-machine-use-lg_global_trylock_relax-to-dead-wi.patch index 77c9386ec0bf..0020774fa268 100644 --- a/debian/patches/features/all/rt/stomp-machine-use-lg_global_trylock_relax-to-dead-wi.patch +++ b/debian/patches/features/all/rt/stomp-machine-use-lg_global_trylock_relax-to-dead-wi.patch @@ -1,7 +1,7 @@ From: Mike Galbraith Date: Fri, 2 May 2014 13:13:34 +0200 Subject: stomp-machine: use lg_global_trylock_relax() to dead with stop_cpus_lock lglock -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz If the stop machinery is called from inactive CPU we cannot use lg_global_lock(), because some other stomp machine invocation might be diff --git a/debian/patches/features/all/rt/stop-machine-raw-lock.patch b/debian/patches/features/all/rt/stop-machine-raw-lock.patch index 37ae24cb0247..f99607b4a179 100644 --- a/debian/patches/features/all/rt/stop-machine-raw-lock.patch +++ b/debian/patches/features/all/rt/stop-machine-raw-lock.patch @@ -1,7 +1,7 @@ Subject: stop_machine: Use raw spinlocks From: Thomas Gleixner Date: Wed, 29 Jun 2011 11:01:51 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Use raw-locks in stomp_machine() to allow locking in irq-off regions. diff --git a/debian/patches/features/all/rt/stop_machine-convert-stop_machine_run-to-PREEMPT_RT.patch b/debian/patches/features/all/rt/stop_machine-convert-stop_machine_run-to-PREEMPT_RT.patch index 7a0f02f44f2f..10e02964f9b1 100644 --- a/debian/patches/features/all/rt/stop_machine-convert-stop_machine_run-to-PREEMPT_RT.patch +++ b/debian/patches/features/all/rt/stop_machine-convert-stop_machine_run-to-PREEMPT_RT.patch @@ -1,7 +1,7 @@ From: Ingo Molnar Date: Fri, 3 Jul 2009 08:30:27 -0500 Subject: stop_machine: convert stop_machine_run() to PREEMPT_RT -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Instead of playing with non-preemption, introduce explicit startup serialization. This is more robust and cleaner as diff --git a/debian/patches/features/all/rt/sunrpc-make-svc_xprt_do_enqueue-use-get_cpu_light.patch b/debian/patches/features/all/rt/sunrpc-make-svc_xprt_do_enqueue-use-get_cpu_light.patch index bb32dd14a110..79caf057a547 100644 --- a/debian/patches/features/all/rt/sunrpc-make-svc_xprt_do_enqueue-use-get_cpu_light.patch +++ b/debian/patches/features/all/rt/sunrpc-make-svc_xprt_do_enqueue-use-get_cpu_light.patch @@ -1,7 +1,7 @@ From: Mike Galbraith Date: Wed, 18 Feb 2015 16:05:28 +0100 Subject: sunrpc: Make svc_xprt_do_enqueue() use get_cpu_light() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz |BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:915 |in_atomic(): 1, irqs_disabled(): 0, pid: 3194, name: rpc.nfsd @@ -34,7 +34,7 @@ Signed-off-by: Sebastian Andrzej Siewior --- a/net/sunrpc/svc_xprt.c +++ b/net/sunrpc/svc_xprt.c -@@ -342,7 +342,7 @@ void svc_xprt_do_enqueue(struct svc_xprt +@@ -344,7 +344,7 @@ void svc_xprt_do_enqueue(struct svc_xprt goto out; } @@ -43,7 +43,7 @@ Signed-off-by: Sebastian Andrzej Siewior pool = svc_pool_for_cpu(xprt->xpt_server, cpu); atomic_long_inc(&pool->sp_stats.packets); -@@ -378,7 +378,7 @@ void svc_xprt_do_enqueue(struct svc_xprt +@@ -380,7 +380,7 @@ void svc_xprt_do_enqueue(struct svc_xprt atomic_long_inc(&pool->sp_stats.threads_woken); wake_up_process(rqstp->rq_task); @@ -52,7 +52,7 @@ Signed-off-by: Sebastian Andrzej Siewior goto out; } rcu_read_unlock(); -@@ -399,7 +399,7 @@ void svc_xprt_do_enqueue(struct svc_xprt +@@ -401,7 +401,7 @@ void svc_xprt_do_enqueue(struct svc_xprt goto redo_search; } rqstp = NULL; diff --git a/debian/patches/features/all/rt/suspend-prevernt-might-sleep-splats.patch b/debian/patches/features/all/rt/suspend-prevernt-might-sleep-splats.patch index a4493a8ddc02..42b723bbd44b 100644 --- a/debian/patches/features/all/rt/suspend-prevernt-might-sleep-splats.patch +++ b/debian/patches/features/all/rt/suspend-prevernt-might-sleep-splats.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Thu, 15 Jul 2010 10:29:00 +0200 Subject: suspend: Prevent might sleep splats -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz timekeeping suspend/resume calls read_persistant_clock() which takes rtc_lock. That results in might sleep warnings because at that point diff --git a/debian/patches/features/all/rt/sysfs-realtime-entry.patch b/debian/patches/features/all/rt/sysfs-realtime-entry.patch index 32695dc79f26..821d27608771 100644 --- a/debian/patches/features/all/rt/sysfs-realtime-entry.patch +++ b/debian/patches/features/all/rt/sysfs-realtime-entry.patch @@ -1,7 +1,7 @@ Subject: sysfs: Add /sys/kernel/realtime entry From: Clark Williams Date: Sat Jul 30 21:55:53 2011 -0500 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Add a /sys/kernel entry to indicate that the kernel is a realtime kernel. diff --git a/debian/patches/features/all/rt/tasklet-rt-prevent-tasklets-from-going-into-infinite-spin-in-rt.patch b/debian/patches/features/all/rt/tasklet-rt-prevent-tasklets-from-going-into-infinite-spin-in-rt.patch index 04015543c7cc..fec48332be7b 100644 --- a/debian/patches/features/all/rt/tasklet-rt-prevent-tasklets-from-going-into-infinite-spin-in-rt.patch +++ b/debian/patches/features/all/rt/tasklet-rt-prevent-tasklets-from-going-into-infinite-spin-in-rt.patch @@ -1,7 +1,7 @@ Subject: tasklet: Prevent tasklets from going into infinite spin in RT From: Ingo Molnar Date: Tue Nov 29 20:18:22 2011 -0500 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz When CONFIG_PREEMPT_RT_FULL is enabled, tasklets run as threads, and spinlocks turn are mutexes. But this can cause issues with diff --git a/debian/patches/features/all/rt/thermal-Defer-thermal-wakups-to-threads.patch b/debian/patches/features/all/rt/thermal-Defer-thermal-wakups-to-threads.patch index dac366fe8f4c..bb4450b3357d 100644 --- a/debian/patches/features/all/rt/thermal-Defer-thermal-wakups-to-threads.patch +++ b/debian/patches/features/all/rt/thermal-Defer-thermal-wakups-to-threads.patch @@ -1,7 +1,7 @@ From: Daniel Wagner Date: Tue, 17 Feb 2015 09:37:44 +0100 Subject: thermal: Defer thermal wakups to threads -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz On RT the spin lock in pkg_temp_thermal_platfrom_thermal_notify will call schedule while we run in irq context. diff --git a/debian/patches/features/all/rt/tick-broadcast--Make-hrtimer-irqsafe.patch b/debian/patches/features/all/rt/tick-broadcast--Make-hrtimer-irqsafe.patch index b27ec8c2cbc6..7a8d7090e48b 100644 --- a/debian/patches/features/all/rt/tick-broadcast--Make-hrtimer-irqsafe.patch +++ b/debian/patches/features/all/rt/tick-broadcast--Make-hrtimer-irqsafe.patch @@ -1,7 +1,7 @@ Subject: tick/broadcast: Make broadcast hrtimer irqsafe From: Thomas Gleixner Date: Sat, 27 Feb 2016 10:47:10 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Otherwise we end up with the following: diff --git a/debian/patches/features/all/rt/tick-sched-Remove-pointless-empty-function.patch b/debian/patches/features/all/rt/tick-sched-Remove-pointless-empty-function.patch new file mode 100644 index 000000000000..7b626464c5d5 --- /dev/null +++ b/debian/patches/features/all/rt/tick-sched-Remove-pointless-empty-function.patch @@ -0,0 +1,71 @@ +From: Thomas Gleixner +Date: Mon, 4 Jul 2016 09:50:35 +0000 +Subject: [PATCH 18/22] tick/sched: Remove pointless empty function +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz + +This was a failed attempt to optimize the timer expiry in idle, which was +disabled and never revisited. Remove the cruft. + +Signed-off-by: Thomas Gleixner +Cc: Peter Zijlstra +Cc: Frederic Weisbecker +Cc: Chris Mason +Cc: Eric Dumazet +Cc: rt@linutronix.de +Cc: "Paul E. McKenney" +Cc: Arjan van de Ven +Signed-off-by: Sebastian Andrzej Siewior +--- + kernel/time/tick-sched.c | 33 +-------------------------------- + 1 file changed, 1 insertion(+), 32 deletions(-) + +--- a/kernel/time/tick-sched.c ++++ b/kernel/time/tick-sched.c +@@ -1091,35 +1091,6 @@ static void tick_nohz_switch_to_nohz(voi + tick_nohz_activate(ts, NOHZ_MODE_LOWRES); + } + +-/* +- * When NOHZ is enabled and the tick is stopped, we need to kick the +- * tick timer from irq_enter() so that the jiffies update is kept +- * alive during long running softirqs. That's ugly as hell, but +- * correctness is key even if we need to fix the offending softirq in +- * the first place. +- * +- * Note, this is different to tick_nohz_restart. We just kick the +- * timer and do not touch the other magic bits which need to be done +- * when idle is left. +- */ +-static void tick_nohz_kick_tick(struct tick_sched *ts, ktime_t now) +-{ +-#if 0 +- /* Switch back to 2.6.27 behaviour */ +- ktime_t delta; +- +- /* +- * Do not touch the tick device, when the next expiry is either +- * already reached or less/equal than the tick period. +- */ +- delta = ktime_sub(hrtimer_get_expires(&ts->sched_timer), now); +- if (delta.tv64 <= tick_period.tv64) +- return; +- +- tick_nohz_restart(ts, now); +-#endif +-} +- + static inline void tick_nohz_irq_enter(void) + { + struct tick_sched *ts = this_cpu_ptr(&tick_cpu_sched); +@@ -1130,10 +1101,8 @@ static inline void tick_nohz_irq_enter(v + now = ktime_get(); + if (ts->idle_active) + tick_nohz_stop_idle(ts, now); +- if (ts->tick_stopped) { ++ if (ts->tick_stopped) + tick_nohz_update_jiffies(now); +- tick_nohz_kick_tick(ts, now); +- } + } + + #else diff --git a/debian/patches/features/all/rt/timekeeping-split-jiffies-lock.patch b/debian/patches/features/all/rt/timekeeping-split-jiffies-lock.patch index e20fa63c4458..a0e6c9a905cd 100644 --- a/debian/patches/features/all/rt/timekeeping-split-jiffies-lock.patch +++ b/debian/patches/features/all/rt/timekeeping-split-jiffies-lock.patch @@ -1,7 +1,7 @@ Subject: timekeeping: Split jiffies seqlock From: Thomas Gleixner Date: Thu, 14 Feb 2013 22:36:59 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Replace jiffies_lock seqlock with a simple seqcounter and a rawlock so it can be taken in atomic context on RT. diff --git a/debian/patches/features/all/rt/timer-Forward-wheel-clock-whenever-possible.patch b/debian/patches/features/all/rt/timer-Forward-wheel-clock-whenever-possible.patch new file mode 100644 index 000000000000..f9eeffcd8c53 --- /dev/null +++ b/debian/patches/features/all/rt/timer-Forward-wheel-clock-whenever-possible.patch @@ -0,0 +1,241 @@ +From: Thomas Gleixner +Date: Mon, 4 Jul 2016 09:50:36 +0000 +Subject: [PATCH 19/22] timer: Forward wheel clock whenever possible +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz + +The wheel clock is stale when a cpu goes into a long idle sleep. This has the +side effect, that timers which are queued end up in the outer wheel +levels. That results in coarser granularity. + +To solve this, we keep track of the idle state and forward the wheel clock +whenever it's possible. + +Signed-off-by: Thomas Gleixner +Cc: Peter Zijlstra +Cc: Frederic Weisbecker +Cc: Chris Mason +Cc: Eric Dumazet +Cc: rt@linutronix.de +Cc: "Paul E. McKenney" +Cc: Arjan van de Ven +Signed-off-by: Sebastian Andrzej Siewior +--- + kernel/time/tick-internal.h | 1 + kernel/time/tick-sched.c | 12 ++++ + kernel/time/timer.c | 128 ++++++++++++++++++++++++++++++++++++-------- + 3 files changed, 120 insertions(+), 21 deletions(-) + +--- a/kernel/time/tick-internal.h ++++ b/kernel/time/tick-internal.h +@@ -164,3 +164,4 @@ static inline void timers_update_migrati + DECLARE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases); + + extern u64 get_next_timer_interrupt(unsigned long basej, u64 basem); ++void timer_clear_idle(void); +--- a/kernel/time/tick-sched.c ++++ b/kernel/time/tick-sched.c +@@ -700,6 +700,12 @@ static ktime_t tick_nohz_stop_sched_tick + delta = next_tick - basemono; + if (delta <= (u64)TICK_NSEC) { + tick.tv64 = 0; ++ ++ /* ++ * Tell the timer code that the base is not idle, i.e. undo ++ * the effect of get_next_timer_interrupt(). ++ */ ++ timer_clear_idle(); + /* + * We've not stopped the tick yet, and there's a timer in the + * next period, so no point in stopping it either, bail. +@@ -808,6 +814,12 @@ static void tick_nohz_restart_sched_tick + tick_do_update_jiffies64(now); + update_cpu_load_nohz(active); + ++ /* ++ * Clear the timer idle flag, so we avoid IPIs on remote queueing and ++ * the clock forward checks in the enqueue path. ++ */ ++ timer_clear_idle(); ++ + calc_load_exit_idle(); + touch_softlockup_watchdog_sched(); + /* +--- a/kernel/time/timer.c ++++ b/kernel/time/timer.c +@@ -196,9 +196,11 @@ struct timer_base { + spinlock_t lock; + struct timer_list *running_timer; + unsigned long clk; ++ unsigned long next_expiry; + unsigned int cpu; + bool migration_enabled; + bool nohz_active; ++ bool is_idle; + DECLARE_BITMAP(pending_map, WHEEL_SIZE); + struct hlist_head vectors[WHEEL_SIZE]; + } ____cacheline_aligned; +@@ -519,24 +521,37 @@ static void internal_add_timer(struct ti + { + __internal_add_timer(base, timer); + ++ if (!IS_ENABLED(CONFIG_NO_HZ_COMMON) || !base->nohz_active) ++ return; ++ + /* +- * Check whether the other CPU is in dynticks mode and needs +- * to be triggered to reevaluate the timer wheel. We are +- * protected against the other CPU fiddling with the timer by +- * holding the timer base lock. This also makes sure that a +- * CPU on the way to stop its tick can not evaluate the timer +- * wheel. +- * +- * Spare the IPI for deferrable timers on idle targets though. +- * The next busy ticks will take care of it. Except full dynticks +- * require special care against races with idle_cpu(), lets deal +- * with that later. +- */ +- if (IS_ENABLED(CONFIG_NO_HZ_COMMON) && base->nohz_active) { +- if (!(timer->flags & TIMER_DEFERRABLE) || +- tick_nohz_full_cpu(base->cpu)) ++ * This wants some optimizing similar to the below, but we do that ++ * when we switch from push to pull for deferrable timers. ++ */ ++ if (timer->flags & TIMER_DEFERRABLE) { ++ if (tick_nohz_full_cpu(base->cpu)) + wake_up_nohz_cpu(base->cpu); ++ return; + } ++ ++ /* ++ * We might have to IPI the remote CPU if the base is idle and the ++ * timer is not deferrable. If the other cpu is on the way to idle ++ * then it can't set base->is_idle as we hold base lock. ++ */ ++ if (!base->is_idle) ++ return; ++ ++ /* Check whether this is the new first expiring timer */ ++ if (time_after_eq(timer->expires, base->next_expiry)) ++ return; ++ ++ /* ++ * Set the next expiry time and kick the cpu so it can reevaluate the ++ * wheel ++ */ ++ base->next_expiry = timer->expires; ++ wake_up_nohz_cpu(base->cpu); + } + + #ifdef CONFIG_TIMER_STATS +@@ -859,10 +874,11 @@ static inline struct timer_base *get_tim + return get_timer_cpu_base(tflags, tflags & TIMER_CPUMASK); + } + +-static inline struct timer_base *get_target_base(struct timer_base *base, +- unsigned tflags) ++#ifdef CONFIG_NO_HZ_COMMON ++static inline struct timer_base *__get_target_base(struct timer_base *base, ++ unsigned tflags) + { +-#if defined(CONFIG_NO_HZ_COMMON) && defined(CONFIG_SMP) ++#ifdef CONFIG_SMP + if ((tflags & TIMER_PINNED) || !base->migration_enabled) + return get_timer_this_cpu_base(tflags); + return get_timer_cpu_base(tflags, get_nohz_timer_target()); +@@ -871,6 +887,43 @@ static inline struct timer_base *get_tar + #endif + } + ++static inline void forward_timer_base(struct timer_base *base) ++{ ++ /* ++ * We only forward the base when it's idle and we have a delta between ++ * base clock and jiffies. ++ */ ++ if (!base->is_idle || (long) (jiffies - base->clk) < 2) ++ return; ++ ++ /* ++ * If the next expiry value is > jiffies, then we fast forward to ++ * jiffies otherwise we forward to the next expiry value. ++ */ ++ if (time_after(base->next_expiry, jiffies)) ++ base->clk = jiffies; ++ else ++ base->clk = base->next_expiry; ++} ++#else ++static inline struct timer_base *__get_target_base(struct timer_base *base, ++ unsigned tflags) ++{ ++ return get_timer_this_cpu_base(tflags); ++} ++ ++static inline void forward_timer_base(struct timer_base *base) { } ++#endif ++ ++static inline struct timer_base *get_target_base(struct timer_base *base, ++ unsigned tflags) ++{ ++ struct timer_base *target = __get_target_base(base, tflags); ++ ++ forward_timer_base(target); ++ return target; ++} ++ + /* + * We are using hashed locking: Holding per_cpu(timer_bases[x]).lock means + * that all timers which are tied to this base are locked, and the base itself +@@ -1432,16 +1485,49 @@ u64 get_next_timer_interrupt(unsigned lo + + spin_lock(&base->lock); + nextevt = __next_timer_interrupt(base); +- spin_unlock(&base->lock); ++ base->next_expiry = nextevt; ++ /* ++ * We have a fresh next event. Check whether we can forward the base. ++ */ ++ if (time_after(nextevt, jiffies)) ++ base->clk = jiffies; ++ else if (time_after(nextevt, base->clk)) ++ base->clk = nextevt; + +- if (time_before_eq(nextevt, basej)) ++ if (time_before_eq(nextevt, basej)) { + expires = basem; +- else ++ base->is_idle = false; ++ } else { + expires = basem + (nextevt - basej) * TICK_NSEC; ++ /* ++ * If we expect to sleep more than a tick, mark the base idle. ++ */ ++ if ((expires - basem) > TICK_NSEC) ++ base->is_idle = true; ++ } ++ spin_unlock(&base->lock); + + return cmp_next_hrtimer_event(basem, expires); + } + ++/** ++ * timer_clear_idle - Clear the idle state of the timer base ++ * ++ * Called with interrupts disabled ++ */ ++void timer_clear_idle(void) ++{ ++ struct timer_base *base = this_cpu_ptr(&timer_bases[BASE_STD]); ++ ++ /* ++ * We do this unlocked. The worst outcome is a remote enqueue sending ++ * a pointless IPI, but taking the lock would just make the window for ++ * sending the IPI a few instructions smaller for the cost of taking ++ * the lock in the exit from idle path. ++ */ ++ base->is_idle = false; ++} ++ + static int collect_expired_timers(struct timer_base *base, + struct hlist_head *heads) + { diff --git a/debian/patches/features/all/rt/timer-Give-a-few-structs-and-members-proper-names.patch b/debian/patches/features/all/rt/timer-Give-a-few-structs-and-members-proper-names.patch new file mode 100644 index 000000000000..f43c6ee54360 --- /dev/null +++ b/debian/patches/features/all/rt/timer-Give-a-few-structs-and-members-proper-names.patch @@ -0,0 +1,422 @@ +From: Thomas Gleixner +Date: Mon, 4 Jul 2016 09:50:28 +0000 +Subject: [PATCH 12/22] timer: Give a few structs and members proper names +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz + +Some of the names are not longer correct and others are simply too long to +type. Clean it up before we switch the wheel implementation over to the new +scheme. + +No functional change. + +Signed-off-by: Thomas Gleixner +Reviewed-by: Frederic Weisbecker +Cc: Peter Zijlstra +Cc: Chris Mason +Cc: Eric Dumazet +Cc: rt@linutronix.de +Cc: "Paul E. McKenney" +Cc: Arjan van de Ven +Signed-off-by: Sebastian Andrzej Siewior +--- + kernel/time/timer.c | 118 ++++++++++++++++++++++++++-------------------------- + 1 file changed, 59 insertions(+), 59 deletions(-) + +--- a/kernel/time/timer.c ++++ b/kernel/time/timer.c +@@ -77,10 +77,10 @@ struct tvec_root { + struct hlist_head vec[TVR_SIZE]; + }; + +-struct tvec_base { ++struct timer_base { + spinlock_t lock; + struct timer_list *running_timer; +- unsigned long timer_jiffies; ++ unsigned long clk; + unsigned long next_timer; + unsigned long active_timers; + unsigned long all_timers; +@@ -95,7 +95,7 @@ struct tvec_base { + } ____cacheline_aligned; + + +-static DEFINE_PER_CPU(struct tvec_base, tvec_bases); ++static DEFINE_PER_CPU(struct timer_base, timer_bases); + + #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON) + unsigned int sysctl_timer_migration = 1; +@@ -106,15 +106,15 @@ void timers_update_migration(bool update + unsigned int cpu; + + /* Avoid the loop, if nothing to update */ +- if (this_cpu_read(tvec_bases.migration_enabled) == on) ++ if (this_cpu_read(timer_bases.migration_enabled) == on) + return; + + for_each_possible_cpu(cpu) { +- per_cpu(tvec_bases.migration_enabled, cpu) = on; ++ per_cpu(timer_bases.migration_enabled, cpu) = on; + per_cpu(hrtimer_bases.migration_enabled, cpu) = on; + if (!update_nohz) + continue; +- per_cpu(tvec_bases.nohz_active, cpu) = true; ++ per_cpu(timer_bases.nohz_active, cpu) = true; + per_cpu(hrtimer_bases.nohz_active, cpu) = true; + } + } +@@ -134,18 +134,18 @@ int timer_migration_handler(struct ctl_t + return ret; + } + +-static inline struct tvec_base *get_target_base(struct tvec_base *base, ++static inline struct timer_base *get_target_base(struct timer_base *base, + int pinned) + { + if (pinned || !base->migration_enabled) +- return this_cpu_ptr(&tvec_bases); +- return per_cpu_ptr(&tvec_bases, get_nohz_timer_target()); ++ return this_cpu_ptr(&timer_bases); ++ return per_cpu_ptr(&timer_bases, get_nohz_timer_target()); + } + #else +-static inline struct tvec_base *get_target_base(struct tvec_base *base, ++static inline struct timer_base *get_target_base(struct timer_base *base, + int pinned) + { +- return this_cpu_ptr(&tvec_bases); ++ return this_cpu_ptr(&timer_bases); + } + #endif + +@@ -371,10 +371,10 @@ void set_timer_slack(struct timer_list * + EXPORT_SYMBOL_GPL(set_timer_slack); + + static void +-__internal_add_timer(struct tvec_base *base, struct timer_list *timer) ++__internal_add_timer(struct timer_base *base, struct timer_list *timer) + { + unsigned long expires = timer->expires; +- unsigned long idx = expires - base->timer_jiffies; ++ unsigned long idx = expires - base->clk; + struct hlist_head *vec; + + if (idx < TVR_SIZE) { +@@ -394,7 +394,7 @@ static void + * Can happen if you add a timer with expires == jiffies, + * or you set a timer to go off in the past + */ +- vec = base->tv1.vec + (base->timer_jiffies & TVR_MASK); ++ vec = base->tv1.vec + (base->clk & TVR_MASK); + } else { + int i; + /* If the timeout is larger than MAX_TVAL (on 64-bit +@@ -403,7 +403,7 @@ static void + */ + if (idx > MAX_TVAL) { + idx = MAX_TVAL; +- expires = idx + base->timer_jiffies; ++ expires = idx + base->clk; + } + i = (expires >> (TVR_BITS + 3 * TVN_BITS)) & TVN_MASK; + vec = base->tv5.vec + i; +@@ -412,11 +412,11 @@ static void + hlist_add_head(&timer->entry, vec); + } + +-static void internal_add_timer(struct tvec_base *base, struct timer_list *timer) ++static void internal_add_timer(struct timer_base *base, struct timer_list *timer) + { + /* Advance base->jiffies, if the base is empty */ + if (!base->all_timers++) +- base->timer_jiffies = jiffies; ++ base->clk = jiffies; + + __internal_add_timer(base, timer); + /* +@@ -722,7 +722,7 @@ static inline void detach_timer(struct t + } + + static inline void +-detach_expired_timer(struct timer_list *timer, struct tvec_base *base) ++detach_expired_timer(struct timer_list *timer, struct timer_base *base) + { + detach_timer(timer, true); + if (!(timer->flags & TIMER_DEFERRABLE)) +@@ -730,7 +730,7 @@ detach_expired_timer(struct timer_list * + base->all_timers--; + } + +-static int detach_if_pending(struct timer_list *timer, struct tvec_base *base, ++static int detach_if_pending(struct timer_list *timer, struct timer_base *base, + bool clear_pending) + { + if (!timer_pending(timer)) +@@ -740,16 +740,16 @@ static int detach_if_pending(struct time + if (!(timer->flags & TIMER_DEFERRABLE)) { + base->active_timers--; + if (timer->expires == base->next_timer) +- base->next_timer = base->timer_jiffies; ++ base->next_timer = base->clk; + } + /* If this was the last timer, advance base->jiffies */ + if (!--base->all_timers) +- base->timer_jiffies = jiffies; ++ base->clk = jiffies; + return 1; + } + + /* +- * We are using hashed locking: holding per_cpu(tvec_bases).lock ++ * We are using hashed locking: holding per_cpu(timer_bases).lock + * means that all timers which are tied to this base via timer->base are + * locked, and the base itself is locked too. + * +@@ -759,16 +759,16 @@ static int detach_if_pending(struct time + * When the timer's base is locked and removed from the list, the + * TIMER_MIGRATING flag is set, FIXME + */ +-static struct tvec_base *lock_timer_base(struct timer_list *timer, ++static struct timer_base *lock_timer_base(struct timer_list *timer, + unsigned long *flags) + __acquires(timer->base->lock) + { + for (;;) { + u32 tf = timer->flags; +- struct tvec_base *base; ++ struct timer_base *base; + + if (!(tf & TIMER_MIGRATING)) { +- base = per_cpu_ptr(&tvec_bases, tf & TIMER_CPUMASK); ++ base = per_cpu_ptr(&timer_bases, tf & TIMER_CPUMASK); + spin_lock_irqsave(&base->lock, *flags); + if (timer->flags == tf) + return base; +@@ -781,7 +781,7 @@ static struct tvec_base *lock_timer_base + static inline int + __mod_timer(struct timer_list *timer, unsigned long expires, bool pending_only) + { +- struct tvec_base *base, *new_base; ++ struct timer_base *base, *new_base; + unsigned long flags; + int ret = 0; + +@@ -948,8 +948,8 @@ EXPORT_SYMBOL(add_timer); + */ + void add_timer_on(struct timer_list *timer, int cpu) + { +- struct tvec_base *new_base = per_cpu_ptr(&tvec_bases, cpu); +- struct tvec_base *base; ++ struct timer_base *new_base = per_cpu_ptr(&timer_bases, cpu); ++ struct timer_base *base; + unsigned long flags; + + timer_stats_timer_set_start_info(timer); +@@ -990,7 +990,7 @@ EXPORT_SYMBOL_GPL(add_timer_on); + */ + int del_timer(struct timer_list *timer) + { +- struct tvec_base *base; ++ struct timer_base *base; + unsigned long flags; + int ret = 0; + +@@ -1016,7 +1016,7 @@ EXPORT_SYMBOL(del_timer); + */ + int try_to_del_timer_sync(struct timer_list *timer) + { +- struct tvec_base *base; ++ struct timer_base *base; + unsigned long flags; + int ret = -1; + +@@ -1100,7 +1100,7 @@ int del_timer_sync(struct timer_list *ti + EXPORT_SYMBOL(del_timer_sync); + #endif + +-static int cascade(struct tvec_base *base, struct tvec *tv, int index) ++static int cascade(struct timer_base *base, struct tvec *tv, int index) + { + /* cascade all the timers from tv up one level */ + struct timer_list *timer; +@@ -1164,7 +1164,7 @@ static void call_timer_fn(struct timer_l + } + } + +-#define INDEX(N) ((base->timer_jiffies >> (TVR_BITS + (N) * TVN_BITS)) & TVN_MASK) ++#define INDEX(N) ((base->clk >> (TVR_BITS + (N) * TVN_BITS)) & TVN_MASK) + + /** + * __run_timers - run all expired timers (if any) on this CPU. +@@ -1173,23 +1173,23 @@ static void call_timer_fn(struct timer_l + * This function cascades all vectors and executes all expired timer + * vectors. + */ +-static inline void __run_timers(struct tvec_base *base) ++static inline void __run_timers(struct timer_base *base) + { + struct timer_list *timer; + + spin_lock_irq(&base->lock); + +- while (time_after_eq(jiffies, base->timer_jiffies)) { ++ while (time_after_eq(jiffies, base->clk)) { + struct hlist_head work_list; + struct hlist_head *head = &work_list; + int index; + + if (!base->all_timers) { +- base->timer_jiffies = jiffies; ++ base->clk = jiffies; + break; + } + +- index = base->timer_jiffies & TVR_MASK; ++ index = base->clk & TVR_MASK; + + /* + * Cascade timers: +@@ -1199,7 +1199,7 @@ static inline void __run_timers(struct t + (!cascade(base, &base->tv3, INDEX(1))) && + !cascade(base, &base->tv4, INDEX(2))) + cascade(base, &base->tv5, INDEX(3)); +- ++base->timer_jiffies; ++ ++base->clk; + hlist_move_list(base->tv1.vec + index, head); + while (!hlist_empty(head)) { + void (*fn)(unsigned long); +@@ -1237,16 +1237,16 @@ static inline void __run_timers(struct t + * is used on S/390 to stop all activity when a CPU is idle. + * This function needs to be called with interrupts disabled. + */ +-static unsigned long __next_timer_interrupt(struct tvec_base *base) ++static unsigned long __next_timer_interrupt(struct timer_base *base) + { +- unsigned long timer_jiffies = base->timer_jiffies; +- unsigned long expires = timer_jiffies + NEXT_TIMER_MAX_DELTA; ++ unsigned long clk = base->clk; ++ unsigned long expires = clk + NEXT_TIMER_MAX_DELTA; + int index, slot, array, found = 0; + struct timer_list *nte; + struct tvec *varray[4]; + + /* Look for timer events in tv1. */ +- index = slot = timer_jiffies & TVR_MASK; ++ index = slot = clk & TVR_MASK; + do { + hlist_for_each_entry(nte, base->tv1.vec + slot, entry) { + if (nte->flags & TIMER_DEFERRABLE) +@@ -1265,8 +1265,8 @@ static unsigned long __next_timer_interr + cascade: + /* Calculate the next cascade event */ + if (index) +- timer_jiffies += TVR_SIZE - index; +- timer_jiffies >>= TVR_BITS; ++ clk += TVR_SIZE - index; ++ clk >>= TVR_BITS; + + /* Check tv2-tv5. */ + varray[0] = &base->tv2; +@@ -1277,7 +1277,7 @@ static unsigned long __next_timer_interr + for (array = 0; array < 4; array++) { + struct tvec *varp = varray[array]; + +- index = slot = timer_jiffies & TVN_MASK; ++ index = slot = clk & TVN_MASK; + do { + hlist_for_each_entry(nte, varp->vec + slot, entry) { + if (nte->flags & TIMER_DEFERRABLE) +@@ -1301,8 +1301,8 @@ static unsigned long __next_timer_interr + } while (slot != index); + + if (index) +- timer_jiffies += TVN_SIZE - index; +- timer_jiffies >>= TVN_BITS; ++ clk += TVN_SIZE - index; ++ clk >>= TVN_BITS; + } + return expires; + } +@@ -1350,7 +1350,7 @@ static u64 cmp_next_hrtimer_event(u64 ba + */ + u64 get_next_timer_interrupt(unsigned long basej, u64 basem) + { +- struct tvec_base *base = this_cpu_ptr(&tvec_bases); ++ struct timer_base *base = this_cpu_ptr(&timer_bases); + u64 expires = KTIME_MAX; + unsigned long nextevt; + +@@ -1363,7 +1363,7 @@ u64 get_next_timer_interrupt(unsigned lo + + spin_lock(&base->lock); + if (base->active_timers) { +- if (time_before_eq(base->next_timer, base->timer_jiffies)) ++ if (time_before_eq(base->next_timer, base->clk)) + base->next_timer = __next_timer_interrupt(base); + nextevt = base->next_timer; + if (time_before_eq(nextevt, basej)) +@@ -1402,9 +1402,9 @@ void update_process_times(int user_tick) + */ + static void run_timer_softirq(struct softirq_action *h) + { +- struct tvec_base *base = this_cpu_ptr(&tvec_bases); ++ struct timer_base *base = this_cpu_ptr(&timer_bases); + +- if (time_after_eq(jiffies, base->timer_jiffies)) ++ if (time_after_eq(jiffies, base->clk)) + __run_timers(base); + } + +@@ -1549,7 +1549,7 @@ signed long __sched schedule_timeout_idl + EXPORT_SYMBOL(schedule_timeout_idle); + + #ifdef CONFIG_HOTPLUG_CPU +-static void migrate_timer_list(struct tvec_base *new_base, struct hlist_head *head) ++static void migrate_timer_list(struct timer_base *new_base, struct hlist_head *head) + { + struct timer_list *timer; + int cpu = new_base->cpu; +@@ -1565,13 +1565,13 @@ static void migrate_timer_list(struct tv + + static void migrate_timers(int cpu) + { +- struct tvec_base *old_base; +- struct tvec_base *new_base; ++ struct timer_base *old_base; ++ struct timer_base *new_base; + int i; + + BUG_ON(cpu_online(cpu)); +- old_base = per_cpu_ptr(&tvec_bases, cpu); +- new_base = get_cpu_ptr(&tvec_bases); ++ old_base = per_cpu_ptr(&timer_bases, cpu); ++ new_base = get_cpu_ptr(&timer_bases); + /* + * The caller is globally serialized and nobody else + * takes two locks at once, deadlock is not possible. +@@ -1595,7 +1595,7 @@ static void migrate_timers(int cpu) + + spin_unlock(&old_base->lock); + spin_unlock_irq(&new_base->lock); +- put_cpu_ptr(&tvec_bases); ++ put_cpu_ptr(&timer_bases); + } + + static int timer_cpu_notify(struct notifier_block *self, +@@ -1623,13 +1623,13 @@ static inline void timer_register_cpu_no + + static void __init init_timer_cpu(int cpu) + { +- struct tvec_base *base = per_cpu_ptr(&tvec_bases, cpu); ++ struct timer_base *base = per_cpu_ptr(&timer_bases, cpu); + + base->cpu = cpu; + spin_lock_init(&base->lock); + +- base->timer_jiffies = jiffies; +- base->next_timer = base->timer_jiffies; ++ base->clk = jiffies; ++ base->next_timer = base->clk; + } + + static void __init init_timer_cpus(void) diff --git a/debian/patches/features/all/rt/timer-Make-pinned-a-timer-property.patch b/debian/patches/features/all/rt/timer-Make-pinned-a-timer-property.patch new file mode 100644 index 000000000000..935c68b80d46 --- /dev/null +++ b/debian/patches/features/all/rt/timer-Make-pinned-a-timer-property.patch @@ -0,0 +1,145 @@ +From: Thomas Gleixner +Date: Mon, 4 Jul 2016 09:50:15 +0000 +Subject: [PATCH 01/22] timer: Make pinned a timer property +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz + +We want to move the timer migration from a push to a pull model. This requires +to store the pinned attribute of a timer in the timer itself. This must happen +at initialization time. + +Add the helper macros for this. + +Signed-off-by: Thomas Gleixner +Reviewed-by: Frederic Weisbecker +Cc: Peter Zijlstra +Cc: Chris Mason +Cc: Eric Dumazet +Cc: rt@linutronix.de +Cc: "Paul E. McKenney" +Cc: Arjan van de Ven +Signed-off-by: Sebastian Andrzej Siewior +--- + include/linux/timer.h | 25 ++++++++++++++++++++++--- + kernel/time/timer.c | 10 +++++----- + 2 files changed, 27 insertions(+), 8 deletions(-) + +--- a/include/linux/timer.h ++++ b/include/linux/timer.h +@@ -62,7 +62,8 @@ struct timer_list { + #define TIMER_MIGRATING 0x00080000 + #define TIMER_BASEMASK (TIMER_CPUMASK | TIMER_MIGRATING) + #define TIMER_DEFERRABLE 0x00100000 +-#define TIMER_IRQSAFE 0x00200000 ++#define TIMER_PINNED 0x00200000 ++#define TIMER_IRQSAFE 0x00400000 + + #define __TIMER_INITIALIZER(_function, _expires, _data, _flags) { \ + .entry = { .next = TIMER_ENTRY_STATIC }, \ +@@ -78,9 +79,15 @@ struct timer_list { + #define TIMER_INITIALIZER(_function, _expires, _data) \ + __TIMER_INITIALIZER((_function), (_expires), (_data), 0) + ++#define TIMER_PINNED_INITIALIZER(_function, _expires, _data) \ ++ __TIMER_INITIALIZER((_function), (_expires), (_data), TIMER_PINNED) ++ + #define TIMER_DEFERRED_INITIALIZER(_function, _expires, _data) \ + __TIMER_INITIALIZER((_function), (_expires), (_data), TIMER_DEFERRABLE) + ++#define TIMER_PINNED_DEFERRED_INITIALIZER(_function, _expires, _data) \ ++ __TIMER_INITIALIZER((_function), (_expires), (_data), TIMER_DEFERRABLE | TIMER_PINNED) ++ + #define DEFINE_TIMER(_name, _function, _expires, _data) \ + struct timer_list _name = \ + TIMER_INITIALIZER(_function, _expires, _data) +@@ -124,8 +131,12 @@ static inline void init_timer_on_stack_k + + #define init_timer(timer) \ + __init_timer((timer), 0) ++#define init_timer_pinned(timer) \ ++ __init_timer((timer), TIMER_PINNED) + #define init_timer_deferrable(timer) \ + __init_timer((timer), TIMER_DEFERRABLE) ++#define init_timer_pinned_deferrable(timer) \ ++ __init_timer((timer), TIMER_DEFERRABLE | TIMER_PINNED) + #define init_timer_on_stack(timer) \ + __init_timer_on_stack((timer), 0) + +@@ -145,12 +156,20 @@ static inline void init_timer_on_stack_k + + #define setup_timer(timer, fn, data) \ + __setup_timer((timer), (fn), (data), 0) ++#define setup_pinned_timer(timer, fn, data) \ ++ __setup_timer((timer), (fn), (data), TIMER_PINNED) + #define setup_deferrable_timer(timer, fn, data) \ + __setup_timer((timer), (fn), (data), TIMER_DEFERRABLE) ++#define setup_pinned_deferrable_timer(timer, fn, data) \ ++ __setup_timer((timer), (fn), (data), TIMER_DEFERRABLE | TIMER_PINNED) + #define setup_timer_on_stack(timer, fn, data) \ + __setup_timer_on_stack((timer), (fn), (data), 0) ++#define setup_pinned_timer_on_stack(timer, fn, data) \ ++ __setup_timer_on_stack((timer), (fn), (data), TIMER_PINNED) + #define setup_deferrable_timer_on_stack(timer, fn, data) \ + __setup_timer_on_stack((timer), (fn), (data), TIMER_DEFERRABLE) ++#define setup_pinned_deferrable_timer_on_stack(timer, fn, data) \ ++ __setup_timer_on_stack((timer), (fn), (data), TIMER_DEFERRABLE | TIMER_PINNED) + + /** + * timer_pending - is a timer pending? +@@ -175,8 +194,8 @@ extern int mod_timer_pinned(struct timer + + extern void set_timer_slack(struct timer_list *time, int slack_hz); + +-#define TIMER_NOT_PINNED 0 +-#define TIMER_PINNED 1 ++#define MOD_TIMER_NOT_PINNED 0 ++#define MOD_TIMER_PINNED 1 + /* + * The jiffies value which is added to now, when there is no timer + * in the timer wheel: +--- a/kernel/time/timer.c ++++ b/kernel/time/timer.c +@@ -797,7 +797,7 @@ static inline int + + debug_activate(timer, expires); + +- new_base = get_target_base(base, pinned); ++ new_base = get_target_base(base, pinned || timer->flags & TIMER_PINNED); + + if (base != new_base) { + /* +@@ -840,7 +840,7 @@ static inline int + */ + int mod_timer_pending(struct timer_list *timer, unsigned long expires) + { +- return __mod_timer(timer, expires, true, TIMER_NOT_PINNED); ++ return __mod_timer(timer, expires, true, MOD_TIMER_NOT_PINNED); + } + EXPORT_SYMBOL(mod_timer_pending); + +@@ -915,7 +915,7 @@ int mod_timer(struct timer_list *timer, + if (timer_pending(timer) && timer->expires == expires) + return 1; + +- return __mod_timer(timer, expires, false, TIMER_NOT_PINNED); ++ return __mod_timer(timer, expires, false, MOD_TIMER_NOT_PINNED); + } + EXPORT_SYMBOL(mod_timer); + +@@ -943,7 +943,7 @@ int mod_timer_pinned(struct timer_list * + if (timer->expires == expires && timer_pending(timer)) + return 1; + +- return __mod_timer(timer, expires, false, TIMER_PINNED); ++ return __mod_timer(timer, expires, false, MOD_TIMER_PINNED); + } + EXPORT_SYMBOL(mod_timer_pinned); + +@@ -1527,7 +1527,7 @@ signed long __sched schedule_timeout(sig + expire = timeout + jiffies; + + setup_timer_on_stack(&timer, process_timeout, (unsigned long)current); +- __mod_timer(&timer, expire, false, TIMER_NOT_PINNED); ++ __mod_timer(&timer, expire, false, MOD_TIMER_NOT_PINNED); + schedule(); + del_singleshot_timer_sync(&timer); + diff --git a/debian/patches/features/all/rt/timer-Move-__run_timers-function.patch b/debian/patches/features/all/rt/timer-Move-__run_timers-function.patch new file mode 100644 index 000000000000..4be95fdcc17e --- /dev/null +++ b/debian/patches/features/all/rt/timer-Move-__run_timers-function.patch @@ -0,0 +1,92 @@ +From: Anna-Maria Gleixner +Date: Mon, 4 Jul 2016 09:50:33 +0000 +Subject: [PATCH 16/22] timer: Move __run_timers() function +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz + +Move __run_timers() below __next_timer_interrupt() and next_pending_bucket() +in preparation for __run_timers() NOHZ optimization. + +No functional change. + +Signed-off-by: Anna-Maria Gleixner +Signed-off-by: Thomas Gleixner +Cc: Peter Zijlstra +Cc: Frederic Weisbecker +Cc: Chris Mason +Cc: Eric Dumazet +Cc: rt@linutronix.de +Cc: "Paul E. McKenney" +Cc: Arjan van de Ven +Signed-off-by: Sebastian Andrzej Siewior +--- + kernel/time/timer.c | 52 ++++++++++++++++++++++++++-------------------------- + 1 file changed, 26 insertions(+), 26 deletions(-) + +--- a/kernel/time/timer.c ++++ b/kernel/time/timer.c +@@ -1292,32 +1292,6 @@ static int collect_expired_timers(struct + return levels; + } + +-/** +- * __run_timers - run all expired timers (if any) on this CPU. +- * @base: the timer vector to be processed. +- */ +-static inline void __run_timers(struct timer_base *base) +-{ +- struct hlist_head heads[LVL_DEPTH]; +- int levels; +- +- if (!time_after_eq(jiffies, base->clk)) +- return; +- +- spin_lock_irq(&base->lock); +- +- while (time_after_eq(jiffies, base->clk)) { +- +- levels = collect_expired_timers(base, heads); +- base->clk++; +- +- while (levels--) +- expire_timers(base, heads + levels); +- } +- base->running_timer = NULL; +- spin_unlock_irq(&base->lock); +-} +- + #ifdef CONFIG_NO_HZ_COMMON + /* + * Find the next pending bucket of a level. Search from @offset + @clk upwards +@@ -1487,6 +1461,32 @@ void update_process_times(int user_tick) + run_posix_cpu_timers(p); + } + ++/** ++ * __run_timers - run all expired timers (if any) on this CPU. ++ * @base: the timer vector to be processed. ++ */ ++static inline void __run_timers(struct timer_base *base) ++{ ++ struct hlist_head heads[LVL_DEPTH]; ++ int levels; ++ ++ if (!time_after_eq(jiffies, base->clk)) ++ return; ++ ++ spin_lock_irq(&base->lock); ++ ++ while (time_after_eq(jiffies, base->clk)) { ++ ++ levels = collect_expired_timers(base, heads); ++ base->clk++; ++ ++ while (levels--) ++ expire_timers(base, heads + levels); ++ } ++ base->running_timer = NULL; ++ spin_unlock_irq(&base->lock); ++} ++ + /* + * This function runs timers and the timer-tq in bottom half context. + */ diff --git a/debian/patches/features/all/rt/timer-Only-wake-softirq-if-necessary.patch b/debian/patches/features/all/rt/timer-Only-wake-softirq-if-necessary.patch new file mode 100644 index 000000000000..d00b8d74b5d9 --- /dev/null +++ b/debian/patches/features/all/rt/timer-Only-wake-softirq-if-necessary.patch @@ -0,0 +1,35 @@ +From: Thomas Gleixner +Date: Mon, 4 Jul 2016 09:50:37 +0000 +Subject: [PATCH 20/22] timer: Only wake softirq if necessary +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz + +With the wheel forwading in place and with the HZ=1000 4ms folding we can +avoid running the softirq at all. + +Signed-off-by: Thomas Gleixner +Signed-off-by: Sebastian Andrzej Siewior +--- + kernel/time/timer.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +--- a/kernel/time/timer.c ++++ b/kernel/time/timer.c +@@ -1623,7 +1623,18 @@ static void run_timer_softirq(struct sof + */ + void run_local_timers(void) + { ++ struct timer_base *base = this_cpu_ptr(&timer_bases[BASE_STD]); ++ + hrtimer_run_queues(); ++ /* Raise the softirq only if required. */ ++ if (time_before(jiffies, base->clk)) { ++ if (!IS_ENABLED(CONFIG_NO_HZ_COMMON) || !base->nohz_active) ++ return; ++ /* CPU is awake, so check the deferrable base. */ ++ base++; ++ if (time_before(jiffies, base->clk)) ++ return; ++ } + raise_softirq(TIMER_SOFTIRQ); + } + diff --git a/debian/patches/features/all/rt/timer-Optimization-for-same-expiry-time-in-mod_timer.patch b/debian/patches/features/all/rt/timer-Optimization-for-same-expiry-time-in-mod_timer.patch new file mode 100644 index 000000000000..af5d8d699e34 --- /dev/null +++ b/debian/patches/features/all/rt/timer-Optimization-for-same-expiry-time-in-mod_timer.patch @@ -0,0 +1,131 @@ +From: Anna-Maria Gleixner +Date: Mon, 4 Jul 2016 09:50:40 +0000 +Subject: [PATCH 22/22] timer: Optimization for same expiry time in mod_timer() +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz + +The existing optimization for same expiry time in mod_timer() checks whether +the timer expiry time is the same as the new requested expiry time. In the old +timer wheel implementation this does not take the slack batching into account, +neither does the new implementation evaluate whether the new expiry time will +requeue the timer to the same bucket. + +To optimize that, we can calculate the resulting bucket and check if the new +expiry time is different from the current expiry time. This calculation +happens outside the base lock held region. If the resulting bucket is the same +we can avoid taking the base lock and requeueing the timer. + +If the timer needs to be requeued then we have to check under the base lock +whether the base time has changed between the lockless calculation and taking +the lock. If it has changed we need to recalculate under the lock. + +This optimization takes effect for timers which are enqueued into the less +granular wheel levels (1 and above). With a simple test case the functionality +has been verified: + + Before After +Match: 5.5% 86.6% +Requeue: 94.5% 13.4% +Recalc: <0.01% + +In the non optimized case the timer is requeued in 94.5% of the cases. With +the index optimization in place the requeue rate drops to 13.4%. The case +where the lockless index calculation has to be redone is less than 0.01%. + +With a real world test case (networking) we observed the following changes: + + Before After +Match: 97.8% 99.7% +Requeue: 2.2% 0.3% +Recalc: <0.001% + +That means two percent less lock/requeue/unlock operations in one of the hot +path use cases of timers. + +Signed-off-by: Anna-Maria Gleixner +Signed-off-by: Thomas Gleixner +Cc: Peter Zijlstra +Cc: Frederic Weisbecker +Cc: Chris Mason +Cc: Eric Dumazet +Cc: rt@linutronix.de +Cc: "Paul E. McKenney" +Cc: Arjan van de Ven +Signed-off-by: Sebastian Andrzej Siewior +--- + kernel/time/timer.c | 51 +++++++++++++++++++++++++++++++++++---------------- + 1 file changed, 35 insertions(+), 16 deletions(-) + +--- a/kernel/time/timer.c ++++ b/kernel/time/timer.c +@@ -975,28 +975,36 @@ static inline int + __mod_timer(struct timer_list *timer, unsigned long expires, bool pending_only) + { + struct timer_base *base, *new_base; +- unsigned long flags; ++ unsigned int idx = UINT_MAX; ++ unsigned long clk = 0, flags; + int ret = 0; + + /* +- * TODO: Calculate the array bucket of the timer right here w/o +- * holding the base lock. This allows to check not only +- * timer->expires == expires below, but also whether the timer +- * ends up in the same bucket. If we really need to requeue +- * the timer then we check whether base->clk have +- * advanced between here and locking the timer base. If +- * jiffies advanced we have to recalc the array bucket with the +- * lock held. +- */ +- +- /* +- * This is a common optimization triggered by the +- * networking code - if the timer is re-modified +- * to be the same thing then just return: ++ * This is a common optimization triggered by the networking code - if ++ * the timer is re-modified to be the same thing or ends up in the ++ * same array bucket then just return: + */ + if (timer_pending(timer)) { + if (timer->expires == expires) + return 1; ++ /* ++ * Take the current timer_jiffies of base, but without holding ++ * the lock! ++ */ ++ base = get_timer_base(timer->flags); ++ clk = base->clk; ++ ++ idx = calc_wheel_index(expires, clk); ++ ++ /* ++ * Retrieve and compare the array index of the pending ++ * timer. If it matches set the expiry to the new value so a ++ * subsequent call will exit in the expires check above. ++ */ ++ if (idx == timer_get_idx(timer)) { ++ timer->expires = expires; ++ return 1; ++ } + } + + timer_stats_timer_set_start_info(timer); +@@ -1033,7 +1041,18 @@ static inline int + } + + timer->expires = expires; +- internal_add_timer(base, timer); ++ /* ++ * If idx was calculated above and the base time did not advance ++ * between calculating idx and taking the lock, only enqueue_timer() ++ * and trigger_dyntick_cpu() is required. Otherwise we need to ++ * (re)calculate the wheel index via internal_add_timer(). ++ */ ++ if (idx != UINT_MAX && clk == base->clk) { ++ enqueue_timer(base, timer, idx); ++ trigger_dyntick_cpu(base, timer); ++ } else { ++ internal_add_timer(base, timer); ++ } + + out_unlock: + spin_unlock_irqrestore(&base->lock, flags); diff --git a/debian/patches/features/all/rt/timer-Optimize-collect-timers-for-NOHZ.patch b/debian/patches/features/all/rt/timer-Optimize-collect-timers-for-NOHZ.patch new file mode 100644 index 000000000000..52387f88ad8e --- /dev/null +++ b/debian/patches/features/all/rt/timer-Optimize-collect-timers-for-NOHZ.patch @@ -0,0 +1,129 @@ +From: Anna-Maria Gleixner +Date: Mon, 4 Jul 2016 09:50:34 +0000 +Subject: [PATCH 17/22] timer: Optimize collect timers for NOHZ +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz + +After a NOHZ idle sleep the wheel must be forwarded to current jiffies. There +might be expired timers so the current code loops and checks the epxired +buckets for timers. This can take quite some time for long NOHZ idle periods. + +The pending bitmask in the timer base allows us to do a quick search for the +next expiring timer and therefor a fast forward of the base time which +prevents pointless long lasting loops. + +For a 3 second idle sleep this reduces the catchup time from ~1ms to 5us. + +Signed-off-by: Anna-Maria Gleixner +Signed-off-by: Thomas Gleixner +Cc: Peter Zijlstra +Cc: Frederic Weisbecker +Cc: Chris Mason +Cc: Eric Dumazet +Cc: rt@linutronix.de +Cc: "Paul E. McKenney" +Cc: Arjan van de Ven +Signed-off-by: Sebastian Andrzej Siewior +--- + kernel/time/timer.c | 49 +++++++++++++++++++++++++++++++++++++++++-------- + 1 file changed, 41 insertions(+), 8 deletions(-) + +--- a/kernel/time/timer.c ++++ b/kernel/time/timer.c +@@ -1267,8 +1267,8 @@ static void expire_timers(struct timer_b + } + } + +-static int collect_expired_timers(struct timer_base *base, +- struct hlist_head *heads) ++static int __collect_expired_timers(struct timer_base *base, ++ struct hlist_head *heads) + { + unsigned long clk = base->clk; + struct hlist_head *vec; +@@ -1294,9 +1294,9 @@ static int collect_expired_timers(struct + + #ifdef CONFIG_NO_HZ_COMMON + /* +- * Find the next pending bucket of a level. Search from @offset + @clk upwards +- * and if nothing there, search from start of the level (@offset) up to +- * @offset + clk. ++ * Find the next pending bucket of a level. Search from level start (@offset) ++ * + @clk upwards and if nothing there, search from start of the level ++ * (@offset) up to @offset + clk. + */ + static int next_pending_bucket(struct timer_base *base, unsigned offset, + unsigned clk) +@@ -1313,14 +1313,14 @@ static int next_pending_bucket(struct ti + } + + /* +- * Search the first expiring timer in the various clock levels. ++ * Search the first expiring timer in the various clock levels. Caller must ++ * hold base->lock. + */ + static unsigned long __next_timer_interrupt(struct timer_base *base) + { + unsigned long clk, next, adj; + unsigned lvl, offset = 0; + +- spin_lock(&base->lock); + next = base->clk + NEXT_TIMER_MAX_DELTA; + clk = base->clk; + for (lvl = 0; lvl < LVL_DEPTH; lvl++, offset += LVL_SIZE) { +@@ -1373,7 +1373,6 @@ static unsigned long __next_timer_interr + clk >>= LVL_CLK_SHIFT; + clk += adj; + } +- spin_unlock(&base->lock); + return next; + } + +@@ -1431,7 +1430,10 @@ u64 get_next_timer_interrupt(unsigned lo + if (cpu_is_offline(smp_processor_id())) + return expires; + ++ spin_lock(&base->lock); + nextevt = __next_timer_interrupt(base); ++ spin_unlock(&base->lock); ++ + if (time_before_eq(nextevt, basej)) + expires = basem; + else +@@ -1439,6 +1441,37 @@ u64 get_next_timer_interrupt(unsigned lo + + return cmp_next_hrtimer_event(basem, expires); + } ++ ++static int collect_expired_timers(struct timer_base *base, ++ struct hlist_head *heads) ++{ ++ /* ++ * NOHZ optimization. After a long idle sleep we need to forward the ++ * base to current jiffies. Avoid a loop by searching the bitfield for ++ * the next expiring timer. ++ */ ++ if ((long)(jiffies - base->clk) > 2) { ++ unsigned long next = __next_timer_interrupt(base); ++ ++ /* ++ * If the next timer is ahead of time forward to current ++ * jiffies, otherwise forward to the next expiry time. ++ */ ++ if (time_after(next, jiffies)) { ++ /* The call site will increment clock! */ ++ base->clk = jiffies - 1; ++ return 0; ++ } ++ base->clk = next; ++ } ++ return __collect_expired_timers(base, heads); ++} ++#else ++static inline int collect_expired_timers(struct timer_base *base, ++ struct hlist_head *heads) ++{ ++ return __collect_expired_timers(base, heads); ++} + #endif + + /* diff --git a/debian/patches/features/all/rt/timer-Reduce-the-CPU-index-space-to-256k.patch b/debian/patches/features/all/rt/timer-Reduce-the-CPU-index-space-to-256k.patch new file mode 100644 index 000000000000..2820913e81d6 --- /dev/null +++ b/debian/patches/features/all/rt/timer-Reduce-the-CPU-index-space-to-256k.patch @@ -0,0 +1,35 @@ +From: Thomas Gleixner +Date: Mon, 4 Jul 2016 09:50:29 +0000 +Subject: [PATCH 13/22] timer: Reduce the CPU index space to 256k +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz + +We want to store the array index in the flags space. 256k CPUs should be +enough for a while. + +Signed-off-by: Thomas Gleixner +Reviewed-by: Frederic Weisbecker +Signed-off-by: Sebastian Andrzej Siewior +--- + include/linux/timer.h | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +--- a/include/linux/timer.h ++++ b/include/linux/timer.h +@@ -58,12 +58,12 @@ struct timer_list { + * workqueue locking issues. It's not meant for executing random crap + * with interrupts disabled. Abuse is monitored! + */ +-#define TIMER_CPUMASK 0x0007FFFF +-#define TIMER_MIGRATING 0x00080000 ++#define TIMER_CPUMASK 0x0003FFFF ++#define TIMER_MIGRATING 0x00040000 + #define TIMER_BASEMASK (TIMER_CPUMASK | TIMER_MIGRATING) +-#define TIMER_DEFERRABLE 0x00100000 +-#define TIMER_PINNED 0x00200000 +-#define TIMER_IRQSAFE 0x00400000 ++#define TIMER_DEFERRABLE 0x00080000 ++#define TIMER_PINNED 0x00100000 ++#define TIMER_IRQSAFE 0x00200000 + + #define __TIMER_INITIALIZER(_function, _expires, _data, _flags) { \ + .entry = { .next = TIMER_ENTRY_STATIC }, \ diff --git a/debian/patches/features/all/rt/timer-Remove-mod_timer_pinned.patch b/debian/patches/features/all/rt/timer-Remove-mod_timer_pinned.patch new file mode 100644 index 000000000000..324ca58b0cbe --- /dev/null +++ b/debian/patches/features/all/rt/timer-Remove-mod_timer_pinned.patch @@ -0,0 +1,117 @@ +From: Thomas Gleixner +Date: Mon, 4 Jul 2016 09:50:24 +0000 +Subject: [PATCH 09/22] timer: Remove mod_timer_pinned +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz + +We switched all users to initialize the timers as pinned and call +mod_timer(). Remove the now unused function. + +Signed-off-by: Thomas Gleixner +Reviewed-by: Frederic Weisbecker +Cc: Peter Zijlstra +Cc: Chris Mason +Cc: Eric Dumazet +Cc: rt@linutronix.de +Cc: "Paul E. McKenney" +Cc: Arjan van de Ven +Signed-off-by: Sebastian Andrzej Siewior +--- + include/linux/timer.h | 3 --- + kernel/time/timer.c | 39 +++++---------------------------------- + 2 files changed, 5 insertions(+), 37 deletions(-) + +--- a/include/linux/timer.h ++++ b/include/linux/timer.h +@@ -190,12 +190,9 @@ extern void add_timer_on(struct timer_li + extern int del_timer(struct timer_list * timer); + extern int mod_timer(struct timer_list *timer, unsigned long expires); + extern int mod_timer_pending(struct timer_list *timer, unsigned long expires); +-extern int mod_timer_pinned(struct timer_list *timer, unsigned long expires); + + extern void set_timer_slack(struct timer_list *time, int slack_hz); + +-#define MOD_TIMER_NOT_PINNED 0 +-#define MOD_TIMER_PINNED 1 + /* + * The jiffies value which is added to now, when there is no timer + * in the timer wheel: +--- a/kernel/time/timer.c ++++ b/kernel/time/timer.c +@@ -779,8 +779,7 @@ static struct tvec_base *lock_timer_base + } + + static inline int +-__mod_timer(struct timer_list *timer, unsigned long expires, +- bool pending_only, int pinned) ++__mod_timer(struct timer_list *timer, unsigned long expires, bool pending_only) + { + struct tvec_base *base, *new_base; + unsigned long flags; +@@ -797,7 +796,7 @@ static inline int + + debug_activate(timer, expires); + +- new_base = get_target_base(base, pinned || timer->flags & TIMER_PINNED); ++ new_base = get_target_base(base, timer->flags & TIMER_PINNED); + + if (base != new_base) { + /* +@@ -840,7 +839,7 @@ static inline int + */ + int mod_timer_pending(struct timer_list *timer, unsigned long expires) + { +- return __mod_timer(timer, expires, true, MOD_TIMER_NOT_PINNED); ++ return __mod_timer(timer, expires, true); + } + EXPORT_SYMBOL(mod_timer_pending); + +@@ -915,39 +914,11 @@ int mod_timer(struct timer_list *timer, + if (timer_pending(timer) && timer->expires == expires) + return 1; + +- return __mod_timer(timer, expires, false, MOD_TIMER_NOT_PINNED); ++ return __mod_timer(timer, expires, false); + } + EXPORT_SYMBOL(mod_timer); + + /** +- * mod_timer_pinned - modify a timer's timeout +- * @timer: the timer to be modified +- * @expires: new timeout in jiffies +- * +- * mod_timer_pinned() is a way to update the expire field of an +- * active timer (if the timer is inactive it will be activated) +- * and to ensure that the timer is scheduled on the current CPU. +- * +- * Note that this does not prevent the timer from being migrated +- * when the current CPU goes offline. If this is a problem for +- * you, use CPU-hotplug notifiers to handle it correctly, for +- * example, cancelling the timer when the corresponding CPU goes +- * offline. +- * +- * mod_timer_pinned(timer, expires) is equivalent to: +- * +- * del_timer(timer); timer->expires = expires; add_timer(timer); +- */ +-int mod_timer_pinned(struct timer_list *timer, unsigned long expires) +-{ +- if (timer->expires == expires && timer_pending(timer)) +- return 1; +- +- return __mod_timer(timer, expires, false, MOD_TIMER_PINNED); +-} +-EXPORT_SYMBOL(mod_timer_pinned); +- +-/** + * add_timer - start a timer + * @timer: the timer to be added + * +@@ -1527,7 +1498,7 @@ signed long __sched schedule_timeout(sig + expire = timeout + jiffies; + + setup_timer_on_stack(&timer, process_timeout, (unsigned long)current); +- __mod_timer(&timer, expire, false, MOD_TIMER_NOT_PINNED); ++ __mod_timer(&timer, expire, false); + schedule(); + del_singleshot_timer_sync(&timer); + diff --git a/debian/patches/features/all/rt/timer-Remove-slack-leftovers.patch b/debian/patches/features/all/rt/timer-Remove-slack-leftovers.patch new file mode 100644 index 000000000000..6322b05e01a1 --- /dev/null +++ b/debian/patches/features/all/rt/timer-Remove-slack-leftovers.patch @@ -0,0 +1,162 @@ +From: Thomas Gleixner +Date: Mon, 4 Jul 2016 09:50:31 +0000 +Subject: [PATCH 15/22] timer: Remove slack leftovers +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz + +We now have implicit batching in the timer wheel. The slack is not longer +used. Remove it. + +Signed-off-by: Thomas Gleixner +Cc: Peter Zijlstra +Cc: Frederic Weisbecker +Cc: Chris Mason +Cc: Eric Dumazet +Cc: rt@linutronix.de +Cc: "Paul E. McKenney" +Cc: Arjan van de Ven +Signed-off-by: Sebastian Andrzej Siewior +--- + block/genhd.c | 5 ----- + drivers/mmc/host/jz4740_mmc.c | 2 -- + drivers/power/bq27xxx_battery.c | 5 +---- + drivers/usb/host/ohci-hcd.c | 1 - + drivers/usb/host/xhci.c | 2 -- + include/linux/timer.h | 4 ---- + kernel/time/timer.c | 19 ------------------- + lib/random32.c | 1 - + 8 files changed, 1 insertion(+), 38 deletions(-) + +--- a/block/genhd.c ++++ b/block/genhd.c +@@ -1523,12 +1523,7 @@ static void __disk_unblock_events(struct + if (--ev->block) + goto out_unlock; + +- /* +- * Not exactly a latency critical operation, set poll timer +- * slack to 25% and kick event check. +- */ + intv = disk_events_poll_jiffies(disk); +- set_timer_slack(&ev->dwork.timer, intv / 4); + if (check_now) + queue_delayed_work(system_freezable_power_efficient_wq, + &ev->dwork, 0); +--- a/drivers/mmc/host/jz4740_mmc.c ++++ b/drivers/mmc/host/jz4740_mmc.c +@@ -1068,8 +1068,6 @@ static int jz4740_mmc_probe(struct platf + jz4740_mmc_clock_disable(host); + setup_timer(&host->timeout_timer, jz4740_mmc_timeout, + (unsigned long)host); +- /* It is not important when it times out, it just needs to timeout. */ +- set_timer_slack(&host->timeout_timer, HZ); + + host->use_dma = true; + if (host->use_dma && jz4740_mmc_acquire_dma_channels(host) != 0) +--- a/drivers/power/bq27xxx_battery.c ++++ b/drivers/power/bq27xxx_battery.c +@@ -735,11 +735,8 @@ static void bq27xxx_battery_poll(struct + + bq27xxx_battery_update(di); + +- if (poll_interval > 0) { +- /* The timer does not have to be accurate. */ +- set_timer_slack(&di->work.timer, poll_interval * HZ / 4); ++ if (poll_interval > 0) + schedule_delayed_work(&di->work, poll_interval * HZ); +- } + } + + /* +--- a/drivers/usb/host/ohci-hcd.c ++++ b/drivers/usb/host/ohci-hcd.c +@@ -500,7 +500,6 @@ static int ohci_init (struct ohci_hcd *o + + setup_timer(&ohci->io_watchdog, io_watchdog_func, + (unsigned long) ohci); +- set_timer_slack(&ohci->io_watchdog, msecs_to_jiffies(20)); + + ohci->hcca = dma_alloc_coherent (hcd->self.controller, + sizeof(*ohci->hcca), &ohci->hcca_dma, GFP_KERNEL); +--- a/drivers/usb/host/xhci.c ++++ b/drivers/usb/host/xhci.c +@@ -490,8 +490,6 @@ static void compliance_mode_recovery_tim + xhci->comp_mode_recovery_timer.expires = jiffies + + msecs_to_jiffies(COMP_MODE_RCVRY_MSECS); + +- set_timer_slack(&xhci->comp_mode_recovery_timer, +- msecs_to_jiffies(COMP_MODE_RCVRY_MSECS)); + add_timer(&xhci->comp_mode_recovery_timer); + xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, + "Compliance mode recovery timer initialized"); +--- a/include/linux/timer.h ++++ b/include/linux/timer.h +@@ -19,7 +19,6 @@ struct timer_list { + void (*function)(unsigned long); + unsigned long data; + u32 flags; +- int slack; + + #ifdef CONFIG_TIMER_STATS + int start_pid; +@@ -73,7 +72,6 @@ struct timer_list { + .expires = (_expires), \ + .data = (_data), \ + .flags = (_flags), \ +- .slack = -1, \ + __TIMER_LOCKDEP_MAP_INITIALIZER( \ + __FILE__ ":" __stringify(__LINE__)) \ + } +@@ -193,8 +191,6 @@ extern int del_timer(struct timer_list * + extern int mod_timer(struct timer_list *timer, unsigned long expires); + extern int mod_timer_pending(struct timer_list *timer, unsigned long expires); + +-extern void set_timer_slack(struct timer_list *time, int slack_hz); +- + /* + * The jiffies value which is added to now, when there is no timer + * in the timer wheel: +--- a/kernel/time/timer.c ++++ b/kernel/time/timer.c +@@ -447,24 +447,6 @@ unsigned long round_jiffies_up_relative( + } + EXPORT_SYMBOL_GPL(round_jiffies_up_relative); + +-/** +- * set_timer_slack - set the allowed slack for a timer +- * @timer: the timer to be modified +- * @slack_hz: the amount of time (in jiffies) allowed for rounding +- * +- * Set the amount of time, in jiffies, that a certain timer has +- * in terms of slack. By setting this value, the timer subsystem +- * will schedule the actual timer somewhere between +- * the time mod_timer() asks for, and that time plus the slack. +- * +- * By setting the slack to -1, a percentage of the delay is used +- * instead. +- */ +-void set_timer_slack(struct timer_list *timer, int slack_hz) +-{ +- timer->slack = slack_hz; +-} +-EXPORT_SYMBOL_GPL(set_timer_slack); + + static inline unsigned int timer_get_idx(struct timer_list *timer) + { +@@ -790,7 +772,6 @@ static void do_init_timer(struct timer_l + { + timer->entry.pprev = NULL; + timer->flags = flags | raw_smp_processor_id(); +- timer->slack = -1; + #ifdef CONFIG_TIMER_STATS + timer->start_site = NULL; + timer->start_pid = -1; +--- a/lib/random32.c ++++ b/lib/random32.c +@@ -233,7 +233,6 @@ static void __prandom_timer(unsigned lon + + static void __init __prandom_start_seed_timer(void) + { +- set_timer_slack(&seed_timer, HZ); + seed_timer.expires = jiffies + msecs_to_jiffies(40 * MSEC_PER_SEC); + add_timer(&seed_timer); + } diff --git a/debian/patches/features/all/rt/timer-Split-out-index-calculation.patch b/debian/patches/features/all/rt/timer-Split-out-index-calculation.patch new file mode 100644 index 000000000000..403e0af709e8 --- /dev/null +++ b/debian/patches/features/all/rt/timer-Split-out-index-calculation.patch @@ -0,0 +1,106 @@ +From: Anna-Maria Gleixner +Date: Mon, 4 Jul 2016 09:50:39 +0000 +Subject: [PATCH 21/22] timer: Split out index calculation +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz + +For further optimizations we need to seperate index calculation and +queueing. No functional change. + +Signed-off-by: Anna-Maria Gleixner +Signed-off-by: Thomas Gleixner +Cc: Peter Zijlstra +Cc: Frederic Weisbecker +Cc: Chris Mason +Cc: Eric Dumazet +Cc: rt@linutronix.de +Cc: "Paul E. McKenney" +Cc: Arjan van de Ven +Signed-off-by: Sebastian Andrzej Siewior +--- + kernel/time/timer.c | 47 ++++++++++++++++++++++++++++++++--------------- + 1 file changed, 32 insertions(+), 15 deletions(-) + +--- a/kernel/time/timer.c ++++ b/kernel/time/timer.c +@@ -471,12 +471,9 @@ static inline unsigned calc_index(unsign + return LVL_OFFS(lvl) + (expires & LVL_MASK); + } + +-static void +-__internal_add_timer(struct timer_base *base, struct timer_list *timer) ++static int calc_wheel_index(unsigned long expires, unsigned long clk) + { +- unsigned long expires = timer->expires; +- unsigned long delta = expires - base->clk; +- struct hlist_head *vec; ++ unsigned long delta = expires - clk; + unsigned int idx; + + if (delta < LVL_START(1)) { +@@ -496,7 +493,7 @@ static void + } else if (LVL_DEPTH > 8 && delta < LVL_START(8)) { + idx = calc_index(expires, 7); + } else if ((long) delta < 0) { +- idx = base->clk & LVL_MASK; ++ idx = clk & LVL_MASK; + } else { + /* + * Force expire obscene large timeouts to expire at the +@@ -507,20 +504,33 @@ static void + + idx = calc_index(expires, LVL_DEPTH - 1); + } +- /* +- * Enqueue the timer into the array bucket, mark it pending in +- * the bitmap and store the index in the timer flags. +- */ +- vec = base->vectors + idx; +- hlist_add_head(&timer->entry, vec); ++ return idx; ++} ++ ++/* ++ * Enqueue the timer into the hash bucket, mark it pending in ++ * the bitmap and store the index in the timer flags. ++ */ ++static void enqueue_timer(struct timer_base *base, struct timer_list *timer, ++ unsigned int idx) ++{ ++ hlist_add_head(&timer->entry, base->vectors + idx); + __set_bit(idx, base->pending_map); + timer_set_idx(timer, idx); + } + +-static void internal_add_timer(struct timer_base *base, struct timer_list *timer) ++static void ++__internal_add_timer(struct timer_base *base, struct timer_list *timer) + { +- __internal_add_timer(base, timer); ++ unsigned int idx; ++ ++ idx = calc_wheel_index(timer->expires, base->clk); ++ enqueue_timer(base, timer, idx); ++} + ++static void ++trigger_dyntick_cpu(struct timer_base *base, struct timer_list *timer) ++{ + if (!IS_ENABLED(CONFIG_NO_HZ_COMMON) || !base->nohz_active) + return; + +@@ -551,7 +561,14 @@ static void internal_add_timer(struct ti + * wheel + */ + base->next_expiry = timer->expires; +- wake_up_nohz_cpu(base->cpu); ++ wake_up_nohz_cpu(base->cpu); ++} ++ ++static void ++internal_add_timer(struct timer_base *base, struct timer_list *timer) ++{ ++ __internal_add_timer(base, timer); ++ trigger_dyntick_cpu(base, timer); + } + + #ifdef CONFIG_TIMER_STATS diff --git a/debian/patches/features/all/rt/timer-Switch-to-a-non-cascading-wheel.patch b/debian/patches/features/all/rt/timer-Switch-to-a-non-cascading-wheel.patch new file mode 100644 index 000000000000..9a72b663a4b5 --- /dev/null +++ b/debian/patches/features/all/rt/timer-Switch-to-a-non-cascading-wheel.patch @@ -0,0 +1,1170 @@ +From: Thomas Gleixner +Date: Mon, 4 Jul 2016 09:50:30 +0000 +Subject: [PATCH 14/22] timer: Switch to a non cascading wheel +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz + +The current timer wheel has some drawbacks: + +1) Cascading + + Cascading can be an unbound operation and is completely pointless in most + cases because the vast majority of the timer wheel timers are canceled or + rearmed before expiration. + +2) No fast lookup of the next expiring timer + + In NOHZ scenarios the first timer soft interrupt after a long NOHZ period + must fast forward the base time to current jiffies. As we have no way to + find the next expiring timer fast, the code loops and increments the base + time by one and checks for expired timers in each step. + +After a thorough analysis of real world data gathered on laptops, +workstations, webservers and other machines (thanks Chris!) I came to the +conclusion that the current 'classic' timer wheel implementation can be +modified to address the above issues. + +The vast majority of timer wheel timers is canceled or rearmed before +expiry. Most of them are timeouts for networking and other I/O tasks. The +nature of timeouts is to catch the exception from normal operation (TCP ack +timed out, disk does not respond, etc.). For these kind of timeouts the +accuracy is not really a concern. In case the timeout fires, performance is +down the drain already. + +The few timers which actually expire can be split into two categories: + + 1) Short expiry times which expect halfways accurate expiry + + 2) Long term expiry times are inaccurate today already due to the batching + which is done for NOHZ. + +So for long term expiry timers we can avoid the cascading property and just +leave them in the less granular outer wheels until expiry or +cancelation. Timers which are armed with a timeout larger than the wheel +capacity are not longer cascaded. We expire them with the longest possible +timeout (6+ days). We have not observed such timeouts in our data collection, +but at least we handle them with the least surprising effect. + +To avoid extending the wheel levels for HZ=1000 so we can accomodate the +longest observed timeouts (5 days in the network conntrack code) we reduce the +first level granularity on HZ=1000 to 4ms, which effectively is the same as +the HZ=250 behaviour. From our data analysis there is nothing which relies on +that 1ms granularity and as a side effect we get better batching and timer +locality for the networking code as well. + +Contrary to the classic wheel the granularity of the next wheel is not the +capacity of the first wheel. The granularities of the wheels are in the +currently chosen setting 8 times the granularity of the previous wheel. So for +HZ=250 we end up with the following granularity levels: + +Level Offset Granularity Range + 0 0 4 ms 0 ms - 252 ms + 1 64 32 ms 256 ms - 2044 ms (256ms - ~2s) + 2 128 256 ms 2048 ms - 16380 ms (~2s - ~16s) + 3 192 2048 ms (~2s) 16384 ms - 131068 ms (~16s - ~2m) + 4 256 16384 ms (~16s) 131072 ms - 1048572 ms (~2m - ~17m) + 5 320 131072 ms (~2m) 1048576 ms - 8388604 ms (~17m - ~2h) + 6 384 1048576 ms (~17m) 8388608 ms - 67108863 ms (~2h - ~18h) + 7 448 8388608 ms (~2h) 67108864 ms - 536870911 ms (~18h - ~6d) + +That's a worst case inaccuracy of 12.5% for the timers which are queued at the +beginning of a level. + +So the new wheel concept addresses the old issues: + +1) Cascading is avoided (except for extreme long time timers) + +2) By keeping the timers in the bucket until expiry/cancelation we can track + the buckets which have timers enqueued in a bucket bitmap and therefor can + lookup the next expiring timer fast and time bound. + +A further benefit of the concept is, that the slack calculation which is done +on every timer start is not longer necessary because the granularity levels +provide natural batching already. + +Our extensive testing with various loads did not show any performance +degradation vs. the current wheel implementation. + +This patch does not address the 'fast lookup' issue as we wanted to make sure +that there is no regression introduced by the wheel redesign. The +optimizations are in follow up patches. + +[ Contains fixes from Anna-Maria Gleixner and Richard Cochran ] + +Signed-off-by: Thomas Gleixner +Cc: Peter Zijlstra +Cc: Frederic Weisbecker +Cc: Chris Mason +Cc: Eric Dumazet +Cc: rt@linutronix.de +Cc: "Paul E. McKenney" +Cc: Arjan van de Ven +Signed-off-by: Sebastian Andrzej Siewior +--- + include/linux/timer.h | 2 + kernel/time/timer.c | 825 ++++++++++++++++++++++++++++---------------------- + 2 files changed, 467 insertions(+), 360 deletions(-) + +--- a/include/linux/timer.h ++++ b/include/linux/timer.h +@@ -64,6 +64,8 @@ struct timer_list { + #define TIMER_DEFERRABLE 0x00080000 + #define TIMER_PINNED 0x00100000 + #define TIMER_IRQSAFE 0x00200000 ++#define TIMER_ARRAYSHIFT 22 ++#define TIMER_ARRAYMASK 0xFFC00000 + + #define __TIMER_INITIALIZER(_function, _expires, _data, _flags) { \ + .entry = { .next = TIMER_ENTRY_STATIC }, \ +--- a/kernel/time/timer.c ++++ b/kernel/time/timer.c +@@ -59,43 +59,151 @@ + EXPORT_SYMBOL(jiffies_64); + + /* +- * per-CPU timer vector definitions: ++ * The timer wheel has LVL_DEPTH array levels. Each level provides an array of ++ * LVL_SIZE buckets. Each level is driven by its own clock and therefor each ++ * level has a different granularity. ++ * ++ * The level granularity is: LVL_CLK_DIV ^ lvl ++ * The level clock frequency is: HZ / (LVL_CLK_DIV ^ level) ++ * ++ * The array level of a newly armed timer depends on the relative expiry ++ * time. The farther the expiry time is away the higher the array level and ++ * therefor the granularity becomes. ++ * ++ * Contrary to the original timer wheel implementation, which aims for 'exact' ++ * expiry of the timers, this implementation removes the need for recascading ++ * the timers into the lower array levels. The previous 'classic' timer wheel ++ * implementation of the kernel already violated the 'exact' expiry by adding ++ * slack to the expiry time to provide batched expiration. The granularity ++ * levels provide implicit batching. ++ * ++ * This is an optimization of the original timer wheel implementation for the ++ * majority of the timer wheel use cases: timeouts. The vast majority of ++ * timeout timers (networking, disk I/O ...) are canceled before expiry. If ++ * the timeout expires it indicates that normal operation is disturbed, so it ++ * does not matter much whether the timeout comes with a slight delay. ++ * ++ * The only exception to this are networking timers with a small expiry ++ * time. They rely on the granularity. Those fit into the first wheel level, ++ * which has HZ granularity. ++ * ++ * We don't have cascading anymore. timers with a expiry time above the ++ * capacity of the last wheel level are force expired at the maximum timeout ++ * value of the last wheel level. From data sampling we know that the maximum ++ * value observed is 5 days (network connection tracking), so this should not ++ * be an issue. ++ * ++ * The currently chosen array constants values are a good compromise between ++ * array size and granularity. ++ * ++ * This results in the following granularity and range levels: ++ * ++ * HZ 1000 steps ++ * Level Offset Granularity Range ++ * 0 0 1 ms 0 ms - 63 ms ++ * 1 64 8 ms 64 ms - 511 ms ++ * 2 128 64 ms 512 ms - 4095 ms (512ms - ~4s) ++ * 3 192 512 ms 4096 ms - 32767 ms (~4s - ~32s) ++ * 4 256 4096 ms (~4s) 32768 ms - 262143 ms (~32s - ~4m) ++ * 5 320 32768 ms (~32s) 262144 ms - 2097151 ms (~4m - ~34m) ++ * 6 384 262144 ms (~4m) 2097152 ms - 16777215 ms (~34m - ~4h) ++ * 7 448 2097152 ms (~34m) 16777216 ms - 134217727 ms (~4h - ~1d) ++ * 8 512 16777216 ms (~4h) 134217728 ms - 1073741822 ms (~1d - ~12d) ++ * ++ * HZ 300 ++ * Level Offset Granularity Range ++ * 0 0 3 ms 0 ms - 210 ms ++ * 1 64 26 ms 213 ms - 1703 ms (213ms - ~1s) ++ * 2 128 213 ms 1706 ms - 13650 ms (~1s - ~13s) ++ * 3 192 1706 ms (~1s) 13653 ms - 109223 ms (~13s - ~1m) ++ * 4 256 13653 ms (~13s) 109226 ms - 873810 ms (~1m - ~14m) ++ * 5 320 109226 ms (~1m) 873813 ms - 6990503 ms (~14m - ~1h) ++ * 6 384 873813 ms (~14m) 6990506 ms - 55924050 ms (~1h - ~15h) ++ * 7 448 6990506 ms (~1h) 55924053 ms - 447392423 ms (~15h - ~5d) ++ * 8 512 55924053 ms (~15h) 447392426 ms - 3579139406 ms (~5d - ~41d) ++ * ++ * HZ 250 ++ * Level Offset Granularity Range ++ * 0 0 4 ms 0 ms - 255 ms ++ * 1 64 32 ms 256 ms - 2047 ms (256ms - ~2s) ++ * 2 128 256 ms 2048 ms - 16383 ms (~2s - ~16s) ++ * 3 192 2048 ms (~2s) 16384 ms - 131071 ms (~16s - ~2m) ++ * 4 256 16384 ms (~16s) 131072 ms - 1048575 ms (~2m - ~17m) ++ * 5 320 131072 ms (~2m) 1048576 ms - 8388607 ms (~17m - ~2h) ++ * 6 384 1048576 ms (~17m) 8388608 ms - 67108863 ms (~2h - ~18h) ++ * 7 448 8388608 ms (~2h) 67108864 ms - 536870911 ms (~18h - ~6d) ++ * 8 512 67108864 ms (~18h) 536870912 ms - 4294967288 ms (~6d - ~49d) ++ * ++ * HZ 100 ++ * Level Offset Granularity Range ++ * 0 0 10 ms 0 ms - 630 ms ++ * 1 64 80 ms 640 ms - 5110 ms (640ms - ~5s) ++ * 2 128 640 ms 5120 ms - 40950 ms (~5s - ~40s) ++ * 3 192 5120 ms (~5s) 40960 ms - 327670 ms (~40s - ~5m) ++ * 4 256 40960 ms (~40s) 327680 ms - 2621430 ms (~5m - ~43m) ++ * 5 320 327680 ms (~5m) 2621440 ms - 20971510 ms (~43m - ~5h) ++ * 6 384 2621440 ms (~43m) 20971520 ms - 167772150 ms (~5h - ~1d) ++ * 7 448 20971520 ms (~5h) 167772160 ms - 1342177270 ms (~1d - ~15d) ++ */ ++ ++/* Clock divisor for the next level */ ++#define LVL_CLK_SHIFT 3 ++#define LVL_CLK_DIV (1UL << LVL_CLK_SHIFT) ++#define LVL_CLK_MASK (LVL_CLK_DIV - 1) ++#define LVL_SHIFT(n) ((n) * LVL_CLK_SHIFT) ++#define LVL_GRAN(n) (1UL << LVL_SHIFT(n)) ++ ++/* ++ * The time start value for each level to select the bucket at enqueue ++ * time. + */ +-#define TVN_BITS (CONFIG_BASE_SMALL ? 4 : 6) +-#define TVR_BITS (CONFIG_BASE_SMALL ? 6 : 8) +-#define TVN_SIZE (1 << TVN_BITS) +-#define TVR_SIZE (1 << TVR_BITS) +-#define TVN_MASK (TVN_SIZE - 1) +-#define TVR_MASK (TVR_SIZE - 1) +-#define MAX_TVAL ((unsigned long)((1ULL << (TVR_BITS + 4*TVN_BITS)) - 1)) ++#define LVL_START(n) ((LVL_SIZE - 1) << (((n) - 1) * LVL_CLK_SHIFT)) + +-struct tvec { +- struct hlist_head vec[TVN_SIZE]; +-}; ++/* Size of each clock level */ ++#define LVL_BITS 6 ++#define LVL_SIZE (1UL << LVL_BITS) ++#define LVL_MASK (LVL_SIZE - 1) ++#define LVL_OFFS(n) ((n) * LVL_SIZE) ++ ++/* Level depth */ ++#if HZ > 100 ++# define LVL_DEPTH 9 ++# else ++# define LVL_DEPTH 8 ++#endif + +-struct tvec_root { +- struct hlist_head vec[TVR_SIZE]; +-}; ++/* The cutoff (max. capacity of the wheel) */ ++#define WHEEL_TIMEOUT_CUTOFF (LVL_START(LVL_DEPTH)) ++#define WHEEL_TIMEOUT_MAX (WHEEL_TIMEOUT_CUTOFF - LVL_GRAN(LVL_DEPTH - 1)) ++ ++/* ++ * The resulting wheel size. If NOHZ is configured we allocate two ++ * wheels so we have a separate storage for the deferrable timers. ++ */ ++#define WHEEL_SIZE (LVL_SIZE * LVL_DEPTH) ++ ++#ifdef CONFIG_NO_HZ_COMMON ++# define NR_BASES 2 ++# define BASE_STD 0 ++# define BASE_DEF 1 ++#else ++# define NR_BASES 1 ++# define BASE_STD 0 ++# define BASE_DEF 0 ++#endif + + struct timer_base { +- spinlock_t lock; +- struct timer_list *running_timer; +- unsigned long clk; +- unsigned long next_timer; +- unsigned long active_timers; +- unsigned long all_timers; +- int cpu; +- bool migration_enabled; +- bool nohz_active; +- struct tvec_root tv1; +- struct tvec tv2; +- struct tvec tv3; +- struct tvec tv4; +- struct tvec tv5; ++ spinlock_t lock; ++ struct timer_list *running_timer; ++ unsigned long clk; ++ unsigned int cpu; ++ bool migration_enabled; ++ bool nohz_active; ++ DECLARE_BITMAP(pending_map, WHEEL_SIZE); ++ struct hlist_head vectors[WHEEL_SIZE]; + } ____cacheline_aligned; + +- +-static DEFINE_PER_CPU(struct timer_base, timer_bases); ++static DEFINE_PER_CPU(struct timer_base, timer_bases[NR_BASES]); + + #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON) + unsigned int sysctl_timer_migration = 1; +@@ -106,15 +214,17 @@ void timers_update_migration(bool update + unsigned int cpu; + + /* Avoid the loop, if nothing to update */ +- if (this_cpu_read(timer_bases.migration_enabled) == on) ++ if (this_cpu_read(timer_bases[BASE_STD].migration_enabled) == on) + return; + + for_each_possible_cpu(cpu) { +- per_cpu(timer_bases.migration_enabled, cpu) = on; ++ per_cpu(timer_bases[BASE_STD].migration_enabled, cpu) = on; ++ per_cpu(timer_bases[BASE_DEF].migration_enabled, cpu) = on; + per_cpu(hrtimer_bases.migration_enabled, cpu) = on; + if (!update_nohz) + continue; +- per_cpu(timer_bases.nohz_active, cpu) = true; ++ per_cpu(timer_bases[BASE_STD].nohz_active, cpu) = true; ++ per_cpu(timer_bases[BASE_DEF].nohz_active, cpu) = true; + per_cpu(hrtimer_bases.nohz_active, cpu) = true; + } + } +@@ -133,20 +243,6 @@ int timer_migration_handler(struct ctl_t + mutex_unlock(&mutex); + return ret; + } +- +-static inline struct timer_base *get_target_base(struct timer_base *base, +- int pinned) +-{ +- if (pinned || !base->migration_enabled) +- return this_cpu_ptr(&timer_bases); +- return per_cpu_ptr(&timer_bases, get_nohz_timer_target()); +-} +-#else +-static inline struct timer_base *get_target_base(struct timer_base *base, +- int pinned) +-{ +- return this_cpu_ptr(&timer_bases); +-} + #endif + + static unsigned long round_jiffies_common(unsigned long j, int cpu, +@@ -370,78 +466,91 @@ void set_timer_slack(struct timer_list * + } + EXPORT_SYMBOL_GPL(set_timer_slack); + ++static inline unsigned int timer_get_idx(struct timer_list *timer) ++{ ++ return (timer->flags & TIMER_ARRAYMASK) >> TIMER_ARRAYSHIFT; ++} ++ ++static inline void timer_set_idx(struct timer_list *timer, unsigned int idx) ++{ ++ timer->flags = (timer->flags & ~TIMER_ARRAYMASK) | ++ idx << TIMER_ARRAYSHIFT; ++} ++ ++/* ++ * Helper function to calculate the array index for a given expiry ++ * time. ++ */ ++static inline unsigned calc_index(unsigned expires, unsigned lvl) ++{ ++ expires = (expires + LVL_GRAN(lvl)) >> LVL_SHIFT(lvl); ++ return LVL_OFFS(lvl) + (expires & LVL_MASK); ++} ++ + static void + __internal_add_timer(struct timer_base *base, struct timer_list *timer) + { + unsigned long expires = timer->expires; +- unsigned long idx = expires - base->clk; ++ unsigned long delta = expires - base->clk; + struct hlist_head *vec; ++ unsigned int idx; + +- if (idx < TVR_SIZE) { +- int i = expires & TVR_MASK; +- vec = base->tv1.vec + i; +- } else if (idx < 1 << (TVR_BITS + TVN_BITS)) { +- int i = (expires >> TVR_BITS) & TVN_MASK; +- vec = base->tv2.vec + i; +- } else if (idx < 1 << (TVR_BITS + 2 * TVN_BITS)) { +- int i = (expires >> (TVR_BITS + TVN_BITS)) & TVN_MASK; +- vec = base->tv3.vec + i; +- } else if (idx < 1 << (TVR_BITS + 3 * TVN_BITS)) { +- int i = (expires >> (TVR_BITS + 2 * TVN_BITS)) & TVN_MASK; +- vec = base->tv4.vec + i; +- } else if ((signed long) idx < 0) { +- /* +- * Can happen if you add a timer with expires == jiffies, +- * or you set a timer to go off in the past +- */ +- vec = base->tv1.vec + (base->clk & TVR_MASK); ++ if (delta < LVL_START(1)) { ++ idx = calc_index(expires, 0); ++ } else if (delta < LVL_START(2)) { ++ idx = calc_index(expires, 1); ++ } else if (delta < LVL_START(3)) { ++ idx = calc_index(expires, 2); ++ } else if (delta < LVL_START(4)) { ++ idx = calc_index(expires, 3); ++ } else if (delta < LVL_START(5)) { ++ idx = calc_index(expires, 4); ++ } else if (delta < LVL_START(6)) { ++ idx = calc_index(expires, 5); ++ } else if (delta < LVL_START(7)) { ++ idx = calc_index(expires, 6); ++ } else if (LVL_DEPTH > 8 && delta < LVL_START(8)) { ++ idx = calc_index(expires, 7); ++ } else if ((long) delta < 0) { ++ idx = base->clk & LVL_MASK; + } else { +- int i; +- /* If the timeout is larger than MAX_TVAL (on 64-bit +- * architectures or with CONFIG_BASE_SMALL=1) then we +- * use the maximum timeout. ++ /* ++ * Force expire obscene large timeouts to expire at the ++ * capacity limit of the wheel. + */ +- if (idx > MAX_TVAL) { +- idx = MAX_TVAL; +- expires = idx + base->clk; +- } +- i = (expires >> (TVR_BITS + 3 * TVN_BITS)) & TVN_MASK; +- vec = base->tv5.vec + i; +- } ++ if (expires >= WHEEL_TIMEOUT_CUTOFF) ++ expires = WHEEL_TIMEOUT_MAX; + ++ idx = calc_index(expires, LVL_DEPTH - 1); ++ } ++ /* ++ * Enqueue the timer into the array bucket, mark it pending in ++ * the bitmap and store the index in the timer flags. ++ */ ++ vec = base->vectors + idx; + hlist_add_head(&timer->entry, vec); ++ __set_bit(idx, base->pending_map); ++ timer_set_idx(timer, idx); + } + + static void internal_add_timer(struct timer_base *base, struct timer_list *timer) + { +- /* Advance base->jiffies, if the base is empty */ +- if (!base->all_timers++) +- base->clk = jiffies; +- + __internal_add_timer(base, timer); +- /* +- * Update base->active_timers and base->next_timer +- */ +- if (!(timer->flags & TIMER_DEFERRABLE)) { +- if (!base->active_timers++ || +- time_before(timer->expires, base->next_timer)) +- base->next_timer = timer->expires; +- } + + /* + * Check whether the other CPU is in dynticks mode and needs +- * to be triggered to reevaluate the timer wheel. +- * We are protected against the other CPU fiddling +- * with the timer by holding the timer base lock. This also +- * makes sure that a CPU on the way to stop its tick can not +- * evaluate the timer wheel. ++ * to be triggered to reevaluate the timer wheel. We are ++ * protected against the other CPU fiddling with the timer by ++ * holding the timer base lock. This also makes sure that a ++ * CPU on the way to stop its tick can not evaluate the timer ++ * wheel. + * + * Spare the IPI for deferrable timers on idle targets though. + * The next busy ticks will take care of it. Except full dynticks + * require special care against races with idle_cpu(), lets deal + * with that later. + */ +- if (base->nohz_active) { ++ if (IS_ENABLED(CONFIG_NO_HZ_COMMON) && base->nohz_active) { + if (!(timer->flags & TIMER_DEFERRABLE) || + tick_nohz_full_cpu(base->cpu)) + wake_up_nohz_cpu(base->cpu); +@@ -721,54 +830,87 @@ static inline void detach_timer(struct t + entry->next = LIST_POISON2; + } + +-static inline void +-detach_expired_timer(struct timer_list *timer, struct timer_base *base) +-{ +- detach_timer(timer, true); +- if (!(timer->flags & TIMER_DEFERRABLE)) +- base->active_timers--; +- base->all_timers--; +-} +- + static int detach_if_pending(struct timer_list *timer, struct timer_base *base, + bool clear_pending) + { ++ unsigned idx = timer_get_idx(timer); ++ + if (!timer_pending(timer)) + return 0; + ++ if (hlist_is_singular_node(&timer->entry, base->vectors + idx)) ++ __clear_bit(idx, base->pending_map); ++ + detach_timer(timer, clear_pending); +- if (!(timer->flags & TIMER_DEFERRABLE)) { +- base->active_timers--; +- if (timer->expires == base->next_timer) +- base->next_timer = base->clk; +- } +- /* If this was the last timer, advance base->jiffies */ +- if (!--base->all_timers) +- base->clk = jiffies; + return 1; + } + ++static inline struct timer_base *get_timer_cpu_base(u32 tflags, u32 cpu) ++{ ++ struct timer_base *base = per_cpu_ptr(&timer_bases[BASE_STD], cpu); ++ ++ /* ++ * If the timer is deferrable and nohz is active then we need to use ++ * the deferrable base. ++ */ ++ if (IS_ENABLED(CONFIG_NO_HZ_COMMON) && base->nohz_active && ++ (tflags & TIMER_DEFERRABLE)) ++ base = per_cpu_ptr(&timer_bases[BASE_DEF], cpu); ++ return base; ++} ++ ++static inline struct timer_base *get_timer_this_cpu_base(u32 tflags) ++{ ++ struct timer_base *base = this_cpu_ptr(&timer_bases[BASE_STD]); ++ ++ /* ++ * If the timer is deferrable and nohz is active then we need to use ++ * the deferrable base. ++ */ ++ if (IS_ENABLED(CONFIG_NO_HZ_COMMON) && base->nohz_active && ++ (tflags & TIMER_DEFERRABLE)) ++ base = this_cpu_ptr(&timer_bases[BASE_DEF]); ++ return base; ++} ++ ++static inline struct timer_base *get_timer_base(u32 tflags) ++{ ++ return get_timer_cpu_base(tflags, tflags & TIMER_CPUMASK); ++} ++ ++static inline struct timer_base *get_target_base(struct timer_base *base, ++ unsigned tflags) ++{ ++#if defined(CONFIG_NO_HZ_COMMON) && defined(CONFIG_SMP) ++ if ((tflags & TIMER_PINNED) || !base->migration_enabled) ++ return get_timer_this_cpu_base(tflags); ++ return get_timer_cpu_base(tflags, get_nohz_timer_target()); ++#else ++ return get_timer_this_cpu_base(tflags); ++#endif ++} ++ + /* +- * We are using hashed locking: holding per_cpu(timer_bases).lock +- * means that all timers which are tied to this base via timer->base are +- * locked, and the base itself is locked too. ++ * We are using hashed locking: Holding per_cpu(timer_bases[x]).lock means ++ * that all timers which are tied to this base are locked, and the base itself ++ * is locked too. + * + * So __run_timers/migrate_timers can safely modify all timers which could +- * be found on ->tvX lists. ++ * be found in the base->vectors array. + * +- * When the timer's base is locked and removed from the list, the +- * TIMER_MIGRATING flag is set, FIXME ++ * When a timer is migrating then the TIMER_MIGRATING flag is set and we need ++ * to wait until the migration is done. + */ + static struct timer_base *lock_timer_base(struct timer_list *timer, +- unsigned long *flags) ++ unsigned long *flags) + __acquires(timer->base->lock) + { + for (;;) { +- u32 tf = timer->flags; + struct timer_base *base; ++ u32 tf = timer->flags; + + if (!(tf & TIMER_MIGRATING)) { +- base = per_cpu_ptr(&timer_bases, tf & TIMER_CPUMASK); ++ base = get_timer_base(tf); + spin_lock_irqsave(&base->lock, *flags); + if (timer->flags == tf) + return base; +@@ -785,6 +927,27 @@ static inline int + unsigned long flags; + int ret = 0; + ++ /* ++ * TODO: Calculate the array bucket of the timer right here w/o ++ * holding the base lock. This allows to check not only ++ * timer->expires == expires below, but also whether the timer ++ * ends up in the same bucket. If we really need to requeue ++ * the timer then we check whether base->clk have ++ * advanced between here and locking the timer base. If ++ * jiffies advanced we have to recalc the array bucket with the ++ * lock held. ++ */ ++ ++ /* ++ * This is a common optimization triggered by the ++ * networking code - if the timer is re-modified ++ * to be the same thing then just return: ++ */ ++ if (timer_pending(timer)) { ++ if (timer->expires == expires) ++ return 1; ++ } ++ + timer_stats_timer_set_start_info(timer); + BUG_ON(!timer->function); + +@@ -796,15 +959,15 @@ static inline int + + debug_activate(timer, expires); + +- new_base = get_target_base(base, timer->flags & TIMER_PINNED); ++ new_base = get_target_base(base, timer->flags); + + if (base != new_base) { + /* +- * We are trying to schedule the timer on the local CPU. ++ * We are trying to schedule the timer on the new base. + * However we can't change timer's base while it is running, + * otherwise del_timer_sync() can't detect that the timer's +- * handler yet has not finished. This also guarantees that +- * the timer is serialized wrt itself. ++ * handler yet has not finished. This also guarantees that the ++ * timer is serialized wrt itself. + */ + if (likely(base->running_timer != timer)) { + /* See the comment in lock_timer_base() */ +@@ -843,45 +1006,6 @@ int mod_timer_pending(struct timer_list + } + EXPORT_SYMBOL(mod_timer_pending); + +-/* +- * Decide where to put the timer while taking the slack into account +- * +- * Algorithm: +- * 1) calculate the maximum (absolute) time +- * 2) calculate the highest bit where the expires and new max are different +- * 3) use this bit to make a mask +- * 4) use the bitmask to round down the maximum time, so that all last +- * bits are zeros +- */ +-static inline +-unsigned long apply_slack(struct timer_list *timer, unsigned long expires) +-{ +- unsigned long expires_limit, mask; +- int bit; +- +- if (timer->slack >= 0) { +- expires_limit = expires + timer->slack; +- } else { +- long delta = expires - jiffies; +- +- if (delta < 256) +- return expires; +- +- expires_limit = expires + delta / 256; +- } +- mask = expires ^ expires_limit; +- if (mask == 0) +- return expires; +- +- bit = __fls(mask); +- +- mask = (1UL << bit) - 1; +- +- expires_limit = expires_limit & ~(mask); +- +- return expires_limit; +-} +- + /** + * mod_timer - modify a timer's timeout + * @timer: the timer to be modified +@@ -904,16 +1028,6 @@ unsigned long apply_slack(struct timer_l + */ + int mod_timer(struct timer_list *timer, unsigned long expires) + { +- expires = apply_slack(timer, expires); +- +- /* +- * This is a common optimization triggered by the +- * networking code - if the timer is re-modified +- * to be the same thing then just return: +- */ +- if (timer_pending(timer) && timer->expires == expires) +- return 1; +- + return __mod_timer(timer, expires, false); + } + EXPORT_SYMBOL(mod_timer); +@@ -948,13 +1062,14 @@ EXPORT_SYMBOL(add_timer); + */ + void add_timer_on(struct timer_list *timer, int cpu) + { +- struct timer_base *new_base = per_cpu_ptr(&timer_bases, cpu); +- struct timer_base *base; ++ struct timer_base *new_base, *base; + unsigned long flags; + + timer_stats_timer_set_start_info(timer); + BUG_ON(timer_pending(timer) || !timer->function); + ++ new_base = get_timer_cpu_base(timer->flags, cpu); ++ + /* + * If @timer was on a different CPU, it should be migrated with the + * old base locked to prevent other operations proceeding with the +@@ -1100,27 +1215,6 @@ int del_timer_sync(struct timer_list *ti + EXPORT_SYMBOL(del_timer_sync); + #endif + +-static int cascade(struct timer_base *base, struct tvec *tv, int index) +-{ +- /* cascade all the timers from tv up one level */ +- struct timer_list *timer; +- struct hlist_node *tmp; +- struct hlist_head tv_list; +- +- hlist_move_list(tv->vec + index, &tv_list); +- +- /* +- * We are removing _all_ timers from the list, so we +- * don't have to detach them individually. +- */ +- hlist_for_each_entry_safe(timer, tmp, &tv_list, entry) { +- /* No accounting, while moving them */ +- __internal_add_timer(base, timer); +- } +- +- return index; +-} +- + static void call_timer_fn(struct timer_list *timer, void (*fn)(unsigned long), + unsigned long data) + { +@@ -1164,68 +1258,80 @@ static void call_timer_fn(struct timer_l + } + } + +-#define INDEX(N) ((base->clk >> (TVR_BITS + (N) * TVN_BITS)) & TVN_MASK) ++static void expire_timers(struct timer_base *base, struct hlist_head *head) ++{ ++ while (!hlist_empty(head)) { ++ struct timer_list *timer; ++ void (*fn)(unsigned long); ++ unsigned long data; ++ ++ timer = hlist_entry(head->first, struct timer_list, entry); ++ timer_stats_account_timer(timer); ++ ++ base->running_timer = timer; ++ detach_timer(timer, true); ++ ++ fn = timer->function; ++ data = timer->data; ++ ++ if (timer->flags & TIMER_IRQSAFE) { ++ spin_unlock(&base->lock); ++ call_timer_fn(timer, fn, data); ++ spin_lock(&base->lock); ++ } else { ++ spin_unlock_irq(&base->lock); ++ call_timer_fn(timer, fn, data); ++ spin_lock_irq(&base->lock); ++ } ++ } ++} ++ ++static int collect_expired_timers(struct timer_base *base, ++ struct hlist_head *heads) ++{ ++ unsigned long clk = base->clk; ++ struct hlist_head *vec; ++ int i, levels = 0; ++ unsigned int idx; ++ ++ for (i = 0; i < LVL_DEPTH; i++) { ++ idx = (clk & LVL_MASK) + i * LVL_SIZE; ++ ++ if (__test_and_clear_bit(idx, base->pending_map)) { ++ vec = base->vectors + idx; ++ hlist_move_list(vec, heads++); ++ levels++; ++ } ++ /* Is it time to look at the next level? */ ++ if (clk & LVL_CLK_MASK) ++ break; ++ /* Shift clock for the next level granularity */ ++ clk >>= LVL_CLK_SHIFT; ++ } ++ return levels; ++} + + /** + * __run_timers - run all expired timers (if any) on this CPU. + * @base: the timer vector to be processed. +- * +- * This function cascades all vectors and executes all expired timer +- * vectors. + */ + static inline void __run_timers(struct timer_base *base) + { +- struct timer_list *timer; ++ struct hlist_head heads[LVL_DEPTH]; ++ int levels; ++ ++ if (!time_after_eq(jiffies, base->clk)) ++ return; + + spin_lock_irq(&base->lock); + + while (time_after_eq(jiffies, base->clk)) { +- struct hlist_head work_list; +- struct hlist_head *head = &work_list; +- int index; + +- if (!base->all_timers) { +- base->clk = jiffies; +- break; +- } +- +- index = base->clk & TVR_MASK; ++ levels = collect_expired_timers(base, heads); ++ base->clk++; + +- /* +- * Cascade timers: +- */ +- if (!index && +- (!cascade(base, &base->tv2, INDEX(0))) && +- (!cascade(base, &base->tv3, INDEX(1))) && +- !cascade(base, &base->tv4, INDEX(2))) +- cascade(base, &base->tv5, INDEX(3)); +- ++base->clk; +- hlist_move_list(base->tv1.vec + index, head); +- while (!hlist_empty(head)) { +- void (*fn)(unsigned long); +- unsigned long data; +- bool irqsafe; +- +- timer = hlist_entry(head->first, struct timer_list, entry); +- fn = timer->function; +- data = timer->data; +- irqsafe = timer->flags & TIMER_IRQSAFE; +- +- timer_stats_account_timer(timer); +- +- base->running_timer = timer; +- detach_expired_timer(timer, base); +- +- if (irqsafe) { +- spin_unlock(&base->lock); +- call_timer_fn(timer, fn, data); +- spin_lock(&base->lock); +- } else { +- spin_unlock_irq(&base->lock); +- call_timer_fn(timer, fn, data); +- spin_lock_irq(&base->lock); +- } +- } ++ while (levels--) ++ expire_timers(base, heads + levels); + } + base->running_timer = NULL; + spin_unlock_irq(&base->lock); +@@ -1233,78 +1339,87 @@ static inline void __run_timers(struct t + + #ifdef CONFIG_NO_HZ_COMMON + /* +- * Find out when the next timer event is due to happen. This +- * is used on S/390 to stop all activity when a CPU is idle. +- * This function needs to be called with interrupts disabled. ++ * Find the next pending bucket of a level. Search from @offset + @clk upwards ++ * and if nothing there, search from start of the level (@offset) up to ++ * @offset + clk. ++ */ ++static int next_pending_bucket(struct timer_base *base, unsigned offset, ++ unsigned clk) ++{ ++ unsigned pos, start = offset + clk; ++ unsigned end = offset + LVL_SIZE; ++ ++ pos = find_next_bit(base->pending_map, end, start); ++ if (pos < end) ++ return pos - start; ++ ++ pos = find_next_bit(base->pending_map, start, offset); ++ return pos < start ? pos + LVL_SIZE - start : -1; ++} ++ ++/* ++ * Search the first expiring timer in the various clock levels. + */ + static unsigned long __next_timer_interrupt(struct timer_base *base) + { +- unsigned long clk = base->clk; +- unsigned long expires = clk + NEXT_TIMER_MAX_DELTA; +- int index, slot, array, found = 0; +- struct timer_list *nte; +- struct tvec *varray[4]; +- +- /* Look for timer events in tv1. */ +- index = slot = clk & TVR_MASK; +- do { +- hlist_for_each_entry(nte, base->tv1.vec + slot, entry) { +- if (nte->flags & TIMER_DEFERRABLE) +- continue; +- +- found = 1; +- expires = nte->expires; +- /* Look at the cascade bucket(s)? */ +- if (!index || slot < index) +- goto cascade; +- return expires; +- } +- slot = (slot + 1) & TVR_MASK; +- } while (slot != index); ++ unsigned long clk, next, adj; ++ unsigned lvl, offset = 0; + +-cascade: +- /* Calculate the next cascade event */ +- if (index) +- clk += TVR_SIZE - index; +- clk >>= TVR_BITS; +- +- /* Check tv2-tv5. */ +- varray[0] = &base->tv2; +- varray[1] = &base->tv3; +- varray[2] = &base->tv4; +- varray[3] = &base->tv5; +- +- for (array = 0; array < 4; array++) { +- struct tvec *varp = varray[array]; +- +- index = slot = clk & TVN_MASK; +- do { +- hlist_for_each_entry(nte, varp->vec + slot, entry) { +- if (nte->flags & TIMER_DEFERRABLE) +- continue; +- +- found = 1; +- if (time_before(nte->expires, expires)) +- expires = nte->expires; +- } +- /* +- * Do we still search for the first timer or are +- * we looking up the cascade buckets ? +- */ +- if (found) { +- /* Look at the cascade bucket(s)? */ +- if (!index || slot < index) +- break; +- return expires; +- } +- slot = (slot + 1) & TVN_MASK; +- } while (slot != index); +- +- if (index) +- clk += TVN_SIZE - index; +- clk >>= TVN_BITS; ++ spin_lock(&base->lock); ++ next = base->clk + NEXT_TIMER_MAX_DELTA; ++ clk = base->clk; ++ for (lvl = 0; lvl < LVL_DEPTH; lvl++, offset += LVL_SIZE) { ++ int pos = next_pending_bucket(base, offset, clk & LVL_MASK); ++ ++ if (pos >= 0) { ++ unsigned long tmp = clk + (unsigned long) pos; ++ ++ tmp <<= LVL_SHIFT(lvl); ++ if (time_before(tmp, next)) ++ next = tmp; ++ } ++ /* ++ * Clock for the next level. If the current level clock lower ++ * bits are zero, we look at the next level as is. If not we ++ * need to advance it by one because that's going to be the ++ * next expiring bucket in that level. base->clk is the next ++ * expiring jiffie. So in case of: ++ * ++ * LVL5 LVL4 LVL3 LVL2 LVL1 LVL0 ++ * 0 0 0 0 0 0 ++ * ++ * we have to look at all levels @index 0. With ++ * ++ * LVL5 LVL4 LVL3 LVL2 LVL1 LVL0 ++ * 0 0 0 0 0 2 ++ * ++ * LVL0 has the next expiring bucket @index 2. The upper ++ * levels have the next expiring bucket @index 1. ++ * ++ * In case that the propagation wraps the next level the same ++ * rules apply: ++ * ++ * LVL5 LVL4 LVL3 LVL2 LVL1 LVL0 ++ * 0 0 0 0 F 2 ++ * ++ * So after looking at LVL0 we get: ++ * ++ * LVL5 LVL4 LVL3 LVL2 LVL1 ++ * 0 0 0 1 0 ++ * ++ * So no propagation from LVL1 to LVL2 because that happened ++ * with the add already, but then we need to propagate further ++ * from LVL2 to LVL3. ++ * ++ * So the simple check whether the lower bits of the current ++ * level are 0 or not is sufficient for all cases. ++ */ ++ adj = clk & LVL_CLK_MASK ? 1 : 0; ++ clk >>= LVL_CLK_SHIFT; ++ clk += adj; + } +- return expires; ++ spin_unlock(&base->lock); ++ return next; + } + + /* +@@ -1350,7 +1465,7 @@ static u64 cmp_next_hrtimer_event(u64 ba + */ + u64 get_next_timer_interrupt(unsigned long basej, u64 basem) + { +- struct timer_base *base = this_cpu_ptr(&timer_bases); ++ struct timer_base *base = this_cpu_ptr(&timer_bases[BASE_STD]); + u64 expires = KTIME_MAX; + unsigned long nextevt; + +@@ -1361,17 +1476,11 @@ u64 get_next_timer_interrupt(unsigned lo + if (cpu_is_offline(smp_processor_id())) + return expires; + +- spin_lock(&base->lock); +- if (base->active_timers) { +- if (time_before_eq(base->next_timer, base->clk)) +- base->next_timer = __next_timer_interrupt(base); +- nextevt = base->next_timer; +- if (time_before_eq(nextevt, basej)) +- expires = basem; +- else +- expires = basem + (nextevt - basej) * TICK_NSEC; +- } +- spin_unlock(&base->lock); ++ nextevt = __next_timer_interrupt(base); ++ if (time_before_eq(nextevt, basej)) ++ expires = basem; ++ else ++ expires = basem + (nextevt - basej) * TICK_NSEC; + + return cmp_next_hrtimer_event(basem, expires); + } +@@ -1402,10 +1511,11 @@ void update_process_times(int user_tick) + */ + static void run_timer_softirq(struct softirq_action *h) + { +- struct timer_base *base = this_cpu_ptr(&timer_bases); ++ struct timer_base *base = this_cpu_ptr(&timer_bases[BASE_STD]); + +- if (time_after_eq(jiffies, base->clk)) +- __run_timers(base); ++ __run_timers(base); ++ if (IS_ENABLED(CONFIG_NO_HZ_COMMON) && base->nohz_active) ++ __run_timers(this_cpu_ptr(&timer_bases[BASE_DEF])); + } + + /* +@@ -1556,7 +1666,6 @@ static void migrate_timer_list(struct ti + + while (!hlist_empty(head)) { + timer = hlist_entry(head->first, struct timer_list, entry); +- /* We ignore the accounting on the dying cpu */ + detach_timer(timer, false); + timer->flags = (timer->flags & ~TIMER_BASEMASK) | cpu; + internal_add_timer(new_base, timer); +@@ -1567,35 +1676,29 @@ static void migrate_timers(int cpu) + { + struct timer_base *old_base; + struct timer_base *new_base; +- int i; ++ int b, i; + + BUG_ON(cpu_online(cpu)); +- old_base = per_cpu_ptr(&timer_bases, cpu); +- new_base = get_cpu_ptr(&timer_bases); +- /* +- * The caller is globally serialized and nobody else +- * takes two locks at once, deadlock is not possible. +- */ +- spin_lock_irq(&new_base->lock); +- spin_lock_nested(&old_base->lock, SINGLE_DEPTH_NESTING); + +- BUG_ON(old_base->running_timer); ++ for (b = 0; b < NR_BASES; b++) { ++ old_base = per_cpu_ptr(&timer_bases[b], cpu); ++ new_base = get_cpu_ptr(&timer_bases[b]); ++ /* ++ * The caller is globally serialized and nobody else ++ * takes two locks at once, deadlock is not possible. ++ */ ++ spin_lock_irq(&new_base->lock); ++ spin_lock_nested(&old_base->lock, SINGLE_DEPTH_NESTING); ++ ++ BUG_ON(old_base->running_timer); ++ ++ for (i = 0; i < WHEEL_SIZE; i++) ++ migrate_timer_list(new_base, old_base->vectors + i); + +- for (i = 0; i < TVR_SIZE; i++) +- migrate_timer_list(new_base, old_base->tv1.vec + i); +- for (i = 0; i < TVN_SIZE; i++) { +- migrate_timer_list(new_base, old_base->tv2.vec + i); +- migrate_timer_list(new_base, old_base->tv3.vec + i); +- migrate_timer_list(new_base, old_base->tv4.vec + i); +- migrate_timer_list(new_base, old_base->tv5.vec + i); +- } +- +- old_base->active_timers = 0; +- old_base->all_timers = 0; +- +- spin_unlock(&old_base->lock); +- spin_unlock_irq(&new_base->lock); +- put_cpu_ptr(&timer_bases); ++ spin_unlock(&old_base->lock); ++ spin_unlock_irq(&new_base->lock); ++ put_cpu_ptr(&timer_bases); ++ } + } + + static int timer_cpu_notify(struct notifier_block *self, +@@ -1623,13 +1726,15 @@ static inline void timer_register_cpu_no + + static void __init init_timer_cpu(int cpu) + { +- struct timer_base *base = per_cpu_ptr(&timer_bases, cpu); +- +- base->cpu = cpu; +- spin_lock_init(&base->lock); ++ struct timer_base *base; ++ int i; + +- base->clk = jiffies; +- base->next_timer = base->clk; ++ for (i = 0; i < NR_BASES; i++) { ++ base = per_cpu_ptr(&timer_bases[i], cpu); ++ base->cpu = cpu; ++ spin_lock_init(&base->lock); ++ base->clk = jiffies; ++ } + } + + static void __init init_timer_cpus(void) diff --git a/debian/patches/features/all/rt/timer-add-setup_deferrable_timer-macro.patch b/debian/patches/features/all/rt/timer-add-setup_deferrable_timer-macro.patch new file mode 100644 index 000000000000..f64e0edc72e9 --- /dev/null +++ b/debian/patches/features/all/rt/timer-add-setup_deferrable_timer-macro.patch @@ -0,0 +1,27 @@ +From: Lucas Stach +Date: Tue, 12 Jan 2016 18:17:19 +0100 +Subject: [PATCH] timer: add setup_deferrable_timer macro +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz + +Upstream commit 6f3ffc19157a14b182d9d0c449cd613cef421fe1 + +Add the trivial missing macro to setup a deferrable timer. + +Signed-off-by: Lucas Stach +Acked-by: Thomas Gleixner +Signed-off-by: Sebastian Andrzej Siewior +--- + include/linux/timer.h | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/include/linux/timer.h ++++ b/include/linux/timer.h +@@ -145,6 +145,8 @@ static inline void init_timer_on_stack_k + + #define setup_timer(timer, fn, data) \ + __setup_timer((timer), (fn), (data), 0) ++#define setup_deferrable_timer(timer, fn, data) \ ++ __setup_timer((timer), (fn), (data), TIMER_DEFERRABLE) + #define setup_timer_on_stack(timer, fn, data) \ + __setup_timer_on_stack((timer), (fn), (data), 0) + #define setup_deferrable_timer_on_stack(timer, fn, data) \ diff --git a/debian/patches/features/all/rt/timer-delay-waking-softirqs-from-the-jiffy-tick.patch b/debian/patches/features/all/rt/timer-delay-waking-softirqs-from-the-jiffy-tick.patch index 14e7bd9e926d..288abbb714d3 100644 --- a/debian/patches/features/all/rt/timer-delay-waking-softirqs-from-the-jiffy-tick.patch +++ b/debian/patches/features/all/rt/timer-delay-waking-softirqs-from-the-jiffy-tick.patch @@ -1,7 +1,7 @@ From: Peter Zijlstra Date: Fri, 21 Aug 2009 11:56:45 +0200 Subject: timer: delay waking softirqs from the jiffy tick -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz People were complaining about broken balancing with the recent -rt series. @@ -59,7 +59,7 @@ Signed-off-by: Thomas Gleixner --- a/kernel/time/timer.c +++ b/kernel/time/timer.c -@@ -1456,13 +1456,13 @@ void update_process_times(int user_tick) +@@ -1639,13 +1639,13 @@ void update_process_times(int user_tick) /* Note: this timer irq context must be accounted for as well. */ account_process_tick(p, user_tick); diff --git a/debian/patches/features/all/rt/timer-fd-avoid-live-lock.patch b/debian/patches/features/all/rt/timer-fd-avoid-live-lock.patch index a9c23073bd42..8a266fe361d9 100644 --- a/debian/patches/features/all/rt/timer-fd-avoid-live-lock.patch +++ b/debian/patches/features/all/rt/timer-fd-avoid-live-lock.patch @@ -1,7 +1,7 @@ Subject: timer-fd: Prevent live lock From: Thomas Gleixner Date: Wed, 25 Jan 2012 11:08:40 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz If hrtimer_try_to_cancel() requires a retry, then depending on the priority setting te retry loop might prevent timer callback completion diff --git a/debian/patches/features/all/rt/timer-make-the-base-lock-raw.patch b/debian/patches/features/all/rt/timer-make-the-base-lock-raw.patch new file mode 100644 index 000000000000..85aebdeed03c --- /dev/null +++ b/debian/patches/features/all/rt/timer-make-the-base-lock-raw.patch @@ -0,0 +1,181 @@ +From: Sebastian Andrzej Siewior +Date: Wed, 13 Jul 2016 18:22:23 +0200 +Subject: [PATCH] timer: make the base lock raw +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz + +The part where the base lock is held got more predictable / shorter after the +timer rework. One reason is the lack of re-cascading. +That means the lock can be made raw and held in IRQ context. + +Signed-off-by: Sebastian Andrzej Siewior +--- + kernel/time/timer.c | 48 ++++++++++++++++++++++++------------------------ + 1 file changed, 24 insertions(+), 24 deletions(-) + +--- a/kernel/time/timer.c ++++ b/kernel/time/timer.c +@@ -193,7 +193,7 @@ EXPORT_SYMBOL(jiffies_64); + #endif + + struct timer_base { +- spinlock_t lock; ++ raw_spinlock_t lock; + struct timer_list *running_timer; + unsigned long clk; + unsigned long next_expiry; +@@ -962,10 +962,10 @@ static struct timer_base *lock_timer_bas + + if (!(tf & TIMER_MIGRATING)) { + base = get_timer_base(tf); +- spin_lock_irqsave(&base->lock, *flags); ++ raw_spin_lock_irqsave(&base->lock, *flags); + if (timer->flags == tf) + return base; +- spin_unlock_irqrestore(&base->lock, *flags); ++ raw_spin_unlock_irqrestore(&base->lock, *flags); + } + cpu_relax(); + } +@@ -1032,9 +1032,9 @@ static inline int + /* See the comment in lock_timer_base() */ + timer->flags |= TIMER_MIGRATING; + +- spin_unlock(&base->lock); ++ raw_spin_unlock(&base->lock); + base = new_base; +- spin_lock(&base->lock); ++ raw_spin_lock(&base->lock); + WRITE_ONCE(timer->flags, + (timer->flags & ~TIMER_BASEMASK) | base->cpu); + } +@@ -1055,7 +1055,7 @@ static inline int + } + + out_unlock: +- spin_unlock_irqrestore(&base->lock, flags); ++ raw_spin_unlock_irqrestore(&base->lock, flags); + + return ret; + } +@@ -1149,16 +1149,16 @@ void add_timer_on(struct timer_list *tim + if (base != new_base) { + timer->flags |= TIMER_MIGRATING; + +- spin_unlock(&base->lock); ++ raw_spin_unlock(&base->lock); + base = new_base; +- spin_lock(&base->lock); ++ raw_spin_lock(&base->lock); + WRITE_ONCE(timer->flags, + (timer->flags & ~TIMER_BASEMASK) | cpu); + } + + debug_activate(timer, timer->expires); + internal_add_timer(base, timer); +- spin_unlock_irqrestore(&base->lock, flags); ++ raw_spin_unlock_irqrestore(&base->lock, flags); + } + EXPORT_SYMBOL_GPL(add_timer_on); + +@@ -1185,7 +1185,7 @@ int del_timer(struct timer_list *timer) + if (timer_pending(timer)) { + base = lock_timer_base(timer, &flags); + ret = detach_if_pending(timer, base, true); +- spin_unlock_irqrestore(&base->lock, flags); ++ raw_spin_unlock_irqrestore(&base->lock, flags); + } + + return ret; +@@ -1213,7 +1213,7 @@ int try_to_del_timer_sync(struct timer_l + timer_stats_timer_clear_start_info(timer); + ret = detach_if_pending(timer, base, true); + } +- spin_unlock_irqrestore(&base->lock, flags); ++ raw_spin_unlock_irqrestore(&base->lock, flags); + + return ret; + } +@@ -1345,13 +1345,13 @@ static void expire_timers(struct timer_b + data = timer->data; + + if (timer->flags & TIMER_IRQSAFE) { +- spin_unlock(&base->lock); ++ raw_spin_unlock(&base->lock); + call_timer_fn(timer, fn, data); +- spin_lock(&base->lock); ++ raw_spin_lock(&base->lock); + } else { +- spin_unlock_irq(&base->lock); ++ raw_spin_unlock_irq(&base->lock); + call_timer_fn(timer, fn, data); +- spin_lock_irq(&base->lock); ++ raw_spin_lock_irq(&base->lock); + } + } + } +@@ -1519,7 +1519,7 @@ u64 get_next_timer_interrupt(unsigned lo + if (cpu_is_offline(smp_processor_id())) + return expires; + +- spin_lock(&base->lock); ++ raw_spin_lock(&base->lock); + nextevt = __next_timer_interrupt(base); + base->next_expiry = nextevt; + /* +@@ -1541,7 +1541,7 @@ u64 get_next_timer_interrupt(unsigned lo + if ((expires - basem) > TICK_NSEC) + base->is_idle = true; + } +- spin_unlock(&base->lock); ++ raw_spin_unlock(&base->lock); + + return cmp_next_hrtimer_event(basem, expires); + } +@@ -1628,7 +1628,7 @@ static inline void __run_timers(struct t + if (!time_after_eq(jiffies, base->clk)) + return; + +- spin_lock_irq(&base->lock); ++ raw_spin_lock_irq(&base->lock); + + while (time_after_eq(jiffies, base->clk)) { + +@@ -1639,7 +1639,7 @@ static inline void __run_timers(struct t + expire_timers(base, heads + levels); + } + base->running_timer = NULL; +- spin_unlock_irq(&base->lock); ++ raw_spin_unlock_irq(&base->lock); + } + + /* +@@ -1834,16 +1834,16 @@ static void migrate_timers(int cpu) + * The caller is globally serialized and nobody else + * takes two locks at once, deadlock is not possible. + */ +- spin_lock_irq(&new_base->lock); +- spin_lock_nested(&old_base->lock, SINGLE_DEPTH_NESTING); ++ raw_spin_lock_irq(&new_base->lock); ++ raw_spin_lock_nested(&old_base->lock, SINGLE_DEPTH_NESTING); + + BUG_ON(old_base->running_timer); + + for (i = 0; i < WHEEL_SIZE; i++) + migrate_timer_list(new_base, old_base->vectors + i); + +- spin_unlock(&old_base->lock); +- spin_unlock_irq(&new_base->lock); ++ raw_spin_unlock(&old_base->lock); ++ raw_spin_unlock_irq(&new_base->lock); + put_cpu_ptr(&timer_bases); + } + } +@@ -1879,7 +1879,7 @@ static void __init init_timer_cpu(int cp + for (i = 0; i < NR_BASES; i++) { + base = per_cpu_ptr(&timer_bases[i], cpu); + base->cpu = cpu; +- spin_lock_init(&base->lock); ++ raw_spin_lock_init(&base->lock); + base->clk = jiffies; + } + } diff --git a/debian/patches/features/all/rt/timers-avoid-the-base-null-otptimization-on-rt.patch b/debian/patches/features/all/rt/timers-avoid-the-base-null-otptimization-on-rt.patch deleted file mode 100644 index db9584d1f4a6..000000000000 --- a/debian/patches/features/all/rt/timers-avoid-the-base-null-otptimization-on-rt.patch +++ /dev/null @@ -1,74 +0,0 @@ -Subject: timers: Avoid the switch timers base set to NULL trick on RT -From: Thomas Gleixner -Date: Thu, 21 Jul 2011 15:23:39 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz - -On RT that code is preemptible, so we cannot assign NULL to timers -base as a preempter would spin forever in lock_timer_base(). - -Signed-off-by: Thomas Gleixner ---- - kernel/time/timer.c | 45 +++++++++++++++++++++++++++++++++++---------- - 1 file changed, 35 insertions(+), 10 deletions(-) - ---- a/kernel/time/timer.c -+++ b/kernel/time/timer.c -@@ -780,6 +780,39 @@ static struct tvec_base *lock_timer_base - cpu_relax(); - } - } -+#ifdef CONFIG_PREEMPT_RT_FULL -+static inline struct tvec_base *switch_timer_base(struct timer_list *timer, -+ struct tvec_base *old, -+ struct tvec_base *new) -+{ -+ /* -+ * We cannot do the below because we might be preempted and -+ * then the preempter would see NULL and loop forever. -+ */ -+ if (spin_trylock(&new->lock)) { -+ WRITE_ONCE(timer->flags, -+ (timer->flags & ~TIMER_BASEMASK) | new->cpu); -+ spin_unlock(&old->lock); -+ return new; -+ } -+ return old; -+} -+ -+#else -+static inline struct tvec_base *switch_timer_base(struct timer_list *timer, -+ struct tvec_base *old, -+ struct tvec_base *new) -+{ -+ /* See the comment in lock_timer_base() */ -+ timer->flags |= TIMER_MIGRATING; -+ -+ spin_unlock(&old->lock); -+ spin_lock(&new->lock); -+ WRITE_ONCE(timer->flags, -+ (timer->flags & ~TIMER_BASEMASK) | new->cpu); -+ return new; -+} -+#endif - - static inline int - __mod_timer(struct timer_list *timer, unsigned long expires, -@@ -810,16 +843,8 @@ static inline int - * handler yet has not finished. This also guarantees that - * the timer is serialized wrt itself. - */ -- if (likely(base->running_timer != timer)) { -- /* See the comment in lock_timer_base() */ -- timer->flags |= TIMER_MIGRATING; -- -- spin_unlock(&base->lock); -- base = new_base; -- spin_lock(&base->lock); -- WRITE_ONCE(timer->flags, -- (timer->flags & ~TIMER_BASEMASK) | base->cpu); -- } -+ if (likely(base->running_timer != timer)) -+ base = switch_timer_base(timer, base, new_base); - } - - timer->expires = expires; diff --git a/debian/patches/features/all/rt/timers-preempt-rt-support.patch b/debian/patches/features/all/rt/timers-preempt-rt-support.patch deleted file mode 100644 index 94e4d2ca60db..000000000000 --- a/debian/patches/features/all/rt/timers-preempt-rt-support.patch +++ /dev/null @@ -1,55 +0,0 @@ -From: Ingo Molnar -Date: Fri, 3 Jul 2009 08:30:20 -0500 -Subject: timers: Preempt-rt support -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz - -The base->lock is a sleeping lock. Try not to workaround with a -spin_trylock(). The rt-mutex lock is not irq save even the try-lock -due to way how the inner lock accessed. Even with this fixed have the -problem that the owner is not the current process on the CPU but his -pid is used while taking the lock. Therefore we go with ext jiffy for -the wakeup. Also drop preempt_disable() usage since we need just to -ensure not to switch CPUs (the data structures have own locks). - -[bigeasy: dropped that spin try lock] -Signed-off-by: Ingo Molnar -Signed-off-by: Thomas Gleixner ---- - kernel/time/timer.c | 12 ++++++++++-- - 1 file changed, 10 insertions(+), 2 deletions(-) - ---- a/kernel/time/timer.c -+++ b/kernel/time/timer.c -@@ -1422,6 +1422,14 @@ u64 get_next_timer_interrupt(unsigned lo - if (cpu_is_offline(smp_processor_id())) - return expires; - -+#ifdef CONFIG_PREEMPT_RT_FULL -+ /* -+ * On PREEMPT_RT we cannot sleep here. As a result we can't take -+ * the base lock to check when the next timer is pending and so -+ * we assume the next jiffy. -+ */ -+ return basem + TICK_NSEC; -+#endif - spin_lock(&base->lock); - if (base->active_timers) { - if (time_before_eq(base->next_timer, base->timer_jiffies)) -@@ -1632,7 +1640,7 @@ static void migrate_timers(int cpu) - - BUG_ON(cpu_online(cpu)); - old_base = per_cpu_ptr(&tvec_bases, cpu); -- new_base = get_cpu_ptr(&tvec_bases); -+ new_base = get_local_ptr(&tvec_bases); - /* - * The caller is globally serialized and nobody else - * takes two locks at once, deadlock is not possible. -@@ -1656,7 +1664,7 @@ static void migrate_timers(int cpu) - - spin_unlock(&old_base->lock); - spin_unlock_irq(&new_base->lock); -- put_cpu_ptr(&tvec_bases); -+ put_local_ptr(&tvec_bases); - } - - static int timer_cpu_notify(struct notifier_block *self, diff --git a/debian/patches/features/all/rt/timers-prepare-for-full-preemption.patch b/debian/patches/features/all/rt/timers-prepare-for-full-preemption.patch index 39863f2d2975..2ee1de5cf0b1 100644 --- a/debian/patches/features/all/rt/timers-prepare-for-full-preemption.patch +++ b/debian/patches/features/all/rt/timers-prepare-for-full-preemption.patch @@ -1,7 +1,7 @@ From: Ingo Molnar Date: Fri, 3 Jul 2009 08:29:34 -0500 Subject: timers: Prepare for full preemption -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz 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 @@ -13,12 +13,12 @@ Signed-off-by: Thomas Gleixner --- include/linux/timer.h | 2 +- kernel/sched/core.c | 9 +++++++-- - kernel/time/timer.c | 41 ++++++++++++++++++++++++++++++++++++++--- - 3 files changed, 46 insertions(+), 6 deletions(-) + kernel/time/timer.c | 44 ++++++++++++++++++++++++++++++++++++++++---- + 3 files changed, 48 insertions(+), 7 deletions(-) --- a/include/linux/timer.h +++ b/include/linux/timer.h -@@ -225,7 +225,7 @@ extern void add_timer(struct timer_list +@@ -241,7 +241,7 @@ extern void add_timer(struct timer_list extern int try_to_del_timer_sync(struct timer_list *timer); @@ -57,17 +57,17 @@ Signed-off-by: Thomas Gleixner /* --- a/kernel/time/timer.c +++ b/kernel/time/timer.c -@@ -80,6 +80,9 @@ struct tvec_root { - struct tvec_base { - spinlock_t lock; - struct timer_list *running_timer; +@@ -195,6 +195,9 @@ EXPORT_SYMBOL(jiffies_64); + struct timer_base { + raw_spinlock_t lock; + struct timer_list *running_timer; +#ifdef CONFIG_PREEMPT_RT_FULL -+ wait_queue_head_t wait_for_running_timer; ++ struct swait_queue_head wait_for_running_timer; +#endif - unsigned long timer_jiffies; - unsigned long next_timer; - unsigned long active_timers; -@@ -1006,6 +1009,33 @@ void add_timer_on(struct timer_list *tim + unsigned long clk; + unsigned long next_expiry; + unsigned int cpu; +@@ -1162,6 +1165,33 @@ void add_timer_on(struct timer_list *tim } EXPORT_SYMBOL_GPL(add_timer_on); @@ -77,18 +77,18 @@ Signed-off-by: Thomas Gleixner + */ +static void wait_for_running_timer(struct timer_list *timer) +{ -+ struct tvec_base *base; ++ struct timer_base *base; + u32 tf = timer->flags; + + if (tf & TIMER_MIGRATING) + return; + -+ base = per_cpu_ptr(&tvec_bases, tf & TIMER_CPUMASK); -+ wait_event(base->wait_for_running_timer, ++ base = get_timer_base(tf); ++ swait_event(base->wait_for_running_timer, + base->running_timer != timer); +} + -+# define wakeup_timer_waiters(b) wake_up(&(b)->wait_for_running_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) +{ @@ -101,7 +101,7 @@ Signed-off-by: Thomas Gleixner /** * del_timer - deactive a timer. * @timer: the timer to be deactivated -@@ -1063,7 +1093,7 @@ int try_to_del_timer_sync(struct timer_l +@@ -1219,7 +1249,7 @@ int try_to_del_timer_sync(struct timer_l } EXPORT_SYMBOL(try_to_del_timer_sync); @@ -110,7 +110,7 @@ Signed-off-by: Thomas Gleixner /** * del_timer_sync - deactivate a timer and wait for the handler to finish. * @timer: the timer to be deactivated -@@ -1123,7 +1153,7 @@ int del_timer_sync(struct timer_list *ti +@@ -1279,7 +1309,7 @@ int del_timer_sync(struct timer_list *ti int ret = try_to_del_timer_sync(timer); if (ret >= 0) return ret; @@ -119,32 +119,41 @@ Signed-off-by: Thomas Gleixner } } EXPORT_SYMBOL(del_timer_sync); -@@ -1248,15 +1278,17 @@ static inline void __run_timers(struct t - if (irqsafe) { - spin_unlock(&base->lock); - call_timer_fn(timer, fn, data); -+ base->running_timer = NULL; - spin_lock(&base->lock); - } else { - spin_unlock_irq(&base->lock); - call_timer_fn(timer, fn, data); -+ base->running_timer = NULL; - spin_lock_irq(&base->lock); - } +@@ -1344,13 +1374,16 @@ static void expire_timers(struct timer_b + fn = timer->function; + data = timer->data; + +- if (timer->flags & TIMER_IRQSAFE) { ++ if (!IS_ENABLED(CONFIG_PREEMPT_RT_FULL) && ++ timer->flags & TIMER_IRQSAFE) { + raw_spin_unlock(&base->lock); + call_timer_fn(timer, fn, data); ++ base->running_timer = NULL; + raw_spin_lock(&base->lock); + } else { + raw_spin_unlock_irq(&base->lock); + call_timer_fn(timer, fn, data); ++ base->running_timer = NULL; + raw_spin_lock_irq(&base->lock); } } +@@ -1638,8 +1671,8 @@ static inline void __run_timers(struct t + while (levels--) + expire_timers(base, heads + levels); + } - base->running_timer = NULL; + raw_spin_unlock_irq(&base->lock); + wakeup_timer_waiters(base); - spin_unlock_irq(&base->lock); } -@@ -1656,6 +1688,9 @@ static void __init init_timer_cpu(int cp - - base->cpu = cpu; - spin_lock_init(&base->lock); + /* +@@ -1881,6 +1914,9 @@ static void __init init_timer_cpu(int cp + base->cpu = cpu; + raw_spin_lock_init(&base->lock); + base->clk = jiffies; +#ifdef CONFIG_PREEMPT_RT_FULL -+ init_waitqueue_head(&base->wait_for_running_timer); ++ init_swait_queue_head(&base->wait_for_running_timer); +#endif + } + } - base->timer_jiffies = jiffies; - base->next_timer = base->timer_jiffies; diff --git a/debian/patches/features/all/rt/trace-correct-off-by-one-while-recording-the-trace-e.patch b/debian/patches/features/all/rt/trace-correct-off-by-one-while-recording-the-trace-e.patch deleted file mode 100644 index fe6e41d91b2f..000000000000 --- a/debian/patches/features/all/rt/trace-correct-off-by-one-while-recording-the-trace-e.patch +++ /dev/null @@ -1,50 +0,0 @@ -From: Sebastian Andrzej Siewior -Date: Wed, 25 May 2016 14:03:50 +0200 -Subject: [PATCH] trace: correct off by one while recording the trace-event -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz - -Trace events like raw_syscalls show always a preempt code of one. The -reason is that on PREEMPT kernels rcu_read_lock_sched_notrace() -increases the preemption counter and the function recording the counter -is caller within the RCU section. - -Cc: stable-rt@vger.kernel.org -Signed-off-by: Sebastian Andrzej Siewior ---- - include/linux/tracepoint.h | 13 +++++++++++++ - kernel/trace/trace_events.c | 2 +- - 2 files changed, 14 insertions(+), 1 deletion(-) - ---- a/include/linux/tracepoint.h -+++ b/include/linux/tracepoint.h -@@ -33,6 +33,19 @@ struct trace_enum_map { - - #define TRACEPOINT_DEFAULT_PRIO 10 - -+/* -+ * The preempt count recorded in trace_event_raw_event_# are off by one due to -+ * rcu_read_lock_sched_notrace() in __DO_TRACE. This is corrected here. -+ */ -+static inline int event_preempt_count(void) -+{ -+#ifdef CONFIG_PREEMPT -+ return preempt_count() - 1; -+#else -+ return 0; -+#endif -+} -+ - extern int - tracepoint_probe_register(struct tracepoint *tp, void *probe, void *data); - extern int ---- a/kernel/trace/trace_events.c -+++ b/kernel/trace/trace_events.c -@@ -243,7 +243,7 @@ void *trace_event_buffer_reserve(struct - return NULL; - - local_save_flags(fbuffer->flags); -- fbuffer->pc = preempt_count(); -+ fbuffer->pc = event_preempt_count(); - fbuffer->trace_file = trace_file; - - fbuffer->event = diff --git a/debian/patches/features/all/rt/trace-latency-hist-Consider-new-argument-when-probin.patch b/debian/patches/features/all/rt/trace-latency-hist-Consider-new-argument-when-probin.patch index 8ff24723969a..fe74b6908a8e 100644 --- a/debian/patches/features/all/rt/trace-latency-hist-Consider-new-argument-when-probin.patch +++ b/debian/patches/features/all/rt/trace-latency-hist-Consider-new-argument-when-probin.patch @@ -2,7 +2,7 @@ From: Carsten Emde Date: Tue, 5 Jan 2016 10:21:59 +0100 Subject: trace/latency-hist: Consider new argument when probing the sched_switch tracer -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz The sched_switch tracer has got a new argument. Fix the latency tracer accordingly. diff --git a/debian/patches/features/all/rt/trace_Use_rcuidle_version_for_preemptoff_hist_trace_point.patch b/debian/patches/features/all/rt/trace_Use_rcuidle_version_for_preemptoff_hist_trace_point.patch index 5410d3917847..0a32fa25aa97 100644 --- a/debian/patches/features/all/rt/trace_Use_rcuidle_version_for_preemptoff_hist_trace_point.patch +++ b/debian/patches/features/all/rt/trace_Use_rcuidle_version_for_preemptoff_hist_trace_point.patch @@ -1,7 +1,7 @@ Subject: trace: Use rcuidle version for preemptoff_hist trace point From: Yang Shi Date: Tue, 23 Feb 2016 13:23:23 -0800 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz When running -rt kernel with both PREEMPT_OFF_HIST and LOCKDEP enabled, the below error is reported: diff --git a/debian/patches/features/all/rt/tracing-Show-the-preempt-count-of-when-the-event-was.patch b/debian/patches/features/all/rt/tracing-Show-the-preempt-count-of-when-the-event-was.patch new file mode 100644 index 000000000000..aba41251e14b --- /dev/null +++ b/debian/patches/features/all/rt/tracing-Show-the-preempt-count-of-when-the-event-was.patch @@ -0,0 +1,42 @@ +From: "Steven Rostedt (Red Hat)" +Date: Fri, 17 Jun 2016 17:40:58 -0400 +Subject: [PATCH] tracing: Show the preempt count of when the event was called +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz + +Upstream commit e947841c0dce9db675a957182214ef8091ac3d61 + +Because tracepoint callbacks are done with preemption enabled, the trace +events are always called with preempt disable due to the +rcu_read_lock_sched_notrace() in __DO_TRACE(). This causes the preempt count +shown in the recorded trace event to be inaccurate. It is always one more +that what the preempt_count was when the tracepoint was called. + +If CONFIG_PREEMPT is enabled, subtract 1 from the preempt_count before +recording it in the trace buffer. + +Link: http://lkml.kernel.org/r/20160525132537.GA10808@linutronix.de + +Reported-by: Sebastian Andrzej Siewior +Signed-off-by: Steven Rostedt +Signed-off-by: Sebastian Andrzej Siewior +--- + kernel/trace/trace_events.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/kernel/trace/trace_events.c ++++ b/kernel/trace/trace_events.c +@@ -244,6 +244,14 @@ void *trace_event_buffer_reserve(struct + + local_save_flags(fbuffer->flags); + fbuffer->pc = preempt_count(); ++ /* ++ * If CONFIG_PREEMPT is enabled, then the tracepoint itself disables ++ * preemption (adding one to the preempt_count). Since we are ++ * interested in the preempt_count at the time the tracepoint was ++ * hit, we need to subtract one to offset the increment. ++ */ ++ if (IS_ENABLED(CONFIG_PREEMPT)) ++ fbuffer->pc--; + fbuffer->trace_file = trace_file; + + fbuffer->event = diff --git a/debian/patches/features/all/rt/tracing-account-for-preempt-off-in-preempt_schedule.patch b/debian/patches/features/all/rt/tracing-account-for-preempt-off-in-preempt_schedule.patch index 13e76604c888..7c34f6fad9ec 100644 --- a/debian/patches/features/all/rt/tracing-account-for-preempt-off-in-preempt_schedule.patch +++ b/debian/patches/features/all/rt/tracing-account-for-preempt-off-in-preempt_schedule.patch @@ -1,7 +1,7 @@ From: Steven Rostedt Date: Thu, 29 Sep 2011 12:24:30 -0500 Subject: tracing: Account for preempt off in preempt_schedule() -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz The preempt_schedule() uses the preempt_disable_notrace() version because it can cause infinite recursion by the function tracer as diff --git a/debian/patches/features/all/rt/tty-serial-8250-don-t-take-the-trylock-during-oops.patch b/debian/patches/features/all/rt/tty-serial-8250-don-t-take-the-trylock-during-oops.patch index d20ec573731b..8eda9c41ef0d 100644 --- a/debian/patches/features/all/rt/tty-serial-8250-don-t-take-the-trylock-during-oops.patch +++ b/debian/patches/features/all/rt/tty-serial-8250-don-t-take-the-trylock-during-oops.patch @@ -1,8 +1,7 @@ -From 08552bb6e497a6f37a31884083cdd2c046d0f674 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Mon, 11 Apr 2016 16:55:02 +0200 Subject: [PATCH] tty: serial: 8250: don't take the trylock during oops -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz 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 diff --git a/debian/patches/features/all/rt/upstream-net-rt-remove-preemption-disabling-in-netif_rx.patch b/debian/patches/features/all/rt/upstream-net-rt-remove-preemption-disabling-in-netif_rx.patch index 3504458f27b2..ead234fd3334 100644 --- a/debian/patches/features/all/rt/upstream-net-rt-remove-preemption-disabling-in-netif_rx.patch +++ b/debian/patches/features/all/rt/upstream-net-rt-remove-preemption-disabling-in-netif_rx.patch @@ -1,7 +1,7 @@ Subject: net: Remove preemption disabling in netif_rx() From: Priyanka Jain Date: Thu, 17 May 2012 09:35:11 +0530 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz 1)enqueue_to_backlog() (called from netif_rx) should be bind to a particluar CPU. This can be achieved by diff --git a/debian/patches/features/all/rt/usb-use-_nort-in-giveback.patch b/debian/patches/features/all/rt/usb-use-_nort-in-giveback.patch index f187224af98d..d6fc46629d7f 100644 --- a/debian/patches/features/all/rt/usb-use-_nort-in-giveback.patch +++ b/debian/patches/features/all/rt/usb-use-_nort-in-giveback.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Fri, 8 Nov 2013 17:34:54 +0100 Subject: usb: Use _nort in giveback function -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Since commit 94dfd7ed ("USB: HCD: support giveback of URB in tasklet context") I see diff --git a/debian/patches/features/all/rt/user-use-local-irq-nort.patch b/debian/patches/features/all/rt/user-use-local-irq-nort.patch index 5ea6ff435fb5..ac8d3352452b 100644 --- a/debian/patches/features/all/rt/user-use-local-irq-nort.patch +++ b/debian/patches/features/all/rt/user-use-local-irq-nort.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Tue, 21 Jul 2009 23:06:05 +0200 Subject: core: Do not disable interrupts on RT in kernel/users.c -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Use the local_irq_*_nort variants to reduce latencies in RT. The code is serialized by the locks. No need to disable interrupts. diff --git a/debian/patches/features/all/rt/wait.h-include-atomic.h.patch b/debian/patches/features/all/rt/wait.h-include-atomic.h.patch index c0f999b05206..86e7a87ff0e9 100644 --- a/debian/patches/features/all/rt/wait.h-include-atomic.h.patch +++ b/debian/patches/features/all/rt/wait.h-include-atomic.h.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Mon, 28 Oct 2013 12:19:57 +0100 Subject: wait.h: include atomic.h -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz | CC init/main.o |In file included from include/linux/mmzone.h:9:0, diff --git a/debian/patches/features/all/rt/work-queue-work-around-irqsafe-timer-optimization.patch b/debian/patches/features/all/rt/work-queue-work-around-irqsafe-timer-optimization.patch index 24454ca7ad0b..6ee60b24a10a 100644 --- a/debian/patches/features/all/rt/work-queue-work-around-irqsafe-timer-optimization.patch +++ b/debian/patches/features/all/rt/work-queue-work-around-irqsafe-timer-optimization.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Mon, 01 Jul 2013 11:02:42 +0200 Subject: workqueue: Prevent workqueue versus ata-piix livelock -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz 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 diff --git a/debian/patches/features/all/rt/work-simple-Simple-work-queue-implemenation.patch b/debian/patches/features/all/rt/work-simple-Simple-work-queue-implemenation.patch index 52ccd001013a..1b0355c42a57 100644 --- a/debian/patches/features/all/rt/work-simple-Simple-work-queue-implemenation.patch +++ b/debian/patches/features/all/rt/work-simple-Simple-work-queue-implemenation.patch @@ -1,7 +1,7 @@ From: Daniel Wagner Date: Fri, 11 Jul 2014 15:26:11 +0200 Subject: work-simple: Simple work queue implemenation -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Provides a framework for enqueuing callbacks from irq context PREEMPT_RT_FULL safe. The callbacks are executed in kthread context. diff --git a/debian/patches/features/all/rt/workqueue-distangle-from-rq-lock.patch b/debian/patches/features/all/rt/workqueue-distangle-from-rq-lock.patch index c883f0879080..c6a3bf8dd762 100644 --- a/debian/patches/features/all/rt/workqueue-distangle-from-rq-lock.patch +++ b/debian/patches/features/all/rt/workqueue-distangle-from-rq-lock.patch @@ -22,7 +22,7 @@ Cc: Jens Axboe Cc: Linus Torvalds Link: http://lkml.kernel.org/r/20110622174919.135236139@linutronix.de Signed-off-by: Thomas Gleixner -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz --- kernel/sched/core.c | 81 ++++++++------------------------------------ diff --git a/debian/patches/features/all/rt/workqueue-prevent-deadlock-stall.patch b/debian/patches/features/all/rt/workqueue-prevent-deadlock-stall.patch index 0d9ffcca960d..804776d6421e 100644 --- a/debian/patches/features/all/rt/workqueue-prevent-deadlock-stall.patch +++ b/debian/patches/features/all/rt/workqueue-prevent-deadlock-stall.patch @@ -1,7 +1,7 @@ Subject: workqueue: Prevent deadlock/stall on RT From: Thomas Gleixner Date: Fri, 27 Jun 2014 16:24:52 +0200 (CEST) -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.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. diff --git a/debian/patches/features/all/rt/workqueue-use-locallock.patch b/debian/patches/features/all/rt/workqueue-use-locallock.patch index 9ff025afd963..926874b8e801 100644 --- a/debian/patches/features/all/rt/workqueue-use-locallock.patch +++ b/debian/patches/features/all/rt/workqueue-use-locallock.patch @@ -1,7 +1,7 @@ Subject: workqueue: Use local irq lock instead of irq disable regions From: Thomas Gleixner Date: Sun, 17 Jul 2011 21:42:26 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz 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. diff --git a/debian/patches/features/all/rt/workqueue-use-rcu.patch b/debian/patches/features/all/rt/workqueue-use-rcu.patch index 8f1573ada731..f9513d90361f 100644 --- a/debian/patches/features/all/rt/workqueue-use-rcu.patch +++ b/debian/patches/features/all/rt/workqueue-use-rcu.patch @@ -1,7 +1,7 @@ Subject: workqueue: Use normal rcu From: Thomas Gleixner Date: Wed, 24 Jul 2013 15:26:54 +0200 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz 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 diff --git a/debian/patches/features/all/rt/x86-UV-raw_spinlock-conversion.patch b/debian/patches/features/all/rt/x86-UV-raw_spinlock-conversion.patch index 584b0382ef14..09818b3631f7 100644 --- a/debian/patches/features/all/rt/x86-UV-raw_spinlock-conversion.patch +++ b/debian/patches/features/all/rt/x86-UV-raw_spinlock-conversion.patch @@ -1,7 +1,7 @@ From: Mike Galbraith Date: Sun, 2 Nov 2014 08:31:37 +0100 Subject: x86: UV: raw_spinlock conversion -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Shrug. Lots of hobbyists have a beast in their basement, right? diff --git a/debian/patches/features/all/rt/x86-apic-uv-Initialize-timer-as-pinned.patch b/debian/patches/features/all/rt/x86-apic-uv-Initialize-timer-as-pinned.patch new file mode 100644 index 000000000000..0305cca4a423 --- /dev/null +++ b/debian/patches/features/all/rt/x86-apic-uv-Initialize-timer-as-pinned.patch @@ -0,0 +1,41 @@ +From: Thomas Gleixner +Date: Mon, 4 Jul 2016 09:50:16 +0000 +Subject: [PATCH 02/22] x86/apic/uv: Initialize timer as pinned +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz + +Pinned timers must carry that attribute in the timer itself. No functional +change. + +Signed-off-by: Thomas Gleixner +Reviewed-by: Frederic Weisbecker +Cc: Peter Zijlstra +Cc: Chris Mason +Cc: Eric Dumazet +Cc: rt@linutronix.de +Cc: "Paul E. McKenney" +Cc: Arjan van de Ven +Signed-off-by: Sebastian Andrzej Siewior +--- + arch/x86/kernel/apic/x2apic_uv_x.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/x86/kernel/apic/x2apic_uv_x.c ++++ b/arch/x86/kernel/apic/x2apic_uv_x.c +@@ -755,7 +755,7 @@ static void uv_heartbeat(unsigned long i + uv_set_scir_bits(bits); + + /* enable next timer period */ +- mod_timer_pinned(timer, jiffies + SCIR_CPU_HB_INTERVAL); ++ mod_timer(timer, jiffies + SCIR_CPU_HB_INTERVAL); + } + + static void uv_heartbeat_enable(int cpu) +@@ -764,7 +764,7 @@ static void uv_heartbeat_enable(int cpu) + struct timer_list *timer = &uv_cpu_hub_info(cpu)->scir.timer; + + uv_set_cpu_scir_bits(cpu, SCIR_CPU_HEARTBEAT|SCIR_CPU_ACTIVITY); +- setup_timer(timer, uv_heartbeat, cpu); ++ setup_pinned_timer(timer, uv_heartbeat, cpu); + timer->expires = jiffies + SCIR_CPU_HB_INTERVAL; + add_timer_on(timer, cpu); + uv_cpu_hub_info(cpu)->scir.enabled = 1; diff --git a/debian/patches/features/all/rt/x86-crypto-reduce-preempt-disabled-regions.patch b/debian/patches/features/all/rt/x86-crypto-reduce-preempt-disabled-regions.patch index c8c6ff12c74d..d90c761f5454 100644 --- a/debian/patches/features/all/rt/x86-crypto-reduce-preempt-disabled-regions.patch +++ b/debian/patches/features/all/rt/x86-crypto-reduce-preempt-disabled-regions.patch @@ -1,7 +1,7 @@ Subject: x86: crypto: Reduce preempt disabled regions From: Peter Zijlstra Date: Mon, 14 Nov 2011 18:19:27 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Restrict the preempt disabled regions to the actual floating point operations and enable preemption for the administrative actions. diff --git a/debian/patches/features/all/rt/x86-highmem-add-a-already-used-pte-check.patch b/debian/patches/features/all/rt/x86-highmem-add-a-already-used-pte-check.patch index 1ce1dd24f5f2..e884b1267195 100644 --- a/debian/patches/features/all/rt/x86-highmem-add-a-already-used-pte-check.patch +++ b/debian/patches/features/all/rt/x86-highmem-add-a-already-used-pte-check.patch @@ -1,7 +1,7 @@ From: Sebastian Andrzej Siewior Date: Mon, 11 Mar 2013 17:09:55 +0100 Subject: x86/highmem: Add a "already used pte" check -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz This is a copy from kmap_atomic_prot(). diff --git a/debian/patches/features/all/rt/x86-io-apic-migra-no-unmask.patch b/debian/patches/features/all/rt/x86-io-apic-migra-no-unmask.patch index 11b5c284544a..f52619530ac5 100644 --- a/debian/patches/features/all/rt/x86-io-apic-migra-no-unmask.patch +++ b/debian/patches/features/all/rt/x86-io-apic-migra-no-unmask.patch @@ -1,7 +1,7 @@ From: Ingo Molnar Date: Fri, 3 Jul 2009 08:29:27 -0500 Subject: x86/ioapic: Do not unmask io_apic when interrupt is in progress -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz With threaded interrupts we might see an interrupt in progress on migration. Do not unmask it when this is the case. diff --git a/debian/patches/features/all/rt/x86-kvm-require-const-tsc-for-rt.patch b/debian/patches/features/all/rt/x86-kvm-require-const-tsc-for-rt.patch index 9078aae55c92..e9edb73db944 100644 --- a/debian/patches/features/all/rt/x86-kvm-require-const-tsc-for-rt.patch +++ b/debian/patches/features/all/rt/x86-kvm-require-const-tsc-for-rt.patch @@ -1,7 +1,7 @@ Subject: x86: kvm Require const tsc for RT From: Thomas Gleixner Date: Sun, 06 Nov 2011 12:26:18 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Non constant TSC is a nightmare on bare metal already, but with virtualization it becomes a complete disaster because the workarounds diff --git a/debian/patches/features/all/rt/x86-mce-Initialize-timer-as-pinned.patch b/debian/patches/features/all/rt/x86-mce-Initialize-timer-as-pinned.patch new file mode 100644 index 000000000000..0b983a3f76a1 --- /dev/null +++ b/debian/patches/features/all/rt/x86-mce-Initialize-timer-as-pinned.patch @@ -0,0 +1,41 @@ +From: Thomas Gleixner +Date: Mon, 4 Jul 2016 09:50:17 +0000 +Subject: [PATCH 03/22] x86/mce: Initialize timer as pinned +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz + +Pinned timers must carry that attribute in the timer itself. No functional +change. + +Signed-off-by: Thomas Gleixner +Reviewed-by: Frederic Weisbecker +Cc: Peter Zijlstra +Cc: Chris Mason +Cc: Eric Dumazet +Cc: rt@linutronix.de +Cc: "Paul E. McKenney" +Cc: Arjan van de Ven +Signed-off-by: Sebastian Andrzej Siewior +--- + arch/x86/kernel/cpu/mcheck/mce.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/x86/kernel/cpu/mcheck/mce.c ++++ b/arch/x86/kernel/cpu/mcheck/mce.c +@@ -1258,7 +1258,7 @@ static void __restart_timer(struct timer + + if (timer_pending(t)) { + if (time_before(when, t->expires)) +- mod_timer_pinned(t, when); ++ mod_timer(t, when); + } else { + t->expires = round_jiffies(when); + add_timer_on(t, smp_processor_id()); +@@ -1672,7 +1672,7 @@ static void __mcheck_cpu_init_timer(void + struct timer_list *t = this_cpu_ptr(&mce_timer); + unsigned int cpu = smp_processor_id(); + +- setup_timer(t, mce_timer_fn, cpu); ++ setup_pinned_timer(t, mce_timer_fn, cpu); + mce_start_timer(cpu, t); + } + diff --git a/debian/patches/features/all/rt/x86-mce-timer-hrtimer.patch b/debian/patches/features/all/rt/x86-mce-timer-hrtimer.patch index e110a0b08e43..a3d8c85b39d4 100644 --- a/debian/patches/features/all/rt/x86-mce-timer-hrtimer.patch +++ b/debian/patches/features/all/rt/x86-mce-timer-hrtimer.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Mon, 13 Dec 2010 16:33:39 +0100 Subject: x86: Convert mce timer to hrtimer -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz mce_timer is started in atomic contexts of cpu bringup. This results in might_sleep() warnings on RT. Convert mce_timer to a hrtimer to @@ -58,7 +58,7 @@ fold in: - - if (timer_pending(t)) { - if (time_before(when, t->expires)) -- mod_timer_pinned(t, when); +- mod_timer(t, when); - } else { - t->expires = round_jiffies(when); - add_timer_on(t, smp_processor_id()); @@ -135,7 +135,7 @@ fold in: + struct hrtimer *t = this_cpu_ptr(&mce_timer); unsigned int cpu = smp_processor_id(); -- setup_timer(t, mce_timer_fn, cpu); +- setup_pinned_timer(t, mce_timer_fn, cpu); + hrtimer_init(t, CLOCK_MONOTONIC, HRTIMER_MODE_REL); + t->function = mce_timer_fn; mce_start_timer(cpu, t); diff --git a/debian/patches/features/all/rt/x86-mce-use-swait-queue-for-mce-wakeups.patch b/debian/patches/features/all/rt/x86-mce-use-swait-queue-for-mce-wakeups.patch index 90f5f0768a2a..b23b6e7444c3 100644 --- a/debian/patches/features/all/rt/x86-mce-use-swait-queue-for-mce-wakeups.patch +++ b/debian/patches/features/all/rt/x86-mce-use-swait-queue-for-mce-wakeups.patch @@ -1,7 +1,7 @@ Subject: x86/mce: use swait queue for mce wakeups From: Steven Rostedt Date: Fri, 27 Feb 2015 15:20:37 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz We had a customer report a lockup on a 3.0-rt kernel that had the following backtrace: diff --git a/debian/patches/features/all/rt/x86-mm-disable-preemption-during-CR3-read-write.patch b/debian/patches/features/all/rt/x86-mm-disable-preemption-during-CR3-read-write.patch new file mode 100644 index 000000000000..1de650c625ea --- /dev/null +++ b/debian/patches/features/all/rt/x86-mm-disable-preemption-during-CR3-read-write.patch @@ -0,0 +1,68 @@ +From: Sebastian Andrzej Siewior +Date: Fri, 5 Aug 2016 13:51:17 +0200 +Subject: [PATCH] x86/mm: disable preemption during CR3 read+write +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.6/older/patches-4.6.5-rt10.tar.xz + +Usually current->mm (and therefore mm->pgd) stays the same during the +lifetime of a task so it does not matter if a task gets preempted during +the read and write of the CR3. + +But then, there is this scenario on x86-UP: +TaskA is in do_exit() and exit_mm() sets current->mm = NULL followed by +mmput() -> exit_mmap() -> tlb_finish_mmu() -> tlb_flush_mmu() -> +tlb_flush_mmu_tlbonly() -> tlb_flush() -> flush_tlb_mm_range() -> +__flush_tlb_up() -> __flush_tlb() -> __native_flush_tlb(). + +At this point current->mm is NULL but current->active_mm still points to +the "old" mm. +Let's preempt taskA _after_ native_read_cr3() by taskB. TaskB has its +own mm so CR3 has changed. +Now preempt back to taskA. TaskA has no ->mm set so it borrows taskB's +mm and so CR3 remains unchanged. Once taskA gets active it continues +where it was interrupted and that means it writes its old CR3 value +back. Everything is fine because userland won't need its memory +anymore. + +Now the fun part. Let's preempt taskA one more time and get back to +taskB. This time switch_mm() won't do a thing because oldmm +(->active_mm) is the same as mm (as per context_switch()). So we remain +with a bad CR3 / pgd and return to userland. +The next thing that happens is handle_mm_fault() with an address for the +execution of its code in userland. handle_mm_fault() realizes that it +has a PTE with proper rights so it returns doing nothing. But the CPU +looks at the wrong pgd and insists that something is wrong and faults +again. And again. And one more time… + +This pagefault circle continues until the scheduler gets tired of it and +puts another task on the CPU. It gets little difficult if the task is a +RT task with a high priority. The system will either freeze or it gets +fixed by the software watchdog thread which usually runs at RT-max prio. +But waiting for the watchdog will increase the latency of the RT task +which is no good. + +Cc: stable@vger.kernel.org +Signed-off-by: Sebastian Andrzej Siewior +--- + arch/x86/include/asm/tlbflush.h | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/arch/x86/include/asm/tlbflush.h ++++ b/arch/x86/include/asm/tlbflush.h +@@ -135,7 +135,14 @@ static inline void cr4_set_bits_and_upda + + static inline void __native_flush_tlb(void) + { ++ /* ++ * if current->mm == NULL then we borrow a mm which may change during a ++ * task switch and therefore we must not be preempted while we write CR3 ++ * back. ++ */ ++ preempt_disable(); + native_write_cr3(native_read_cr3()); ++ preempt_enable(); + } + + static inline void __native_flush_tlb_global_irq_disabled(void) diff --git a/debian/patches/features/all/rt/x86-preempt-lazy.patch b/debian/patches/features/all/rt/x86-preempt-lazy.patch index db7b2b96eef8..382a1619452a 100644 --- a/debian/patches/features/all/rt/x86-preempt-lazy.patch +++ b/debian/patches/features/all/rt/x86-preempt-lazy.patch @@ -1,7 +1,7 @@ Subject: x86: Support for lazy preemption From: Thomas Gleixner Date: Thu, 01 Nov 2012 11:03:47 +0100 -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Implement the x86 pieces for lazy preempt. diff --git a/debian/patches/features/all/rt/x86-signal-delay-calling-signals-on-32bit.patch b/debian/patches/features/all/rt/x86-signal-delay-calling-signals-on-32bit.patch index 278ad302795d..4286c1eacd92 100644 --- a/debian/patches/features/all/rt/x86-signal-delay-calling-signals-on-32bit.patch +++ b/debian/patches/features/all/rt/x86-signal-delay-calling-signals-on-32bit.patch @@ -1,7 +1,7 @@ From: Yang Shi Date: Thu, 10 Dec 2015 10:58:51 -0800 Subject: x86/signal: delay calling signals on 32bit -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz When running some ptrace single step tests on x86-32 machine, the below problem is triggered: diff --git a/debian/patches/features/all/rt/x86-stackprot-no-random-on-rt.patch b/debian/patches/features/all/rt/x86-stackprot-no-random-on-rt.patch index 0e139efe47fa..2722c6f72358 100644 --- a/debian/patches/features/all/rt/x86-stackprot-no-random-on-rt.patch +++ b/debian/patches/features/all/rt/x86-stackprot-no-random-on-rt.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Thu, 16 Dec 2010 14:25:18 +0100 Subject: x86: stackprotector: Avoid random pool on rt -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz CPU bringup calls into the random pool to initialize the stack canary. During boot that works nicely even on RT as the might sleep diff --git a/debian/patches/features/all/rt/x86-use-gen-rwsem-spinlocks-rt.patch b/debian/patches/features/all/rt/x86-use-gen-rwsem-spinlocks-rt.patch index adf91f6119ec..e1020af24924 100644 --- a/debian/patches/features/all/rt/x86-use-gen-rwsem-spinlocks-rt.patch +++ b/debian/patches/features/all/rt/x86-use-gen-rwsem-spinlocks-rt.patch @@ -1,7 +1,7 @@ From: Thomas Gleixner Date: Sun, 26 Jul 2009 02:21:32 +0200 Subject: x86: Use generic rwsem_spinlocks on -rt -Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.4-rt6.tar.xz +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.6/older/patches-4.6.5-rt10.tar.xz Simplifies the separation of anon_rw_semaphores and rw_semaphores for -rt. diff --git a/debian/patches/series-rt b/debian/patches/series-rt index 1870d9ed9a7e..c59740cf9f1a 100644 --- a/debian/patches/series-rt +++ b/debian/patches/series-rt @@ -6,10 +6,38 @@ # UPSTREAM changes queued ############################################################ features/all/rt/ARM-imx-always-use-TWD-on-IMX6Q.patch +features/all/rt/tracing-Show-the-preempt-count-of-when-the-event-was.patch + +# timer: "Refactor the timer wheel v4' + 2 prerequisites +features/all/rt/drm-i915-Use-consistent-forcewake-auto-release-timeo.patch +features/all/rt/timer-add-setup_deferrable_timer-macro.patch + +features/all/rt/timer-Make-pinned-a-timer-property.patch +features/all/rt/x86-apic-uv-Initialize-timer-as-pinned.patch +features/all/rt/x86-mce-Initialize-timer-as-pinned.patch +features/all/rt/driver-net-ethernet-tile-Initialize-timer-as-pinned.patch +features/all/rt/drivers-tty-metag_da-Initialize-timer-as-pinned.patch +features/all/rt/drivers-tty-mips_ejtag-Initialize-timer-as-pinned.patch +features/all/rt/net-ipv4-inet-Initialize-timers-as-pinned.patch +features/all/rt/timer-Remove-mod_timer_pinned.patch +features/all/rt/signal-Use-hrtimer-for-sigtimedwait.patch +features/all/rt/hlist-Add-hlist_is_singular_node-helper.patch +features/all/rt/timer-Give-a-few-structs-and-members-proper-names.patch +features/all/rt/timer-Reduce-the-CPU-index-space-to-256k.patch +features/all/rt/timer-Switch-to-a-non-cascading-wheel.patch +features/all/rt/timer-Remove-slack-leftovers.patch +features/all/rt/timer-Move-__run_timers-function.patch +features/all/rt/timer-Optimize-collect-timers-for-NOHZ.patch +features/all/rt/tick-sched-Remove-pointless-empty-function.patch +features/all/rt/timer-Forward-wheel-clock-whenever-possible.patch +features/all/rt/timer-Only-wake-softirq-if-necessary.patch +features/all/rt/timer-Split-out-index-calculation.patch +features/all/rt/timer-Optimization-for-same-expiry-time-in-mod_timer.patch ############################################################ # UPSTREAM FIXES, patches pending ############################################################ +features/all/rt/timer-make-the-base-lock-raw.patch ############################################################ # Stuff broken upstream, patches submitted @@ -20,6 +48,7 @@ features/all/rt/sc16is7xx_Drop_bogus_use_of_IRQF_ONESHOT.patch features/all/rt/crypto-ccp-remove-rwlocks_types.h.patch features/all/rt/infiniband-ulp-ipoib-remove-pkey_mutex.patch features/all/rt/sched-preempt-Fix-preempt_count-manipulations.patch +features/all/rt/x86-mm-disable-preemption-during-CR3-read-write.patch # Those two should vanish soon (not use PIT during bootup) features/all/rt/at91_dont_enable_disable_clock.patch @@ -74,7 +103,6 @@ features/all/rt/kernel-SRCU-provide-a-static-initializer.patch ############################################################ # Stuff which should go upstream ASAP ############################################################ -features/all/rt/trace-correct-off-by-one-while-recording-the-trace-e.patch # SCHED BLOCK/WQ features/all/rt/block-shorten-interrupt-disabled-regions.patch @@ -262,9 +290,7 @@ features/all/rt/relay-fix-timer-madness.patch # TIMERS features/all/rt/timers-prepare-for-full-preemption.patch -features/all/rt/timers-preempt-rt-support.patch features/all/rt/timer-delay-waking-softirqs-from-the-jiffy-tick.patch -features/all/rt/timers-avoid-the-base-null-otptimization-on-rt.patch # HRTIMERS features/all/rt/hrtimers-prepare-full-preemption.patch @@ -492,6 +518,7 @@ features/all/rt/KVM-lapic-mark-LAPIC-timer-handler-as-irqsafe.patch # SCSI/FCOE features/all/rt/scsi-fcoe-rt-aware.patch +features/all/rt/scsi-fcoe-Fix-get_cpu-put_cpu_light-imbalance-in-fco.patch features/all/rt/sas-ata-isci-dont-t-disable-interrupts-in-qc_issue-h.patch # X86 crypto @@ -554,6 +581,7 @@ features/all/rt/rcu-make-RCU_BOOST-default-on-RT.patch # PREEMPT LAZY features/all/rt/preempt-lazy-support.patch features/all/rt/preempt-lazy-check-preempt_schedule.patch +features/all/rt/sched-lazy_preempt-avoid-a-warning-in-the-RT-case.patch features/all/rt/x86-preempt-lazy.patch features/all/rt/arm-preempt-lazy-support.patch features/all/rt/arm-lazy-preempt-correct-resched-condition.patch