DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Kavanagh, Mark B" <mark.b.kavanagh@intel.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	"yliu@fridaylinux.org" <yliu@fridaylinux.org>,
	"thomas@monjalon.net" <thomas@monjalon.net>,
	"ktraynor@redhat.com" <ktraynor@redhat.com>
Subject: Re: [dpdk-dev] [PATCH] vhost: disable reply-ack protocol feature if iommu feature disabled
Date: Mon, 6 Nov 2017 14:22:52 +0000	[thread overview]
Message-ID: <DC5AD7FA266D86499789B1BCAEC715F8D3A41E26@irsmsx105.ger.corp.intel.com> (raw)
In-Reply-To: <20171103175735.24603-1-maxime.coquelin@redhat.com>

>From: Maxime Coquelin [mailto:maxime.coquelin@redhat.com]
>Sent: Friday, November 3, 2017 5:58 PM
>To: dev@dpdk.org; yliu@fridaylinux.org; Kavanagh, Mark B
><mark.b.kavanagh@intel.com>; thomas@monjalon.net; ktraynor@redhat.com
>Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
>Subject: [PATCH] vhost: disable reply-ack protocol feature if iommu feature
>disabled
>
>If the application has disabled VIRTIO_F_IOMMU_PLATFORM, disable
>VHOST_USER_PROTOCOL_F_REPLY_ACK protocol feature that is only
>mandatory with IOMMU for now.
>
>This is done to provide a way for the application to support
>multiqueue with old Qemu versions (v2.7.0 to v2.9.0) that have
>reply-ack feature broken.
>
>Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
>---
>
>This is an alternative to my proposition of adding a new flag at
>vhost register time. Advantage of this solution is that it does
>not bring API change.
>
> lib/librte_vhost/vhost_user.c | 24 ++++++++++++++++++++++--
> 1 file changed, 22 insertions(+), 2 deletions(-)
>
>diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
>index 1f6cba4b9..e35218688 100644
>--- a/lib/librte_vhost/vhost_user.c
>+++ b/lib/librte_vhost/vhost_user.c
>@@ -878,6 +878,27 @@ vhost_user_set_vring_enable(struct virtio_net **pdev,
> }
>
> static void
>+vhost_user_get_protocol_features(struct virtio_net *dev,
>+				 struct VhostUserMsg *msg)
>+{
>+	uint64_t features, protocol_features = VHOST_USER_PROTOCOL_FEATURES;
>+
>+	rte_vhost_driver_get_features(dev->ifname, &features);
>+
>+	/*
>+	 * REPLY_ACK protocol feature is only mandatory for now
>+	 * for IOMMU feature. If IOMMU is explicitly disabled by the
>+	 * application, disable also REPLY_ACK feature for older buggy
>+	 * Qemu versions (from v2.7.0 to v2.9.0).
>+	 */
>+	if (!(features & (1ULL << VIRTIO_F_IOMMU_PLATFORM)))

Hi Maxime,

Thanks for this patch - I like this approach, as it maintains API compatibility.

Now for the gotchas, unfortunately:
- VIRTIO_F_IOMMU_PLATFORM is defined in vhost.h, as opposed to rte_vhost.h, so it is not exposed to OvS :(
- Currently, we use other similar macros in OvS (VIRTIO_NET_F_CSUM, VIRTIO_NET_F_HOST_TSO[4|6]); however, we obtain the definition of these from a kernel header file, as opposed to a DPDK header (linux/virtio_net.h)
	-- We could adopt the same approach for VIRTIO_F_IOMMU_PLATFORM, and include linux/virtio_config.h; unfortunately, the VIRTIO_F_IOMMU_PLATFORM macro is only defined from kernel 4.8, which creates another problem entirely.

One potential solution is to move the VIRTIO_* definitions to rte_vhost.h, but at this stage in the DPDK release cycle, that's probably a tall ask.

Any thoughts?

Thanks again,
Mark

>+		protocol_features &= ~(1ULL << VHOST_USER_PROTOCOL_F_REPLY_ACK);
>+
>+	msg->payload.u64 = protocol_features;
>+	msg->size = sizeof(msg->payload.u64);
>+}
>+
>+static void
> vhost_user_set_protocol_features(struct virtio_net *dev,
> 				 uint64_t protocol_features)
> {
>@@ -1248,8 +1269,7 @@ vhost_user_msg_handler(int vid, int fd)
> 		break;
>
> 	case VHOST_USER_GET_PROTOCOL_FEATURES:
>-		msg.payload.u64 = VHOST_USER_PROTOCOL_FEATURES;
>-		msg.size = sizeof(msg.payload.u64);
>+		vhost_user_get_protocol_features(dev, &msg);
> 		send_vhost_reply(fd, &msg);
> 		break;
> 	case VHOST_USER_SET_PROTOCOL_FEATURES:
>--
>2.13.6

  reply	other threads:[~2017-11-06 14:22 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-03 17:57 Maxime Coquelin
2017-11-06 14:22 ` Kavanagh, Mark B [this message]
2017-11-06 20:38 ` [dpdk-dev] [PATCH v2 0/3] vhost: disable iommu support by default Maxime Coquelin
2017-11-06 20:38   ` [dpdk-dev] [PATCH v2 1/3] vhost: disable reply-ack protocol feature if iommu feature disabled Maxime Coquelin
2017-11-06 20:38   ` [dpdk-dev] [PATCH v2 2/3] vhost: add flag to enable iommu support Maxime Coquelin
2017-11-06 20:38   ` [dpdk-dev] [PATCH v2 3/3] net: vhost: add iommu-support parameter to enable IOMMU feature Maxime Coquelin
2017-11-07  3:32   ` [dpdk-dev] [PATCH v2 0/3] vhost: disable iommu support by default Yuanhan Liu
2017-11-07 13:20     ` Thomas Monjalon
2017-11-07 10:56   ` Kavanagh, Mark B
2017-11-07 11:04     ` Maxime Coquelin
2017-11-07 11:08       ` Kavanagh, Mark B
2017-11-07 12:27         ` Maxime Coquelin
2017-11-07 11:25     ` Kevin Traynor
2017-11-07 11:30       ` Maxime Coquelin
2017-11-07 11:51         ` 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=DC5AD7FA266D86499789B1BCAEC715F8D3A41E26@irsmsx105.ger.corp.intel.com \
    --to=mark.b.kavanagh@intel.com \
    --cc=dev@dpdk.org \
    --cc=ktraynor@redhat.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=thomas@monjalon.net \
    --cc=yliu@fridaylinux.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;
as well as URLs for NNTP newsgroup(s).