From: "H. Peter Anvin" <hpa@zytor.com>
To: Borislav Petkov <bp@alien8.de>
Cc: X86 ML <x86@kernel.org>, LKML <linux-kernel@vger.kernel.org>,
Borislav Petkov <bp@suse.de>
Subject: Re: [RFC PATCH 1/4] x86, cpu: Expand cpufeature facility to include cpu bugs
Date: Wed, 13 Feb 2013 15:23:42 -0800 [thread overview]
Message-ID: <511C207E.9030008@zytor.com> (raw)
In-Reply-To: <1360581521-4712-2-git-send-email-bp@alien8.de>
On 02/11/2013 03:18 AM, Borislav Petkov wrote:
>
> +#define __BUG_CHECK_BIT(bit) \
> +({ \
> + WARN_ON(bit >> 5 < NCAPINTS); \
> + bit; \
> +})
> +
Do we need this? Either way, if we do, I would suggest doing something
like:
if (__builtin_constant_p(bit))
bad_bug_number();
... and flag bad_bug_number as a compile time error, since the vast
majority of the time the bit number will be constant.
However, I don't think it is necessary. In order for this to ever
trigger someone must have known they were testing for a bug, and yet not
used the X86_BUG_ macros, which seems very unlikely.
> #define X86_BUG_F00F (NCAPINTS*32+ 0) /* Intel F00F bug */
> #define X86_BUG_FDIV (NCAPINTS*32+ 1) /* FPU FDIV bug */
> +#define X86_BUG_COMA (NCAPINTS*32+ 2) /* Cyrix 6x86 coma */
Just to make it a bit cleaner once we have more than one word of bug
tests, I would suggest macroizing this:
#define X86_BUG(x) (NCAPINTS*32 + (x))
... and then just ...
#define X86_BUG_F00F X86_BUG(0)
#define X86_BUG_FDIV X86_BUG(1)
... and so on.
The only reason we *don't* do that with the features is that they tend
to come chunkwise in the form of CPUID words.
-hpa
next prev parent reply other threads:[~2013-02-13 23:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-11 11:18 [RFC PATCH 0/4] x86, cpu: Expand ->x86_capability flags with bugs bitvector Borislav Petkov
2013-02-11 11:18 ` [RFC PATCH 1/4] x86, cpu: Expand cpufeature facility to include cpu bugs Borislav Petkov
2013-02-13 23:23 ` H. Peter Anvin [this message]
2013-02-11 11:18 ` [RFC PATCH 2/4] x86, cpu: Convert F00F bug detection Borislav Petkov
2013-02-11 11:18 ` [RFC PATCH 3/4] x86, cpu: Convert FDIV " Borislav Petkov
2013-02-11 11:18 ` [RFC PATCH 4/4] x86, cpu: Convert Cyrix coma " Borislav Petkov
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=511C207E.9030008@zytor.com \
--to=hpa@zytor.com \
--cc=bp@alien8.de \
--cc=bp@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=x86@kernel.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