mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Suresh Siddha <suresh.b.siddha@intel.com>
To: Ingo Molnar <mingo@kernel.org>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>,
	agordeev@redhat.com, yinghai@kernel.org,
	linux-kernel@vger.kernel.org, x86@kernel.org,
	gorcunov@openvz.org
Subject: [PATCH v3 3/3] x86, x2apic: use multiple cluster members for the irq destination only with the explicit affinity
Date: Mon, 25 Jun 2012 13:38:29 -0700	[thread overview]
Message-ID: <1340656709-11423-4-git-send-email-suresh.b.siddha@intel.com> (raw)
In-Reply-To: <1340656709-11423-1-git-send-email-suresh.b.siddha@intel.com>

During boot or driver load etc, interrupt destination is setup using default
target cpu's. Later the user (irqbalance etc) or the driver (irq_set_affinity/
irq_set_affinity_hint) can request the interrupt to be migrated to some
specific set of cpu's.

In the x2apic cluster routing, for the default scenario use single cpu as the
interrupt destination and when there is an explicit interrupt affinity
request, route the interrupt to multiple members of a x2apic cluster
specified in the cpumask of the migration request.

This will minmize the vector pressure when there are lot of interrupt
sources and relatively few x2apic clusters (for example a single socket
server). This will allow the performance critical interrupts to be
routed to multiple cpu's in the x2apic cluster (irqbalance for example
uses the cache siblings etc while specifying the interrupt destination) and
allow non-critical interrupts to be serviced by a single logical cpu.

Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Acked-by: Yinghai Lu <yinghai@kernel.org>
Acked-by: Alexander Gordeev <agordeev@redhat.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
 arch/x86/kernel/apic/x2apic_cluster.c |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c
index bde78d0..c88baa4 100644
--- a/arch/x86/kernel/apic/x2apic_cluster.c
+++ b/arch/x86/kernel/apic/x2apic_cluster.c
@@ -209,13 +209,30 @@ static int x2apic_cluster_probe(void)
 		return 0;
 }
 
+static const struct cpumask *x2apic_cluster_target_cpus(void)
+{
+	return cpu_all_mask;
+}
+
 /*
  * Each x2apic cluster is an allocation domain.
  */
 static void cluster_vector_allocation_domain(int cpu, struct cpumask *retmask,
 					     const struct cpumask *mask)
 {
-	cpumask_and(retmask, mask, per_cpu(cpus_in_cluster, cpu));
+	/*
+	 * To minimize vector pressure, default case of boot, device bringup
+	 * etc will use a single cpu for the interrupt destination.
+	 *
+	 * On explicit migration requests coming from irqbalance etc,
+	 * interrupts will be routed to the x2apic cluster (cluster-id
+	 * derived from the first cpu in the mask) members specified
+	 * in the mask.
+	 */
+	if (mask == x2apic_cluster_target_cpus())
+		cpumask_copy(retmask, cpumask_of(cpu));
+	else
+		cpumask_and(retmask, mask, per_cpu(cpus_in_cluster, cpu));
 }
 
 static struct apic apic_x2apic_cluster = {
@@ -229,7 +246,7 @@ static struct apic apic_x2apic_cluster = {
 	.irq_delivery_mode		= dest_LowestPrio,
 	.irq_dest_mode			= 1, /* logical */
 
-	.target_cpus			= online_target_cpus,
+	.target_cpus			= x2apic_cluster_target_cpus,
 	.disable_esr			= 0,
 	.dest_logical			= APIC_DEST_LOGICAL,
 	.check_apicid_used		= NULL,
-- 
1.7.6.5


  parent reply	other threads:[~2012-06-25 20:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-25 20:38 [PATCH v3 0/3] -tip cleanups/fixes for x2apic cluster mode routing Suresh Siddha
2012-06-25 20:38 ` [PATCH v3 1/3] x86, apic: optimize cpu traversal in __assign_irq_vector() using domain membership Suresh Siddha
2012-07-06 11:28   ` [tip:x86/platform] x86/apic: Optimize " tip-bot for Suresh Siddha
2012-06-25 20:38 ` [PATCH v3 2/3] x86, x2apic: limit the vector reservation to the user specified mask Suresh Siddha
2012-07-06 11:29   ` [tip:x86/platform] x86/apic/x2apic: Limit " tip-bot for Suresh Siddha
2012-06-25 20:38 ` Suresh Siddha [this message]
2012-07-06 11:29   ` [tip:x86/platform] x86/apic/x2apic: Use multiple cluster members for the irq destination only with the explicit affinity tip-bot for Suresh Siddha

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=1340656709-11423-4-git-send-email-suresh.b.siddha@intel.com \
    --to=suresh.b.siddha@intel.com \
    --cc=agordeev@redhat.com \
    --cc=gorcunov@openvz.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=x86@kernel.org \
    --cc=yinghai@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®