vm_event: fix rc check for uninitialized ring
authorJuergen Gross <jgross@suse.com>
Mon, 27 May 2019 10:26:20 +0000 (12:26 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 27 May 2019 10:26:20 +0000 (12:26 +0200)
vm_event_claim_slot() returns -EOPNOTSUPP for an uninitialized ring
since commit 15e4dd5e866b43bbc ("common/vm_event: Initialize vm_event
lists on domain creation"), but the callers test for -ENOSYS.

Correct the callers.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
xen/arch/x86/mm/p2m.c
xen/common/monitor.c
xen/common/vm_event.c

index 57c5eeda9142b12ab0947116948de4446e424ff4..8fd3c9d996c06fa9b035d842f721484dc4b33bcf 100644 (file)
@@ -1705,7 +1705,8 @@ void p2m_mem_paging_populate(struct domain *d, unsigned long gfn_l)
 
     /* We're paging. There should be a ring */
     int rc = vm_event_claim_slot(d, d->vm_event_paging);
-    if ( rc == -ENOSYS )
+
+    if ( rc == -EOPNOTSUPP )
     {
         gdprintk(XENLOG_ERR, "Domain %hu paging gfn %lx yet no ring "
                              "in place\n", d->domain_id, gfn_l);
index cb5f37fdb245d97c00270612ee66afb99175ba44..d5c9ff1cbf8cc71dfc1f31fbefa8ad21e2cdab99 100644 (file)
@@ -98,7 +98,7 @@ int monitor_traps(struct vcpu *v, bool sync, vm_event_request_t *req)
     {
     case 0:
         break;
-    case -ENOSYS:
+    case -EOPNOTSUPP:
         /*
          * If there was no ring to handle the event, then
          * simply continue executing normally.
index 6e68be47bcc228ccb7003b7f97554b260d90b39e..6833c21544147db1c8945bfc327411212d47b972 100644 (file)
@@ -64,7 +64,7 @@ static int vm_event_enable(
     /* The parameter defaults to zero, and it should be
      * set to something */
     if ( ring_gfn == 0 )
-        return -ENOSYS;
+        return -EOPNOTSUPP;
 
     vm_event_ring_lock_init(*ved);
     vm_event_ring_lock(*ved);
@@ -465,7 +465,7 @@ static int vm_event_grab_slot(struct vm_event_domain *ved, int foreign)
     unsigned int avail_req;
 
     if ( !ved->ring_page )
-        return -ENOSYS;
+        return -EOPNOTSUPP;
 
     vm_event_ring_lock(ved);
 
@@ -513,7 +513,7 @@ bool vm_event_check_ring(struct vm_event_domain *ved)
  * this function will always return 0 for a guest.  For a non-guest, we check
  * for space and return -EBUSY if the ring is not available.
  *
- * Return codes: -ENOSYS: the ring is not yet configured
+ * Return codes: -EOPNOTSUPP: the ring is not yet configured
  *               -EBUSY: the ring is busy
  *               0: a spot has been reserved
  *