[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <517E9405.8030509@zytor.com>
Date: Mon, 29 Apr 2013 08:38:45 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: Borislav Petkov <bp@...en8.de>
CC: X86 ML <x86@...nel.org>, LKML <linux-kernel@...r.kernel.org>,
Borislav Petkov <bp@...e.de>
Subject: Re: [PATCH 2/3] x86: Sanity-check static_cpu_has usage
On 04/29/2013 07:04 AM, Borislav Petkov wrote:
> From: Borislav Petkov <bp@...e.de>
>
> static_cpu_has may be used only after alternatives have run. Before that
> it always returns false if constant folding with __builtin_constant_p()
> doesn't happen. And you don't want that.
>
> This patch is the result of me debugging an issue where I overzealously
> put static_cpu_has in code which executed before alternatives have run
> and had to spend some time with scratching head and cursing at the
> monitor.
>
> So add a jump to a warning which screams loudly when we use this
> function too early. The alternatives patch that check away in
> conjunction with patching the rest of the kernel image.
>
> This first JMP the compiler then issues should always be a two-byte JMP
> because its relative offset fits in a byte. This gets replaced by only a
> two-byte NOP => less instruction cache bloat.
>
I still would prefer this to be an option.
-hpa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists