From: Dou Liyang <douliyangs@gmail.com>
To: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org
Cc: tglx@linutronix.de, kashyap.desai@broadcom.com,
shivasharan.srikanteshwara@broadcom.com,
sumit.saxena@broadcom.com, ming.lei@redhat.com, hch@lst.de,
bhelgaas@google.com, douliyang1@huawei.com,
Dou Liyang <douliyangs@gmail.com>
Subject: [PATCH 2/3] irq/affinity: Add is_managed into struct irq_affinity_desc
Date: Tue, 4 Dec 2018 23:51:21 +0800 [thread overview]
Message-ID: <20181204155122.6327-3-douliyangs@gmail.com> (raw)
In-Reply-To: <20181204155122.6327-1-douliyangs@gmail.com>
Now, Linux uses the irq_affinity_desc to convey information.
As Kashyap and Sumit reported, in MSI/-x subsystem, the pre/post vectors
may be used to some extra reply queues for performance.
https://marc.info/?l=linux-kernel&m=153543887027997&w=2
Their affinities are not NULL, but, they should be mapped as unmanaged
interrupts. So, only transfering the irq affinity assignments is not enough.
Add a new bit "is_managed" to convey the info in irq_affinity_desc and use
it in alloc_descs().
Reported-by: Kashyap Desai <kashyap.desai@broadcom.com>
Reported-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Dou Liyang <douliyangs@gmail.com>
---
include/linux/interrupt.h | 1 +
kernel/irq/affinity.c | 7 +++++++
kernel/irq/irqdesc.c | 9 +++++++--
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 71be303231e9..a12b3dbbc45e 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -263,6 +263,7 @@ struct irq_affinity {
*/
struct irq_affinity_desc {
struct cpumask mask;
+ unsigned int is_managed : 1;
};
#if defined(CONFIG_SMP)
diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c
index 1562a36e7c0f..d122575ba1b4 100644
--- a/kernel/irq/affinity.c
+++ b/kernel/irq/affinity.c
@@ -289,6 +289,13 @@ irq_create_affinity_masks(int nvecs, const struct irq_affinity *affd)
for (; curvec < nvecs; curvec++)
cpumask_copy(&masks[curvec].mask, irq_default_affinity);
+ /* Setup complementary information */
+ for (i = 0; i < nvecs; i++) {
+ if (i >= affd->pre_vectors && i < nvecs - affd->post_vectors)
+ masks[i].is_managed = 1;
+ else
+ masks[i].is_managed = 0;
+ }
outnodemsk:
free_node_to_cpumask(node_to_cpumask);
return masks;
diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index f87fa2b9935a..6b0821c144c0 100644
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -455,7 +455,7 @@ static int alloc_descs(unsigned int start, unsigned int cnt, int node,
const struct irq_affinity_desc *cur_affinity= affinity;
const struct cpumask *mask = NULL;
struct irq_desc *desc;
- unsigned int flags;
+ unsigned int flags = 0;
int i;
/* Validate affinity mask(s) */
@@ -468,11 +468,16 @@ static int alloc_descs(unsigned int start, unsigned int cnt, int node,
}
}
- flags = affinity ? IRQD_AFFINITY_MANAGED | IRQD_MANAGED_SHUTDOWN : 0;
mask = NULL;
for (i = 0; i < cnt; i++) {
if (affinity) {
+ if (affinity->is_managed) {
+ flags = IRQD_AFFINITY_MANAGED |
+ IRQD_MANAGED_SHUTDOWN;
+ } else {
+ flags = 0;
+ }
mask = &affinity->mask;
node = cpu_to_node(cpumask_first(mask));
affinity++;
--
2.17.2
next prev parent reply other threads:[~2018-12-04 15:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-04 15:51 [PATCH 0/3] irq/core: Fix and expand the irq affinity descriptor Dou Liyang
2018-12-04 15:51 ` [PATCH 1/3] genirq/core: Add a new interrupt " Dou Liyang
2018-12-04 15:51 ` Dou Liyang [this message]
2018-12-18 15:26 ` [PATCH 2/3] irq/affinity: Add is_managed into struct irq_affinity_desc Thomas Gleixner
2018-12-04 15:51 ` [PATCH 3/3] irq/affinity: Fix a possible breakage Dou Liyang
2018-12-05 8:28 ` Thomas Gleixner
2018-12-11 16:27 ` Dou Liyang
2018-12-19 10:53 ` [PATCH 0/3] irq/core: Fix and expand the irq affinity descriptor Thomas Gleixner
2018-12-19 12:55 ` Sumit Saxena
2018-12-28 9:54 ` Sumit Saxena
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181204155122.6327-3-douliyangs@gmail.com \
--to=douliyangs@gmail.com \
--cc=bhelgaas@google.com \
--cc=douliyang1@huawei.com \
--cc=hch@lst.de \
--cc=kashyap.desai@broadcom.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=shivasharan.srikanteshwara@broadcom.com \
--cc=sumit.saxena@broadcom.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).