[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] x86/mm: Fix operator associativity bug in mm-locks.h


  • To: xen-devel@xxxxxxxxxxxxxxxxxxx
  • From: Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx>
  • Date: Thu, 12 Jan 2012 11:20:06 -0500
  • Cc: tim@xxxxxxx
  • Delivery-date: Thu, 12 Jan 2012 16:16:02 +0000
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=lagarcavilla.org; h=content-type :mime-version:content-transfer-encoding:subject:message-id:date :from:to:cc; q=dns; s=lagarcavilla.org; b=m4yzkJtHlv9ccQzdV7/l+M y7qoy3kg+kJcsjEjy/kfLTrQ0d7lJOmH9W8+Zu3O8smUGlzPJfsZjJJIFC6mrp+k kXpbtgH/iC0kPr14zN1upGsqbwJTpdGDFWg0r8l0CKyBJdsfHtFKxyhFtPTkP/hV NqK3V9ItsNs9Oe2QI+NK0=
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

 xen/arch/x86/mm/mm-locks.h |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


In an order-enforcing wrapper for an "external" recursive lock,
we aim to increment/decrement a recurse count and only update the
lock ordering on zero counts.

Unfortunately we incrementing/decrementing the pointer to the
recurse count, rather than the count itself.

Signed-off-by: Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx>

diff -r 91f9a26a8d94 -r e7028b298fe3 xen/arch/x86/mm/mm-locks.h
--- a/xen/arch/x86/mm/mm-locks.h
+++ b/xen/arch/x86/mm/mm-locks.h
@@ -81,7 +81,7 @@ static inline void _mm_enforce_order_loc
 {
     if ( recurse_count )
     {
-        if ( *recurse_count++ == 0 )
+        if ( (*recurse_count)++ == 0 )
         {
             *unlock_level = __get_lock_level();
         }
@@ -125,7 +125,7 @@ static inline void mm_enforce_order_unlo
     if ( recurse_count )
     {
         BUG_ON(*recurse_count == 0);
-        if ( *recurse_count-- == 1 )
+        if ( (*recurse_count)-- == 1 )
         {
             __set_lock_level(unlock_level);
         }

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.