public inbox for linux-rt-users@vger.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Nicholas Mc Guire <der.herr@hofr.at>
Cc: linux-rt-users@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Carsten Emde <C.Emde@osadl.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Andreas Platschek <platschek@ict.tuwien.ac.at>
Subject: Re: [PATCH RT 2/5] allow preemption in alloc and free _buffer_head
Date: Fri, 14 Feb 2014 13:53:25 +0100	[thread overview]
Message-ID: <20140214125325.GD28438@linutronix.de> (raw)
In-Reply-To: <20140210153759.GC20017@opentech.at>

* Nicholas Mc Guire | 2014-02-10 16:37:59 [+0100]:

>2a) premption induced race in __this_cpu_dec
>  T1 dec:start
>               T2 dec
>  T1 dec:end
>
>__this_cpu_dec 
>  -> __this_cpu_sub 
>    -> __this_cpu_add
>      -> __this_cpu_add_#
>        -> __this_cpu_generic_to_op
>         -> __this_cpu_ptr += val
>
>
>so we end up with the possibilities of
>  T1 load
>          T2 load
>          T2 store
>  T1 store
>and the increment provided by T2 would be lost. The result of which
>is that reaching the buffer_heads_over_limit threshold in recalc_bh_state 

I don't like this very much. __this_cpu_inc() is not atomic as you say
and without the locking that is provided by preempt_disable() it might
lose one store in inc or dec direction. This error will never be
corrected again. That code path looks very short unless you have 4096
CPUs.

Sebastian

      reply	other threads:[~2014-02-14 12:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-10 15:37 [PATCH RT 2/5] allow preemption in alloc and free _buffer_head Nicholas Mc Guire
2014-02-14 12:53 ` Sebastian Andrzej Siewior [this message]

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=20140214125325.GD28438@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=C.Emde@osadl.org \
    --cc=der.herr@hofr.at \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=platschek@ict.tuwien.ac.at \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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