patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Kevin Traynor <ktraynor@redhat.com>
To: Stephen Hemminger <sthemmin@microsoft.com>
Cc: dpdk stable <stable@dpdk.org>
Subject: [dpdk-stable] patch 'bus/vmbus: map ring in secondary process' has been queued to LTS release 18.11.2
Date: Thu, 25 Apr 2019 16:39:42 +0100	[thread overview]
Message-ID: <20190425154037.28778-7-ktraynor@redhat.com> (raw)
In-Reply-To: <20190425154037.28778-1-ktraynor@redhat.com>

Hi,

FYI, your patch has been queued to LTS release 18.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 05/01/19. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches can be viewed on the 18.11 branch at:
	https://github.com/kevintraynor/dpdk-stable-queue.git

Thanks.

Kevin Traynor

---
From d96d210d1d4166b028594ae7adb496b760f573a2 Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <sthemmin@microsoft.com>
Date: Thu, 7 Feb 2019 19:44:05 -0800
Subject: [PATCH] bus/vmbus: map ring in secondary process

[ upstream commit 2a28a502c6078ceb3e5b296b5f9cbb7e27ceedbd ]

Need to remember primary channel in secondary process.
Then use it to iterate over subchannels in secondary
process mapping setup.

Fixes: 831dba47bd36 ("bus/vmbus: add Hyper-V virtual bus support")

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
---
 drivers/bus/vmbus/linux/vmbus_uio.c  | 43 ++++++++++++++++++++++++++++
 drivers/bus/vmbus/private.h          |  3 ++
 drivers/bus/vmbus/vmbus_channel.c    | 20 +++++++++++--
 drivers/bus/vmbus/vmbus_common_uio.c | 15 ++++++++++
 4 files changed, 78 insertions(+), 3 deletions(-)

diff --git a/drivers/bus/vmbus/linux/vmbus_uio.c b/drivers/bus/vmbus/linux/vmbus_uio.c
index 7a3f3fda9..a6b3e9201 100644
--- a/drivers/bus/vmbus/linux/vmbus_uio.c
+++ b/drivers/bus/vmbus/linux/vmbus_uio.c
@@ -248,4 +248,47 @@ static int vmbus_uio_map_subchan(const struct rte_vmbus_device *dev,
 }
 
