From: Andrew Morton <akpm@linux-foundation.org>
To: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [patch 8/9] F00F bug fixup for i386 - use conditional calls
Date: Wed, 30 May 2007 13:33:59 -0700 [thread overview]
Message-ID: <20070530133359.5a553e0c.akpm@linux-foundation.org> (raw)
In-Reply-To: <20070530140229.491376274@polymtl.ca>
On Wed, 30 May 2007 10:00:33 -0400
Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> wrote:
> Use the faster conditional calls for F00F bug handling in do_page_fault.
>
I guess this means that CONDCALL will be enabled on pretty much all i386,
in which case making the whole feature Kconfigurable is starting to look
marginal.
Perhaps a better approach would have to made this change dependent upon
CONDCALL, rather than forcing it on.
> @@ -1084,6 +1085,7 @@
> */
> idt_descr.address = fix_to_virt(FIX_F00F_IDT);
> load_idt(&idt_descr);
> + BUG_ON(cond_call_arm("fix_f00f"));
It is generally poor C style to do
assert(something_which_has_side_effects())
because people can legitimately expect to do
#define assert() /*nothing*/
for production code.
The kernel doesn't actually do the right thing here when CONFIG_BUG=n,
sadly. But still, children might be watching, so the better and preferred
style is
if (cond_call_arm("fix_f00f"))
BUG();
> }
> #endif
>
> Index: linux-2.6-lttng/arch/i386/mm/fault.c
> ===================================================================
> --- linux-2.6-lttng.orig/arch/i386/mm/fault.c 2007-05-29 11:05:48.000000000 -0400
> +++ linux-2.6-lttng/arch/i386/mm/fault.c 2007-05-29 11:13:16.000000000 -0400
> @@ -25,6 +25,7 @@
> #include <linux/kprobes.h>
> #include <linux/uaccess.h>
> #include <linux/kdebug.h>
> +#include <linux/condcall.h>
>
> #include <asm/system.h>
> #include <asm/desc.h>
> @@ -221,6 +222,25 @@
>
> fastcall void do_invalid_op(struct pt_regs *, unsigned long);
>
> +#ifdef CONFIG_X86_F00F_BUG
> +/*
> + * Pentium F0 0F C7 C8 bug workaround.
> + */
> +static inline int do_f00f_workaround(struct pt_regs *regs,
> + unsigned long address)
> +{
> + unsigned long nr;
> +
> + nr = (address - idt_descr.address) >> 3;
> +
> + if (nr == 6) {
> + do_invalid_op(regs, 0);
> + return 1;
> + }
> + return 0;
> +}
> +#endif
> +
> static inline pmd_t *vmalloc_sync_one(pgd_t *pgd, unsigned long address)
> {
> unsigned index = pgd_index(address);
> @@ -474,19 +494,8 @@
> }
>
> #ifdef CONFIG_X86_F00F_BUG
> - /*
> - * Pentium F0 0F C7 C8 bug workaround.
> - */
> - if (boot_cpu_data.f00f_bug) {
> - unsigned long nr;
> -
> - nr = (address - idt_descr.address) >> 3;
> -
> - if (nr == 6) {
> - do_invalid_op(regs, 0);
> - return;
> - }
> - }
> + if (cond_call(fix_f00f, do_f00f_workaround(regs, address)))
> + return;
We do a cond_call() to an inlined function? That's a bit weird, isn't it?
> #endif
>
> no_context:
> Index: linux-2.6-lttng/arch/i386/Kconfig.cpu
> ===================================================================
> --- linux-2.6-lttng.orig/arch/i386/Kconfig.cpu 2007-05-29 11:51:46.000000000 -0400
> +++ linux-2.6-lttng/arch/i386/Kconfig.cpu 2007-05-29 11:52:08.000000000 -0400
> @@ -275,6 +275,7 @@
> config X86_F00F_BUG
> bool
> depends on M586MMX || M586TSC || M586 || M486 || M386
> + select COND_CALL
That hurts.
next prev parent reply other threads:[~2007-05-30 20:35 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-30 14:00 [patch 0/9] Conditional Calls - for 2.6.22-rc2-mm1 Mathieu Desnoyers
2007-05-30 14:00 ` [patch 1/9] Conditional Calls - Architecture Independent Code Mathieu Desnoyers
2007-05-30 20:32 ` Andrew Morton
2007-05-31 16:34 ` Mathieu Desnoyers
2007-05-31 13:47 ` Andi Kleen
2007-06-05 18:40 ` Mathieu Desnoyers
2007-06-04 19:01 ` Adrian Bunk
2007-06-13 15:57 ` Mathieu Desnoyers
2007-06-13 21:51 ` Adrian Bunk
2007-06-14 16:02 ` Mathieu Desnoyers
2007-06-14 21:06 ` Adrian Bunk
2007-06-20 21:59 ` Mathieu Desnoyers
2007-06-21 13:00 ` Adrian Bunk
2007-06-21 13:55 ` Mathieu Desnoyers
2007-05-30 14:00 ` [patch 2/9] Conditional Calls - Hash Table Mathieu Desnoyers
2007-05-30 20:32 ` Andrew Morton
2007-05-31 13:42 ` Andi Kleen
2007-06-01 16:08 ` Matt Mackall
2007-06-01 16:46 ` Mathieu Desnoyers
2007-06-01 17:07 ` Matt Mackall
2007-06-01 17:45 ` Andi Kleen
2007-06-01 18:06 ` Mathieu Desnoyers
2007-06-01 18:49 ` Matt Mackall
2007-06-01 19:35 ` Andi Kleen
2007-06-01 20:33 ` Mathieu Desnoyers
2007-06-01 20:44 ` Andi Kleen
2007-06-04 22:26 ` Mathieu Desnoyers
2007-06-01 18:03 ` Mathieu Desnoyers
2007-05-30 14:00 ` [patch 3/9] Conditional Calls - Non Optimized Architectures Mathieu Desnoyers
2007-05-30 14:00 ` [patch 4/9] Conditional Calls - Add kconfig menus Mathieu Desnoyers
2007-05-30 14:00 ` [patch 5/9] Conditional Calls - i386 Optimization Mathieu Desnoyers
2007-05-30 20:33 ` Andrew Morton
2007-05-31 13:54 ` Andi Kleen
2007-06-05 19:02 ` Mathieu Desnoyers
2007-05-30 14:00 ` [patch 6/9] Conditional Calls - PowerPC Optimization Mathieu Desnoyers
2007-05-30 14:00 ` [patch 7/9] Conditional Calls - Documentation Mathieu Desnoyers
2007-05-30 14:00 ` [patch 8/9] F00F bug fixup for i386 - use conditional calls Mathieu Desnoyers
2007-05-30 20:33 ` Andrew Morton [this message]
2007-05-31 21:07 ` Mathieu Desnoyers
2007-05-31 21:21 ` Andrew Morton
2007-05-31 21:38 ` Mathieu Desnoyers
2007-05-30 14:00 ` [patch 9/9] Scheduler profiling - Use " Mathieu Desnoyers
2007-05-30 20:34 ` Andrew Morton
2007-06-01 15:54 ` Mathieu Desnoyers
2007-06-01 16:19 ` Andrew Morton
2007-06-01 16:33 ` Mathieu Desnoyers
2007-05-30 20:59 ` William Lee Irwin III
2007-05-31 21:12 ` Mathieu Desnoyers
2007-05-31 23:41 ` William Lee Irwin III
2007-06-04 22:20 ` Mathieu Desnoyers
2007-05-30 21:44 ` Matt Mackall
2007-05-31 21:36 ` Mathieu Desnoyers
2007-05-31 13:39 ` Andi Kleen
2007-05-31 22:07 ` Mathieu Desnoyers
2007-05-31 22:33 ` Andi Kleen
2007-06-04 22:20 ` Mathieu Desnoyers
-- strict thread matches above, loose matches on Subject: below --
2007-06-01 0:14 [patch 8/9] F00F bug fixup for i386 - use " Mikael Pettersson
2007-06-01 0:43 ` Andrew Morton
2007-06-01 1:13 ` Mathieu Desnoyers
2007-05-29 18:33 [patch 0/9] Conditional Calls Mathieu Desnoyers
2007-05-29 18:34 ` [patch 8/9] F00F bug fixup for i386 - use conditional calls Mathieu Desnoyers
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=20070530133359.5a553e0c.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@polymtl.ca \
/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
Powered by JetHome