All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>,
	Christoph Hellwig <hch@lst.de>, Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Jens Axboe <axboe@kernel.dk>, Keith Busch <keith.busch@intel.com>
Subject: [patch 44/55] x86/apic: Add irq_data argument to apic->cpu_mask_to_apicid()
Date: Tue, 20 Jun 2017 01:37:44 +0200	[thread overview]
Message-ID: <20170619235446.720739075@linutronix.de> (raw)
In-Reply-To: 20170619233700.547167146@linutronix.de

[-- Attachment #1: x86-apic--Add-irq_data-argument-to-apic--cpu_mask_to_apicid--.patch --]
[-- Type: text/plain, Size: 5733 bytes --]

The decision to which CPUs an interrupt is effectively routed happens in
the various apic->cpu_mask_to_apicid() implementations

To support effective affinity masks this information needs to be updated in
irq_data. Add a pointer to irq_data to the callbacks and feed it through
the call chain.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/include/asm/apic.h           |    5 +++++
 arch/x86/kernel/apic/apic.c           |    9 +++++++--
 arch/x86/kernel/apic/vector.c         |   25 +++++++++++++++----------
 arch/x86/kernel/apic/x2apic_cluster.c |    3 ++-
 arch/x86/kernel/apic/x2apic_uv_x.c    |    5 +++--
 5 files changed, 32 insertions(+), 15 deletions(-)

--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -252,6 +252,8 @@ static inline int x2apic_enabled(void) {
 #define	x2apic_supported()	(0)
 #endif /* !CONFIG_X86_X2APIC */
 
+struct irq_data;
+
 /*
  * Copyright 2004 James Cleverdon, IBM.
  * Subject to the GNU Public License, v.2
@@ -297,6 +299,7 @@ struct apic {
 	unsigned long (*set_apic_id)(unsigned int id);
 
 	int (*cpu_mask_to_apicid)(const struct cpumask *cpumask,
+				  struct irq_data *irqdata,
 				  unsigned int *apicid);
 
 	/* ipi */
@@ -540,8 +543,10 @@ static inline int default_phys_pkg_id(in
 #endif
 
 extern int flat_cpu_mask_to_apicid(const struct cpumask *cpumask,
+				   struct irq_data *irqdata,
 				   unsigned int *apicid);
 extern int default_cpu_mask_to_apicid(const struct cpumask *cpumask,
+				      struct irq_data *irqdata,
 				      unsigned int *apicid);
 
 static inline void
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -2201,7 +2201,9 @@ void default_init_apic_ldr(void)
 	apic_write(APIC_LDR, val);
 }
 
-int default_cpu_mask_to_apicid(const struct cpumask *mask, unsigned int *apicid)
+int default_cpu_mask_to_apicid(const struct cpumask *mask,
+			       struct irq_data *irqdata,
+			       unsigned int *apicid)
 {
 	unsigned int cpu = cpumask_first(mask);
 
@@ -2211,7 +2213,10 @@ int default_cpu_mask_to_apicid(const str
 	return 0;
 }
 
-int flat_cpu_mask_to_apicid(const struct cpumask *mask, unsigned int *apicid)
+int flat_cpu_mask_to_apicid(const struct cpumask *mask,
+			    struct irq_data *irqdata,
+			    unsigned int *apicid)
+
 {
 	unsigned long cpu_mask = cpumask_bits(mask)[0] & APIC_ALL_CPUS;
 
--- a/arch/x86/kernel/apic/vector.c
+++ b/arch/x86/kernel/apic/vector.c
@@ -103,7 +103,8 @@ static void free_apic_chip_data(struct a
 }
 
 static int __assign_irq_vector(int irq, struct apic_chip_data *d,
-			       const struct cpumask *mask)
+			       const struct cpumask *mask,
+			       struct irq_data *irqdata)
 {
 	/*
 	 * NOTE! The local APIC isn't very good at handling
@@ -226,32 +227,35 @@ static int __assign_irq_vector(int irq,
 	 * cpus masked out.
 	 */
 	cpumask_and(vector_searchmask, vector_searchmask, mask);
-	BUG_ON(apic->cpu_mask_to_apicid(vector_searchmask, &d->cfg.dest_apicid));
+	BUG_ON(apic->cpu_mask_to_apicid(vector_searchmask, irqdata,
+					&d->cfg.dest_apicid));
 	return 0;
 }
 
 static int assign_irq_vector(int irq, struct apic_chip_data *data,
-			     const struct cpumask *mask)
+			     const struct cpumask *mask,
+			     struct irq_data *irqdata)
 {
 	int err;
 	unsigned long flags;
 
 	raw_spin_lock_irqsave(&vector_lock, flags);
-	err = __assign_irq_vector(irq, data, mask);
+	err = __assign_irq_vector(irq, data, mask, irqdata);
 	raw_spin_unlock_irqrestore(&vector_lock, flags);
 	return err;
 }
 
 static int assign_irq_vector_policy(int irq, int node,
 				    struct apic_chip_data *data,
-				    struct irq_alloc_info *info)
+				    struct irq_alloc_info *info,
+				    struct irq_data *irqdata)
 {
 	if (info && info->mask)
-		return assign_irq_vector(irq, data, info->mask);
+		return assign_irq_vector(irq, data, info->mask, irqdata);
 	if (node != NUMA_NO_NODE &&
-	    assign_irq_vector(irq, data, cpumask_of_node(node)) == 0)
+	    assign_irq_vector(irq, data, cpumask_of_node(node), irqdata) == 0)
 		return 0;
-	return assign_irq_vector(irq, data, apic->target_cpus());
+	return assign_irq_vector(irq, data, apic->target_cpus(), irqdata);
 }
 
 static void clear_irq_vector(int irq, struct apic_chip_data *data)
@@ -363,7 +367,8 @@ static int x86_vector_alloc_irqs(struct
 		irq_data->chip = &lapic_controller;
 		irq_data->chip_data = data;
 		irq_data->hwirq = virq + i;
-		err = assign_irq_vector_policy(virq + i, node, data, info);
+		err = assign_irq_vector_policy(virq + i, node, data, info,
+					       irq_data);
 		if (err)
 			goto error;
 	}
@@ -537,7 +542,7 @@ static int apic_set_affinity(struct irq_
 	if (!cpumask_intersects(dest, cpu_online_mask))
 		return -EINVAL;
 
-	err = assign_irq_vector(irq, data, dest);
+	err = assign_irq_vector(irq, data, dest, irq_data);
 	return err ? err : IRQ_SET_MASK_OK;
 }
 
--- a/arch/x86/kernel/apic/x2apic_cluster.c
+++ b/arch/x86/kernel/apic/x2apic_cluster.c
@@ -104,7 +104,8 @@ static void x2apic_send_IPI_all(int vect
 }
 
 static int
-x2apic_cpu_mask_to_apicid(const struct cpumask *mask, unsigned int *apicid)
+x2apic_cpu_mask_to_apicid(const struct cpumask *mask, struct irq_data *irqdata,
+			  unsigned int *apicid)
 {
 	unsigned int cpu;
 	u32 dest = 0;
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -526,9 +526,10 @@ static void uv_init_apic_ldr(void)
 }
 
 static int
