Message ID | 1447121713-12095-1-git-send-email-rlane@bigswitch.com (mailing list archive) |
---|---|
State | Accepted, archived |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 7B832591E; Tue, 10 Nov 2015 03:15:23 +0100 (CET) Received: from mail-pa0-f47.google.com (mail-pa0-f47.google.com [209.85.220.47]) by dpdk.org (Postfix) with ESMTP id 6904B3979 for <dev@dpdk.org>; Tue, 10 Nov 2015 03:15:22 +0100 (CET) Received: by pabfh17 with SMTP id fh17so218211672pab.0 for <dev@dpdk.org>; Mon, 09 Nov 2015 18:15:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bigswitch_com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=nSzu+VLnXY+bLroGR+kZ7qZczjU3l/ynFfWJ10u2ZYQ=; b=lzmaO1IUa6bSMmMBk8/brPhUuRl6rQvrO3m2gkXnJClkpqi5ocxNkotD+CCmStEWHH 6MRsczZbrQjLzN+3773mRVG0aIEGbtB24naph0hrQF4JNAoc8FV0azqWuvmBzrWtKXzN KnKv5ePWOe6AKm3rDwojPsDdhfYeHu3vhc15BXGw+BvFQXEWFb29A6dgAPGoQ8maSpyb dO6qkzVQChyc/sPOCXW/g362VTqKu2N8KwKz4NoCs7w4HTRWH7OEUfJcqTDi31WuGJh7 KR4YNi4OZU0I9v/BDTIoxuVqOZVP3L/rfzHgZeqWWijcEGZQEwq6H92+0+eNUOdyUd6H x3Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=nSzu+VLnXY+bLroGR+kZ7qZczjU3l/ynFfWJ10u2ZYQ=; b=I8xckDp11fh/ykNqSbgHBNBaqVq121T4PTL1kczQEmlbWQTfzByQTTJNArRaKQsdCh ZeJo7OCXBNU62DzvXTOaya4rZLL+rnflNh3cWXwdTR8Zd8LDe3UkgnMFxG8s3Q8QkMH/ z2Zo/N7D7nPtjbA6Zqf6fPGDrvhit+679bAfmo2fUx/pCIGJD58r7LvoDhayw0ifi51G hCeFXfZRvn6VCLObsLrbwND0SoIMh2pfkmOOUVBXj6kdbt2Z0t7n5alAm4Lkw/MWjnu/ tzInxHnlRqyFATmQRl0KwuoM++iObE/5gDhmlPVjh1KD8Gu3YGNRGP5exE+EzKi2wTqX bKcQ== X-Gm-Message-State: ALoCoQlfUHvJmo3VWAlhBpMxa027NE1Eod2/Vl/XDXhQbQ4xzDEykReaVoSH8wKJiOfjokHUeu2e X-Received: by 10.66.199.5 with SMTP id jg5mr1830567pac.72.1447121721568; Mon, 09 Nov 2015 18:15:21 -0800 (PST) Received: from rlane-work.eng.bigswitch.com (c-67-188-28-208.hsd1.ca.comcast.net. [67.188.28.208]) by smtp.gmail.com with ESMTPSA id f3sm706479pas.36.2015.11.09.18.15.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Nov 2015 18:15:21 -0800 (PST) From: Rich Lane <rich.lane@bigswitch.com> X-Google-Original-From: Rich Lane <rlane@bigswitch.com> To: dev@dpdk.org Date: Mon, 9 Nov 2015 18:15:13 -0800 Message-Id: <1447121713-12095-1-git-send-email-rlane@bigswitch.com> X-Mailer: git-send-email 1.9.1 Cc: changchun.ouyang@intel.com Subject: [dpdk-dev] [PATCH] vhost: make destroy callback on VHOST_USER_RESET_OWNER X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK <dev.dpdk.org> List-Unsubscribe: <http://dpdk.org/ml/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://dpdk.org/ml/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <http://dpdk.org/ml/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Commit Message
Rich Lane
Nov. 10, 2015, 2:15 a.m. UTC
QEMU sends this message first when shutting down. There was previously no way
for the dataplane to know that the virtio_net instance had become unusable and
it would segfault when trying to do RX/TX.
Signed-off-by: Rich Lane <rlane@bigswitch.com>
---
lib/librte_vhost/virtio-net.c | 3 +++
1 file changed, 3 insertions(+)
Comments
On Mon, Nov 09, 2015 at 06:15:13PM -0800, Rich Lane wrote: > QEMU sends this message first when shutting down. There was previously no way > for the dataplane to know that the virtio_net instance had become unusable and > it would segfault when trying to do RX/TX. > > Signed-off-by: Rich Lane <rlane@bigswitch.com> Thanks. Even I have same patch in my patch queue (I have some other issues to fix), you got my ack. Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com> --yliu > --- > lib/librte_vhost/virtio-net.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c > index 14278de..39a6a5e 100644 > --- a/lib/librte_vhost/virtio-net.c > +++ b/lib/librte_vhost/virtio-net.c > @@ -436,6 +436,9 @@ reset_owner(struct vhost_device_ctx ctx) > if (dev == NULL) > return -1; > > + if (dev->flags & VIRTIO_DEV_RUNNING) > + notify_ops->destroy_device(dev); > + > device_fh = dev->device_fh; > cleanup_device(dev); > init_device(dev); > -- > 1.9.1
On 2015/11/10 11:25, Yuanhan Liu wrote: > On Mon, Nov 09, 2015 at 06:15:13PM -0800, Rich Lane wrote: >> QEMU sends this message first when shutting down. There was previously no way >> for the dataplane to know that the virtio_net instance had become unusable and >> it would segfault when trying to do RX/TX. >> >> Signed-off-by: Rich Lane <rlane@bigswitch.com> > Thanks. Even I have same patch in my patch queue (I have some other > issues to fix), you got my ack. > > Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com> > > --yliu > Hi Liu and Rich, How about saving "dev->ifname" while processing reset_owner like "dev->device_fh"? It was only set when connection is established. But so far, it will be cleared when reset_owner message comes. Probably it should be cleared when unix domain socket connection is closed. Thanks, Tetsuya >> --- >> lib/librte_vhost/virtio-net.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c >> index 14278de..39a6a5e 100644 >> --- a/lib/librte_vhost/virtio-net.c >> +++ b/lib/librte_vhost/virtio-net.c >> @@ -436,6 +436,9 @@ reset_owner(struct vhost_device_ctx ctx) >> if (dev == NULL) >> return -1; >> >> + if (dev->flags & VIRTIO_DEV_RUNNING) >> + notify_ops->destroy_device(dev); >> + >> device_fh = dev->device_fh; >> cleanup_device(dev); >> init_device(dev); >> -- >> 1.9.1
On Tue, Nov 10, 2015 at 12:51:42PM +0900, Tetsuya Mukawa wrote: > On 2015/11/10 11:25, Yuanhan Liu wrote: > > On Mon, Nov 09, 2015 at 06:15:13PM -0800, Rich Lane wrote: > >> QEMU sends this message first when shutting down. There was previously no way > >> for the dataplane to know that the virtio_net instance had become unusable and > >> it would segfault when trying to do RX/TX. > >> > >> Signed-off-by: Rich Lane <rlane@bigswitch.com> > > Thanks. Even I have same patch in my patch queue (I have some other > > issues to fix), you got my ack. > > > > Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com> > > > > --yliu > > > > Hi Liu and Rich, > > How about saving "dev->ifname" while processing reset_owner like > "dev->device_fh"? > It was only set when connection is established. > But so far, it will be cleared when reset_owner message comes. > Probably it should be cleared when unix domain socket connection is closed. Yes, you are right, and I was thinking (and doing) same stuff. And we may need save few more fields. (For Thomas, this patch is still needed). --yliu > > >> --- > >> lib/librte_vhost/virtio-net.c | 3 +++ > >> 1 file changed, 3 insertions(+) > >> > >> diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c > >> index 14278de..39a6a5e 100644 > >> --- a/lib/librte_vhost/virtio-net.c > >> +++ b/lib/librte_vhost/virtio-net.c > >> @@ -436,6 +436,9 @@ reset_owner(struct vhost_device_ctx ctx) > >> if (dev == NULL) > >> return -1; > >> > >> + if (dev->flags & VIRTIO_DEV_RUNNING) > >> + notify_ops->destroy_device(dev); > >> + > >> device_fh = dev->device_fh; > >> cleanup_device(dev); > >> init_device(dev); > >> -- > >> 1.9.1
2015-11-10 10:25, Yuanhan Liu: > On Mon, Nov 09, 2015 at 06:15:13PM -0800, Rich Lane wrote: > > QEMU sends this message first when shutting down. There was previously no way > > for the dataplane to know that the virtio_net instance had become unusable and > > it would segfault when trying to do RX/TX. > > > > Signed-off-by: Rich Lane <rlane@bigswitch.com> > > Thanks. Even I have same patch in my patch queue (I have some other > issues to fix), you got my ack. > > Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com> Applied, thanks
diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c index 14278de..39a6a5e 100644 --- a/lib/librte_vhost/virtio-net.c +++ b/lib/librte_vhost/virtio-net.c @@ -436,6 +436,9 @@ reset_owner(struct vhost_device_ctx ctx) if (dev == NULL) return -1; + if (dev->flags & VIRTIO_DEV_RUNNING) + notify_ops->destroy_device(dev); + device_fh = dev->device_fh; cleanup_device(dev); init_device(dev);