Skip to contentSkip to conversation

vfio: unhide vdev->debug_root

PATCH In review Arnd Bergmann 2 participants 2 messages Mar 27 – Mar 30

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vfio: unhide vdev->debug_root

From: Arnd Bergmann <[email protected]>

When debugfs is disabled, the hisilicon driver now fails to build:

drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c: In function 'hisi_acc_vfio_debug_init':
drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c:1671:62: error: 'struct vfio_device' has no member named 'debug_root'
1671 | vfio_dev_migration = debugfs_lookup("migration", vdev->debug_root);
| ^~

The driver otherwise relies on dead-code elimination, but this reference fails. The single struct member is not going to make much of a difference for memory consumption, so just keep this visible unconditionally.

----
This seems to be a new build failure, but I could not pinpoint which commit caused it, as both the #ifdef and the the use were introduced a while ago.

---
 include/linux/vfio.h | 2 --
 1 file changed, 2 deletions(-)
include/linux/vfio.h +0 -2
index 50b474334a19..31b826efba00 100644
@@ -74,13 +74,11 @@ struct vfio_device {
 	u8 iommufd_attached:1;
 #endif
 	u8 cdev_opened:1;
-#ifdef CONFIG_DEBUG_FS
 	/*
 	 * debug_root is a static property of the vfio_device
 	 * which must be set prior to registering the vfio_device.
 	 */
 	struct dentry *debug_root;
-#endif
 };
 
 /**
Signature · 1 line
2.39.5
maintainer
#1 lore raw
Quoted 13 lines · On Fri, 27 Mar 2026 17:55:08 +0100 Arnd Bergmann <[email protected]> wrote:

From: Arnd Bergmann <[email protected]>

When debugfs is disabled, the hisilicon driver now fails to build:

drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c: In function 'hisi_acc_vfio_debug_init':
drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c:1671:62: error: 'struct vfio_device' has no member named 'debug_root'
1671 | vfio_dev_migration = debugfs_lookup("migration", vdev->debug_root);
| ^~

The driver otherwise relies on dead-code elimination, but this reference fails. The single struct member is not going to make much of a difference for memory consumption, so just keep this visible unconditionally.

Quoted 6 lines

----
This seems to be a new build failure, but I could not pinpoint which commit caused it, as both the #ifdef and the the use were introduced a while ago.
---

They were introduced some time apart, but I'd attribute it to the use here in the hisi_acc driver, ie. Fixes: b398f91779b8 ("hisi_acc_vfio_pci: register debugfs for hisilicon migration driver"). The series introducing debug_root had proper stubs to avoid references.

I'll add that on commit, otherwise LGTM. Thanks,

Alex

Quoted 21 lines
 include/linux/vfio.h | 2 --
 1 file changed, 2 deletions(-)
include/linux/vfio.h +0 -2
index 50b474334a19..31b826efba00 100644
@@ -74,13 +74,11 @@ struct vfio_device {
 	u8 iommufd_attached:1;
 #endif
 	u8 cdev_opened:1;
-#ifdef CONFIG_DEBUG_FS
 	/*
 	 * debug_root is a static property of the vfio_device
 	 * which must be set prior to registering the vfio_device.
 	 */
 	struct dentry *debug_root;
-#endif
 };
 
 /**