Re: [Xen-devel] [PATCH 00/13] x86: CPUID and MSR policy marshalling support

2018-07-04 Thread Andrew Cooper
On 04/07/18 09:17, Jan Beulich wrote:
 On 03.07.18 at 22:55,  wrote:
>> Some open questions:
>>
>>   * The position of libx86 in the source tree.  It probably doesn't want to
>> live in its current location.
> So did you intentionally decide against ...
>
>>  .gitignore  |   2 +-
>>  tools/include/Makefile  |  15 ++
>>  tools/libxc/Makefile|  14 +-
>>  tools/libxc/include/xenctrl.h   |  15 +-
>>  tools/libxc/xc_cpuid_x86.c  | 163 +---
>>  tools/misc/xen-cpuid.c  | 135 +++-
>>  tools/tests/x86_emulator/x86-emulate.h  |   2 +
>>  xen/arch/x86/cpu/common.c   |   2 +-
>>  xen/arch/x86/cpuid.c|  32 +---
>>  xen/arch/x86/domctl.c   | 133 
>>  xen/arch/x86/msr.c  |   4 +-
>>  xen/arch/x86/sysctl.c   | 101 
>>  xen/arch/x86/x86_emulate/x86_emulate.h  |   7 +-
>>  xen/common/Makefile |   1 +
>>  xen/common/libx86/Makefile  |   3 +
>>  xen/common/libx86/cpuid.c   | 226 
>> +++
>>  xen/common/libx86/libx86-private.h  |  74 +
>>  xen/common/libx86/msr.c | 134 
>>  xen/common/libx86/policies.c|  19 +++
> xen/lib/x86/... or lib/x86/... here and ...
>
>>  xen/include/Makefile|   6 +-
>>  xen/include/asm-x86/cpufeatures.h   |   2 +-
>>  xen/include/asm-x86/cpuid.h | 228 
>> +---
>>  xen/include/asm-x86/msr.h   |  65 ++--
>>  xen/include/public/arch-x86/xen.h   |  18 +++
>>  xen/include/public/domctl.h |  25 +++
>>  xen/include/public/sysctl.h |  41 +
>>  xen/include/{asm-x86 => xen/libx86}/cpuid.h | 103 +
>>  xen/include/xen/libx86/msr.h|  78 ++
>>  xen/include/xen/libx86/policies.h   |  35 +
> xen/include/lib/x86/... or include/lib/x86/... here, as suggested
> on irc?

I tried, got stuck, then decided it would be better use of time to post
a v1 for review.

Once a general decision has been made, I'll try to remember/work out how
to use `git filter-branch` without it trying to delete my entire history.

> Personally I'd favor the top level variants, as that makes
> sufficiently clear that the code is neither specific to the hypervisor
> nor specific to the tools.

That's the concern I've got with the top level variant.  I view this as
hypervisor code which we also want to use in libxc, rather than
specifically separate code.

~Andrew

___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH 00/13] x86: CPUID and MSR policy marshalling support

2018-07-04 Thread Jan Beulich
>>> On 03.07.18 at 22:55,  wrote:
> Some open questions:
> 
>   * The position of libx86 in the source tree.  It probably doesn't want to
> live in its current location.

So did you intentionally decide against ...

>  .gitignore  |   2 +-
>  tools/include/Makefile  |  15 ++
>  tools/libxc/Makefile|  14 +-
>  tools/libxc/include/xenctrl.h   |  15 +-
>  tools/libxc/xc_cpuid_x86.c  | 163 +---
>  tools/misc/xen-cpuid.c  | 135 +++-
>  tools/tests/x86_emulator/x86-emulate.h  |   2 +
>  xen/arch/x86/cpu/common.c   |   2 +-
>  xen/arch/x86/cpuid.c|  32 +---
>  xen/arch/x86/domctl.c   | 133 
>  xen/arch/x86/msr.c  |   4 +-
>  xen/arch/x86/sysctl.c   | 101 
>  xen/arch/x86/x86_emulate/x86_emulate.h  |   7 +-
>  xen/common/Makefile |   1 +
>  xen/common/libx86/Makefile  |   3 +
>  xen/common/libx86/cpuid.c   | 226 +++
>  xen/common/libx86/libx86-private.h  |  74 +
>  xen/common/libx86/msr.c | 134 
>  xen/common/libx86/policies.c|  19 +++

xen/lib/x86/... or lib/x86/... here and ...

>  xen/include/Makefile|   6 +-
>  xen/include/asm-x86/cpufeatures.h   |   2 +-
>  xen/include/asm-x86/cpuid.h | 228 
> +---
>  xen/include/asm-x86/msr.h   |  65 ++--
>  xen/include/public/arch-x86/xen.h   |  18 +++
>  xen/include/public/domctl.h |  25 +++
>  xen/include/public/sysctl.h |  41 +
>  xen/include/{asm-x86 => xen/libx86}/cpuid.h | 103 +
>  xen/include/xen/libx86/msr.h|  78 ++
>  xen/include/xen/libx86/policies.h   |  35 +

xen/include/lib/x86/... or include/lib/x86/... here, as suggested
on irc? Personally I'd favor the top level variants, as that makes
sufficiently clear that the code is neither specific to the hypervisor
nor specific to the tools.

Jan



___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

[Xen-devel] [PATCH 00/13] x86: CPUID and MSR policy marshalling support

2018-07-03 Thread Andrew Cooper
This series introduces libx86, a small shared library between the hypervisor
and libxc, and hypercalls to get/set full CPUID/MSR policies.  Future work
will arrange for XEN_DOMCTL_set_cpumsr_policy to function properly, after the
auditing and comparison logic is sorted.

In the meantime, the data marshalling logic is in a suitable state for review.

Some open questions:

  * The position of libx86 in the source tree.  It probably doesn't want to
live in its current location.
  * Naming of various files, particularly policy.c (which I don't like, but
can't think of anything better).
  * A TOCTOU race in the final patch, caused by the copy_from_guest() ABI.
More details in that patch.

This series is based on x86-next, and can be found in git form here:

  
http://xenbits.xen.org/gitweb/?p=people/andrewcoop/xen.git;a=shortlog;h=refs/heads/cpuid-marshal-v1

Andrew Cooper (5):
  libx86: Introduce libx86/cpuid.h
  libx86: Introduce libx86/msr.h and share msr_{domain,vcpu}_policy with 
userspace
  libx86: Introduce a helper to serialise a cpuid_policy object
  x86: Collect policies together into groups
  libx86: Introduce a helper to deserialise a cpuid_policy object

Roger Pau Monné (5):
  libx86: generate cpuid-autogen.h in the libx86 include dir
  libx86: Share struct cpuid_policy with userspace
  libx86: introduce a libx86 shared library
  libx86: Introduce a helper to serialise msr_{domain,vcpu}_policy objects
  libx86: introduce a helper to deserialize MSR policies

Sergey Dyasli (3):
  x86/sysctl: Implement XEN_SYSCTL_get_cpumsr_policy
  x86/domctl: Implement XEN_DOMCTL_get_cpumsr_policy
  x86/domctl: Implement XEN_DOMCTL_set_cpumsr_policy

 .gitignore  |   2 +-
 tools/include/Makefile  |  15 ++
 tools/libxc/Makefile|  14 +-
 tools/libxc/include/xenctrl.h   |  15 +-
 tools/libxc/xc_cpuid_x86.c  | 163 +---
 tools/misc/xen-cpuid.c  | 135 +++-
 tools/tests/x86_emulator/x86-emulate.h  |   2 +
 xen/arch/x86/cpu/common.c   |   2 +-
 xen/arch/x86/cpuid.c|  32 +---
 xen/arch/x86/domctl.c   | 133 
 xen/arch/x86/msr.c  |   4 +-
 xen/arch/x86/sysctl.c   | 101 
 xen/arch/x86/x86_emulate/x86_emulate.h  |   7 +-
 xen/common/Makefile |   1 +
 xen/common/libx86/Makefile  |   3 +
 xen/common/libx86/cpuid.c   | 226 +++
 xen/common/libx86/libx86-private.h  |  74 +
 xen/common/libx86/msr.c | 134 
 xen/common/libx86/policies.c|  19 +++
 xen/include/Makefile|   6 +-
 xen/include/asm-x86/cpufeatures.h   |   2 +-
 xen/include/asm-x86/cpuid.h | 228 +---
 xen/include/asm-x86/msr.h   |  65 ++--
 xen/include/public/arch-x86/xen.h   |  18 +++
 xen/include/public/domctl.h |  25 +++
 xen/include/public/sysctl.h |  41 +
 xen/include/{asm-x86 => xen/libx86}/cpuid.h | 103 +
 xen/include/xen/libx86/msr.h|  78 ++
 xen/include/xen/libx86/policies.h   |  35 +
 xen/include/xen/xmalloc.h   |   7 +
 xen/xsm/flask/hooks.c   |   3 +
 xen/xsm/flask/policy/access_vectors |   4 +-
 32 files changed, 1281 insertions(+), 416 deletions(-)
 create mode 100644 xen/common/libx86/Makefile
 create mode 100644 xen/common/libx86/cpuid.c
 create mode 100644 xen/common/libx86/libx86-private.h
 create mode 100644 xen/common/libx86/msr.c
 create mode 100644 xen/common/libx86/policies.c
 copy xen/include/{asm-x86 => xen/libx86}/cpuid.h (77%)
 create mode 100644 xen/include/xen/libx86/msr.h
 create mode 100644 xen/include/xen/libx86/policies.h

-- 
2.1.4


___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel