[PATCH v11 3/7] genirq: Add mechanism to multiplex a single HW IPI

Marc Zyngier maz at kernel.org
Sat Nov 26 06:28:14 PST 2022


On Sat, 26 Nov 2022 13:31:46 +0000,
Anup Patel <apatel at ventanamicro.com> wrote:
> 
> On Sat, Nov 26, 2022 at 6:12 PM Marc Zyngier <maz at kernel.org> wrote:
> >
> > On Mon, 14 Nov 2022 09:39:00 +0000,
> > Anup Patel <apatel at ventanamicro.com> wrote:
> > >
> > > +struct ipi_mux_control {
> > > +     void                            *data;
> > > +     unsigned int                    nr;
> >
> > Honestly, I think we can get rid of this. The number of IPIs Linux
> > uses is pretty small, and assuming a huge value (like 32) would be
> > enough. It would save looking up this value on each IPI handling.
> 
> I had kept in-case some driver wanted to create fewer (< 32)
> muxed IPIs.

I'm fine with being able to specifying the max, but I'm not sure there
is a need to keep track of it any further. Certainly, the overhead of
loading this value on each IPI could be removed. On most architecture,
for_each_set_bit() and co and better optimised with a fixed number of
bits.

> > > +static const struct irq_chip ipi_mux_chip = {
> > > +     .name           = "IPI Mux",
> > > +     .irq_mask       = ipi_mux_mask,
> > > +     .irq_unmask     = ipi_mux_unmask,
> > > +     .ipi_send_mask  = ipi_mux_send_mask,
> > > +};
> >
> > I really think this could either be supplied by the irqchip, or
> > somehow patched to avoid the pointless imux->ops->ipi_mux_send
> > indirection. Pointer chasing hurts.
> 
> Once we remove ipi_mux_pre/post_handle() callbacks, the
> "ops" will be pointless and we will be able to remove one level
> of indirection here.
> 
> We certainly need a mux irqchip to implement the
> mask/unmask semantics for muxed IPIs.

I'm not disputing that last point.

> > > +/**
> > > + * ipi_mux_create - Create virtual IPIs multiplexed on top of a single
> > > + * parent IPI.
> > > + * @parent_virq:     virq of the parent per-CPU IRQ
> > > + * @nr_ipi:          number of virtual IPIs to create. This should
> > > + *                   be <= BITS_PER_TYPE(int)
> > > + * @ops:             multiplexing operations for the parent IPI
> > > + * @data:            opaque data used by the multiplexing operations
> >
> > What is the use for data? If anything, that data should be passed via
> > the mux interrupt. But the whole point of this is to make the mux
> > invisible. So this whole 'data' business is a mystery to me.
> 
> This is added only to pass back driver data in ipi_mux_send().

Again, what is the purpose of such data? If you need per-interrupt
data, this should be provided by the requester of the interrupt.

	M.

-- 
Without deviation from the norm, progress is not possible.



More information about the linux-riscv mailing list