From: Thomas Huth <thuth@redhat.com>
To: Luca Bonissi <qemu@bonslack.org>, Laurent Vivier <laurent@vivier.eu>
Cc: qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>,
Richard Henderson <richard.henderson@linaro.org>
Subject: Re: [PATCH] Wrong unpacked structure for epoll_event on qemu-or1k (openrisc user-space)
Date: Wed, 2 Aug 2023 21:55:37 +0200 [thread overview]
Message-ID: <f5fac2cd-04ee-f12d-fcf7-cd443016c957@redhat.com> (raw)
In-Reply-To: <38f8621c-98e7-53c4-ac1b-7ff4c569ed18@bonslack.org>
On 19/07/2023 14.38, Luca Bonissi wrote:
> On 19/07/23 10:49, Laurent Vivier wrote:
>>
>> According to linux/glibc sourced, epoll is only packed for x86_64.
>
> And, in recent glibc, also for i386, even it seems not necessary: even if
> the __alignof__(long long) is 8, structures like epoll_event are only 12
> bytes, maybe "packed" for historical reasons. Ancient i386 gcc[s] (<3.0.0)
> have 4 bytes for __alignof__(long long).
>
>> Perhaps the default alignment of long is not correctly defined in qemu for
>> openrisc?
>
> __alignof__(long long):
> - 8 bytes: all 64 bit targets + arm, hppa, mips, ppc, sparc, xtensa, x86
> - 4 bytes: microblaze, nios2, or1k, sh4
> - 2 bytes: m68k
> - 1 byte : cris
>
> offsetof(struct epoll_event,data):
> - 8: all 64 bit targets + arm, hppa, mips, ppc, sparc, xtensa
> - 4: cris, m68k, microblaze, nios2, or1k, sh4, x86
>
> So, epoll_event is "naturally" packed on the following targets (checked in
> linux-user container and/or with cross-compiler):
> - cris, m68k, microblaze, nios2, or1k, sh4, x86 (32bit)
>
>> See include/exec/user/abitypes.h to update the value.
>
> OK, abitypes.h should be updated with the following patch (discard the
> previous patch on syscall_defs.h):
>
> Signed-off-by: Luca Bonissi <qemu@bonslack.org>
> ---
>
> diff -up a/include/exec/user/abitypes.h b/include/exec/user/abitypes.h
> --- a/include/exec/user/abitypes.h 2023-03-27 15:41:42.511916232 +0200
> +++ b/include/exec/user/abitypes.h 2023-07-19 12:09:03.001687788 +0200
> @@ -15,7 +15,15 @@
> #define ABI_LLONG_ALIGNMENT 2
> #endif
>
> +#ifdef TARGET_CRIS
> +#define ABI_SHORT_ALIGNMENT 1
> +#define ABI_INT_ALIGNMENT 1
> +#define ABI_LONG_ALIGNMENT 1
> +#define ABI_LLONG_ALIGNMENT 1
> +#endif
> +
> -#if (defined(TARGET_I386) && !defined(TARGET_X86_64)) || defined(TARGET_SH4)
> +#if (defined(TARGET_I386) && !defined(TARGET_X86_64)) ||
> defined(TARGET_SH4) || \
> + defined(TARGET_OPENRISC) || defined(TARGET_NIOS2) ||
> defined(TARGET_MICROBLAZE)
> #define ABI_LLONG_ALIGNMENT 4
> #endif
Hi! Thanks for the patch - but could you please send this as a new patch
mail with a proper subject and patch description, so that it could be
applied with "git am" ? Thanks!
Thomas
next prev parent reply other threads:[~2023-08-02 19:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-18 13:03 Wrong unpacked structure for epoll_event on qemu-or1k (openrisc user-space) Luca Bonissi
2023-07-18 14:40 ` Peter Maydell
2023-07-18 15:06 ` [PATCH] " Luca Bonissi
2023-07-19 8:49 ` Laurent Vivier
2023-07-19 12:38 ` Luca Bonissi
2023-08-02 19:55 ` Thomas Huth [this message]
2023-08-02 20:03 ` Richard Henderson
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=f5fac2cd-04ee-f12d-fcf7-cd443016c957@redhat.com \
--to=thuth@redhat.com \
--cc=laurent@vivier.eu \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu@bonslack.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 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).