All of lore.kernel.org
 help / color / mirror / Atom feed
* (no subject)
@ 2017-02-17 10:47 Norbert Manthey
  2017-02-17 10:47 ` [MINOR FIXES 1/2] mm: fix memory cleanup Norbert Manthey
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Norbert Manthey @ 2017-02-17 10:47 UTC (permalink / raw)
  To: xen-devel


Dear Xen developers,

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

Best,
Norbert

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [MINOR FIXES 1/2] mm: fix memory cleanup
  2017-02-17 10:47 (no subject) Norbert Manthey
@ 2017-02-17 10:47 ` Norbert Manthey
  2017-02-17 11:29   ` Andrew Cooper
  2017-02-17 10:47 ` [MINOR FIXES 2/2] lowmemd: fix comparison in cleanup Norbert Manthey
  2017-02-17 11:35 ` (no subject) Andrew Cooper
  2 siblings, 1 reply; 9+ messages in thread
From: Norbert Manthey @ 2017-02-17 10:47 UTC (permalink / raw)
  To: xen-devel; +Cc: 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.

Signed-off-by: Norbert Manthey <nmanthey@amazon.com>
---
 xen/arch/x86/x86_64/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c
index 9ead02e..52f2bd5 100644
--- a/xen/arch/x86/x86_64/mm.c
+++ b/xen/arch/x86/x86_64/mm.c
@@ -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;
-- 
2.7.4


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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [MINOR FIXES 2/2] lowmemd: fix comparison in cleanup
  2017-02-17 10:47 (no subject) Norbert Manthey
  2017-02-17 10:47 ` [MINOR FIXES 1/2] mm: fix memory cleanup Norbert Manthey
@ 2017-02-17 10:47 ` Norbert Manthey
  2017-02-17 11:31   ` Andrew Cooper
  2017-02-17 11:35 ` (no subject) Andrew Cooper
  2 siblings, 1 reply; 9+ messages in thread
From: Norbert Manthey @ 2017-02-17 10:47 UTC (permalink / raw)
  To: xen-devel; +Cc: 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.

Signed-off-by: Norbert Manthey <nmanthey@amazon.com>
---
 tools/misc/xen-lowmemd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/misc/xen-lowmemd.c b/tools/misc/xen-lowmemd.c
index 3200404..865a54c 100644
--- a/tools/misc/xen-lowmemd.c
+++ b/tools/misc/xen-lowmemd.c
@@ -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);
-- 
2.7.4


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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [MINOR FIXES 1/2] mm: fix memory cleanup
  2017-02-17 10:47 ` [MINOR FIXES 1/2] mm: fix memory cleanup Norbert Manthey
@ 2017-02-17 11:29   ` Andrew Cooper
  0 siblings, 0 replies; 9+ messages in thread
From: Andrew Cooper @ 2017-02-17 11:29 UTC (permalink / raw)
  To: Norbert Manthey, xen-devel

On 17/02/17 10:47, Norbert Manthey wrote:
> 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.
>
> Signed-off-by: Norbert Manthey <nmanthey@amazon.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [MINOR FIXES 2/2] lowmemd: fix comparison in cleanup
  2017-02-17 10:47 ` [MINOR FIXES 2/2] lowmemd: fix comparison in cleanup Norbert Manthey
@ 2017-02-17 11:31   ` Andrew Cooper
  2017-02-20 16:58     ` Wei Liu
  0 siblings, 1 reply; 9+ messages in thread
From: Andrew Cooper @ 2017-02-17 11:31 UTC (permalink / raw)
  To: Norbert Manthey, xen-devel

On 17/02/17 10:47, Norbert Manthey wrote:
> 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.
>
> Signed-off-by: Norbert Manthey <nmanthey@amazon.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: (no subject)
  2017-02-17 10:47 (no subject) Norbert Manthey
  2017-02-17 10:47 ` [MINOR FIXES 1/2] mm: fix memory cleanup Norbert Manthey
  2017-02-17 10:47 ` [MINOR FIXES 2/2] lowmemd: fix comparison in cleanup Norbert Manthey
@ 2017-02-17 11:35 ` Andrew Cooper
  2 siblings, 0 replies; 9+ messages in thread
From: Andrew Cooper @ 2017-02-17 11:35 UTC (permalink / raw)
  To: Norbert Manthey, xen-devel

On 17/02/17 10:47, Norbert Manthey wrote:
> 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
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [MINOR FIXES 2/2] lowmemd: fix comparison in cleanup
  2017-02-17 11:31   ` Andrew Cooper
@ 2017-02-20 16:58     ` Wei Liu
  2017-02-20 19:19       ` Norbert Manthey
  0 siblings, 1 reply; 9+ messages in thread
From: Wei Liu @ 2017-02-20 16:58 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: Norbert Manthey, Wei Liu, xen-devel

On Fri, Feb 17, 2017 at 11:31:01AM +0000, Andrew Cooper wrote:
> On 17/02/17 10:47, Norbert Manthey wrote:
> > 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.
> >
> > Signed-off-by: Norbert Manthey <nmanthey@amazon.com>
> 
> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
> 

Acked + applied this patch.

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

Wei.

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [MINOR FIXES 2/2] lowmemd: fix comparison in cleanup
  2017-02-20 16:58     ` Wei Liu
@ 2017-02-20 19:19       ` Norbert Manthey
  2017-02-20 20:10         ` Wei Liu
  0 siblings, 1 reply; 9+ messages in thread
From: Norbert Manthey @ 2017-02-20 19:19 UTC (permalink / raw)
  To: Wei Liu, Andrew Cooper; +Cc: Norbert Manthey, xen-devel

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


On 02/20/2017 05:58 PM, Wei Liu wrote:
> On Fri, Feb 17, 2017 at 11:31:01AM +0000, Andrew Cooper wrote:
>> On 17/02/17 10:47, Norbert Manthey wrote:
>>> 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.
>>>
>>> Signed-off-by: Norbert Manthey <nmanthey@amazon.com>
>> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
>>
> 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
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [MINOR FIXES 2/2] lowmemd: fix comparison in cleanup
  2017-02-20 19:19       ` Norbert Manthey
@ 2017-02-20 20:10         ` Wei Liu
  0 siblings, 0 replies; 9+ messages in thread
From: Wei Liu @ 2017-02-20 20:10 UTC (permalink / raw)
  To: Norbert Manthey; +Cc: Andrew Cooper, Norbert Manthey, Wei Liu, xen-devel

On Mon, Feb 20, 2017 at 08:19:09PM +0100, Norbert Manthey wrote:
> 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
> 

Oh yes, I missed that.

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-02-20 20:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-17 10:47 (no subject) Norbert Manthey
2017-02-17 10:47 ` [MINOR FIXES 1/2] mm: fix memory cleanup Norbert Manthey
2017-02-17 11:29   ` Andrew Cooper
2017-02-17 10:47 ` [MINOR FIXES 2/2] lowmemd: fix comparison in cleanup Norbert Manthey
2017-02-17 11:31   ` Andrew Cooper
2017-02-20 16:58     ` Wei Liu
2017-02-20 19:19       ` Norbert Manthey
2017-02-20 20:10         ` Wei Liu
2017-02-17 11:35 ` (no subject) Andrew Cooper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.