kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: lemonlime51@gmail.com (Matthias Bonne)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Question on mutex code
Date: Mon, 16 Mar 2015 05:40:15 +0200	[thread overview]
Message-ID: <5506509F.1040108@gmail.com> (raw)
In-Reply-To: <20150315221018.GA25881@debian>

On 03/16/15 00:10, Rabin Vincent wrote:
> On Sun, Mar 15, 2015 at 11:49:07PM +0200, Matthias Bonne wrote:
>> So the counter is set to 1 before taking the spinlock, which I think
>> might cause the race. Did I miss something?
>
> Yes, you miss the fact that __mutex_slowpath_needs_to_unlock() is 0 for
> the CONFIG_DEBUG_MUTEXES case:
>
>   #ifdef CONFIG_DEBUG_MUTEXES
>   # include "mutex-debug.h"
>   # include <asm-generic/mutex-null.h>
>   /*
>    * Must be 0 for the debug case so we do not do the unlock outside of the
>    * wait_lock region. debug_mutex_unlock() will do the actual unlock in this
>    * case.
>    */
>   # undef __mutex_slowpath_needs_to_unlock
>   # define  __mutex_slowpath_needs_to_unlock()	0
>

Right, I overlooked this part. Thanks to both of you for the
clarifications.

  reply	other threads:[~2015-03-16  3:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-04  0:13 Question on mutex code Matthias Bonne
2015-03-10 13:03 ` Yann Droneaud
2015-03-10 14:59   ` Valdis.Kletnieks at vt.edu
2015-03-14 23:08     ` Matthias Bonne
2015-03-14 23:05   ` Matthias Bonne
2015-03-15  1:04     ` Davidlohr Bueso
2015-03-15  1:10       ` Davidlohr Bueso
2015-03-15 21:49         ` Matthias Bonne
2015-03-15 22:11           ` Rabin Vincent
2015-03-16  3:40             ` Matthias Bonne [this message]
2015-03-15 22:19           ` Davidlohr Bueso
2015-03-15 22:24             ` Davidlohr Bueso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5506509F.1040108@gmail.com \
    --to=lemonlime51@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).