+int
+vmbus_uio_map_secondary_subchan(const struct rte_vmbus_device *dev,
+				const struct vmbus_channel *chan)
+{
+	const struct vmbus_br *br = &chan->txbr;
+	char ring_path[PATH_MAX];
+	void *mapaddr, *ring_buf;
+	uint32_t ring_size;
+	int fd;
+
+	snprintf(ring_path, sizeof(ring_path),
+		 "%s/%s/channels/%u/ring",
+		 SYSFS_VMBUS_DEVICES, dev->device.name,
+		 chan->relid);
+
+	ring_buf = br->vbr;
+	ring_size = br->dsize + sizeof(struct vmbus_bufring);
+	VMBUS_LOG(INFO, "secondary ring_buf %p size %u",
+		  ring_buf, ring_size);
+
+	fd = open(ring_path, O_RDWR);
+	if (fd < 0) {
+		VMBUS_LOG(ERR, "Cannot open %s: %s",
+			  ring_path, strerror(errno));
+		return -errno;
+	}
+
+	mapaddr = vmbus_map_resource(ring_buf, fd, 0, 2 * ring_size, 0);
+	close(fd);
+
+	if (mapaddr == ring_buf)
+		return 0;
+
+	if (mapaddr == MAP_FAILED)
+		VMBUS_LOG(ERR,
+			  "mmap subchan %u in secondary failed", chan->relid);
+	else
+		VMBUS_LOG(ERR,
+			  "mmap subchan %u in secondary address mismatch",
+			  chan->relid);
+	return -1;
+}
+
 int vmbus_uio_map_rings(struct vmbus_channel *chan)
 {
diff --git a/drivers/bus/vmbus/private.h b/drivers/bus/vmbus/private.h
index 211127dd8..f19b14e4a 100644
--- a/drivers/bus/vmbus/private.h
+++ b/drivers/bus/vmbus/private.h
@@ -46,4 +46,5 @@ struct mapped_vmbus_resource {
 	rte_uuid_t id;
 	int nb_maps;
+	struct vmbus_channel *primary;
 	struct vmbus_map maps[VMBUS_MAX_RESOURCE];
 	char path[PATH_MAX];
@@ -108,4 +109,6 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary,
 			  struct vmbus_channel **subchan);
 int vmbus_uio_map_rings(struct vmbus_channel *chan);
+int vmbus_uio_map_secondary_subchan(const struct rte_vmbus_device *dev,
+				    const struct vmbus_channel *chan);
 
 void vmbus_br_setup(struct vmbus_br *br, void *buf, unsigned int blen);
diff --git a/drivers/bus/vmbus/vmbus_channel.c b/drivers/bus/vmbus/vmbus_channel.c
index bd14c0662..46b3ba3f9 100644
--- a/drivers/bus/vmbus/vmbus_channel.c
+++ b/drivers/bus/vmbus/vmbus_channel.c
@@ -353,10 +353,19 @@ int rte_vmbus_chan_open(struct rte_vmbus_device *device,
 			struct vmbus_channel **new_chan)
 {
+	struct mapped_vmbus_resource *uio_res;
 	int err;
 
+	uio_res = vmbus_uio_find_resource(device);
+	if (!uio_res) {
+		VMBUS_LOG(ERR, "can't find uio resource");
+		return -EINVAL;
+	}
+
 	err = vmbus_chan_create(device, device->relid, 0,
 				device->monitor_id, new_chan);
-	if (!err)
+	if (!err) {
 		device->primary = *new_chan;
+		uio_res->primary = *new_chan;
+	}
 
 	return err;
@@ -397,9 +406,14 @@ void rte_vmbus_chan_close(struct vmbus_channel *chan)
 	struct vmbus_channel *primary = device->primary;
 
-	if (chan != primary)
+	/*
+	 * intentionally leak primary channel because
+	 * secondary may still reference it
+	 */
+	if (chan != primary) {
 		STAILQ_REMOVE(&primary->subchannel_list, chan,
 			      vmbus_channel, next);
+		rte_free(chan);
+	}
 
-	rte_free(chan);
 }
 
diff --git a/drivers/bus/vmbus/vmbus_common_uio.c b/drivers/bus/vmbus/vmbus_common_uio.c
index a6545b758..9947f82ab 100644
--- a/drivers/bus/vmbus/vmbus_common_uio.c
+++ b/drivers/bus/vmbus/vmbus_common_uio.c
@@ -28,4 +28,5 @@ vmbus_uio_map_secondary(struct rte_vmbus_device *dev)
 {
 	int fd, i;
+	struct vmbus_channel *chan;
 	struct mapped_vmbus_resource *uio_res;
 	struct mapped_vmbus_res_list *uio_res_list
@@ -77,4 +78,18 @@ vmbus_uio_map_secondary(struct rte_vmbus_device *dev)
 		/* fd is not needed in slave process, close it */
 		close(fd);
+
+		dev->primary = uio_res->primary;
+		if (!dev->primary) {
+			VMBUS_LOG(ERR, "missing primary channel");
+			return -1;
+		}
+
+		STAILQ_FOREACH(chan, &dev->primary->subchannel_list, next) {
+			if (vmbus_uio_map_secondary_subchan(dev, chan) != 0) {
+				VMBUS_LOG(ERR, "cannot map secondary subchan");
+				return -1;
+			}
+		}
+
 		return 0;
 	}
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2019-04-25 16:37:47.079589209 +0100
+++ 0007-bus-vmbus-map-ring-in-secondary-process.patch	2019-04-25 16:37:46.686296299 +0100
@@ -1 +1 @@
-From 2a28a502c6078ceb3e5b296b5f9cbb7e27ceedbd Mon Sep 17 00:00:00 2001
+From d96d210d1d4166b028594ae7adb496b760f573a2 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 2a28a502c6078ceb3e5b296b5f9cbb7e27ceedbd ]
+
@@ -11 +12,0 @@
-Cc: stable@dpdk.org
@@ -22 +23 @@
-index 8c6bc52fd..fb60ee126 100644
+index 7a3f3fda9..a6b3e9201 100644

  parent reply	other threads:[~2019-04-25 15:40 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-25 15:39 [dpdk-stable] patch 'drivers: fix SPDX license id consistency' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'malloc: fix IPC message initialization' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'bus/vmbus: fix secondary process setup' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'net/netvsc: fix VF support with secondary process' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'bus/vmbus: fix check for mmap failure' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'bus/vmbus: stop mapping if empty resource found' " Kevin Traynor
2019-04-25 15:39 ` Kevin Traynor [this message]
2019-04-25 15:39 ` [dpdk-stable] patch 'bus/fslmc: decrease log level for unsupported devices' " Kevin Traynor
2019-04-26  9:38   ` [dpdk-stable] [EXT] " Hemant Agrawal
2019-04-25 15:39 ` [dpdk-stable] patch 'bus/dpaa: fix Rx discard register mask' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'mem: warn user when running without NUMA support' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'eal/linux: remove thread ID from debug message' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'bus/fslmc: remove unused include of error.h' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'bus/fslmc: fix build with musl libc' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'net/nfp: " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'net/netvsc: fix include of fcntl.h' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'app/test: fix flags with meson' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'app/test: fix build with musl libc' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'net/vdev_netvsc: fix device cast' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'app/testpmd: add missing newline when showing statistics' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'app/testpmd: extend forwarding statistics to 64 bits' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'app/testpmd: remove useless casts on statistics' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'ethdev: fix a typo' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'net/i40e: log when provided RSS key is not valid' " Kevin Traynor
2019-04-25 15:39 ` [dpdk-stable] patch 'net/bnxt: fix Rx VLAN offload flags' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'net/fm10k: fix VLAN strip offload flag' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'net/virtio: fix duplicate naming of include guard' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'net/virtio-user: fix multi-process support' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'vhost/crypto: fix parens' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'raw/ifpga: modify log output' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'net/netvsc: remove useless condition' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'net/virtio: " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'power: fix governor storage to trim newlines' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'telemetry: fix mapping of statistics' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'app/test: fix sprintf with strlcat' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'maintainers: update for IBM POWER' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'eal: initialize alarms early' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'ring: fix an error message' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'mem: limit use of address hint' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'event/sw: fix enqueue checks in self-test' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'test/event: replace sprintf with snprintf' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'compress/isal: fix compression stream initialization' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'crypto/dpaa2_sec: fix session clearing' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'crypto/dpaa2_sec: fix offset calculation for GCM' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'drivers/qat: fix queue pair NUMA node' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'compress/isal: fix getting information about CPU' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'ring: fix namesize macro documentation block' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'eal: tighten permissions on shared memory files' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'net/bonding: fix buffer length when printing strings' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'raw/dpaa2_qdma: fix to support multiprocess execution' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'power: remove unused variable' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'test/distributor: replace sprintf with strlcpy' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'test/hash: replace sprintf with snprintf' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'eal: fix typo in comment of vector function' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'doc: fix links to doxygen and sphinx sites' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'doc: fix two typos in contributing guide' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'doc: fix ABI check script examples' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'cfgfile: replace strcat with strlcat' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'net/mlx5: fix errno typos in comments' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'doc: fix typos in mlx5 guide' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'doc: fix typos in testpmd user " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'app/testpmd: fix typo in comment' " Kevin Traynor
2019-04-25 15:40 ` [dpdk-stable] patch 'ethdev: fix typo in error messages' " Kevin Traynor

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=20190425154037.28778-7-ktraynor@redhat.com \
    --to=ktraynor@redhat.com \
    --cc=stable@dpdk.org \
    --cc=sthemmin@microsoft.com \
    /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).