core_hotunplug improvements
Subsystems (5)
cover core_hotunplug improvements
Currently core_hotunplug or in general trying to hotunplug the device is broken in a number of ways.
Signature · 1 line
2.45.0
PATCH 1/20 drm/drm_managed: try to improve the drmm DOC
Hopefully make it clearer when to use devm vs drmm.
--- drivers/gpu/drm/drm_managed.c | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
drivers/gpu/drm/drm_managed.c +42 -0
@@ -34,6 +34,48 @@* during the lifetime of the driver, all the functions are fully concurrent * safe. But it is recommended to use managed resources only for resources that * change rarely, if ever, during the lifetime of the &drm_device instance. +* +* Note that the distinction between devm and drmm is important to get right. +* Consider some hotunplug scenarios, where it is valid for there to be multiple +* unplugged struct &drm_device instances each being kept alive by an open +* driver fd. The driver needs a clean separation between what needs to happen +* when the struct &device is removed and what needs to happen when a given +* struct &drm_device instance is released, as well as in some cases a more +* finer grained marking of critical sections that require hardware interaction. +* See below. +* +* devm +* ~~~~ +* In general use devm for cleaning up anything hardware related. So removing +* pci mmaps, releasing interrupt handlers, basically anything hw related. The +* devm release actions are called when the struct &device is removed, shortly +* after calling into the drivers struct &pci_driver.remove() callback, if this +* is a pci device. +* +* devm can be thought of as an alternative to putting all the hw related +* cleanup directly in the struct &pci_driver.remove() callback, where the +* correct ordering of the unwind steps needs to be manually done in the error +* path of the struct &pci_driver.probe() and again on the remove side. With +* devm this is all done automatically. +* +* drmm +* ~~~~ +* In general use this for cleaning up anything software related. So data +* structures and the like which are tied to the lifetime of a particular struct +* &drm_device instance. +* +* drmm can be thought of as an alternative to putting all the software related +* cleanup directly in the struct &drm_driver.release() callback, where again +* the correct ordering of the unwind steps needs to be done manually. As with +* devm this is instead done automatically. +* +* Sometimes there is no clean separation between software and hardware, which +* is where drm_dev_enter() comes in. For example, a driver might have some +* state tied to a struct &drm_device instance, for which the same cleanup path +* is called for both a plugged and unplugged device, and the cleanup itself +* might require talking to the device if it's still attached to this particular +* struct &drm_device. For that we instead mark the device sections. See +* drm_dev_enter(), drm_dev_exit() and drm_dev_unplug(). */ struct drmres_node {
Signature · 1 line
2.45.0
Re: [PATCH 01/20] drm/drm_managed: try to improve the drmm DOC
Quoted 49 lines · Matthew Auld
Hopefully make it clearer when to use devm vs drmm.
Signed-off-by Matthew Auld <[email protected]>Cc Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_managed.c | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)drivers/gpu/drm/drm_managed.c +32
-0@@ -34,6 +34,48 @@* during the lifetime of the driver, all the functions are fully concurrent * safe. But it is recommended to use managed resources only for resources that * change rarely, if ever, during the lifetime of the &drm_device instance. +* +* Note that the distinction between devm and drmm is important to get right. +* Consider some hotunplug scenarios, where it is valid for there to be multiple +* unplugged struct &drm_device instances each being kept alive by an open +* driver fd. The driver needs a clean separation between what needs to happen +* when the struct &device is removed and what needs to happen when a given +* struct &drm_device instance is released, as well as in some cases a more +* finer grained marking of critical sections that require hardware interaction. +* See below. +* +* devm +* ~~~~ +* In general use devm for cleaning up anything hardware related. So removing +* pci mmaps, releasing interrupt handlers, basically anything hw related. The +* devm release actions are called when the struct &device is removed, shortly +* after calling into the drivers struct &pci_driver.remove() callback, if this +* is a pci device. +* +* devm can be thought of as an alternative to putting all the hw related +* cleanup directly in the struct &pci_driver.remove() callback, where the +* correct ordering of the unwind steps needs to be manually done in the error +* path of the struct &pci_driver.probe() and again on the remove side. With +* devm this is all done automatically. +* +* drmm +* ~~~~ +* In general use this for cleaning up anything software related. So data +* structures and the like which are tied to the lifetime of a particular struct +* &drm_device instance. +* +* drmm can be thought of as an alternative to putting all the software related +* cleanup directly in the struct &drm_driver.release() callback, where again
drivers/gpu/drm/drm_managed.c line 78
Quoted 10 lines
drivers/gpu/drm/drm_managed.c +10
-0+* the correct ordering of the unwind steps needs to be done manually. As with +* devm this is instead done automatically. +* +* Sometimes there is no clean separation between software and hardware, which +* is where drm_dev_enter() comes in. For example, a driver might have some +* state tied to a struct &drm_device instance, for which the same cleanup path +* is called for both a plugged and unplugged device, and the cleanup itself +* might require talking to the device if it's still attached to this particular +* struct &drm_device. For that we instead mark the device sections. See +* drm_dev_enter(), drm_dev_exit() and drm_dev_unplug().
I would emphasize somewhere that after device unbind any interaction with physical device is forbidden (are some exceptions for this?). Anyway nice stuff.
Regards
Andrzej
Quoted 3 lines
drivers/gpu/drm/drm_managed.c +0
-0*/ struct drmres_node {
Rodrigo Vivi
maintainerRe: [PATCH 01/20] drm/drm_managed: try to improve the drmm DOC
In reply to Matthew AuldQuoted 21 lines · Matthew Auld
Hopefully make it clearer when to use devm vs drmm.
Signed-off-by Matthew Auld <[email protected]>Cc Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_managed.c | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)drivers/gpu/drm/drm_managed.c +4
-0@@ -34,6 +34,48 @@* during the lifetime of the driver, all the functions are fully concurrent * safe. But it is recommended to use managed resources only for resources that * change rarely, if ever, during the lifetime of the &drm_device instance. +* +* Note that the distinction between devm and drmm is important to get right. +* Consider some hotunplug scenarios, where it is valid for there to be multiple +* unplugged struct &drm_device instances each being kept alive by an open
drivers/gpu/drm/drm_managed.c line 50
Quoted 10 lines
drivers/gpu/drm/drm_managed.c +10
-0+* driver fd. The driver needs a clean separation between what needs to happen +* when the struct &device is removed and what needs to happen when a given +* struct &drm_device instance is released, as well as in some cases a more +* finer grained marking of critical sections that require hardware interaction. +* See below. +* +* devm +* ~~~~ +* In general use devm for cleaning up anything hardware related. So removing +* pci mmaps, releasing interrupt handlers, basically anything hw related. The
^
Extra space.
drivers/gpu/drm/drm_managed.c line 55
Quoted 5 lines
drivers/gpu/drm/drm_managed.c +5
-0+* devm release actions are called when the struct &device is removed, shortly +* after calling into the drivers struct &pci_driver.remove() callback, if this +* is a pci device. +* +* devm can be thought of as an alternative to putting all the hw related
nit: perhaps s/thought/seen ?
drivers/gpu/drm/drm_managed.c line 67
Quoted 12 lines
drivers/gpu/drm/drm_managed.c +12
-0+* cleanup directly in the struct &pci_driver.remove() callback, where the +* correct ordering of the unwind steps needs to be manually done in the error +* path of the struct &pci_driver.probe() and again on the remove side. With +* devm this is all done automatically. +* +* drmm +* ~~~~ +* In general use this for cleaning up anything software related. So data +* structures and the like which are tied to the lifetime of a particular struct +* &drm_device instance. +* +* drmm can be thought of as an alternative to putting all the software related
nit: perhaps s/thought/seen ?
drivers/gpu/drm/drm_managed.c line 78
Quoted 11 lines
drivers/gpu/drm/drm_managed.c +11
-0+* cleanup directly in the struct &drm_driver.release() callback, where again +* the correct ordering of the unwind steps needs to be done manually. As with +* devm this is instead done automatically. +* +* Sometimes there is no clean separation between software and hardware, which +* is where drm_dev_enter() comes in. For example, a driver might have some +* state tied to a struct &drm_device instance, for which the same cleanup path +* is called for both a plugged and unplugged device, and the cleanup itself +* might require talking to the device if it's still attached to this particular +* struct &drm_device. For that we instead mark the device sections. See +* drm_dev_enter(), drm_dev_exit() and drm_dev_unplug().
perhaps open up a bit more here?
anyway, everything looks good to me.
Sima, thoughts?
Quoted 6 lines
drivers/gpu/drm/drm_managed.c +0
-0*/ struct drmres_node {Signature · 1 line
2.45.0
PATCH 2/20 drm/amdgpu: don't trample pdev drvdata
In reply to Matthew AuldThe driver release callback is called when a particular drm_device goes away, just like with drmm, so here we should never nuke the pdev drvdata pointer, since that could already be pointing to a new drvdata. For example something hotunplugs the device, for which we have an open driver fd, keeping the drm_device alive, and in the meantime the same physical device is re-attached to a new drm_device therefore setting drvdata again. Once the original drm_device goes away, we might then call the release which then incorrectly tramples the drvdata.
The driver core will already nuke the pointer for us when the pci device is removed, so should be safe to simply drop. Alternative would be to move to the driver pci remove callback.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 -1
@@ -1450,7 +1450,6 @@ void amdgpu_driver_release_kms(struct drm_device *dev)struct amdgpu_device *adev =drm_to_adev (dev);amdgpu_device_fini_sw (adev); -pci_set_drvdata (adev->pdev,NULL ); }/*
Signature · 1 line
2.45.0
Re: [PATCH 02/20] drm/amdgpu: don't trample pdev drvdata
Am 10.05.24 um 20:12 schrieb Matthew Auld:
Quoted 9 lines
The driver release callback is called when a particular
drm_devicegoes away, just like with drmm, so here we should never nuke the pdev drvdata pointer, since that could already be pointing to a new drvdata. For example something hotunplugs the device, for which we have an open driver fd, keeping thedrm_devicealive, and in the meantime the same physical device is re-attached to a newdrm_devicetherefore setting drvdata again. Once the originaldrm_devicegoes away, we might then call the release which then incorrectly tramples the drvdata.
Quoted 8 lines
The driver core will already nuke the pointer for us when the pci device is removed, so should be safe to simply drop. Alternative would be to move to the driver pci remove callback.
Signed-off-by Matthew Auld <[email protected]>Cc Christian König <[email protected]>Cc Daniel Vetter <[email protected]>
Oh! Very good catch! That might become important for a feature we current discuss internally.
Quoted 16 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 1 - 1 file changed, 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0
-1@@ -1450,7 +1450,6 @@ void amdgpu_driver_release_kms(struct drm_device *dev)struct amdgpu_device *adev =drm_to_adev (dev);amdgpu_device_fini_sw (adev); -pci_set_drvdata (adev->pdev,NULL ); }/*
PATCH 3/20 drm/xe/pci: remove broken driver_release
In reply to Matthew AuldThis is quite broken since we are nuking the pdev link to the private driver struct, but note here that driver_release is called when the drm_device is released (poor mans drmm), which can be long after the device has been removed. So here what we are actually doing is nuking the pdev link for what is potentially bound to a different drm_device. If that happens before our pci remove callback is triggered (for the new drm_device) we silently exit and skip some important cleanup steps, resulting in hilarity.
There should be no reason to implement driver_release, when we already have nicer stuff like drmm, so just remove completely. The actual pdev link is already nuked when removing the device.
--- drivers/gpu/drm/xe/xe_device.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/gpu/drm/xe/xe_device.c +0 -9
@@ -188,13 +188,6 @@ static const struct file_operations xe_driver_fops = {#endif }; -static void xe_driver_release (struct drm_device *dev) -{ -struct xe_device *xe =to_xe_device (dev); - -pci_set_drvdata (to_pci_dev (xe->drm.dev),NULL ); -} -static struct drm_driver driver = {/* Don't use MTRRs here; the Xserver or userspace app should * deal with them for Intel hardware.
@@ -213,8 +206,6 @@ static struct drm_driver driver = {#ifdef CONFIG_PROC_FS .show_fdinfo = xe_drm_client_fdinfo, #endif - .release = &xe_driver_release, - .ioctls = xe_ioctls, .num_ioctls = ARRAY_SIZE(xe_ioctls), .fops = &xe_driver_fops,
Signature · 1 line
2.45.0
Re: [PATCH 03/20] drm/xe/pci: remove broken driver_release
Quoted 9 lines · Matthew Auld
This is quite broken since we are nuking the pdev link to the private driver struct, but note here that
driver_releaseis called when thedrm_deviceis released (poor mans drmm), which can be long after the device has been removed. So here what we are actually doing is nuking the pdev link for what is potentially bound to a differentdrm_device. If that happens before our pci remove callback is triggered (for the newdrm_device) we silently exit and skip some important cleanup steps, resulting in hilarity.
Quoted 7 lines
There should be no reason to implement
driver_release, when we already have nicer stuff like drmm, so just remove completely. The actual pdev link is already nuked when removing the device.Signed-off-by Matthew Auld <[email protected]>Cc Andrzej Hajda <[email protected]>Cc Rodrigo Vivi <[email protected]>
Regards
Andrzej
Quoted 31 lines
--- drivers/gpu/drm/xe/xe_device.c | 9 --------- 1 file changed, 9 deletions(-)drivers/gpu/drm/xe/xe_device.c +0
-9@@ -188,13 +188,6 @@ static const struct file_operations xe_driver_fops = {#endif }; -static void xe_driver_release (struct drm_device *dev) -{ -struct xe_device *xe =to_xe_device (dev); - -pci_set_drvdata (to_pci_dev (xe->drm.dev),NULL ); -} -static struct drm_driver driver = {/* Don't use MTRRs here; the Xserver or userspace app should * deal with them for Intel hardware. @@ -213,8 +206,6 @@ static struct drm_driver driver = {#ifdef CONFIG_PROC_FS .show_fdinfo = xe_drm_client_fdinfo, #endif - .release = &xe_driver_release, - .ioctls = xe_ioctls, .num_ioctls = ARRAY_SIZE(xe_ioctls), .fops = &xe_driver_fops,
PATCH 4/20 drm/xe: covert sysfs over to devm
In reply to Matthew AuldHotunplugging the device seems to result in stuff like:
kobject_add_internal failed for tile0 with -EEXIST, don't try to register things with the same name in the same directory.
We only remove the sysfs as part of drmm, however that is tied to the lifetime of the driver instance and not the device underneath. Attempt to fix by using devm for all of the remaining sysfs stuff related to the device.
--- drivers/gpu/drm/xe/xe_device_sysfs.c | 4 ++-- drivers/gpu/drm/xe/xe_gt_ccs_mode.c | 4 ++-- drivers/gpu/drm/xe/xe_gt_freq.c | 4 ++-- drivers/gpu/drm/xe/xe_gt_idle.c | 4 ++-- drivers/gpu/drm/xe/xe_gt_sysfs.c | 4 ++-- drivers/gpu/drm/xe/xe_gt_throttle_sysfs.c | 4 ++-- drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c | 12 ++++++------ drivers/gpu/drm/xe/xe_tile_sysfs.c | 4 ++-- drivers/gpu/drm/xe/xe_vram_freq.c | 4 ++-- 9 files changed, 22 insertions(+), 22 deletions(-)
drivers/gpu/drm/xe/xe_device_sysfs.c +2 -2
@@ -69,7 +69,7 @@ vram_d3cold_threshold_store(struct device *dev, struct device_attribute *attr,static DEVICE_ATTR_RW (vram_d3cold_threshold); -static void xe_device_sysfs_fini (struct drm_device *drm,void *arg) +static void xe_device_sysfs_fini (void *arg) {struct xe_device *xe = arg;
@@ -85,5 +85,5 @@ int xe_device_sysfs_init(struct xe_device *xe)if (ret)return ret; -return drmm_add_action_or_reset (&xe->drm, xe_device_sysfs_fini, xe); +return devm_add_action_or_reset (dev, xe_device_sysfs_fini, xe); }
drivers/gpu/drm/xe/xe_gt_ccs_mode.c +2 -2
@@ -150,7 +150,7 @@ static const struct attribute *gt_ccs_mode_attrs[] = { NULL, }; -static void xe_gt_ccs_mode_sysfs_fini (struct drm_device *drm,void *arg) +static void xe_gt_ccs_mode_sysfs_fini (void *arg) {struct xe_gt *gt = arg;
@@ -182,5 +182,5 @@ int xe_gt_ccs_mode_sysfs_init(struct xe_gt *gt)if (err)return err; -return drmm_add_action_or_reset (&xe->drm, xe_gt_ccs_mode_sysfs_fini, gt); +return devm_add_action_or_reset (xe->drm.dev, xe_gt_ccs_mode_sysfs_fini, gt); }
drivers/gpu/drm/xe/xe_gt_freq.c +2 -2
@@ -209,7 +209,7 @@ static const struct attribute *freq_attrs[] = { NULL }; -static void freq_fini (struct drm_device *drm,void *arg) +static void freq_fini (void *arg) {struct kobject *kobj = arg;
@@ -237,7 +237,7 @@ int xe_gt_freq_init(struct xe_gt *gt)if (!gt->freq)return -ENOMEM ; - err =drmm_add_action_or_reset (&xe->drm, freq_fini, gt->freq); + err =devm_add_action (xe->drm.dev, freq_fini, gt->freq);if (err)return err;
drivers/gpu/drm/xe/xe_gt_idle.c +2 -2
@@ -145,7 +145,7 @@ static const struct attribute *gt_idle_attrs[] = { NULL, }; -static void gt_idle_sysfs_fini (struct drm_device *drm,void *arg) +static void gt_idle_sysfs_fini (void *arg) {struct kobject *kobj = arg;
@@ -182,7 +182,7 @@ int xe_gt_idle_sysfs_init(struct xe_gt_idle *gtidle)return err; } -return drmm_add_action_or_reset (&xe->drm, gt_idle_sysfs_fini, kobj); +return devm_add_action_or_reset (xe->drm.dev, gt_idle_sysfs_fini, kobj); }void xe_gt_idle_enable_c6 (struct xe_gt *gt)
drivers/gpu/drm/xe/xe_gt_sysfs.c +2 -2
@@ -22,7 +22,7 @@ static const struct kobj_type xe_gt_sysfs_kobj_type = { .sysfs_ops = &kobj_sysfs_ops, }; -static void gt_sysfs_fini (struct drm_device *drm,void *arg) +static void gt_sysfs_fini (void *arg) {struct xe_gt *gt = arg;
@@ -51,5 +51,5 @@ int xe_gt_sysfs_init(struct xe_gt *gt) gt->sysfs = &kg->base; -return drmm_add_action_or_reset (&xe->drm, gt_sysfs_fini, gt); +return devm_add_action (xe->drm.dev, gt_sysfs_fini, gt); }
drivers/gpu/drm/xe/xe_gt_throttle_sysfs.c +2 -2
@@ -229,7 +229,7 @@ static const struct attribute_group throttle_group_attrs = { .attrs = throttle_attrs, }; -static void gt_throttle_sysfs_fini (struct drm_device *drm,void *arg) +static void gt_throttle_sysfs_fini (void *arg) {struct xe_gt *gt = arg;
@@ -245,5 +245,5 @@ int xe_gt_throttle_sysfs_init(struct xe_gt *gt)if (err)return err; -return drmm_add_action_or_reset (&xe->drm, gt_throttle_sysfs_fini, gt); +return devm_add_action_or_reset (xe->drm.dev, gt_throttle_sysfs_fini, gt); }
drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c +6 -6
@@ -492,7 +492,7 @@ static const struct attribute * const files[] = { NULL }; -static void kobj_xe_hw_engine_class_fini (struct drm_device *drm,void *arg) +static void kobj_xe_hw_engine_class_fini (void *arg) {struct kobject *kobj = arg;
@@ -517,7 +517,7 @@ kobj_xe_hw_engine_class(struct xe_device *xe, struct kobject *parent, const char } keclass->xe = xe; - err =drmm_add_action_or_reset (&xe->drm, kobj_xe_hw_engine_class_fini, + err =devm_add_action_or_reset (xe->drm.dev, kobj_xe_hw_engine_class_fini, &keclass->base);if (err)return NULL ;
@@ -525,7 +525,7 @@ kobj_xe_hw_engine_class(struct xe_device *xe, struct kobject *parent, const charreturn keclass; } -static void hw_engine_class_defaults_fini (struct drm_device *drm,void *arg) +static void hw_engine_class_defaults_fini (void *arg) {struct kobject *kobj = arg;
@@ -552,7 +552,7 @@ static int xe_add_hw_engine_class_defaults(struct xe_device *xe,if (err) goto err_object; -return drmm_add_action_or_reset (&xe->drm, hw_engine_class_defaults_fini, kobj); +return devm_add_action_or_reset (xe->drm.dev, hw_engine_class_defaults_fini, kobj); err_object:kobject_put (kobj);
@@ -611,7 +611,7 @@ static const struct kobj_type xe_hw_engine_sysfs_kobj_type = { .sysfs_ops = &xe_hw_engine_class_sysfs_ops, }; -static void hw_engine_class_sysfs_fini (struct drm_device *drm,void *arg) +static void hw_engine_class_sysfs_fini (void *arg) {struct kobject *kobj = arg;
@@ -698,7 +698,7 @@ int xe_hw_engine_class_sysfs_init(struct xe_gt *gt) goto err_object; } -return drmm_add_action_or_reset (&xe->drm, hw_engine_class_sysfs_fini, kobj); +return devm_add_action_or_reset (xe->drm.dev, hw_engine_class_sysfs_fini, kobj); err_object:kobject_put (kobj);
drivers/gpu/drm/xe/xe_tile_sysfs.c +2 -2
@@ -22,7 +22,7 @@ static const struct kobj_type xe_tile_sysfs_kobj_type = { .sysfs_ops = &kobj_sysfs_ops, }; -static void tile_sysfs_fini (struct drm_device *drm,void *arg) +static void tile_sysfs_fini (void *arg) {struct xe_tile *tile = arg;
@@ -55,5 +55,5 @@ int xe_tile_sysfs_init(struct xe_tile *tile)if (err)return err; -return drmm_add_action_or_reset (&xe->drm, tile_sysfs_fini, tile); +return devm_add_action_or_reset (xe->drm.dev, tile_sysfs_fini, tile); }
drivers/gpu/drm/xe/xe_vram_freq.c +2 -2
@@ -87,7 +87,7 @@ static const struct attribute_group freq_group_attrs = { .attrs = freq_attrs, }; -static void vram_freq_sysfs_fini (struct drm_device *drm,void *arg) +static void vram_freq_sysfs_fini (void *arg) {struct kobject *kobj = arg;
@@ -122,5 +122,5 @@ int xe_vram_freq_sysfs_init(struct xe_tile *tile)return err; } -return drmm_add_action_or_reset (&xe->drm, vram_freq_sysfs_fini, kobj); +return devm_add_action_or_reset (xe->drm.dev, vram_freq_sysfs_fini, kobj); }
Signature · 1 line
2.45.0
PATCH 5/20 drm/xe/ggtt: use drm_dev_enter to mark device section
In reply to Matthew AuldDevice can be hotunplugged before we start destroying gem objects. In such a case don't touch the GGTT entries, trigger any invalidations or mess around with rpm. This should already be taken care of when removing the device, we just need to take care of dealing with the software state, like removing the mm node.
v2: (Andrzej)
- Avoid some duplication by tracking the bound status and checking that instead.
References: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/1717
--- drivers/gpu/drm/xe/xe_ggtt.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/gpu/drm/xe/xe_ggtt.c +15 -3
@@ -8,6 +8,7 @@#include <linux/io-64-nonatomic-lo-hi.h> #include <linux/sizes.h> +#include <drm/drm_drv.h> #include <drm/drm_managed.h> #include <drm/i915_drm.h>
@@ -433,18 +434,29 @@ int xe_ggtt_insert_bo(struct xe_ggtt *ggtt, struct xe_bo *bo)void xe_ggtt_remove_node (struct xe_ggtt *ggtt,struct drm_mm_node *node,bool invalidate) { -xe_pm_runtime_get_noresume (tile_to_xe (ggtt->tile)); +struct xe_device *xe =tile_to_xe (ggtt->tile); +bool bound; +int idx; + + bound =drm_dev_enter (&xe->drm, &idx); +if (bound) +xe_pm_runtime_get_noresume (xe);mutex_lock (&ggtt->lock); -xe_ggtt_clear (ggtt, node->start, node->size); +if (bound) +xe_ggtt_clear (ggtt, node->start, node->size);drm_mm_remove_node (node); node->size =0 ;mutex_unlock (&ggtt->lock); +if (!bound) +return ; +if (invalidate)xe_ggtt_invalidate (ggtt); -xe_pm_runtime_put (tile_to_xe (ggtt->tile)); +xe_pm_runtime_put (xe); +drm_dev_exit (idx); }void xe_ggtt_remove_bo (struct xe_ggtt *ggtt,struct xe_bo *bo)
Signature · 1 line
2.45.0
Re: [PATCH 05/20] drm/xe/ggtt: use drm_dev_enter to mark device section
Quoted 6 lines · Matthew Auld
Device can be hotunplugged before we start destroying gem objects. In such a case don't touch the GGTT entries, trigger any invalidations or mess around with rpm. This should already be taken care of when removing the device, we just need to take care of dealing with the software state, like removing the mm node.
Quoted 8 lines
v2: (Andrzej)
- Avoid some duplication by tracking the bound status and checking that instead.References: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/1717
Signed-off-by Matthew Auld <[email protected]>Cc Andrzej Hajda <[email protected]>Cc Rodrigo Vivi <[email protected]>
Regards
Andrzej
Quoted 49 lines
--- drivers/gpu/drm/xe/xe_ggtt.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)drivers/gpu/drm/xe/xe_ggtt.c +15
-3@@ -8,6 +8,7 @@#include <linux/io-64-nonatomic-lo-hi.h> #include <linux/sizes.h> +#include <drm/drm_drv.h> #include <drm/drm_managed.h> #include <drm/i915_drm.h> @@ -433,18 +434,29 @@ int xe_ggtt_insert_bo(struct xe_ggtt *ggtt, struct xe_bo *bo)void xe_ggtt_remove_node (struct xe_ggtt *ggtt,struct drm_mm_node *node,bool invalidate) { -xe_pm_runtime_get_noresume (tile_to_xe (ggtt->tile)); +struct xe_device *xe =tile_to_xe (ggtt->tile); +bool bound; +int idx; + + bound =drm_dev_enter (&xe->drm, &idx); +if (bound) +xe_pm_runtime_get_noresume (xe);mutex_lock (&ggtt->lock); -xe_ggtt_clear (ggtt, node->start, node->size); +if (bound) +xe_ggtt_clear (ggtt, node->start, node->size);drm_mm_remove_node (node); node->size =0 ;mutex_unlock (&ggtt->lock); +if (!bound) +return ; +if (invalidate)xe_ggtt_invalidate (ggtt); -xe_pm_runtime_put (tile_to_xe (ggtt->tile)); +xe_pm_runtime_put (xe); +drm_dev_exit (idx); }void xe_ggtt_remove_bo (struct xe_ggtt *ggtt,struct xe_bo *bo)
Re: [PATCH 05/20] drm/xe/ggtt: use drm_dev_enter to mark device section
In reply to Matthew AuldQuoted 53 lines · Matthew Auld
Device can be hotunplugged before we start destroying gem objects. In such a case don't touch the GGTT entries, trigger any invalidations or mess around with rpm. This should already be taken care of when removing the device, we just need to take care of dealing with the software state, like removing the mm node.
v2: (Andrzej)
- Avoid some duplication by tracking the bound status and checking that instead.References: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/1717
Signed-off-by Matthew Auld <[email protected]>Cc Andrzej Hajda <[email protected]>Cc Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/xe/xe_ggtt.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)drivers/gpu/drm/xe/xe_ggtt.c +12
-2@@ -8,6 +8,7 @@#include <linux/io-64-nonatomic-lo-hi.h> #include <linux/sizes.h> +#include <drm/drm_drv.h> #include <drm/drm_managed.h> #include <drm/i915_drm.h> @@ -433,18 +434,29 @@ int xe_ggtt_insert_bo(struct xe_ggtt *ggtt, struct xe_bo *bo)void xe_ggtt_remove_node (struct xe_ggtt *ggtt,struct drm_mm_node *node,bool invalidate) { -xe_pm_runtime_get_noresume (tile_to_xe (ggtt->tile)); +struct xe_device *xe =tile_to_xe (ggtt->tile); +bool bound; +int idx; + + bound =drm_dev_enter (&xe->drm, &idx); +if (bound) +xe_pm_runtime_get_noresume (xe);mutex_lock (&ggtt->lock); -xe_ggtt_clear (ggtt, node->start, node->size); +if (bound) +xe_ggtt_clear (ggtt, node->start, node->size);drm_mm_remove_node (node); node->size =0 ;mutex_unlock (&ggtt->lock); +if (!bound) +return ;
drivers/gpu/drm/xe/xe_ggtt.c int xe_ggtt_insert_bo(struct xe_ggtt *ggtt, struct xe_bo *bo) · line 462
Quoted 10 lines
drivers/gpu/drm/xe/xe_ggtt.c +3
-1+if (invalidate)xe_ggtt_invalidate (ggtt); -xe_pm_runtime_put (tile_to_xe (ggtt->tile)); +xe_pm_runtime_put (xe); +drm_dev_exit (idx); }void xe_ggtt_remove_bo (struct xe_ggtt *ggtt,struct xe_bo *bo)
PATCH 6/20 drm/xe/guc: move guc_fini over to devm
In reply to Matthew AuldMake sure to actually call this when the device is removed. Currently we only trigger it when the driver instance goes away, but that doesn't work too well with hotunplug, since device can be removed and re-probed with a new driver instance, where the guc_fini() is called too late. Move the fini over to devm to ensure this is called when device is removed.
References: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/1717
--- drivers/gpu/drm/xe/xe_guc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_guc.c +2 -2
@@ -239,7 +239,7 @@ static void guc_write_params(struct xe_guc *guc)xe_mmio_write32 (gt,SOFT_SCRATCH (1 + i), guc->params[i]); } -static void guc_fini (struct drm_device *drm,void *arg) +static void guc_fini (void *arg) {struct xe_guc *guc = arg;struct xe_gt *gt =guc_to_gt (guc);
@@ -323,7 +323,7 @@ int xe_guc_init(struct xe_guc *guc)if (ret) goto out; - ret =drmm_add_action_or_reset (&xe->drm, guc_fini, guc); + ret =devm_add_action_or_reset (xe->drm.dev, guc_fini, guc);if (ret) goto out;
Signature · 1 line
2.45.0
PATCH 7/20 drm/xe/guc: s/guc_fini/guc_fini_hw/
In reply to Matthew AuldMake it clear that is about cleaning up the HW/FW side, and not software state.
--- drivers/gpu/drm/xe/xe_guc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_guc.c +2 -2
@@ -239,7 +239,7 @@ static void guc_write_params(struct xe_guc *guc)xe_mmio_write32 (gt,SOFT_SCRATCH (1 + i), guc->params[i]); } -static void guc_fini (void *arg) +static void guc_fini_hw (void *arg) {struct xe_guc *guc = arg;struct xe_gt *gt =guc_to_gt (guc);
@@ -323,7 +323,7 @@ int xe_guc_init(struct xe_guc *guc)if (ret) goto out; - ret =devm_add_action_or_reset (xe->drm.dev, guc_fini, guc); + ret =devm_add_action_or_reset (xe->drm.dev, guc_fini_hw, guc);if (ret) goto out;
Signature · 1 line
2.45.0
Re: [PATCH 07/20] drm/xe/guc: s/guc_fini/guc_fini_hw/
Quoted 6 lines · Matthew Auld
Make it clear that is about cleaning up the HW/FW side, and not software state.
Signed-off-by Matthew Auld <[email protected]>Cc Andrzej Hajda <[email protected]>Cc Rodrigo Vivi <[email protected]>
Regards
Andrzej
Quoted 26 lines
--- drivers/gpu/drm/xe/xe_guc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/xe/xe_guc.c +2
-2@@ -239,7 +239,7 @@ static void guc_write_params(struct xe_guc *guc)xe_mmio_write32 (gt,SOFT_SCRATCH (1 + i), guc->params[i]); } -static void guc_fini (void *arg) +static void guc_fini_hw (void *arg) {struct xe_guc *guc = arg;struct xe_gt *gt =guc_to_gt (guc);@@ -323,7 +323,7 @@ int xe_guc_init(struct xe_guc *guc)if (ret) goto out; - ret =devm_add_action_or_reset (xe->drm.dev, guc_fini, guc); + ret =devm_add_action_or_reset (xe->drm.dev, guc_fini_hw, guc);if (ret) goto out;
PATCH 8/20 drm/xe/guc_pc: move pc_fini to devm
In reply to Matthew AuldHere we are touching the HW/GuC and presumably this should happen when the device is removed. Currently if you hotunplug the device this is skipped if there is already open driver instance.
--- drivers/gpu/drm/xe/xe_guc_pc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_guc_pc.c +2 -2
@@ -893,7 +893,7 @@ int xe_guc_pc_stop(struct xe_guc_pc *pc)* @drm: DRM device * @arg: opaque pointer that should point to Xe_GuC_PC instance */ -static void xe_guc_pc_fini (struct drm_device *drm,void *arg) +static void xe_guc_pc_fini (void *arg) {struct xe_guc_pc *pc = arg;struct xe_device *xe =pc_to_xe (pc);
@@ -941,5 +941,5 @@ int xe_guc_pc_init(struct xe_guc_pc *pc) pc->bo = bo; -return drmm_add_action_or_reset (&xe->drm, xe_guc_pc_fini, pc); +return devm_add_action_or_reset (xe->drm.dev, xe_guc_pc_fini, pc); }
Signature · 1 line
2.45.0
PATCH 9/20 drm/xe/guc_pc: s/pc_fini/pc_fini_hw/
In reply to Matthew AuldMake it clear that is about cleaning up the HW/FW side, and not software state.
--- drivers/gpu/drm/xe/xe_guc_pc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/xe/xe_guc_pc.c +3 -3
@@ -889,11 +889,11 @@ int xe_guc_pc_stop(struct xe_guc_pc *pc) }/** -* xe_guc_pc_fini - Finalize GuC's Power Conservation component +* xe_guc_pc_fini_hw - Finalize GuC's Power Conservation component * @drm: DRM device * @arg: opaque pointer that should point to Xe_GuC_PC instance */ -static void xe_guc_pc_fini (void *arg) +static void xe_guc_pc_fini_hw (void *arg) {struct xe_guc_pc *pc = arg;struct xe_device *xe =pc_to_xe (pc);
@@ -941,5 +941,5 @@ int xe_guc_pc_init(struct xe_guc_pc *pc) pc->bo = bo; -return devm_add_action_or_reset (xe->drm.dev, xe_guc_pc_fini, pc); +return devm_add_action_or_reset (xe->drm.dev, xe_guc_pc_fini_hw, pc); }
Signature · 1 line
2.45.0
kernel test robot
build botRe: [PATCH 09/20] drm/xe/guc_pc: s/pc_fini/pc_fini_hw/
kernel test robot noticed the following build warnings:
Hi Matthew,
kernel test robot noticed the following build warnings:
[auto build test WARNING on drm-xe/drm-xe-next]
[also build test WARNING on drm-misc/drm-misc-next next-20240510] [cannot apply to linus/master v6.9-rc7]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Matthew-Auld/drm-drm_managed-try-to-improve-the-drmm-DOC/20240511-061452 base: https://gitlab.freedesktop.org/drm/xe/kernel.git drm-xe-next patch link: https://lore.kernel.org/r/20240510181212.264622-31-matthew.auld%40intel.com patch subject: [PATCH 09/20] drm/xe/guc_pc: s/pc_fini/pc_fini_hw/ config: s390-allyesconfig (https://download.01.org/0day-ci/archive/20240511/[email protected]/config) compiler: s390-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240511/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> drivers/gpu/drm/xe/xe_guc_pc.c:897: warning: Excess function parameter 'drm' description in 'xe_guc_pc_fini_hw'
vim +897 drivers/gpu/drm/xe/xe_guc_pc.c
dd08ebf6c3525a Matthew Brost 2023-03-30 890
bef52b5c7a1904 Rodrigo Vivi 2023-12-08 891 /**
d4543ae6de1c7e Matthew Auld 2024-05-10 892 * xe_guc_pc_fini_hw - Finalize GuC's Power Conservation component
8a4587ef9f9521 Michał Winiarski 2024-02-19 893 * @drm: DRM device
8a4587ef9f9521 Michał Winiarski 2024-02-19 894 * @arg: opaque pointer that should point to Xe_GuC_PC instance
bef52b5c7a1904 Rodrigo Vivi 2023-12-08 895 */
d4543ae6de1c7e Matthew Auld 2024-05-10 896 static void xe_guc_pc_fini_hw(void *arg)
dd08ebf6c3525a Matthew Brost 2023-03-30 @897 {
8a4587ef9f9521 Michał Winiarski 2024-02-19 898 struct xe_guc_pc *pc = arg;
975e4a3795d4f1 Vinay Belgaumkar 2023-11-17 899 struct xe_device *xe = pc_to_xe(pc);
975e4a3795d4f1 Vinay Belgaumkar 2023-11-17 900
975e4a3795d4f1 Vinay Belgaumkar 2023-11-17 901 if (xe->info.skip_guc_pc) {
975e4a3795d4f1 Vinay Belgaumkar 2023-11-17 902 xe_gt_idle_disable_c6(pc_to_gt(pc));
975e4a3795d4f1 Vinay Belgaumkar 2023-11-17 903 return;
975e4a3795d4f1 Vinay Belgaumkar 2023-11-17 904 }
975e4a3795d4f1 Vinay Belgaumkar 2023-11-17 905
fb74b205cdd263 Rodrigo Vivi 2024-04-23 906 if (xe_device_wedged(xe))
fb74b205cdd263 Rodrigo Vivi 2024-04-23 907 return;
fb74b205cdd263 Rodrigo Vivi 2024-04-23 908
649a125a88da64 Daniele Ceraolo Spurio 2024-03-18 909 XE_WARN_ON(xe_force_wake_get(gt_to_fw(pc_to_gt(pc)), XE_FORCEWAKE_ALL));
1737785ae5313e Riana Tauro 2023-07-17 910 XE_WARN_ON(xe_guc_pc_gucrc_disable(pc));
dd08ebf6c3525a Matthew Brost 2023-03-30 911 XE_WARN_ON(xe_guc_pc_stop(pc));
8a4587ef9f9521 Michał Winiarski 2024-02-19 912 xe_force_wake_put(gt_to_fw(pc_to_gt(pc)), XE_FORCEWAKE_ALL);
dd08ebf6c3525a Matthew Brost 2023-03-30 913 }
dd08ebf6c3525a Matthew Brost 2023-03-30 914 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Re: [PATCH 09/20] drm/xe/guc_pc: s/pc_fini/pc_fini_hw/
In reply to Matthew AuldQuoted 15 lines · Matthew Auld
Make it clear that is about cleaning up the HW/FW side, and not software state.
Signed-off-by Matthew Auld <[email protected]>Cc Andrzej Hajda <[email protected]>Cc Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/xe/xe_guc_pc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/xe/xe_guc_pc.c +0
-0
drivers/gpu/drm/xe/xe_guc_pc.c int xe_guc_pc_stop(struct xe_guc_pc *pc) · line 893
Quoted 6 lines
drivers/gpu/drm/xe/xe_guc_pc.c +1
-1@@ -889,11 +889,11 @@ int xe_guc_pc_stop(struct xe_guc_pc *pc) }/** -* xe_guc_pc_fini - Finalize GuC's Power Conservation component +* xe_guc_pc_fini_hw - Finalize GuC's Power Conservation component * @drm: DRM device
With removal of @drm description
Regards
Andrzej
Quoted 14 lines
drivers/gpu/drm/xe/xe_guc_pc.c +2
-2* @arg: opaque pointer that should point to Xe_GuC_PC instance */ -static void xe_guc_pc_fini (void *arg) +static void xe_guc_pc_fini_hw (void *arg) {struct xe_guc_pc *pc = arg;struct xe_device *xe =pc_to_xe (pc);@@ -941,5 +941,5 @@ int xe_guc_pc_init(struct xe_guc_pc *pc) pc->bo = bo; -return devm_add_action_or_reset (xe->drm.dev, xe_guc_pc_fini, pc); +return devm_add_action_or_reset (xe->drm.dev, xe_guc_pc_fini_hw, pc); }
PATCH 10/20 drm/xe/irq: move irq_uninstall over to devm
In reply to Matthew AuldMakes sense to trigger this when the device is removed.
--- drivers/gpu/drm/xe/xe_irq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/xe/xe_irq.c +3 -3
@@ -663,7 +663,7 @@ static irq_handler_t xe_irq_handler(struct xe_device *xe)return xelp_irq_handler; } -static void irq_uninstall (struct drm_device *drm,void *arg) +static void irq_uninstall (void *arg) {struct xe_device *xe = arg;struct pci_dev *pdev =to_pci_dev (xe->drm.dev);
@@ -723,7 +723,7 @@ int xe_irq_install(struct xe_device *xe)xe_irq_postinstall (xe); - err =drmm_add_action_or_reset (&xe->drm, irq_uninstall, xe); + err =devm_add_action_or_reset (xe->drm.dev, irq_uninstall, xe);if (err) goto free_irq_handler;
@@ -737,7 +737,7 @@ int xe_irq_install(struct xe_device *xe)void xe_irq_shutdown (struct xe_device *xe) { -irq_uninstall (&xe->drm, xe); +irq_uninstall (xe); }void xe_irq_suspend (struct xe_device *xe)
Signature · 1 line
2.45.0
PATCH 11/20 drm/xe/device: move flr to devm
In reply to Matthew AuldShould be called when driver is removed, not when this particular driver instance is destroyed.
--- drivers/gpu/drm/xe/xe_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_device.c +2 -2
@@ -380,7 +380,7 @@ static void xe_driver_flr(struct xe_device *xe)xe_mmio_write32 (gt,GU_DEBUG ,DRIVERFLR_STATUS ); } -static void xe_driver_flr_fini (struct drm_device *drm,void *arg) +static void xe_driver_flr_fini (void *arg) {struct xe_device *xe = arg;
@@ -582,7 +582,7 @@ int xe_device_probe(struct xe_device *xe) err =xe_devcoredump_init (xe);if (err)return err; - err =drmm_add_action_or_reset (&xe->drm, xe_driver_flr_fini, xe); + err =devm_add_action_or_reset (xe->drm.dev, xe_driver_flr_fini, xe);if (err)return err;
Signature · 1 line
2.45.0
PATCH 12/20 drm/xe/device: move xe_device_sanitize over to devm
In reply to Matthew AuldDisable GuC submission when removing the device.
--- drivers/gpu/drm/xe/xe_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_device.c +2 -2
@@ -388,7 +388,7 @@ static void xe_driver_flr_fini(void *arg)xe_driver_flr (xe); } -static void xe_device_sanitize (struct drm_device *drm,void *arg) +static void xe_device_sanitize (void *arg) {struct xe_device *xe = arg;struct xe_gt *gt;
@@ -654,7 +654,7 @@ int xe_device_probe(struct xe_device *xe)xe_hwmon_register (xe); -return drmm_add_action_or_reset (&xe->drm, xe_device_sanitize, xe); +return devm_add_action_or_reset (xe->drm.dev, xe_device_sanitize, xe); err_fini_display:xe_display_driver_remove (xe);
Signature · 1 line
2.45.0
PATCH 13/20 drm/xe/coredump: move over to devm
In reply to Matthew AuldHere we are using drmm to ensure we release the coredump when unloading the module, however the coredump is very much tied to the struct device underneath. We can see this when we hotunplug the device, for which we have already got a coredump attached. In such a case the coredump still remains and adding another is not possible. However we still register the release action via xe_driver_devcoredump_fini(), so in effect two or more releases for one dump. The other consideration is that the coredump state is embedded in the xe_driver instance, so technically once the drmm release action fires we might free the coredumpe state from a different driver instance, assuming we have two release actions and they can race. Rather use devm here to remove the coredump when the device is released.
References: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/1679
--- drivers/gpu/drm/xe/xe_devcoredump.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_devcoredump.c +4 -2
@@ -238,13 +238,15 @@ void xe_devcoredump(struct xe_sched_job *job) xe_devcoredump_read, xe_devcoredump_free); } -static void xe_driver_devcoredump_fini (struct drm_device *drm,void *arg) +static void xe_driver_devcoredump_fini (void *arg) { +struct drm_device *drm = arg; +dev_coredump_put (drm->dev); }int xe_devcoredump_init (struct xe_device *xe) { -return drmm_add_action_or_reset (&xe->drm, xe_driver_devcoredump_fini, xe); +return devm_add_action_or_reset (xe->drm.dev, xe_driver_devcoredump_fini, &xe->drm); }#endif
Signature · 1 line
2.45.0
Re: [PATCH 13/20] drm/xe/coredump: move over to devm
Quoted 13 lines · Matthew Auld
Here we are using drmm to ensure we release the coredump when unloading the module, however the coredump is very much tied to the struct device underneath. We can see this when we hotunplug the device, for which we have already got a coredump attached. In such a case the coredump still remains and adding another is not possible. However we still register the release action via
xe_driver_devcoredump_fini(), so in effect two or more releases for one dump. The other consideration is that the coredump state is embedded in thexe_driverinstance, so technically once the drmm release action fires we might free the coredumpe state from a different driver instance, assuming we have two release actions and they can race. Rather use devm here to remove the coredump when the device is released.
Quoted 4 lines
References: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/1679
Signed-off-by Matthew Auld <[email protected]>Cc Andrzej Hajda <[email protected]>Cc Rodrigo Vivi <[email protected]>
Regards
Andrzej
Quoted 26 lines
--- drivers/gpu/drm/xe/xe_devcoredump.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/gpu/drm/xe/xe_devcoredump.c +4
-2@@ -238,13 +238,15 @@ void xe_devcoredump(struct xe_sched_job *job) xe_devcoredump_read, xe_devcoredump_free); } -static void xe_driver_devcoredump_fini (struct drm_device *drm,void *arg) +static void xe_driver_devcoredump_fini (void *arg) { +struct drm_device *drm = arg; +dev_coredump_put (drm->dev); }int xe_devcoredump_init (struct xe_device *xe) { -return drmm_add_action_or_reset (&xe->drm, xe_driver_devcoredump_fini, xe); +return devm_add_action_or_reset (xe->drm.dev, xe_driver_devcoredump_fini, &xe->drm); }#endif
PATCH 14/20 drm/xe/gt: break out gt_fini into sw vs hw state
In reply to Matthew AuldHave a cleaner separation between hw vs sw.
--- drivers/gpu/drm/xe/xe_gt.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
drivers/gpu/drm/xe/xe_gt.c +13 -8
@@ -57,9 +57,17 @@#include "xe_wa.h" #include "xe_wopcm.h" +static void gt_fini (struct drm_device *drm,void *arg) +{ +struct xe_gt *gt = arg; + +destroy_workqueue (gt->ordered_wq); +} +struct xe_gt *xe_gt_alloc (struct xe_tile *tile) {struct xe_gt *gt; +int err; gt =drmm_kzalloc (&tile_to_xe (tile)->drm,sizeof (*gt),GFP_KERNEL );if (!gt)
@@ -68,6 +76,10 @@ struct xe_gt *xe_gt_alloc(struct xe_tile *tile) gt->tile = tile; gt->ordered_wq =alloc_ordered_workqueue ("gt-ordered-wq" ,0 ); + err =drmm_add_action_or_reset (>_to_xe (gt)->drm, gt_fini, gt); +if (err) +return ERR_PTR (err); +return gt; }
@@ -90,15 +102,9 @@ void xe_gt_sanitize(struct xe_gt *gt)*/ void xe_gt_remove (struct xe_gt *gt) { -xe_uc_remove (>->uc); -} - -static void gt_fini (struct drm_device *drm,void *arg) -{ -struct xe_gt *gt = arg;int i; -destroy_workqueue (gt->ordered_wq); +xe_uc_remove (>->uc);for (i =0 ; i <XE_ENGINE_CLASS_MAX ; ++i)xe_hw_fence_irq_finish (>->fence_irq[i]);
@@ -567,7 +573,6 @@ int xe_gt_init(struct xe_gt *gt)if (err)return err; -return drmm_add_action_or_reset (>_to_xe (gt)->drm, gt_fini, gt); }static int do_gt_reset (struct xe_gt *gt)
Signature · 1 line
2.45.0
Re: [PATCH 14/20] drm/xe/gt: break out gt_fini into sw vs hw state
Quoted 14 lines · Matthew Auld
Have a cleaner separation between hw vs sw.
Signed-off-by Matthew Auld <[email protected]>Cc Andrzej Hajda <[email protected]>Cc Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/xe/xe_gt.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)drivers/gpu/drm/xe/xe_gt.c +0
-0
drivers/gpu/drm/xe/xe_gt.c line 64
Quoted 8 lines
drivers/gpu/drm/xe/xe_gt.c +5
-0@@ -57,9 +57,17 @@#include "xe_wa.h" #include "xe_wopcm.h" +static void gt_fini (struct drm_device *drm,void *arg) +{ +struct xe_gt *gt = arg; + +destroy_workqueue (gt->ordered_wq);
Do we need this wq after unbind? It seems to be used by hw stuff:
- gt_reset
- xe_guc_exec_queue_trigger_cleanup
Regards
Andrzej
Quoted 45 lines
drivers/gpu/drm/xe/xe_gt.c +8
-8+} +struct xe_gt *xe_gt_alloc (struct xe_tile *tile) {struct xe_gt *gt; +int err; gt =drmm_kzalloc (&tile_to_xe (tile)->drm,sizeof (*gt),GFP_KERNEL );if (!gt)@@ -68,6 +76,10 @@ struct xe_gt *xe_gt_alloc(struct xe_tile *tile) gt->tile = tile; gt->ordered_wq =alloc_ordered_workqueue ("gt-ordered-wq" ,0 ); + err =drmm_add_action_or_reset (>_to_xe (gt)->drm, gt_fini, gt); +if (err) +return ERR_PTR (err); +return gt; }@@ -90,15 +102,9 @@ void xe_gt_sanitize(struct xe_gt *gt)*/ void xe_gt_remove (struct xe_gt *gt) { -xe_uc_remove (>->uc); -} - -static void gt_fini (struct drm_device *drm,void *arg) -{ -struct xe_gt *gt = arg;int i; -destroy_workqueue (gt->ordered_wq); +xe_uc_remove (>->uc);for (i =0 ; i <XE_ENGINE_CLASS_MAX ; ++i)xe_hw_fence_irq_finish (>->fence_irq[i]);@@ -567,7 +573,6 @@ int xe_gt_init(struct xe_gt *gt)if (err)return err; -return drmm_add_action_or_reset (>_to_xe (gt)->drm, gt_fini, gt); }static int do_gt_reset (struct xe_gt *gt)
Re: [PATCH 14/20] drm/xe/gt: break out gt_fini into sw vs hw state
Quoted 10 lines · Andrzej Hajda
Quoted 9 lines · Matthew Auld
Have a cleaner separation between hw vs sw.
Signed-off-by Matthew Auld <[email protected]>Cc Andrzej Hajda <[email protected]>Cc Rodrigo Vivi <[email protected]>---
drivers/gpu/drm/xe/xe_gt.c| 21 +++++++++++++--------1 file changed, 13 insertions(+), 8 deletions(-)
Quoted 16 lines
drivers/gpu/drm/xe/xe_gt.c line 63
Quoted 12 lines
drivers/gpu/drm/xe/xe_gt.c +5
-0@@ -57,9 +57,17 @@ #include "xe_wa.h" #include "xe_wopcm.h" +static void gt_fini (struct drm_device *drm,void *arg) +{ + struct xe_gt *gt = arg; + + destroy_workqueue(gt->ordered_wq);Do we need this wq after unbind? It seems to be used by hw stuff:
-gt_reset
-xe_guc_exec_queue_trigger_cleanup
Yeah, my thinking is that for stuff like exec queue we might need to clean it up after unplug? Plus it's just sw state. I can drop for now if you prefer?
Quoted 43 lines
Regards
AndrzejQuoted 38 lines
drivers/gpu/drm/xe/xe_gt.c +8
-8+} + struct xe_gt *xe_gt_alloc(struct xe_tile *tile) { struct xe_gt *gt; + int err; gt = drmm_kzalloc(&tile_to_xe(tile)->drm, sizeof(*gt), GFP_KERNEL); if (!gt)@@ -68,6 +76,10 @@ struct xe_gt *xe_gt_alloc(struct xe_tile *tile) gt->tile = tile; gt->ordered_wq = alloc_ordered_workqueue("gt-ordered-wq", 0); + err = drmm_add_action_or_reset(>_to_xe(gt)->drm, gt_fini, gt); + if (err) + return ERR_PTR(err); + return gt; }@@ -90,15 +102,9 @@ void xe_gt_sanitize(struct xe_gt *gt)*/ void xe_gt_remove(struct xe_gt *gt) { - xe_uc_remove(>->uc); -} - -static void gt_fini (struct drm_device *drm,void *arg) -{ - struct xe_gt *gt = arg; int i; - destroy_workqueue(gt->ordered_wq); + xe_uc_remove(>->uc); for (i = 0; i < XE_ENGINE_CLASS_MAX; ++i) xe_hw_fence_irq_finish(>->fence_irq[i]);@@ -567,7 +573,6 @@ int xe_gt_init(struct xe_gt *gt) if (err) return err; - return drmm_add_action_or_reset(>_to_xe(gt)->drm, gt_fini, gt); } static int do_gt_reset(struct xe_gt *gt)
Andrzej Hajda
Reviewed-byRe: [PATCH 14/20] drm/xe/gt: break out gt_fini into sw vs hw state
Quoted 28 lines · Matthew Auld
Quoted 10 lines · Andrzej Hajda
Quoted 9 lines · Matthew Auld
Have a cleaner separation between hw vs sw.
Signed-off-by Matthew Auld <[email protected]>Cc Andrzej Hajda <[email protected]>Cc Rodrigo Vivi <[email protected]>---
drivers/gpu/drm/xe/xe_gt.c| 21 +++++++++++++--------1 file changed, 13 insertions(+), 8 deletions(-)Quoted 16 lines
drivers/gpu/drm/xe/xe_gt.c line 63
Quoted 12 lines
drivers/gpu/drm/xe/xe_gt.c +5
-0@@ -57,9 +57,17 @@ #include "xe_wa.h" #include "xe_wopcm.h" +static void gt_fini (struct drm_device *drm,void *arg) +{ + struct xe_gt *gt = arg; + + destroy_workqueue(gt->ordered_wq);Do we need this wq after unbind? It seems to be used by hw stuff:
-gt_reset
-xe_guc_exec_queue_trigger_cleanup
Quoted 1 line
Yeah, my thinking is that for stuff like exec queue we might need to clean it up after unplug? Plus it's just sw state. I can drop for now if you prefer?
OK, no strong feelings.
Regards
Andrzej
Quoted 44 lines
Quoted 44 lines
Regards
AndrzejQuoted 38 lines
drivers/gpu/drm/xe/xe_gt.c +8
-8+} + struct xe_gt *xe_gt_alloc(struct xe_tile *tile) { struct xe_gt *gt; + int err; gt = drmm_kzalloc(&tile_to_xe(tile)->drm, sizeof(*gt), GFP_KERNEL); if (!gt)@@ -68,6 +76,10 @@ struct xe_gt *xe_gt_alloc(struct xe_tile *tile) gt->tile = tile; gt->ordered_wq = alloc_ordered_workqueue("gt-ordered-wq", 0); + err = drmm_add_action_or_reset(>_to_xe(gt)->drm, gt_fini, gt); + if (err) + return ERR_PTR(err); + return gt; }@@ -90,15 +102,9 @@ void xe_gt_sanitize(struct xe_gt *gt)*/ void xe_gt_remove(struct xe_gt *gt) { - xe_uc_remove(>->uc); -} - -static void gt_fini (struct drm_device *drm,void *arg) -{ - struct xe_gt *gt = arg; int i; - destroy_workqueue(gt->ordered_wq); + xe_uc_remove(>->uc); for (i = 0; i < XE_ENGINE_CLASS_MAX; ++i) xe_hw_fence_irq_finish(>->fence_irq[i]);@@ -567,7 +573,6 @@ int xe_gt_init(struct xe_gt *gt) if (err) return err; - return drmm_add_action_or_reset(>_to_xe(gt)->drm, gt_fini, gt); } static int do_gt_reset(struct xe_gt *gt)
PATCH 15/20 drm/xe: make gt_remove use devm
In reply to Matthew AuldNo need to hand roll the onion unwind here, just move gt_remove over to devm which will already have the correct ordering.
--- drivers/gpu/drm/xe/xe_device.c | 22 ++-------------------- drivers/gpu/drm/xe/xe_gt.c | 9 ++++----- drivers/gpu/drm/xe/xe_gt.h | 1 - 3 files changed, 6 insertions(+), 26 deletions(-)
drivers/gpu/drm/xe/xe_device.c +2 -20
@@ -537,7 +537,6 @@ int xe_device_probe(struct xe_device *xe)struct xe_tile *tile;struct xe_gt *gt;int err; -u8 last_gt;u8 id;xe_pat_init_early (xe);
@@ -631,18 +630,16 @@ int xe_device_probe(struct xe_device *xe) goto err_irq_shutdown;for_each_gt (gt, xe, id) { - last_gt = id; - err =xe_gt_init (gt);if (err) - goto err_fini_gt; + goto err_irq_shutdown; }xe_heci_gsc_init (xe); err =xe_display_init (xe);if (err) - goto err_fini_gt; + goto err_irq_shutdown; err =drm_dev_register (&xe->drm,0 );if (err)
@@ -658,15 +655,6 @@ int xe_device_probe(struct xe_device *xe) err_fini_display:xe_display_driver_remove (xe); - -err_fini_gt: -for_each_gt (gt, xe, id) { -if (id < last_gt) -xe_gt_remove (gt); -else -break ; - } - err_irq_shutdown:xe_irq_shutdown (xe); err:
@@ -684,18 +672,12 @@ static void xe_device_remove_display(struct xe_device *xe)void xe_device_remove (struct xe_device *xe) { -struct xe_gt *gt; -u8 id; -xe_device_remove_display (xe);xe_display_fini (xe);xe_heci_gsc_fini (xe); -for_each_gt (gt, xe, id) -xe_gt_remove (gt); -xe_irq_shutdown (xe); }
drivers/gpu/drm/xe/xe_gt.c +4 -5
@@ -92,16 +92,14 @@ void xe_gt_sanitize(struct xe_gt *gt) gt->uc.guc.submission_state.enabled = false; } -/** -* xe_gt_remove() - Clean up the GT structures before driver removal -* @gt: the GT object -* +/* * This function should only act on objects/structures that must be cleaned * before the driver removal callback is complete and therefore can't be * deferred to a drmm action. */ -void xe_gt_remove (struct xe_gt *gt) +static void gt_remove (void *arg) { +struct xe_gt *gt = arg;int i;xe_uc_remove (>->uc);
@@ -573,6 +571,7 @@ int xe_gt_init(struct xe_gt *gt)if (err)return err; +return devm_add_action_or_reset (gt_to_xe (gt)->drm.dev, gt_remove, gt); }static int do_gt_reset (struct xe_gt *gt)
drivers/gpu/drm/xe/xe_gt.h +0 -1
@@ -43,7 +43,6 @@ int xe_gt_suspend(struct xe_gt *gt);int xe_gt_resume (struct xe_gt *gt);void xe_gt_reset_async (struct xe_gt *gt);void xe_gt_sanitize (struct xe_gt *gt); -void xe_gt_remove (struct xe_gt *gt);/** * xe_gt_any_hw_engine_by_reset_domain - scan the list of engines and return the
Signature · 1 line
2.45.0
Re: [PATCH 15/20] drm/xe: make gt_remove use devm
Quoted 6 lines · Matthew Auld
No need to hand roll the onion unwind here, just move
gt_removeover to devm which will already have the correct ordering.Signed-off-by Matthew Auld <[email protected]>Cc Andrzej Hajda <[email protected]>Cc Rodrigo Vivi <[email protected]>
Regards
Andrzej
Quoted 118 lines
--- drivers/gpu/drm/xe/xe_device.c | 22 ++-------------------- drivers/gpu/drm/xe/xe_gt.c | 9 ++++----- drivers/gpu/drm/xe/xe_gt.h | 1 - 3 files changed, 6 insertions(+), 26 deletions(-)drivers/gpu/drm/xe/xe_device.c +2
-20@@ -537,7 +537,6 @@ int xe_device_probe(struct xe_device *xe)struct xe_tile *tile;struct xe_gt *gt;int err; -u8 last_gt;u8 id;xe_pat_init_early (xe);@@ -631,18 +630,16 @@ int xe_device_probe(struct xe_device *xe) goto err_irq_shutdown;for_each_gt (gt, xe, id) { - last_gt = id; - err =xe_gt_init (gt);if (err) - goto err_fini_gt; + goto err_irq_shutdown; }xe_heci_gsc_init (xe); err =xe_display_init (xe);if (err) - goto err_fini_gt; + goto err_irq_shutdown; err =drm_dev_register (&xe->drm,0 );if (err)@@ -658,15 +655,6 @@ int xe_device_probe(struct xe_device *xe) err_fini_display:xe_display_driver_remove (xe); - -err_fini_gt: -for_each_gt (gt, xe, id) { -if (id < last_gt) -xe_gt_remove (gt); -else -break ; - } - err_irq_shutdown:xe_irq_shutdown (xe); err:@@ -684,18 +672,12 @@ static void xe_device_remove_display(struct xe_device *xe)void xe_device_remove (struct xe_device *xe) { -struct xe_gt *gt; -u8 id; -xe_device_remove_display (xe);xe_display_fini (xe);xe_heci_gsc_fini (xe); -for_each_gt (gt, xe, id) -xe_gt_remove (gt); -xe_irq_shutdown (xe); }drivers/gpu/drm/xe/xe_gt.c +4
-5@@ -92,16 +92,14 @@ void xe_gt_sanitize(struct xe_gt *gt) gt->uc.guc.submission_state.enabled = false; } -/** -* xe_gt_remove() - Clean up the GT structures before driver removal -* @gt: the GT object -* +/* * This function should only act on objects/structures that must be cleaned * before the driver removal callback is complete and therefore can't be * deferred to a drmm action. */ -void xe_gt_remove (struct xe_gt *gt) +static void gt_remove (void *arg) { +struct xe_gt *gt = arg;int i;xe_uc_remove (>->uc);@@ -573,6 +571,7 @@ int xe_gt_init(struct xe_gt *gt)if (err)return err; +return devm_add_action_or_reset (gt_to_xe (gt)->drm.dev, gt_remove, gt); }static int do_gt_reset (struct xe_gt *gt)drivers/gpu/drm/xe/xe_gt.h +0
-1@@ -43,7 +43,6 @@ int xe_gt_suspend(struct xe_gt *gt);int xe_gt_resume (struct xe_gt *gt);void xe_gt_reset_async (struct xe_gt *gt);void xe_gt_sanitize (struct xe_gt *gt); -void xe_gt_remove (struct xe_gt *gt);/** * xe_gt_any_hw_engine_by_reset_domain - scan the list of engines and return the
PATCH 16/20 drm/xe/mmio: move mmio_fini over to devm
In reply to Matthew AuldNot valid to touch mmio once the device is removed, so make sure we unmap on removal and not just when driver instance goes away. Also set the mmio pointers to NULL to hopefully catch such issues more easily.
--- drivers/gpu/drm/xe/xe_mmio.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_mmio.c +5 -2
@@ -387,13 +387,16 @@ void xe_mmio_probe_tiles(struct xe_device *xe) } } -static void mmio_fini (struct drm_device *drm,void *arg) +static void mmio_fini (void *arg) {struct xe_device *xe = arg;pci_iounmap (to_pci_dev (xe->drm.dev), xe->mmio.regs);if (xe->mem.vram.mapping)iounmap (xe->mem.vram.mapping); + + xe->mem.vram.mapping =NULL ; + xe->mmio.regs =NULL ; }int xe_mmio_init (struct xe_device *xe)
@@ -418,7 +421,7 @@ int xe_mmio_init(struct xe_device *xe) root_tile->mmio.size =SZ_16M ; root_tile->mmio.regs = xe->mmio.regs; -return drmm_add_action_or_reset (&xe->drm, mmio_fini, xe); +return devm_add_action_or_reset (xe->drm.dev, mmio_fini, xe); }u8 xe_mmio_read8 (struct xe_gt *gt,struct xe_reg reg)
Signature · 1 line
2.45.0
Re: [PATCH 16/20] drm/xe/mmio: move mmio_fini over to devm
Quoted 7 lines · Matthew Auld
Not valid to touch mmio once the device is removed, so make sure we unmap on removal and not just when driver instance goes away. Also set the mmio pointers to NULL to hopefully catch such issues more easily.
Signed-off-by Matthew Auld <[email protected]>Cc Andrzej Hajda <[email protected]>Cc Rodrigo Vivi <[email protected]>
Regards
Andrzej
Quoted 35 lines
--- drivers/gpu/drm/xe/xe_mmio.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)drivers/gpu/drm/xe/xe_mmio.c +5
-2@@ -387,13 +387,16 @@ void xe_mmio_probe_tiles(struct xe_device *xe) } } -static void mmio_fini (struct drm_device *drm,void *arg) +static void mmio_fini (void *arg) {struct xe_device *xe = arg;pci_iounmap (to_pci_dev (xe->drm.dev), xe->mmio.regs);if (xe->mem.vram.mapping)iounmap (xe->mem.vram.mapping); + + xe->mem.vram.mapping =NULL ; + xe->mmio.regs =NULL ; }int xe_mmio_init (struct xe_device *xe)@@ -418,7 +421,7 @@ int xe_mmio_init(struct xe_device *xe) root_tile->mmio.size =SZ_16M ; root_tile->mmio.regs = xe->mmio.regs; -return drmm_add_action_or_reset (&xe->drm, mmio_fini, xe); +return devm_add_action_or_reset (xe->drm.dev, mmio_fini, xe); }u8 xe_mmio_read8 (struct xe_gt *gt,struct xe_reg reg)
PATCH 17/20 drm/xe: reset mmio mappings with devm
In reply to Matthew AuldSet our various mmio mappings to NULL. This should make it easier to catch something rogue trying to mess with mmio after device removal. For example, we might unmap everything and then start hitting some mmio address which has already been unmamped by us and then remapped by something else, causing all kinds of carnage.
--- drivers/gpu/drm/xe/xe_device.c | 4 +++- drivers/gpu/drm/xe/xe_mmio.c | 35 ++++++++++++++++++++++++++++------ drivers/gpu/drm/xe/xe_mmio.h | 2 +- 3 files changed, 33 insertions(+), 8 deletions(-)
drivers/gpu/drm/xe/xe_device.c +3 -1
@@ -554,7 +554,9 @@ int xe_device_probe(struct xe_device *xe)if (err)return err; -xe_mmio_probe_tiles (xe); + err =xe_mmio_probe_tiles (xe); +if (err) +return err;xe_ttm_sys_mgr_init (xe);
drivers/gpu/drm/xe/xe_mmio.c +29 -6
@@ -255,6 +255,21 @@ static int xe_mmio_tile_vram_size(struct xe_tile *tile, u64 *vram_size,return xe_force_wake_put (gt_to_fw (gt),XE_FW_GT ); } +static void vram_fini (void *arg) +{ +struct xe_device *xe = arg; +struct xe_tile *tile; +int id; + +if (xe->mem.vram.mapping) +iounmap (xe->mem.vram.mapping); + + xe->mem.vram.mapping =NULL ; + +for_each_tile (tile, xe, id) + tile->mem.vram.mapping =NULL ; +} +int xe_mmio_probe_vram (struct xe_device *xe) {struct xe_tile *tile;
@@ -331,10 +346,20 @@ int xe_mmio_probe_vram(struct xe_device *xe)drm_info (&xe->drm,"Available VRAM: %pa, %pa\n" , &xe->mem.vram.io_start, &available_size); -return 0 ; +return devm_add_action_or_reset (xe->drm.dev, vram_fini, xe); } -void xe_mmio_probe_tiles (struct xe_device *xe) +static void tiles_fini (void *arg) +{ +struct xe_device *xe = arg; +struct xe_tile *tile; +int id; + +for_each_tile (tile, xe, id) + tile->mmio.regs =NULL ; +} + +int xe_mmio_probe_tiles (struct xe_device *xe) {size_t tile_mmio_size =SZ_16M , tile_mmio_ext_size = xe->info.tile_mmio_ext_size;u8 id, tile_count = xe->info.tile_count;
@@ -385,6 +410,8 @@ void xe_mmio_probe_tiles(struct xe_device *xe) regs += tile_mmio_ext_size; } } + +return devm_add_action_or_reset (xe->drm.dev, tiles_fini, xe); }static void mmio_fini (void *arg)
@@ -392,10 +419,6 @@ static void mmio_fini(void *arg)struct xe_device *xe = arg;pci_iounmap (to_pci_dev (xe->drm.dev), xe->mmio.regs); -if (xe->mem.vram.mapping) -iounmap (xe->mem.vram.mapping); - - xe->mem.vram.mapping =NULL ; xe->mmio.regs =NULL ; }
drivers/gpu/drm/xe/xe_mmio.h +1 -1
@@ -21,7 +21,7 @@ struct xe_device;#define LMEM_BAR 2int xe_mmio_init (struct xe_device *xe); -void xe_mmio_probe_tiles (struct xe_device *xe); +int xe_mmio_probe_tiles (struct xe_device *xe);u8 xe_mmio_read8 (struct xe_gt *gt,struct xe_reg reg);u16 xe_mmio_read16 (struct xe_gt *gt,struct xe_reg reg);
Signature · 1 line
2.45.0
Re: [PATCH 17/20] drm/xe: reset mmio mappings with devm
Quoted 9 lines · Matthew Auld
Set our various mmio mappings to NULL. This should make it easier to catch something rogue trying to mess with mmio after device removal. For example, we might unmap everything and then start hitting some mmio address which has already been unmamped by us and then remapped by something else, causing all kinds of carnage.
Signed-off-by Matthew Auld <[email protected]>Cc Andrzej Hajda <[email protected]>Cc Rodrigo Vivi <[email protected]>
Regards
Andrzej
Quoted 103 lines
--- drivers/gpu/drm/xe/xe_device.c | 4 +++- drivers/gpu/drm/xe/xe_mmio.c | 35 ++++++++++++++++++++++++++++------ drivers/gpu/drm/xe/xe_mmio.h | 2 +- 3 files changed, 33 insertions(+), 8 deletions(-)drivers/gpu/drm/xe/xe_device.c +3
-1@@ -554,7 +554,9 @@ int xe_device_probe(struct xe_device *xe)if (err)return err; -xe_mmio_probe_tiles (xe); + err =xe_mmio_probe_tiles (xe); +if (err) +return err;xe_ttm_sys_mgr_init (xe);drivers/gpu/drm/xe/xe_mmio.c +29
-6@@ -255,6 +255,21 @@ static int xe_mmio_tile_vram_size(struct xe_tile *tile, u64 *vram_size,return xe_force_wake_put (gt_to_fw (gt),XE_FW_GT ); } +static void vram_fini (void *arg) +{ +struct xe_device *xe = arg; +struct xe_tile *tile; +int id; + +if (xe->mem.vram.mapping) +iounmap (xe->mem.vram.mapping); + + xe->mem.vram.mapping =NULL ; + +for_each_tile (tile, xe, id) + tile->mem.vram.mapping =NULL ; +} +int xe_mmio_probe_vram (struct xe_device *xe) {struct xe_tile *tile;@@ -331,10 +346,20 @@ int xe_mmio_probe_vram(struct xe_device *xe)drm_info (&xe->drm,"Available VRAM: %pa, %pa\n" , &xe->mem.vram.io_start, &available_size); -return 0 ; +return devm_add_action_or_reset (xe->drm.dev, vram_fini, xe); } -void xe_mmio_probe_tiles (struct xe_device *xe) +static void tiles_fini (void *arg) +{ +struct xe_device *xe = arg; +struct xe_tile *tile; +int id; + +for_each_tile (tile, xe, id) + tile->mmio.regs =NULL ; +} + +int xe_mmio_probe_tiles (struct xe_device *xe) {size_t tile_mmio_size =SZ_16M , tile_mmio_ext_size = xe->info.tile_mmio_ext_size;u8 id, tile_count = xe->info.tile_count;@@ -385,6 +410,8 @@ void xe_mmio_probe_tiles(struct xe_device *xe) regs += tile_mmio_ext_size; } } + +return devm_add_action_or_reset (xe->drm.dev, tiles_fini, xe); }static void mmio_fini (void *arg)@@ -392,10 +419,6 @@ static void mmio_fini(void *arg)struct xe_device *xe = arg;pci_iounmap (to_pci_dev (xe->drm.dev), xe->mmio.regs); -if (xe->mem.vram.mapping) -iounmap (xe->mem.vram.mapping); - - xe->mem.vram.mapping =NULL ; xe->mmio.regs =NULL ; }drivers/gpu/drm/xe/xe_mmio.h +1
-1@@ -21,7 +21,7 @@ struct xe_device;#define LMEM_BAR 2int xe_mmio_init (struct xe_device *xe); -void xe_mmio_probe_tiles (struct xe_device *xe); +int xe_mmio_probe_tiles (struct xe_device *xe);u8 xe_mmio_read8 (struct xe_gt *gt,struct xe_reg reg);u16 xe_mmio_read16 (struct xe_gt *gt,struct xe_reg reg);
PATCH 18/20 drm/xe/display: move display fini stuff to devm
In reply to Matthew AuldMatch the i915 display handling here with calling both no_irq and noaccel when removing the device.
--- drivers/gpu/drm/xe/display/xe_display.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/xe/display/xe_display.c +6 -6
@@ -126,9 +126,9 @@ int xe_display_init_nommio(struct xe_device *xe)return drmm_add_action_or_reset (&xe->drm, xe_display_fini_nommio, xe); } -static void xe_display_fini_noirq (struct drm_device *dev,void *dummy) +static void xe_display_fini_noirq (void *arg) { -struct xe_device *xe =to_xe_device (dev); +struct xe_device *xe = arg;if (!xe->info.enable_display)return ;
@@ -163,12 +163,12 @@ int xe_display_init_noirq(struct xe_device *xe)if (err)return err; -return drmm_add_action_or_reset (&xe->drm, xe_display_fini_noirq,NULL ); +return devm_add_action_or_reset (xe->drm.dev, xe_display_fini_noirq, xe); } -static void xe_display_fini_noaccel (struct drm_device *dev,void *dummy) +static void xe_display_fini_noaccel (void *arg) { -struct xe_device *xe =to_xe_device (dev); +struct xe_device *xe = arg;if (!xe->info.enable_display)return ;
@@ -187,7 +187,7 @@ int xe_display_init_noaccel(struct xe_device *xe)if (err)return err; -return drmm_add_action_or_reset (&xe->drm, xe_display_fini_noaccel,NULL ); +return devm_add_action_or_reset (xe->drm.dev, xe_display_fini_noaccel, xe); }int xe_display_init (struct xe_device *xe)
Signature · 1 line
2.45.0
Re: [PATCH 18/20] drm/xe/display: move display fini stuff to devm
Quoted 6 lines · Matthew Auld
Match the i915 display handling here with calling both
no_irqand noaccel when removing the device.Signed-off-by Matthew Auld <[email protected]>Cc Andrzej Hajda <[email protected]>Cc Rodrigo Vivi <[email protected]>
Regards
Andrzej
Quoted 45 lines
--- drivers/gpu/drm/xe/display/xe_display.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/gpu/drm/xe/display/xe_display.c +6
-6@@ -126,9 +126,9 @@ int xe_display_init_nommio(struct xe_device *xe)return drmm_add_action_or_reset (&xe->drm, xe_display_fini_nommio, xe); } -static void xe_display_fini_noirq (struct drm_device *dev,void *dummy) +static void xe_display_fini_noirq (void *arg) { -struct xe_device *xe =to_xe_device (dev); +struct xe_device *xe = arg;if (!xe->info.enable_display)return ;@@ -163,12 +163,12 @@ int xe_display_init_noirq(struct xe_device *xe)if (err)return err; -return drmm_add_action_or_reset (&xe->drm, xe_display_fini_noirq,NULL ); +return devm_add_action_or_reset (xe->drm.dev, xe_display_fini_noirq, xe); } -static void xe_display_fini_noaccel (struct drm_device *dev,void *dummy) +static void xe_display_fini_noaccel (void *arg) { -struct xe_device *xe =to_xe_device (dev); +struct xe_device *xe = arg;if (!xe->info.enable_display)return ;@@ -187,7 +187,7 @@ int xe_display_init_noaccel(struct xe_device *xe)if (err)return err; -return drmm_add_action_or_reset (&xe->drm, xe_display_fini_noaccel,NULL ); +return devm_add_action_or_reset (xe->drm.dev, xe_display_fini_noaccel, xe); }int xe_display_init (struct xe_device *xe)
PATCH 19/20 drm/xe/display: stop calling domains_driver_remove twice
In reply to Matthew AuldUnclear why we call this twice.
--- drivers/gpu/drm/xe/display/xe_display.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/xe/display/xe_display.c +0 -1
@@ -134,7 +134,6 @@ static void xe_display_fini_noirq(void *arg)return ;intel_display_driver_remove_noirq (xe); -intel_power_domains_driver_remove (xe); }int xe_display_init_noirq (struct xe_device *xe)
Signature · 1 line
2.45.0
Re: [PATCH 19/20] drm/xe/display: stop calling domains_driver_remove twice
Quoted 1 line · Matthew Auld
Unclear why we call this twice.
Hmm, where is another call, I couldn't find one.
Andrzej
Quoted 22 lines
Signed-off-by Matthew Auld <[email protected]>Cc Andrzej Hajda <[email protected]>Cc Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/xe/display/xe_display.c | 1 - 1 file changed, 1 deletion(-)drivers/gpu/drm/xe/display/xe_display.c +0
-1@@ -134,7 +134,6 @@ static void xe_display_fini_noirq(void *arg)return ;intel_display_driver_remove_noirq (xe); -intel_power_domains_driver_remove (xe); }int
xe_display_init_noirq(struct xe_device *xe)
Re: [PATCH 19/20] drm/xe/display: stop calling domains_driver_remove twice
Quoted 4 lines · Andrzej Hajda
Quoted 1 line · Matthew Auld
Unclear why we call this twice.
Hmm, where is another call, I couldn't find one.
In intel_display_driver_remove_nogem it is already called.
Quoted 25 lines
Andrzej
Quoted 20 lines
Signed-off-by Matthew Auld <[email protected]>Cc Andrzej Hajda <[email protected]>Cc Rodrigo Vivi <[email protected]>---
drivers/gpu/drm/xe/display/xe_display.c| 1 -1 file changed, 1 deletion(-)drivers/gpu/drm/xe/display/xe_display.c +0
-1@@ -134,7 +134,6 @@ static void xe_display_fini_noirq(void *arg) return; intel_display_driver_remove_noirq(xe); - intel_power_domains_driver_remove(xe); } int xe_display_init_noirq(struct xe_device *xe)
Andrzej Hajda
Reviewed-byRe: [PATCH 19/20] drm/xe/display: stop calling domains_driver_remove twice
Quoted 7 lines · Matthew Auld
Quoted 4 lines · Andrzej Hajda
Quoted 1 line · Matthew Auld
Unclear why we call this twice.
Hmm, where is another call, I couldn't find one.
In
intel_display_driver_remove_nogemit is already called.
Apparently I have some outdated sources.
Quoted 9 lines
Quoted 9 lines
Andrzej
Quoted 4 lines
Signed-off-by Matthew Auld <[email protected]>Cc Andrzej Hajda <[email protected]>Cc Rodrigo Vivi <[email protected]>
Regards
Andrzej
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
---
drivers/gpu/drm/xe/display/xe_display.c| 1 -1 file changed, 1 deletion(-)drivers/gpu/drm/xe/display/xe_display.c +0
-1@@ -134,7 +134,6 @@ static void xe_display_fini_noirq(void *arg) return; intel_display_driver_remove_noirq(xe); - intel_power_domains_driver_remove(xe); } int xe_display_init_noirq(struct xe_device *xe)
PATCH 20/20 drm/xe/display: move device_remove over to drmm
In reply to Matthew Auldi915 display calls this when releasing the drm_device, match this also in xe by using drmm. intel_display_device_remove() is freeing purely software state for the drm_device.
--- drivers/gpu/drm/xe/display/xe_display.c | 20 ++++++++++++++++---- drivers/gpu/drm/xe/display/xe_display.h | 4 ++-- drivers/gpu/drm/xe/xe_pci.c | 4 +++- 3 files changed, 21 insertions(+), 7 deletions(-)
drivers/gpu/drm/xe/display/xe_display.c +16 -4
@@ -234,8 +234,6 @@ void xe_display_driver_remove(struct xe_device *xe)return ;intel_display_driver_remove (xe); - -intel_display_device_remove (xe); }/* IRQ-related functions */
@@ -377,17 +375,31 @@ void xe_display_pm_resume(struct xe_device *xe)intel_power_domains_enable (xe); } -void xe_display_probe (struct xe_device *xe) +static void display_device_remove (struct drm_device *dev,void *arg) +{ +struct xe_device *xe = arg; + +intel_display_device_remove (xe); +} + +int xe_display_probe (struct xe_device *xe) { +int err; +if (!xe->info.enable_display) goto no_display;intel_display_device_probe (xe); + err =drmm_add_action_or_reset (&xe->drm, display_device_remove, xe); +if (err) +return err; +if (has_display (xe)) -return ; +return 0 ; no_display: xe->info.enable_display = false;unset_display_features (xe); +return 0 ; }
drivers/gpu/drm/xe/display/xe_display.h +2 -2
@@ -18,7 +18,7 @@ void xe_display_driver_remove(struct xe_device *xe);int xe_display_create (struct xe_device *xe); -void xe_display_probe (struct xe_device *xe); +int xe_display_probe (struct xe_device *xe);int xe_display_init_nommio (struct xe_device *xe);int xe_display_init_noirq (struct xe_device *xe);
@@ -47,7 +47,7 @@ static inline void xe_display_driver_remove(struct xe_device *xe) {}static inline int xe_display_create (struct xe_device *xe) {return 0 ; } -static inline void xe_display_probe (struct xe_device *xe) { } +static inline int xe_display_probe (struct xe_device *xe) { }static inline int xe_display_init_nommio (struct xe_device *xe) {return 0 ; }static inline int xe_display_init_noirq (struct xe_device *xe) {return 0 ; }
drivers/gpu/drm/xe/xe_pci.c +3 -1
@@ -768,7 +768,9 @@ static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)if (err)return err; -xe_display_probe (xe); + err =xe_display_probe (xe); +if (err) +return err; drm_dbg(&xe->drm, "%s %s %04x:%04x dgfx:%d gfx:%s (%d.%02d) media:%s (%d.%02d) display:%s dma_m_s:%d tc:%d gscfi:%d", desc->platform_name,
Signature · 1 line
2.45.0
kernel test robot
build botRe: [PATCH 20/20] drm/xe/display: move device_remove over to drmm
kernel test robot noticed the following build warnings:
Hi Matthew,
kernel test robot noticed the following build warnings:
[auto build test WARNING on drm-xe/drm-xe-next]
[also build test WARNING on drm-misc/drm-misc-next next-20240510] [cannot apply to linus/master v6.9-rc7]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Matthew-Auld/drm-drm_managed-try-to-improve-the-drmm-DOC/20240511-061452 base: https://gitlab.freedesktop.org/drm/xe/kernel.git drm-xe-next patch link: https://lore.kernel.org/r/20240510181212.264622-42-matthew.auld%40intel.com patch subject: [PATCH 20/20] drm/xe/display: move device_remove over to drmm config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20240511/[email protected]/config) compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240511/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
In file included from drivers/gpu/drm/xe/xe_device.c:18:
>> drivers/gpu/drm/xe/display/xe_display.h:50:60: warning: non-void function does not return a value [-Wreturn-type]
50 | static inline int xe_display_probe(struct xe_device *xe) { }
| ^1 warning generated.
vim +50 drivers/gpu/drm/xe/display/xe_display.h
49
> 50 static inline int xe_display_probe(struct xe_device *xe) { }
51 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH 20/20] drm/xe/display: move device_remove over to drmm
In reply to Matthew Auldkernel test robot noticed the following build warnings:
Hi Matthew,
kernel test robot noticed the following build warnings:
[auto build test WARNING on drm-xe/drm-xe-next]
[also build test WARNING on drm-misc/drm-misc-next next-20240510] [cannot apply to linus/master v6.9-rc7]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Matthew-Auld/drm-drm_managed-try-to-improve-the-drmm-DOC/20240511-061452 base: https://gitlab.freedesktop.org/drm/xe/kernel.git drm-xe-next patch link: https://lore.kernel.org/r/20240510181212.264622-42-matthew.auld%40intel.com patch subject: [PATCH 20/20] drm/xe/display: move device_remove over to drmm config: s390-allyesconfig (https://download.01.org/0day-ci/archive/20240511/[email protected]/config) compiler: s390-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240511/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
In file included from drivers/gpu/drm/xe/xe_device.c:18:
drivers/gpu/drm/xe/display/xe_display.h: In function 'xe_display_probe':
>> drivers/gpu/drm/xe/display/xe_display.h:50:43: warning: no return statement in function returning non-void [-Wreturn-type]
50 | static inline int xe_display_probe(struct xe_device *xe) { }
| ^~~~~~~~~vim +50 drivers/gpu/drm/xe/display/xe_display.h
49
> 50 static inline int xe_display_probe(struct xe_device *xe) { }
51 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Re: [PATCH 20/20] drm/xe/display: move device_remove over to drmm
In reply to Matthew AuldQuoted 74 lines · Matthew Auld
i915 display calls this when releasing the
drm_device, match this also in xe by using drmm.intel_display_device_remove()is freeing purely software state for thedrm_device.Signed-off-by Matthew Auld <[email protected]>Cc Andrzej Hajda <[email protected]>Cc Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/xe/display/xe_display.c | 20 ++++++++++++++++---- drivers/gpu/drm/xe/display/xe_display.h | 4 ++-- drivers/gpu/drm/xe/xe_pci.c | 4 +++- 3 files changed, 21 insertions(+), 7 deletions(-)drivers/gpu/drm/xe/display/xe_display.c +16
-4@@ -234,8 +234,6 @@ void xe_display_driver_remove(struct xe_device *xe)return ;intel_display_driver_remove (xe); - -intel_display_device_remove (xe); }/* IRQ-related functions */ @@ -377,17 +375,31 @@ void xe_display_pm_resume(struct xe_device *xe)intel_power_domains_enable (xe); } -void xe_display_probe (struct xe_device *xe) +static void display_device_remove (struct drm_device *dev,void *arg) +{ +struct xe_device *xe = arg; + +intel_display_device_remove (xe); +} + +int xe_display_probe (struct xe_device *xe) { +int err; +if (!xe->info.enable_display) goto no_display;intel_display_device_probe (xe); + err =drmm_add_action_or_reset (&xe->drm, display_device_remove, xe); +if (err) +return err; +if (has_display (xe)) -return ; +return 0 ; no_display: xe->info.enable_display = false;unset_display_features (xe); +return 0 ; }drivers/gpu/drm/xe/display/xe_display.h +1
-1@@ -18,7 +18,7 @@ void xe_display_driver_remove(struct xe_device *xe);int xe_display_create (struct xe_device *xe); -void xe_display_probe (struct xe_device *xe); +int xe_display_probe (struct xe_device *xe);int xe_display_init_nommio (struct xe_device *xe);int xe_display_init_noirq (struct xe_device *xe);
drivers/gpu/drm/xe/display/xe_display.h static inline void xe_display_driver_remove(struct xe_device *xe) {} · line 50
Quoted 5 lines
drivers/gpu/drm/xe/display/xe_display.h +1
-1@@ -47,7 +47,7 @@ static inline void xe_display_driver_remove(struct xe_device *xe) {}static inline int xe_display_create (struct xe_device *xe) {return 0 ; } -static inline void xe_display_probe (struct xe_device *xe) { } +static inline int xe_display_probe (struct xe_device *xe) { }
With added "return 0"
Regards
Andrzej
Quoted 18 lines
drivers/gpu/drm/xe/display/xe_display.h +0
-0static inline int xe_display_init_nommio (struct xe_device *xe) {return 0 ; }static inline int xe_display_init_noirq (struct xe_device *xe) {return 0 ; }drivers/gpu/drm/xe/xe_pci.c +3
-1@@ -768,7 +768,9 @@ static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)if (err)return err; -xe_display_probe (xe); + err =xe_display_probe (xe); +if (err) +return err; drm_dbg(&xe->drm, "%s %s %04x:%04x dgfx:%d gfx:%s (%d.%02d) media:%s (%d.%02d) display:%s dma_m_s:%d tc:%d gscfi:%d", desc->platform_name,
Patchwork
CI✓ CI.Patch_applied: success for core_hotunplug improvements
In reply to Matthew Auld== Series Details ==
== Series Details ==
Series: core_hotunplug improvements
URL : https://patchwork.freedesktop.org/series/133462/
State : success
== Summary ==
=== Applying kernel patches on branch 'drm-tip' with base: ===
Base commit: afd593c3e9f9 drm-tip: 2024y-05m-10d-17h-57m-52s UTC integration manifest === git am output follows ===
Applying: drm/drm_managed: try to improve the drmm DOC
Applying: drm/amdgpu: don't trample pdev drvdata
Applying: drm/xe/pci: remove broken driver_release
Applying: drm/xe: covert sysfs over to devm
Applying: drm/xe/ggtt: use drm_dev_enter to mark device section
Applying: drm/xe/guc: move guc_fini over to devm
Applying: drm/xe/guc: s/guc_fini/guc_fini_hw/
Applying: drm/xe/guc_pc: move pc_fini to devm
Applying: drm/xe/guc_pc: s/pc_fini/pc_fini_hw/
Applying: drm/xe/irq: move irq_uninstall over to devm
Applying: drm/xe/device: move flr to devm
Applying: drm/xe/device: move xe_device_sanitize over to devm
Applying: drm/xe/coredump: move over to devm
Applying: drm/xe/gt: break out gt_fini into sw vs hw state
Applying: drm/xe: make gt_remove use devm
Applying: drm/xe/mmio: move mmio_fini over to devm
Applying: drm/xe: reset mmio mappings with devm
Applying: drm/xe/display: move display fini stuff to devm
Applying: drm/xe/display: stop calling domains_driver_remove twice
Applying: drm/xe/display: move device_remove over to drmm
Patchwork
CI✗ CI.checkpatch: warning for core_hotunplug improvements
In reply to Matthew Auld== Series Details ==
== Series Details ==
Series: core_hotunplug improvements
URL : https://patchwork.freedesktop.org/series/133462/
State : warning
== Summary ==
+ KERNEL=/kernel
+ git clone https://gitlab.freedesktop.org/drm/maintainer-tools mt Cloning into 'mt'...
warning: redirecting to https://gitlab.freedesktop.org/drm/maintainer-tools.git/
+ git -C mt rev-list -n1 origin/master 57b97a66dd129aea93991dc66cd10477f7a05cf8
+ cd /kernel
+ git config --global --add safe.directory /kernel
+ git log -n1
commit 6c043bff1967dd164a2eaa1cfc21a93f6db0d048
Author: Matthew Auld <[email protected]> Date: Fri May 10 19:12:33 2024 +0100
drm/xe/display: move device_remove over to drmm
i915 display calls this when releasing the drm_device, match this also in xe by using drmm. intel_display_device_remove() is freeing purely software state for the drm_device.
+ /mt/dim checkpatch afd593c3e9f9218ececa93e30c33182346295ac9 drm-intelf2cc8205fe5b drm/drm_managed: try to improve the drmm DOC5f92a217a75e drm/amdgpu: don't trample pdev drvdata0891c1b63924 drm/xe/pci: remove broken driver_release1760609797fb drm/xe: covert sysfs over to devmcdf82178ac6b drm/xe/ggtt: use drm_dev_enter to mark device section
-:16: WARNING:COMMIT_LOG_USE_LINK: Unknown link reference 'References:', use 'Link:' or 'Closes:' instead #16:
References: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/1717
total: 0 errors, 1 warnings, 0 checks, 39 lines checked26c68e93195c drm/xe/guc: move guc_fini over to devm
-:13: WARNING:COMMIT_LOG_USE_LINK: Unknown link reference 'References:', use 'Link:' or 'Closes:' instead #13:
References: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/1717
total: 0 errors, 1 warnings, 0 checks, 16 lines checkeda61bdf6e5af0 drm/xe/guc: s/guc_fini/guc_fini_hw/bbefb452533f drm/xe/guc_pc: move pc_fini to devm6eff907b65c4 drm/xe/guc_pc: s/pc_fini/pc_fini_hw/c280057f5c85 drm/xe/irq: move irq_uninstall over to devme3fc860f512d drm/xe/device: move flr to devmc1fdc710349f drm/xe/device: move xe_device_sanitize over to devm3467cf60a470 drm/xe/coredump: move over to devm
-:19: WARNING:COMMIT_LOG_USE_LINK: Unknown link reference 'References:', use 'Link:' or 'Closes:' instead #19:
References: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/1679
total: 0 errors, 1 warnings, 0 checks, 17 lines checked 36c887aba920 drm/xe/gt: break out gt_fini into sw vs hw state ed6fc1a6bccf drm/xe: make gt_remove use devmb23795ca6416 drm/xe/mmio: move mmio_fini over to devm 4c4b9e75a48c drm/xe: reset mmio mappings with devm 7389922c5733 drm/xe/display: move display fini stuff to devm d013035c43ba drm/xe/display: stop calling domains_driver_remove twice 6c043bff1967 drm/xe/display: move device_remove over to drmm
Patchwork
CI✗ CI.KUnit: failure for core_hotunplug improvements
In reply to Matthew Auld== Series Details ==
== Series Details ==
Series: core_hotunplug improvements
URL : https://patchwork.freedesktop.org/series/133462/
State : failure
== Summary ==
+ trap cleanup EXIT
+ /kernel/tools/testing/kunit/kunit.py run --kunitconfig /kernel/drivers/gpu/drm/xe/.kunitconfig ERROR:root:../arch/x86/um/user-offsets.c:17:6: warning: no previous prototype for ‘foo’ [-Wmissing-prototypes] 17 | void foo(void)
| ^~~
In file included from ../arch/um/kernel/asm-offsets.c:1:../arch/x86/um/shared/sysdep/kernel-offsets.h:9:6: warning: no previous prototype for ‘foo’ [-Wmissing-prototypes]
9 | void foo(void)
| ^~~../arch/x86/um/bugs_64.c:9:6: warning: no previous prototype for ‘arch_check_bugs’ [-Wmissing-prototypes]
9 | void arch_check_bugs(void)
| ^~~~~~~~~~~~~~~../arch/x86/um/bugs_64.c:13:6: warning: no previous prototype for ‘arch_examine_signal’ [-Wmissing-prototypes]
13 | void arch_examine_signal(int sig, struct uml_pt_regs *regs)
| ^~~~~~~~~~~~~~~~~~~
../arch/x86/um/fault.c:18:5: warning: no previous prototype for ‘arch_fixup’ [-Wmissing-prototypes]
18 | int arch_fixup(unsigned long address, struct uml_pt_regs *regs)
| ^~~~~~~~~~../arch/x86/um/os-Linux/mcontext.c:7:6: warning: no previous prototype for ‘get_regs_from_mc’ [-Wmissing-prototypes]
7 | void get_regs_from_mc(struct uml_pt_regs *regs, mcontext_t *mc)
| ^~~~~~~~~~~~~~~~../arch/x86/um/os-Linux/registers.c:146:15: warning: no previous prototype for ‘get_thread_reg’ [-Wmissing-prototypes]
146 | unsigned long get_thread_reg(int reg, jmp_buf *buf)
| ^~~~~~~~~~~~~~
../arch/x86/um/vdso/um_vdso.c:16:5: warning: no previous prototype for ‘__vdso_clock_gettime’ [-Wmissing-prototypes]
16 | int __vdso_clock_gettime(clockid_t clock, struct __kernel_old_timespec *ts)
| ^~~~~~~~~~~~~~~~~~~~
../arch/x86/um/vdso/um_vdso.c:30:5: warning: no previous prototype for ‘__vdso_gettimeofday’ [-Wmissing-prototypes]
30 | int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz)
| ^~~~~~~~~~~~~~~~~~~
../arch/x86/um/vdso/um_vdso.c:44:21: warning: no previous prototype for ‘__vdso_time’ [-Wmissing-prototypes]
44 | __kernel_old_time_t __vdso_time(__kernel_old_time_t *t)
| ^~~~~~~~~~~
../arch/x86/um/vdso/um_vdso.c:57:1: warning: no previous prototype for ‘__vdso_getcpu’ [-Wmissing-prototypes]
57 | __vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused)
| ^~~~~~~~~~~~~
../arch/um/os-Linux/skas/process.c:107:6: warning: no previous prototype for ‘wait_stub_done’ [-Wmissing-prototypes]
107 | void wait_stub_done(int pid)
| ^~~~~~~~~~~~~~
../arch/um/os-Linux/skas/process.c:683:6: warning: no previous prototype for ‘__switch_mm’ [-Wmissing-prototypes]
683 | void __switch_mm(struct mm_id *mm_idp)
| ^~~~~~~~~~~
../arch/um/os-Linux/main.c:187:7: warning: no previous prototype for ‘__wrap_malloc’ [-Wmissing-prototypes]
187 | void *__wrap_malloc(int size)
| ^~~~~~~~~~~~~
../arch/um/os-Linux/main.c:208:7: warning: no previous prototype for ‘__wrap_calloc’ [-Wmissing-prototypes]
208 | void *__wrap_calloc(int n, int size)
| ^~~~~~~~~~~~~
../arch/um/os-Linux/main.c:222:6: warning: no previous prototype for ‘__wrap_free’ [-Wmissing-prototypes]
222 | void __wrap_free(void *ptr)
| ^~~~~~~~~~~
../arch/um/os-Linux/mem.c:28:6: warning: no previous prototype for ‘kasan_map_memory’ [-Wmissing-prototypes]
28 | void kasan_map_memory(void *start, size_t len)
| ^~~~~~~~~~~~~~~~
../arch/um/os-Linux/mem.c:212:13: warning: no previous prototype for ‘check_tmpexec’ [-Wmissing-prototypes]
212 | void __init check_tmpexec(void)
| ^~~~~~~~~~~~~
../arch/um/kernel/skas/process.c:36:12: warning: no previous prototype for ‘start_uml’ [-Wmissing-prototypes]
36 | int __init start_uml(void)
| ^~~~~~~~~
../arch/x86/um/ptrace_64.c:111:5: warning: no previous prototype for ‘poke_user’ [-Wmissing-prototypes]
111 | int poke_user(struct task_struct *child, long addr, long data)
| ^~~~~~~~~
../arch/x86/um/ptrace_64.c:171:5: warning: no previous prototype for ‘peek_user’ [-Wmissing-prototypes]
171 | int peek_user(struct task_struct *child, long addr, long data)
| ^~~~~~~~~
../arch/x86/um/signal.c:560:6: warning: no previous prototype for ‘sys_rt_sigreturn’ [-Wmissing-prototypes]
560 | long sys_rt_sigreturn(void)
| ^~~~~~~~~~~~~~~~
../arch/um/kernel/skas/mmu.c:17:5: warning: no previous prototype for ‘init_new_context’ [-Wmissing-prototypes]
17 | int init_new_context(struct task_struct *task, struct mm_struct *mm)
| ^~~~~~~~~~~~~~~~
../arch/um/kernel/skas/mmu.c:60:6: warning: no previous prototype for ‘destroy_context’ [-Wmissing-prototypes]
60 | void destroy_context(struct mm_struct *mm)
| ^~~~~~~~~~~~~~~
../arch/um/os-Linux/signal.c:75:6: warning: no previous prototype for ‘sig_handler’ [-Wmissing-prototypes]
75 | void sig_handler(int sig, struct siginfo *si, mcontext_t *mc)
| ^~~~~~~~~~~
../arch/um/os-Linux/signal.c:111:6: warning: no previous prototype for ‘timer_alarm_handler’ [-Wmissing-prototypes]
111 | void timer_alarm_handler(int sig, struct siginfo *unused_si, mcontext_t *mc)
| ^~~~~~~~~~~~~~~~~~~
../arch/um/os-Linux/start_up.c:301:12: warning: no previous prototype for ‘parse_iomem’ [-Wmissing-prototypes]
301 | int __init parse_iomem(char *str, int *add)
| ^~~~~~~~~~~
../arch/um/kernel/mem.c:202:8: warning: no previous prototype for ‘pgd_alloc’ [-Wmissing-prototypes]
202 | pgd_t *pgd_alloc(struct mm_struct *mm)
| ^~~~~~~~~
../arch/um/kernel/mem.c:215:7: warning: no previous prototype for ‘uml_kmalloc’ [-Wmissing-prototypes]
215 | void *uml_kmalloc(int size, int flags)
| ^~~~~~~~~~~
../arch/um/kernel/process.c:51:5: warning: no previous prototype for ‘pid_to_processor_id’ [-Wmissing-prototypes]
51 | int pid_to_processor_id(int pid)
| ^~~~~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:87:7: warning: no previous prototype for ‘__switch_to’ [-Wmissing-prototypes]
87 | void *__switch_to(struct task_struct *from, struct task_struct *to)
| ^~~~~~~~~~~
../arch/um/kernel/process.c:140:6: warning: no previous prototype for ‘fork_handler’ [-Wmissing-prototypes]
140 | void fork_handler(void)
| ^~~~~~~~~~~~
../arch/um/kernel/process.c:217:6: warning: no previous prototype for ‘arch_cpu_idle’ [-Wmissing-prototypes]
217 | void arch_cpu_idle(void)
| ^~~~~~~~~~~~~
../arch/um/kernel/process.c:253:5: warning: no previous prototype for ‘copy_to_user_proc’ [-Wmissing-prototypes]
253 | int copy_to_user_proc(void __user *to, void *from, int size)
| ^~~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:263:5: warning: no previous prototype for ‘clear_user_proc’ [-Wmissing-prototypes]
263 | int clear_user_proc(void __user *buf, int size)
| ^~~~~~~~~~~~~~~
../arch/um/kernel/process.c:271:6: warning: no previous prototype for ‘set_using_sysemu’ [-Wmissing-prototypes]
271 | void set_using_sysemu(int value)
| ^~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:278:5: warning: no previous prototype for ‘get_using_sysemu’ [-Wmissing-prototypes]
278 | int get_using_sysemu(void)
| ^~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:316:12: warning: no previous prototype for ‘make_proc_sysemu’ [-Wmissing-prototypes]
316 | int __init make_proc_sysemu(void)
| ^~~~~~~~~~~~~~~~
../arch/um/kernel/process.c:348:15: warning: no previous prototype for ‘arch_align_stack’ [-Wmissing-prototypes]
348 | unsigned long arch_align_stack(unsigned long sp)
| ^~~~~~~~~~~~~~~~
../arch/um/kernel/reboot.c:45:6: warning: no previous prototype for ‘machine_restart’ [-Wmissing-prototypes]
45 | void machine_restart(char * __unused)
| ^~~~~~~~~~~~~~~
../arch/um/kernel/reboot.c:51:6: warning: no previous prototype for ‘machine_power_off’ [-Wmissing-prototypes]
51 | void machine_power_off(void)
| ^~~~~~~~~~~~~~~~~
../arch/um/kernel/reboot.c:57:6: warning: no previous prototype for ‘machine_halt’ [-Wmissing-prototypes]
57 | void machine_halt(void)
| ^~~~~~~~~~~~
../arch/x86/um/syscalls_64.c:48:6: warning: no previous prototype for ‘arch_switch_to’ [-Wmissing-prototypes]
48 | void arch_switch_to(struct task_struct *to)
| ^~~~~~~~~~~~~~
../arch/um/kernel/tlb.c:579:6: warning: no previous prototype for ‘flush_tlb_mm_range’ [-Wmissing-prototypes]
579 | void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start,
| ^~~~~~~~~~~~~~~~~~
../arch/um/kernel/tlb.c:594:6: warning: no previous prototype for ‘force_flush_all’ [-Wmissing-prototypes]
594 | void force_flush_all(void)
| ^~~~~~~~~~~~~~~
../arch/um/kernel/um_arch.c:408:19: warning: no previous prototype for ‘read_initrd’ [-Wmissing-prototypes]
408 | int __init __weak read_initrd(void)
| ^~~~~~~~~~~
../arch/um/kernel/um_arch.c:461:7: warning: no previous prototype for ‘text_poke’ [-Wmissing-prototypes]
461 | void *text_poke(void *addr, const void *opcode, size_t len)
| ^~~~~~~~~
../arch/um/kernel/um_arch.c:473:6: warning: no previous prototype for ‘text_poke_sync’ [-Wmissing-prototypes]
473 | void text_poke_sync(void)
| ^~~~~~~~~~~~~~
../arch/um/kernel/kmsg_dump.c:60:12: warning: no previous prototype for ‘kmsg_dumper_stdout_init’ [-Wmissing-prototypes]
60 | int __init kmsg_dumper_stdout_init(void)
| ^~~~~~~~~~~~~~~~~~~~~~~In file included from ../drivers/gpu/drm/xe/xe_device.c:19:../drivers/gpu/drm/xe/display/xe_display.h: In function ‘xe_display_probe’:../drivers/gpu/drm/xe/display/xe_display.h:50:43: error: no return statement in function returning non-void [-Werror=return-type]
50 | static inline int xe_display_probe(struct xe_device *xe) { }
| ^~~~~~~~~
cc1: some warnings being treated as errors
make[7]: *** [../scripts/Makefile.build:244: drivers/gpu/drm/xe/xe_device.o] Error 1
make[7]: *** Waiting for unfinished jobs....
make[6]: *** [../scripts/Makefile.build:485: drivers/gpu/drm/xe] Error 2
make[6]: *** Waiting for unfinished jobs....
make[5]: *** [../scripts/Makefile.build:485: drivers/gpu/drm] Error 2
make[4]: *** [../scripts/Makefile.build:485: drivers/gpu] Error 2
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [../scripts/Makefile.build:485: drivers] Error 2
make[3]: *** Waiting for unfinished jobs....../lib/iomap.c:156:5: warning: no previous prototype for ‘ioread64_lo_hi’ [-Wmissing-prototypes]
156 | u64 ioread64_lo_hi(const void __iomem *addr)
| ^~~~~~~~~~~~~~
../lib/iomap.c:163:5: warning: no previous prototype for ‘ioread64_hi_lo’ [-Wmissing-prototypes]
163 | u64 ioread64_hi_lo(const void __iomem *addr)
| ^~~~~~~~~~~~~~
../lib/iomap.c:170:5: warning: no previous prototype for ‘ioread64be_lo_hi’ [-Wmissing-prototypes]
170 | u64 ioread64be_lo_hi(const void __iomem *addr)
| ^~~~~~~~~~~~~~~~
../lib/iomap.c:178:5: warning: no previous prototype for ‘ioread64be_hi_lo’ [-Wmissing-prototypes]
178 | u64 ioread64be_hi_lo(const void __iomem *addr)
| ^~~~~~~~~~~~~~~~
../lib/iomap.c:264:6: warning: no previous prototype for ‘iowrite64_lo_hi’ [-Wmissing-prototypes]
264 | void iowrite64_lo_hi(u64 val, void __iomem *addr)
| ^~~~~~~~~~~~~~~
../lib/iomap.c:272:6: warning: no previous prototype for ‘iowrite64_hi_lo’ [-Wmissing-prototypes]
272 | void iowrite64_hi_lo(u64 val, void __iomem *addr)
| ^~~~~~~~~~~~~~~
../lib/iomap.c:280:6: warning: no previous prototype for ‘iowrite64be_lo_hi’ [-Wmissing-prototypes]
280 | void iowrite64be_lo_hi(u64 val, void __iomem *addr)
| ^~~~~~~~~~~~~~~~~
../lib/iomap.c:288:6: warning: no previous prototype for ‘iowrite64be_hi_lo’ [-Wmissing-prototypes]
288 | void iowrite64be_hi_lo(u64 val, void __iomem *addr)
| ^~~~~~~~~~~~~~~~~make[2]: *** [/kernel/Makefile:1919: .] Error 2 make[1]: *** [/kernel/Makefile:240: __sub-make] Error 2
make: *** [Makefile:240: __sub-make] Error 2
[18:18:06] Configuring KUnit Kernel ...
Generating .config ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig [18:18:11] Building KUnit Kernel ... Populating config with: $ make ARCH=um O=.kunit olddefconfig Building with: $ make ARCH=um O=.kunit --jobs=48 + cleanup ++ stat -c %u:%g /kernel + chown -R 1003:1003 /kernel