Skip to contentSkip to conversation

x86/hvm: Fix non-onchangeonly CR write events logic

PATCH In review Razvan Cojocaru 3 participants 4 messages Aug 12, 2015 – Aug 13, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/hvm: Fix non-onchangeonly CR write events logic

hvm_event_crX() already returns a bool_t to tell us whether an event will be sent out or not, so the extra check that value != old is not only useless, but also prevents non-onchangeonly events from being sent.

---
 xen/arch/x86/hvm/hvm.c |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
xen/arch/x86/hvm/hvm.c +3 -6
index c957610..707ad86 100644
@@ -3368,8 +3368,7 @@ int hvm_set_cr0(unsigned long value, bool_t may_defer)
     }
 
     if ( may_defer && unlikely(currad->monitor.write_ctrlreg_enabled &
-                               monitor_ctrlreg_bitmask(VM_EVENT_X86_CR0)) &&
-         value != old_value )
+                               monitor_ctrlreg_bitmask(VM_EVENT_X86_CR0)) )
     {
         ASSERT(currad->event_write_data != NULL);
 
@@ -3472,8 +3471,7 @@ int hvm_set_cr3(unsigned long value, bool_t may_defer)
     struct arch_domain *currad = &v->domain->arch;
 
     if ( may_defer && unlikely(currad->monitor.write_ctrlreg_enabled &
-                               monitor_ctrlreg_bitmask(VM_EVENT_X86_CR3)) &&
-         value != old )
+                               monitor_ctrlreg_bitmask(VM_EVENT_X86_CR3)) )
     {
         ASSERT(currad->event_write_data != NULL);
 
@@ -3546,8 +3544,7 @@ int hvm_set_cr4(unsigned long value, bool_t may_defer)
     }
 
     if ( may_defer && unlikely(currad->monitor.write_ctrlreg_enabled &
-                               monitor_ctrlreg_bitmask(VM_EVENT_X86_CR4)) &&
-         value != old_cr )
+                               monitor_ctrlreg_bitmask(VM_EVENT_X86_CR4)) )
     {
         ASSERT(currad->event_write_data != NULL);
 
Signature · 1 line
1.7.9.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Razvan Cojocaru

hvm_event_crX() already returns a bool_t to tell us whether an event will be sent out or not, so the extra check that value != old is not only useless, but also prevents non-onchangeonly events from being sent.

I presume this is a 4.6 candidate? If so, you need to CC the release manager as we are into the RC's

~Andrew

#2 lore raw
Quoted 6 lines · Andrew Cooper
Quoted 5 lines · Razvan Cojocaru

hvm_event_crX() already returns a bool_t to tell us whether an event will be sent out or not, so the extra check that value != old is not only useless, but also prevents non-onchangeonly events from being sent.

Quoted 6 lines
Quoted 1 line

I presume this is a 4.6 candidate? If so, you need to CC the release manager as we are into the RC's

Yes, it is. I've now CCd Wei, thank you for pointing that out! And sorry for missing this before.

Thanks,
Razvan

#3 lore raw
Quoted 9 lines · Razvan Cojocaru
Quoted 8 lines · Andrew Cooper
Quoted 6 lines · Razvan Cojocaru

hvm_event_crX() already returns a bool_t to tell us whether an event will be sent out or not, so the extra check that value != old is not only useless, but also prevents non-onchangeonly events from being sent.

Quoted 8 lines
Quoted 4 lines

I presume this is a 4.6 candidate? If so, you need to CC the release manager as we are into the RC's

Yes, it is. I've now CCd Wei, thank you for pointing that out! And sorry for missing this before.

Quoted 3 lines

Thanks,
Razvan