[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3 6/8] x86/vm-event: minor ASSERT fix, add 'unlikely'



On 7/7/2016 11:27 AM, Jan Beulich wrote:
On 06.07.16 at 17:54, <czuzu@xxxxxxxxxxxxxxx> wrote:
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -475,7 +475,7 @@ void hvm_do_resume(struct vcpu *v)
if ( unlikely(v->arch.vm_event) )
      {
-        if ( v->arch.vm_event->emulate_flags )
+        if ( unlikely(v->arch.vm_event->emulate_flags) )
          {
              enum emul_kind kind = EMUL_KIND_NORMAL;
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/xen/arch/x86/vm_event.c
+++ b/xen/arch/x86/vm_event.c
@@ -96,14 +96,16 @@ void vm_event_register_write_resume(struct vcpu *v,
vm_event_response_t *rsp)
  {
      if ( rsp->flags & VM_EVENT_FLAG_DENY )
      {
-        struct monitor_write_data *w = &v->arch.vm_event->write_data;
+        struct monitor_write_data *w;
- ASSERT(w);
+        ASSERT(v->arch.vm_event);
/* deny flag requires the vCPU to be paused */
          if ( !atomic_read(&v->vm_event_pause_count) )
              return;
+ w = &v->arch.vm_event->write_data;
+
          switch ( rsp->reason )
          {
          case VM_EVENT_REASON_MOV_TO_MSR:
I'd have preferred for you to leave alone the initializer, but we'll see
what the maintainers are going to say.

Jan

It's 'cleaner' this way, doesn't it? Not assigning a pointer to a possibly invalid address... Anyway, I'm preparing a v4, I'll probably drop this change if you won't *subdue* to ack it (kidding).

Thanks,
Corneliu.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.