From: Raag Jadav <raag.jadav@intel.com>
To: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Cc: "Matthew Brost" <matthew.brost@intel.com>,
"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
brgl@kernel.org, intel-xe@lists.freedesktop.org,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
"Heikki Krogerus" <heikki.krogerus@linux.intel.com>
Subject: Re: [PATCH] drm/xe/i2c: use device_create_managed_software_node()
Date: Fri, 9 Oct 2026 08:43:22 +0200 [thread overview]
Message-ID: <asiNCndYPAlM1p5u@black.igk.intel.com> (raw)
In-Reply-To: <20260922-xe-i2c-reapply-swnode-unreg-v1-1-1bdda5d44701@oss.qualcomm.com>
On Tue, Sep 22, 2026 at 04:25:55PM +0200, Bartosz Golaszewski wrote:
> This driver intentionally uses the fine-grained approach to creating
> platform devices. It assigns a software node as the primary firmware
> node of the device it creates. Ahead of improving the reference counting
> of platform device software nodes, switch to using
> device_create_managed_software_node(). This way, we create a dynamic
> software node whose life-time is tied to the device to which it's
> assigned.
>
> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
> ---
> This patch exists in mainline as commit fc90ce2d ("drm/xe/i2c: use
> device_create_managed_software_node()") but the code got silently
> overwritten by merge commit cc467969646b ("Merge drm/drm-next into
> drm-xe-next"). It should be reapplied.
Seeing this on drm-xe-next during driver unbind.
[ 8042.309896] Oops: general protection fault, probably for non-canonical address 0x6b6b6b6b6b6b6b73: 0000 [#1] SMP NOPTI
[ 8042.316397] [Poison overwritten] 0xff110001b3a7e838-0xff110001b3a7e847 @offset=26680. First byte 0x6a instead of 0x6b
[ 8042.316513] =============================================================================
[ 8042.316534] BUG kmalloc-512 (Tainted: G S U E ): Object corrupt
[ 8042.316551] -----------------------------------------------------------------------------
[ 8042.316572] Allocated in swnode_register+0x35/0x260 age=42577 cpu=0 pid=381
[ 8042.316598] swnode_register+0x35/0x260
[ 8042.316612] fwnode_create_software_node+0xbe/0x180
[ 8042.316628] device_create_managed_software_node+0x82/0xf0
[ 8042.316642] xe_i2c_probe+0x1b8/0x260 [xe]
[ 8042.316939] xe_device_probe+0x617/0x1000 [xe]
[ 8042.317109] xe_pci_probe+0x539/0xb40 [xe]
[ 8042.317310] local_pci_probe+0x47/0xa0
[ 8042.317322] local_pci_probe_callback+0x1a/0x30
[ 8042.317334] process_one_work+0x2ad/0x880
[ 8042.317347] worker_thread+0x204/0x3e0
[ 8042.317357] kthread+0x113/0x150
[ 8042.317367] ret_from_fork+0x2dd/0x3c0
[ 8042.317379] ret_from_fork_asm+0x1a/0x30
[ 8042.317391] Freed in software_node_release+0xa0/0x100 age=2 cpu=13 pid=6676
[ 8042.317409] kfree+0x227/0x4c0
[ 8042.317418] software_node_release+0xa0/0x100
[ 8042.317429] kobject_put+0x8c/0x220
[ 8042.317440] software_node_notify_remove+0xa5/0xe0
[ 8042.317450] device_del+0x17b/0x3b0
[ 8042.317461] platform_device_del.part.0+0x18/0x90
[ 8042.317475] platform_device_unregister+0x24/0x40
[ 8042.317486] xe_i2c_remove+0x84/0xa0 [xe]
[ 8042.317720] devm_action_release+0x1a/0x20
[ 8042.317729] release_nodes+0x3d/0x130
[ 8042.317738] devres_release_all+0x96/0xd0
[ 8042.317749] device_unbind_cleanup+0x2a/0xa0
[ 8042.317763] device_release_driver_internal+0x21e/0x260
[ 8042.317775] device_driver_detach+0x18/0x20
[ 8042.317785] unbind_store+0xa8/0xb0
[ 8042.317794] drv_attr_store+0x28/0x40
[ 8042.317804] Slab 0xffd4000006ce9e00 objects=21 used=17 fp=0xff110001b3a7dc00 flags=0x17ffffc0000240(workingset|head|node=0|zone=2|lastcpupid=0x1fffff)
[ 8042.317830] Object 0xff110001b3a7e800 @offset=26624 fp=0xff110001b3a7dc00
Raag
> ---
> drivers/gpu/drm/xe/xe_i2c.c | 22 ++++++++--------------
> drivers/gpu/drm/xe/xe_i2c.h | 1 -
> 2 files changed, 8 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_i2c.c b/drivers/gpu/drm/xe/xe_i2c.c
> index 51ca9fb73b708317c5dd8613d0ba060b8dc2028e..f4f3819882897f7f19a7bd3043a936e3c7eec553 100644
> --- a/drivers/gpu/drm/xe/xe_i2c.c
> +++ b/drivers/gpu/drm/xe/xe_i2c.c
> @@ -111,14 +111,9 @@ static int xe_i2c_register_adapter(struct xe_i2c *i2c)
> {
> struct pci_dev *pci = to_pci_dev(i2c->drm_dev);
> struct platform_device *pdev;
> - struct fwnode_handle *fwnode;
> int ret;
> u32 id;
>
> - fwnode = fwnode_create_software_node(xe_i2c_adapter_properties, NULL);
> - if (IS_ERR(fwnode))
> - return PTR_ERR(fwnode);
> -
> id = (pci_domain_nr(pci->bus) << 16) | pci_dev_id(pci);
>
> /*
> @@ -128,14 +123,16 @@ static int xe_i2c_register_adapter(struct xe_i2c *i2c)
> * platform_device_register_full() is done.
> */
> pdev = platform_device_alloc(adapter_name, id);
> - if (!pdev) {
> - ret = -ENOMEM;
> - goto err_fwnode_remove;
> - }
> + if (!pdev)
> + return -ENOMEM;
> +
> + ret = device_create_managed_software_node(&pdev->dev,
> + xe_i2c_adapter_properties,
> + NULL);
> + if (ret)
> + goto err_pdev_put;
>
> pdev->dev.parent = i2c->drm_dev;
> - pdev->dev.fwnode = fwnode;
> - i2c->adapter_node = fwnode;
> i2c->pdev = pdev;
>
> ret = platform_device_add(pdev);
> @@ -146,8 +143,6 @@ static int xe_i2c_register_adapter(struct xe_i2c *i2c)
>
> err_pdev_put:
> platform_device_put(pdev);
> -err_fwnode_remove:
> - fwnode_remove_software_node(fwnode);
>
> return ret;
> }
> @@ -155,7 +150,6 @@ static int xe_i2c_register_adapter(struct xe_i2c *i2c)
> static void xe_i2c_unregister_adapter(struct xe_i2c *i2c)
> {
> platform_device_unregister(i2c->pdev);
> - fwnode_remove_software_node(i2c->adapter_node);
> }
>
> /**
> diff --git a/drivers/gpu/drm/xe/xe_i2c.h b/drivers/gpu/drm/xe/xe_i2c.h
> index d63adacfefe71b3ae695987f104f978959a7e2c5..5969054a6b6b3f184857defd4ad3f6489f05aca0 100644
> --- a/drivers/gpu/drm/xe/xe_i2c.h
> +++ b/drivers/gpu/drm/xe/xe_i2c.h
> @@ -33,7 +33,6 @@ struct xe_i2c_endpoint {
> };
>
> struct xe_i2c {
> - struct fwnode_handle *adapter_node;
> struct platform_device *pdev;
> struct i2c_adapter *adapter;
> struct i2c_client *client[XE_I2C_MAX_CLIENTS];
>
> ---
> base-commit: 5c4d4169604b335c38bbc79bc1fc03042981fc6f
> change-id: 20260922-xe-i2c-reapply-swnode-unreg-8e18b542549f
>
> Best regards,
> --
> Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
>
next prev parent reply other threads:[~2026-10-09 6:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 14:25 [PATCH] drm/xe/i2c: use device_create_managed_software_node() Bartosz Golaszewski
2026-09-22 14:34 ` ✓ CI.KUnit: success for " Patchwork
2026-09-22 16:14 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-23 2:05 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-09-26 1:00 ` [PATCH] " Rodrigo Vivi
2026-10-09 6:43 ` Raag Jadav [this message]
2026-10-09 16:47 ` Vivekanandan, Balasubramani
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=asiNCndYPAlM1p5u@black.igk.intel.com \
--to=raag.jadav@intel.com \
--cc=airlied@gmail.com \
--cc=bartosz.golaszewski@oss.qualcomm.com \
--cc=brgl@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew.brost@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=simona@ffwll.ch \
--cc=thomas.hellstrom@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox