FreeBSD fixes
cover FreeBSD fixes
Misc fixes for FreeBSD that affect libxl and the recently added xendriverdomain rc.d script.
PATCH 1/3 libxl: include sys/endian.h for FreeBSD
be64toh and friends are declared in sys/endian.h on FreeBSD, so include it as part of libxl_osdeps.h.
--- tools/libxl/libxl_osdeps.h | 1 + 1 file changed, 1 insertion(+)
tools/libxl/libxl_osdeps.h +1 -0
@@ -42,6 +42,7 @@#define SYSFS_PCIBACK_DRIVER "/dev/null"#define NETBACK_NIC_NAME "xnb%u.%d"#include <libutil.h> +#include <sys/endian.h> #endif #ifndef SYSFS_PCIBACK_DRIVER
Signature · 7 lines
1.9.5 (Apple Git-50.3) _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
PATCH 2/3 libxl/psr: use Xen error codes when checking hypercall return values
In reply to Roger Pau MonneWe cannot use the systems errno values when checking return values from Xen, because some OSes don't have the same set of errno definitions. Instead use the definitions present in Xen public errno.h header.
---
I have not checked if there are other places in libxl that need similar treatment, I just came around this because FreeBSD doesn't have EBADSLT defined.
--- tools/libxl/libxl_internal.h | 1 + tools/libxl/libxl_psr.c | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 13 deletions(-)
tools/libxl/libxl_internal.h +1 -0
@@ -55,6 +55,7 @@#include "xentoollog.h" #include <xen/io/xenbus.h> +#include <xen/errno.h> #ifdef LIBXL_H # error libxl.h should be included via libxl_internal.h, not separately
tools/libxl/libxl_psr.c +13 -13
@@ -24,17 +24,17 @@ static void libxl__psr_log_err_msg(libxl__gc *gc, int err)char *msg;switch (err) { -case ENOSYS : -case EOPNOTSUPP : +case XEN_ENOSYS : +case XEN_EOPNOTSUPP : msg ="unsupported operation" ;break ; -case ESRCH : +case XEN_ESRCH : msg ="invalid domain ID" ;break ; -case EBADSLT : +case XEN_EBADSLT : msg ="socket is not supported" ;break ; -case EFAULT : +case XEN_EFAULT : msg ="failed to exchange data with Xen" ;break ;default :
@@ -50,16 +50,16 @@ static void libxl__psr_cmt_log_err_msg(libxl__gc *gc, int err)char *msg;switch (err) { -case ENODEV : +case XEN_ENODEV : msg ="CMT is not supported in this system" ;break ; -case EEXIST : +case XEN_EEXIST : msg ="CMT is already attached to this domain" ;break ; -case ENOENT : +case XEN_ENOENT : msg ="CMT is not attached to this domain" ;break ; -case EUSERS : +case XEN_EUSERS : msg ="no free RMID available" ;break ;default :
@@ -75,16 +75,16 @@ static void libxl__psr_cat_log_err_msg(libxl__gc *gc, int err)char *msg;switch (err) { -case ENODEV : +case XEN_ENODEV : msg ="CAT is not supported in this system" ;break ; -case ENOENT : +case XEN_ENOENT : msg ="CAT is not enabled on the socket" ;break ; -case EUSERS : +case XEN_EUSERS : msg ="no free COS available" ;break ; -case EEXIST : +case XEN_EEXIST : msg ="The same CBM is already set to this domain" ;break ;
Signature · 7 lines
1.9.5 (Apple Git-50.3) _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
PATCH 3/3 hotplug/FreeBSD: fix xendriverdomain rc.d script
In reply to Roger Pau Monnehotplugpath.sh by default is located in /usr/local/etc/xen/scripts on FreeBSD. Instead of hardcoding it's location use the XEN_SCRIPT_DIR variable like it's used on the xencommons rc.d script.
--- tools/hotplug/FreeBSD/rc.d/xendriverdomain.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/hotplug/FreeBSD/rc.d/xendriverdomain.in +1 -1
@@ -7,7 +7,7 @@ . /etc/rc.subr -. /etc/xen/scripts/hotplugpath.sh +. @XEN_SCRIPT_DIR@/hotplugpath.sh LD_LIBRARY_PATH="${libdir}" export LD_LIBRARY_PATH
Signature · 7 lines
1.9.5 (Apple Git-50.3) _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [PATCH for-4.6 1/3] libxl: include sys/endian.h for FreeBSD
In reply to Roger Pau MonneQuoted 7 lines · Roger Pau Monne
be64toh and friends are declared in
sys/endian.hon FreeBSD, so include it as part oflibxl_osdeps.h.Signed-off-by Roger Pau Monné <[email protected]>Cc Ian Jackson <[email protected]>Cc Ian Campbell <[email protected]>Cc Wei Liu <[email protected]>
Quoted 18 lines
--- tools/libxl/libxl_osdeps.h | 1 + 1 file changed, 1 insertion(+)tools/libxl/libxl_osdeps.h +1
-0@@ -42,6 +42,7 @@#define SYSFS_PCIBACK_DRIVER "/dev/null"#define NETBACK_NIC_NAME "xnb%u.%d"#include <libutil.h> +#include <sys/endian.h> #endif #ifndef SYSFS_PCIBACK_DRIVER Signature · 1 line
1.9.5 (Apple Git-50.3)
Re: [PATCH for-4.6 3/3] hotplug/FreeBSD: fix xendriverdomain rc.d script
In reply to Roger Pau MonneQuoted 8 lines · Roger Pau Monne
hotplugpath.shby default is located in/usr/local/etc/xen/scriptson FreeBSD. Instead of hardcoding it's location use theXEN_SCRIPT_DIRvariable like it's used on the xencommons rc.d script.Signed-off-by Roger Pau Monné <[email protected]>Cc Ian Jackson <[email protected]>Cc Ian Campbell <[email protected]>Cc Wei Liu <[email protected]>
Quoted 19 lines
--- tools/hotplug/FreeBSD/rc.d/xendriverdomain.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/hotplug/FreeBSD/rc.d/xendriverdomain.in +1
-1@@ -7,7 +7,7 @@ . /etc/rc.subr -. /etc/xen/scripts/hotplugpath.sh +. @XEN_SCRIPT_DIR@/hotplugpath.sh LD_LIBRARY_PATH="${libdir}" export LD_LIBRARY_PATHSignature · 1 line
1.9.5 (Apple Git-50.3)
Re: [PATCH for-4.6 2/3] libxl/psr: use Xen error codes when checking hypercall return values
In reply to Roger Pau MonneRoger Pau Monne writes ("[PATCH for-4.6 2/3] libxl/psr: use Xen error codes when checking hypercall return values"):
Quoted 8 lines
We cannot use the systems errno values when checking return values from Xen, because some OSes don't have the same set of errno definitions. Instead use the definitions present in Xen public
errno.hheader.Signed-off-by Roger Pau Monné <[email protected]>Cc Ian Jackson <[email protected]>Cc Ian Campbell <[email protected]>Cc Wei Liu <[email protected]>
Quoted 3 lines
I have not checked if there are other places in libxl that need similar treatment, I just came around this because FreeBSD doesn't have EBADSLT defined.
Right. There is probably more of this, but that's not a blocker for this patch.
Maybe it would be worth mentioning this issue in CODING_STYLE.
Ian.
Re: [PATCH for-4.6 2/3] libxl/psr: use Xen error codes when checking hypercall return values
Ian Jackson writes ("Re: [PATCH for-4.6 2/3] libxl/psr: use Xen error codes when checking hypercall return values"):
Quoted 1 line
Acked-by Ian Jackson <[email protected]>
Actually, I withdraw that. I was confused about how things worked. To summarise an irc discussion:
* On NetBSD, hypercall numbers are translated by the privcmd driver. This is probably correct. (Not sure if FreeBSD does the same.)
* So the libxc API is that errno values are OS errno values. Roger's patch is wrong.
* A corrollary is that the hypervisor may not use errno values which are not in the toolstack OS. Since the hypervisor is supposed to be fairly portable to different toolstacks, that means we shouldn't be using errno values which are not in POSIX.
* Re EBADSLT in particular:
- There is one return site in 4.5, which is in hvm_save_one, which is toolstack-onloy functionality. We can therefore change it for 4.6.
- The other sites where EBADSLT are generated in staging must also be fixed.
So the correct approach is:
- Patch to change EBADSLT to something else, everywhere.
- Patch to remove EBADSLT from hypervisor errno list (if it's not just been renamed/renumbered).
- If FreeBSD privcmd does not translate errno numbers, make it do so.
Ian.
Re: [PATCH for-4.6 2/3] libxl/psr: use Xen error codes when checking hypercall return values
Quoted 23 lines · Ian Jackson
Ian Jackson writes ("Re: [PATCH for-4.6 2/3] libxl/psr: use Xen error codes when checking hypercall return values"):
Quoted 1 line
Acked-by Ian Jackson <[email protected]>Actually, I withdraw that. I was confused about how things worked. To summarise an irc discussion:
* On NetBSD, hypercall numbers are translated by the privcmd driver. This is probably correct. (Not sure if FreeBSD does the same.)
* So the libxc API is that errno values are OS errno values. Roger's patch is wrong.
* A corrollary is that the hypervisor may not use errno values which are not in the toolstack OS. Since the hypervisor is supposed to be fairly portable to different toolstacks, that means we shouldn't be using errno values which are not in POSIX.
* Re EBADSLT in particular:
- There is one return site in 4.5, which is inhvm_save_one, which is toolstack-onloy functionality. We can therefore change it for 4.6.
- The other sites where EBADSLT are generated in staging must also be fixed.
Quoted 6 lines
So the correct approach is:
- Patch to change EBADSLT to something else, everywhere.
- Patch to remove EBADSLT from hypervisor errno list (if it's not just been renamed/renumbered).
- If FreeBSD privcmd does not translate errno numbers, make it do so.
EBADSLT isn't the only example here. I believe ENODATA is a similar example.
If we are going to do this, we should prune all non-posix errnos out of the hypervisor errno list.
~Andrew
Re: [PATCH for-4.6 2/3] libxl/psr: use Xen error codes when checking hypercall return values
Andrew Cooper writes ("Re: [Xen-devel] [PATCH for-4.6 2/3] libxl/psr: use Xen error codes when checking hypercall return values"):
Quoted 2 lines
EBADSLT isn't the only example here. I believe ENODATA is a similar example.
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html
But
http://fxr.watson.org/fxr/source/sys/errno.h
How annoying.
Ian.
Re: [PATCH for-4.6 2/3] libxl/psr: use Xen error codes when checking hypercall return values
Quoted 8 lines · Ian Jackson
Andrew Cooper writes ("Re: [Xen-devel] [PATCH for-4.6 2/3] libxl/psr:
use Xen error codes when checking hypercall return values"):Quoted 3 lines
EBADSLT isn't the only example here. I believe ENODATA is a similar
example.http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html
Quoted 8 lines
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/sys/errno.h?rev=1.40&cont
ent-type=text/x-cvsweb-markup&only_with_tag=MAINBut
http://fxr.watson.org/fxr/source/sys/errno.h
How annoying.
THat's just a FreeBSD bug then?
Re: [PATCH for-4.6 2/3] libxl/psr: use Xen error codes when checking hypercall return values
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 21.07.15 at 14:47, <[email protected]> wrote:
Quoted 11 lines · Ian Jackson
Andrew Cooper writes ("Re: [Xen-devel] [PATCH for-4.6 2/3] libxl/psr:
use Xen error codes when checking hypercall return values"):Quoted 3 lines
EBADSLT isn't the only example here. I believe ENODATA is a similar
example.http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/sys/errno.h?rev=1.40&cont
ent-type=text/x-cvsweb-markup&only_with_tag=MAIN
Quoted 7 lines
Quoted 5 lines
But
http://fxr.watson.org/fxr/source/sys/errno.h
How annoying.
THat's just a FreeBSD bug then?
Why? The OpenGroup page above clearly says that the two so far identified values are an extension.
Jan
Re: [PATCH for-4.6 2/3] libxl/psr: use Xen error codes when checking hypercall return values
Quoted 19 lines · Jan Beulich
Quoted 19 lines
Quoted 2 lines
Quoted 2 lines · On 21.07.15 at 14:47, <[email protected]> wrote:
Quoted 16 lines · Ian Jackson
Andrew Cooper writes ("Re: [Xen-devel] [PATCH for-4.6 2/3] libxl/psr:
use Xen error codes when checking hypercall return values"):Quoted 3 lines
EBADSLT isn't the only example here. I believe ENODATA is a similar
example.http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.
htmlhttp://cvsweb.netbsd.org/bsdweb.cgi/src/sys/sys/errno.h?rev=1.40&
cont
ent-type=text/x-cvsweb-markup&only_with_tag=MAINBut
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
http://fxr.watson.org/fxr/source/sys/errno.h
How annoying.
THat's just a FreeBSD bug then?
Why? The OpenGroup page above clearly says that the two so far identified values are an extension.
I didn't realise that was what the XSR tag meant, sorry.
I note that OB is obsolete too FWIW...
I suppose it could be worse than "POSIX plus a couple of grandfathered in exceptions (sorry)"...
Ian.
Re: [PATCH for-4.6 3/3] hotplug/FreeBSD: fix xendriverdomain rc.d script
In reply to Wei LiuQuoted 7 lines · Wei Liu
Quoted 6 lines · Roger Pau Monne
hotplugpath.shby default is located in/usr/local/etc/xen/scriptson
FreeBSD. Instead of hardcoding it's location use theXEN_SCRIPT_DIRvariable
like it's used on the xencommons rc.d script.
Quoted 6 lines
Quoted 4 lines
Signed-off-by Roger Pau Monné <[email protected]>Cc Ian Jackson <[email protected]>Cc Ian Campbell <[email protected]>Cc Wei Liu <[email protected]>Acked-by Wei Liu <[email protected]>
Me too, plus applied.
Thanks Roger, sorry for the breakage.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Ian Campbell
AppliedRe: [PATCH for-4.6 1/3] libxl: include sys/endian.h for FreeBSD
In reply to Wei LiuQuoted 11 lines · Wei Liu
Quoted 8 lines · Roger Pau Monne
be64toh and friends are declared in
sys/endian.hon FreeBSD, so include it
as part oflibxl_osdeps.h.Signed-off-by Roger Pau Monné <[email protected]>Cc Ian Jackson <[email protected]>Cc Ian Campbell <[email protected]>Cc Wei Liu <[email protected]>Acked-by Wei Liu <[email protected]>
Applied.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel