FAILED: patch "[PATCH] drm/xe: Set TTM device beneficial_order to 9 (2M)" failed to apply to 7.1-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 7.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-7.1.y
git checkout FETCH_HEAD
git cherry-pick -x ba7fd163422877ad5a5cf31306a38c07d3932b0c
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026072950-giggling-gooey-3782@gregkh' --subject-prefix 'PATCH 7.1.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From ba7fd163422877ad5a5cf31306a38c07d3932b0c Mon Sep 17 00:00:00 2001
From: Matthew Brost <[email protected]>
Date: Thu, 11 Jun 2026 16:58:44 -0700
Subject: [PATCH] drm/xe: Set TTM device beneficial_order to 9 (2M)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Set the TTM device beneficial_order to 9 (2M), which is the sweet spot for Xe when attempting reclaim on system memory BOs, as it matches the large GPU page size. This ensures reclaim is attempted at the most effective order for the driver.
This fixes an issue where an order-10 (4M) allocation cannot be found despite an abundance of memory. The 4M allocation triggers reclaim, unnecessarily evicting the working set and hurting performance. Since the TTM infrastructure was introduced recently, we are tagging the TTM patch as the Fixes target, even though this resolves an Xe-side problem.
drivers/gpu/drm/xe/xe_device.c +2 -1
@@ -526,7 +526,8 @@ int xe_device_init_early(struct xe_device *xe) err =ttm_device_init (&xe->ttm, &xe_ttm_funcs, xe->drm.dev, xe->drm.anon_inode->i_mapping, - xe->drm.vma_offset_manager,0 ); + xe->drm.vma_offset_manager, +TTM_ALLOCATION_POOL_BENEFICIAL_ORDER (get_order (SZ_2M )));if (err)return err;
Sasha Levin
maintainerPATCH 1/5 drm/xe: Drop unused param from xe_device_create()
From: Michal Wajdeczko <[email protected]>
[ Upstream commit 8a09097b11ca4d436691f64c3cc0958006f36e33 ]
We never used or need anything from the struct pci_device_id there. And while around, add simple kernel-doc for this function.
Stable-dep-of: ba7fd1634228 ("drm/xe: Set TTM device beneficial_order to 9 (2M)")
--- drivers/gpu/drm/xe/xe_device.c | 11 +++++++++-- drivers/gpu/drm/xe/xe_device.h | 3 +-- drivers/gpu/drm/xe/xe_pci.c | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-)
drivers/gpu/drm/xe/xe_device.c +9 -2
@@ -435,8 +435,15 @@ static void xe_device_destroy(struct drm_device *dev, void *dummy)ttm_device_fini (&xe->ttm); } -struct xe_device *xe_device_create (struct pci_dev *pdev, -const struct pci_device_id *ent) +/** +* xe_device_create() - Create a new &xe_device instance +* @pdev: the parent &pci_dev +* +* Allocate and initialize a device managed Xe device structure. +* +* Return: pointer to new &xe_device on success, or ERR_PTR on failure. +*/ +struct xe_device *xe_device_create (struct pci_dev *pdev) {struct xe_device *xe;int err;
drivers/gpu/drm/xe/xe_device.h +1 -2
@@ -43,8 +43,7 @@ static inline struct xe_device *ttm_to_xe_device(struct ttm_device *ttm) return container_of(ttm, struct xe_device, ttm); } -struct xe_device *xe_device_create (struct pci_dev *pdev, -const struct pci_device_id *ent); +struct xe_device *xe_device_create (struct pci_dev *pdev);int xe_device_probe_early (struct xe_device *xe);int xe_device_probe (struct xe_device *xe);void xe_device_remove (struct xe_device *xe);
drivers/gpu/drm/xe/xe_pci.c +1 -1
@@ -1085,7 +1085,7 @@ static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)if (err)return err; - xe =xe_device_create (pdev, ent); + xe =xe_device_create (pdev);if (IS_ERR (xe))return PTR_ERR (xe);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/5 drm/xe: Move xe->info.force_execlist initialization
From: Michal Wajdeczko <[email protected]>
[ Upstream commit f1d581bb50ed54b71a8121d3d46fe2627fddd147 ]
The xe_info_init_early() is a place where we initialize those of the xe->info fields that do not require any additional hardware probes. Move the initialization of the force_execlist flag there.
Stable-dep-of: ba7fd1634228 ("drm/xe: Set TTM device beneficial_order to 9 (2M)")
--- drivers/gpu/drm/xe/xe_device.c | 1 - drivers/gpu/drm/xe/xe_pci.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_device.c +0 -1
@@ -475,7 +475,6 @@ struct xe_device *xe_device_create(struct pci_dev *pdev) xe->info.devid = pdev->device; xe->info.revid = pdev->revision; - xe->info.force_execlist = xe_modparam.force_execlist; xe->atomic_svm_timeslice_ms =5 ; xe->min_run_period_lr_ms =5 ;
drivers/gpu/drm/xe/xe_pci.c +1 -0
@@ -774,6 +774,7 @@ static int xe_info_init_early(struct xe_device *xe, xe->info.probe_display =IS_ENABLED (CONFIG_DRM_XE_DISPLAY ) && xe_modparam.probe_display && desc->has_display; + xe->info.force_execlist = xe_modparam.force_execlist;xe_assert (xe, desc->max_gt_per_tile >0 );xe_assert (xe, desc->max_gt_per_tile <=XE_MAX_GT_PER_TILE );
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 3/5 drm/xe: Move xe->info.devid|revid initialization
In reply to Sasha LevinFrom: Michal Wajdeczko <[email protected]>
[ Upstream commit c03d9fbe77ec5002a2345b9be464683e0b157709 ]
The xe_info_init_early() is a place where we initialize those of the xe->info fields that do not require any additional hardware probes. Move the initialization of the devid/revid also there, but to avoid breaking the kunit helper, which also calls this function, keep their initialization separate in sub-function so we can easily stub it when running the kunit test.
Stable-dep-of: ba7fd1634228 ("drm/xe: Set TTM device beneficial_order to 9 (2M)")
--- drivers/gpu/drm/xe/tests/xe_pci.c | 6 ++++++ drivers/gpu/drm/xe/xe_device.c | 2 -- drivers/gpu/drm/xe/xe_pci.c | 12 ++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/tests/xe_pci.c +6 -0
@@ -310,6 +310,11 @@ const void *xe_pci_id_gen_param(struct kunit *test, const void *prev, char *desc }EXPORT_SYMBOL_IF_KUNIT (xe_pci_id_gen_param); +static void fake_init_devid (struct xe_device *xe) +{ +/* Nothing to do, just keep zero. */ +} +static int fake_read_gmdid (struct xe_device *xe,enum xe_gmdid_type type,u32 *ver,u32 *revid) {
@@ -368,6 +373,7 @@ int xe_pci_fake_device_init(struct xe_device *xe) xe->sriov.__mode = data && data->sriov_mode ? data->sriov_mode :XE_SRIOV_MODE_NONE ; +kunit_activate_static_stub (test, init_devid, fake_init_devid);kunit_activate_static_stub (test, read_gmdid, fake_read_gmdid);kunit_activate_static_stub (test, xe_info_probe_tile_count, fake_xe_info_probe_tile_count);
drivers/gpu/drm/xe/xe_device.c +0 -2
@@ -473,8 +473,6 @@ struct xe_device *xe_device_create(struct pci_dev *pdev)if (err)return ERR_PTR (err); - xe->info.devid = pdev->device; - xe->info.revid = pdev->revision; xe->atomic_svm_timeslice_ms =5 ; xe->min_run_period_lr_ms =5 ;
drivers/gpu/drm/xe/xe_pci.c +12 -0
@@ -723,6 +723,16 @@ static int handle_gmdid(struct xe_device *xe,return 0 ; } +static void init_devid (struct xe_device *xe) +{ +struct pci_dev *pdev =to_pci_dev (xe->drm.dev); + +KUNIT_STATIC_STUB_REDIRECT (init_devid, xe); + + xe->info.devid = pdev->device; + xe->info.revid = pdev->revision; +} +/* * Initialize device info content that only depends on static driver_data * passed to the driver at probe time from PCI ID table.
@@ -738,6 +748,8 @@ static int xe_info_init_early(struct xe_device *xe, xe->info.subplatform = subplatform_desc ? subplatform_desc->subplatform :XE_SUBPLATFORM_NONE ; +init_devid (xe); + xe->info.dma_mask_size = desc->dma_mask_size; xe->info.va_bits = desc->va_bits; xe->info.vm_max_level = desc->vm_max_level;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 4/5 drm/xe: Separate early xe_device initialization
In reply to Sasha LevinFrom: Michal Wajdeczko <[email protected]>
[ Upstream commit 2841cea001b983db79dc1fdf160e65318dfda3cd ]
We would like to initialize more of the xe_device struct also from the kunit code, as it should be safe to use most of the generic drm or xe components without doing any additional tweaks. Separate early xe initialization code to a new function, so it can be reused.
Stable-dep-of: ba7fd1634228 ("drm/xe: Set TTM device beneficial_order to 9 (2M)")
--- drivers/gpu/drm/xe/xe_device.c | 39 ++++++++++++++++++++++++---------- drivers/gpu/drm/xe/xe_device.h | 1 + 2 files changed, 29 insertions(+), 11 deletions(-)
drivers/gpu/drm/xe/xe_device.c +28 -11
@@ -458,27 +458,45 @@ struct xe_device *xe_device_create(struct pci_dev *pdev)if (IS_ERR (xe))return xe; + err =xe_device_init_early (xe); +if (err) +return ERR_PTR (err); + +return xe; +} +ALLOW_ERROR_INJECTION (xe_device_create,ERRNO );/* See xe_pci_probe() */ + +/** +* xe_device_init_early() - Initialize a new &xe_device instance +* @xe: the &xe_device to initialize +* +* Return: 0 on success or a negative error code on failure. +*/ +int xe_device_init_early (struct xe_device *xe) +{ +int err; + err =ttm_device_init (&xe->ttm, &xe_ttm_funcs, xe->drm.dev, xe->drm.anon_inode->i_mapping, xe->drm.vma_offset_manager,0 ); -if (WARN_ON (err)) -return ERR_PTR (err); +if (err) +return err;xe_bo_dev_init (&xe->bo_device); err =drmm_add_action_or_reset (&xe->drm, xe_device_destroy,NULL );if (err) -return ERR_PTR (err); +return err; err =xe_shrinker_create (xe);if (err) -return ERR_PTR (err); +return err; xe->atomic_svm_timeslice_ms =5 ; xe->min_run_period_lr_ms =5 ; err =xe_irq_init (xe);if (err) -return ERR_PTR (err); +return err;xe_validation_device_init (&xe->val);
@@ -488,7 +506,7 @@ struct xe_device *xe_device_create(struct pci_dev *pdev) err =xe_pagemap_shrinker_create (xe);if (err) -return ERR_PTR (err); +return err;xa_init_flags (&xe->usm.asid_to_vm,XA_FLAGS_ALLOC );
@@ -507,7 +525,7 @@ struct xe_device *xe_device_create(struct pci_dev *pdev) err =xe_bo_pinned_init (xe);if (err) -return ERR_PTR (err); +return err; xe->preempt_fence_wq =alloc_ordered_workqueue ("xe-preempt-fence-wq" ,WQ_MEM_RECLAIM );
@@ -521,16 +539,15 @@ struct xe_device *xe_device_create(struct pci_dev *pdev)* drmm_add_action_or_reset register above */ drm_err (&xe->drm,"Failed to allocate xe workqueues\n" ); -return ERR_PTR (-ENOMEM ); +return -ENOMEM ; } err =drmm_mutex_init (&xe->drm, &xe->pmt.lock);if (err) -return ERR_PTR (err); +return err; -return xe; +return 0 ; } -ALLOW_ERROR_INJECTION (xe_device_create,ERRNO );/* See xe_pci_probe() */ static bool xe_driver_flr_disabled (struct xe_device *xe) {
drivers/gpu/drm/xe/xe_device.h +1 -0
@@ -44,6 +44,7 @@ static inline struct xe_device *ttm_to_xe_device(struct ttm_device *ttm) }struct xe_device *xe_device_create (struct pci_dev *pdev); +int xe_device_init_early (struct xe_device *xe);int xe_device_probe_early (struct xe_device *xe);int xe_device_probe (struct xe_device *xe);void xe_device_remove (struct xe_device *xe);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 5/5 drm/xe: Set TTM device beneficial_order to 9 (2M)
In reply to Sasha LevinFrom: Matthew Brost <[email protected]>
[ Upstream commit ba7fd163422877ad5a5cf31306a38c07d3932b0c ]
Set the TTM device beneficial_order to 9 (2M), which is the sweet spot for Xe when attempting reclaim on system memory BOs, as it matches the large GPU page size. This ensures reclaim is attempted at the most effective order for the driver.
This fixes an issue where an order-10 (4M) allocation cannot be found despite an abundance of memory. The 4M allocation triggers reclaim, unnecessarily evicting the working set and hurting performance. Since the TTM infrastructure was introduced recently, we are tagging the TTM patch as the Fixes target, even though this resolves an Xe-side problem.
--- drivers/gpu/drm/xe/xe_device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_device.c +2 -1
@@ -478,7 +478,8 @@ int xe_device_init_early(struct xe_device *xe) err =ttm_device_init (&xe->ttm, &xe_ttm_funcs, xe->drm.dev, xe->drm.anon_inode->i_mapping, - xe->drm.vma_offset_manager,0 ); + xe->drm.vma_offset_manager, +TTM_ALLOCATION_POOL_BENEFICIAL_ORDER (get_order (SZ_2M )));if (err)return err;
Signature · 1 line
2.53.0