DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] vhost: make destroy callback on VHOST_USER_RESET_OWNER
@ 2015-11-10  2:15 Rich Lane
  2015-11-10  2:25 ` Yuanhan Liu
  0 siblings, 1 reply; 5+ messages in thread
From: Rich Lane @ 2015-11-10  2:15 UTC (permalink / raw)
  To: dev; +Cc: changchun.ouyang

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(+)

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: make destroy callback on VHOST_USER_RESET_OWNER
  2015-11-10  2:15 [dpdk-dev] [PATCH] vhost: make destroy callback on VHOST_USER_RESET_OWNER Rich Lane
@ 2015-11-10  2:25 ` Yuanhan Liu
  2015-11-10  3:51   ` Tetsuya Mukawa
  2015-11-12 11:27   ` Thomas Monjalon
  0 siblings, 2 replies; 5+ messages in thread
From: Yuanhan Liu @ 2015-11-10  2:25 UTC (permalink / raw)
  To: Rich Lane; +Cc: dev

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: make destroy callback on VHOST_USER_RESET_OWNER
  2015-11-10  2:25 ` Yuanhan Liu
@ 2015-11-10  3:51   ` Tetsuya Mukawa
  2015-11-10  4:05     ` Yuanhan Liu
  2015-11-12 11:27   ` Thomas Monjalon
  1 sibling, 1 reply; 5+ messages in thread
From: Tetsuya Mukawa @ 2015-11-10  3:51 UTC (permalink / raw)
  To: Yuanhan Liu, Rich Lane; +Cc: dev

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: make destroy callback on VHOST_USER_RESET_OWNER
  2015-11-10  3:51   ` Tetsuya Mukawa
@ 2015-11-10  4:05     ` Yuanhan Liu
  0 siblings, 0 replies; 5+ messages in thread
From: Yuanhan Liu @ 2015-11-10  4:05 UTC (permalink / raw)
  To: Tetsuya Mukawa; +Cc: dev

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: make destroy callback on VHOST_USER_RESET_OWNER
  2015-11-10  2:25 ` Yuanhan Liu
  2015-11-10  3:51   ` Tetsuya Mukawa
@ 2015-11-12 11:27   ` Thomas Monjalon
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2015-11-12 11:27 UTC (permalink / raw)
  To: Rich Lane; +Cc: dev

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-11-12 11:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-10  2:15 [dpdk-dev] [PATCH] vhost: make destroy callback on VHOST_USER_RESET_OWNER Rich Lane
2015-11-10  2:25 ` Yuanhan Liu
2015-11-10  3:51   ` Tetsuya Mukawa
2015-11-10  4:05     ` Yuanhan Liu
2015-11-12 11:27   ` Thomas Monjalon

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).