-uv_cpu_mask_to_apicid(const struct cpumask *mask, unsigned int *apicid)
+uv_cpu_mask_to_apicid(const struct cpumask *mask, struct irq_data *irqdata,
+		      unsigned int *apicid)
 {
-	int ret = default_cpu_mask_to_apicid(mask, apicid);
+	int ret = default_cpu_mask_to_apicid(mask, irqdata, apicid);
 
 	if (!ret)
 		*apicid |= uv_apicid_hibits;

  parent reply	other threads:[~2017-06-20  0:04 UTC|newest]

Thread overview: 133+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-19 23:37 [patch 00/55] genirq: Debuggability, consolidation and managed affinities Thomas Gleixner
2017-06-19 23:37 ` [patch 01/55] x86/apic: Add name to irq chip Thomas Gleixner
2017-06-22 16:40   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 02/55] iommu/amd: " Thomas Gleixner
2017-06-19 23:37   ` Thomas Gleixner
2017-06-21 15:51   ` Joerg Roedel
2017-06-21 15:51     ` Joerg Roedel
2017-06-22 16:40   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 03/55] iommu/vt-d: " Thomas Gleixner
2017-06-21 15:51   ` Joerg Roedel
2017-06-21 15:51     ` Joerg Roedel
2017-06-22 16:41   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 04/55] genirq/msi: Prevent overwriting domain name Thomas Gleixner
2017-06-22 16:41   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 05/55] genirq: Allow fwnode to carry name information only Thomas Gleixner
2017-06-22 16:42   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 06/55] x86/vector: Create named irq domain Thomas Gleixner
2017-06-22 16:42   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 07/55] x86/ioapic: " Thomas Gleixner
2017-06-22 16:43   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 08/55] x86/htirq: Create named domain Thomas Gleixner
2017-06-22 16:44   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 09/55] x86/uv: Create named irq domain Thomas Gleixner
2017-06-22 16:44   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 10/55] x86/msi: Provide new iommu irqdomain interface Thomas Gleixner
2017-06-19 23:37   ` Thomas Gleixner
2017-06-22 16:45   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 11/55] iommu/vt-d: Use named irq domain interface Thomas Gleixner
2017-06-19 23:37   ` Thomas Gleixner
2017-06-21 15:52   ` Joerg Roedel
2017-06-21 15:52     ` Joerg Roedel
2017-06-22 16:45   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 12/55] iommu/amd: " Thomas Gleixner
2017-06-19 23:37   ` Thomas Gleixner
2017-06-21 15:52   ` Joerg Roedel
2017-06-21 15:52     ` Joerg Roedel
2017-06-22 16:46   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 13/55] x86/msi: Remove unused remap " Thomas Gleixner
2017-06-22 16:46   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 14/55] x86/msi: Create named irq domains Thomas Gleixner
2017-06-22 16:47   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 15/55] PCI: vmd: Create named irq domain Thomas Gleixner
2017-06-19 23:37   ` Thomas Gleixner
2017-06-20 20:07   ` Keith Busch
2017-06-20 20:07     ` Thomas Gleixner
2017-06-20 20:39       ` Thomas Gleixner
2017-06-22 16:47   ` [tip:irq/core] PCI/vmd: " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 16/55] genirq/irqdomain: Add map counter Thomas Gleixner
2017-06-22 16:48   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 17/55] genirq/debugfs: Add proper debugfs interface Thomas Gleixner
2017-06-22 16:49   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 18/55] genirq: Add missing comment for IRQD_STARTED Thomas Gleixner
2017-06-22 16:49   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 19/55] genirq: Provide irq_fixup_move_pending() Thomas Gleixner
2017-06-20  4:21   ` Dou Liyang
2017-06-20  6:58     ` Thomas Gleixner
2017-06-22 16:50   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 20/55] x86/irq: Cleanup pending irq move in fixup_irqs() Thomas Gleixner
2017-06-22 16:50   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 21/55] genirq: Remove mask argument from setup_affinity() Thomas Gleixner
2017-06-22 16:51   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 22/55] genirq: Rename setup_affinity() to irq_setup_affinity() Thomas Gleixner
2017-06-22 16:52   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 23/55] genirq: Move initial affinity setup to irq_startup() Thomas Gleixner
2017-06-22 16:52   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 24/55] genirq: Move pending helpers to internal.h Thomas Gleixner
2017-06-22 16:53   ` [tip:irq/core] " tip-bot for Christoph Hellwig
2017-06-19 23:37 ` [patch 25/55] genirq/cpuhotplug: Remove irq disabling logic Thomas Gleixner
2017-06-22 16:53   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 26/55] genirq/cpuhotplug: Dont claim success on error Thomas Gleixner
2017-06-22 16:54   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 27/55] genirq/cpuhotplug: Reorder check logic Thomas Gleixner
2017-06-22 16:54   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 28/55] genirq/cpuhotplug: Do not migrated shutdown irqs Thomas Gleixner
2017-06-22 16:55   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 29/55] genirq/cpuhotplug: Add support for cleaning up move in progress Thomas Gleixner
2017-06-22 16:56   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 30/55] genirq/cpuhotplug: Add support for conditional masking Thomas Gleixner
2017-06-22 16:56   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 31/55] genirq/cpuhotplug: Set force affinity flag on hotplug migration Thomas Gleixner
2017-06-22 16:57   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 32/55] x86/irq: Restructure fixup_irqs() Thomas Gleixner
2017-06-20 21:34   ` Keith Busch
2017-06-20 21:28     ` Thomas Gleixner
2017-06-22 16:57   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 33/55] x86/irq: Use irq_migrate_all_off_this_cpu() Thomas Gleixner
2017-06-22 16:58   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 34/55] genirq: Move irq_fixup_move_pending() to core Thomas Gleixner
2017-06-22 16:58   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 35/55] genirq: Remove pointless arg from show_irq_affinity Thomas Gleixner
2017-06-22 16:59   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 36/55] genirq: Remove pointless gfp argument Thomas Gleixner
2017-06-22 17:00   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 37/55] genirq/proc: Replace ever repeating type cast Thomas Gleixner
2017-06-22 17:00   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 38/55] genirq: Introduce effective affinity mask Thomas Gleixner
2017-06-22 17:01   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 39/55] genirq/cpuhotplug: Use " Thomas Gleixner
2017-06-22 17:01   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 40/55] x86/apic: Move flat_cpu_mask_to_apicid_and() into C source Thomas Gleixner
2017-06-22 17:02   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 41/55] x86/uv: Use default_cpu_mask_to_apicid_and() Thomas Gleixner
2017-06-22 17:03   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 42/55] x86/apic: Move online masking to core code Thomas Gleixner
2017-06-22 17:03   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 43/55] x86/apic: Move cpumask and " Thomas Gleixner
2017-06-22 17:04   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` Thomas Gleixner [this message]
2017-06-22 17:04   ` [tip:irq/core] x86/apic: Add irq_data argument to apic->cpu_mask_to_apicid() tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 45/55] xen/events: Add support for effective affinity mask Thomas Gleixner
2017-06-22 17:05   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 46/55] x86/apic: Implement effective irq mask update Thomas Gleixner
2017-06-22 17:05   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 47/55] genirq: Introduce IRQD_MANAGED_SHUTDOWN Thomas Gleixner
2017-06-22 17:06   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 48/55] genirq: Split out irq_startup() code Thomas Gleixner
2017-06-22 17:06   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 49/55] genirq: Add force argument to irq_startup() Thomas Gleixner
2017-06-22 17:07   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 50/55] genirq: Handle managed irqs gracefully in irq_startup() Thomas Gleixner
2017-06-22 17:08   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 51/55] genirq/cpuhotplug: Handle managed IRQs on CPU hotplug Thomas Gleixner
2017-06-22 17:08   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 52/55] genirq: Introduce IRQD_SINGLE_TARGET flag Thomas Gleixner
2017-06-22 17:09   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 53/55] genirq/cpuhotplug: Avoid irq affinity setting for single targets Thomas Gleixner
2017-06-22 17:09   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 54/55] x86/apic: Mark single target interrupts Thomas Gleixner
2017-06-22 17:10   ` [tip:irq/core] " tip-bot for Thomas Gleixner
2017-06-19 23:37 ` [patch 55/55] genirq/affinity: Assign vectors to all present CPUs Thomas Gleixner
2017-06-19 23:37   ` Thomas Gleixner
2017-06-19 23:37   ` Thomas Gleixner
2017-06-20  9:23 ` [patch 00/55] genirq: Debuggability, consolidation and managed affinities Christoph Hellwig

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=20170619235446.720739075@linutronix.de \
    --to=tglx@linutronix.de \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=keith.busch@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=mingo@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=peterz@infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.