Re: [Xen-devel] [PATCH V9] vm_event: Allow subscribing to write events for specific MSR-s
On 06/01/2016 01:39 PM, Ian Jackson wrote: > Razvan Cojocaru writes ("Re: [PATCH V9] vm_event: Allow subscribing to write > events for specific MSR-s"): >> On 05/13/2016 02:35 PM, Jan Beulich wrote: >> On 06.05.16 at 16:33, wrote: Previously, subscribing to MSR write events was an all-or-none approach, with special cases for introspection MSR-s. This patch allows the vm_event consumer to specify exactly what MSR-s it is interested in, and as a side-effect gets rid of the vmx_introspection_force_enabled_msrs[] special case. The patch also introduces arch_monitor_init_domain() and arch_monitor_cleanup_domain(), to do monitor-specific work (as opposed to the previous way of doing all the setup in vm_event_init_domain() / vm_event_cleanup_domain()). This replaces the previously posted "xen: Filter out MSR write events" patch. Signed-off-by: Razvan Cojocaru Acked-by: Wei Liu Acked-by: Kevin Tian >>> >>> Acked-by: Jan Beulich >> >> Does this patch require additional acks? Tamas' maybe? > > I assume it's not for 4.7. (If it were for 4.7 it would require a > release ack, which (on the basis of the information provided so far) I > think ought probably not to be granted.) Indeed, as Wei has already pointed out this isn't meant for 4.7. Thanks, Razvan ___ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH V9] vm_event: Allow subscribing to write events for specific MSR-s
On Wed, Jun 01, 2016 at 11:39:40AM +0100, Ian Jackson wrote: > Razvan Cojocaru writes ("Re: [PATCH V9] vm_event: Allow subscribing to write > events for specific MSR-s"): > > On 05/13/2016 02:35 PM, Jan Beulich wrote: > > On 06.05.16 at 16:33, wrote: > > >> Previously, subscribing to MSR write events was an all-or-none > > >> approach, with special cases for introspection MSR-s. This patch > > >> allows the vm_event consumer to specify exactly what MSR-s it is > > >> interested in, and as a side-effect gets rid of the > > >> vmx_introspection_force_enabled_msrs[] special case. > > >> The patch also introduces arch_monitor_init_domain() and > > >> arch_monitor_cleanup_domain(), to do monitor-specific work > > >> (as opposed to the previous way of doing all the setup in > > >> vm_event_init_domain() / vm_event_cleanup_domain()). > > >> This replaces the previously posted "xen: Filter out MSR write > > >> events" patch. > > >> > > >> Signed-off-by: Razvan Cojocaru > > >> Acked-by: Wei Liu > > >> Acked-by: Kevin Tian > > > > > > Acked-by: Jan Beulich > > > > Does this patch require additional acks? Tamas' maybe? > > I assume it's not for 4.7. (If it were for 4.7 it would require a > release ack, which (on the basis of the information provided so far) I > think ought probably not to be granted.) > This is not for 4.7. Wei. > Thanks, > Ian. ___ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH V9] vm_event: Allow subscribing to write events for specific MSR-s
Razvan Cojocaru writes ("Re: [PATCH V9] vm_event: Allow subscribing to write events for specific MSR-s"): > On 05/13/2016 02:35 PM, Jan Beulich wrote: > On 06.05.16 at 16:33, wrote: > >> Previously, subscribing to MSR write events was an all-or-none > >> approach, with special cases for introspection MSR-s. This patch > >> allows the vm_event consumer to specify exactly what MSR-s it is > >> interested in, and as a side-effect gets rid of the > >> vmx_introspection_force_enabled_msrs[] special case. > >> The patch also introduces arch_monitor_init_domain() and > >> arch_monitor_cleanup_domain(), to do monitor-specific work > >> (as opposed to the previous way of doing all the setup in > >> vm_event_init_domain() / vm_event_cleanup_domain()). > >> This replaces the previously posted "xen: Filter out MSR write > >> events" patch. > >> > >> Signed-off-by: Razvan Cojocaru > >> Acked-by: Wei Liu > >> Acked-by: Kevin Tian > > > > Acked-by: Jan Beulich > > Does this patch require additional acks? Tamas' maybe? I assume it's not for 4.7. (If it were for 4.7 it would require a release ack, which (on the basis of the information provided so far) I think ought probably not to be granted.) Thanks, Ian. ___ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH V9] vm_event: Allow subscribing to write events for specific MSR-s
On Mon, May 30, 2016 at 4:13 AM, Jan Beulich wrote: On 30.05.16 at 09:13, wrote: >> On 05/13/2016 02:35 PM, Jan Beulich wrote: >> On 06.05.16 at 16:33, wrote: Previously, subscribing to MSR write events was an all-or-none approach, with special cases for introspection MSR-s. This patch allows the vm_event consumer to specify exactly what MSR-s it is interested in, and as a side-effect gets rid of the vmx_introspection_force_enabled_msrs[] special case. The patch also introduces arch_monitor_init_domain() and arch_monitor_cleanup_domain(), to do monitor-specific work (as opposed to the previous way of doing all the setup in vm_event_init_domain() / vm_event_cleanup_domain()). This replaces the previously posted "xen: Filter out MSR write events" patch. Signed-off-by: Razvan Cojocaru Acked-by: Wei Liu Acked-by: Kevin Tian >>> >>> Acked-by: Jan Beulich >> >> Does this patch require additional acks? Tamas' maybe? > > Yes, quite clearly (looking at the diffstat). Hm, I thought I already acked it. Acked-by: Tamas K Lengyel ___ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH V9] vm_event: Allow subscribing to write events for specific MSR-s
>>> On 30.05.16 at 09:13, wrote: > On 05/13/2016 02:35 PM, Jan Beulich wrote: > On 06.05.16 at 16:33, wrote: >>> Previously, subscribing to MSR write events was an all-or-none >>> approach, with special cases for introspection MSR-s. This patch >>> allows the vm_event consumer to specify exactly what MSR-s it is >>> interested in, and as a side-effect gets rid of the >>> vmx_introspection_force_enabled_msrs[] special case. >>> The patch also introduces arch_monitor_init_domain() and >>> arch_monitor_cleanup_domain(), to do monitor-specific work >>> (as opposed to the previous way of doing all the setup in >>> vm_event_init_domain() / vm_event_cleanup_domain()). >>> This replaces the previously posted "xen: Filter out MSR write >>> events" patch. >>> >>> Signed-off-by: Razvan Cojocaru >>> Acked-by: Wei Liu >>> Acked-by: Kevin Tian >> >> Acked-by: Jan Beulich > > Does this patch require additional acks? Tamas' maybe? Yes, quite clearly (looking at the diffstat). Jan ___ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH V9] vm_event: Allow subscribing to write events for specific MSR-s
On 05/13/2016 02:35 PM, Jan Beulich wrote: On 06.05.16 at 16:33, wrote: >> Previously, subscribing to MSR write events was an all-or-none >> approach, with special cases for introspection MSR-s. This patch >> allows the vm_event consumer to specify exactly what MSR-s it is >> interested in, and as a side-effect gets rid of the >> vmx_introspection_force_enabled_msrs[] special case. >> The patch also introduces arch_monitor_init_domain() and >> arch_monitor_cleanup_domain(), to do monitor-specific work >> (as opposed to the previous way of doing all the setup in >> vm_event_init_domain() / vm_event_cleanup_domain()). >> This replaces the previously posted "xen: Filter out MSR write >> events" patch. >> >> Signed-off-by: Razvan Cojocaru >> Acked-by: Wei Liu >> Acked-by: Kevin Tian > > Acked-by: Jan Beulich Does this patch require additional acks? Tamas' maybe? Thanks, Razvan ___ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH V9] vm_event: Allow subscribing to write events for specific MSR-s
>>> On 06.05.16 at 16:33, wrote: > Previously, subscribing to MSR write events was an all-or-none > approach, with special cases for introspection MSR-s. This patch > allows the vm_event consumer to specify exactly what MSR-s it is > interested in, and as a side-effect gets rid of the > vmx_introspection_force_enabled_msrs[] special case. > The patch also introduces arch_monitor_init_domain() and > arch_monitor_cleanup_domain(), to do monitor-specific work > (as opposed to the previous way of doing all the setup in > vm_event_init_domain() / vm_event_cleanup_domain()). > This replaces the previously posted "xen: Filter out MSR write > events" patch. > > Signed-off-by: Razvan Cojocaru > Acked-by: Wei Liu > Acked-by: Kevin Tian Acked-by: Jan Beulich ___ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
[Xen-devel] [PATCH V9] vm_event: Allow subscribing to write events for specific MSR-s
Previously, subscribing to MSR write events was an all-or-none approach, with special cases for introspection MSR-s. This patch allows the vm_event consumer to specify exactly what MSR-s it is interested in, and as a side-effect gets rid of the vmx_introspection_force_enabled_msrs[] special case. The patch also introduces arch_monitor_init_domain() and arch_monitor_cleanup_domain(), to do monitor-specific work (as opposed to the previous way of doing all the setup in vm_event_init_domain() / vm_event_cleanup_domain()). This replaces the previously posted "xen: Filter out MSR write events" patch. Signed-off-by: Razvan Cojocaru Acked-by: Wei Liu Acked-by: Kevin Tian --- Changes since V8: - Now using DECLARE_BITMAP() for the monitor bitmaps. - Const-ified monitored_msr(). --- tools/libxc/include/xenctrl.h | 9 ++- tools/libxc/xc_monitor.c | 6 +- xen/arch/x86/hvm/event.c | 3 +- xen/arch/x86/hvm/hvm.c | 3 +- xen/arch/x86/hvm/vmx/vmcs.c| 26 +--- xen/arch/x86/hvm/vmx/vmx.c | 10 +-- xen/arch/x86/monitor.c | 124 + xen/arch/x86/vm_event.c| 3 +- xen/common/vm_event.c | 5 ++ xen/include/asm-arm/monitor.h | 13 xen/include/asm-x86/domain.h | 3 +- xen/include/asm-x86/hvm/hvm.h | 8 +-- xen/include/asm-x86/hvm/vmx/vmcs.h | 7 --- xen/include/asm-x86/monitor.h | 12 xen/include/public/domctl.h| 5 +- 15 files changed, 168 insertions(+), 69 deletions(-) diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h index dc54612..edb333b 100644 --- a/tools/libxc/include/xenctrl.h +++ b/tools/libxc/include/xenctrl.h @@ -2153,8 +2153,13 @@ int xc_monitor_get_capabilities(xc_interface *xch, domid_t domain_id, int xc_monitor_write_ctrlreg(xc_interface *xch, domid_t domain_id, uint16_t index, bool enable, bool sync, bool onchangeonly); -int xc_monitor_mov_to_msr(xc_interface *xch, domid_t domain_id, bool enable, - bool extended_capture); +/* + * A list of MSR indices can usually be found in /usr/include/asm/msr-index.h. + * Please consult the Intel/AMD manuals for more information on + * non-architectural indices. + */ +int xc_monitor_mov_to_msr(xc_interface *xch, domid_t domain_id, uint32_t msr, + bool enable); int xc_monitor_singlestep(xc_interface *xch, domid_t domain_id, bool enable); int xc_monitor_software_breakpoint(xc_interface *xch, domid_t domain_id, bool enable); diff --git a/tools/libxc/xc_monitor.c b/tools/libxc/xc_monitor.c index b1705dd..78131b2 100644 --- a/tools/libxc/xc_monitor.c +++ b/tools/libxc/xc_monitor.c @@ -86,8 +86,8 @@ int xc_monitor_write_ctrlreg(xc_interface *xch, domid_t domain_id, return do_domctl(xch, &domctl); } -int xc_monitor_mov_to_msr(xc_interface *xch, domid_t domain_id, bool enable, - bool extended_capture) +int xc_monitor_mov_to_msr(xc_interface *xch, domid_t domain_id, uint32_t msr, + bool enable) { DECLARE_DOMCTL; @@ -96,7 +96,7 @@ int xc_monitor_mov_to_msr(xc_interface *xch, domid_t domain_id, bool enable, 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_MOV_TO_MSR; -domctl.u.monitor_op.u.mov_to_msr.extended_capture = extended_capture; +domctl.u.monitor_op.u.mov_to_msr.msr = msr; return do_domctl(xch, &domctl); } diff --git a/xen/arch/x86/hvm/event.c b/xen/arch/x86/hvm/event.c index 56c5514..8fdb6f5 100644 --- a/xen/arch/x86/hvm/event.c +++ b/xen/arch/x86/hvm/event.c @@ -57,9 +57,8 @@ bool_t hvm_event_cr(unsigned int index, unsigned long value, unsigned long old) void hvm_event_msr(unsigned int msr, uint64_t value) { struct vcpu *curr = current; -struct arch_domain *ad = &curr->domain->arch; -if ( ad->monitor.mov_to_msr_enabled ) +if ( monitored_msr(curr->domain, msr) ) { vm_event_request_t req = { .reason = VM_EVENT_REASON_MOV_TO_MSR, diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 82e2ed1..799fdeb 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -3694,7 +3694,6 @@ int hvm_msr_write_intercept(unsigned int msr, uint64_t msr_content, bool_t mtrr; unsigned int edx, index; int ret = X86EMUL_OKAY; -struct arch_domain *currad = ¤t->domain->arch; HVMTRACE_3D(MSR_WRITE, msr, (uint32_t)msr_content, (uint32_t)(msr_content >> 32)); @@ -3702,7 +3701,7 @@ int hvm_msr_write_intercept(unsigned int msr, uint64_t msr_content, hvm_cpuid(1, NULL, NULL, NULL, &edx); mtrr = !!(edx & cpufeat_mask(X86_FEATURE_MTRR)); -if ( may_defer && unlikely(currad->monitor.mov_to_msr