qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for-2.12] tap: set vhostfd passed from qemu cli to non-blocking
@ 2018-04-06 12:03 Brijesh Singh
  2018-04-06 15:44 ` Eric Blake
  2018-04-09  5:51 ` Michael S. Tsirkin
  0 siblings, 2 replies; 4+ messages in thread
From: Brijesh Singh @ 2018-04-06 12:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas.Lendacky, Brijesh Singh, Michael S . Tsirkin, Jason Wang

A guest boot hangs while probing the network interface when
iommu_platform=on is used.

The following qemu cli hangs without this patch:

# $QEMU \
  -netdev tap,fd=3,id=hostnet0,vhost=on,vhostfd=4 3<>/dev/tap67 4<>/dev/host-net \
  -device virtio-net-pci,netdev=hostnet0,id=net0,iommu_platform=on,disable-legacy=on \
  ...

Commit: c471ad0e9bd46 (vhost_net: device IOTLB support) took care of
setting vhostfd to non-blocking when QEMU opens /dev/host-net but if
the fd is passed from qemu cli then we need to ensure that fd is set
to non-blocking.

Fixes: c471ad0e9bd46 "vhost_net: device IOTLB support"
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
---
 net/tap.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/tap.c b/net/tap.c
index 2b3a36f9b50d..8c026fbf95cd 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -693,6 +693,7 @@ static void net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,
                 }
                 return;
             }
