Re: [PATCH 3/7] irqbypass: Take ownership of producer/consumer token tracking
From: Sean Christopherson
Date: Thu Apr 10 2025 - 18:04:51 EST
On Thu, Apr 10, 2025, Alex Williamson wrote:
> On Fri, 4 Apr 2025 14:14:45 -0700
> Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
> > diff --git a/include/linux/irqbypass.h b/include/linux/irqbypass.h
> > index 9bdb2a781841..379725b9a003 100644
> > --- a/include/linux/irqbypass.h
> > +++ b/include/linux/irqbypass.h
> > @@ -10,6 +10,7 @@
> >
> > #include <linux/list.h>
> >
> > +struct eventfd_ctx;
> > struct irq_bypass_consumer;
> >
> > /*
> > @@ -18,20 +19,20 @@ struct irq_bypass_consumer;
> > * The IRQ bypass manager is a simple set of lists and callbacks that allows
> > * IRQ producers (ex. physical interrupt sources) to be matched to IRQ
> > * consumers (ex. virtualization hardware that allows IRQ bypass or offload)
> > - * via a shared token (ex. eventfd_ctx). Producers and consumers register
> > - * independently. When a token match is found, the optional @stop callback
> > - * will be called for each participant. The pair will then be connected via
> > - * the @add_* callbacks, and finally the optional @start callback will allow
> > - * any final coordination. When either participant is unregistered, the
> > - * process is repeated using the @del_* callbacks in place of the @add_*
> > - * callbacks. Match tokens must be unique per producer/consumer, 1:N pairings
> > - * are not supported.
> > + * via a shared eventfd_ctx). Producers and consumers register independently.
> > + * When a producer and consumer are paired, i.e. a token match is found, the
> > + * optional @stop callback will be called for each participant. The pair will
> > + * then be connected via the @add_* callbacks, and finally the optional @start
> > + * callback will allow any final coordination. When either participant is
> > + * unregistered, the process is repeated using the @del_* callbacks in place of
> > + * the @add_* callbacks. Match tokens must be unique per producer/consumer,
> > + * 1:N pairings are not supported.
> > */
> >
> > /**
> > * struct irq_bypass_producer - IRQ bypass producer definition
> > * @node: IRQ bypass manager private list management
> > - * @token: opaque token to match between producer and consumer (non-NULL)
> > + * @token: IRQ bypass manage private token to match producers and consumers
>
> The "token" terminology seems a little out of place after all is said
> and done in this series.
Ugh, yeah, good point. I don't know why I left it as "token".
> Should it just be an "index" in anticipation of the usage with xarray and
> changed to an unsigned long? Or at least s/token/eventfd/ and changed to an
> eventfd_ctx pointer?
My strong vote is for "struct eventfd_ctx *eventfd;"