From: Peter Zijlstra <peterz@infradead.org>
To: Andrea Parri <andrea.parri@amarulasolutions.com>
Cc: Daniel Jordan <daniel.m.jordan@oracle.com>,
Steffen Klassert <steffen.klassert@secunet.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
boqun.feng@gmail.com, paulmck@linux.ibm.com,
linux-arch@vger.kernel.org, linux-crypto@vger.kernel.org,
linux-kernel@vger.kernel.org, will@kernel.org
Subject: Re: [PATCH] padata: use smp_mb in padata_reorder to avoid orphaned padata jobs
Date: Tue, 16 Jul 2019 15:13:50 +0200 [thread overview]
Message-ID: <20190716131350.GA3402@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20190716125309.GA10672@andrea>
On Tue, Jul 16, 2019 at 02:53:09PM +0200, Andrea Parri wrote:
> C daniel-padata
>
> { }
>
> P0(atomic_t *reorder_objects, spinlock_t *pd_lock)
> {
> int r0;
>
> spin_lock(pd_lock);
> spin_unlock(pd_lock);
> smp_mb();
> r0 = atomic_read(reorder_objects);
> }
>
> P1(atomic_t *reorder_objects, spinlock_t *pd_lock, spinlock_t *reorder_lock)
> {
> int r1;
>
> spin_lock(reorder_lock);
> atomic_inc(reorder_objects);
> spin_unlock(reorder_lock);
> //smp_mb();
> r1 = spin_trylock(pd_lock);
> }
>
> exists (0:r0=0 /\ 1:r1=0)
>
> It seems worth noticing that this test's "exists" clause is satisfiable
> according to the (current) memory consistency model. (Informally, this
> can be explained by noticing that the RELEASE from the spin_unlock() in
> P1 does not provide any order between the atomic increment and the read
> part of the spin_trylock() operation.) FWIW, uncommenting the smp_mb()
> in P1 would suffice to prevent this clause from being satisfiable; I am
> not sure, however, whether this approach is feasible or ideal... (sorry,
> I'm definitely not too familiar with this code... ;/)
Urgh, that one again.
Yes, you need the smp_mb(); although a whole bunch of architectures can
live without it. IIRC it is part of the eternal RCsc/RCpc debate.
Paul/RCU have their smp_mb__after_unlock_lock() that is about something
similar, although we've so far confinsed that to the RCU code, because
of how confusing that all is.
next prev parent reply other threads:[~2019-07-16 13:13 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-11 22:12 [PATCH] padata: use smp_mb in padata_reorder to avoid orphaned padata jobs Daniel Jordan
2019-07-12 10:06 ` Herbert Xu
2019-07-12 10:06 ` Herbert Xu
2019-07-12 10:06 ` Herbert Xu
2019-07-12 10:10 ` Steffen Klassert
2019-07-12 10:10 ` Steffen Klassert
2019-07-12 16:07 ` Daniel Jordan
2019-07-13 5:03 ` Herbert Xu
2019-07-15 16:10 ` Daniel Jordan
2019-07-16 10:04 ` Herbert Xu
2019-07-16 11:14 ` Steffen Klassert
2019-07-16 11:14 ` Steffen Klassert
2019-07-16 12:57 ` [PATCH] padata: Use RCU when fetching pd from do_serial Herbert Xu
2019-07-16 13:09 ` Herbert Xu
2019-07-16 13:23 ` [v2 PATCH] " Herbert Xu
2019-07-17 8:36 ` Steffen Klassert
2019-07-17 8:36 ` Steffen Klassert
2019-07-17 8:50 ` Herbert Xu
2019-07-17 8:28 ` [PATCH] " Steffen Klassert
2019-07-17 8:28 ` Steffen Klassert
2019-07-17 8:47 ` Herbert Xu
2019-07-17 8:53 ` Steffen Klassert
2019-07-17 8:53 ` Steffen Klassert
2019-07-16 13:15 ` Peter Zijlstra
2019-07-16 13:18 ` Herbert Xu
2019-07-16 13:50 ` Peter Zijlstra
2019-07-16 13:52 ` Herbert Xu
2019-07-16 12:53 ` [PATCH] padata: use smp_mb in padata_reorder to avoid orphaned padata jobs Andrea Parri
2019-07-16 13:13 ` Peter Zijlstra [this message]
2019-07-16 15:01 ` Herbert Xu
2019-07-16 15:44 ` Daniel Jordan
2019-07-16 16:32 ` [PATCH v2] " Daniel Jordan
2019-07-17 11:11 ` [PATCH] padata: Replace delayed timer with immediate workqueue in padata_reorder Herbert Xu
2019-07-17 18:32 ` Daniel Jordan
2019-07-18 3:31 ` Herbert Xu
2019-07-18 14:27 ` Daniel Jordan
2019-07-18 14:56 ` Herbert Xu
2019-07-18 15:01 ` [v2 PATCH] " Herbert Xu
2019-07-19 14:37 ` Daniel Jordan
2019-07-19 14:55 ` Herbert Xu
2019-07-19 19:04 ` [PATCH] padata: purge get_cpu and reorder_via_wq from padata_do_serial Daniel Jordan
2019-07-26 12:36 ` Herbert Xu
2019-07-19 14:27 ` [PATCH] padata: Replace delayed timer with immediate workqueue in padata_reorder Daniel Jordan
2019-07-17 23:21 ` Daniel Jordan
2019-07-18 3:30 ` Herbert Xu
2019-07-18 14:25 ` Daniel Jordan
2019-07-18 14:49 ` Herbert Xu
2019-07-19 14:21 ` Daniel Jordan
2019-07-18 5:42 ` [PATCH v2] padata: use smp_mb in padata_reorder to avoid orphaned padata jobs Herbert Xu
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=20190716131350.GA3402@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=andrea.parri@amarulasolutions.com \
--cc=boqun.feng@gmail.com \
--cc=daniel.m.jordan@oracle.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-arch@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@linux.ibm.com \
--cc=steffen.klassert@secunet.com \
--cc=will@kernel.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 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.