From: David Woodhouse <dwmw2@infradead.org>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Anthony Perard" <anthony.perard@citrix.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"qemu-block@nongnu.org" <qemu-block@nongnu.org>,
"Thomas Huth" <thuth@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"qemu-arm@nongnu.org" <qemu-arm@nongnu.org>,
"Paul Durrant" <paul@xen.org>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>
Subject: Re: [PATCH-for-9.0 04/10] hw/xen: Factor xen_arch_align_ioreq_data() out of handle_ioreq()
Date: Mon, 13 Nov 2023 12:11:11 -0500 [thread overview]
Message-ID: <e892e4eee469b1d1406dcd0844af48d1aaff23ae.camel@infradead.org> (raw)
In-Reply-To: <7a66c289-19e1-4690-8c6e-31a9f6344b6f@linaro.org>
[-- Attachment #1: Type: text/plain, Size: 3402 bytes --]
On Mon, 2023-11-13 at 17:09 +0100, Philippe Mathieu-Daudé wrote:
> On 13/11/23 16:58, Woodhouse, David wrote:
> > On 13 Nov 2023 10:22, Philippe Mathieu-Daudé <philmd@linaro.org>
> > wrote:
> >
> > Per commit f17068c1c7 ("xen-hvm: reorganize xen-hvm and move
> > common
> > function to xen-hvm-common"), handle_ioreq() is expected to be
> > target-agnostic. However it uses 'target_ulong', which is a
> > target
> > specific definition.
> >
> > In order to compile this file once for all targets, factor the
> > target-specific code out of handle_ioreq() as a per-target
> > handler
> > called xen_arch_align_ioreq_data().
> >
> > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> > ---
> > Should we have a 'unsigned qemu_target_long_bits();' helper
> > such qemu_target_page_foo() API and target_words_bigendian()?
> >
> >
> > It can be more fun than that though. What about
> > qemu_target_alignof_uint64() for example, which differs between
> > i386 and
> > x86_64 and causes even structs with *explicitly* sized fields to
> > differ
> > because of padding.
> >
> > I'd *love* to see this series as a step towards my fantasy of being
> > able
> > to support Xen under TCG. After all, without that what's the point
> > in
> > being target-agnostic?
>
> Another win is we are building all these files once instead of one
> for
> each i386/x86_64/aarch64 targets, so we save CI time and Amazon
> trees.
>
> > However, I am mildly concerned that some of these files are
> > accidentally
> > using the host ELF ABI, perhaps with explicit management of 32-bit
> > compatibility, and the target-agnosticity is purely an illusion?
> >
> > See the "protocol" handling and the three ABIs for the ring in
> > xen-block, for example.
>
> If so I'd expect build failures or violent runtime assertions.
Heh, mostly the guest just crashes in the cases I've seen so far.
See commit a1c1082908d ("hw/xen: use correct default protocol for xen-
block on x86").
> Reviewing quickly hw/block/dataplane/xen-block.c, this code doesn't
> seem target specific at all IMHO. Otherwise I'd really expect it to
> fail compiling. But I don't know much about Xen, so I'll let block &
> xen experts to have a look.
Where it checks dataplane->protocol and does different things for
BLKIF_PROTOCOL_NATIVE/BLKIF_PROTOCOL_X86_32/BLKIF_PROTOCOL_X86_64, the
*structures* it uses are intended to be using the correct ABI. I think
the structs for BLKIF_PROTOCOL_NATIVE may actually be *different*
according to the target, in theory?
I don't know that they are *correct* right now, if the host is
different from the target. But that's just a bug (that only matters if
we ever want to support Xen-compatible guests using TCG).
> > Can we be explicit about what's expected to work here and what's
> > not in scope?
>
> What do you mean? Everything is expected to work like without this
> series applied :)
I think that if we ever do support Xen-compatible guests using TCG,
we'll have to fix that bug and use the right target-specific
structures... and then perhaps we'll want the affected files to
actually become target-specfic again?
I think this series makes it look like target-agnostic support *should*
work... but it doesn't really?
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5965 bytes --]
next prev parent reply other threads:[~2023-11-13 17:12 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-13 15:58 [PATCH-for-9.0 04/10] hw/xen: Factor xen_arch_align_ioreq_data() out of handle_ioreq() Woodhouse, David
2023-11-13 16:09 ` Philippe Mathieu-Daudé
2023-11-13 17:11 ` David Woodhouse [this message]
2023-11-14 7:58 ` Philippe Mathieu-Daudé
2023-11-14 13:49 ` David Woodhouse
-- strict thread matches above, loose matches on Subject: below --
2023-11-13 15:21 [PATCH-for-9.0 00/10] hw/xen: Have most of Xen files become target-agnostic Philippe Mathieu-Daudé
2023-11-13 15:21 ` [PATCH-for-9.0 04/10] hw/xen: Factor xen_arch_align_ioreq_data() out of handle_ioreq() Philippe Mathieu-Daudé
2023-11-13 17:36 ` David Woodhouse
2023-11-13 18:16 ` Richard Henderson
2023-11-14 7:42 ` Philippe Mathieu-Daudé
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=e892e4eee469b1d1406dcd0844af48d1aaff23ae.camel@infradead.org \
--to=dwmw2@infradead.org \
--cc=alex.bennee@linaro.org \
--cc=anthony.perard@citrix.com \
--cc=eduardo@habkost.net \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=paul@xen.org \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=sstabellini@kernel.org \
--cc=thuth@redhat.com \
--cc=xen-devel@lists.xenproject.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 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).