linux-mips
[Top] [All Lists]

Re: [PATCH] MIPS: __raw_spin_lock() spins forever on ticket wrap.

To: David Daney <ddaney@caviumnetworks.com>
Subject: Re: [PATCH] MIPS: __raw_spin_lock() spins forever on ticket wrap.
From: Ralf Baechle <ralf@linux-mips.org>
Date: Fri, 27 Mar 2009 23:47:50 +0100
Cc: linux-mips@linux-mips.org
In-reply-to: <1238173622-12585-1-git-send-email-ddaney@caviumnetworks.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1238173622-12585-1-git-send-email-ddaney@caviumnetworks.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.5.18 (2008-05-17)
On Fri, Mar 27, 2009 at 10:07:02AM -0700, David Daney wrote:

> If the lock is not acquired and has to spin *and* the second attempt
> to acquire the lock fails, the delay time is not masked by the ticket
> range mask.  If the ticket number wraps around to zero, the result is
> that the lock sampling delay is essentially infinite (due to casting
> -1 to an unsigned int).
> 
> The fix: Always mask the difference between my_ticket and the current
> ticket value before calculating the delay.

Thanks, applied!

  Ralf

<Prev in Thread] Current Thread [Next in Thread>