Skip to contentSkip to conversation

tools: Drop xc_cpuid_check() and bindings

RFC PATCH In review Andrew Cooper 6 participants 7 messages Jul 17, 2017 – Jul 20, 2017 Arm/actions semi architecture

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 tools: Drop xc_cpuid_check() and bindings

There are no current users which I can locate. One piece of xend which didn't move forwards into xl/libxl is this:

# Configure host CPUID consistency checks, which must be satisfied for this
# VM to be allowed to run on this host's processor type:
#cpuid_check=[ '1:ecx=xxxxxxxxxxxxxxxxxxxxxxxxxx1xxxxx' ] # - Host must have VMX feature flag set

The implementation of xc_cpuid_check() is conceptually broken. Dom0's view of CPUID is not the approprite view to check, and will be wrong in the presence of CPUID masking/faulting, and for HVM-based toolstack domains.

If it turns out that the functionality is required, it should be implemented in terms of XEN_SYSCTL_get_cpuid_policy to use the proper CPUID view.

---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>
CC: David Scott <[email protected]>
CC: Christian Lindig <[email protected]>
CC: Juergen Gross <[email protected]>
CC: Jim Fehlig <[email protected]>
CC: Boris Ostrovsky <[email protected]>
CC: Konrad Rzeszutek Wilk <[email protected]>

RFC initially for feedback, and to see if anyone does expect to be using this call. It turns out that Xapi has a library function using it, but that function is dead so can be removed.

---
 tools/libxc/include/xenctrl.h       |  4 ---
 tools/libxc/xc_cpuid_x86.c          | 57 -------------------------------------
 tools/ocaml/libs/xc/xenctrl.ml      |  2 --
 tools/ocaml/libs/xc/xenctrl.mli     |  3 --
 tools/ocaml/libs/xc/xenctrl_stubs.c | 43 ----------------------------
 tools/python/xen/lowlevel/xc/xc.c   | 34 ----------------------
 6 files changed, 143 deletions(-)
tools/libxc/include/xenctrl.h +0 -4
index 96df836..acd778c 100644
@@ -1793,10 +1793,6 @@ int xc_domain_debug_control(xc_interface *xch,
                             uint32_t vcpu);
 
 #if defined(__i386__) || defined(__x86_64__)
-int xc_cpuid_check(xc_interface *xch,
-                   const unsigned int *input,
-                   const char **config,
-                   char **config_transformed);
 int xc_cpuid_set(xc_interface *xch,
                  domid_t domid,
                  const unsigned int *input,
tools/libxc/xc_cpuid_x86.c +0 -57

63 lines not on this page · raw message

tools/ocaml/libs/xc/xenctrl.ml +0 -2
index 75006e7..70a325b 100644
@@ -218,8 +218,6 @@ external domain_cpuid_set: handle -> domid -> (int64 * (int64 option))
        = "stub_xc_domain_cpuid_set"
 external domain_cpuid_apply_policy: handle -> domid -> unit
        = "stub_xc_domain_cpuid_apply_policy"
-external cpuid_check: handle -> (int64 * (int64 option)) -> string option array -> (bool * string option array)
-       = "stub_xc_cpuid_check"
 
 external map_foreign_range: handle -> domid -> int
                          -> nativeint -> Xenmmap.mmap_interface
tools/ocaml/libs/xc/xenctrl.mli +0 -3
index 720e4b2..702d8a7 100644
@@ -179,6 +179,3 @@ external domain_cpuid_set: handle -> domid -> (int64 * (int64 option))
        = "stub_xc_domain_cpuid_set"
 external domain_cpuid_apply_policy: handle -> domid -> unit
        = "stub_xc_domain_cpuid_apply_policy"
-external cpuid_check: handle -> (int64 * (int64 option)) -> string option array -> (bool * string option array)
-       = "stub_xc_cpuid_check"
-
tools/ocaml/libs/xc/xenctrl_stubs.c +0 -43

49 lines not on this page · raw message

tools/python/xen/lowlevel/xc/xc.c +0 -34
index 5d112af..aa9f8e4 100644
@@ -711,29 +711,6 @@ static PyObject *pyxc_create_cpuid_dict(char **regs)
    return dict;
 }
 
-static PyObject *pyxc_dom_check_cpuid(XcObject *self,
-                                      PyObject *args)
-{
-    PyObject *sub_input, *config;
-    unsigned int input[2];
-    char *regs[4], *regs_transform[4];
-
-    if ( !PyArg_ParseTuple(args, "iOO", &input[0], &sub_input, &config) )
-        return NULL;
-
-    pyxc_dom_extract_cpuid(config, regs);
-
-    input[1] = XEN_CPUID_INPUT_UNUSED;
-    if ( PyLong_Check(sub_input) )
-        input[1] = PyLong_AsUnsignedLong(sub_input);
-
-    if ( xc_cpuid_check(self->xc_handle, input,
-                        (const char **)regs, regs_transform) )
-        return pyxc_error_to_exception(self->xc_handle);
-
-    return pyxc_create_cpuid_dict(regs_transform);
-}
-
 static PyObject *pyxc_dom_set_policy_cpuid(XcObject *self,
                                            PyObject *args)
 {
@@ -2467,17 +2444,6 @@ static PyMethodDef pyxc_methods[] = {
       " keys    [str]: String of keys to inject.\n" },
 
 #if defined(__i386__) || defined(__x86_64__)
-    { "domain_check_cpuid", 
-      (PyCFunction)pyxc_dom_check_cpuid, 
-      METH_VARARGS, "\n"
-      "Apply checks to host CPUID.\n"
-      " input [long]: Input for cpuid instruction (eax)\n"
-      " sub_input [long]: Second input (optional, may be None) for cpuid "
-      "                     instruction (ecx)\n"
-      " config [dict]: Dictionary of register\n"
-      " config [dict]: Dictionary of register, use for checking\n\n"
-      "Returns: [int] 0 on success; exception on error.\n" },
-    
     { "domain_set_cpuid", 
       (PyCFunction)pyxc_dom_set_cpuid, 
       METH_VARARGS, "\n"
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw
Quoted 5 lines · Andrew Cooper

It turns out that Xapi has a library function using it, but that function is dead so can be removed.

I am fine with the removal of the OCaml bindings and the patch for the OCaml code. If the code is fundamentally broken it should be removed in any case but like you already said, we are not aware of any clients.

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

#2 lore raw
Quoted 7 lines · Christian Lindig
Quoted 5 lines · Andrew Cooper

It turns out that Xapi has a library function using it, but that function is dead so can be removed.

I am fine with the removal of the OCaml bindings and the patch for the OCaml code. If the code is fundamentally broken it should be removed in any case but like you already said, we are not aware of any clients.

Same for python bindings.

Signature · 5 lines
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

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

#3 lore raw
In reply to Andrew Cooper
Quoted 27 lines · Andrew Cooper

There are no current users which I can locate. One piece of xend which didn't move forwards into xl/libxl is this:

# Configure host CPUID consistency checks, which must be satisfied for this
# VM to be allowed to run on this host's processor type:
#cpuid_check=[ '1:ecx=xxxxxxxxxxxxxxxxxxxxxxxxxx1xxxxx' ] # - Host must have VMX feature flag set

The implementation of xc_cpuid_check() is conceptually broken. Dom0's view of CPUID is not the approprite view to check, and will be wrong in the presence of CPUID masking/faulting, and for HVM-based toolstack domains.

If it turns out that the functionality is required, it should be implemented in terms of XEN_SYSCTL_get_cpuid_policy to use the proper CPUID view.

---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>
CC: David Scott <[email protected]>
CC: Christian Lindig <[email protected]>
CC: Juergen Gross <[email protected]>
CC: Jim Fehlig <[email protected]>
CC: Boris Ostrovsky <[email protected]>
CC: Konrad Rzeszutek Wilk <[email protected]>

Quoted 3 lines

RFC initially for feedback, and to see if anyone does expect to be using this call. It turns out that Xapi has a library function using it, but that function is dead so can be removed.

FAOD I am still waiting for Oracle and Suse folks to express their opinions.

I will wait until August 4th. If I don't hear objection by then I will just apply this patch.

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

#4 lore raw
Quoted 28 lines · Wei Liu
Quoted 27 lines · Andrew Cooper

There are no current users which I can locate. One piece of xend which didn't move forwards into xl/libxl is this:

# Configure host CPUID consistency checks, which must be satisfied for this
# VM to be allowed to run on this host's processor type:
#cpuid_check=[ '1:ecx=xxxxxxxxxxxxxxxxxxxxxxxxxx1xxxxx' ] # - Host must have VMX feature flag set

The implementation of xc_cpuid_check() is conceptually broken. Dom0's view of CPUID is not the approprite view to check, and will be wrong in the presence of CPUID masking/faulting, and for HVM-based toolstack domains.

If it turns out that the functionality is required, it should be implemented in terms of XEN_SYSCTL_get_cpuid_policy to use the proper CPUID view.

---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>
CC: David Scott <[email protected]>
CC: Christian Lindig <[email protected]>
CC: Juergen Gross <[email protected]>
CC: Jim Fehlig <[email protected]>
CC: Boris Ostrovsky <[email protected]>
CC: Konrad Rzeszutek Wilk <[email protected]>

Quoted 6 lines
Quoted 3 lines

RFC initially for feedback, and to see if anyone does expect to be using this call. It turns out that Xapi has a library function using it, but that function is dead so can be removed.

FAOD I am still waiting for Oracle and Suse folks to express their opinions.

No objection from me.

Juergen

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

#5 lore raw
Quoted 29 lines · Juergen Gross
Quoted 28 lines · Wei Liu
Quoted 27 lines · Andrew Cooper

There are no current users which I can locate. One piece of xend which didn't move forwards into xl/libxl is this:

# Configure host CPUID consistency checks, which must be satisfied for this
# VM to be allowed to run on this host's processor type:
#cpuid_check=[ '1:ecx=xxxxxxxxxxxxxxxxxxxxxxxxxx1xxxxx' ] # - Host must have VMX feature flag set

The implementation of xc_cpuid_check() is conceptually broken. Dom0's view of CPUID is not the approprite view to check, and will be wrong in the presence of CPUID masking/faulting, and for HVM-based toolstack domains.

If it turns out that the functionality is required, it should be implemented in terms of XEN_SYSCTL_get_cpuid_policy to use the proper CPUID view.

---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>
CC: David Scott <[email protected]>
CC: Christian Lindig <[email protected]>
CC: Juergen Gross <[email protected]>
CC: Jim Fehlig <[email protected]>
CC: Boris Ostrovsky <[email protected]>
CC: Konrad Rzeszutek Wilk <[email protected]>

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

RFC initially for feedback, and to see if anyone does expect to be using this call. It turns out that Xapi has a library function using it, but that function is dead so can be removed.

FAOD I am still waiting for Oracle and Suse folks to express their opinions.

No objection from me.

Or from me.

-boris

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

#6 lore raw
Quoted 33 lines · Boris Ostrovsky
Quoted 32 lines · Juergen Gross
Quoted 31 lines · Wei Liu
Quoted 30 lines · Andrew Cooper

There are no current users which I can locate. One piece of xend which didn't move forwards into xl/libxl is this:

# Configure host CPUID consistency checks, which must be satisfied for this
# VM to be allowed to run on this host's processor type:
#cpuid_check=[ '1:ecx=xxxxxxxxxxxxxxxxxxxxxxxxxx1xxxxx' ] # - Host must have VMX feature flag set

The implementation of xc_cpuid_check() is conceptually broken. Dom0's view of CPUID is not the approprite view to check, and will be wrong in the presence of CPUID masking/faulting, and for HVM-based toolstack domains.

If it turns out that the functionality is required, it should be implemented in terms of XEN_SYSCTL_get_cpuid_policy to use the proper CPUID view.

---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>
CC: David Scott <[email protected]>
CC: Christian Lindig <[email protected]>
CC: Juergen Gross <[email protected]>
CC: Jim Fehlig <[email protected]>
CC: Boris Ostrovsky <[email protected]>
CC: Konrad Rzeszutek Wilk <[email protected]>

RFC initially for feedback, and to see if anyone does expect to be using this call. It turns out that Xapi has a library function using it, but that function is dead so can be removed.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

FAOD I am still waiting for Oracle and Suse folks to express their opinions.

No objection from me.

Or from me.

In that case -- queued.

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