Skip to contentSkip to conversation

(no subject)

PATCH In review Norbert Manthey 4 participants 9 messages Feb 17, 2017 – Feb 20, 2017

lore
Share & tools
lore
#1 lore raw

PATCH 1/2 mm: fix memory cleanup

During destroying the m2p mapping, the loop variable was always incremented by one, as the current version used a compare operator on the left hand side, which always evaluated to true, i.e.

i += 1UL < (L2_PAGETABLE_SHIFT - 2)

The fix increments the value of the variable by the actual page size by using the shift operator instead.

---
 xen/arch/x86/x86_64/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/x86_64/mm.c +1 -1
index 9ead02e..52f2bd5 100644
@@ -251,7 +251,7 @@ static void destroy_compat_m2p_mapping(struct mem_hotadd_info *info)
             }
         }
 
-        i += 1UL < (L2_PAGETABLE_SHIFT - 2);
+        i += 1UL << (L2_PAGETABLE_SHIFT - 2);
     }
 
     return;
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Reviewed-by on v1 1/2
#2 lore raw

Re: [MINOR FIXES 1/2] mm: fix memory cleanup

Quoted 10 lines · Norbert Manthey

During destroying the m2p mapping, the loop variable was always incremented by one, as the current version used a compare operator on the left hand side, which always evaluated to true, i.e.

i += 1UL < (L2_PAGETABLE_SHIFT - 2)

The fix increments the value of the variable by the actual page size by using the shift operator instead.

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

#3 lore raw

PATCH 2/2 lowmemd: fix comparison in cleanup

In reply to Norbert Manthey

The variable virq_port of type uint32_t was compared to being greater than -1. This check always results in false for unsigned data types, resulting in never cleaning up the memory. Furthermore, the initialization with a negative variable for an unsigned type has been fixed.

---
 tools/misc/xen-lowmemd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/misc/xen-lowmemd.c +2 -2
index 3200404..865a54c 100644
@@ -10,14 +10,14 @@
 #include <stdlib.h>
 #include <string.h>
 
-static evtchn_port_t virq_port      = -1;
+static evtchn_port_t virq_port      = ~0;
 static xenevtchn_handle *xce_handle = NULL;
 static xc_interface *xch            = NULL;
 static struct xs_handle *xs_handle  = NULL;
 
 void cleanup(void)
 {
-    if (virq_port > -1)
+    if (virq_port != ~0)
         xenevtchn_unbind(xce_handle, virq_port);
     if (xce_handle)
         xenevtchn_close(xce_handle);
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Reviewed-by on v1 2/2
#4 lore raw

Re: [MINOR FIXES 2/2] lowmemd: fix comparison in cleanup

Quoted 6 lines · Norbert Manthey

The variable virq_port of type uint32_t was compared to being greater than -1. This check always results in false for unsigned data types, resulting in never cleaning up the memory. Furthermore, the initialization with a negative variable for an unsigned type has been fixed.

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

#5 lore raw

Re: [MINOR FIXES 2/2] lowmemd: fix comparison in cleanup

Quoted 10 lines · Andrew Cooper
Quoted 6 lines · Norbert Manthey

The variable virq_port of type uint32_t was compared to being greater than -1. This check always results in false for unsigned data types, resulting in never cleaning up the memory. Furthermore, the initialization with a negative variable for an unsigned type has been fixed.

Acked + applied this patch.

Tried to apply patch 1 as well but it didn't apply cleanly.

Wei.

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

#6 lore raw

Re: [MINOR FIXES 2/2] lowmemd: fix comparison in cleanup

Hi Wei,

as far as I can tell, patch 1 has already been added:

http://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=71af7d4220227529ea43b898683d4d2e68a90ffd

Best,
Norbert

Quoted 7 lines · Wei Liu
Quoted 6 lines · Andrew Cooper
Quoted 5 lines · Norbert Manthey

The variable virq_port of type uint32_t was compared to being greater than -1. This check always results in false for unsigned data types, resulting in never cleaning up the memory. Furthermore, the initialization with a negative variable for an unsigned type has been fixed.

Quoted 9 lines
Quoted 3 lines
Quoted 1 line

Acked + applied this patch.

Tried to apply patch 1 as well but it didn't apply cleanly.

Wei.

Amazon Development Center Germany GmbH
Berlin - Dresden - Aachen
main office: Krausenstr. 38, 10117 Berlin
Geschaeftsfuehrer: Dr. Ralf Herbrich, Christian Schlaeger
Ust-ID: DE289237879
Eingetragen am Amtsgericht Charlottenburg HRB 149173 B

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

#8 lore raw
In reply to Norbert Manthey
Quoted 4 lines · Norbert Manthey

Dear Xen developers,

I would like to bring the attached two patches online, as they fix minor defects in the upstream code base.

Thankyou for the fixes; they are both good.

For future fixes, please can you CC the appropriate maintainers
(https://wiki.xen.org/wiki/Submitting_Xen_Project_Patches#Cc_the_maintainer_of_the_code_you_are_modifying),
and you probably want to join the xen-devel mailing list to avoid getting held in moderation.

~Andrew

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