Re: [PATCH v3 1/8] driver core: bus: add irq_get_affinity callback to bus_type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 13, 2024 at 10:16:32AM +0000, John Garry wrote:
> On 12/11/2024 13:26, Daniel Wagner wrote:
> > Introducing a callback in struct bus_type so that a subsystem
> > can hook up the getters directly. This approach avoids exposing
> > random getters in any subsystems APIs.
> > 
> > Acked-by: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
> > Signed-off-by: Daniel Wagner <wagi@xxxxxxxxxx>
> > ---
> >   include/linux/device/bus.h | 3 +++
> >   1 file changed, 3 insertions(+)
> > 
> > diff --git a/include/linux/device/bus.h b/include/linux/device/bus.h
> > index cdc4757217f9bb4b36b5c3b8a48bab45737e44c5..b18658bce2c3819fc1cbeb38fb98391d56ec3317 100644
> > --- a/include/linux/device/bus.h
> > +++ b/include/linux/device/bus.h
> > @@ -48,6 +48,7 @@ struct fwnode_handle;
> >    *		will never get called until they do.
> >    * @remove:	Called when a device removed from this bus.
> 
> My impression is that this would be better suited to "struct device_driver",
> but I assume that there is a good reason to add to "struct bus_type".

I think the main reason to put it here is that most of the drivers are
happy with the getter on bus level and don't need special treatment. We
don't have to touch all the drivers to hookup a common getter, nor do we
have to install a default handler when the driver doesn't specify one.
Having the callback in struct bus_driver avoids this. Though Christoph
suggested it, so I can only guess.

But you bring up a good point, if we had also an irq_get_affinity
callback in struct device_driver it would be possible for the
hisi_sas v2 driver to provide a getter and blk_mq_hctx_map_queues could
do:

	for (queue = 0; queue < qmap->nr_queues; queue++) {
		if (dev->driver->irq_get_affinity)
			mask = dev->driver->irq_get_affinity;
		else if (dev->bus->irq_get_affinity)
			mask = dev->bus->irq_get_affinity(dev, queue + offset);
		if (!mask)
			goto fallback;

		for_each_cpu(cpu, mask)
			qmap->mq_map[cpu] = qmap->queue_offset + queue;
	}

and with this in place the open coded version in hisi_sas v2 can also be
replaced. If no one objects, I go ahead and add the callback to struct
device_driver.




[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux