From: "H. Peter Anvin" <hpa@zytor.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: mingo@redhat.com, linux-kernel@vger.kernel.org,
tglx@linutronix.de, linux-tip-commits@vger.kernel.org
Subject: Re: [tip:x86/fpu] x86-64, asm: Use fxsaveq/fxrestorq in more places
Date: Fri, 22 Oct 2010 20:39:55 -0700 [thread overview]
Message-ID: <4CC2590B.5080109@zytor.com> (raw)
In-Reply-To: <AANLkTi=KRVMrNh6MyDh5v-ZGB18iEKkqsW+6Eqp27M5X@mail.gmail.com>
On 10/22/2010 07:11 PM, Linus Torvalds wrote:
> On Fri, Oct 22, 2010 at 6:20 PM, tip-bot for H. Peter Anvin
> <hpa@zytor.com> wrote:
>>
>> Checkin d7acb92fea932ad2e7846480aeacddc2c03c8485 made use of fxsaveq
>> in fpu_fxsave() if the assembler supports it; this adds
>> fxsaveq/fxrstorq to fxrstor_checking() and fxsave_user() as well.
>
> Hmm. I really think you should be able to do something like this
>
> #ifdef CONFIG_AS_FXSAVEQ
> #define FXSAVEQ_INSN "fxsaveq %[fx]"
> #define FXRSTORQ_INSN "fxrstorq %[fx]"
> #define FX_EXTRA(ptr)
> #else
> #define FXSAVEQ_INSN "rex64/fxsave (%[fxr])"
> #define FXRSTORQ_INSN "rex64/fxrstor (%[fxr])"
> #define FX_EXTRA(ptr) [fxr] "R" (ptr)
> #endif
>
> and then you should be able to write the actual code something like
>
> asm volatile(FXSAVEQ_INSN
> :[fx] "=m" (memory)
> :FX_EXTRA(&memory))
>
> and
>
> #define __COMMA_CONCAT(x) ,##x
> #define COMMA_CONCAT(x) __COMMA_CONCAT(x)
> asm volatile(FXRSTRORQ_INSN
> : :[fx] "m" (memory) COMMA_CONCAT(FX_EXTRA(&memory)));
>
> or something like that (obviously you'll need the exception stuff too there).
>
> With no #ifdef's in the actual code. Hmm?
>
Well sure, but it is already encapsulated in 3 inlines. To me, the
above is quite frankly quite a bit harder to read than the broken-out form.
-hpa
--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.
prev parent reply other threads:[~2010-10-23 3:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-21 13:45 [GIT PULL] x86/fpu for v2.6.37 Ingo Molnar
2010-10-21 20:45 ` Linus Torvalds
2010-10-21 21:24 ` H. Peter Anvin
2010-10-23 1:20 ` [tip:x86/fpu] x86-64, asm: Use fxsaveq/fxrestorq in more places tip-bot for H. Peter Anvin
2010-10-23 2:11 ` Linus Torvalds
2010-10-23 3:39 ` H. Peter Anvin [this message]
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=4CC2590B.5080109@zytor.com \
--to=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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.