From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id E67345A83 for ; Wed, 12 Aug 2015 05:34:53 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP; 11 Aug 2015 20:34:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,658,1432623600"; d="scan'208";a="766927481" Received: from pgsmsx104.gar.corp.intel.com ([10.221.44.91]) by fmsmga001.fm.intel.com with ESMTP; 11 Aug 2015 20:34:52 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by PGSMSX104.gar.corp.intel.com (10.221.44.91) with Microsoft SMTP Server (TLS) id 14.3.224.2; Wed, 12 Aug 2015 11:34:50 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.18]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.45]) with mapi id 14.03.0224.002; Wed, 12 Aug 2015 11:34:49 +0800 From: "Xie, Huawei" To: Jan Kiszka , "dev@dpdk.org" Thread-Topic: [PATCH] vchost: Notify application of ownership change Thread-Index: AdDUr9bUsBUNER7rT6KBk5jMib3rsw== Date: Wed, 12 Aug 2015 03:34:48 +0000 Message-ID: References: <55C4E8E1.9090406@siemens.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] vchost: Notify application of ownership change X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Aug 2015 03:34:54 -0000 On 8/8/2015 1:21 AM, Jan Kiszka wrote:=0A= > On VHOST_*_RESET_OWNER, we reinitialize the device but without telling=0A= > the application. That will cause crashes when it continues to invoke=0A= > vhost services on the device. Fix it by calling the destruction hook if= =0A= > the device is still in use.=0A= >=0A= > Signed-off-by: Jan Kiszka =0A= > ---=0A= >=0A= > This is the surprisingly simple answer to my questions in=0A= > http://thread.gmane.org/gmane.comp.networking.dpdk.devel/22661.=0A= >=0A= > lib/librte_vhost/virtio-net.c | 3 +++=0A= > 1 file changed, 3 insertions(+)=0A= >=0A= > diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.= c=0A= > index b520ec5..3c5b5b2 100644=0A= > --- a/lib/librte_vhost/virtio-net.c=0A= > +++ b/lib/librte_vhost/virtio-net.c=0A= > @@ -402,6 +402,9 @@ reset_owner(struct vhost_device_ctx ctx)=0A= >=0A= > ll_dev =3D get_config_ll_entry(ctx);=0A= >=0A= > + if ((ll_dev->dev.flags & VIRTIO_DEV_RUNNING))=0A= > + notify_ops->destroy_device(&ll_dev->dev);=0A= =0A= To me this patch makes sense here.=0A= Whether RESET_OWNER is really needed is another question. Whenever the=0A= vhost itself needs to process the vhost device, we need to notify the=0A= switch application to remove it from data plane.=0A= > +=0A= > cleanup_device(&ll_dev->dev);=0A= > init_device(&ll_dev->dev);=0A= >=0A= =0A=