x86/hvm: Clean up the rest of bool_t from vm_event
PATCH v2 1/1 x86/hvm: Clean up the rest of bool_t from vm_event
---
Changes since V1:
- Made style corrections suggested by Jan.
--- xen/arch/x86/hvm/hvm.c | 3 ++- xen/arch/x86/mm/mem_sharing.c | 2 +- xen/arch/x86/mm/p2m.c | 5 ++--- 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, 13 insertions(+), 13 deletions(-)
xen/arch/x86/hvm/hvm.c +2 -1
@@ -1905,7 +1905,8 @@ 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
@@ -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 -3
@@ -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 ); +mem_sharing_notify_enomem (p2m->domain, gfn_l, false); mfn = p2m->get_entry (p2m, gfn, t, a, q, page_order,NULL ); }
@@ -839,8 +839,7 @@ guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,* Foreign domains are okay to place an event as they * won't go to sleep. */ (void )mem_sharing_notify_enomem (p2m->domain, -gfn_x (gfn_add (gfn, i)), -0 ); +gfn_x (gfn_add (gfn, i)), false);return rc; } omfn = p2m->get_entry(p2m, gfn_add(gfn, i),
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 ); +mem_sharing_notify_enomem (d, gmfn, false); goto out_put_gfn; }/* Maybe the mfn changed */
xen/common/vm_event.c +2 -2
@@ -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
@@ -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
@@ -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
Any changes required for this to go in?
Regards,
Alex
Quoted 140 lines · Alexandru Stefan ISAILA
Signed-off-by Alexandru Isaila <[email protected]>Acked-by Tamas K Lengyel <[email protected]>Acked-by Jan Beulich <[email protected]>---
Changes since V1:
- Made style corrections suggested by Jan.--- xen/arch/x86/hvm/hvm.c | 3 ++- xen/arch/x86/mm/mem_sharing.c | 2 +- xen/arch/x86/mm/p2m.c | 5 ++--- 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, 13 insertions(+), 13 deletions(-)xen/arch/x86/hvm/hvm.c +2
-1@@ -1905,7 +1905,8 @@ 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@@ -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
-3@@ -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 ); +mem_sharing_notify_enomem (p2m->domain, gfn_l, false); mfn = p2m->get_entry (p2m, gfn, t, a, q, page_order,NULL ); }@@ -839,8 +839,7 @@ guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,* Foreign domains are okay to place an event as they * won't go to sleep. */ (void )mem_sharing_notify_enomem (p2m->domain, -gfn_x (gfn_add (gfn, i)), -0 ); +gfn_x (gfn_add (gfn, i)), false);return rc; } omfn = p2m->get_entry(p2m, gfn_add(gfn, i),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 ); +mem_sharing_notify_enomem (d, gmfn, false); goto out_put_gfn; }/* Maybe the mfn changed */ xen/common/vm_event.c +2
-2@@ -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@@ -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 +3
-3@@ -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);
xen/include/xen/vm_event.h bool_t vm_event_check_ring(struct vm_event_domain *ved); · line 62
Quoted 10 lines
xen/include/xen/vm_event.h +1
-1}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);
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 49 lines · Alexandru Stefan ISAILA
Signed-off-by Alexandru Isaila <[email protected]>Acked-by Tamas K Lengyel <[email protected]>Acked-by Jan Beulich <[email protected]>---
Changes since V1:
- Made style corrections suggested by Jan.--- xen/arch/x86/hvm/hvm.c | 3 ++- xen/arch/x86/mm/mem_sharing.c | 2 +- xen/arch/x86/mm/p2m.c | 5 ++--- 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, 13 insertions(+), 13 deletions(-)xen/arch/x86/hvm/hvm.c +2
-1@@ -1905,7 +1905,8 @@ 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@@ -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 +0
-0
xen/arch/x86/mm/p2m.c mfn_t __get_gfn_type_access(struct p2m_domain *p2m, unsigned long gfn_l, · line 451
Quoted 5 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 ); +mem_sharing_notify_enomem (p2m->domain, gfn_l, false);
Why do you remove the (void) cast here...
xen/arch/x86/mm/p2m.c guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn, · line 842
Quoted 10 lines
xen/arch/x86/mm/p2m.c +1
-2mfn = p2m->get_entry (p2m, gfn, t, a, q, page_order,NULL ); }@@ -839,8 +839,7 @@ guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,* Foreign domains are okay to place an event as they * won't go to sleep. */ (void )mem_sharing_notify_enomem (p2m->domain, -gfn_x (gfn_add (gfn, i)), -0 ); +gfn_x (gfn_add (gfn, i)), false);
...but not here?
-George
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 61 lines · George Dunlap
Quoted 49 lines · Alexandru Stefan ISAILA
Signed-off-by Alexandru Isaila <[email protected]>Acked-by Tamas K Lengyel <[email protected]>Acked-by Jan Beulich <[email protected]>---
Changes since V1:
- Made style corrections suggested by Jan.--- xen/arch/x86/hvm/hvm.c | 3 ++- xen/arch/x86/mm/mem_sharing.c | 2 +- xen/arch/x86/mm/p2m.c | 5 ++--- 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, 13 insertions(+), 13 deletions(-)xen/arch/x86/hvm/hvm.c +2
-1@@ -1905,7 +1905,8 @@ 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@@ -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 +0
-0xen/arch/x86/mm/p2m.c mfn_t __get_gfn_type_access(struct p2m_domain *p2m, unsigned long gfn_l, · line 451
Quoted 5 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 ); +mem_sharing_notify_enomem (p2m->domain, gfn_l, false);Why do you remove the (void) cast here...
Quoted 3 lines
xen/arch/x86/mm/p2m.c +0
-0mfn = p2m->get_entry (p2m, gfn, t, a, q, page_order,NULL ); }
Quoted 9 lines
xen/arch/x86/mm/p2m.c guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn, · line 842
Quoted 7 lines
xen/arch/x86/mm/p2m.c +1
-2@@ -839,8 +839,7 @@ guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,* Foreign domains are okay to place an event as they * won't go to sleep. */ (void )mem_sharing_notify_enomem (p2m->domain, -gfn_x (gfn_add (gfn, i)), -0 ); +gfn_x (gfn_add (gfn, i)), false);...but not here?
That's what Jan has recommended here:
https://lists.xenproject.org/archives/html/xen-devel/2018-10/msg02289.html
Thanks,
Razvan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 16 lines
Quoted 1 line
Quoted 1 line · On 05.11.18 at 17:17, <[email protected]> wrote:
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 · Alexandru Stefan ISAILA
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 ); +mem_sharing_notify_enomem (p2m->domain, gfn_l, false);Why do you remove the (void) cast here...
Quoted 3 lines
xen/arch/x86/mm/p2m.c +0
-0mfn = p2m->get_entry (p2m, gfn, t, a, q, page_order,NULL ); }
Quoted 9 lines
xen/arch/x86/mm/p2m.c guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn, · line 842
Quoted 7 lines
xen/arch/x86/mm/p2m.c +1
-2@@ -839,8 +839,7 @@ guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,* Foreign domains are okay to place an event as they * won't go to sleep. */ (void )mem_sharing_notify_enomem (p2m->domain, -gfn_x (gfn_add (gfn, i)), -0 ); +gfn_x (gfn_add (gfn, i)), false);...but not here?
I had asked that it strictly be removed from lines touched anyway, and I left it to their discretion to leave alone neighboring lines. Of course it would have helped if the description said so.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
George Dunlap
Acked-byQuoted 26 lines · Jan Beulich
Quoted 16 lines
Quoted 1 line
Quoted 1 line · On 05.11.18 at 17:17, <[email protected]> wrote:
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 · Alexandru Stefan ISAILA
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 ); +mem_sharing_notify_enomem (p2m->domain, gfn_l, false);Why do you remove the (void) cast here...
Quoted 3 lines
xen/arch/x86/mm/p2m.c +0
-0mfn = p2m->get_entry (p2m, gfn, t, a, q, page_order,NULL ); }Quoted 9 lines
xen/arch/x86/mm/p2m.c guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn, · line 842
Quoted 7 lines
xen/arch/x86/mm/p2m.c +1
-2@@ -839,8 +839,7 @@ guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,* Foreign domains are okay to place an event as they * won't go to sleep. */ (void )mem_sharing_notify_enomem (p2m->domain, -gfn_x (gfn_add (gfn, i)), -0 ); +gfn_x (gfn_add (gfn, i)), false);...but not here?
Quoted 3 lines
I had asked that it strictly be removed from lines touched anyway, and I left it to their discretion to leave alone neighboring lines. Of course it would have helped if the description said so.
Right. In that case:
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel