From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/3] memory_ldst: Add atomic ops for PTE updates
Date: Fri, 14 Dec 2018 14:54:38 +1100 [thread overview]
Message-ID: <cf77c9e71a0ae5d3dd4ed163c60785ceffb05ffd.camel@kernel.crashing.org> (raw)
In-Reply-To: <0ad68048-8f16-930f-2e87-ca90d8038bd0@linaro.org>
On Thu, 2018-12-13 at 21:01 -0600, Richard Henderson wrote:
> On 12/13/18 5:58 PM, Benjamin Herrenschmidt wrote:
> > +#ifdef CONFIG_ATOMIC64
> > +/* This is meant to be used for atomic PTE updates under MT-TCG */
> > +uint32_t glue(address_space_cmpxchgq_notdirty, SUFFIX)(ARG1_DECL,
> > + hwaddr addr, uint64_t old, uint64_t new, MemTxAttrs attrs, MemTxResult *result)
> > +{
> > + uint8_t *ptr;
> > + MemoryRegion *mr;
> > + hwaddr l = 8;
> > + hwaddr addr1;
> > + MemTxResult r;
> > + uint8_t dirty_log_mask;
> > +
> > + /* Must test result */
> > + assert(result);
> > +
> > + RCU_READ_LOCK();
> > + mr = TRANSLATE(addr, &addr1, &l, true, attrs);
> > + if (l < 8 || !memory_access_is_direct(mr, true)) {
> > + r = MEMTX_ERROR;
> > + } else {
> > + uint32_t orig = old;
> > +
> > + ptr = qemu_map_ram_ptr(mr->ram_block, addr1);
> > + old = atomic_cmpxchg(ptr, orig, new);
> > +
>
> I think you need atomic_cmpxchg__nocheck here.
>
> Failure would be with a 32-bit host that supports ATOMIC64.
> E.g. i686.
I'm confused by this and the comments around the definition of
ATOMIC_REG_SIZE :)
So would we have CONFIG_ATOMIC64 in that case and if yes why if all the
atomic_* end up barfing ?
Or rather, why set CONFIG_ATOMIC64 if we ought not to use 64-bit
atomics ?
Also we should probably define ATOMIC_REG_SIZE to 8 for ppc64...
Cheers
Ben.
>
> r~
prev parent reply other threads:[~2018-12-14 3:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-13 23:58 [Qemu-devel] [PATCH 1/3] memory_ldst: Add atomic ops for PTE updates Benjamin Herrenschmidt
2018-12-13 23:58 ` [Qemu-devel] [PATCH 2/3] i386: Atomically update PTEs with mttcg Benjamin Herrenschmidt
2018-12-14 0:05 ` Benjamin Herrenschmidt
2018-12-14 11:11 ` [Qemu-riscv] " Philippe Mathieu-Daudé
2018-12-14 11:11 ` Philippe Mathieu-Daudé
2018-12-13 23:58 ` [Qemu-devel] [PATCH 3/3] ppc: Fix radix RC updates Benjamin Herrenschmidt
2018-12-14 0:03 ` Benjamin Herrenschmidt
2018-12-14 3:01 ` [Qemu-devel] [PATCH 1/3] memory_ldst: Add atomic ops for PTE updates Richard Henderson
2018-12-14 3:54 ` Benjamin Herrenschmidt [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=cf77c9e71a0ae5d3dd4ed163c60785ceffb05ffd.camel@kernel.crashing.org \
--to=benh@kernel.crashing.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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.