All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>,
	qemu-ppc@nongnu.org, rth@twiddle.net, qemu-devel@nongnu.org,
	benh@kernel.crashing.org
Subject: Re: [Qemu-devel] [PATCH RFC 3/4] target-ppc: use atomic_cmpxchg for ld/st reservation
Date: Wed, 07 Sep 2016 08:13:31 +0100	[thread overview]
Message-ID: <87d1kgyyg4.fsf@linaro.org> (raw)
In-Reply-To: <20160907053459.GM2780@voom.fritz.box>


David Gibson <david@gibson.dropbear.id.au> writes:

> On Wed, Sep 07, 2016 at 10:17:42AM +0530, Nikunj A Dadhania wrote:
>> David Gibson <david@gibson.dropbear.id.au> writes:
>>
>> > [ Unknown signature status ]
>> > On Fri, Sep 02, 2016 at 12:02:55PM +0530, Nikunj A Dadhania wrote:
>> >> Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
>> >
>> > This really needs a comment indicating that this implementation isn't
>> > strictly correct (although probably good enough in practice).
>>
>> Sure. And it also does not help if someone uses any store other than
>> store conditional, that isn't taken care.
>>
>> Assumption here is the locking primitives use load with reservation and
>> store conditional. And no other ld/st variant touch this memory.
>
> So, a) I don't think this really relies on that: an ordinary store
> (assuming it changes the value) will still get picked up the cmpxchg.
> Well.. at least after a suitable memory barrier.  Matching memory
> models between emulated and host cpus is a whole other kettle of fish.

Have you seen Pranith's memory barrier patches?

>
> I think this does matter, IIRC a kernel spin unlock on ppc is a
> barrier + plain store, no load locked or store conditional.
>
>> > Specifically a racing store which happens to store the same value
>> > which was already in memory should clobber the reservation, but won't
>> > with this implementation.
>> >
>> > I had a long discussion at KVM Forum with Emilio Costa about this, in
>> > which I discovered just how hard it is to strictly implement
>> > store-conditional semantics in terms of anything else.  So, this is
>> > probably a reasonable substitute, but we should note the fact that
>> > it's not 100%.
>>
>> I will update the commit log.
>>
>> Regards,
>> Nikunj
>>


--
Alex Bennée

  reply	other threads:[~2016-09-07  7:13 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-02  6:32 [Qemu-devel] [PATCH RFC 0/4] Enable MTTCG on PowerPC Nikunj A Dadhania
2016-09-02  6:32 ` [Qemu-devel] [PATCH RFC 1/4] spapr-hcall: take iothread lock during handler call Nikunj A Dadhania
2016-09-02  8:53   ` Greg Kurz
2016-09-02  9:28     ` Nikunj A Dadhania
2016-09-02  9:57       ` Greg Kurz
2016-09-03 16:31         ` Nikunj A Dadhania
2016-09-02 10:06   ` Thomas Huth
2016-09-03 16:33     ` Nikunj A Dadhania
2016-09-02  6:32 ` [Qemu-devel] [PATCH RFC 2/4] target-ppc: with MTTCG report more threads Nikunj A Dadhania
2016-09-02  9:28   ` Greg Kurz
2016-09-02  9:34     ` Nikunj A Dadhania
2016-09-02 10:45       ` Greg Kurz
2016-09-03 16:34         ` Nikunj A Dadhania
2016-09-07  3:51   ` David Gibson
2016-09-07  4:41     ` Nikunj A Dadhania
2016-09-02  6:32 ` [Qemu-devel] [PATCH RFC 3/4] target-ppc: use atomic_cmpxchg for ld/st reservation Nikunj A Dadhania
2016-09-07  4:02   ` David Gibson
2016-09-07  4:47     ` Nikunj A Dadhania
2016-09-07  5:24       ` Benjamin Herrenschmidt
2016-09-07  8:42         ` Nikunj A Dadhania
2016-09-07  5:34       ` David Gibson
2016-09-07  7:13         ` Alex Bennée [this message]
2016-09-12  1:19           ` David Gibson
2016-09-12  8:39             ` Alex Bennée
2016-09-12  9:15               ` Benjamin Herrenschmidt
2016-09-02  6:32 ` [Qemu-devel] [PATCH RFC 4/4] target-ppc: flush tlb from all the cpu Nikunj A Dadhania
2016-09-02  7:22   ` Benjamin Herrenschmidt
2016-09-02  7:34     ` Nikunj A Dadhania
2016-09-04 17:00       ` Alex Bennée
2016-09-04 22:17         ` Benjamin Herrenschmidt
2016-09-05  0:10         ` Benjamin Herrenschmidt
2016-09-06  1:55           ` Nikunj A Dadhania
2016-09-06  3:05             ` Benjamin Herrenschmidt
2016-09-06  4:53               ` Nikunj A Dadhania
2016-09-06  5:30                 ` Benjamin Herrenschmidt
2016-09-06  6:57                   ` Nikunj A Dadhania
2016-09-02  6:43 ` [Qemu-devel] [PATCH RFC 0/4] Enable MTTCG on PowerPC Cédric Le Goater
2016-09-02  6:46   ` Nikunj A Dadhania
2016-09-02  7:57   ` Thomas Huth
2016-09-02 11:44     ` Cédric Le Goater
2016-09-02  7:19 ` Benjamin Herrenschmidt
2016-09-02  7:39   ` Nikunj A Dadhania
2016-09-02 12:13     ` Benjamin Herrenschmidt
2016-09-07  4:08   ` David Gibson
2016-09-07  4:48     ` Nikunj A Dadhania

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=87d1kgyyg4.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=benh@kernel.crashing.org \
    --cc=david@gibson.dropbear.id.au \
    --cc=nikunj@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=rth@twiddle.net \
    /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.