+            fcntl(vhostfd, F_SETFL, O_NONBLOCK);
         } else {
             vhostfd = open("/dev/vhost-net", O_RDWR);
             if (vhostfd < 0) {
-- 
2.14.3

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

* Re: [Qemu-devel] [PATCH for-2.12] tap: set vhostfd passed from qemu cli to non-blocking
  2018-04-06 12:03 [Qemu-devel] [PATCH for-2.12] tap: set vhostfd passed from qemu cli to non-blocking Brijesh Singh
@ 2018-04-06 15:44 ` Eric Blake
  2018-04-06 16:08   ` Brijesh Singh
  2018-04-09  5:51 ` Michael S. Tsirkin
  1 sibling, 1 reply; 4+ messages in thread
From: Eric Blake @ 2018-04-06 15:44 UTC (permalink / raw)
  To: Brijesh Singh, qemu-devel
  Cc: Thomas.Lendacky, Jason Wang, Michael S . Tsirkin

[-- Attachment #1: Type: text/plain, Size: 1422 bytes --]

On 04/06/2018 07:03 AM, Brijesh Singh wrote:
> A guest boot hangs while probing the network interface when
> iommu_platform=on is used.
> 
> The following qemu cli hangs without this patch:
> 
> # $QEMU \
>   -netdev tap,fd=3,id=hostnet0,vhost=on,vhostfd=4 3<>/dev/tap67 4<>/dev/host-net \
>   -device virtio-net-pci,netdev=hostnet0,id=net0,iommu_platform=on,disable-legacy=on \
>   ...
> 
> Commit: c471ad0e9bd46 (vhost_net: device IOTLB support) took care of
> setting vhostfd to non-blocking when QEMU opens /dev/host-net but if
> the fd is passed from qemu cli then we need to ensure that fd is set
> to non-blocking.
> 
> Fixes: c471ad0e9bd46 "vhost_net: device IOTLB support"
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
> ---
>  net/tap.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/net/tap.c b/net/tap.c
> index 2b3a36f9b50d..8c026fbf95cd 100644
> --- a/net/tap.c
> +++ b/net/tap.c
> @@ -693,6 +693,7 @@ static void net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,
>                  }
>                  return;
>              }
> +            fcntl(vhostfd, F_SETFL, O_NONBLOCK);

Please use qemu_set_nonblock() instead.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]

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

* Re: [Qemu-devel] [PATCH for-2.12] tap: set vhostfd passed from qemu cli to non-blocking
  2018-04-06 15:44 ` Eric Blake
@ 2018-04-06 16:08   ` Brijesh Singh
  0 siblings, 0 replies; 4+ messages in thread
From: Brijesh Singh @ 2018-04-06 16:08 UTC (permalink / raw)
  To: Eric Blake, qemu-devel
  Cc: brijesh.singh, Thomas.Lendacky, Jason Wang, Michael S . Tsirkin



On 04/06/2018 10:44 AM, Eric Blake wrote:
> On 04/06/2018 07:03 AM, Brijesh Singh wrote:
>> A guest boot hangs while probing the network interface when
>> iommu_platform=on is used.
>>
>> The following qemu cli hangs without this patch:
>>
>> # $QEMU \
>>    -netdev tap,fd=3,id=hostnet0,vhost=on,vhostfd=4 3<>/dev/tap67 4<>/dev/host-net \
>>    -device virtio-net-pci,netdev=hostnet0,id=net0,iommu_platform=on,disable-legacy=on \
>>    ...
>>
>> Commit: c471ad0e9bd46 (vhost_net: device IOTLB support) took care of
>> setting vhostfd to non-blocking when QEMU opens /dev/host-net but if
>> the fd is passed from qemu cli then we need to ensure that fd is set
>> to non-blocking.
>>
>> Fixes: c471ad0e9bd46 "vhost_net: device IOTLB support"
>> Cc: Michael S. Tsirkin <mst@redhat.com>
>> Cc: Jason Wang <jasowang@redhat.com>
>> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
>> ---
>>   net/tap.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/net/tap.c b/net/tap.c
>> index 2b3a36f9b50d..8c026fbf95cd 100644
>> --- a/net/tap.c
>> +++ b/net/tap.c
>> @@ -693,6 +693,7 @@ static void net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,
>>                   }
>>                   return;
>>               }
>> +            fcntl(vhostfd, F_SETFL, O_NONBLOCK);
> 
> Please use qemu_set_nonblock() instead.
> 


Sure will do.

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

* Re: [Qemu-devel] [PATCH for-2.12] tap: set vhostfd passed from qemu cli to non-blocking
  2018-04-06 12:03 [Qemu-devel] [PATCH for-2.12] tap: set vhostfd passed from qemu cli to non-blocking Brijesh Singh
  2018-04-06 15:44 ` Eric Blake
@ 2018-04-09  5:51 ` Michael S. Tsirkin
  1 sibling, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2018-04-09  5:51 UTC (permalink / raw)
  To: Brijesh Singh; +Cc: qemu-devel, Thomas.Lendacky, Jason Wang

On Fri, Apr 06, 2018 at 07:03:56AM -0500, Brijesh Singh wrote:
> A guest boot hangs while probing the network interface when
> iommu_platform=on is used.
> 
> The following qemu cli hangs without this patch:
> 
> # $QEMU \
>   -netdev tap,fd=3,id=hostnet0,vhost=on,vhostfd=4 3<>/dev/tap67 4<>/dev/host-net \
>   -device virtio-net-pci,netdev=hostnet0,id=net0,iommu_platform=on,disable-legacy=on \
>   ...
> 
> Commit: c471ad0e9bd46 (vhost_net: device IOTLB support) took care of
> setting vhostfd to non-blocking when QEMU opens /dev/host-net but if
> the fd is passed from qemu cli then we need to ensure that fd is set
> to non-blocking.
> 
> Fixes: c471ad0e9bd46 "vhost_net: device IOTLB support"
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>

Reviewed-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  net/tap.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/net/tap.c b/net/tap.c
> index 2b3a36f9b50d..8c026fbf95cd 100644
> --- a/net/tap.c
> +++ b/net/tap.c
> @@ -693,6 +693,7 @@ static void net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,
>                  }
>                  return;
>              }
> +            fcntl(vhostfd, F_SETFL, O_NONBLOCK);
>          } else {
>              vhostfd = open("/dev/vhost-net", O_RDWR);
>              if (vhostfd < 0) {
> -- 
> 2.14.3

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

end of thread, other threads:[~2018-04-09  5:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-06 12:03 [Qemu-devel] [PATCH for-2.12] tap: set vhostfd passed from qemu cli to non-blocking Brijesh Singh
2018-04-06 15:44 ` Eric Blake
2018-04-06 16:08   ` Brijesh Singh
2018-04-09  5:51 ` Michael S. Tsirkin

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