Message ID | 20201125111657.1141295-2-lvivier@redhat.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
Series | powerpc/pseries: fix MSI/X IRQ affinity on pseries | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | Successfully applied on branch powerpc/merge (4c202167192a77481310a3cacae9f12618b92216) |
snowpatch_ozlabs/checkpatch | warning | total: 0 errors, 0 warnings, 3 checks, 60 lines checked |
snowpatch_ozlabs/needsstable | success | Patch has no Fixes tags |
On Wed, 25 Nov 2020 12:16:56 +0100 Laurent Vivier <lvivier@redhat.com> wrote: > This function adds an affinity parameter to irq_create_mapping(). > This parameter is needed to pass it to irq_domain_alloc_descs(). > > irq_create_mapping() is a wrapper around irq_create_mapping_affinity() > to pass NULL for the affinity parameter. > > No functional change. > > Signed-off-by: Laurent Vivier <lvivier@redhat.com> > --- Reviewed-by: Greg Kurz <groug@kaod.org> > include/linux/irqdomain.h | 12 ++++++++++-- > kernel/irq/irqdomain.c | 13 ++++++++----- > 2 files changed, 18 insertions(+), 7 deletions(-) > > diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h > index 71535e87109f..ea5a337e0f8b 100644 > --- a/include/linux/irqdomain.h > +++ b/include/linux/irqdomain.h > @@ -384,11 +384,19 @@ extern void irq_domain_associate_many(struct irq_domain *domain, > extern void irq_domain_disassociate(struct irq_domain *domain, > unsigned int irq); > > -extern unsigned int irq_create_mapping(struct irq_domain *host, > - irq_hw_number_t hwirq); > +extern unsigned int irq_create_mapping_affinity(struct irq_domain *host, > + irq_hw_number_t hwirq, > + const struct irq_affinity_desc *affinity); > extern unsigned int irq_create_fwspec_mapping(struct irq_fwspec *fwspec); > extern void irq_dispose_mapping(unsigned int virq); > > +static inline unsigned int irq_create_mapping(struct irq_domain *host, > + irq_hw_number_t hwirq) > +{ > + return irq_create_mapping_affinity(host, hwirq, NULL); > +} > + > + > /** > * irq_linear_revmap() - Find a linux irq from a hw irq number. > * @domain: domain owning this hardware interrupt > diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c > index cf8b374b892d..e4ca69608f3b 100644 > --- a/kernel/irq/irqdomain.c > +++ b/kernel/irq/irqdomain.c > @@ -624,17 +624,19 @@ unsigned int irq_create_direct_mapping(struct irq_domain *domain) > EXPORT_SYMBOL_GPL(irq_create_direct_mapping); > > /** > - * irq_create_mapping() - Map a hardware interrupt into linux irq space > + * irq_create_mapping_affinity() - Map a hardware interrupt into linux irq space > * @domain: domain owning this hardware interrupt or NULL for default domain > * @hwirq: hardware irq number in that domain space > + * @affinity: irq affinity > * > * Only one mapping per hardware interrupt is permitted. Returns a linux > * irq number. > * If the sense/trigger is to be specified, set_irq_type() should be called > * on the number returned from that call. > */ > -unsigned int irq_create_mapping(struct irq_domain *domain, > - irq_hw_number_t hwirq) > +unsigned int irq_create_mapping_affinity(struct irq_domain *domain, > + irq_hw_number_t hwirq, > + const struct irq_affinity_desc *affinity) > { > struct device_node *of_node; > int virq; > @@ -660,7 +662,8 @@ unsigned int irq_create_mapping(struct irq_domain *domain, > } > > /* Allocate a virtual interrupt number */ > - virq = irq_domain_alloc_descs(-1, 1, hwirq, of_node_to_nid(of_node), NULL); > + virq = irq_domain_alloc_descs(-1, 1, hwirq, of_node_to_nid(of_node), > + affinity); > if (virq <= 0) { > pr_debug("-> virq allocation failed\n"); > return 0; > @@ -676,7 +679,7 @@ unsigned int irq_create_mapping(struct irq_domain *domain, > > return virq; > } > -EXPORT_SYMBOL_GPL(irq_create_mapping); > +EXPORT_SYMBOL_GPL(irq_create_mapping_affinity); > > /** > * irq_create_strict_mappings() - Map a range of hw irqs to fixed linux irqs
Laurent, On Wed, Nov 25 2020 at 12:16, Laurent Vivier wrote: The proper subsystem prefix is: 'genirq/irqdomain:' and the first letter after the colon wants to be uppercase. > This function adds an affinity parameter to irq_create_mapping(). > This parameter is needed to pass it to irq_domain_alloc_descs(). A changelog has to explain the WHY. 'The parameter is needed' is not really useful information. Thanks, tglx
On 25/11/2020 14:20, Thomas Gleixner wrote: > Laurent, > > On Wed, Nov 25 2020 at 12:16, Laurent Vivier wrote: > > The proper subsystem prefix is: 'genirq/irqdomain:' and the first letter > after the colon wants to be uppercase. Ok. >> This function adds an affinity parameter to irq_create_mapping(). >> This parameter is needed to pass it to irq_domain_alloc_descs(). > > A changelog has to explain the WHY. 'The parameter is needed' is not > really useful information. > The reason of this change is explained in PATCH 2. I have two patches, one to change the interface with no functional change (PATCH 1) and one to fix the problem (PATCH 2). Moreover they don't cover the same subsystems. I can either: - merge the two patches - or make a reference in the changelog of PATCH 1 to PATCH 2 (something like "(see folowing patch "powerpc/pseries: pass MSI affinity to irq_create_mapping()")") - or copy some information from PATCH 2 (something like "this parameter is needed by rtas_setup_msi_irqs() to pass the affinity to irq_domain_alloc_descs() to fix multiqueue affinity") What do you prefer? Thanks, Laurent
On 2020-11-25 14:09, Laurent Vivier wrote: > On 25/11/2020 14:20, Thomas Gleixner wrote: >> Laurent, >> >> On Wed, Nov 25 2020 at 12:16, Laurent Vivier wrote: >> >> The proper subsystem prefix is: 'genirq/irqdomain:' and the first >> letter >> after the colon wants to be uppercase. > > Ok. > >>> This function adds an affinity parameter to irq_create_mapping(). >>> This parameter is needed to pass it to irq_domain_alloc_descs(). >> >> A changelog has to explain the WHY. 'The parameter is needed' is not >> really useful information. >> > > The reason of this change is explained in PATCH 2. > > I have two patches, one to change the interface with no functional > change (PATCH 1) and > one to fix the problem (PATCH 2). Moreover they don't cover the same > subsystems. > > I can either: > - merge the two patches > - or make a reference in the changelog of PATCH 1 to PATCH 2 > (something like "(see folowing patch "powerpc/pseries: pass MSI > affinity to > irq_create_mapping()")") > - or copy some information from PATCH 2 > (something like "this parameter is needed by rtas_setup_msi_irqs() > to pass the affinity > to irq_domain_alloc_descs() to fix multiqueue affinity") > > What do you prefer? How about something like this for the first patch: "There is currently no way to convey the affinity of an interrupt via irq_create_mapping(), which creates issues for devices that expect that affinity to be managed by the kernel. In order to sort this out, rename irq_create_mapping() to irq_create_mapping_affinity() with an additional affinity parameter that can conveniently passed down to irq_domain_alloc_descs(). irq_create_mapping() is then re-implemented as a wrapper around irq_create_mapping_affinity()." Thanks, M.
On 25/11/2020 15:54, Marc Zyngier wrote: > On 2020-11-25 14:09, Laurent Vivier wrote: >> On 25/11/2020 14:20, Thomas Gleixner wrote: >>> Laurent, >>> >>> On Wed, Nov 25 2020 at 12:16, Laurent Vivier wrote: >>> >>> The proper subsystem prefix is: 'genirq/irqdomain:' and the first letter >>> after the colon wants to be uppercase. >> >> Ok. >> >>>> This function adds an affinity parameter to irq_create_mapping(). >>>> This parameter is needed to pass it to irq_domain_alloc_descs(). >>> >>> A changelog has to explain the WHY. 'The parameter is needed' is not >>> really useful information. >>> >> >> The reason of this change is explained in PATCH 2. >> >> I have two patches, one to change the interface with no functional >> change (PATCH 1) and >> one to fix the problem (PATCH 2). Moreover they don't cover the same subsystems. >> >> I can either: >> - merge the two patches >> - or make a reference in the changelog of PATCH 1 to PATCH 2 >> (something like "(see folowing patch "powerpc/pseries: pass MSI affinity to >> irq_create_mapping()")") >> - or copy some information from PATCH 2 >> (something like "this parameter is needed by rtas_setup_msi_irqs() >> to pass the affinity >> to irq_domain_alloc_descs() to fix multiqueue affinity") >> >> What do you prefer? > > How about something like this for the first patch: > > "There is currently no way to convey the affinity of an interrupt > via irq_create_mapping(), which creates issues for devices that > expect that affinity to be managed by the kernel. > > In order to sort this out, rename irq_create_mapping() to > irq_create_mapping_affinity() with an additional affinity parameter > that can conveniently passed down to irq_domain_alloc_descs(). > > irq_create_mapping() is then re-implemented as a wrapper around > irq_create_mapping_affinity()." It looks perfect. I update the changelog with that. Thanks, Laurent
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h index 71535e87109f..ea5a337e0f8b 100644 --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h @@ -384,11 +384,19 @@ extern void irq_domain_associate_many(struct irq_domain *domain, extern void irq_domain_disassociate(struct irq_domain *domain, unsigned int irq); -extern unsigned int irq_create_mapping(struct irq_domain *host, - irq_hw_number_t hwirq); +extern unsigned int irq_create_mapping_affinity(struct irq_domain *host, + irq_hw_number_t hwirq, + const struct irq_affinity_desc *affinity); extern unsigned int irq_create_fwspec_mapping(struct irq_fwspec *fwspec); extern void irq_dispose_mapping(unsigned int virq); +static inline unsigned int irq_create_mapping(struct irq_domain *host, + irq_hw_number_t hwirq) +{ + return irq_create_mapping_affinity(host, hwirq, NULL); +} + + /** * irq_linear_revmap() - Find a linux irq from a hw irq number. * @domain: domain owning this hardware interrupt diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index cf8b374b892d..e4ca69608f3b 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -624,17 +624,19 @@ unsigned int irq_create_direct_mapping(struct irq_domain *domain) EXPORT_SYMBOL_GPL(irq_create_direct_mapping); /** - * irq_create_mapping() - Map a hardware interrupt into linux irq space + * irq_create_mapping_affinity() - Map a hardware interrupt into linux irq space * @domain: domain owning this hardware interrupt or NULL for default domain * @hwirq: hardware irq number in that domain space + * @affinity: irq affinity * * Only one mapping per hardware interrupt is permitted. Returns a linux * irq number. * If the sense/trigger is to be specified, set_irq_type() should be called * on the number returned from that call. */ -unsigned int irq_create_mapping(struct irq_domain *domain, - irq_hw_number_t hwirq) +unsigned int irq_create_mapping_affinity(struct irq_domain *domain, + irq_hw_number_t hwirq, + const struct irq_affinity_desc *affinity) { struct device_node *of_node; int virq; @@ -660,7 +662,8 @@ unsigned int irq_create_mapping(struct irq_domain *domain, } /* Allocate a virtual interrupt number */ - virq = irq_domain_alloc_descs(-1, 1, hwirq, of_node_to_nid(of_node), NULL); + virq = irq_domain_alloc_descs(-1, 1, hwirq, of_node_to_nid(of_node), + affinity); if (virq <= 0) { pr_debug("-> virq allocation failed\n"); return 0; @@ -676,7 +679,7 @@ unsigned int irq_create_mapping(struct irq_domain *domain, return virq; } -EXPORT_SYMBOL_GPL(irq_create_mapping); +EXPORT_SYMBOL_GPL(irq_create_mapping_affinity); /** * irq_create_strict_mappings() - Map a range of hw irqs to fixed linux irqs
This function adds an affinity parameter to irq_create_mapping(). This parameter is needed to pass it to irq_domain_alloc_descs(). irq_create_mapping() is a wrapper around irq_create_mapping_affinity() to pass NULL for the affinity parameter. No functional change. Signed-off-by: Laurent Vivier <lvivier@redhat.com> --- include/linux/irqdomain.h | 12 ++++++++++-- kernel/irq/irqdomain.c | 13 ++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-)