Skip to contentSkip to conversation

x86/vm_event: block interrupt injection for sync vm_events

PATCH In review Razvan Cojocaru 8 participants 15 messages Dec 14, 2018 – Jan 16, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 x86/vm_event: block interrupt injection for sync vm_events

Block interrupts (in vmx_intr_assist()) for the duration of processing a sync vm_event (similarly to the strategy currently used for single-stepping). Otherwise, attempting to emulate an instruction when requested by a vm_event reply may legitimately need to call e.g. hvm_inject_page_fault(), which then overwrites the active interrupt in the VMCS.

The sync vm_event handling path on x86/VMX is (roughly):
monitor_traps() -> process vm_event -> vmx_intr_assist() (possibly writing VM_ENTRY_INTR_INFO) -> hvm_vm_event_do_resume() -> hvm_emulate_one_vm_event() (possibly overwriting the VM_ENTRY_INTR_INFO value).

This patch may also be helpful for the future removal of may_defer in hvm_set_cr{0,3,4} and hvm_set_msr().

---
Changes since V2:
- Renamed intr_block to sync_event and vm_event_block_interrupts() to vm_event_sync_event().
- Rephrased and / or removed stale comments.
- Added more details to the commit description.

---
 xen/arch/x86/hvm/svm/intr.c    | 5 +++++
 xen/arch/x86/hvm/vm_event.c    | 2 ++
 xen/arch/x86/hvm/vmx/intr.c    | 5 +++++
 xen/arch/x86/vm_event.c        | 5 +++++
 xen/common/monitor.c           | 1 +
 xen/include/asm-arm/vm_event.h | 6 ++++++
 xen/include/asm-x86/vm_event.h | 4 ++++
 7 files changed, 28 insertions(+)
xen/arch/x86/hvm/svm/intr.c +5 -0
index 7967353..ff75516 100644
@@ -32,6 +32,7 @@
 #include <asm/hvm/svm/svm.h>
 #include <asm/hvm/svm/intr.h>
 #include <asm/hvm/nestedhvm.h> /* for nestedhvm_vcpu_in_guestmode */
+#include <asm/vm_event.h>
 #include <xen/event.h>
 #include <xen/kernel.h>
 #include <public/hvm/ioreq.h>
@@ -137,6 +138,10 @@ void svm_intr_assist(void)
     struct hvm_intack intack;
     enum hvm_intblk intblk;
 
+    /* Block event injection while handling a sync vm_event. */
+    if ( unlikely(v->arch.vm_event) && v->arch.vm_event->sync_event )
+        return;
+
     /* Crank the handle on interrupt state. */
     pt_update_irq(v);
 
xen/arch/x86/hvm/vm_event.c +2 -0
index 0df8ab4..121de23 100644
@@ -124,6 +124,8 @@ void hvm_vm_event_do_resume(struct vcpu *v)
 
         w->do_write.msr = 0;
     }
+
+    vm_event_sync_event(v, false);
 }
 
 /*
xen/arch/x86/hvm/vmx/intr.c +5 -0
index 5e8cbd4..0d097cf 100644
@@ -37,6 +37,7 @@
 #include <asm/hvm/nestedhvm.h>
 #include <public/hvm/ioreq.h>
 #include <asm/hvm/trace.h>
+#include <asm/vm_event.h>
 
 /*
  * A few notes on virtual NMI and INTR delivery, and interactions with
@@ -239,6 +240,10 @@ void vmx_intr_assist(void)
         return;
     }
 
+    /* Block event injection while handling a sync vm_event. */
+    if ( unlikely(v->arch.vm_event) && v->arch.vm_event->sync_event )
+        return;
+
     /* Crank the handle on interrupt state. */
     pt_vector = pt_update_irq(v);
 
xen/arch/x86/vm_event.c +5 -0
index 713e684..51c3493 100644
@@ -122,6 +122,11 @@ void vm_event_monitor_next_interrupt(struct vcpu *v)
     v->arch.monitor.next_interrupt_enabled = true;
 }
 
+void vm_event_sync_event(struct vcpu *v, bool value)
+{
+    v->arch.vm_event->sync_event = value;
+}
+
 #ifdef CONFIG_HVM
 static void vm_event_pack_segment_register(enum x86_segment segment,
                                            struct vm_event_regs_x86 *reg)
xen/common/monitor.c +1 -0
index c606683..cb5f37f 100644
@@ -113,6 +113,7 @@ int monitor_traps(struct vcpu *v, bool sync, vm_event_request_t *req)
     if ( sync )
     {
         req->flags |= VM_EVENT_FLAG_VCPU_PAUSED;
+        vm_event_sync_event(v, true);
         vm_event_vcpu_pause(v);
         rc = 1;
     }
xen/include/asm-arm/vm_event.h +6 -0
index 66f2474..14d1d34 100644
@@ -52,4 +52,10 @@ void vm_event_emulate_check(struct vcpu *v, vm_event_response_t *rsp)
     /* Not supported on ARM. */
 }
 
+static inline
+void vm_event_sync_event(struct vcpu *v, bool value)
+{
+    /* Not supported on ARM. */
+}
+
 #endif /* __ASM_ARM_VM_EVENT_H__ */
xen/include/asm-x86/vm_event.h +4 -0
index 39e73c8..23e6557 100644
@@ -34,6 +34,8 @@ struct arch_vm_event {
     struct monitor_write_data write_data;
     struct vm_event_regs_x86 gprs;
     bool set_gprs;
+    /* A sync vm_event has been sent and we're not done handling it. */
+    bool sync_event;
 };
 
 int vm_event_init_domain(struct domain *d);
@@ -47,4 +49,6 @@ void vm_event_register_write_resume(struct vcpu *v, vm_event_response_t *rsp);
 
 void vm_event_emulate_check(struct vcpu *v, vm_event_response_t *rsp);
 
+void vm_event_sync_event(struct vcpu *v, bool value);
+
 #endif /* __ASM_X86_VM_EVENT_H__ */
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v3 1/1
#1 lore raw
Quoted 17 lines

From: Razvan Cojocaru [mailto:[email protected]]
Sent: Friday, December 14, 2018 7:50 PM

Block interrupts (in vmx_intr_assist()) for the duration of processing a sync vm_event (similarly to the strategy currently used for single-stepping). Otherwise, attempting to emulate an instruction when requested by a vm_event reply may legitimately need to call e.g. hvm_inject_page_fault(), which then overwrites the active interrupt in the VMCS.

The sync vm_event handling path on x86/VMX is (roughly):
monitor_traps() -> process vm_event -> vmx_intr_assist() (possibly writing VM_ENTRY_INTR_INFO) -> hvm_vm_event_do_resume() -> hvm_emulate_one_vm_event() (possibly overwriting the VM_ENTRY_INTR_INFO value).

Quoted 5 lines

This patch may also be helpful for the future removal of may_defer in hvm_set_cr{0,3,4} and hvm_set_msr().

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

#2 lore raw
Quoted 17 lines · Kevin
Quoted 17 lines

From: Razvan Cojocaru [mailto:[email protected]]
Sent: Friday, December 14, 2018 7:50 PM

Block interrupts (in vmx_intr_assist()) for the duration of processing a sync vm_event (similarly to the strategy currently used for single-stepping). Otherwise, attempting to emulate an instruction when requested by a vm_event reply may legitimately need to call e.g. hvm_inject_page_fault(), which then overwrites the active interrupt in the VMCS.

The sync vm_event handling path on x86/VMX is (roughly):
monitor_traps() -> process vm_event -> vmx_intr_assist() (possibly writing VM_ENTRY_INTR_INFO) -> hvm_vm_event_do_resume() -> hvm_emulate_one_vm_event() (possibly overwriting the VM_ENTRY_INTR_INFO value).

Quoted 7 lines
Quoted 5 lines

This patch may also be helpful for the future removal of may_defer in hvm_set_cr{0,3,4} and hvm_set_msr().

Ping?

Thanks,
Razvan

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

Reviewed-by on v3 1/1
#3 lore raw
In reply to Razvan Cojocaru
Quoted 15 lines · Razvan Cojocaru

Block interrupts (in vmx_intr_assist()) for the duration of processing a sync vm_event (similarly to the strategy currently used for single-stepping). Otherwise, attempting to emulate an instruction when requested by a vm_event reply may legitimately need to call e.g. hvm_inject_page_fault(), which then overwrites the active interrupt in the VMCS.

