ARM: Implement support for write-ctrlreg vm-events
cover ARM: Implement support for write-ctrlreg vm-events
I've decided to include a cover-letter for this patch to ask for some feedback on a few matters (and also to detail the changes that were done here instead of writing that in the commit message).
First,
DETAILS OF CHANGES:
== Moved to common-side:
1) monitor_ctrlreg_bitmask macro
2) hvm_event_cr->vm_event_monitor_cr
3) XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG handling (moved from X86 arch_monitor_domctl_event to common monitor_domctl)
== ARM implementations:
1) add VM_EVENT_ARM_{SCTLR,TTBR{0,1},TTBCR} as possible vm_event_write_ctrlreg indexes
2) add write_ctrlreg_* bits in arch_domain
3) vm_event_monitor_get_capabilities updated to reflect support for XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG
4) on the scheduling tail, p2m_restore_state sets the HCR_TVM bit if write_ctrlreg_enabled <> 0 for the domain
5) traps.c, traps.h:
do_cp15_32, do_cp15_64 and do_sysreg now handle HCR_TVM traps, emulating writes as needed and also calling vm_event_monitor_cr in the process for the targeted monitored registers
The patch was currently tested on an ARMv8 (CONFIG_ARM_64) machine (after applying a fix I'll send soon). With CONFIG_ARM_32 I only checked that Xen clean-builds ok.
Then,
QUESTIONS (FOR VM-EVENTS & ARM MAINTAINERS ESPECIALLY):
Q1) Getting rid of the "#ifdef CONFIG_X86" @
monitor_domctl->XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG case. To trap targeted control-registers writes, on ARM we check if write_ctrlreg_enabled is non-zero on the scheduling tail and set/unset the HCR_TVM bit accordingly (see the p2m_restore_state function).
I see that on X86 for CR3 that's done @ vmx_update_guest_cr by this code:
/* Trap CR3 updates if CR3 memory events are enabled. */ if ( v->domain->arch.monitor.write_ctrlreg_enabled &
monitor_ctrlreg_bitmask(VM_EVENT_X86_CR3) )
v->arch.hvm_vmx.exec_control |= CPU_BASED_CR3_LOAD_EXITING;
Couldn't we move this part on the X86 scheduling tail as it is done for ARM in this changeset?
Q2) About VM_EVENT_FLAG_DENY
Q2.1)
Doesn't it require sync = 1 (i.e. the vcpu to be paused) to work? If so, shouldn't we call vm_event_register_write_resume only after checking that VM_EVENT_FLAG_VCPU_PAUSED flag is set (vm_event_resume). Moreover, if we do that, wouldn't it be 'cleaner' to rename vm_event_register_write_resume->vm_event_deny, check for the VM_EVENT_FLAG_DENY flag in vm_event_resume instead and call vm_event_deny from there after this check?
Q2.2)
VM_EVENT_FLAG_DENY functionality is not implemented w/ this change-set. What is done instead is that the control-register write is done *before* sending the vm-event (vm_event_put_request). This way, the user can override the written register value after receiving the vm-event, which in effect provides the same flexibility as VM_EVENT_FLAG_DENY does. Using this strategy instead would simplify both Xen's code and the libxc user's code.
Thoughts?
Q3) About security: i.e. making sure I don't crash Xen :)
When a system-register write is trapped in Xen due to the HCR_TVM bit, besides triggering the vm-event where it's the case, we also need to emulate this write operation. This is done with the WRITE_SYSREG* macros (see TVM_EMUL/TVM_EMUL_VMEVT macros and their usage).
A potential security issue I see here is a case where WRITE_SYSREG* would cause some kind of hardware fault/exception from EL2 that I did not take into account. Since the value that must be written is determined by the domain, that would mean that a 'bad' domain could willingly cause Xen to crash.
I've read the ARM manuals and of course I've kept this in mind while doing the emulation, but I still need some clarifications. Concretely, this is the information I haven't found while reading the docs:
Q3.1)
If an AArch64 domain does:
MSR SCTLR_EL1, <Xt>
and given that SCTLR_EL1 is a 32-bit system register and that Xt is a 64-bit register, what happens if the *high* 32-bits of Xt are not set to zero? Are they simply ignored or would that cause a fault? If so, would that fault happen before trapping to EL2?
Q3.2)
What would happen if a domain writes an invalid value to these regs. By invalid I mean writing 1 to RES0/UNK/SBZP/RAZ/SBZP bits or vice-versa (0 to RES1,etc). Again, could such behavior cause faults when doing WRITE_SYSREG*? Note that this also concerns functions like xc_vcpu_setcontext.
Q4) The ARMv7 manual doesn't include AMAIR0/AMAIR1 in the list of registers that
cause HYP traps on write when the HCR.TVM bit is set. Is that correct? If so, should I surround parts relevant to them in this changeset w/ CONFIG_ARM_64?
Corneliu ZUZU (1):
arm/monitor vm-events: implement write-ctrlreg support
xen/arch/arm/p2m.c | 5 + xen/arch/arm/traps.c | 128 +++++++++++++++++++++- xen/arch/x86/hvm/event.c | 27 ----- xen/arch/x86/hvm/hvm.c | 2 +- xen/arch/x86/hvm/vmx/vmx.c | 2 +- xen/arch/x86/monitor.c | 45 -------- xen/common/monitor.c | 48 +++++++++ xen/common/vm_event.c | 29 +++++ xen/include/asm-arm/domain.h | 8 ++ xen/include/asm-arm/traps.h | 227 ++++++++++++++++++++++++++++++++++++++++ xen/include/asm-arm/vm_event.h | 4 +- xen/include/asm-x86/hvm/event.h | 13 +-- xen/include/asm-x86/monitor.h | 2 - xen/include/public/vm_event.h | 8 +- xen/include/xen/monitor.h | 2 + xen/include/xen/vm_event.h | 8 ++ 16 files changed, 467 insertions(+), 91 deletions(-) create mode 100644 xen/include/asm-arm/traps.h
Signature · 7 lines
2.5.0 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
PATCH 1/1 arm/monitor vm-events: implement write-ctrlreg support
This patch adds ARM support for write-ctrlreg monitor vm-events. The ARM control-registers that can be monitored are:
- VM_EVENT_ARM_SCTLR: AArch32 SCTLR, AArch64 SCTLR_EL1
- VM_EVENT_ARM_TTBR{0,1}: AArch32 TTBR{0,1}, AArch64 TTBR{0,1}_EL1
- VM_EVENT_ARM_TTBCR: AArch32 TTBCR, AArch64 TCR_EL1Trapping of write operations for these registers was attained by setting the HCR_EL2.TVM / HCR.TVM bit.
--- xen/arch/arm/p2m.c | 5 + xen/arch/arm/traps.c | 128 +++++++++++++++++++++- xen/arch/x86/hvm/event.c | 27 ----- xen/arch/x86/hvm/hvm.c | 2 +- xen/arch/x86/hvm/vmx/vmx.c | 2 +- xen/arch/x86/monitor.c | 45 -------- xen/common/monitor.c | 48 +++++++++ xen/common/vm_event.c | 29 +++++ xen/include/asm-arm/domain.h | 8 ++ xen/include/asm-arm/traps.h | 227 ++++++++++++++++++++++++++++++++++++++++ xen/include/asm-arm/vm_event.h | 4 +- xen/include/asm-x86/hvm/event.h | 13 +-- xen/include/asm-x86/monitor.h | 2 - xen/include/public/vm_event.h | 8 +- xen/include/xen/monitor.h | 2 + xen/include/xen/vm_event.h | 8 ++ 16 files changed, 467 insertions(+), 91 deletions(-) create mode 100644 xen/include/asm-arm/traps.h
xen/arch/arm/p2m.c +5 -0
@@ -108,6 +108,11 @@ void p2m_restore_state(struct vcpu *n)else hcr |=HCR_RW ; +if (likely (0 == n->domain->arch.monitor.write_ctrlreg_enabled) ) + hcr &= ~HCR_TVM ; +else + hcr |=HCR_TVM ; +WRITE_SYSREG (n->arch.sctlr,SCTLR_EL1 );isb ();
xen/arch/arm/traps.c +124 -4
184 lines not on this page · raw message
xen/arch/x86/hvm/event.c +0 -27
@@ -27,33 +27,6 @@#include <asm/vm_event.h> #include <public/vm_event.h> -bool_t hvm_event_cr (unsigned int index,unsigned long value,unsigned long old) -{ -struct vcpu *curr = current; -struct arch_domain *ad = &curr->domain->arch; -unsigned int ctrlreg_bitmask =monitor_ctrlreg_bitmask (index); - -if ( (ad->monitor.write_ctrlreg_enabled & ctrlreg_bitmask) && - (!(ad->monitor.write_ctrlreg_onchangeonly & ctrlreg_bitmask) || - value != old) ) - { -bool_t sync = !!(ad->monitor.write_ctrlreg_sync & ctrlreg_bitmask); - -vm_event_request_t req = { - .reason =VM_EVENT_REASON_WRITE_CTRLREG , - .vcpu_id = curr->vcpu_id, - .u.write_ctrlreg.index = index, - .u.write_ctrlreg.new_value = value, - .u.write_ctrlreg.old_value = old - }; - -vm_event_monitor_traps (curr, sync, &req); -return 1 ; - } - -return 0 ; -} -void hvm_event_msr (unsigned int msr,uint64_t value) {struct vcpu *curr = current;
xen/arch/x86/hvm/hvm.c +1 -1
@@ -37,6 +37,7 @@#include <xen/mem_access.h> #include <xen/rangeset.h> #include <xen/vm_event.h> +#include <xen/monitor.h> #include <asm/shadow.h> #include <asm/hap.h> #include <asm/current.h>
@@ -52,7 +53,6 @@#include <asm/traps.h> #include <asm/mc146818rtc.h> #include <asm/mce.h> -#include <asm/monitor.h> #include <asm/hvm/hvm.h> #include <asm/hvm/vpt.h> #include <asm/hvm/support.h>
xen/arch/x86/hvm/vmx/vmx.c +1 -1
@@ -25,6 +25,7 @@#include <xen/domain_page.h> #include <xen/hypercall.h> #include <xen/perfc.h> +#include <xen/monitor.h> #include <asm/current.h> #include <asm/io.h> #include <asm/iocap.h>
@@ -57,7 +58,6 @@#include <asm/hvm/nestedhvm.h> #include <asm/altp2m.h> #include <asm/event.h> -#include <asm/monitor.h> #include <public/arch-x86/cpuid.h> static bool_t __initdata opt_force_ept;
xen/arch/x86/monitor.c +0 -45
51 lines not on this page · raw message
xen/common/monitor.c +48 -0
54 lines not on this page · raw message
xen/common/vm_event.c +29 -0
@@ -25,6 +25,7 @@#include <xen/wait.h> #include <xen/vm_event.h> #include <xen/mem_access.h> +#include <xen/monitor.h> #include <asm/p2m.h> #include <asm/altp2m.h> #include <asm/vm_event.h>
@@ -824,6 +825,34 @@ int vm_event_monitor_traps(struct vcpu *v, uint8_t sync,return 1 ; } +bool_t vm_event_monitor_cr (unsigned int index,unsigned long value, +unsigned long old) +{ +struct vcpu *curr = current; +struct arch_domain *ad = &curr->domain->arch; +unsigned int ctrlreg_bitmask =monitor_ctrlreg_bitmask (index); + +if ( (ad->monitor.write_ctrlreg_enabled & ctrlreg_bitmask) && + (!(ad->monitor.write_ctrlreg_onchangeonly & ctrlreg_bitmask) || + value != old) ) + { +bool_t sync = !!(ad->monitor.write_ctrlreg_sync & ctrlreg_bitmask); + +vm_event_request_t req = { + .reason =VM_EVENT_REASON_WRITE_CTRLREG , + .vcpu_id = curr->vcpu_id, + .u.write_ctrlreg.index = index, + .u.write_ctrlreg.new_value = value, + .u.write_ctrlreg.old_value = old + }; + +vm_event_monitor_traps (curr, sync, &req); +return 1 ; + } + +return 0 ; +} +void vm_event_monitor_guest_request (void ) {struct vcpu *curr = current;
xen/include/asm-arm/domain.h +8 -0
@@ -129,6 +129,14 @@ struct arch_domainpaddr_t efi_acpi_gpa;paddr_t efi_acpi_len;#endif + +/* Arch-specific monitor options */ +struct { +unsigned int write_ctrlreg_enabled :4 ; +unsigned int write_ctrlreg_sync :4 ; +unsigned int write_ctrlreg_onchangeonly :4 ; + } monitor; + } __cacheline_aligned;struct arch_vcpu
xen/include/asm-arm/traps.h new file +227 -0
227 lines not on this page · raw message
xen/include/asm-arm/vm_event.h +3 -1
@@ -33,6 +33,7 @@ int vm_event_init_domain(struct domain *d)static inline void vm_event_cleanup_domain (struct domain *d) { +memset (&d->arch.monitor,0 ,sizeof (d->arch.monitor));memset (&d->monitor,0 ,sizeof (d->monitor)); }
@@ -63,7 +64,8 @@ static inline uint32_t vm_event_monitor_get_capabilities(struct domain *d) {uint32_t capabilities =0 ; - capabilities = (1U <<XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST ); + capabilities = (1U <<XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG ) | + (1U <<XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST );return capabilities; }
xen/include/asm-x86/hvm/event.h +4 -9
@@ -21,6 +21,7 @@#include <xen/sched.h> #include <xen/paging.h> +#include <xen/vm_event.h> #include <public/vm_event.h> enum hvm_event_breakpoint_type
@@ -29,19 +30,13 @@ enum hvm_event_breakpoint_type HVM_EVENT_SINGLESTEP_BREAKPOINT, }; -/* -* Called for current VCPU on crX/MSR changes by guest. -* The event might not fire if the client has subscribed to it in onchangeonly -* mode, hence the bool_t return type for control register write events. -*/ -bool_t hvm_event_cr (unsigned int index,unsigned long value, -unsigned long old); -#define hvm_event_crX (cr, new, old) \ - hvm_event_cr(VM_EVENT_X86_##cr, new, old)void hvm_event_msr (unsigned int msr,uint64_t value);int hvm_event_breakpoint (unsigned long rip,enum hvm_event_breakpoint_type type); +#define hvm_event_crX (cr, new, old) \ + vm_event_monitor_cr(VM_EVENT_X86_##cr, new, old) +#endif /* __ASM_X86_HVM_EVENT_H__ */ /*
xen/include/asm-x86/monitor.h +0 -2
@@ -27,8 +27,6 @@#include <asm/cpufeature.h> #include <asm/hvm/hvm.h> -#define monitor_ctrlreg_bitmask (ctrlreg_index) (1U << (ctrlreg_index)) -static inline int arch_monitor_domctl_op (struct domain *d,struct xen_domctl_monitor_op *mop) {
xen/include/public/vm_event.h +7 -1
@@ -120,12 +120,18 @@/* An event has been requested via HVMOP_guest_request_vm_event. */ #define VM_EVENT_REASON_GUEST_REQUEST 8 -/* Supported values for the vm_event_write_ctrlreg index. */ +/* Supported values for the vm_event_write_ctrlreg index (x86). */ #define VM_EVENT_X86_CR0 0#define VM_EVENT_X86_CR3 1#define VM_EVENT_X86_CR4 2#define VM_EVENT_X86_XCR0 3 +/* Supported values for the vm_event_write_ctrlreg index (arm). */ +#define VM_EVENT_ARM_SCTLR 0/* SCTLR_EL1 (aarch64), SCTLR (aarch32) */ +#define VM_EVENT_ARM_TTBR0 1/* TTBR0_EL1 (aarch64), TTBR0 (aarch32) */ +#define VM_EVENT_ARM_TTBR1 2/* TTBR1_EL1 (aarch64), TTBR1 (aarch32) */ +#define VM_EVENT_ARM_TTBCR 3/* TCR_EL1 (aarch64), TTBCR (aarch32) */ +/* * Using a custom struct (not hvm_hw_cpu) so as to not fill * the vm_event ring buffer too quickly.
xen/include/xen/monitor.h +2 -0
@@ -25,6 +25,8 @@struct domain ;struct xen_domctl_monitor_op ; +#define monitor_ctrlreg_bitmask (ctrlreg_index) (1U << (ctrlreg_index)) +int monitor_domctl (struct domain *d,struct xen_domctl_monitor_op *op);#endif /* __XEN_MONITOR_H__ */
xen/include/xen/vm_event.h +8 -0
@@ -81,6 +81,14 @@ void vm_event_vcpu_unpause(struct vcpu *v);int vm_event_monitor_traps (struct vcpu *v,uint8_t sync,vm_event_request_t *req); +/* +* Called for current VCPU on control-register changes by guest. +* The event might not fire if the client has subscribed to it in onchangeonly +* mode, hence the bool_t return type for control register write events. +*/ +bool_t vm_event_monitor_cr (unsigned int index,unsigned long value, +unsigned long old); +void vm_event_monitor_guest_request (void );#endif /* __VM_EVENT_H__ */
Signature · 7 lines
2.5.0 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Quoted 2 lines · Corneliu ZUZU
The patch was currently tested on an ARMv8 (
CONFIG_ARM_64) machine (after applying a fix I'll send soon).
Shannon beat me to it with the fix ;) See "[PATCH] arm/timer: fix panic when booting with DT".
Corneliu.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 10 lines · Corneliu ZUZU
Q2) About
VM_EVENT_FLAG_DENYQ2.1)
Doesn't it require sync = 1 (i.e. the vcpu to be paused) to work? If so, shouldn't we callvm_event_register_write_resumeonly after checking thatVM_EVENT_FLAG_VCPU_PAUSEDflag is set (vm_event_resume). Moreover, if we do that, wouldn't it be 'cleaner' to renamevm_event_register_write_resume->vm_event_deny, check for theVM_EVENT_FLAG_DENYflag invm_event_resumeinstead and callvm_event_denyfrom there after this check?
Yes, it does require the VCPU to be paused to work, and yes, it's a good idea to check that that flag is set in the response.
Beyond that, I'd prefer we keep vm_event_register_write_resume() because, while today all we do there is check that VM_EVENT_FLAG_DENY is set, we might want do to other things as well there as well (for example, maybe validate the content of some register). That was really the point of the "bigger-named" function.
But that's just my opinion, if Tamas prefers your rename suggestion I'll consider myself outnumbered.
Quoted 9 lines
Q2.2)
VM_EVENT_FLAG_DENYfunctionality is not implemented w/ this change-set. What is done instead is that the control-register write is done *before* sending the vm-event (vm_event_put_request). This way, the user can override the written register value after receiving the vm-event, which in effect provides the same flexibility asVM_EVENT_FLAG_DENYdoes. Using this strategy instead would simplify both Xen's code and the libxc user's code.
Thoughts?
That's how I initially did it with CR events, but with an application dealing with huge numbers of events, an extra hypercall (to re-set the register) can be quite expensive, so I had to rework it to the present state. On these grounds I'm opposed to it - and for consistency I would prefer that all register write events are pre-write events, and deniable with a single vm_event reply.
HTH,
Razvan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 14 lines · Razvan Cojocaru
Quoted 10 lines · Corneliu ZUZU
Q2) About
VM_EVENT_FLAG_DENYQ2.1)
Doesn't it require sync = 1 (i.e. the vcpu to be paused) to work? If so, shouldn't we callvm_event_register_write_resumeonly after checking thatVM_EVENT_FLAG_VCPU_PAUSEDflag is set (vm_event_resume). Moreover, if we do that, wouldn't it be 'cleaner' to renamevm_event_register_write_resume->vm_event_deny, check for theVM_EVENT_FLAG_DENYflag invm_event_resumeinstead and callvm_event_denyfrom there after this check?Yes, it does require the VCPU to be paused to work, and yes, it's a good idea to check that that flag is set in the response.
Quoted 8 lines
Beyond that, I'd prefer we keep
vm_event_register_write_resume()because, while today all we do there is check thatVM_EVENT_FLAG_DENYis set, we might want do to other things as well there as well (for example, maybe validate the content of some register). That was really the point of the "bigger-named" function.But that's just my opinion, if Tamas prefers your rename suggestion I'll consider myself outnumbered.
Oh, ok, then the check for VM_EVENT_FLAG_VCPU_PAUSED would be done in vm_event_register_write_resume instead of vm_event_resume, since I suppose vm_event_register_write_resume shouldn't be called only when the vcpu is paused, we only apply that to the DENY flag, correct?
Quoted 9 lines
Quoted 9 lines
Q2.2)
VM_EVENT_FLAG_DENYfunctionality is not implemented w/ this change-set. What is done instead is that the control-register write is done *before* sending the vm-event (vm_event_put_request). This way, the user can override the written register value after receiving the vm-event, which in effect provides the same flexibility asVM_EVENT_FLAG_DENYdoes. Using this strategy instead would simplify both Xen's code and the libxc user's code.
Thoughts?
Quoted 7 lines
That's how I initially did it with CR events, but with an application dealing with huge numbers of events, an extra hypercall (to re-set the register) can be quite expensive, so I had to rework it to the present state. On these grounds I'm opposed to it - and for consistency I would prefer that all register write events are pre-write events, and deniable with a single
vm_eventreply.
Ah, I understand. I figured the utility of the DENY flag was only for cases where you'd want to actively override the value written to the register (set register to overridden value + resume w/ DENY), instead of just forbidding the write and leaving the register untouched (i.e. set on the old value). If the latter is a desirable functionality then it indeed makes sense to have a DENY flag.
With that said, another thing crossed my mind. Since the DENY flag will be implemented for ARM w/ the next revision and the actual write will be done on the scheduler tail, similarly to X86 ((hvm_do_resume), wouldn't it be good if we separated the code that checks monitor_write_data from there into an arch-dependent function, e.g. vm_event_monitor_write_data? That way the scheduler tail function won't be 'polluted' w/ that code and IMHO it will make the vm-events design more clear (since that functionality will also be in vm_event.c along w/ the other vm_event_* functions).
Quoted 3 lines
HTH,
Razvan
Thanks,
Corneliu.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 24 lines · Corneliu ZUZU
Quoted 23 lines · Razvan Cojocaru
Quoted 13 lines · Corneliu ZUZU
Q2) About
VM_EVENT_FLAG_DENYQ2.1)
Doesn't it require sync = 1 (i.e. the vcpu to be paused) to work? If so, shouldn't we callvm_event_register_write_resumeonly
after checking
thatVM_EVENT_FLAG_VCPU_PAUSEDflag is set (vm_event_resume).
Moreover, if
we do that, wouldn't it be 'cleaner' to renamevm_event_register_write_resume->vm_event_deny, check for theVM_EVENT_FLAG_DENYflag invm_event_resumeinstead and callvm_event_deny
from there after this check?Yes, it does require the VCPU to be paused to work, and yes, it's a good idea to check that that flag is set in the response.
Beyond that, I'd prefer we keep
vm_event_register_write_resume()because, while today all we do there is check thatVM_EVENT_FLAG_DENYis set, we might want do to other things as well there as well (for example, maybe validate the content of some register). That was really the point of the "bigger-named" function.
Quoted 7 lines
Quoted 2 lines
But that's just my opinion, if Tamas prefers your rename suggestion I'll consider myself outnumbered.
Oh, ok, then the check for
VM_EVENT_FLAG_VCPU_PAUSEDwould be done invm_event_register_write_resumeinstead ofvm_event_resume, since I supposevm_event_register_write_resumeshouldn't be called only when the vcpu is paused, we only apply that to the DENY flag, correct?
Yes, I think that's the path of least resistance.
Quoted 21 lines
Quoted 13 lines
Quoted 5 lines
Q2.2)
VM_EVENT_FLAG_DENYfunctionality is not implemented w/ this
change-set.
What is done instead is that the control-register write is done
*before*Quoted 8 lines
sending the vm-event (
vm_event_put_request). This way, the user can override the written register value after receiving the
vm-event, which
in effect provides the same flexibility asVM_EVENT_FLAG_DENYdoes. Using this strategy instead would simplify both Xen's code and
the libxc
user's code.
Thoughts?Quoted 7 lines
That's how I initially did it with CR events, but with an application dealing with huge numbers of events, an extra hypercall (to re-set the register) can be quite expensive, so I had to rework it to the present state. On these grounds I'm opposed to it - and for consistency I would prefer that all register write events are pre-write events, and deniable with a single
vm_eventreply.
Quoted 8 lines
Ah, I understand. I figured the utility of the DENY flag was only for cases where you'd want to actively
override the value written to the register (set register to overridden value + resume w/ DENY), instead
of just forbidding the write and leaving the register untouched (i.e. set on the old value).
If the latter is a desirable functionality then it indeed makes sense to have a DENY flag.
Yes, that's the goal.
Quoted 11 lines
With that said, another thing crossed my mind. Since the DENY flag will be implemented for ARM w/ the next
revision and the actual write will be done on the scheduler tail, similarly to X86 ((hvm_do_resume), wouldn't
it be good if we separated the code that checksmonitor_write_datafrom there into an arch-dependent function,
e.g.vm_event_monitor_write_data? That way the scheduler tail function won't be 'polluted' w/ that code and IMHO
it will make the vm-events design more clear (since that functionality will also be invm_event.calong w/ the other
vm_event_* functions).
Sounds good, except perhaps for the function name but I'm not sure what a better one might be unfortunately, maybe someone else with chime in with a suggestion.
Thanks,
Razvan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 74 lines · Razvan Cojocaru
Quoted 24 lines · Corneliu ZUZU
Quoted 23 lines · Razvan Cojocaru
Quoted 13 lines · Corneliu ZUZU
Q2) About
VM_EVENT_FLAG_DENYQ2.1)
Doesn't it require sync = 1 (i.e. the vcpu to be paused) to work? If so, shouldn't we callvm_event_register_write_resumeonly
after checking
thatVM_EVENT_FLAG_VCPU_PAUSEDflag is set (vm_event_resume).
Moreover, if
we do that, wouldn't it be 'cleaner' to renamevm_event_register_write_resume->vm_event_deny, check for theVM_EVENT_FLAG_DENYflag invm_event_resumeinstead and callvm_event_deny
from there after this check?Yes, it does require the VCPU to be paused to work, and yes, it's a good idea to check that that flag is set in the response.
Beyond that, I'd prefer we keep
vm_event_register_write_resume()because, while today all we do there is check thatVM_EVENT_FLAG_DENYis set, we might want do to other things as well there as well (for example, maybe validate the content of some register). That was really the point of the "bigger-named" function.Quoted 6 lines
Quoted 2 lines
But that's just my opinion, if Tamas prefers your rename suggestion I'll consider myself outnumbered.
Oh, ok, then the check for
VM_EVENT_FLAG_VCPU_PAUSEDwould be done invm_event_register_write_resumeinstead ofvm_event_resume, since I supposevm_event_register_write_resumeshouldn't be called only when the vcpu is paused, we only apply that to the DENY flag, correct?Yes, I think that's the path of least resistance.
Quoted 20 lines
Quoted 13 lines
Quoted 5 lines
Q2.2)
VM_EVENT_FLAG_DENYfunctionality is not implemented w/ this
change-set.
What is done instead is that the control-register write is done
*before*Quoted 8 lines
sending the vm-event (
vm_event_put_request). This way, the user can override the written register value after receiving the
vm-event, which
in effect provides the same flexibility asVM_EVENT_FLAG_DENYdoes. Using this strategy instead would simplify both Xen's code and
the libxc
user's code.
Thoughts?Quoted 7 lines
That's how I initially did it with CR events, but with an application dealing with huge numbers of events, an extra hypercall (to re-set the register) can be quite expensive, so I had to rework it to the present state. On these grounds I'm opposed to it - and for consistency I would prefer that all register write events are pre-write events, and deniable with a single
vm_eventreply.Quoted 8 lines
Ah, I understand. I figured the utility of the DENY flag was only for cases where you'd want to actively
override the value written to the register (set register to overridden value + resume w/ DENY), instead
of just forbidding the write and leaving the register untouched (i.e. set on the old value).
If the latter is a desirable functionality then it indeed makes sense to have a DENY flag.Yes, that's the goal.
Quoted 11 lines
With that said, another thing crossed my mind. Since the DENY flag will be implemented for ARM w/ the next
revision and the actual write will be done on the scheduler tail, similarly to X86 ((hvm_do_resume), wouldn't
it be good if we separated the code that checksmonitor_write_datafrom there into an arch-dependent function,
e.g.vm_event_monitor_write_data? That way the scheduler tail function won't be 'polluted' w/ that code and IMHO
it will make the vm-events design more clear (since that functionality will also be invm_event.calong w/ the other
vm_event_* functions).
Quoted 9 lines
Sounds good, except perhaps for the function name but I'm not sure what a better one might be unfortunately, maybe someone else with chime in with a suggestion.
Thanks,
Razvan
I was thinking of the option of giving this function the significance of it being called by the scheduler tail, i.e. just before "entering" a vcpu, in which case we could use a name like vm_event_schedtail.
To me this sounds pretty good since it generalizes the function and it makes sense to have a vm_event_* function that is called just before a vcpu is scheduled, i.e. a vm-events function that would add-in a "final touch" before the "final stage" of actually entering the vcpu.
Let me know what you think.
Thanks,
Corneliu.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 27 lines
Quoted 11 lines
Quoted 11 lines
With that said, another thing crossed my mind. Since the DENY flag will be implemented for ARM w/ the next
revision and the actual write will be done on the scheduler tail, similarly to X86 ((hvm_do_resume), wouldn't
it be good if we separated the code that checksmonitor_write_datafrom there into an arch-dependent function,
e.g.vm_event_monitor_write_data? That way the scheduler tail function won't be 'polluted' w/ that code and IMHO
it will make the vm-events design more clear (since that functionality will also be invm_event.calong w/ the other
vm_event_* functions).Quoted 3 lines
Sounds good, except perhaps for the function name but I'm not sure what a better one might be unfortunately, maybe someone else with chime in with a suggestion.
I was thinking of the option of giving this function the significance of it being called by the
scheduler tail, i.e. just before "entering" a vcpu, in which case we could use a name
likevm_event_schedtail.
To me this sounds pretty good since it generalizes the function and it makes sense to have
a vm_event_* function that is called just before a vcpu is scheduled, i.e. a vm-events function
that would add-in a "final touch" before the "final stage" of actually entering the vcpu.
Quoted 1 line
Let me know what you think.
Sounds good to me. Let's see if somebody else objects.
Thanks,
Razvan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 10 lines · Corneliu ZUZU
Then,
QUESTIONS (FOR VM-EVENTS & ARMMAINTAINERSESPECIALLY):Q1) [...]
Q2) [...]
Q3) [...]
Q4) [...]
JSYK, I've realized I can find the answer for these easily (besides Q2, for which Razvan already gave feedback) with some tests (as soon as I get access to my ARMv8 machine). So, no need to think of that anymore ;)
Thanks,
Corneliu.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 10 lines · Corneliu ZUZU
Then,
QUESTIONS (FOR VM-EVENTS & ARMMAINTAINERSESPECIALLY):Q1) [...]
Q2) [...]
Q3) [...]
Q4) [...]
Hey all,
I have a question relating to this part of code @ vmx_update_guest_cr:
if ( paging_mode_hap(v->domain) )
{
/* Manage GUEST_CR3 when CR0.PE=0. */
uint32_t cr3_ctls = (CPU_BASED_CR3_LOAD_EXITING |
CPU_BASED_CR3_STORE_EXITING);
v->arch.hvm_vmx.exec_control &= ~cr3_ctls;
if ( !hvm_paging_enabled(v) && !vmx_unrestricted_guest(v) )
v->arch.hvm_vmx.exec_control |= cr3_ctls;
/* Trap CR3 updates if CR3 memory events are enabled. */
if ( v->domain->arch.monitor.write_ctrlreg_enabled &
monitor_ctrlreg_bitmask(VM_EVENT_X86_CR3) )
v->arch.hvm_vmx.exec_control |= CPU_BASED_CR3_LOAD_EXITING;
vmx_update_cpu_exec_control(v);
}While trying to move the check for VM_EVENT_X86_CR3 to the scheduling tail, a few questions came to my mind.
1). Tamas, Razvan, maybe you guys could clarify this. I noticed this part of code is only executed if paging_mode_hap(v->domain). Is EPT mandatory to monitor CR3 writes or is it just that when shadow paging is enabled, CR3 r/w are unconditionally trapped? If the former is true, shouldn't we do a check like this in vm_event_monitor_get_capabilities instead?
2). I was also wondering why CR3 load/stores are trapped if paging is disabled for a domain.
Thanks,
Corneliu.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 35 lines · Corneliu ZUZU
Quoted 11 lines · Corneliu ZUZU
Then,
QUESTIONS (FOR VM-EVENTS & ARMMAINTAINERSESPECIALLY):Q1) [...]
Q2) [...]
Q3) [...]
Q4) [...]
Hey all,
I have a question relating to this part of code @
vmx_update_guest_cr:if ( paging_mode_hap(v->domain) ) { /* Manage GUEST_CR3 when CR0.PE=0. */ uint32_t cr3_ctls = (CPU_BASED_CR3_LOAD_EXITING | CPU_BASED_CR3_STORE_EXITING); v->arch.hvm_vmx.exec_control &= ~cr3_ctls; if ( !hvm_paging_enabled(v) && !vmx_unrestricted_guest(v) ) v->arch.hvm_vmx.exec_control |= cr3_ctls; /* Trap CR3 updates if CR3 memory events are enabled. */ if ( v->domain->arch.monitor.write_ctrlreg_enabled & monitor_ctrlreg_bitmask(VM_EVENT_X86_CR3) ) v->arch.hvm_vmx.exec_control |= CPU_BASED_CR3_LOAD_EXITING; vmx_update_cpu_exec_control(v); }
Quoted 7 lines
While trying to move the check for
VM_EVENT_X86_CR3to the scheduling tail, a few questions came to my mind.1). Tamas, Razvan, maybe you guys could clarify this. I noticed this part of code is only executed if
paging_mode_hap(v->domain). Is EPT mandatory to monitor CR3 writes or is it just that when shadow paging is enabled, CR3 r/w are unconditionally trapped?
EPT is not really required for CR3 monitoring, it just has been the case that vm_events have been only implemented for hap-enabled domains. AFAIK for non-hap case CR3 needs to be trapped unconditionally, yes.
Quoted 3 lines
If the former is true, shouldn't we do a check like this in
vm_event_monitor_get_capabilitiesinstead?
Yes, it should now, this code was just written before vm_event_monitor_get_capabilities was introduced and we haven't gotten around converting this check to it.
Quoted 4 lines
2). I was also wondering why CR3 load/stores are trapped if paging is disabled for a domain.
Good question, I was wondering about that myself at some point but I haven't found an answer to it. Maybe some git archaeology can help determining when that was added and why ;)
Cheers,
Tamas
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 1 line · Tamas K Lengyel
EPT is not really required for CR3 monitoring, it just has been the case that
vm_eventshave been only implemented for hap-enabled domains.
I suppose this is not valid for vm-events in their entirety, right? I mean it seems to me that @ least for monitor vm-events VMX is enough.
Quoted 7 lines
AFAIK for non-hap case CR3 needs to be trapped unconditionally, yes.
If the former is true, shouldn't we do a check like this in
vm_event_monitor_get_capabilitiesinstead?Yes, it should now, this code was just written before
vm_event_monitor_get_capabilitieswas introduced and we haven't gotten around converting this check to it.
Is there any reason why monitor vm-events in their current state wouldn't work on non-hap domains?
If they would work, shouldn't we instead simply move the monitor.write_ctrlreg_enabled part out of the if ( paging_mode_hap(...) ) ?
Quoted 9 lines
2). I was also wondering why CR3 load/stores are trapped if paging is disabled for a domain.
Good question, I was wondering about that myself at some point but I haven't found an answer to it. Maybe some git archaeology can help determining when that was added and why ;)
Cheers,
Tamas
Yep, will "blame into it".
Thanks,
Corneliu.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 9 lines · Corneliu ZUZU
On 3/7/2016 11:12 AM, Tamas K Lengyel wrote:
EPT is not really required for CR3 monitoring, it just has been the case that
vm_eventshave been only implemented for hap-enabled domains.I suppose this is not valid for vm-events in their entirety, right? I mean it seems to me that @ least for monitor vm-events VMX is enough.
Yes. OTOH I don't think you can find any CPUs on the market today that support VMX but have no EPT so this hasn't really caused any issues for anyone using vm_events, but technically yes VMX is enough for these events.
Quoted 12 lines
AFAIK for non-hap case CR3 needs to be trapped unconditionally, yes.
Quoted 3 lines
If the former is true, shouldn't we do a check like this in
vm_event_monitor_get_capabilitiesinstead?Yes, it should now, this code was just written before
vm_event_monitor_get_capabilitieswas introduced and we haven't gotten around converting this check to it.
Quoted 5 lines
Is there any reason why monitor vm-events in their current state wouldn't work on non-hap domains?
If they would work, shouldn't we instead simply move the monitor.write_ctrlreg_enabled part out of the if (paging_mode_hap(...)) ?
Yeap, that sounds like the right place to have that check.
Tamas
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 33 lines · Tamas K Lengyel
On Mon, Mar 7, 2016 at 10:31 AM, Corneliu ZUZU <[email protected] <mailto:[email protected]>> wrote:
On 3/7/2016 11:12 AM, Tamas K Lengyel wrote:Quoted 3 lines
EPT is not really required for CR3 monitoring, it just has been the case that
vm_eventshave been only implemented for hap-enabled domains.I suppose this is not valid for vm-events in their entirety, right? I mean it seems to me that @ least for monitor vm-events VMX is enough.
Yes. OTOH I don't think you can find any CPUs on the market today that support VMX but have no EPT so this hasn't really caused any issues for anyone using
vm_events, but technically yes VMX is enough for these events.Quoted 9 lines
AFAIK for non-hap case CR3 needs to be trapped unconditionally, yes.
If the former is true, shouldn't we do a check like this in
vm_event_monitor_get_capabilitiesinstead?Yes, it should now, this code was just written before
vm_event_monitor_get_capabilitieswas introduced and we haven't gotten around converting this check to it.Is there any reason why monitor vm-events in their current state wouldn't work on non-hap domains?
If they would work, shouldn't we instead simply move the monitor.write_ctrlreg_enabled part out of the if (paging_mode_hap(...)) ?
Quoted 3 lines
Yeap, that sounds like the right place to have that check.
Tamas
Good, with that out of the way, one more issue to solve. What I'm actually trying to do is to move that part of the code to the scheduling tail - i.e. enabling/disabling CPU_BASED_CR3_LOAD_EXITING only when we actually enter the vcpu. To do this I also need to know exactly in what cases CPU_BASED_CR3_LOAD_EXITING can/is enabled, besides the already mentioned case when a domain's paging is disabled.
I'm searching through the codebase right now but it's a bit dizzying, can someone provide some feedback on this matter?
Thanks,
Corneliu.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 38 lines · Corneliu ZUZU
Quoted 33 lines · Tamas K Lengyel
On Mon, Mar 7, 2016 at 10:31 AM, Corneliu ZUZU <[email protected] <mailto:[email protected]>> wrote:
On 3/7/2016 11:12 AM, Tamas K Lengyel wrote:Quoted 3 lines
EPT is not really required for CR3 monitoring, it just has been the case that
vm_eventshave been only implemented for hap-enabled domains.I suppose this is not valid for vm-events in their entirety, right? I mean it seems to me that @ least for monitor vm-events VMX is enough.
Yes. OTOH I don't think you can find any CPUs on the market today that support VMX but have no EPT so this hasn't really caused any issues for anyone using
vm_events, but technically yes VMX is enough for these events.Quoted 9 lines
AFAIK for non-hap case CR3 needs to be trapped unconditionally, yes.
If the former is true, shouldn't we do a check like this in
vm_event_monitor_get_capabilitiesinstead?Yes, it should now, this code was just written before
vm_event_monitor_get_capabilitieswas introduced and we haven't gotten around converting this check to it.Is there any reason why monitor vm-events in their current state wouldn't work on non-hap domains?
If they would work, shouldn't we instead simply move the monitor.write_ctrlreg_enabled part out of the if (paging_mode_hap(...)) ?Quoted 3 lines
Yeap, that sounds like the right place to have that check.
Tamas
Quoted 7 lines
Good, with that out of the way, one more issue to solve. What I'm actually trying to do is to move that part of the code to the scheduling tail - i.e. enabling/disabling
CPU_BASED_CR3_LOAD_EXITINGonly when we actually enter the vcpu. To do this I also need to know exactly in what casesCPU_BASED_CR3_LOAD_EXITINGcan/is enabled, besides the already mentioned case when a domain's paging is disabled.I'm searching through the codebase right now but it's a bit dizzying, can someone provide some feedback on this matter?
Thanks,
Corneliu.
Ok, by searching for places v->arch.hvm_vmx.exec_control is set, it seems that vmx_update_guest_cr is the only place where CR3 load-exiting is set/unset.
It also seems that in non-hap case CPU_BASED_CR3_LOAD_EXITING is indeed unconditionally enabled, i.e. @ vmx_vcpu_initialise -> vmx_create_vmcs -> construct_vmcs:
v->arch.hvm_vmx.secondary_exec_control = vmx_secondary_exec_control;
/* Disable VPID for now: we decide when to enable it on VMENTER. */
v->arch.hvm_vmx.secondary_exec_control &= ~SECONDARY_EXEC_ENABLE_VPID;
if ( paging_mode_hap(d) )
{
v->arch.hvm_vmx.exec_control &= ~(CPU_BASED_INVLPG_EXITING |
CPU_BASED_CR3_LOAD_EXITING |
CPU_BASED_CR3_STORE_EXITING);
}Can somebody else confirm this, just to be sure?
Tamas, if this were true, that would mean that we can move that part to the scheduling tail, and we could write there smth like this pseudocode:
/* if ! hap => CR3 writes unconditionally trap */
if (paging_mode_hap) return;
if (monitor.write_ctrlreg_enabled for CR3) and
(CPU_BASED_CR3_LOAD_EXITING currently disabled)
enable CPU_BASED_CR3_LOAD_EXITING;
else if (NOT monitor.write_ctrlreg_enabled for CR3) and
(CPU_BASED_CR3_LOAD_EXITING currently enabled) and (paging is enabled)
disable CPU_BASED_CR3_LOAD_EXITING;Would that be suitable?
Thanks,
Corneliu.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 51 lines · Tamas K Lengyel
On Mon, Mar 7, 2016 at 9:22 AM, Corneliu ZUZU <[email protected] <mailto:[email protected]>> wrote:
On 3/3/2016 4:10 PM, Corneliu ZUZU wrote: Then, QUESTIONS (FOR VM-EVENTS & ARM MAINTAINERS ESPECIALLY): Q1) [...] Q2) [...] Q3) [...] Q4) [...] Hey all, I have a question relating to this part of code @ vmx_update_guest_cr: if ( paging_mode_hap(v->domain) ) { /* Manage GUEST_CR3 when CR0.PE <http://CR0.PE>=0. */ uint32_t cr3_ctls = (CPU_BASED_CR3_LOAD_EXITING | CPU_BASED_CR3_STORE_EXITING); v->arch.hvm_vmx.exec_control &= ~cr3_ctls; if ( !hvm_paging_enabled(v) && !vmx_unrestricted_guest(v) ) v->arch.hvm_vmx.exec_control |= cr3_ctls; /* Trap CR3 updates if CR3 memory events are enabled. */ if ( v->domain->arch.monitor.write_ctrlreg_enabled & monitor_ctrlreg_bitmask(VM_EVENT_X86_CR3) ) v->arch.hvm_vmx.exec_control |= CPU_BASED_CR3_LOAD_EXITING; vmx_update_cpu_exec_control(v); } While trying to move the check for VM_EVENT_X86_CR3 to the scheduling tail, a few questions came to my mind. 1). Tamas, Razvan, maybe you guys could clarify this. I noticed this part of code is only executed if paging_mode_hap(v->domain). Is EPT mandatory to monitor CR3 writes or is it just that when shadow paging is enabled, CR3 r/w are unconditionally trapped?
Quoted 4 lines
EPT is not really required for CR3 monitoring, it just has been the case that
vm_eventshave been only implemented for hap-enabled domains. AFAIK for non-hap case CR3 needs to be trapped unconditionally, yes.
Specifically, the shadow pagetable code needs to swap shadows when the guest switches cr3.
Quoted 12 lines
If the former is true, shouldn't we do a check like this in
vm_event_monitor_get_capabilitiesinstead?Yes, it should now, this code was just written before
vm_event_monitor_get_capabilitieswas introduced and we haven't gotten around converting this check to it.
Quoted 7 lines
2). I was also wondering why CR3 load/stores are trapped if paging is disabled for a domain.
Good question, I was wondering about that myself at some point but I haven't found an answer to it. Maybe some git archaeology can help determining when that was added and why ;)
Gen1 VT-x didn't support running a guest in non-paged mode. Gen2 introduced "unrestricted-guest" which works as intended, but Gen1 has to fake non-pagad mode using identity paging. As a result, CR3 cannot be used as scratch space like it can in non-paged mode, and the guest must be prevented from moving CR3 away from the gfn set up by the domain builder in HVM_PARAM_IDENT_PT.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 67 lines · Andrew Cooper
Quoted 51 lines · Tamas K Lengyel
On Mon, Mar 7, 2016 at 9:22 AM, Corneliu ZUZU <[email protected] <mailto:[email protected]>> wrote:
On 3/3/2016 4:10 PM, Corneliu ZUZU wrote: Then, QUESTIONS (FOR VM-EVENTS & ARM MAINTAINERS ESPECIALLY): Q1) [...] Q2) [...] Q3) [...] Q4) [...] Hey all, I have a question relating to this part of code @ vmx_update_guest_cr: if ( paging_mode_hap(v->domain) ) { /* Manage GUEST_CR3 when CR0.PE <http://CR0.PE>=0. */ uint32_t cr3_ctls = (CPU_BASED_CR3_LOAD_EXITING | CPU_BASED_CR3_STORE_EXITING); v->arch.hvm_vmx.exec_control &= ~cr3_ctls; if ( !hvm_paging_enabled(v) && !vmx_unrestricted_guest(v) ) v->arch.hvm_vmx.exec_control |= cr3_ctls; /* Trap CR3 updates if CR3 memory events are enabled. */ if ( v->domain->arch.monitor.write_ctrlreg_enabled & monitor_ctrlreg_bitmask(VM_EVENT_X86_CR3) ) v->arch.hvm_vmx.exec_control |= CPU_BASED_CR3_LOAD_EXITING; vmx_update_cpu_exec_control(v); } While trying to move the check for VM_EVENT_X86_CR3 to the scheduling tail, a few questions came to my mind. 1). Tamas, Razvan, maybe you guys could clarify this. I noticed this part of code is only executed if paging_mode_hap(v->domain). Is EPT mandatory to monitor CR3 writes or is it just that when shadow paging is enabled, CR3 r/w are unconditionally trapped?Quoted 1 line
EPT is not really required for CR3 monitoring, it just has been the case that
vm_eventshave been only implemented for hap-enabled domains. AFAIK for non-hap case CR3 needs to be trapped unconditionally, yes.Specifically, the shadow pagetable code needs to swap shadows when the guest switches cr3.
Quoted 11 lines
If the former is true, shouldn't we do a check like this in
vm_event_monitor_get_capabilitiesinstead?Yes, it should now, this code was just written before
vm_event_monitor_get_capabilitieswas introduced and we haven't gotten around converting this check to it.2). I was also wondering why CR3 load/stores are trapped if paging is disabled for a domain.
Quoted 5 lines
Quoted 1 line
Good question, I was wondering about that myself at some point but I haven't found an answer to it. Maybe some git archaeology can help determining when that was added and why ;)
Gen1 VT-x didn't support running a guest in non-paged mode. Gen2 introduced "unrestricted-guest" which works as intended, but Gen1 has to fake non-pagad mode using identity paging. As a result, CR3 cannot be used as scratch space like it can in non-paged mode, and the guest must be prevented from moving CR3 away from the gfn set up by the domain builder in
HVM_PARAM_IDENT_PT.~Andrew
Nice, thanks a bunch.
Corneliu.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel