From: "BillXiang" <xiangwencheng@lanxincomputing.com>
To: "Richard Henderson" <richard.henderson@linaro.org>,
"Peter Maydell" <peter.maydell@linaro.org>
Cc: <mst@redhat.com>, <pbonzini@redhat.com>, <peterx@redhat.com>,
<philmd@mailo.com>, <qemu-devel@nongnu.org>,
<qemu-riscv@nongnu.org>
Subject: Re: [PATCH v2] virtio: Add aligned ld/st accessors for vring
Date: Mon, 24 Aug 2026 12:19:15 +0800 [thread overview]
Message-ID: <02da9676-febf-4389-b09b-5e5d41c1084e@lanxincomputing.com> (raw)
In-Reply-To: <bad5c8b3-668f-4893-974f-9dbca8dc6893@linaro.org>
On 8/22/2026 1:32 AM, Richard Henderson wrote:
> On 8/21/26 03:25, Peter Maydell wrote:
>> I'm tempted to suggest some kind of "if pointer is aligned take
>> aligned path, otherwise take slow path" either here or actually
>> in lduw_le_p(), but maybe that's a bad idea. Richard ?
>>
>> (I have a suspicion that other places than this one will assume
>> that an aligned ldl_he_p() is not going to tear.)
> I agree -- I expect most everything assumes ldl_he_p won't tear for
> aligned accesses.
Hi Peter, I noticed that in your commit [1], you have pointed out that
ld*_he_p() and st*_he_p() is not atomic especially for vring_avail_idx.
This suggests it’s time to finally implement the atomic functions. And
I think we should provide explicit atomic operations, similar to those
in CPU instruction sets, rather than a single all‑purpose function
cluttered with conditional branches — and it should be the caller’s
responsibility to decide whether to use them.
>
> This kinda begs the question of what atomicity the caller expects. It's
> not implausible that an x86 path expects even unaligned accesses not
> crossing a cacheline to be atomic, since that's been a thing since
> 1995. I expect both IBM architectures similarly expect atomicity by
> alignment, since that's been a thing for s390 since yonks and Power has
> the same language.
>
> We have a bunch of code in accel/tcg/ldst_atomicity.c.inc that can
> handle this, we'd just need to provide it with the correct inputs. And
> I assume we'd still like to inline the single access on appropriate hosts.
>
>
> r~
Hi Richard, I've read your code in accel/tcg/ldst_atomicity.c.inc. Do
you think it would be better to make the load/store_atomic* public?
--
Bill Xiang
[1]
https://lore.kernel.org/qemu-devel/1554826986-37164-4-git-send-email-pbonzini@redhat.com/#r
next prev parent reply other threads:[~2026-08-24 4:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 10:08 [PATCH v2] virtio: Add aligned ld/st accessors for vring BillXiang
2026-08-21 10:25 ` Peter Maydell
2026-08-21 17:32 ` Richard Henderson
2026-08-24 4:19 ` BillXiang [this message]
2026-08-24 15:23 ` Peter Xu
2026-09-01 2:44 ` BillXiang
2026-09-04 13:34 ` Peter Xu
2026-09-07 10:11 ` BillXiang
2026-09-07 10:29 ` Peter Maydell
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=02da9676-febf-4389-b09b-5e5d41c1084e@lanxincomputing.com \
--to=xiangwencheng@lanxincomputing.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=peterx@redhat.com \
--cc=philmd@mailo.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@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.