Re: [RFC PATCH v8 01/10] ras: scrub: Add scrub subsystem
From: Dan Williams
Date: Thu May 09 2024 - 17:22:15 EST
Borislav Petkov wrote:
> On Thu, May 09, 2024 at 05:52:18PM +0200, Borislav Petkov wrote:
> > Are you arguing for the nonsensical "it should load" case because it
> > is simply easier this way? How hard is that "jump through hoops" thing
> > anyway?
>
> Let's see: the following patches add something called
> GET_SUPPORTED_FEATURES which is used to detect whether the system has
> patrol scrub functionality etc.
>
> Then there's ras2_acpi_init() which checks for a RAS2 ACPI table.
>
> Are you saying that checking for those two things in the init function
> is jumping through hoops?
Wait, this discussion has gone off the rails.
Recall that there are 461 usages of module_pci_driver() in the kernel.
Every one of those arranges for just registering a PCI driver when the
module is loaded regardless of whether any devices that driver cares
about are present.
Consider the case of the PCI subsystem that allows dynamically updating
the device ids that a driver attaches. I.e.
echo $id > /sys/bus/pci/drivers/$driver/new_id
..the fundamentally does not work if the module unloads itself and the
driver(s) it registers when the PCI bus core finds no devices to attach
at runtime.
The mitigation for keeping unneeded modules unloaded is that udev does
not autoload modules unless a PCI bus udev event matches a module's
published PCI device table.
Don't want to waste module memory? Don't load the module.