|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] vmx/monitor: CPUID events
On 07/08/16 05:31, Tamas K Lengyel wrote:
> This patch implements sending notification to a monitor subscriber when an
> x86/vmx guest executes the CPUID instruction.
>
> Signed-off-by: Tamas K Lengyel <tamas.lengyel@xxxxxxxxxxxx>
> ---
> Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
> Cc: Wei Liu <wei.liu2@xxxxxxxxxx>
> Cc: Razvan Cojocaru <rcojocaru@xxxxxxxxxxxxxxx>
> Cc: Jan Beulich <jbeulich@xxxxxxxx>
> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> Cc: Jun Nakajima <jun.nakajima@xxxxxxxxx>
> Cc: Kevin Tian <kevin.tian@xxxxxxxxx>
> ---
> tools/libxc/include/xenctrl.h | 1 +
> tools/libxc/xc_monitor.c | 13 +++++++++++++
> tools/tests/xen-access/xen-access.c | 33 ++++++++++++++++++++++++++++++++-
> xen/arch/x86/hvm/monitor.c | 16 ++++++++++++++++
> xen/arch/x86/hvm/vmx/vmx.c | 23 +++++++++++++++++++----
> xen/arch/x86/monitor.c | 13 +++++++++++++
> xen/include/asm-x86/domain.h | 1 +
> xen/include/asm-x86/hvm/monitor.h | 1 +
> xen/include/asm-x86/monitor.h | 3 ++-
> xen/include/public/domctl.h | 1 +
> xen/include/public/vm_event.h | 8 ++++++++
> 11 files changed, 107 insertions(+), 6 deletions(-)
>
> diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
> index 4a85b4a..e904bd5 100644
> --- a/tools/libxc/include/xenctrl.h
> +++ b/tools/libxc/include/xenctrl.h
> @@ -2167,6 +2167,7 @@ int xc_monitor_guest_request(xc_interface *xch, domid_t
> domain_id,
> bool enable, bool sync);
> int xc_monitor_debug_exceptions(xc_interface *xch, domid_t domain_id,
> bool enable, bool sync);
> +int xc_monitor_cpuid(xc_interface *xch, domid_t domain_id, bool enable);
> /**
> * This function enables / disables emulation for each REP for a
> * REP-compatible instruction.
> diff --git a/tools/libxc/xc_monitor.c b/tools/libxc/xc_monitor.c
> index 264992c..4298813 100644
> --- a/tools/libxc/xc_monitor.c
> +++ b/tools/libxc/xc_monitor.c
> @@ -172,6 +172,19 @@ int xc_monitor_debug_exceptions(xc_interface *xch,
> domid_t domain_id,
> return do_domctl(xch, &domctl);
> }
>
> +int xc_monitor_cpuid(xc_interface *xch, domid_t domain_id, bool enable)
> +{
> + DECLARE_DOMCTL;
> +
> + domctl.cmd = XEN_DOMCTL_monitor_op;
> + domctl.domain = domain_id;
> + domctl.u.monitor_op.op = enable ? XEN_DOMCTL_MONITOR_OP_ENABLE
> + : XEN_DOMCTL_MONITOR_OP_DISABLE;
> + domctl.u.monitor_op.event = XEN_DOMCTL_MONITOR_EVENT_CPUID;
> +
> + return do_domctl(xch, &domctl);
> +}
> +
> /*
> * Local variables:
> * mode: C
> diff --git a/tools/tests/xen-access/xen-access.c
> b/tools/tests/xen-access/xen-access.c
> index 02655d5..d525b82 100644
> --- a/tools/tests/xen-access/xen-access.c
> +++ b/tools/tests/xen-access/xen-access.c
> @@ -337,7 +337,7 @@ void usage(char* progname)
> {
> fprintf(stderr, "Usage: %s [-m] <domain_id> write|exec", progname);
> #if defined(__i386__) || defined(__x86_64__)
> - fprintf(stderr, "|breakpoint|altp2m_write|altp2m_exec|debug");
> + fprintf(stderr,
> "|breakpoint|altp2m_write|altp2m_exec|debug|cpuid");
> #endif
> fprintf(stderr,
> "\n"
> @@ -364,6 +364,7 @@ int main(int argc, char *argv[])
> int shutting_down = 0;
> int altp2m = 0;
> int debug = 0;
> + int cpuid = 1;
Should this be on by default? All the rest of the options are 0, and ...
> uint16_t altp2m_view_id = 0;
>
> char* progname = argv[0];
> @@ -426,6 +427,10 @@ int main(int argc, char *argv[])
> {
> debug = 1;
> }
> + else if ( !strcmp(argv[0], "cpuid") )
> + {
> + cpuid = 1;
> + }
> #endif
... you also set it to 1 here.
Thanks,
Razvan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |