All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/mm: Fix operator associativity bug in mm-locks.h
@ 2012-01-12 16:20 Andres Lagar-Cavilla
  2012-01-12 16:41 ` Tim Deegan
  0 siblings, 1 reply; 2+ messages in thread
From: Andres Lagar-Cavilla @ 2012-01-12 16:20 UTC (permalink / raw)
  To: xen-devel; +Cc: tim

 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@lagarcavilla.org>

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);
         }

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

* Re: [PATCH] x86/mm: Fix operator associativity bug in mm-locks.h
  2012-01-12 16:20 [PATCH] x86/mm: Fix operator associativity bug in mm-locks.h Andres Lagar-Cavilla
@ 2012-01-12 16:41 ` Tim Deegan
  0 siblings, 0 replies; 2+ messages in thread
From: Tim Deegan @ 2012-01-12 16:41 UTC (permalink / raw)
  To: Andres Lagar-Cavilla; +Cc: xen-devel

At 11:20 -0500 on 12 Jan (1326367206), Andres Lagar-Cavilla wrote:
> 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.

Applied, thanks.

Tim

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

end of thread, other threads:[~2012-01-12 16:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-12 16:20 [PATCH] x86/mm: Fix operator associativity bug in mm-locks.h Andres Lagar-Cavilla
2012-01-12 16:41 ` Tim Deegan

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.