qemu-freebsd: fixes for running Xen guests
v2 cover qemu-freebsd: fixes for running Xen guests
This three patches allow FreeBSD Xen Dom0 to use Qemu (i.e., launch HVM guests).
First patch fixes the usage of ENODATA, which doesn't exist on FreeBSD and is replaced with ENOENT instead.
The second patch is more controversial probably, since it introduces a FreeBSD specific version of tap_open which behaves like it's Linux counterpart, allowing Qemu to create tap interfaces and rename them. I've decided to just fork the function instead of adding a bunch more of preprocessor code in the original function.
Last patch adds G_IO_HUP to calls to qemu_chr_fe_add_watch so they behave the same way on both FreeBSD and Linux (see the commit message for the rationale).
Thanks for the review, Roger.
PATCH v2 1/3 xen: fix usage of ENODATA
ENODATA doesn't exist on FreeBSD, so ENODATA errors returned by the hypervisor are translated to ENOENT.
Also, the error code is returned in errno if the call returns -1, so compare the error code with the value in errno instead of the value returned by the function.
---
Changes since v1:
- Define ENODATA to ENOENT for platforms that don't have ENODATA.
--- xen-hvm.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
xen-hvm.c +5 -2
@@ -499,11 +499,14 @@ static void xen_sync_dirty_bitmap(XenIOState *state, start_addr >>TARGET_PAGE_BITS , npages, bitmap);if (rc <0 ) { -if (rc != -ENODATA ) { +#ifndef ENODATA +#define ENODATA ENOENT +#endif +if (errno ==ENODATA ) {memory_region_set_dirty (framebuffer,0 , size);DPRINTF ("xen: track_dirty_vram failed (0x" TARGET_FMT_plx", 0x" TARGET_FMT_plx"): %s\n" , - start_addr, start_addr + size,strerror (-rc)); + start_addr, start_addr + size,strerror (errno)); }return ; }
Signature · 7 lines
1.7.7.5 (Apple Git-26) _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
PATCH v2 1/3 xen: fix usage of ENODATA
In reply to Roger Pau MonneENODATA doesn't exist on FreeBSD, so ENODATA errors returned by the hypervisor are translated to ENOENT.
Also, the error code is returned in errno if the call returns -1, so compare the error code with the value in errno instead of the value returned by the function.
---
Changes since v1:
- Define ENODATA to ENOENT for platforms that don't have ENODATA.
--- xen-hvm.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
xen-hvm.c +5 -2
@@ -499,11 +499,14 @@ static void xen_sync_dirty_bitmap(XenIOState *state, start_addr >>TARGET_PAGE_BITS , npages, bitmap);if (rc <0 ) { -if (rc != -ENODATA ) { +#ifndef ENODATA +#define ENODATA ENOENT +#endif +if (errno ==ENODATA ) {memory_region_set_dirty (framebuffer,0 , size);DPRINTF ("xen: track_dirty_vram failed (0x" TARGET_FMT_plx", 0x" TARGET_FMT_plx"): %s\n" , - start_addr, start_addr + size,strerror (-rc)); + start_addr, start_addr + size,strerror (errno)); }return ; }
Signature · 1 line
1.7.7.5 (Apple Git-26)
Re: [PATCH v2 1/3] xen: fix usage of ENODATA
Quoted 23 lines · Roger Pau Monne
ENODATA doesn't exist on FreeBSD, so ENODATA errors returned by the hypervisor are translated to ENOENT.
Also, the error code is returned in errno if the call returns -1, so compare the error code with the value in errno instead of the value returned by the function.
Signed-off-by Roger Pau Monné <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Anthony Perard <[email protected]>---
Changes since v1:
- Define ENODATA to ENOENT for platforms that don't have ENODATA.--- xen-hvm.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)xen-hvm.c +0
-0
xen-hvm.c static void xen_sync_dirty_bitmap(XenIOState *state, · line 504
Quoted 7 lines
xen-hvm.c +3
-1@@ -499,11 +499,14 @@ static void xen_sync_dirty_bitmap(XenIOState *state, start_addr >>TARGET_PAGE_BITS , npages, bitmap);if (rc <0 ) { -if (rc != -ENODATA ) { +#ifndef ENODATA +#define ENODATA ENOENT +#endif
I wonder if it makes sense to have this in a more generic header, lile include/qemu/osdep.h?
Quoted 12 lines
xen-hvm.c +2
-1+if (errno ==ENODATA ) {memory_region_set_dirty (framebuffer,0 , size);DPRINTF ("xen: track_dirty_vram failed (0x" TARGET_FMT_plx", 0x" TARGET_FMT_plx"): %s\n" , - start_addr, start_addr + size,strerror (-rc)); + start_addr, start_addr + size,strerror (errno)); }return ; }Signature · 1 line
1.7.7.5 (Apple Git-26)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 1/3] xen: fix usage of ENODATA
Quoted 19 lines · Stefano Stabellini
Quoted 18 lines · Roger Pau Monne
ENODATA doesn't exist on FreeBSD, so ENODATA errors returned by the hypervisor are translated to ENOENT.
Also, the error code is returned in errno if the call returns -1, so compare the error code with the value in errno instead of the value returned by the function.
Signed-off-by Roger Pau Monné <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Anthony Perard <[email protected]>---
Changes since v1:
- Define ENODATA to ENOENT for platforms that don't have ENODATA.--- xen-hvm.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
Quoted 15 lines
xen-hvm.c static void xen_sync_dirty_bitmap(XenIOState *state, · line 504
Quoted 12 lines
xen-hvm.c +3
-1@@ -499,11 +499,14 @@ static void xen_sync_dirty_bitmap(XenIOState *state, start_addr >>TARGET_PAGE_BITS , npages, bitmap);if (rc <0 ) { -if (rc != -ENODATA ) { +#ifndef ENODATA +#define ENODATA ENOENT +#endif I wonder if it makes sense to have this in a more generic header, lile
include/qemu/osdep.h?
Well, I think this is something really specific to Xen, because FreeBSD is mapping the error returned by Xen (ENODATA), to a error code available on FreeBSD (ENOENT), see:
But I don't think this is useful outside of this context, since there's no syscall that would return ENODATA on FreeBSD that instead returns ENOENT. All the paths in Qemu that check for ENODATA are Linux specific AFAICT.
Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [Qemu-devel] [PATCH v2 1/3] xen: fix usage of ENODATA
Quoted 40 lines · Roger Pau Monné
Quoted 19 lines · Stefano Stabellini
Quoted 18 lines · Roger Pau Monne
ENODATA doesn't exist on FreeBSD, so ENODATA errors returned by the hypervisor are translated to ENOENT.
Also, the error code is returned in errno if the call returns -1, so compare the error code with the value in errno instead of the value returned by the function.
Signed-off-by Roger Pau Monné <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Anthony Perard <[email protected]>---
Changes since v1:
- Define ENODATA to ENOENT for platforms that don't have ENODATA.--- xen-hvm.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)Quoted 15 lines
xen-hvm.c static void xen_sync_dirty_bitmap(XenIOState *state, · line 504
Quoted 12 lines
xen-hvm.c +3
-1@@ -499,11 +499,14 @@ static void xen_sync_dirty_bitmap(XenIOState *state, start_addr >>TARGET_PAGE_BITS , npages, bitmap);if (rc <0 ) { -if (rc != -ENODATA ) { +#ifndef ENODATA +#define ENODATA ENOENT +#endif I wonder if it makes sense to have this in a more generic header, lile
include/qemu/osdep.h?Well, I think this is something really specific to Xen, because FreeBSD is mapping the error returned by Xen (ENODATA), to a error code available on FreeBSD (ENOENT), see:
Quoted 6 lines
But I don't think this is useful outside of this context, since there's no syscall that would return ENODATA on FreeBSD that instead returns ENOENT. All the paths in Qemu that check for ENODATA are Linux specific AFAICT.
Fair enough. In that case the patch is fine as it is.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH v2 2/3 tap-bsd: implement a FreeBSD only version of tap_open
In reply to Roger Pau MonneThe current behaviour of tap_open for BSD systems differ greatly from it's Linux counterpart. Since FreeBSD supports interface renaming and tap device cloning by opening /dev/tap, implement a FreeBSD specific version of tap_open that behaves like it's Linux counterpart.
This is specially important for toolstacks that use Qemu (like Xen libxl), in order to have a unified behaviour across suported platforms.
--- net/tap-bsd.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 69 insertions(+), 1 deletions(-)
net/tap-bsd.c +69 -1
@@ -27,12 +27,13 @@#include "sysemu/sysemu.h" #include "qemu/error-report.h" -#ifdef __NetBSD__ +#if defined(__NetBSD__) || defined(__FreeBSD__)#include <sys/ioctl.h> #include <net/if.h> #include <net/if_tap.h> #endif +#ifndef __FreeBSD__int tap_open (char *ifname,int ifname_size,int *vnet_hdr,int vnet_hdr_required,int mq_required) {
@@ -108,6 +109,73 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr,return fd; } +#else /* __FreeBSD__ */ + +#define PATH_NET_TAP "/dev/tap" + +int tap_open (char *ifname,int ifname_size,int *vnet_hdr, +int vnet_hdr_required,int mq_required) +{ +int fd, s, ret; +struct ifreq ifr; + +TFR (fd =open (PATH_NET_TAP ,O_RDWR )); +if (fd <0 ) { +error_report ("could not open %s: %s" ,PATH_NET_TAP ,strerror (errno)); +return -1 ; + } + +memset (&ifr,0 ,sizeof (ifr)); + + ret =ioctl (fd,TAPGIFNAME , (void *)&ifr); +if (ret <0 ) { +error_report ("could not get tap interface name" ); + goto error; + } + +if (ifname[0 ] !='\0' ) { +/* User requested the interface to have a specific name */ + s =socket (AF_LOCAL ,SOCK_DGRAM ,0 ); +if (s <0 ) { +error_report ("could not open socket to set interface name" ); + goto error; + } + ifr.ifr_data = ifname; + ret =ioctl (s,SIOCSIFNAME , (void *)&ifr); +close (s); +if (ret <0 ) { +error_report ("could not set tap interface name" ); + goto error; + } + }else { +pstrcpy (ifname, ifname_size, ifr.ifr_name); + } + +if (*vnet_hdr) { +/* BSD doesn't have IFF_VNET_HDR */ + *vnet_hdr =0 ; + +if (vnet_hdr_required && !*vnet_hdr) { +error_report ("vnet_hdr=1 requested, but no kernel " +"support for IFF_VNET_HDR available" ); + goto error; + } + } +if (mq_required) { +error_report ("mq_required requested, but not kernel support" +"for IFF_MULTI_QUEUE available" ); + goto error; + } + +fcntl (fd,F_SETFL ,O_NONBLOCK ); +return fd; + +error: +close (fd); +return -1 ; +} +#endif /* __FreeBSD__ */ +int tap_set_sndbuf (int fd,const NetdevTapOptions *tap) {return 0 ;
Signature · 7 lines
1.7.7.5 (Apple Git-26) _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] tap-bsd: implement a FreeBSD only version of tap_open
Quoted 9 lines · Roger Pau Monne
The current behaviour of
tap_openfor BSD systems differ greatly from it's Linux counterpart. Since FreeBSD supports interface renaming and tap device cloning by opening/dev/tap, implement a FreeBSD specific version oftap_openthat behaves like it's Linux counterpart.This is specially important for toolstacks that use Qemu (like Xen libxl), in order to have a unified behaviour across suported platforms.
Quoted 8 lines
Signed-off-by Roger Pau Monné <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Anthony Liguori <[email protected]>Cc Stefan Hajnoczi <[email protected]>--- net/tap-bsd.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 69 insertions(+), 1 deletions(-)
Re: [Qemu-devel] [PATCH v2 2/3] tap-bsd: implement a FreeBSD only version of tap_open
Quoted 19 lines · Stefan Hajnoczi
Quoted 9 lines · Roger Pau Monne
The current behaviour of
tap_openfor BSD systems differ greatly from it's Linux counterpart. Since FreeBSD supports interface renaming and tap device cloning by opening/dev/tap, implement a FreeBSD specific version oftap_openthat behaves like it's Linux counterpart.This is specially important for toolstacks that use Qemu (like Xen libxl), in order to have a unified behaviour across suported platforms.
Quoted 8 lines
Signed-off-by Roger Pau Monné <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Anthony Liguori <[email protected]>Cc Stefan Hajnoczi <[email protected]>--- net/tap-bsd.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 69 insertions(+), 1 deletions(-)
Quoted 1 line
Reviewed-by Stefan Hajnoczi <[email protected]>
I still don't see this committed to the repository, should I ping someone?
Thanks, Roger.
Re: [PATCH v2 2/3] tap-bsd: implement a FreeBSD only version of tap_open
Quoted 20 lines · Roger Pau Monné
Quoted 19 lines · Stefan Hajnoczi
Quoted 17 lines · Roger Pau Monne
The current behaviour of
tap_openfor BSD systems differ greatly from it's Linux counterpart. Since FreeBSD supports interface renaming and tap device cloning by opening/dev/tap, implement a FreeBSD specific version oftap_openthat behaves like it's Linux counterpart.This is specially important for toolstacks that use Qemu (like Xen libxl), in order to have a unified behaviour across suported platforms.
Signed-off-by Roger Pau Monné <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Anthony Liguori <[email protected]>Cc Stefan Hajnoczi <[email protected]>--- net/tap-bsd.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 69 insertions(+), 1 deletions(-)
Quoted 3 lines
Quoted 1 line
Reviewed-by Stefan Hajnoczi <[email protected]>I still don't see this committed to the repository, should I ping someone?
I was assuming that this patch would go via some other tree. But if Stefan is OK I could pick it up and submit a pull request for both patch 1 and 2 of this series.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [Qemu-devel] [PATCH v2 2/3] tap-bsd: implement a FreeBSD only version of tap_open
In reply to Roger Pau MonnéQuoted 20 lines · Roger Pau Monné
Quoted 19 lines · Stefan Hajnoczi
Quoted 17 lines · Roger Pau Monne
The current behaviour of
tap_openfor BSD systems differ greatly from it's Linux counterpart. Since FreeBSD supports interface renaming and tap device cloning by opening/dev/tap, implement a FreeBSD specific version oftap_openthat behaves like it's Linux counterpart.This is specially important for toolstacks that use Qemu (like Xen libxl), in order to have a unified behaviour across suported platforms.
Signed-off-by Roger Pau Monné <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Anthony Liguori <[email protected]>Cc Stefan Hajnoczi <[email protected]>--- net/tap-bsd.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 69 insertions(+), 1 deletions(-)
Quoted 3 lines
Quoted 1 line
Reviewed-by Stefan Hajnoczi <[email protected]>I still don't see this committed to the repository, should I ping someone?
I was assuming that this patch would go via some other tree. But if Stefan is OK I could pick it up and submit a pull request for both patch 1 and 2 of this series.
Re: [Qemu-devel] [PATCH v2 2/3] tap-bsd: implement a FreeBSD only version of tap_open
Quoted 21 lines · Stefano Stabellini
Quoted 20 lines · Roger Pau Monné
Quoted 19 lines · Stefan Hajnoczi
Quoted 17 lines · Roger Pau Monne
The current behaviour of
tap_openfor BSD systems differ greatly from it's Linux counterpart. Since FreeBSD supports interface renaming and tap device cloning by opening/dev/tap, implement a FreeBSD specific version oftap_openthat behaves like it's Linux counterpart.This is specially important for toolstacks that use Qemu (like Xen libxl), in order to have a unified behaviour across suported platforms.
Signed-off-by Roger Pau Monné <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Anthony Liguori <[email protected]>Cc Stefan Hajnoczi <[email protected]>--- net/tap-bsd.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 69 insertions(+), 1 deletions(-)
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Reviewed-by Stefan Hajnoczi <[email protected]>I still don't see this committed to the repository, should I ping someone?
I was assuming that this patch would go via some other tree. But if Stefan is OK I could pick it up and submit a pull request for both patch 1 and 2 of this series.
I'm fine with that. I only reviewed this patch since it affects the net subsystem and left the series as a whole for someone to merge.
Stefan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [Qemu-devel] [PATCH v2 2/3] tap-bsd: implement a FreeBSD only version of tap_open
In reply to Stefano StabelliniQuoted 21 lines · Stefano Stabellini
Quoted 20 lines · Roger Pau Monné
Quoted 19 lines · Stefan Hajnoczi
Quoted 17 lines · Roger Pau Monne
The current behaviour of
tap_openfor BSD systems differ greatly from it's Linux counterpart. Since FreeBSD supports interface renaming and tap device cloning by opening/dev/tap, implement a FreeBSD specific version oftap_openthat behaves like it's Linux counterpart.This is specially important for toolstacks that use Qemu (like Xen libxl), in order to have a unified behaviour across suported platforms.
Signed-off-by Roger Pau Monné <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Anthony Liguori <[email protected]>Cc Stefan Hajnoczi <[email protected]>--- net/tap-bsd.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 69 insertions(+), 1 deletions(-)
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Reviewed-by Stefan Hajnoczi <[email protected]>I still don't see this committed to the repository, should I ping someone?
I was assuming that this patch would go via some other tree. But if Stefan is OK I could pick it up and submit a pull request for both patch 1 and 2 of this series.
I'm fine with that. I only reviewed this patch since it affects the net subsystem and left the series as a whole for someone to merge.
Stefan
Re: [PATCH v2 2/3] tap-bsd: implement a FreeBSD only version of tap_open
In reply to Stefano StabelliniQuoted 21 lines · Stefano Stabellini
Quoted 20 lines · Roger Pau Monné
Quoted 19 lines · Stefan Hajnoczi
Quoted 17 lines · Roger Pau Monne
The current behaviour of
tap_openfor BSD systems differ greatly from it's Linux counterpart. Since FreeBSD supports interface renaming and tap device cloning by opening/dev/tap, implement a FreeBSD specific version oftap_openthat behaves like it's Linux counterpart.This is specially important for toolstacks that use Qemu (like Xen libxl), in order to have a unified behaviour across suported platforms.
Signed-off-by Roger Pau Monné <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Anthony Liguori <[email protected]>Cc Stefan Hajnoczi <[email protected]>--- net/tap-bsd.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 69 insertions(+), 1 deletions(-)
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Reviewed-by Stefan Hajnoczi <[email protected]>I still don't see this committed to the repository, should I ping someone?
I was assuming that this patch would go via some other tree. But if Stefan is OK I could pick it up and submit a pull request for both patch 1 and 2 of this series.
Would you do the backport of those three patches (one is already committed as e02bc6) to the qemu-xen repo at the same time, or would you like me to remind you about this in a month or so?
I would really like to have all this patches in Xen 4.5 if possible.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [Qemu-devel] [PATCH v2 2/3] tap-bsd: implement a FreeBSD only version of tap_open
In reply to Stefano StabelliniQuoted 21 lines · Stefano Stabellini
Quoted 20 lines · Roger Pau Monné
Quoted 19 lines · Stefan Hajnoczi
Quoted 17 lines · Roger Pau Monne
The current behaviour of
tap_openfor BSD systems differ greatly from it's Linux counterpart. Since FreeBSD supports interface renaming and tap device cloning by opening/dev/tap, implement a FreeBSD specific version oftap_openthat behaves like it's Linux counterpart.This is specially important for toolstacks that use Qemu (like Xen libxl), in order to have a unified behaviour across suported platforms.
Signed-off-by Roger Pau Monné <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Anthony Liguori <[email protected]>Cc Stefan Hajnoczi <[email protected]>--- net/tap-bsd.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 69 insertions(+), 1 deletions(-)
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Reviewed-by Stefan Hajnoczi <[email protected]>I still don't see this committed to the repository, should I ping someone?
I was assuming that this patch would go via some other tree. But if Stefan is OK I could pick it up and submit a pull request for both patch 1 and 2 of this series.
Would you do the backport of those three patches (one is already committed as e02bc6) to the qemu-xen repo at the same time, or would you like me to remind you about this in a month or so?
I would really like to have all this patches in Xen 4.5 if possible.
Thanks, Roger.
Re: [PATCH v2 2/3] tap-bsd: implement a FreeBSD only version of tap_open
Quoted 30 lines · Roger Pau Monné
Quoted 21 lines · Stefano Stabellini
Quoted 20 lines · Roger Pau Monné
Quoted 19 lines · Stefan Hajnoczi
Quoted 17 lines · Roger Pau Monne
The current behaviour of
tap_openfor BSD systems differ greatly from it's Linux counterpart. Since FreeBSD supports interface renaming and tap device cloning by opening/dev/tap, implement a FreeBSD specific version oftap_openthat behaves like it's Linux counterpart.This is specially important for toolstacks that use Qemu (like Xen libxl), in order to have a unified behaviour across suported platforms.
Signed-off-by Roger Pau Monné <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Anthony Liguori <[email protected]>Cc Stefan Hajnoczi <[email protected]>--- net/tap-bsd.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 69 insertions(+), 1 deletions(-)Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Reviewed-by Stefan Hajnoczi <[email protected]>I still don't see this committed to the repository, should I ping someone?
I was assuming that this patch would go via some other tree. But if Stefan is OK I could pick it up and submit a pull request for both patch 1 and 2 of this series.
Quoted 5 lines
Would you do the backport of those three patches (one is already committed as e02bc6) to the qemu-xen repo at the same time, or would you like me to remind you about this in a month or so?
I would really like to have all this patches in Xen 4.5 if possible.
I should remember when I'll send a pull request (when 2.1 will be out). But please remind me if I'll forget.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [Qemu-devel] [PATCH v2 2/3] tap-bsd: implement a FreeBSD only version of tap_open
In reply to Roger Pau MonnéQuoted 30 lines · Roger Pau Monné
Quoted 21 lines · Stefano Stabellini
Quoted 20 lines · Roger Pau Monné
Quoted 19 lines · Stefan Hajnoczi
Quoted 17 lines · Roger Pau Monne
The current behaviour of
tap_openfor BSD systems differ greatly from it's Linux counterpart. Since FreeBSD supports interface renaming and tap device cloning by opening/dev/tap, implement a FreeBSD specific version oftap_openthat behaves like it's Linux counterpart.This is specially important for toolstacks that use Qemu (like Xen libxl), in order to have a unified behaviour across suported platforms.
Signed-off-by Roger Pau Monné <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Anthony Liguori <[email protected]>Cc Stefan Hajnoczi <[email protected]>--- net/tap-bsd.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 69 insertions(+), 1 deletions(-)Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Reviewed-by Stefan Hajnoczi <[email protected]>I still don't see this committed to the repository, should I ping someone?
I was assuming that this patch would go via some other tree. But if Stefan is OK I could pick it up and submit a pull request for both patch 1 and 2 of this series.
Quoted 5 lines
Would you do the backport of those three patches (one is already committed as e02bc6) to the qemu-xen repo at the same time, or would you like me to remind you about this in a month or so?
I would really like to have all this patches in Xen 4.5 if possible.
I should remember when I'll send a pull request (when 2.1 will be out). But please remind me if I'll forget.
PATCH v2 3/3 serial: poll the serial console with G_IO_HUP
In reply to Roger Pau MonneOn FreeBSD polling a master pty while the other end is not connected with G_IO_OUT only results in an endless wait. This is different from the Linux behaviour, that returns immediately. In order to demonstrate this, I have the following example code:
http://xenbits.xen.org/people/royger/test_poll.c
When executed on Linux:
$ ./test_poll In callback
On FreeBSD instead, the callback never gets called:
$ ./test_poll
So, in order to workaround this, poll the source with G_IO_HUP (which makes the code behave the same way on both Linux and FreeBSD).
---
Changes since v1:
- Fix other users of qemu_chr_fe_add_watch to use G_IO_HUP.
--- hw/char/serial.c | 2 +- hw/char/virtio-console.c | 3 ++- hw/usb/redirect.c | 2 +- monitor.c | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-)
hw/char/serial.c +1 -1
@@ -246,7 +246,7 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque)serial_receive1 (s, &s->tsr,1 ); }else if (qemu_chr_fe_write (s->chr, &s->tsr,1 ) !=1 ) {if (s->tsr_retry >=0 && s->tsr_retry <MAX_XMIT_RETRY && -qemu_chr_fe_add_watch (s->chr,G_IO_OUT , serial_xmit, s) >0 ) { +qemu_chr_fe_add_watch (s->chr,G_IO_OUT |G_IO_HUP , serial_xmit, s) >0 ) { s->tsr_retry++;return FALSE; }
hw/char/virtio-console.c +2 -1
@@ -69,7 +69,8 @@ static ssize_t flush_buf(VirtIOSerialPort *port,if (!k->is_console) {virtio_serial_throttle_port (port, true);if (!vcon->watch) { - vcon->watch =qemu_chr_fe_add_watch (vcon->chr,G_IO_OUT , + vcon->watch =qemu_chr_fe_add_watch (vcon->chr, +G_IO_OUT |G_IO_HUP , chr_write_unblocked, vcon); } }
hw/usb/redirect.c +1 -1
@@ -284,7 +284,7 @@ static int usbredir_write(void *priv, uint8_t *data, int count) r =qemu_chr_fe_write (dev->cs, data, count);if (r < count) {if (!dev->watch) { - dev->watch =qemu_chr_fe_add_watch (dev->cs,G_IO_OUT , + dev->watch =qemu_chr_fe_add_watch (dev->cs,G_IO_OUT |G_IO_HUP , usbredir_write_unblocked, dev); }if (r <0 ) {
monitor.c +1 -1
@@ -304,7 +304,7 @@ void monitor_flush(Monitor *mon) mon->outbuf = tmp; }if (mon->watch ==0 ) { - mon->watch =qemu_chr_fe_add_watch (mon->chr,G_IO_OUT , + mon->watch =qemu_chr_fe_add_watch (mon->chr,G_IO_OUT |G_IO_HUP , monitor_unblocked, mon); } }
Signature · 7 lines
1.7.7.5 (Apple Git-26) _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
PATCH v2 3/3 serial: poll the serial console with G_IO_HUP
In reply to Roger Pau MonneOn FreeBSD polling a master pty while the other end is not connected with G_IO_OUT only results in an endless wait. This is different from the Linux behaviour, that returns immediately. In order to demonstrate this, I have the following example code:
http://xenbits.xen.org/people/royger/test_poll.c
When executed on Linux:
$ ./test_poll In callback
On FreeBSD instead, the callback never gets called:
$ ./test_poll
So, in order to workaround this, poll the source with G_IO_HUP (which makes the code behave the same way on both Linux and FreeBSD).
---
Changes since v1:
- Fix other users of qemu_chr_fe_add_watch to use G_IO_HUP.
--- hw/char/serial.c | 2 +- hw/char/virtio-console.c | 3 ++- hw/usb/redirect.c | 2 +- monitor.c | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-)
hw/char/serial.c +1 -1
@@ -246,7 +246,7 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque)serial_receive1 (s, &s->tsr,1 ); }else if (qemu_chr_fe_write (s->chr, &s->tsr,1 ) !=1 ) {if (s->tsr_retry >=0 && s->tsr_retry <MAX_XMIT_RETRY && -qemu_chr_fe_add_watch (s->chr,G_IO_OUT , serial_xmit, s) >0 ) { +qemu_chr_fe_add_watch (s->chr,G_IO_OUT |G_IO_HUP , serial_xmit, s) >0 ) { s->tsr_retry++;return FALSE; }
hw/char/virtio-console.c +2 -1
@@ -69,7 +69,8 @@ static ssize_t flush_buf(VirtIOSerialPort *port,if (!k->is_console) {virtio_serial_throttle_port (port, true);if (!vcon->watch) { - vcon->watch =qemu_chr_fe_add_watch (vcon->chr,G_IO_OUT , + vcon->watch =qemu_chr_fe_add_watch (vcon->chr, +G_IO_OUT |G_IO_HUP , chr_write_unblocked, vcon); } }
hw/usb/redirect.c +1 -1
@@ -284,7 +284,7 @@ static int usbredir_write(void *priv, uint8_t *data, int count) r =qemu_chr_fe_write (dev->cs, data, count);if (r < count) {if (!dev->watch) { - dev->watch =qemu_chr_fe_add_watch (dev->cs,G_IO_OUT , + dev->watch =qemu_chr_fe_add_watch (dev->cs,G_IO_OUT |G_IO_HUP , usbredir_write_unblocked, dev); }if (r <0 ) {
monitor.c +1 -1
@@ -304,7 +304,7 @@ void monitor_flush(Monitor *mon) mon->outbuf = tmp; }if (mon->watch ==0 ) { - mon->watch =qemu_chr_fe_add_watch (mon->chr,G_IO_OUT , + mon->watch =qemu_chr_fe_add_watch (mon->chr,G_IO_OUT |G_IO_HUP , monitor_unblocked, mon); } }
Signature · 1 line
1.7.7.5 (Apple Git-26)
Re: [PATCH v2 3/3] serial: poll the serial console with G_IO_HUP
Ping?
Quoted 81 lines · Roger Pau Monne
On FreeBSD polling a master pty while the other end is not connected with
G_IO_OUTonly results in an endless wait. This is different from the Linux behaviour, that returns immediately. In order to demonstrate this, I have the following example code:http://xenbits.xen.org/people/royger/test_poll.c
When executed on Linux:
$ ./test_poll In callbackOn FreeBSD instead, the callback never gets called:
$ ./test_pollSo, in order to workaround this, poll the source with
G_IO_HUP(which makes the code behave the same way on both Linux and FreeBSD).Signed-off-by Roger Pau Monné <[email protected]>Cc Peter Crosthwaite <[email protected]>Cc Michael Tokarev <[email protected]>Cc "Andreas Färber" <[email protected]>Cc Paolo Bonzini <[email protected]>---
Changes since v1:
- Fix other users ofqemu_chr_fe_add_watchto useG_IO_HUP.--- hw/char/serial.c | 2 +- hw/char/virtio-console.c | 3 ++- hw/usb/redirect.c | 2 +- monitor.c | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-)hw/char/serial.c +1
-1@@ -246,7 +246,7 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque)serial_receive1 (s, &s->tsr,1 ); }else if (qemu_chr_fe_write (s->chr, &s->tsr,1 ) !=1 ) {if (s->tsr_retry >=0 && s->tsr_retry <MAX_XMIT_RETRY && -qemu_chr_fe_add_watch (s->chr,G_IO_OUT , serial_xmit, s) >0 ) { +qemu_chr_fe_add_watch (s->chr,G_IO_OUT |G_IO_HUP , serial_xmit, s) >0 ) { s->tsr_retry++;return FALSE; }hw/char/virtio-console.c +2
-1@@ -69,7 +69,8 @@ static ssize_t flush_buf(VirtIOSerialPort *port,if (!k->is_console) {virtio_serial_throttle_port (port, true);if (!vcon->watch) { - vcon->watch =qemu_chr_fe_add_watch (vcon->chr,G_IO_OUT , + vcon->watch =qemu_chr_fe_add_watch (vcon->chr, +G_IO_OUT |G_IO_HUP , chr_write_unblocked, vcon); } }hw/usb/redirect.c +1
-1@@ -284,7 +284,7 @@ static int usbredir_write(void *priv, uint8_t *data, int count) r =qemu_chr_fe_write (dev->cs, data, count);if (r < count) {if (!dev->watch) { - dev->watch =qemu_chr_fe_add_watch (dev->cs,G_IO_OUT , + dev->watch =qemu_chr_fe_add_watch (dev->cs,G_IO_OUT |G_IO_HUP , usbredir_write_unblocked, dev); }if (r <0 ) {monitor.c +0
-0
monitor.c void monitor_flush(Monitor *mon) · line 310
Quoted 8 lines
monitor.c +1
-1@@ -304,7 +304,7 @@ void monitor_flush(Monitor *mon) mon->outbuf = tmp; }if (mon->watch ==0 ) { - mon->watch =qemu_chr_fe_add_watch (mon->chr,G_IO_OUT , + mon->watch =qemu_chr_fe_add_watch (mon->chr,G_IO_OUT |G_IO_HUP , monitor_unblocked, mon); } }
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [Qemu-devel] [PATCH v2 3/3] serial: poll the serial console with G_IO_HUP
In reply to Roger Pau MonnePing?
Quoted 89 lines · Roger Pau Monne
On FreeBSD polling a master pty while the other end is not connected with
G_IO_OUTonly results in an endless wait. This is different from the Linux behaviour, that returns immediately. In order to demonstrate this, I have the following example code:http://xenbits.xen.org/people/royger/test_poll.c
When executed on Linux:
$ ./test_poll In callbackOn FreeBSD instead, the callback never gets called:
$ ./test_pollSo, in order to workaround this, poll the source with
G_IO_HUP(which makes the code behave the same way on both Linux and FreeBSD).Signed-off-by Roger Pau Monné <[email protected]>Cc Peter Crosthwaite <[email protected]>Cc Michael Tokarev <[email protected]>Cc "Andreas Färber" <[email protected]>Cc Paolo Bonzini <[email protected]>---
Changes since v1:
- Fix other users ofqemu_chr_fe_add_watchto useG_IO_HUP.--- hw/char/serial.c | 2 +- hw/char/virtio-console.c | 3 ++- hw/usb/redirect.c | 2 +- monitor.c | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-)hw/char/serial.c +1
-1@@ -246,7 +246,7 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque)serial_receive1 (s, &s->tsr,1 ); }else if (qemu_chr_fe_write (s->chr, &s->tsr,1 ) !=1 ) {if (s->tsr_retry >=0 && s->tsr_retry <MAX_XMIT_RETRY && -qemu_chr_fe_add_watch (s->chr,G_IO_OUT , serial_xmit, s) >0 ) { +qemu_chr_fe_add_watch (s->chr,G_IO_OUT |G_IO_HUP , serial_xmit, s) >0 ) { s->tsr_retry++;return FALSE; }hw/char/virtio-console.c +2
-1@@ -69,7 +69,8 @@ static ssize_t flush_buf(VirtIOSerialPort *port,if (!k->is_console) {virtio_serial_throttle_port (port, true);if (!vcon->watch) { - vcon->watch =qemu_chr_fe_add_watch (vcon->chr,G_IO_OUT , + vcon->watch =qemu_chr_fe_add_watch (vcon->chr, +G_IO_OUT |G_IO_HUP , chr_write_unblocked, vcon); } }hw/usb/redirect.c +1
-1@@ -284,7 +284,7 @@ static int usbredir_write(void *priv, uint8_t *data, int count) r =qemu_chr_fe_write (dev->cs, data, count);if (r < count) {if (!dev->watch) { - dev->watch =qemu_chr_fe_add_watch (dev->cs,G_IO_OUT , + dev->watch =qemu_chr_fe_add_watch (dev->cs,G_IO_OUT |G_IO_HUP , usbredir_write_unblocked, dev); }if (r <0 ) {monitor.c +1
-1@@ -304,7 +304,7 @@ void monitor_flush(Monitor *mon) mon->outbuf = tmp; }if (mon->watch ==0 ) { - mon->watch =qemu_chr_fe_add_watch (mon->chr,G_IO_OUT , + mon->watch =qemu_chr_fe_add_watch (mon->chr,G_IO_OUT |G_IO_HUP , monitor_unblocked, mon); } }
Re: [Qemu-devel] [PATCH v2 3/3] serial: poll the serial console with G_IO_HUP
Do I need to resend this? it's been more than a month without review.
Roger.
Quoted 84 lines · Roger Pau Monné
Ping?
Quoted 81 lines · Roger Pau Monne
On FreeBSD polling a master pty while the other end is not connected with
G_IO_OUTonly results in an endless wait. This is different from the Linux behaviour, that returns immediately. In order to demonstrate this, I have the following example code:http://xenbits.xen.org/people/royger/test_poll.c
When executed on Linux:
$ ./test_poll In callbackOn FreeBSD instead, the callback never gets called:
$ ./test_pollSo, in order to workaround this, poll the source with
G_IO_HUP(which makes the code behave the same way on both Linux and FreeBSD).Signed-off-by Roger Pau Monné <[email protected]>Cc Peter Crosthwaite <[email protected]>Cc Michael Tokarev <[email protected]>Cc "Andreas Färber" <[email protected]>Cc Paolo Bonzini <[email protected]>---
Changes since v1:
- Fix other users ofqemu_chr_fe_add_watchto useG_IO_HUP.--- hw/char/serial.c | 2 +- hw/char/virtio-console.c | 3 ++- hw/usb/redirect.c | 2 +- monitor.c | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-)hw/char/serial.c +1
-1@@ -246,7 +246,7 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque)serial_receive1 (s, &s->tsr,1 ); }else if (qemu_chr_fe_write (s->chr, &s->tsr,1 ) !=1 ) {if (s->tsr_retry >=0 && s->tsr_retry <MAX_XMIT_RETRY && -qemu_chr_fe_add_watch (s->chr,G_IO_OUT , serial_xmit, s) >0 ) { +qemu_chr_fe_add_watch (s->chr,G_IO_OUT |G_IO_HUP , serial_xmit, s) >0 ) { s->tsr_retry++;return FALSE; }hw/char/virtio-console.c +2
-1@@ -69,7 +69,8 @@ static ssize_t flush_buf(VirtIOSerialPort *port,if (!k->is_console) {virtio_serial_throttle_port (port, true);if (!vcon->watch) { - vcon->watch =qemu_chr_fe_add_watch (vcon->chr,G_IO_OUT , + vcon->watch =qemu_chr_fe_add_watch (vcon->chr, +G_IO_OUT |G_IO_HUP , chr_write_unblocked, vcon); } }hw/usb/redirect.c +1
-1@@ -284,7 +284,7 @@ static int usbredir_write(void *priv, uint8_t *data, int count) r =qemu_chr_fe_write (dev->cs, data, count);if (r < count) {if (!dev->watch) { - dev->watch =qemu_chr_fe_add_watch (dev->cs,G_IO_OUT , + dev->watch =qemu_chr_fe_add_watch (dev->cs,G_IO_OUT |G_IO_HUP , usbredir_write_unblocked, dev); }if (r <0 ) {monitor.c +0
-0@@ -304,7 +304,7 @@ void monitor_flush(Monitor *mon) mon->outbuf = tmp;
Quoted 10 lines
monitor.c void monitor_flush(Monitor *mon) · line 310
Quoted 8 lines
monitor.c +1
-1}if (mon->watch ==0 ) { - mon->watch =qemu_chr_fe_add_watch (mon->chr,G_IO_OUT , + mon->watch =qemu_chr_fe_add_watch (mon->chr,G_IO_OUT |G_IO_HUP , monitor_unblocked, mon); } }
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [Qemu-devel] [PATCH v2 3/3] serial: poll the serial console with G_IO_HUP
In reply to Roger Pau MonnéDo I need to resend this? it's been more than a month without review.
Roger.
Quoted 94 lines · Roger Pau Monné
Ping?
Quoted 89 lines · Roger Pau Monne
On FreeBSD polling a master pty while the other end is not connected with
G_IO_OUTonly results in an endless wait. This is different from the Linux behaviour, that returns immediately. In order to demonstrate this, I have the following example code:http://xenbits.xen.org/people/royger/test_poll.c
When executed on Linux:
$ ./test_poll In callbackOn FreeBSD instead, the callback never gets called:
$ ./test_pollSo, in order to workaround this, poll the source with
G_IO_HUP(which makes the code behave the same way on both Linux and FreeBSD).Signed-off-by Roger Pau Monné <[email protected]>Cc Peter Crosthwaite <[email protected]>Cc Michael Tokarev <[email protected]>Cc "Andreas Färber" <[email protected]>Cc Paolo Bonzini <[email protected]>---
Changes since v1:
- Fix other users ofqemu_chr_fe_add_watchto useG_IO_HUP.--- hw/char/serial.c | 2 +- hw/char/virtio-console.c | 3 ++- hw/usb/redirect.c | 2 +- monitor.c | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-)hw/char/serial.c +1
-1@@ -246,7 +246,7 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque)serial_receive1 (s, &s->tsr,1 ); }else if (qemu_chr_fe_write (s->chr, &s->tsr,1 ) !=1 ) {if (s->tsr_retry >=0 && s->tsr_retry <MAX_XMIT_RETRY && -qemu_chr_fe_add_watch (s->chr,G_IO_OUT , serial_xmit, s) >0 ) { +qemu_chr_fe_add_watch (s->chr,G_IO_OUT |G_IO_HUP , serial_xmit, s) >0 ) { s->tsr_retry++;return FALSE; }hw/char/virtio-console.c +2
-1@@ -69,7 +69,8 @@ static ssize_t flush_buf(VirtIOSerialPort *port,if (!k->is_console) {virtio_serial_throttle_port (port, true);if (!vcon->watch) { - vcon->watch =qemu_chr_fe_add_watch (vcon->chr,G_IO_OUT , + vcon->watch =qemu_chr_fe_add_watch (vcon->chr, +G_IO_OUT |G_IO_HUP , chr_write_unblocked, vcon); } }hw/usb/redirect.c +1
-1@@ -284,7 +284,7 @@ static int usbredir_write(void *priv, uint8_t *data, int count) r =qemu_chr_fe_write (dev->cs, data, count);if (r < count) {if (!dev->watch) { - dev->watch =qemu_chr_fe_add_watch (dev->cs,G_IO_OUT , + dev->watch =qemu_chr_fe_add_watch (dev->cs,G_IO_OUT |G_IO_HUP , usbredir_write_unblocked, dev); }if (r <0 ) {monitor.c +1
-1@@ -304,7 +304,7 @@ void monitor_flush(Monitor *mon) mon->outbuf = tmp; }if (mon->watch ==0 ) { - mon->watch =qemu_chr_fe_add_watch (mon->chr,G_IO_OUT , + mon->watch =qemu_chr_fe_add_watch (mon->chr,G_IO_OUT |G_IO_HUP , monitor_unblocked, mon); } }
Re: [Qemu-devel] [PATCH v2 3/3] serial: poll the serial console with G_IO_HUP
Il 30/06/2014 13:00, Roger Pau Monné ha scritto:
Quoted 1 line
Do I need to resend this? it's been more than a month without review.
I'll send a pull request for it.
Sorry for the delay.
Paolo
Quoted 87 lines · Roger Pau Monné
Quoted 86 lines
Ping?
Quoted 83 lines · Roger Pau Monne
On FreeBSD polling a master pty while the other end is not connected with
G_IO_OUTonly results in an endless wait. This is different from the Linux behaviour, that returns immediately. In order to demonstrate this, I have the following example code:http://xenbits.xen.org/people/royger/test_poll.c
When executed on Linux:
$ ./test_poll In callbackOn FreeBSD instead, the callback never gets called:
$ ./test_pollSo, in order to workaround this, poll the source with
G_IO_HUP(which makes the code behave the same way on both Linux and FreeBSD).Signed-off-by Roger Pau Monné <[email protected]>Cc Peter Crosthwaite <[email protected]>Cc Michael Tokarev <[email protected]>Cc "Andreas Färber" <[email protected]>Cc Paolo Bonzini <[email protected]>---
Changes since v1:
- Fix other users ofqemu_chr_fe_add_watchto useG_IO_HUP.--- hw/char/serial.c | 2 +- hw/char/virtio-console.c | 3 ++- hw/usb/redirect.c | 2 +- monitor.c | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-)hw/char/serial.c +1
-1@@ -246,7 +246,7 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque)serial_receive1 (s, &s->tsr,1 ); }else if (qemu_chr_fe_write (s->chr, &s->tsr,1 ) !=1 ) {if (s->tsr_retry >=0 && s->tsr_retry <MAX_XMIT_RETRY && -qemu_chr_fe_add_watch (s->chr,G_IO_OUT , serial_xmit, s) >0 ) { +qemu_chr_fe_add_watch (s->chr,G_IO_OUT |G_IO_HUP , serial_xmit, s) >0 ) { s->tsr_retry++;return FALSE; }hw/char/virtio-console.c +2
-1@@ -69,7 +69,8 @@ static ssize_t flush_buf(VirtIOSerialPort *port,if (!k->is_console) {virtio_serial_throttle_port (port, true);if (!vcon->watch) { - vcon->watch =qemu_chr_fe_add_watch (vcon->chr,G_IO_OUT , + vcon->watch =qemu_chr_fe_add_watch (vcon->chr, +G_IO_OUT |G_IO_HUP , chr_write_unblocked, vcon); } }hw/usb/redirect.c +1
-1@@ -284,7 +284,7 @@ static int usbredir_write(void *priv, uint8_t *data, int count) r =qemu_chr_fe_write (dev->cs, data, count);if (r < count) {if (!dev->watch) { - dev->watch =qemu_chr_fe_add_watch (dev->cs,G_IO_OUT , + dev->watch =qemu_chr_fe_add_watch (dev->cs,G_IO_OUT |G_IO_HUP , usbredir_write_unblocked, dev); }if (r <0 ) {monitor.c +0
-0@@ -304,7 +304,7 @@ void monitor_flush(Monitor *mon) mon->outbuf = tmp; }if (mon->watch ==0 ) {
Quoted 9 lines
Quoted 8 lines
monitor.c void monitor_flush(Monitor *mon) · line 310
Quoted 6 lines
monitor.c +1
-1- mon->watch =qemu_chr_fe_add_watch (mon->chr,G_IO_OUT , + mon->watch =qemu_chr_fe_add_watch (mon->chr,G_IO_OUT |G_IO_HUP , monitor_unblocked, mon); } }
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [Qemu-devel] [PATCH v2 3/3] serial: poll the serial console with G_IO_HUP
In reply to Roger Pau MonnéIl 30/06/2014 13:00, Roger Pau Monné ha scritto:
Quoted 1 line
Do I need to resend this? it's been more than a month without review.
I'll send a pull request for it.
Sorry for the delay.
Paolo
Quoted 96 lines · Roger Pau Monné
Quoted 94 lines
Ping?
Quoted 89 lines · Roger Pau Monne
On FreeBSD polling a master pty while the other end is not connected with
G_IO_OUTonly results in an endless wait. This is different from the Linux behaviour, that returns immediately. In order to demonstrate this, I have the following example code:http://xenbits.xen.org/people/royger/test_poll.c
When executed on Linux:
$ ./test_poll In callbackOn FreeBSD instead, the callback never gets called:
$ ./test_pollSo, in order to workaround this, poll the source with
G_IO_HUP(which makes the code behave the same way on both Linux and FreeBSD).Signed-off-by Roger Pau Monné <[email protected]>Cc Peter Crosthwaite <[email protected]>Cc Michael Tokarev <[email protected]>Cc "Andreas Färber" <[email protected]>Cc Paolo Bonzini <[email protected]>---
Changes since v1:
- Fix other users ofqemu_chr_fe_add_watchto useG_IO_HUP.--- hw/char/serial.c | 2 +- hw/char/virtio-console.c | 3 ++- hw/usb/redirect.c | 2 +- monitor.c | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-)hw/char/serial.c +1
-1@@ -246,7 +246,7 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque)serial_receive1 (s, &s->tsr,1 ); }else if (qemu_chr_fe_write (s->chr, &s->tsr,1 ) !=1 ) {if (s->tsr_retry >=0 && s->tsr_retry <MAX_XMIT_RETRY && -qemu_chr_fe_add_watch (s->chr,G_IO_OUT , serial_xmit, s) >0 ) { +qemu_chr_fe_add_watch (s->chr,G_IO_OUT |G_IO_HUP , serial_xmit, s) >0 ) { s->tsr_retry++;return FALSE; }hw/char/virtio-console.c +2
-1@@ -69,7 +69,8 @@ static ssize_t flush_buf(VirtIOSerialPort *port,if (!k->is_console) {virtio_serial_throttle_port (port, true);if (!vcon->watch) { - vcon->watch =qemu_chr_fe_add_watch (vcon->chr,G_IO_OUT , + vcon->watch =qemu_chr_fe_add_watch (vcon->chr, +G_IO_OUT |G_IO_HUP , chr_write_unblocked, vcon); } }hw/usb/redirect.c +1
-1@@ -284,7 +284,7 @@ static int usbredir_write(void *priv, uint8_t *data, int count) r =qemu_chr_fe_write (dev->cs, data, count);if (r < count) {if (!dev->watch) { - dev->watch =qemu_chr_fe_add_watch (dev->cs,G_IO_OUT , + dev->watch =qemu_chr_fe_add_watch (dev->cs,G_IO_OUT |G_IO_HUP , usbredir_write_unblocked, dev); }if (r <0 ) {monitor.c +1
-1@@ -304,7 +304,7 @@ void monitor_flush(Monitor *mon) mon->outbuf = tmp; }if (mon->watch ==0 ) { - mon->watch =qemu_chr_fe_add_watch (mon->chr,G_IO_OUT , + mon->watch =qemu_chr_fe_add_watch (mon->chr,G_IO_OUT |G_IO_HUP , monitor_unblocked, mon); } }