public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "K. Y. Srinivasan" <kys@microsoft.com>
To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
	devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com,
	jasowang@redhat.com
Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Subject: [PATCH 19/28] Drivers: hv: Add code to distribute channel interrupt load
Date: Sat,  1 Dec 2012 06:46:50 -0800	[thread overview]
Message-ID: <1354373219-31374-19-git-send-email-kys@microsoft.com> (raw)
In-Reply-To: <1354373219-31374-1-git-send-email-kys@microsoft.com>

Implement a simple policy for distributing incoming interrupt load.
We classify channels as (a) performance critical and (b) not
performance critical. All non-performance critical channels will
be bound to the boot cpu. Performance critical channels will be
bound to the remaining available CPUs on a round-robin basis.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
---
 drivers/hv/channel_mgmt.c |   85 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 84 insertions(+), 1 deletions(-)

diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 56ed45c..c80fe62 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -257,6 +257,89 @@ static void vmbus_process_offer(struct work_struct *work)
 	}
 }
 
+enum {
+	IDE = 0,
+	SCSI,
+	NIC,
+	MAX_PERF_CHN,
+};
+
+/*
+ * This is an array of channels (devices) that are performance critical.
+ * We attempt to distribute the interrupt load for these devices across
+ * all available CPUs.
+ */
+static const uuid_le hp_devs[] = {
+	/* {32412632-86cb-44a2-9b5c-50d1417354f5} */
+	/* IDE */
+	{
+		.b = {
+			0x32, 0x26, 0x41, 0x32, 0xcb, 0x86, 0xa2, 0x44,
+			0x9b, 0x5c, 0x50, 0xd1, 0x41, 0x73, 0x54, 0xf5
+		}
+	},
+	/* {ba6163d9-04a1-4d29-b605-72e2ffb1dc7f} */
+	/* Storage - SCSI */
+	{
+		.b  = {
+			0xd9, 0x63, 0x61, 0xba, 0xa1, 0x04, 0x29, 0x4d,
+			0xb6, 0x05, 0x72, 0xe2, 0xff, 0xb1, 0xdc, 0x7f
+		}
+	},
+	/* {F8615163-DF3E-46c5-913F-F2D2F965ED0E} */
+	/* Network */
+	{
+		.b = {
+			0x63, 0x51, 0x61, 0xF8, 0x3E, 0xDF, 0xc5, 0x46,
+			0x91, 0x3F, 0xF2, 0xD2, 0xF9, 0x65, 0xED, 0x0E
+		}
+	},
+
+};
+
+
+/*
+ * We use this state to statically distribute the channel interrupt load.
+ */
+static u32  next_vp;
+
+/*
+ * Starting with Win8, we can statically distribute the incoming
+ * channel interrupt load by binding a channel to VCPU. We
+ * implement here a simple round robin scheme for distributing
+ * the interrupt load.
+ * We will bind channels that are not performance critical to cpu 0 and
+ * performance critical channels (IDE, SCSI and Network) will be uniformly
+ * distributed across all available CPUs.
+ */
+static u32 get_vp_index(uuid_le *type_guid)
+{
+	u32 cur_cpu;
+	int i;
+	bool perf_chn = false;
+	u32 max_cpus = num_online_cpus();
+
+	for (i = IDE; i < MAX_PERF_CHN; i++) {
+		if (!memcmp(type_guid->b, hp_devs[i].b,
+				 sizeof(uuid_le))) {
+			perf_chn = true;
+			break;
+		}
+	}
+	if ((vmbus_proto_version == VERSION_WS2008) ||
+	    (vmbus_proto_version == VERSION_WIN7) || (!perf_chn)) {
+		/*
+		 * Prior to win8, all channel interrupts are
+		 * delivered on cpu 0.
+		 * Also if the channel is not a performance critical
+		 * channel, bind it to cpu 0.
+		 */
+		return 0;
+	}
+	cur_cpu = (++next_vp % max_cpus);
+	return hv_context.vp_index[cur_cpu];
+}
+
 /*
  * vmbus_onoffer - Handler for channel offers from vmbus in parent partition.
  *
@@ -302,7 +385,7 @@ static void vmbus_onoffer(struct vmbus_channel_message_header *hdr)
 				offer->connection_id;
 	}
 
-	newchannel->target_vp = 0;
+	newchannel->target_vp = get_vp_index(&offer->offer.if_type);
 
 	memcpy(&newchannel->offermsg, offer,
 	       sizeof(struct vmbus_channel_offer_channel));
-- 
1.7.4.1


  parent reply	other threads:[~2012-12-01 14:25 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-01 14:46 [PATCH 00/28] Drivers: hv: Update the Vmbus protocol K. Y. Srinivasan
2012-12-01 14:46 ` [PATCH 01/28] Drivers: hv: Implement routines for read side signaling optimization K. Y. Srinivasan
2012-12-01 14:46   ` [PATCH 02/28] Drivers: hv: Add state to manage batched reading K. Y. Srinivasan
2012-12-01 14:46   ` [PATCH 03/28] Drivers: hv: Turn off batched reading for util drivers K. Y. Srinivasan
2012-12-01 14:46   ` [PATCH 04/28] Drivers: hv: Optimize signaling in the read path K. Y. Srinivasan
2012-12-01 14:46   ` [PATCH 05/28] Drivers: hv: Optimize the signaling on the write path K. Y. Srinivasan
2012-12-01 14:46   ` [PATCH 06/28] Drivers: hv: Get rid of hv_get_ringbuffer_interrupt_mask() K. Y. Srinivasan
2012-12-01 14:46   ` [PATCH 07/28] Drivers: hv: Support handling multiple VMBUS versions K. Y. Srinivasan
2012-12-01 14:46   ` [PATCH 08/28] Drivers: hv: Update the ring buffer structure to match win8 functionality K. Y. Srinivasan
2012-12-01 14:46   ` [PATCH 09/28] Drivers: hv: Extend/modify vmbus_channel_offer_channel for win7 and beyond K. Y. Srinivasan
2012-12-01 14:46   ` [PATCH 10/28] Drivers: hv: Save and export negotiated vmbus version K. Y. Srinivasan
2012-12-01 14:46   ` [PATCH 11/28] Drivers: hv: Change the signature for hv_signal_event() K. Y. Srinivasan
2012-12-01 14:46   ` [PATCH 12/28] Drivers: hv: Change the signature of vmbus_set_event() K. Y. Srinivasan
2012-12-01 14:46   ` [PATCH 13/28] Drivers: hv: Move vmbus version definitions to hyperv.h K. Y. Srinivasan
2012-12-01 14:46   ` [PATCH 14/28] Drivers: hv: Manage signaling state on a per-connection basis K. Y. Srinivasan
2012-12-01 14:46   ` [PATCH 15/28] Drivers: hv: Cleanup vmbus_set_event() to support win7 and beyond K. Y. Srinivasan
2012-12-01 14:46   ` [PATCH 16/28] Drivers: hv: Setup a mapping for Hyper-V's notion cpu ID K. Y. Srinivasan
2012-12-01 14:46   ` [PATCH 17/28] Drivers: hv: Add state to manage incoming channel interrupt load K. Y. Srinivasan
2012-12-01 14:46   ` [PATCH 18/28] Drivers: hv: Modify the interrupt handling code to support win8 and beyond K. Y. Srinivasan
2012-12-01 14:46   ` K. Y. Srinivasan [this message]
2013-01-17 19:38     ` [PATCH 19/28] Drivers: hv: Add code to distribute channel interrupt load Greg KH
2013-01-17 21:28       ` KY Srinivasan
2012-12-01 14:46   ` [PATCH 20/28] Drivers: hv: Get rid of the unused global signaling state K. Y. Srinivasan
2012-12-01 14:46   ` [PATCH 21/28] Drivers: hv: Get rid of unnecessary request for offers K. Y. Srinivasan
2012-12-01 14:46   ` [PATCH 22/28] Drivers: hv: Manage event tasklets on per-cpu basis K. Y. Srinivasan
2012-12-01 14:46   ` [PATCH 23/28] Drivers: hv: Handle vmbus interrupts concurrently on all cpus K. Y. Srinivasan
2012-12-01 14:46   ` [PATCH 24/28] Drivers: hv: Add a check to deal with spurious interrupts K. Y. Srinivasan
2012-12-01 14:46   ` [PATCH 25/28] Drivers: hv: Enable protocol negotiation with win8 hosts K. Y. Srinivasan
2012-12-01 14:46   ` [PATCH 26/28] Drivers: hv: Implement flow management on the send side K. Y. Srinivasan
2012-12-01 14:46   ` [PATCH 27/28] Drivers: hv: Capture the host build information K. Y. Srinivasan
2012-12-01 14:46   ` [PATCH 28/28] Drivers: hv: Cleanup and consolidate reporting of build/version info K. Y. Srinivasan
2013-01-17 19:42 ` [PATCH 00/28] Drivers: hv: Update the Vmbus protocol Greg KH

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=1354373219-31374-19-git-send-email-kys@microsoft.com \
    --to=kys@microsoft.com \
    --cc=apw@canonical.com \
    --cc=devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jasowang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olaf@aepfle.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