FAILED: patch "[PATCH] irqdomain: Refactor __irq_domain_alloc_irqs()" failed to apply to 5.15-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y
git checkout FETCH_HEAD
git cherry-pick -x d55f7f4c58c07beb5050a834bf57ae2ede599c7e
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 5.15.y' HEAD^..
Possible dependencies:
d55f7f4c58c0 ("irqdomain: Refactor __irq_domain_alloc_irqs()")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From d55f7f4c58c07beb5050a834bf57ae2ede599c7e Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Mon, 13 Feb 2023 11:42:47 +0100
Subject: [PATCH] irqdomain: Refactor __irq_domain_alloc_irqs()
Refactor __irq_domain_alloc_irqs() so that it can be called internally while holding the irq_domain_mutex.
This will be used to fix a shared-interrupt mapping race, hence the Fixes tag.
kernel/irq/irqdomain.c +48 -40
@@ -1441,40 +1441,12 @@ int irq_domain_alloc_irqs_hierarchy(struct irq_domain *domain,return domain->ops->alloc (domain, irq_base, nr_irqs, arg); } -/** -* __irq_domain_alloc_irqs - Allocate IRQs from domain -* @domain: domain to allocate from -* @irq_base: allocate specified IRQ number if irq_base >= 0 -* @nr_irqs: number of IRQs to allocate -* @node: NUMA node id for memory allocation -* @arg: domain specific argument -* @realloc: IRQ descriptors have already been allocated if true -* @affinity: Optional irq affinity mask for multiqueue devices -* -* Allocate IRQ numbers and initialized all data structures to support -* hierarchy IRQ domains. -* Parameter @realloc is mainly to support legacy IRQs. -* Returns error code or allocated IRQ number -* -* The whole process to setup an IRQ has been split into two steps. -* The first step, __irq_domain_alloc_irqs(), is to allocate IRQ -* descriptor and required hardware resources. The second step, -* irq_domain_activate_irq(), is to program the hardware with preallocated -* resources. In this way, it's easier to rollback when failing to -* allocate resources. -*/ -int __irq_domain_alloc_irqs (struct irq_domain *domain,int irq_base, -unsigned int nr_irqs,int node,void *arg, -bool realloc,const struct irq_affinity_desc *affinity) +static int irq_domain_alloc_irqs_locked (struct irq_domain *domain,int irq_base, +unsigned int nr_irqs,int node,void *arg, +bool realloc,const struct irq_affinity_desc *affinity) {int i, ret, virq; -if (domain ==NULL ) { - domain = irq_default_domain; -if (WARN (!domain,"domain is NULL; cannot allocate IRQ\n" )) -return -EINVAL ; - } -if (realloc && irq_base >=0 ) { virq = irq_base; }else {
@@ -1493,24 +1465,18 @@ int __irq_domain_alloc_irqs(struct irq_domain *domain, int irq_base, goto out_free_desc; } -mutex_lock (&irq_domain_mutex); ret =irq_domain_alloc_irqs_hierarchy (domain, virq, nr_irqs, arg); -if (ret <0 ) { -mutex_unlock (&irq_domain_mutex); +if (ret <0 ) goto out_free_irq_data; - }for (i =0 ; i < nr_irqs; i++) { ret =irq_domain_trim_hierarchy (virq + i); -if (ret) { -mutex_unlock (&irq_domain_mutex); +if (ret) goto out_free_irq_data; - } } - +for (i =0 ; i < nr_irqs; i++)irq_domain_insert_irq (virq + i); -mutex_unlock (&irq_domain_mutex);return virq;
@@ -1520,6 +1486,48 @@ int __irq_domain_alloc_irqs(struct irq_domain *domain, int irq_base,irq_free_descs (virq, nr_irqs);return ret; } + +/** +* __irq_domain_alloc_irqs - Allocate IRQs from domain +* @domain: domain to allocate from +* @irq_base: allocate specified IRQ number if irq_base >= 0 +* @nr_irqs: number of IRQs to allocate +* @node: NUMA node id for memory allocation +* @arg: domain specific argument +* @realloc: IRQ descriptors have already been allocated if true +* @affinity: Optional irq affinity mask for multiqueue devices +* +* Allocate IRQ numbers and initialized all data structures to support +* hierarchy IRQ domains. +* Parameter @realloc is mainly to support legacy IRQs. +* Returns error code or allocated IRQ number +* +* The whole process to setup an IRQ has been split into two steps. +* The first step, __irq_domain_alloc_irqs(), is to allocate IRQ +* descriptor and required hardware resources. The second step, +* irq_domain_activate_irq(), is to program the hardware with preallocated +* resources. In this way, it's easier to rollback when failing to +* allocate resources. +*/ +int __irq_domain_alloc_irqs (struct irq_domain *domain,int irq_base, +unsigned int nr_irqs,int node,void *arg, +bool realloc,const struct irq_affinity_desc *affinity) +{ +int ret; + +if (domain ==NULL ) { + domain = irq_default_domain; +if (WARN (!domain,"domain is NULL; cannot allocate IRQ\n" )) +return -EINVAL ; + } + +mutex_lock (&irq_domain_mutex); + ret =irq_domain_alloc_irqs_locked (domain, irq_base, nr_irqs, node, arg, + realloc, affinity); +mutex_unlock (&irq_domain_mutex); + +return ret; +}EXPORT_SYMBOL_GPL (__irq_domain_alloc_irqs);/* The irq_data was moved, fix the revmap to refer to the new location */
Quoted 15 lines · Greg Kroah-Hartman
The patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y
git checkoutFETCH_HEAD
git cherry-pick -xd55f7f4c58c07beb5050a834bf57ae2ede599c7e
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 5.15.y' HEAD^..
Quoted 3 lines
Possible dependencies:
d55f7f4c58c0("irqdomain: Refactor__irq_domain_alloc_irqs()")
The below commit applies fine to 5.15.y. Could you try cherry-picking it again?
Johan
Quoted 20 lines
------------------ original commit in Linus's tree ------------------
From
d55f7f4c58c07beb5050a834bf57ae2ede599c7eMon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Mon, 13 Feb 2023 11:42:47 +0100
Subject: [PATCH] irqdomain: Refactor__irq_domain_alloc_irqs()Refactor
__irq_domain_alloc_irqs()so that it can be called internally while holding theirq_domain_mutex.This will be used to fix a shared-interrupt mapping race, hence the Fixes tag.
Fixes b62b2cf5759b ("irqdomain: Fix handling of type settings for existing mappings")Cc [email protected] # 4.8Tested-by Hsin-Yi Wang <[email protected]>Tested-by Mark-PK Tsai <[email protected]>Signed-off-by Johan Hovold <[email protected]>Signed-off-by Marc Zyngier <[email protected]>
Greg KH
maintainerQuoted 16 lines · Johan Hovold
Quoted 15 lines · Greg Kroah-Hartman
The patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y
git checkoutFETCH_HEAD
git cherry-pick -xd55f7f4c58c07beb5050a834bf57ae2ede599c7e
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 5.15.y' HEAD^..
Quoted 6 lines
Quoted 3 lines
Possible dependencies:
d55f7f4c58c0("irqdomain: Refactor__irq_domain_alloc_irqs()")The below commit applies fine to 5.15.y. Could you try cherry-picking it again?
patching file kernel/irq/irqdomain.c
Hunk #1 succeeded at 1464 (offset 23 lines).
Hunk #2 succeeded at 1488 (offset 23 lines).
Hunk #3 FAILED at 1486.
1 out of 3 hunks FAILED -- rejects in file kernel/irq/irqdomain.c
And doesn't look to apply properly as the EXPORT_SYMBOL_GPL(... line is not in 5.15.y
thanks,
greg k-h
Quoted 24 lines · Greg Kroah-Hartman
Quoted 16 lines · Johan Hovold
Quoted 15 lines · Greg Kroah-Hartman
The patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y
git checkoutFETCH_HEAD
git cherry-pick -xd55f7f4c58c07beb5050a834bf57ae2ede599c7e
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 5.15.y' HEAD^..Quoted 6 lines
Quoted 3 lines
Possible dependencies:
d55f7f4c58c0("irqdomain: Refactor__irq_domain_alloc_irqs()")The below commit applies fine to 5.15.y. Could you try cherry-picking it again?
Quoted 8 lines
patching file
kernel/irq/irqdomain.c
Hunk #1 succeeded at 1464 (offset 23 lines).
Hunk #2 succeeded at 1488 (offset 23 lines).
Hunk #3 FAILED at 1486.
1 out of 3 hunks FAILED -- rejects in filekernel/irq/irqdomain.cAnd doesn't look to apply properly as the EXPORT_SYMBOL_GPL(... line is not in 5.15.y
Ok, I only tried cherry picking which worked fine. I've posted a backport of this one and the follow-on fix now.
They should be applied in order to avoid a build failure so you should drop the second patch which you already applied ("irqdomain: Fix mapping-creation race") in favour of that series.
Johan