Skip to contentSkip to conversation

x86/sysctl: Hide hvm_directio if hvm is not available

PATCH In review Andrew Cooper 3 participants 9 messages Nov 26, 2015 – Dec 11, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/sysctl: Hide hvm_directio if hvm is not available

If HVM support unavailable, advertising hvm_directio is misleading.

---
CC: Jan Beulich <[email protected]>

---
 xen/arch/x86/sysctl.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
xen/arch/x86/sysctl.c +4 -2
index 58cbd70..c440c93 100644
@@ -77,9 +77,11 @@ void arch_do_physinfo(xen_sysctl_physinfo_t *pi)
     memcpy(pi->hw_cap, boot_cpu_data.x86_capability,
            min(sizeof(pi->hw_cap), sizeof(boot_cpu_data.x86_capability)));
     if ( hvm_enabled )
+    {
         pi->capabilities |= XEN_SYSCTL_PHYSCAP_hvm;
-    if ( iommu_enabled )
-        pi->capabilities |= XEN_SYSCTL_PHYSCAP_hvm_directio;
+        if ( iommu_enabled )
+            pi->capabilities |= XEN_SYSCTL_PHYSCAP_hvm_directio;
+    }
 }
 
 long arch_do_sysctl(
Signature · 1 line
2.1.4
#1 lore raw
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 26.11.15 at 18:02, <[email protected]> wrote:

If HVM support unavailable, advertising hvm_directio is misleading.

Well, perhaps XEN_SYSCTL_PHYSCAP_hvm_directio is the wrong name for the flag? How would the tool stack know the IOMMU is available for PV pass-through with that flag hidden?

Jan

#2 lore raw

PATCH 1/1 public/sysctl: Clarifications to XEN_SYSCTL_PHYSCAP_hvm_directio

Specifically that it indicates passthrough support for PV guests as well

---
CC: Keir Fraser <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Tim Deegan <[email protected]>
CC: Ian Campbell <[email protected]>
CC: Ian Jackson <[email protected]>

---
 xen/include/public/sysctl.h | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
xen/include/public/sysctl.h +8 -1
index 96680eb..cbbeecd 100644
@@ -89,7 +89,14 @@ DEFINE_XEN_GUEST_HANDLE(xen_sysctl_tbuf_op_t);
  /* (x86) The platform supports HVM guests. */
 #define _XEN_SYSCTL_PHYSCAP_hvm          0
 #define XEN_SYSCTL_PHYSCAP_hvm           (1u<<_XEN_SYSCTL_PHYSCAP_hvm)
- /* (x86) The platform supports HVM-guest direct access to I/O devices. */
+ /*
+  * (x86) The platform supports guest direct access to I/O devices.
+  *
+  * Note that this parameter has been misnamed since its introduction, and is
+  * now too baked into APIs and ABIs to change.  Despite the "hvm" in its
+  * name, it simply indicates the presence of an enabled IOMMU, allowing for
+  * passthrough of devices to guests, including PV guests.
+  */
 #define _XEN_SYSCTL_PHYSCAP_hvm_directio 1
 #define XEN_SYSCTL_PHYSCAP_hvm_directio  (1u<<_XEN_SYSCTL_PHYSCAP_hvm_directio)
 struct xen_sysctl_physinfo {
Signature · 1 line
2.1.4
#3 lore raw

Re: [PATCH] public/sysctl: Clarifications to XEN_SYSCTL_PHYSCAP_hvm_directio

xen/include/public/sysctl.h DEFINE_XEN_GUEST_HANDLE(xen_sysctl_tbuf_op_t); · line 96

Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 01.12.15 at 12:37, <[email protected]> wrote:
xen/include/public/sysctl.h +5 -1
@@ -89,7 +89,14 @@ DEFINE_XEN_GUEST_HANDLE(xen_sysctl_tbuf_op_t);
  /* (x86) The platform supports HVM guests. */
 #define _XEN_SYSCTL_PHYSCAP_hvm          0
 #define XEN_SYSCTL_PHYSCAP_hvm           (1u<<_XEN_SYSCTL_PHYSCAP_hvm)
- /* (x86) The platform supports HVM-guest direct access to I/O devices. */
+ /*
+  * (x86) The platform supports guest direct access to I/O devices.
+  *
+  * Note that this parameter has been misnamed since its introduction, and is
+  * now too baked into APIs and ABIs to change.  Despite the "hvm" in its

What do you mean with "too baked into ..."? This is sysctl, which can be changed, and I found just two uses (one in the hypervisor, the other in libxl), so changing the use sites wouldn't seem all that problematic (in the worst case we could also keep to current name behind a __XEN_INTERFACE_VERSION__ conditional).

Jan

Quoted 6 lines
xen/include/public/sysctl.h +3 -0
+  * name, it simply indicates the presence of an enabled IOMMU, allowing for
+  * passthrough of devices to guests, including PV guests.
+  */
 #define _XEN_SYSCTL_PHYSCAP_hvm_directio 1
 #define XEN_SYSCTL_PHYSCAP_hvm_directio  (1u<<_XEN_SYSCTL_PHYSCAP_hvm_directio)
 struct xen_sysctl_physinfo {
#4 lore raw

Re: [PATCH] public/sysctl: Clarifications to XEN_SYSCTL_PHYSCAP_hvm_directio

Quoted 10 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 01.12.15 at 12:37, <[email protected]> wrote:
xen/include/public/sysctl.h +2 -1
@@ -89,7 +89,14 @@ DEFINE_XEN_GUEST_HANDLE(xen_sysctl_tbuf_op_t);
  /* (x86) The platform supports HVM guests. */
 #define _XEN_SYSCTL_PHYSCAP_hvm          0
 #define XEN_SYSCTL_PHYSCAP_hvm           (1u<<_XEN_SYSCTL_PHYSCAP_hvm)
- /* (x86) The platform supports HVM-guest direct access to I/O devices. */
+ /*
+  * (x86) The platform supports guest direct access to I/O devices.
Quoted 8 lines

xen/include/public/sysctl.h DEFINE_XEN_GUEST_HANDLE(xen_sysctl_tbuf_op_t); · line 96

Quoted 3 lines
xen/include/public/sysctl.h +3 -0
+  *
+  * Note that this parameter has been misnamed since its introduction, and is
+  * now too baked into APIs and ABIs to change.  Despite the "hvm" in its

What do you mean with "too baked into ..."? This is sysctl, which can be changed, and I found just two uses (one in the hypervisor, the other in libxl), so changing the use sites wouldn't seem all that problematic (in the worst case we could also keep to current name behind a __XEN_INTERFACE_VERSION__ conditional).

It is libxl which is the problem. Given its stable API, libxl_physinfo.cap_hvm_directio can't be changed.

~Andrew

#5 lore raw

Re: [PATCH] public/sysctl: Clarifications to XEN_SYSCTL_PHYSCAP_hvm_directio

Quoted 21 lines
Quoted 1 line
Quoted 1 line · On 10.12.15 at 21:07, <[email protected]> wrote:
Quoted 10 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 01.12.15 at 12:37, <[email protected]> wrote:
xen/include/public/sysctl.h +2 -1
@@ -89,7 +89,14 @@ DEFINE_XEN_GUEST_HANDLE(xen_sysctl_tbuf_op_t);
  /* (x86) The platform supports HVM guests. */
 #define _XEN_SYSCTL_PHYSCAP_hvm          0
 #define XEN_SYSCTL_PHYSCAP_hvm           (1u<<_XEN_SYSCTL_PHYSCAP_hvm)
- /* (x86) The platform supports HVM-guest direct access to I/O devices. */
+ /*
+  * (x86) The platform supports guest direct access to I/O devices.
Quoted 8 lines

xen/include/public/sysctl.h DEFINE_XEN_GUEST_HANDLE(xen_sysctl_tbuf_op_t); · line 96

Quoted 3 lines
xen/include/public/sysctl.h +3 -0
+  *
+  * Note that this parameter has been misnamed since its introduction, and is
+  * now too baked into APIs and ABIs to change.  Despite the "hvm" in its

What do you mean with "too baked into ..."? This is sysctl, which can be changed, and I found just two uses (one in the hypervisor, the other in libxl), so changing the use sites wouldn't seem all that problematic (in the worst case we could also keep to current name behind a __XEN_INTERFACE_VERSION__ conditional).

Quoted 2 lines

It is libxl which is the problem. Given its stable API, libxl_physinfo.cap_hvm_directio can't be changed.

But that's only derived from the sysctl interface, i.e. changing the name in the public headers won't - unless I'm overlooking something - have any effect on the libxl interface. It's the libxl implementation which would then need to explain (for itself) that the name doesn't reflect the function.

Jan

#6 lore raw

Re: [PATCH] public/sysctl: Clarifications to XEN_SYSCTL_PHYSCAP_hvm_directio

Quoted 20 lines · Jan Beulich
Quoted 20 lines
Quoted 1 line
Quoted 1 line · On 10.12.15 at 21:07, <[email protected]> wrote:
Quoted 18 lines · Jan Beulich

xen/include/public/sysctl.h DEFINE_XEN_GUEST_HANDLE(xen_sysctl_tbuf_op_t); · line 96

Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 01.12.15 at 12:37, <[email protected]> wrote:
xen/include/public/sysctl.h +5 -1
@@ -89,7 +89,14 @@ DEFINE_XEN_GUEST_HANDLE(xen_sysctl_tbuf_op_t);
  /* (x86) The platform supports HVM guests. */
 #define _XEN_SYSCTL_PHYSCAP_hvm          0
 #define XEN_SYSCTL_PHYSCAP_hvm           (1u<<_XEN_SYSCTL_PHYSCAP_hvm)
- /* (x86) The platform supports HVM-guest direct access to I/O devices. */
+ /*
+  * (x86) The platform supports guest direct access to I/O devices.
+  *
+  * Note that this parameter has been misnamed since its introduction, and is
+  * now too baked into APIs and ABIs to change.  Despite the "hvm" in its

What do you mean with "too baked into ..."? This is sysctl, which can be changed, and I found just two uses (one in the hypervisor, the other in libxl), so changing the use sites wouldn't seem all that problematic (in the worst case we could also keep to current name behind a __XEN_INTERFACE_VERSION__ conditional).

Quoted 7 lines
Quoted 2 lines

It is libxl which is the problem. Given its stable API, libxl_physinfo.cap_hvm_directio can't be changed.

But that's only derived from the sysctl interface, i.e. changing the name in the public headers won't - unless I'm overlooking something - have any effect on the libxl interface. It's the libxl implementation which would then need to explain (for itself) that the name doesn't reflect the function.

This is all true, but it is better to have it consistent everywhere rather than to change just half of it.

~Andrew

#7 lore raw

Re: [PATCH] public/sysctl: Clarifications to XEN_SYSCTL_PHYSCAP_hvm_directio

Quoted 24 lines
Quoted 1 line
Quoted 1 line · On 11.12.15 at 11:20, <[email protected]> wrote:
Quoted 22 lines · Jan Beulich
Quoted 22 lines
Quoted 1 line
Quoted 1 line · On 10.12.15 at 21:07, <[email protected]> wrote:
Quoted 10 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 01.12.15 at 12:37, <[email protected]> wrote:
xen/include/public/sysctl.h +2 -1
@@ -89,7 +89,14 @@ DEFINE_XEN_GUEST_HANDLE(xen_sysctl_tbuf_op_t);
  /* (x86) The platform supports HVM guests. */
 #define _XEN_SYSCTL_PHYSCAP_hvm          0
 #define XEN_SYSCTL_PHYSCAP_hvm           (1u<<_XEN_SYSCTL_PHYSCAP_hvm)
- /* (x86) The platform supports HVM-guest direct access to I/O devices. */
+ /*
+  * (x86) The platform supports guest direct access to I/O devices.
Quoted 8 lines

xen/include/public/sysctl.h DEFINE_XEN_GUEST_HANDLE(xen_sysctl_tbuf_op_t); · line 96

Quoted 3 lines
xen/include/public/sysctl.h +3 -0
+  *
+  * Note that this parameter has been misnamed since its introduction, and is
+  * now too baked into APIs and ABIs to change.  Despite the "hvm" in its

What do you mean with "too baked into ..."? This is sysctl, which can be changed, and I found just two uses (one in the hypervisor, the other in libxl), so changing the use sites wouldn't seem all that problematic (in the worst case we could also keep to current name behind a __XEN_INTERFACE_VERSION__ conditional).

It is libxl which is the problem. Given its stable API, libxl_physinfo.cap_hvm_directio can't be changed.

Quoted 8 lines
Quoted 5 lines

But that's only derived from the sysctl interface, i.e. changing the name in the public headers won't - unless I'm overlooking something - have any effect on the libxl interface. It's the libxl implementation which would then need to explain (for itself) that the name doesn't reflect the function.

This is all true, but it is better to have it consistent everywhere rather than to change just half of it.

I disagree (we should eliminate as much confusion as possible), but I'm fine to be overruled by other REST maintainers.

Jan

#8 lore raw

Re: [PATCH] public/sysctl: Clarifications to XEN_SYSCTL_PHYSCAP_hvm_directio

Quoted 37 lines · Jan Beulich
Quoted 37 lines
Quoted 1 line
Quoted 1 line · On 11.12.15 at 11:20, <[email protected]> wrote:
Quoted 34 lines · Jan Beulich
Quoted 27 lines
Quoted 1 line
Quoted 1 line · On 10.12.15 at 21:07, <[email protected]> wrote:
Quoted 17 lines · Jan Beulich
Quoted 17 lines
Quoted 1 line
Quoted 1 line · On 01.12.15 at 12:37, <[email protected]> wrote:
xen/include/public/sysctl.h +0 -1
@@ -89,7 +89,14 @@
 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_tbuf_op_t);
   /* (x86) The platform supports HVM guests. */
  #define _XEN_SYSCTL_PHYSCAP_hvm          0
  #define
 XEN_SYSCTL_PHYSCAP_hvm           (1u<<_XEN_SYSCTL_PHYSCAP_hvm)
- /* (x86) The platform supports HVM-guest direct access to I/O

devices. */
+ /*
+  * (x86) The platform supports guest direct access to I/O devices.
+  *
+  * Note that this parameter has been misnamed since its introduction, and is

Quoted 8 lines
Quoted 2 lines

+  * now too baked into APIs and ABIs to change.  Despite the "hvm" in its

What do you mean with "too baked into ..."? This is sysctl, which can
be changed, and I found just two uses (one in the hypervisor, the other in libxl), so changing the use sites wouldn't seem all that problematic (in the worst case we could also keep to current name behind a __XEN_INTERFACE_VERSION__ conditional).

Quoted 2 lines

It is libxl which is the problem.  Given its stable API, libxl_physinfo.cap_hvm_directio can't be changed.

But that's only derived from the sysctl interface, i.e. changing the name in the public headers won't - unless I'm overlooking something - have any effect on the libxl interface. It's the libxl implementation which would then need to explain (for itself) that the name doesn't reflect the function.

Quoted 5 lines
Quoted 2 lines

This is all true, but it is better to have it consistent everywhere rather than to change just half of it.

I disagree (we should eliminate as much confusion as possible), but I'm fine to be overruled by other REST maintainers.

I can see both sides of this coin.

If it's just libxl being a pain then we could introduce a new (second) field and deprecate the old one (while keeping it for compatibility) or maybe (but probably not) do something with LIBXL_API_VERSION to have a single field with a dual personality.

We also have the (rather more extreme) of deprecating libxl_get_physinfo entirely and adding a new more general interface which doesn't encode hypervisor specifics quite so hardcodedly. I've no idea what such an interface would look like though, and it would seem like overkill.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel