Skip to contentSkip to conversation

x86/hvm: Clean up the rest of bool_t from vm_event

PATCH Superseded Alexandru Stefan ISAILA 3 participants 3 messages Oct 29, 2018

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/hvm: Clean up the rest of bool_t from vm_event

---
 xen/arch/x86/hvm/hvm.c            | 2 +-
 xen/arch/x86/mm/mem_sharing.c     | 2 +-
 xen/arch/x86/mm/p2m.c             | 4 ++--
 xen/common/memory.c               | 2 +-
 xen/common/vm_event.c             | 4 ++--
 xen/include/asm-x86/mem_sharing.h | 2 +-
 xen/include/xen/vm_event.h        | 8 ++++----
 7 files changed, 12 insertions(+), 12 deletions(-)
xen/arch/x86/hvm/hvm.c +1 -1
index a140e60c9c..3a1d8ce279 100644
@@ -1905,7 +1905,7 @@ int hvm_hap_nested_page_fault(paddr_t gpa, unsigned long gla,
     if ( sharing_enomem )
     {
         int rv;
-        if ( (rv = mem_sharing_notify_enomem(currd, gfn, 1)) < 0 )
+        if ( (rv = mem_sharing_notify_enomem(currd, gfn, true)) < 0 )
         {
             gdprintk(XENLOG_ERR, "Domain %hu attempt to unshare "
                      "gfn %lx, ENOMEM and no helper (rc %d)\n",
xen/arch/x86/mm/mem_sharing.c +1 -1
index 1dab2c8cc3..be09c8871a 100644
@@ -546,7 +546,7 @@ static int audit(void)
 }
 
 int mem_sharing_notify_enomem(struct domain *d, unsigned long gfn,
-                                bool_t allow_sleep) 
+                              bool allow_sleep)
 {
     struct vcpu *v = current;
     int rc;
xen/arch/x86/mm/p2m.c +2 -2
index a00a3c1bff..cbd9bac6a1 100644
@@ -448,7 +448,7 @@ mfn_t __get_gfn_type_access(struct p2m_domain *p2m, unsigned long gfn_l,
         /* Try to unshare. If we fail, communicate ENOMEM without
          * sleeping. */
         if ( mem_sharing_unshare_page(p2m->domain, gfn_l, 0) < 0 )
-            (void)mem_sharing_notify_enomem(p2m->domain, gfn_l, 0);
+            (void)mem_sharing_notify_enomem(p2m->domain, gfn_l, false);
         mfn = p2m->get_entry(p2m, gfn, t, a, q, page_order, NULL);
     }
 
@@ -840,7 +840,7 @@ guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
                  * won't go to sleep. */
                 (void)mem_sharing_notify_enomem(p2m->domain,
                                                 gfn_x(gfn_add(gfn, i)),
-                                                0);
+                                                false);
                 return rc;
             }
             omfn = p2m->get_entry(p2m, gfn_add(gfn, i),
xen/common/memory.c +1 -1
index 987395fbb3..5676740973 100644
@@ -356,7 +356,7 @@ int guest_remove_page(struct domain *d, unsigned long gmfn)
         rc = mem_sharing_unshare_page(d, gmfn, 0);
         if ( rc )
         {
-            (void)mem_sharing_notify_enomem(d, gmfn, 0);
+            (void)mem_sharing_notify_enomem(d, gmfn, false);
             goto out_put_gfn;
         }
         /* Maybe the mfn changed */
xen/common/vm_event.c +2 -2
index 6ffd18a448..26cfa2c605 100644
@@ -496,7 +496,7 @@ static int vm_event_wait_slot(struct vm_event_domain *ved)
     return rc;
 }
 
-bool_t vm_event_check_ring(struct vm_event_domain *ved)
+bool vm_event_check_ring(struct vm_event_domain *ved)
 {
     return (ved && ved->ring_page);
 }
@@ -514,7 +514,7 @@ bool_t vm_event_check_ring(struct vm_event_domain *ved)
  *
  */
 int __vm_event_claim_slot(struct domain *d, struct vm_event_domain *ved,
-                          bool_t allow_sleep)
+                          bool allow_sleep)
 {
     if ( !vm_event_check_ring(ved) )
         return -EOPNOTSUPP;
xen/include/asm-x86/mem_sharing.h +1 -1
index 91908924df..0e77b7d935 100644
@@ -84,7 +84,7 @@ static inline int mem_sharing_unshare_page(struct domain *d,
  * then it's the same as a foreign domain.
  */
 int mem_sharing_notify_enomem(struct domain *d, unsigned long gfn,
-                                bool_t allow_sleep);
+                              bool allow_sleep);
 int mem_sharing_memop(XEN_GUEST_HANDLE_PARAM(xen_mem_sharing_op_t) arg);
 int mem_sharing_domctl(struct domain *d, 
                        struct xen_domctl_mem_sharing_op *mec);
xen/include/xen/vm_event.h +4 -4
index 2ff6e1c333..5302ee55c1 100644
@@ -30,7 +30,7 @@
 void vm_event_cleanup(struct domain *d);
 
 /* Returns whether a ring has been set up */
-bool_t vm_event_check_ring(struct vm_event_domain *ved);
+bool vm_event_check_ring(struct vm_event_domain *ved);
 
 /* Returns 0 on success, -ENOSYS if there is no ring, -EBUSY if there is no
  * available space and the caller is a foreign domain. If the guest itself
@@ -46,17 +46,17 @@ bool_t vm_event_check_ring(struct vm_event_domain *ved);
  * succeed.
  */
 int __vm_event_claim_slot(struct domain *d, struct vm_event_domain *ved,
-                          bool_t allow_sleep);
+                          bool allow_sleep);
 static inline int vm_event_claim_slot(struct domain *d,
                                       struct vm_event_domain *ved)
 {
-    return __vm_event_claim_slot(d, ved, 1);
+    return __vm_event_claim_slot(d, ved, true);
 }
 
 static inline int vm_event_claim_slot_nosleep(struct domain *d,
                                               struct vm_event_domain *ved)
 {
-    return __vm_event_claim_slot(d, ved, 0);
+    return __vm_event_claim_slot(d, ved, false);
 }
 
 void vm_event_cancel_slot(struct domain *d, struct vm_event_domain *ved);
Signature · 7 lines
2.17.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 1/1
#2 lore raw
In reply to Alexandru Stefan ISAILA

xen/arch/x86/hvm/hvm.c int hvm_hap_nested_page_fault(paddr_t gpa, unsigned long gla, · line 1908

Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 29.10.18 at 11:54, <[email protected]> wrote:
xen/arch/x86/hvm/hvm.c +1 -1
@@ -1905,7 +1905,7 @@ int hvm_hap_nested_page_fault(paddr_t gpa, unsigned long gla,
     if ( sharing_enomem )
     {
         int rv;
-        if ( (rv = mem_sharing_notify_enomem(currd, gfn, 1)) < 0 )
+        if ( (rv = mem_sharing_notify_enomem(currd, gfn, true)) < 0 )

May I encourage you to make trivial style corrections when you touch a piece of code anyway (here: add a missing blank line ahead of the line you change). It's fine to restrict this to just code you actually change, i.e. it's generally preferable if you don't change lines you don't touch anyway.

xen/arch/x86/mm/p2m.c mfn_t __get_gfn_type_access(struct p2m_domain *p2m, unsigned long gfn_l, · line 451

Quoted 8 lines
xen/arch/x86/mm/p2m.c +1 -1
@@ -448,7 +448,7 @@ mfn_t __get_gfn_type_access(struct p2m_domain *p2m, unsigned long gfn_l,
         /* Try to unshare. If we fail, communicate ENOMEM without
          * sleeping. */
         if ( mem_sharing_unshare_page(p2m->domain, gfn_l, 0) < 0 )
-            (void)mem_sharing_notify_enomem(p2m->domain, gfn_l, 0);
+            (void)mem_sharing_notify_enomem(p2m->domain, gfn_l, false);

Same here then (pointless cast could be dropped).

xen/arch/x86/mm/p2m.c guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn, · line 844

Quoted 7 lines
xen/arch/x86/mm/p2m.c +1 -1
@@ -840,7 +840,7 @@ guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
                  * won't go to sleep. */
                 (void)mem_sharing_notify_enomem(p2m->domain,
                                                 gfn_x(gfn_add(gfn, i)),
-                                                0);
+                                                false);
                 return rc;

Whereas this is an example where I personally wouldn't drop the cast, but I'd consider combining the last two lines.

xen/common/memory.c int guest_remove_page(struct domain *d, unsigned long gmfn) · line 359

Quoted 8 lines
xen/common/memory.c +1 -1
@@ -356,7 +356,7 @@ int guest_remove_page(struct domain *d, unsigned long gmfn)
         rc = mem_sharing_unshare_page(d, gmfn, 0);
         if ( rc )
         {
-            (void)mem_sharing_notify_enomem(d, gmfn, 0);
+            (void)mem_sharing_notify_enomem(d, gmfn, false);

Pointless cast should be dropped again.

With these adjustments

Jan

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