All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Huang Ying <ying.huang@intel.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org
Subject: Re: [RFC 6/7] x86: Move kernel_fpu_using to asm/i387.h
Date: Wed, 17 Jun 2009 10:06:44 -0700	[thread overview]
Message-ID: <4A3922A4.1080300@zytor.com> (raw)
In-Reply-To: <20090617164622.GB25357@elte.hu>

Ingo Molnar wrote:
>>  
>> +static inline int kernel_fpu_using(void)
>> +{
>> +	if (in_interrupt() && !(read_cr0() & X86_CR0_TS))
>> +		return 1;
>> +	return 0;
>> +}
>> +
> 
> Looks sane to me. Herbert, do you ack it?
> 

Although I have to say, the structure of:

if (boolean test)
	return 1;
return 0;

... truly was hit with the ugly stick.  It really should be:

static inline bool kernel_fpu_using(void)
{
	return in_interrupt() && !(read_cr0() && C86_CR0_TS);
}

Huang: if I recall correctly, these functions were originally designed
to deal with the fact that VIA processors generate spurious #TS faults
due to broken design of the Padlock instructions.  The AES and PCLMUL
instructions actually use SSE registers and so will require different
structure.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


  reply	other threads:[~2009-06-17 17:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-11  7:10 [RFC 6/7] x86: Move kernel_fpu_using to asm/i387.h Huang Ying
2009-06-11  7:10 ` Huang Ying
2009-06-17 16:46 ` Ingo Molnar
2009-06-17 17:06   ` H. Peter Anvin [this message]
2009-06-18  1:48     ` Herbert Xu
2009-06-18  3:51       ` H. Peter Anvin
2009-06-18  1:57     ` Huang Ying
2009-06-18  3:52       ` H. Peter Anvin

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=4A3922A4.1080300@zytor.com \
    --to=hpa@zytor.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=ying.huang@intel.com \
    /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.