Kernel KVM virtualization development
 help / color / mirror / Atom feed
* [PATCH] vfio/pci: make nointxmask and disable_idle_d3 module params read-only
@ 2026-06-10  5:47 Guixin Liu
  2026-06-11 18:32 ` Alex Williamson
  0 siblings, 1 reply; 2+ messages in thread
From: Guixin Liu @ 2026-06-10  5:47 UTC (permalink / raw)
  To: Alex Williamson, Jason Gunthorpe, Kevin Tian, Pranjal Shrivastava,
	Brett Creeley, Leon Romanovsky
  Cc: kvm, xlpang, oliver.yang

The nointxmask and disable_idle_d3 module parameters are registered with
S_IWUSR, exposing a writable node under /sys/module/vfio_pci/parameters/.
However, writing to them at runtime has no effect on driver behaviour:

 - Both values are copied into vfio-pci-core's own static variables via
   vfio_pci_core_set_params(), which is only called once at module init
   time.  A later write to the vfio_pci front-end variable is never
   propagated to the core.

 - disable_idle_d3 additionally gates paired runtime PM get/put calls
   across the probe/remove (register/unregister) and open/close
   (enable/disable) life cycles.  Changing it at runtime would tear
   these pairs apart and leak or underflow the runtime PM usage counter.

 - nointxmask is latched into per-device state (vdev->nointx /
   vdev->pci_2_3) at device open time, so a later change can only affect
   newly opened devices and yields inconsistent behaviour.

These parameters are effectively load-time constants.  Drop the write
permission so they match disable_vga, which is already read-only, and to
stop misleading users into thinking they are runtime tunable.

Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
---
 drivers/vfio/pci/vfio_pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
index 0c771064c0b8..b72f168feb3c 100644
--- a/drivers/vfio/pci/vfio_pci.c
+++ b/drivers/vfio/pci/vfio_pci.c
@@ -35,7 +35,7 @@ module_param_string(ids, ids, sizeof(ids), 0);
 MODULE_PARM_DESC(ids, "Initial PCI IDs to add to the vfio driver, format is \"vendor:device[:subvendor[:subdevice[:class[:class_mask]]]]\" and multiple comma separated entries can be specified");
 
 static bool nointxmask;
-module_param_named(nointxmask, nointxmask, bool, S_IRUGO | S_IWUSR);
+module_param_named(nointxmask, nointxmask, bool, 0444);
 MODULE_PARM_DESC(nointxmask,
 		  "Disable support for PCI 2.3 style INTx masking.  If this resolves problems for specific devices, report lspci -vvvxxx to linux-pci@vger.kernel.org so the device can be fixed automatically via the broken_intx_masking flag.");
 
@@ -46,7 +46,7 @@ MODULE_PARM_DESC(disable_vga, "Disable VGA resource access through vfio-pci");
 #endif
 
 static bool disable_idle_d3;
-module_param(disable_idle_d3, bool, S_IRUGO | S_IWUSR);
+module_param(disable_idle_d3, bool, 0444);
 MODULE_PARM_DESC(disable_idle_d3,
 		 "Disable using the PCI D3 low power state for idle, unused devices");
 
-- 
2.43.7


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-11 18:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-10  5:47 [PATCH] vfio/pci: make nointxmask and disable_idle_d3 module params read-only Guixin Liu
2026-06-11 18:32 ` Alex Williamson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox