Re: [PATCH v2] virtio: Add aligned ld/st accessors for vring

Richard Henderson <[email protected]>
Newsgroups org.nongnu.qemu-devel,org.nongnu.qemu-riscv
Message-ID <[email protected]>
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.

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~
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.