The sync vm_event handling path on x86/VMX is (roughly):
monitor_traps() -> process vm_event -> vmx_intr_assist() (possibly writing VM_ENTRY_INTR_INFO) -> hvm_vm_event_do_resume() -> hvm_emulate_one_vm_event() (possibly overwriting the VM_ENTRY_INTR_INFO value).

Quoted 4 lines

This patch may also be helpful for the future removal of may_defer in hvm_set_cr{0,3,4} and hvm_set_msr().

Thanks.

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

Reviewed-by on v3 1/1
#4 lore raw
In reply to Razvan Cojocaru
Quoted 14 lines · Razvan Cojocaru

Block interrupts (in vmx_intr_assist()) for the duration of processing a sync vm_event (similarly to the strategy currently used for single-stepping). Otherwise, attempting to emulate an instruction when requested by a vm_event reply may legitimately need to call e.g. hvm_inject_page_fault(), which then overwrites the active interrupt in the VMCS.

The sync vm_event handling path on x86/VMX is (roughly):
monitor_traps() -> process vm_event -> vmx_intr_assist() (possibly writing VM_ENTRY_INTR_INFO) -> hvm_vm_event_do_resume() -> hvm_emulate_one_vm_event() (possibly overwriting the VM_ENTRY_INTR_INFO value).

Quoted 4 lines

This patch may also be helpful for the future removal of may_defer in hvm_set_cr{0,3,4} and hvm_set_msr().

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

#5 lore raw
Quoted 15 lines · Boris Ostrovsky
Quoted 14 lines · Razvan Cojocaru

Block interrupts (in vmx_intr_assist()) for the duration of processing a sync vm_event (similarly to the strategy currently used for single-stepping). Otherwise, attempting to emulate an instruction when requested by a vm_event reply may legitimately need to call e.g. hvm_inject_page_fault(), which then overwrites the active interrupt in the VMCS.

The sync vm_event handling path on x86/VMX is (roughly):
monitor_traps() -> process vm_event -> vmx_intr_assist() (possibly writing VM_ENTRY_INTR_INFO) -> hvm_vm_event_do_resume() -> hvm_emulate_one_vm_event() (possibly overwriting the VM_ENTRY_INTR_INFO value).

Quoted 7 lines
Quoted 4 lines

This patch may also be helpful for the future removal of may_defer in hvm_set_cr{0,3,4} and hvm_set_msr().

Thanks! So now we have three reviewed-bys, if I'm not mistaken all we need is Tamas' (for the vm_event part) and Julien / Stefano's (for ARM) acks (or otherwise).

Could you please take a look?

Thanks,
Razvan

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

#6 lore raw
Quoted 20 lines
Quoted 1 line
Quoted 1 line · On 14.01.19 at 10:34, <[email protected]> wrote:
Quoted 18 lines · Boris Ostrovsky
Quoted 17 lines · Razvan Cojocaru

Block interrupts (in vmx_intr_assist()) for the duration of processing a sync vm_event (similarly to the strategy currently used for single-stepping). Otherwise, attempting to emulate an instruction when requested by a vm_event reply may legitimately need to call e.g. hvm_inject_page_fault(), which then overwrites the active interrupt in the VMCS.

The sync vm_event handling path on x86/VMX is (roughly):
monitor_traps() -> process vm_event -> vmx_intr_assist() (possibly writing VM_ENTRY_INTR_INFO) -> hvm_vm_event_do_resume() -> hvm_emulate_one_vm_event() (possibly overwriting the VM_ENTRY_INTR_INFO value).

This patch may also be helpful for the future removal of may_defer in hvm_set_cr{0,3,4} and hvm_set_msr().

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Thanks! So now we have three reviewed-bys, if I'm not mistaken all we need is Tamas' (for the vm_event part) and Julien / Stefano's (for ARM) acks (or otherwise).

And you'd need to talk Jürgen into allowing this in, now that we're past the freeze point.

Jan

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

#7 lore raw
Quoted 23 lines · Jan Beulich
Quoted 23 lines
Quoted 1 line
Quoted 1 line · On 14.01.19 at 10:34, <[email protected]> wrote:
Quoted 21 lines · Boris Ostrovsky
Quoted 18 lines · Razvan Cojocaru

Block interrupts (in vmx_intr_assist()) for the duration of processing a sync vm_event (similarly to the strategy currently used for single-stepping). Otherwise, attempting to emulate an instruction when requested by a vm_event reply may legitimately need to call e.g. hvm_inject_page_fault(), which then overwrites the active interrupt in the VMCS.

The sync vm_event handling path on x86/VMX is (roughly):
monitor_traps() -> process vm_event -> vmx_intr_assist() (possibly writing VM_ENTRY_INTR_INFO) -> hvm_vm_event_do_resume() -> hvm_emulate_one_vm_event() (possibly overwriting the VM_ENTRY_INTR_INFO value).

This patch may also be helpful for the future removal of may_defer in hvm_set_cr{0,3,4} and hvm_set_msr().

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Thanks! So now we have three reviewed-bys, if I'm not mistaken all we need is Tamas' (for the vm_event part) and Julien / Stefano's (for ARM) acks (or otherwise).

And you'd need to talk Jürgen into allowing this in, now that we're past the freeze point.

(Adding Jürgen to the conversation.)

Right, that would be ideal if possible - the code has absolutely no impact on anything unless vm_event is active on the domain, which is never the case for the use-cases considered for a Xen release.

So the case I'm making for the patch to go in 4.12 is that:

1. It's perfectly harmless (it affects nothing, except for introspection).

2. It's trivial and thus very easy to see that it's correct.

3. It fixes a major headache for us, and thus it is a great improvement from an introspection standpoint (fixes OS crashes / hangs which we'd otherwise need to work around in rather painful ways).

4. V3 of the patch has been sent out on Dec 14th - it's just that reviewers have had other priorities and it did not gather all acks in time.

However, if it's not possible or desirable to allow this in the next best thing is to at least have all the acks necessary for it to go in first thing once the freeze is over.

From Julien's reply I understand that the last ack necessary is Tamas'.

Thanks,
Razvan

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

#8 lore raw
Quoted 49 lines · Razvan Cojocaru
Quoted 23 lines · Jan Beulich
Quoted 23 lines
Quoted 1 line
Quoted 1 line · On 14.01.19 at 10:34, <[email protected]> wrote:
Quoted 21 lines · Boris Ostrovsky
Quoted 18 lines · Razvan Cojocaru

Block interrupts (in vmx_intr_assist()) for the duration of processing a sync vm_event (similarly to the strategy currently used for single-stepping). Otherwise, attempting to emulate an instruction when requested by a vm_event reply may legitimately need to call e.g. hvm_inject_page_fault(), which then overwrites the active interrupt in the VMCS.

The sync vm_event handling path on x86/VMX is (roughly):
monitor_traps() -> process vm_event -> vmx_intr_assist() (possibly writing VM_ENTRY_INTR_INFO) -> hvm_vm_event_do_resume() -> hvm_emulate_one_vm_event() (possibly overwriting the VM_ENTRY_INTR_INFO value).

This patch may also be helpful for the future removal of may_defer in hvm_set_cr{0,3,4} and hvm_set_msr().

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Thanks! So now we have three reviewed-bys, if I'm not mistaken all we need is Tamas' (for the vm_event part) and Julien / Stefano's (for ARM) acks (or otherwise).

And you'd need to talk Jürgen into allowing this in, now that we're past the freeze point.

(Adding Jürgen to the conversation.)

Right, that would be ideal if possible - the code has absolutely no impact on anything unless vm_event is active on the domain, which is never the case for the use-cases considered for a Xen release.

So the case I'm making for the patch to go in 4.12 is that:

1. It's perfectly harmless (it affects nothing, except for introspection).

2. It's trivial and thus very easy to see that it's correct.

3. It fixes a major headache for us, and thus it is a great improvement from an introspection standpoint (fixes OS crashes / hangs which we'd otherwise need to work around in rather painful ways).

Quoted 8 lines

4. V3 of the patch has been sent out on Dec 14th - it's just that reviewers have had other priorities and it did not gather all acks in time.

However, if it's not possible or desirable to allow this in the next best thing is to at least have all the acks necessary for it to go in first thing once the freeze is over.

From Julien's reply I understand that the last ack necessary is Tamas'.

With that ack just arrived:

Juergen

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

#9 lore raw
Quoted 57 lines · Juergen Gross
Quoted 56 lines · Razvan Cojocaru
Quoted 23 lines · Jan Beulich
Quoted 23 lines
Quoted 1 line
Quoted 1 line · On 14.01.19 at 10:34, <[email protected]> wrote:
Quoted 21 lines · Boris Ostrovsky
Quoted 18 lines · Razvan Cojocaru

Block interrupts (in vmx_intr_assist()) for the duration of processing a sync vm_event (similarly to the strategy currently used for single-stepping). Otherwise, attempting to emulate an instruction when requested by a vm_event reply may legitimately need to call e.g. hvm_inject_page_fault(), which then overwrites the active interrupt in the VMCS.

The sync vm_event handling path on x86/VMX is (roughly):
monitor_traps() -> process vm_event -> vmx_intr_assist() (possibly writing VM_ENTRY_INTR_INFO) -> hvm_vm_event_do_resume() -> hvm_emulate_one_vm_event() (possibly overwriting the VM_ENTRY_INTR_INFO value).

This patch may also be helpful for the future removal of may_defer in hvm_set_cr{0,3,4} and hvm_set_msr().

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Thanks! So now we have three reviewed-bys, if I'm not mistaken all we need is Tamas' (for the vm_event part) and Julien / Stefano's (for ARM) acks (or otherwise).

And you'd need to talk Jürgen into allowing this in, now that we're past the freeze point.

(Adding Jürgen to the conversation.)

Right, that would be ideal if possible - the code has absolutely no impact on anything unless vm_event is active on the domain, which is never the case for the use-cases considered for a Xen release.

So the case I'm making for the patch to go in 4.12 is that:

1. It's perfectly harmless (it affects nothing, except for introspection).

2. It's trivial and thus very easy to see that it's correct.

3. It fixes a major headache for us, and thus it is a great improvement from an introspection standpoint (fixes OS crashes / hangs which we'd otherwise need to work around in rather painful ways).

4. V3 of the patch has been sent out on Dec 14th - it's just that reviewers have had other priorities and it did not gather all acks in time.

However, if it's not possible or desirable to allow this in the next best thing is to at least have all the acks necessary for it to go in first thing once the freeze is over.

Quoted 5 lines
Quoted 1 line

From Julien's reply I understand that the last ack necessary is Tamas'.

With that ack just arrived:

Thanks! Very much appreciated.

Razvan

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

#10 lore raw
In reply to Juergen Gross
Quoted 57 lines · Juergen Gross
Quoted 56 lines · Razvan Cojocaru
Quoted 23 lines · Jan Beulich
Quoted 23 lines
Quoted 1 line
Quoted 1 line · On 14.01.19 at 10:34, <[email protected]> wrote:
Quoted 21 lines · Boris Ostrovsky
Quoted 18 lines · Razvan Cojocaru

Block interrupts (in vmx_intr_assist()) for the duration of processing a sync vm_event (similarly to the strategy currently used for single-stepping). Otherwise, attempting to emulate an instruction when requested by a vm_event reply may legitimately need to call e.g. hvm_inject_page_fault(), which then overwrites the active interrupt in the VMCS.

The sync vm_event handling path on x86/VMX is (roughly):
monitor_traps() -> process vm_event -> vmx_intr_assist() (possibly writing VM_ENTRY_INTR_INFO) -> hvm_vm_event_do_resume() -> hvm_emulate_one_vm_event() (possibly overwriting the VM_ENTRY_INTR_INFO value).

This patch may also be helpful for the future removal of may_defer in hvm_set_cr{0,3,4} and hvm_set_msr().

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Thanks! So now we have three reviewed-bys, if I'm not mistaken all we need is Tamas' (for the vm_event part) and Julien / Stefano's (for ARM) acks (or otherwise).

And you'd need to talk Jürgen into allowing this in, now that we're past the freeze point.

(Adding Jürgen to the conversation.)

Right, that would be ideal if possible - the code has absolutely no impact on anything unless vm_event is active on the domain, which is never the case for the use-cases considered for a Xen release.

So the case I'm making for the patch to go in 4.12 is that:

1. It's perfectly harmless (it affects nothing, except for introspection).

2. It's trivial and thus very easy to see that it's correct.

3. It fixes a major headache for us, and thus it is a great improvement from an introspection standpoint (fixes OS crashes / hangs which we'd otherwise need to work around in rather painful ways).

4. V3 of the patch has been sent out on Dec 14th - it's just that reviewers have had other priorities and it did not gather all acks in time.

However, if it's not possible or desirable to allow this in the next best thing is to at least have all the acks necessary for it to go in first thing once the freeze is over.

Quoted 5 lines
Quoted 1 line

From Julien's reply I understand that the last ack necessary is Tamas'.

With that ack just arrived:

AFAICT this is fine to apply to staging now, am I incorrect?

Thanks,
Razvan

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

#11 lore raw
Quoted 59 lines
Quoted 1 line
Quoted 1 line · On 16.01.19 at 08:10, <[email protected]> wrote:
Quoted 57 lines · Juergen Gross
Quoted 56 lines · Razvan Cojocaru
Quoted 23 lines · Jan Beulich
Quoted 23 lines
Quoted 1 line
Quoted 1 line · On 14.01.19 at 10:34, <[email protected]> wrote:
Quoted 21 lines · Boris Ostrovsky
Quoted 18 lines · Razvan Cojocaru

Block interrupts (in vmx_intr_assist()) for the duration of processing a sync vm_event (similarly to the strategy currently used for single-stepping). Otherwise, attempting to emulate an instruction when requested by a vm_event reply may legitimately need to call e.g. hvm_inject_page_fault(), which then overwrites the active interrupt in the VMCS.

The sync vm_event handling path on x86/VMX is (roughly):
monitor_traps() -> process vm_event -> vmx_intr_assist() (possibly writing VM_ENTRY_INTR_INFO) -> hvm_vm_event_do_resume() -> hvm_emulate_one_vm_event() (possibly overwriting the VM_ENTRY_INTR_INFO value).

This patch may also be helpful for the future removal of may_defer in hvm_set_cr{0,3,4} and hvm_set_msr().

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Thanks! So now we have three reviewed-bys, if I'm not mistaken all we need is Tamas' (for the vm_event part) and Julien / Stefano's (for ARM) acks (or otherwise).

And you'd need to talk Jürgen into allowing this in, now that we're past the freeze point.

(Adding Jürgen to the conversation.)

Right, that would be ideal if possible - the code has absolutely no impact on anything unless vm_event is active on the domain, which is never the case for the use-cases considered for a Xen release.

So the case I'm making for the patch to go in 4.12 is that:

1. It's perfectly harmless (it affects nothing, except for introspection).

2. It's trivial and thus very easy to see that it's correct.

3. It fixes a major headache for us, and thus it is a great improvement from an introspection standpoint (fixes OS crashes / hangs which we'd otherwise need to work around in rather painful ways).

4. V3 of the patch has been sent out on Dec 14th - it's just that reviewers have had other priorities and it did not gather all acks in time.

However, if it's not possible or desirable to allow this in the next best thing is to at least have all the acks necessary for it to go in first thing once the freeze is over.

Quoted 6 lines
Quoted 5 lines
Quoted 1 line

From Julien's reply I understand that the last ack necessary is Tamas'.

With that ack just arrived:

AFAICT this is fine to apply to staging now, am I incorrect?

Yes, but may I ask that you be a little more patient?

Jan

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

#12 lore raw
Quoted 59 lines · Jan Beulich
Quoted 59 lines
Quoted 1 line
Quoted 1 line · On 16.01.19 at 08:10, <[email protected]> wrote:
Quoted 57 lines · Juergen Gross
Quoted 56 lines · Razvan Cojocaru
Quoted 23 lines · Jan Beulich
Quoted 23 lines
Quoted 1 line
Quoted 1 line · On 14.01.19 at 10:34, <[email protected]> wrote:
Quoted 21 lines · Boris Ostrovsky
Quoted 18 lines · Razvan Cojocaru

Block interrupts (in vmx_intr_assist()) for the duration of processing a sync vm_event (similarly to the strategy currently used for single-stepping). Otherwise, attempting to emulate an instruction when requested by a vm_event reply may legitimately need to call e.g. hvm_inject_page_fault(), which then overwrites the active interrupt in the VMCS.

The sync vm_event handling path on x86/VMX is (roughly):
monitor_traps() -> process vm_event -> vmx_intr_assist() (possibly writing VM_ENTRY_INTR_INFO) -> hvm_vm_event_do_resume() -> hvm_emulate_one_vm_event() (possibly overwriting the VM_ENTRY_INTR_INFO value).

This patch may also be helpful for the future removal of may_defer in hvm_set_cr{0,3,4} and hvm_set_msr().

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Thanks! So now we have three reviewed-bys, if I'm not mistaken all we need is Tamas' (for the vm_event part) and Julien / Stefano's (for ARM) acks (or otherwise).

And you'd need to talk Jürgen into allowing this in, now that we're past the freeze point.

(Adding Jürgen to the conversation.)

Right, that would be ideal if possible - the code has absolutely no impact on anything unless vm_event is active on the domain, which is never the case for the use-cases considered for a Xen release.

So the case I'm making for the patch to go in 4.12 is that:

1. It's perfectly harmless (it affects nothing, except for introspection).

2. It's trivial and thus very easy to see that it's correct.

3. It fixes a major headache for us, and thus it is a great improvement from an introspection standpoint (fixes OS crashes / hangs which we'd otherwise need to work around in rather painful ways).

4. V3 of the patch has been sent out on Dec 14th - it's just that reviewers have had other priorities and it did not gather all acks in time.

However, if it's not possible or desirable to allow this in the next best thing is to at least have all the acks necessary for it to go in first thing once the freeze is over.

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 1 line

From Julien's reply I understand that the last ack necessary is Tamas'.

With that ack just arrived:

AFAICT this is fine to apply to staging now, am I incorrect?

Yes, but may I ask that you be a little more patient?

Of course, apologies. I was just unsure if further action was required on my part.

Thank you,
Razvan

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

#13 lore raw
In reply to Razvan Cojocaru

Hi,

Quoted 19 lines · Razvan Cojocaru
Quoted 18 lines · Boris Ostrovsky
Quoted 17 lines · Razvan Cojocaru

Block interrupts (in vmx_intr_assist()) for the duration of processing a sync vm_event (similarly to the strategy currently used for single-stepping). Otherwise, attempting to emulate an instruction when requested by a vm_event reply may legitimately need to call e.g. hvm_inject_page_fault(), which then overwrites the active interrupt in the VMCS.

The sync vm_event handling path on x86/VMX is (roughly):
monitor_traps() -> process vm_event -> vmx_intr_assist() (possibly writing VM_ENTRY_INTR_INFO) -> hvm_vm_event_do_resume() -> hvm_emulate_one_vm_event() (possibly overwriting the VM_ENTRY_INTR_INFO value).

This patch may also be helpful for the future removal of may_defer in hvm_set_cr{0,3,4} and hvm_set_msr().

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Thanks! So now we have three reviewed-bys, if I'm not mistaken all we need is Tamas' (for the vm_event part) and Julien / Stefano's (for ARM) acks (or otherwise).

Could you please take a look?

All the Arm code modified falls under "VM EVENT, MEM ACCESS and MONITOR". So I don't think you need an ack from Stefano or I.

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v3 1/1
#14 lore raw
In reply to Razvan Cojocaru
Quoted 15 lines · Razvan Cojocaru

Block interrupts (in vmx_intr_assist()) for the duration of processing a sync vm_event (similarly to the strategy currently used for single-stepping). Otherwise, attempting to emulate an instruction when requested by a vm_event reply may legitimately need to call e.g. hvm_inject_page_fault(), which then overwrites the active interrupt in the VMCS.

The sync vm_event handling path on x86/VMX is (roughly):
monitor_traps() -> process vm_event -> vmx_intr_assist() (possibly writing VM_ENTRY_INTR_INFO) -> hvm_vm_event_do_resume() -> hvm_emulate_one_vm_event() (possibly overwriting the VM_ENTRY_INTR_INFO value).

Quoted 4 lines

This patch may also be helpful for the future removal of may_defer in hvm_set_cr{0,3,4} and hvm_set_msr().

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