linux/drivers/gpu/drm/i915/gt
Linus Torvalds 1d6d399223 Kthreads affinity follow either of 4 existing different patterns:
1) Per-CPU kthreads must stay affine to a single CPU and never execute
    relevant code on any other CPU. This is currently handled by smpboot
    code which takes care of CPU-hotplug operations. Affinity here is
    a correctness constraint.
 
 2) Some kthreads _have_ to be affine to a specific set of CPUs and can't
    run anywhere else. The affinity is set through kthread_bind_mask()
    and the subsystem takes care by itself to handle CPU-hotplug
    operations. Affinity here is assumed to be a correctness constraint.
 
 3) Per-node kthreads _prefer_ to be affine to a specific NUMA node. This
    is not a correctness constraint but merely a preference in terms of
    memory locality. kswapd and kcompactd both fall into this category.
    The affinity is set manually like for any other task and CPU-hotplug
    is supposed to be handled by the relevant subsystem so that the task
    is properly reaffined whenever a given CPU from the node comes up.
    Also care should be taken so that the node affinity doesn't cross
    isolated (nohz_full) cpumask boundaries.
 
 4) Similar to the previous point except kthreads have a _preferred_
    affinity different than a node. Both RCU boost kthreads and RCU
    exp kworkers fall into this category as they refer to "RCU nodes"
    from a distinctly distributed tree.
 
 Currently the preferred affinity patterns (3 and 4) have at least 4
 identified users, with more or less success when it comes to handle
 CPU-hotplug operations and CPU isolation. Each of which do it in its own
 ad-hoc way.
 
 This is an infrastructure proposal to handle this with the following API
 changes:
 
 _ kthread_create_on_node() automatically affines the created kthread to
   its target node unless it has been set as per-cpu or bound with
   kthread_bind[_mask]() before the first wake-up.
 
 - kthread_affine_preferred() is a new function that can be called right
   after kthread_create_on_node() to specify a preferred affinity
   different than the specified node.
 
 When the preferred affinity can't be applied because the possible
 targets are offline or isolated (nohz_full), the kthread is affine
 to the housekeeping CPUs (which means to all online CPUs most of the
 time or only the non-nohz_full CPUs when nohz_full= is set).
 
 kswapd, kcompactd, RCU boost kthreads and RCU exp kworkers have been
 converted, along with a few old drivers.
 
 Summary of the changes:
 
 * Consolidate a bunch of ad-hoc implementations of kthread_run_on_cpu()
 
 * Introduce task_cpu_fallback_mask() that defines the default last
   resort affinity of a task to become nohz_full aware
 
 * Add some correctness check to ensure kthread_bind() is always called
   before the first kthread wake up.
 
 * Default affine kthread to its preferred node.
 
 * Convert kswapd / kcompactd and remove their halfway working ad-hoc
   affinity implementation
 
 * Implement kthreads preferred affinity
 
 * Unify kthread worker and kthread API's style
 
 * Convert RCU kthreads to the new API and remove the ad-hoc affinity
   implementation.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEd76+gtGM8MbftQlOhSRUR1COjHcFAmeNf8gACgkQhSRUR1CO
 jHedQQ/+IxTjjqQiItzrq41TES2S0desHDq8lNJFb7rsR/DtKFyLx3s67cOYV+cM
 Yx54QHg2m/Fz4nXMQ7Po5ygOtJGCKBc5C5QQy7y0lVKeTQK+daDfEtBSa3oG7j3C
 u+E3tTY6qxkbCzymUyaKkHN4/ay2vLvjFS50luV7KMyI3x47Aji+t7VdCX4LCPP2
 eAwOALWD0+7qLJ/VF6gsmQLKA4Qx7PQAzBa3KSBmUN9UcN8Gk1bQHCTIQKDHP9LQ
 v8BXrNZtYX1o2+snNYpX2z6/ECjxkdwriOgqqZY5306hd9RAQ1u46Dx3byrIqjGn
 ULG/XQ2istPyhTqb/h+RbrobdOcwEUIeqk8hRRbBXE8bPpqUz9EMuaCMxWDbQjgH
 NTuKG4ifKJ/IqstkkuDkdOiByE/ysMmwqrTXgSnu2ITNL9yY3BEgFbvA95hgo42s
 f7QCxEfZb1MHcNEMENSMwM3xw5lLMGMpxVZcMQ3gLwyotMBRrhFZm1qZJG7TITYW
 IDIeCbH4JOMdQwLs3CcWTXio0N5/85NhRNFV+IDn96OrgxObgnMtV8QwNgjXBAJ5
 wGeJWt8s34W1Zo3qS9gEuVzEhW4XaxISQQMkHe8faKkK6iHmIB/VjSQikDwwUNQ/
 AspYj82RyWBCDZsqhiYh71kpxjvS6Xp0bj39Ce1sNsOnuksxKkQ=
 =g8In
 -----END PGP SIGNATURE-----

