From: "Alejandro Vallejo" <alejandro.vallejo@cloud.com>
To: "Jan Beulich" <jbeulich@suse.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
"Roger Pau Monné" <roger.pau@citrix.com>
Subject: Re: [PATCH] x86/FPU: make vcpu_reset_fpu() build again with old gcc
Date: Tue, 10 Dec 2024 14:25:29 +0000 [thread overview]
Message-ID: <D6838QWBS1OG.37M94XNPN17P7@cloud.com> (raw)
In-Reply-To: <da8320f7-1baf-41f5-b7ac-c05b6371e1e4@suse.com>
On Mon Dec 9, 2024 at 3:13 PM GMT, Jan Beulich wrote:
> Fields of anonymous structs/unions may not be part of an initializer for
> rather old gcc.
Can you add the specific version for tracking purposes?
>
> Fixes: 49a068471d77 ("x86/fpu: Rework fpu_setup_fpu() uses to split it in two")
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
> --- a/xen/arch/x86/i387.c
> +++ b/xen/arch/x86/i387.c
> @@ -306,13 +306,13 @@ void vcpu_reset_fpu(struct vcpu *v)
> {
> v->fpu_initialised = false;
> *v->arch.xsave_area = (struct xsave_struct) {
> - .fpu_sse = {
> - .mxcsr = MXCSR_DEFAULT,
> - .fcw = FCW_RESET,
> - .ftw = FXSAVE_FTW_RESET,
> - },
> .xsave_hdr.xstate_bv = X86_XCR0_X87,
> };
> +
> + /* Old gcc doesn't permit these to be part of the initializer. */
> + v->arch.xsave_area->fpu_sse.mxcsr = MXCSR_DEFAULT;
> + v->arch.xsave_area->fpu_sse.fcw = FCW_RESET;
> + v->arch.xsave_area->fpu_sse.ftw = FXSAVE_FTW_RESET;
That's not quite the same though. A more apt equivalence would be to memset the
area to zero ahead of the assignments. Otherwise rubble will be left behind.
> }
>
> void vcpu_setup_fpu(struct vcpu *v, const void *data)
Out of context and not triggering the GCC bug, but vcpu_setup_fpu() should
probably share the same initialization style as vcpu_reset_fpu(), imo.
Cheers,
Alejandro
next prev parent reply other threads:[~2024-12-10 14:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-09 15:13 [PATCH] x86/FPU: make vcpu_reset_fpu() build again with old gcc Jan Beulich
2024-12-10 14:25 ` Alejandro Vallejo [this message]
2024-12-10 14:34 ` Jan Beulich
2024-12-10 15:12 ` Alejandro Vallejo
2024-12-10 16:14 ` Jan Beulich
2024-12-10 16:58 ` Alejandro Vallejo
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=D6838QWBS1OG.37M94XNPN17P7@cloud.com \
--to=alejandro.vallejo@cloud.com \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=roger.pau@citrix.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 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.