qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jamie Lokier <jamie@shareable.org>
To: Richard Henderson <rth@twiddle.net>
Cc: qemu-devel@nongnu.org, aurelien@aurel32.net
Subject: Re: [Qemu-devel] [PATCH 00/10, v3] target-alpha improvements
Date: Fri, 26 Mar 2010 01:52:52 +0000	[thread overview]
Message-ID: <20100326015252.GG19308@shareable.org> (raw)
In-Reply-To: <cover.1269476678.git.rth@twiddle.net>

Richard Henderson wrote:
> I don't see how any sort of emulation of cmpxchg/load-locked is working
> for any currently enabled nptl target.  I think how I've approached
> handling load-locked for alpha is probably the easiest way.  Slightly
> better would be if TCG had a (set of) cmpxchg opcodes, which would have
> the benefit of getting the virt->phys->host address (and segfault handling)
> more correct.  I've sort of totally ignored the faulting for now.

I guess you are thinking to save the value loaded by load-locked, and
use it as the "old" for host cmpxchg at target's store-conditional?

I'm not sure if that will have the correct behaviour for all target
architectures, where _any_ value written by another CPU during an
ll/sc sequence will prevent the sequence from proceeding, including

   CPU #0                CPU #1

   x <- load-locked(A)
   y <- load(B)
                         x+1 -> store(A)
                         y+1 -> store(B)
                         x   -> store(A)
   f(x,y) -> store-cond(A)

Unless I made a mistake, the above cannot store f(x,y+1) into A, for
any interleaving (assume strongly ordered memory or barriers), on
machines where any store by another CPU breaks the condition.  But on
machines which implement store-cond by atomic-cmpxchg using the
load-locked value, f(x,y+1) can be stored.

It'll be fine when ll/sc are only used to provide single-word atomic
calculations, but I'm not sure those are the only uses to which they
are put by any code anywhere.  E.g. if I remember rightly, there was
some discussion of a planned unusual ll/sc use on the linux-arm list,
which involved a second word, but the idea wasn't ever implemented.

-- Jamie

  parent reply	other threads:[~2010-03-26  1:52 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-25  0:24 [Qemu-devel] [PATCH 00/10, v3] target-alpha improvements Richard Henderson
2010-03-12 18:31 ` [Qemu-devel] [PATCH 01/10] target-alpha: Add flags markups to helpers.h Richard Henderson
2010-03-12 19:22 ` [Qemu-devel] [PATCH 02/10] target-alpha: Implement cpys{, n, e} inline Richard Henderson
2010-03-15 14:49 ` [Qemu-devel] [PATCH 03/10] target-alpha: Implement rs/rc properly Richard Henderson
2010-03-15 15:38 ` [Qemu-devel] [PATCH 05/10] target-alpha: Implement cvtlq inline Richard Henderson
2010-03-16 20:04 ` [Qemu-devel] [PATCH 06/10] target-alpha: Use setcond for int comparisons Richard Henderson
2010-03-16 21:44 ` [Qemu-devel] [PATCH 07/10] target-alpha: Use non-inverted arguments to gen_{f}cmov Richard Henderson
2010-03-16 22:10 ` [Qemu-devel] [PATCH 08/10] target-alpha: Emit goto_tb opcodes Richard Henderson
2010-03-19 22:55 ` [Qemu-devel] [PATCH 04/10] target-alpha: Implement cvtql inline Richard Henderson
2010-03-25  0:11 ` [Qemu-devel] [PATCH 09/10] target-alpha: Implement load-locked/store-conditional properly Richard Henderson
2010-03-25 13:39   ` Nathan Froyd
2010-03-25 15:46     ` Richard Henderson
2010-03-25 16:06       ` Nathan Froyd
2010-03-25 16:29         ` Richard Henderson
2010-03-25 16:42           ` Nathan Froyd
2010-03-25 16:50             ` Richard Henderson
2010-03-25 17:40       ` Blue Swirl
2010-03-25 18:19         ` Richard Henderson
2010-03-26  1:55           ` Jamie Lokier
2010-03-26  2:01       ` Jamie Lokier
2010-03-25  0:13 ` [Qemu-devel] [PATCH 10/10] target-alpha: Enable NPTL Richard Henderson
2010-03-26  1:52 ` Jamie Lokier [this message]
2010-03-26 13:37   ` [Qemu-devel] [PATCH 00/10, v3] target-alpha improvements Richard Henderson
2010-04-01 13:44   ` Paul Brook

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=20100326015252.GG19308@shareable.org \
    --to=jamie@shareable.org \
    --cc=aurelien@aurel32.net \
    --cc=qemu-devel@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 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).