Merge tag 'kthread-for-6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks

Pull kthread updates from Frederic Weisbecker:
 "Kthreads affinity follow either of 4 existing different patterns:

   1) Per-CPU kthreads must stay affine to a single CPU and never
      execute relevant code on any other CPU. This is currently handled
      by smpboot code which takes care of CPU-hotplug operations.
      Affinity here is a correctness constraint.

   2) Some kthreads _have_ to be affine to a specific set of CPUs and
      can't run anywhere else. The affinity is set through
      kthread_bind_mask() and the subsystem takes care by itself to
      handle CPU-hotplug operations. Affinity here is assumed to be a
      correctness constraint.

   3) Per-node kthreads _prefer_ to be affine to a specific NUMA node.
      This is not a correctness constraint but merely a preference in
      terms of memory locality. kswapd and kcompactd both fall into this
      category. The affinity is set manually like for any other task and
      CPU-hotplug is supposed to be handled by the relevant subsystem so
      that the task is properly reaffined whenever a given CPU from the
      node comes up. Also care should be taken so that the node affinity
      doesn't cross isolated (nohz_full) cpumask boundaries.

   4) Similar to the previous point except kthreads have a _preferred_
      affinity different than a node. Both RCU boost kthreads and RCU
      exp kworkers fall into this category as they refer to "RCU nodes"
      from a distinctly distributed tree.

  Currently the preferred affinity patterns (3 and 4) have at least 4
  identified users, with more or less success when it comes to handle
  CPU-hotplug operations and CPU isolation. Each of which do it in its
  own ad-hoc way.

  This is an infrastructure proposal to handle this with the following
  API changes:

   - kthread_create_on_node() automatically affines the created kthread
     to its target node unless it has been set as per-cpu or bound with
     kthread_bind[_mask]() before the first wake-up.

   - kthread_affine_preferred() is a new function that can be called
     right after kthread_create_on_node() to specify a preferred
     affinity different than the specified node.

  When the preferred affinity can't be applied because the possible
  targets are offline or isolated (nohz_full), the kthread is affine to
  the housekeeping CPUs (which means to all online CPUs most of the time
  or only the non-nohz_full CPUs when nohz_full= is set).

  kswapd, kcompactd, RCU boost kthreads and RCU exp kworkers have been
  converted, along with a few old drivers.

  Summary of the changes:

   - Consolidate a bunch of ad-hoc implementations of
     kthread_run_on_cpu()

   - Introduce task_cpu_fallback_mask() that defines the default last
     resort affinity of a task to become nohz_full aware

   - Add some correctness check to ensure kthread_bind() is always
     called before the first kthread wake up.

   - Default affine kthread to its preferred node.

   - Convert kswapd / kcompactd and remove their halfway working ad-hoc
     affinity implementation

   - Implement kthreads preferred affinity

   - Unify kthread worker and kthread API's style

   - Convert RCU kthreads to the new API and remove the ad-hoc affinity
     implementation"

* tag 'kthread-for-6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks:
  kthread: modify kernel-doc function name to match code
  rcu: Use kthread preferred affinity for RCU exp kworkers
  treewide: Introduce kthread_run_worker[_on_cpu]()
  kthread: Unify kthread_create_on_cpu() and kthread_create_worker_on_cpu() automatic format
  rcu: Use kthread preferred affinity for RCU boost
  kthread: Implement preferred affinity
  mm: Create/affine kswapd to its preferred node
  mm: Create/affine kcompactd to its preferred node
  kthread: Default affine kthread to its preferred NUMA node
  kthread: Make sure kthread hasn't started while binding it
  sched,arm64: Handle CPU isolation on last resort fallback rq selection
  arm64: Exclude nohz_full CPUs from 32bits el0 support
  lib: test_objpool: Use kthread_run_on_cpu()
  kallsyms: Use kthread_run_on_cpu()
  soc/qman: test: Use kthread_run_on_cpu()
  arm/bL_switcher: Use kthread_run_on_cpu()
2025-01-21 17:10:05 -08:00
..
selftests
shaders
uc Merge tag 'drm-intel-gt-next-2025-01-10' of https://gitlab.freedesktop.org/drm/i915/kernel into drm-next 2025-01-13 08:05:00 +10:00
gen2_engine_cs.c drm/i915/gt: s/gen3/gen2/ 2024-10-15 17:49:24 +03:00
gen2_engine_cs.h drm/i915/gt: s/gen3/gen2/ 2024-10-15 17:49:24 +03:00
gen6_engine_cs.c
gen6_engine_cs.h
gen6_ppgtt.c drm/i915: use pat_index instead of cache_level 2023-05-11 17:38:55 +02:00
gen6_ppgtt.h
gen6_renderstate.c
gen7_renderclear.c drm/i915: remove all IS_<PLATFORM>_GT<N>() macros 2024-10-24 13:14:37 +03:00
gen7_renderclear.h
gen7_renderstate.c
gen8_engine_cs.c Merge tag 'drm-intel-gt-next-2024-04-26' of https://anongit.freedesktop.org/git/drm/drm-intel into drm-next 2024-04-30 14:40:43 +10:00
gen8_engine_cs.h drm/i915/gt: Support aux invalidation on all engines 2023-07-26 14:35:32 +02:00
gen8_ppgtt.c Linux 6.9-rc5 2024-04-22 14:35:52 +10:00
gen8_ppgtt.h drm/i915: use pat_index instead of cache_level 2023-05-11 17:38:55 +02:00
gen8_renderstate.c
gen9_renderstate.c
hsw_clear_kernel.c
intel_breadcrumbs.c drm/i915: use NULL for zero wakeref_t instead of plain integer 0 2024-10-04 10:29:24 +03:00
intel_breadcrumbs.h
intel_breadcrumbs_types.h drm/i915: Track gt pm wakerefs 2023-11-20 12:36:56 +01:00
intel_context.c drm/i915: Support replaying GPU hangs with captured context image 2024-05-16 07:37:05 +00:00
intel_context.h drm/i915: Support replaying GPU hangs with captured context image 2024-05-16 07:37:05 +00:00
intel_context_param.h
intel_context_sseu.c
intel_context_types.h drm/i915: Support replaying GPU hangs with captured context image 2024-05-16 07:37:05 +00:00
intel_engine.h drm/i915/gt: Remove unused execlists_unwind_incomplete_requests 2024-11-04 16:31:44 -05:00
intel_engine_cs.c drm/i915/gt: Empty uabi engines list during intel_engines_release() 2024-08-05 23:10:46 +01:00
intel_engine_heartbeat.c Merge drm/drm-next into drm-misc-next-fixes 2024-02-26 15:12:53 +01:00
intel_engine_heartbeat.h
intel_engine_pm.c drm/i915/gt: Reset queue_priority_hint on parking 2024-03-28 12:16:16 -04:00
intel_engine_pm.h drm/i915: Move for_each_engine* out of i915_drv.h 2023-11-06 09:04:52 +00:00
intel_engine_regs.h drm/i915/pmu: Add support for gen2 2024-10-15 17:51:00 +03:00
intel_engine_stats.h
intel_engine_types.h i915/guc: Ensure busyness counter increases motonically 2024-12-13 15:13:50 -08:00
intel_engine_user.c drm/i915/gsc: Mark internal GSC engine with reserved uabi class 2023-11-29 10:23:11 +02:00
intel_engine_user.h
intel_execlists_submission.c drm/i915/gt: Remove unused execlists_unwind_incomplete_requests 2024-11-04 16:31:44 -05:00
intel_execlists_submission.h drm/i915: Fix up locking around dumping requests lists 2023-01-30 15:48:21 -05:00
intel_ggtt.c drm/i915/dpt: Evict all DPT VMAs on suspend 2024-11-28 17:33:44 +02:00
intel_ggtt_fencing.c drm: Fix kerneldoc for "Returns" section 2024-08-26 16:40:09 +02:00
intel_ggtt_fencing.h
intel_ggtt_gmch.c drm: move intel-gtt.h under include/drm/intel 2024-05-31 16:10:50 +03:00
intel_ggtt_gmch.h
intel_gpu_commands.h drm/i915/gt: Add Wa_14019789679 2024-08-05 22:33:39 +01:00
intel_gsc.c drm/i915: Drop dead code for xehpsdv 2024-03-22 14:14:39 -07:00
intel_gsc.h drm/i915/gt: reconcile Excess struct member kernel-doc warnings 2024-01-10 11:56:19 +02:00
intel_gt.c drm for 6.13-rc1 2024-11-21 14:56:17 -08:00
intel_gt.h drm/i915/gt: remove stray declaration of intel_gt_release_all() 2024-08-17 11:24:46 +02:00
intel_gt_buffer_pool.c drm/i915: add a dedicated workqueue inside drm_i915_private 2023-06-10 06:33:11 +03:00
intel_gt_buffer_pool.h
intel_gt_buffer_pool_types.h
intel_gt_ccs_mode.c drm/i915/gt: Fix CCS id's calculation for CCS mode setting 2024-05-29 11:35:38 +03:00
intel_gt_ccs_mode.h drm/i915/gt: Automate CCS Mode setting during engine resets 2024-05-06 14:15:24 -04:00
intel_gt_clock_utils.c drm/i915: use i9xx_fsb_freq() for GT clock frequency 2024-06-17 11:54:31 +03:00
intel_gt_clock_utils.h
intel_gt_debugfs.c drm/i915/gt: Create per-gt debugfs files 2023-03-21 10:09:31 +01:00
intel_gt_debugfs.h
intel_gt_defines.h i915/drm/gt: Move the gt defines in the gt directory 2023-08-02 15:41:31 +02:00
intel_gt_engines_debugfs.c drm/i915: Move for_each_engine* out of i915_drv.h 2023-11-06 09:04:52 +00:00
intel_gt_engines_debugfs.h
intel_gt_irq.c drm/i915/irq: s/gen3/gen2/ 2024-10-15 17:29:30 +03:00
intel_gt_irq.h
intel_gt_mcr.c drm/i915: Drop dead code for pvc 2024-03-22 14:14:56 -07:00
intel_gt_mcr.h drm/i915: Update IP_VER(12, 50) 2024-03-22 14:14:52 -07:00
intel_gt_pm.c drm/i915: Refactor confusing __intel_gt_reset() 2024-04-24 18:48:31 +02:00
intel_gt_pm.h drm/i915: use NULL for zero wakeref_t instead of plain integer 0 2024-10-04 10:29:24 +03:00
intel_gt_pm_debugfs.c Merge tag 'drm-intel-gt-next-2024-10-23' of https://gitlab.freedesktop.org/drm/i915/kernel into drm-next 2024-10-25 05:57:38 +10:00
intel_gt_pm_debugfs.h
intel_gt_pm_irq.c
intel_gt_pm_irq.h
intel_gt_print.h drm/i915/gt: More use of GT specific print helpers 2023-10-10 15:40:24 -07:00
intel_gt_regs.h drm/i915: Disable compression tricks on JSL 2024-10-09 19:04:24 +03:00
intel_gt_requests.c drm/i915: add a dedicated workqueue inside drm_i915_private 2023-06-10 06:33:11 +03:00
intel_gt_requests.h
intel_gt_sysfs.c drm/i915: Make kobj_type structures constant 2023-02-17 11:50:28 +02:00
intel_gt_sysfs.h
intel_gt_sysfs_pm.c Merge tag 'drm-intel-gt-next-2024-04-26' of https://anongit.freedesktop.org/git/drm/drm-intel into drm-next 2024-04-30 14:40:43 +10:00
intel_gt_sysfs_pm.h
intel_gt_types.h drm/i915/gt: Mark the GT as dead when mmio is unreliable 2024-08-09 12:51:17 +01:00
intel_gtt.c drm/i915: Update IP_VER(12, 50) 2024-03-22 14:14:52 -07:00
intel_gtt.h drm/i915/dpt: Evict all DPT VMAs on suspend 2024-11-28 17:33:44 +02:00
intel_hwconfig.h
intel_llc.c
intel_llc.h
intel_llc_types.h
intel_lrc.c drm/i915/pxp: Add missing tag for Wa_14019159160 2024-10-18 11:00:33 -04:00
intel_lrc.h
intel_lrc_reg.h
intel_migrate.c drm/i915: Update IP_VER(12, 50) 2024-03-22 14:14:52 -07:00
intel_migrate.h drm/i915: use pat_index instead of cache_level 2023-05-11 17:38:55 +02:00
intel_migrate_types.h
intel_mocs.c drm/i915: Drop dead code for pvc 2024-03-22 14:14:56 -07:00
intel_mocs.h
intel_ppgtt.c drm/i915: Invalidate the TLBs on each GT 2023-08-02 15:56:44 +02:00
intel_rc6.c drm/i915/dg1: Fix power gate sequence. 2024-12-20 13:49:40 -05:00
intel_rc6.h drm/i915/mtl: Synchronize i915/BIOS on C6 enabling 2023-03-24 08:43:32 -07:00
intel_rc6_types.h drm/i915/mtl: Synchronize i915/BIOS on C6 enabling 2023-03-24 08:43:32 -07:00
intel_region_lmem.c drm/i915: Rename the DSM/GSM registers 2024-02-07 01:59:01 +02:00
intel_region_lmem.h
intel_renderstate.c
intel_renderstate.h
intel_reset.c Merge tag 'drm-intel-gt-next-2025-01-10' of https://gitlab.freedesktop.org/drm/i915/kernel into drm-next 2025-01-13 08:05:00 +10:00
intel_reset.h drm/i915: Refactor confusing __intel_gt_reset() 2024-04-24 18:48:31 +02:00
intel_reset_types.h drm/i915/gt: Rename dev_priv to i915 for private data naming consistency 2023-02-27 23:22:54 +01:00
intel_ring.c drm/i915: Remove unused intel_ring_cacheline_align 2024-12-30 01:31:56 +01:00
intel_ring.h drm/i915: Remove unused intel_ring_cacheline_align 2024-12-30 01:31:56 +01:00
intel_ring_submission.c drm/i915/gt: Use ENGINE_TRACE for tracing. 2024-12-20 11:42:26 +01:00
intel_ring_types.h
intel_rps.c drm/i915: convert fsb_freq and mem_freq to kHz 2024-06-17 11:54:31 +03:00
intel_rps.h drm/i915: Add helpers for managing rps thresholds 2023-07-19 11:28:28 +01:00
intel_rps_types.h drm/i915/gt: Rename dev_priv to i915 for private data naming consistency 2023-02-27 23:22:54 +01:00
intel_sa_media.c drm/i915/uncore: add intel_uncore_regs() helper 2023-07-04 17:12:48 +03:00
intel_sa_media.h
intel_sseu.c drm/i915: Drop dead code for pvc 2024-03-22 14:14:56 -07:00
intel_sseu.h drm/i915/sseu: fix max_subslices array-index-out-of-bounds access 2023-03-13 11:38:05 +02:00
intel_sseu_debugfs.c
intel_sseu_debugfs.h
intel_timeline.c
intel_timeline.h
intel_timeline_types.h
intel_tlb.c drm/i915/gt: add a macro for mock gt wakeref special value and use it 2024-09-30 17:54:11 +03:00
intel_tlb.h drm/i915/gt: Move TLB invalidation to its own file 2023-08-02 15:40:11 +02:00
intel_wopcm.c
intel_wopcm.h
intel_workarounds.c drm/i915: remove all IS_<PLATFORM>_GT<N>() macros 2024-10-24 13:14:37 +03:00
intel_workarounds.h
intel_workarounds_types.h
ivb_clear_kernel.c
mock_engine.c
mock_engine.h
selftest_context.c drm/i915: Don't use __func__ as prefix for drm_dbg_printer 2024-06-06 14:46:15 -04:00
selftest_engine.c
selftest_engine.h
selftest_engine_cs.c drm/i915: Track gt pm wakerefs 2023-11-20 12:36:56 +01:00
selftest_engine_heartbeat.c drm/i915/gt: Delete the live_hearbeat_fast selftest 2024-06-06 03:46:13 +02:00
selftest_engine_heartbeat.h
selftest_engine_pm.c drm/i915/gt: Use gt_err for GT info 2023-05-03 12:56:10 +02:00
selftest_execlists.c treewide: Introduce kthread_run_worker[_on_cpu]() 2025-01-08 18:15:03 +01:00
selftest_gt_pm.c drm/i915: Track gt pm wakerefs 2023-11-20 12:36:56 +01:00
selftest_hangcheck.c treewide: Introduce kthread_run_worker[_on_cpu]() 2025-01-08 18:15:03 +01:00
selftest_llc.c drm/i915: remove unnecessary intel_pm.h includes 2023-03-06 18:26:30 +02:00
selftest_llc.h
selftest_lrc.c drm/i915/gt: add selftest to exercise WABB 2023-10-31 13:06:21 +01:00
selftest_migrate.c drm/i915/gt: Prevent uninitialized pointer reads 2025-01-08 08:54:57 -05:00
selftest_mocs.c drm/i915: use direct alias for i915 in requests 2023-07-24 17:24:35 +02:00
selftest_rc6.c drm/i915/selftests: Implement frequency logging for energy reading validation 2024-12-19 11:06:03 +01:00
selftest_rc6.h
selftest_reset.c drm/i915: Refactor confusing __intel_gt_reset() 2024-04-24 18:48:31 +02:00
selftest_ring.c
selftest_ring_submission.c
selftest_rps.c drm/i915/selftests: Add delay to stabilize frequency in live_rps_power 2024-12-06 20:15:07 +05:30
selftest_rps.h
selftest_slpc.c treewide: Introduce kthread_run_worker[_on_cpu]() 2025-01-08 18:15:03 +01:00
selftest_timeline.c drm/i915: use direct alias for i915 in requests 2023-07-24 17:24:35 +02:00
selftest_tlb.c drm/i915: Use struct resource for memory region IO as well 2024-02-07 01:58:40 +02:00
selftest_workarounds.c drm/i915/selftest: use igt_vma_move_to_active_unlocked if possible 2023-01-09 14:23:52 +01:00
shmem_utils.c fs: port files to file_ref 2024-10-30 09:57:43 +01:00
shmem_utils.h
st_shmem_utils.c
sysfs_engines.c drm/i915/gt: Continue creating engine sysfs files even after a failure 2024-08-24 00:28:55 +02:00
sysfs_engines.h