Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1371265 > unrolled thread
| Started by | Borislav Petkov <bp@alien8.de> |
|---|---|
| First post | 2016-04-05 08:40 +0200 |
| Last post | 2016-04-13 13:50 +0200 |
| Articles | 13 — 4 participants |
Back to article view | Back to linux.kernel
[PATCH 0/6] x86: Misc cleanups Borislav Petkov <bp@alien8.de> - 2016-04-05 08:40 +0200
[PATCH 4/6] x86/tsc: Save an indentation level in recalibrate_cpu_khz() Borislav Petkov <bp@alien8.de> - 2016-04-05 08:40 +0200
Re: [PATCH 4/6] x86/tsc: Save an indentation level in recalibrate_cpu_khz() Peter Zijlstra <peterz@infradead.org> - 2016-04-05 10:10 +0200
[tip:x86/asm] x86/tsc: Save an indentation level in recalibrate_cpu_khz() tip-bot for Borislav Petkov <tipbot@zytor.com> - 2016-04-13 13:50 +0200
[PATCH 3/6] x86/tsc: Do not check X86_FEATURE_CONSTANT_TSC in notifier call Borislav Petkov <bp@alien8.de> - 2016-04-05 08:40 +0200
Re: [PATCH 3/6] x86/tsc: Do not check X86_FEATURE_CONSTANT_TSC in notifier call Peter Zijlstra <peterz@infradead.org> - 2016-04-05 10:10 +0200
[tip:x86/asm] x86/tsc: Do not check X86_FEATURE_CONSTANT_TSC in notifier call tip-bot for Borislav Petkov <tipbot@zytor.com> - 2016-04-13 13:50 +0200
[PATCH 1/6] x86/fpu/regset: Use boot_cpu_has() Borislav Petkov <bp@alien8.de> - 2016-04-05 08:40 +0200
Re: [PATCH 1/6] x86/fpu/regset: Use boot_cpu_has() Brian Gerst <brgerst@gmail.com> - 2016-04-05 16:00 +0200
Re: [PATCH 1/6] x86/fpu/regset: Use boot_cpu_has() Borislav Petkov <bp@alien8.de> - 2016-04-05 17:20 +0200
[tip:x86/asm] x86/fpu/regset: Replace static_cpu_has() usage with boot_cpu_has() tip-bot for Borislav Petkov <tipbot@zytor.com> - 2016-04-13 13:50 +0200
[PATCH 5/6] x86/fpu: Remove check_fpu() indirection Borislav Petkov <bp@alien8.de> - 2016-04-05 08:40 +0200
[tip:x86/asm] x86/fpu: Remove check_fpu() indirection tip-bot for Borislav Petkov <tipbot@zytor.com> - 2016-04-13 13:50 +0200
| From | Borislav Petkov <bp@alien8.de> |
|---|---|
| Date | 2016-04-05 08:40 +0200 |
| Subject | [PATCH 0/6] x86: Misc cleanups |
| Message-ID | <rksOC-7th-13@gated-at.bofh.it> |
From: Borislav Petkov <bp@suse.de> Hi, here a bunch of minor cleanups ontop of the cpu_has_YYY removal pile. Borislav Petkov (6): x86/fpu/regset: Use boot_cpu_has() x86/cpu: Simplify extended APIC ID detection on AMD x86/tsc: Do not check X86_FEATURE_CONSTANT_TSC in notifier call x86/tsc: Save an indentation level in recalibrate_cpu_khz() x86/fpu: Remove check_fpu() indirection x86/fpu: Get rid of x87 math exception helpers arch/x86/kernel/cpu/amd.c | 17 ++++++++++------- arch/x86/kernel/fpu/bugs.c | 16 +++++----------- arch/x86/kernel/fpu/core.c | 44 +++++++++++++------------------------------- arch/x86/kernel/fpu/regset.c | 4 ++-- arch/x86/kernel/tsc.c | 23 ++++++++++------------- 5 files changed, 40 insertions(+), 64 deletions(-) -- 2.7.3
[toc] | [next] | [standalone]
| From | Borislav Petkov <bp@alien8.de> |
|---|---|
| Date | 2016-04-05 08:40 +0200 |
| Subject | [PATCH 4/6] x86/tsc: Save an indentation level in recalibrate_cpu_khz() |
| Message-ID | <rksOD-7th-29@gated-at.bofh.it> |
| In reply to | #1371265 |
From: Borislav Petkov <bp@suse.de>
... by flipping the check.
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
---
arch/x86/kernel/tsc.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 5bb702c77e8f..38ba6de56ede 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -834,15 +834,15 @@ int recalibrate_cpu_khz(void)
#ifndef CONFIG_SMP
unsigned long cpu_khz_old = cpu_khz;
- if (boot_cpu_has(X86_FEATURE_TSC)) {
- tsc_khz = x86_platform.calibrate_tsc();
- cpu_khz = tsc_khz;
- cpu_data(0).loops_per_jiffy =
- cpufreq_scale(cpu_data(0).loops_per_jiffy,
- cpu_khz_old, cpu_khz);
- return 0;
- } else
+ if (!boot_cpu_has(X86_FEATURE_TSC))
return -ENODEV;
+
+ tsc_khz = x86_platform.calibrate_tsc();
+ cpu_khz = tsc_khz;
+ cpu_data(0).loops_per_jiffy = cpufreq_scale(cpu_data(0).loops_per_jiffy,
+ cpu_khz_old, cpu_khz);
+
+ return 0;
#else
return -ENODEV;
#endif
--
2.7.3
[toc] | [prev] | [next] | [standalone]
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2016-04-05 10:10 +0200 |
| Subject | Re: [PATCH 4/6] x86/tsc: Save an indentation level in recalibrate_cpu_khz() |
| Message-ID | <rkudI-9L-13@gated-at.bofh.it> |
| In reply to | #1371267 |
On Tue, Apr 05, 2016 at 08:29:53AM +0200, Borislav Petkov wrote: > From: Borislav Petkov <bp@suse.de> > > ... by flipping the check. > > Signed-off-by: Borislav Petkov <bp@suse.de> > Cc: Thomas Gleixner <tglx@linutronix.de> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Borislav Petkov <tipbot@zytor.com> |
|---|---|
| Date | 2016-04-13 13:50 +0200 |
| Subject | [tip:x86/asm] x86/tsc: Save an indentation level in recalibrate_cpu_khz() |
| Message-ID | <rnrt0-BH-17@gated-at.bofh.it> |
| In reply to | #1371267 |
Commit-ID: eff4677e9fb9b680d1d5f6ba079116548d072b7e
Gitweb: http://git.kernel.org/tip/eff4677e9fb9b680d1d5f6ba079116548d072b7e
Author: Borislav Petkov <bp@suse.de>
AuthorDate: Tue, 5 Apr 2016 08:29:53 +0200
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 13 Apr 2016 11:37:43 +0200
x86/tsc: Save an indentation level in recalibrate_cpu_khz()
... by flipping the check.
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1459837795-2588-5-git-send-email-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/kernel/tsc.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 5bb702c..38ba6de 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -834,15 +834,15 @@ int recalibrate_cpu_khz(void)
#ifndef CONFIG_SMP
unsigned long cpu_khz_old = cpu_khz;
- if (boot_cpu_has(X86_FEATURE_TSC)) {
- tsc_khz = x86_platform.calibrate_tsc();
- cpu_khz = tsc_khz;
- cpu_data(0).loops_per_jiffy =
- cpufreq_scale(cpu_data(0).loops_per_jiffy,
- cpu_khz_old, cpu_khz);
- return 0;
- } else
+ if (!boot_cpu_has(X86_FEATURE_TSC))
return -ENODEV;
+
+ tsc_khz = x86_platform.calibrate_tsc();
+ cpu_khz = tsc_khz;
+ cpu_data(0).loops_per_jiffy = cpufreq_scale(cpu_data(0).loops_per_jiffy,
+ cpu_khz_old, cpu_khz);
+
+ return 0;
#else
return -ENODEV;
#endif
[toc] | [prev] | [next] | [standalone]
| From | Borislav Petkov <bp@alien8.de> |
|---|---|
| Date | 2016-04-05 08:40 +0200 |
| Subject | [PATCH 3/6] x86/tsc: Do not check X86_FEATURE_CONSTANT_TSC in notifier call |
| Message-ID | <rksOD-7th-31@gated-at.bofh.it> |
| In reply to | #1371265 |
From: Borislav Petkov <bp@suse.de>
... because the notifier-registering routine already does that. Also,
rename cpufreq_tsc() init call to something more telling.
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
---
arch/x86/kernel/tsc.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index a0346bc51833..5bb702c77e8f 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -922,9 +922,6 @@ static int time_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
struct cpufreq_freqs *freq = data;
unsigned long *lpj;
- if (cpu_has(&cpu_data(freq->cpu), X86_FEATURE_CONSTANT_TSC))
- return 0;
-
lpj = &boot_cpu_data.loops_per_jiffy;
#ifdef CONFIG_SMP
if (!(freq->flags & CPUFREQ_CONST_LOOPS))
@@ -954,7 +951,7 @@ static struct notifier_block time_cpufreq_notifier_block = {
.notifier_call = time_cpufreq_notifier
};
-static int __init cpufreq_tsc(void)
+static int __init cpufreq_register_tsc_scaling(void)
{
if (!boot_cpu_has(X86_FEATURE_TSC))
return 0;
@@ -965,7 +962,7 @@ static int __init cpufreq_tsc(void)
return 0;
}
-core_initcall(cpufreq_tsc);
+core_initcall(cpufreq_register_tsc_scaling);
#endif /* CONFIG_CPU_FREQ */
--
2.7.3
[toc] | [prev] | [next] | [standalone]
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2016-04-05 10:10 +0200 |
| Subject | Re: [PATCH 3/6] x86/tsc: Do not check X86_FEATURE_CONSTANT_TSC in notifier call |
| Message-ID | <rkudI-9L-15@gated-at.bofh.it> |
| In reply to | #1371268 |
On Tue, Apr 05, 2016 at 08:29:52AM +0200, Borislav Petkov wrote: > From: Borislav Petkov <bp@suse.de> > > ... because the notifier-registering routine already does that. Also, > rename cpufreq_tsc() init call to something more telling. > > Signed-off-by: Borislav Petkov <bp@suse.de> > Cc: Thomas Gleixner <tglx@linutronix.de> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Borislav Petkov <tipbot@zytor.com> |
|---|---|
| Date | 2016-04-13 13:50 +0200 |
| Subject | [tip:x86/asm] x86/tsc: Do not check X86_FEATURE_CONSTANT_TSC in notifier call |
| Message-ID | <rnrt2-BH-67@gated-at.bofh.it> |
| In reply to | #1371268 |
Commit-ID: a841cca74ea7612508aee161c89987b2646ed769
Gitweb: http://git.kernel.org/tip/a841cca74ea7612508aee161c89987b2646ed769
Author: Borislav Petkov <bp@suse.de>
AuthorDate: Tue, 5 Apr 2016 08:29:52 +0200
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 13 Apr 2016 11:37:43 +0200
x86/tsc: Do not check X86_FEATURE_CONSTANT_TSC in notifier call
... because the notifier-registering routine already does that. Also,
rename cpufreq_tsc() init call to something more telling.
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1459837795-2588-4-git-send-email-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/kernel/tsc.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index a0346bc..5bb702c 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -922,9 +922,6 @@ static int time_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
struct cpufreq_freqs *freq = data;
unsigned long *lpj;
- if (cpu_has(&cpu_data(freq->cpu), X86_FEATURE_CONSTANT_TSC))
- return 0;
-
lpj = &boot_cpu_data.loops_per_jiffy;
#ifdef CONFIG_SMP
if (!(freq->flags & CPUFREQ_CONST_LOOPS))
@@ -954,7 +951,7 @@ static struct notifier_block time_cpufreq_notifier_block = {
.notifier_call = time_cpufreq_notifier
};
-static int __init cpufreq_tsc(void)
+static int __init cpufreq_register_tsc_scaling(void)
{
if (!boot_cpu_has(X86_FEATURE_TSC))
return 0;
@@ -965,7 +962,7 @@ static int __init cpufreq_tsc(void)
return 0;
}
-core_initcall(cpufreq_tsc);
+core_initcall(cpufreq_register_tsc_scaling);
#endif /* CONFIG_CPU_FREQ */
[toc] | [prev] | [next] | [standalone]
| From | Borislav Petkov <bp@alien8.de> |
|---|---|
| Date | 2016-04-05 08:40 +0200 |
| Subject | [PATCH 1/6] x86/fpu/regset: Use boot_cpu_has() |
| Message-ID | <rksOD-7th-35@gated-at.bofh.it> |
| In reply to | #1371265 |
From: Borislav Petkov <bp@suse.de>
fpregs_{g,s}et() are not sizzling-hot paths to justify the need for
static_cpu_has(). Use the normal boot_cpu_has() helper.
Signed-off-by: Borislav Petkov <bp@suse.de>
---
arch/x86/kernel/fpu/regset.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/fpu/regset.c b/arch/x86/kernel/fpu/regset.c
index bc5e76c1d7c5..81422dfb152b 100644
--- a/arch/x86/kernel/fpu/regset.c
+++ b/arch/x86/kernel/fpu/regset.c
@@ -278,7 +278,7 @@ int fpregs_get(struct task_struct *target, const struct user_regset *regset,
fpu__activate_fpstate_read(fpu);
- if (!static_cpu_has(X86_FEATURE_FPU))
+ if (!boot_cpu_has(X86_FEATURE_FPU))
return fpregs_soft_get(target, regset, pos, count, kbuf, ubuf);
if (!boot_cpu_has(X86_FEATURE_FXSR))
@@ -309,7 +309,7 @@ int fpregs_set(struct task_struct *target, const struct user_regset *regset,
fpu__activate_fpstate_write(fpu);
fpstate_sanitize_xstate(fpu);
- if (!static_cpu_has(X86_FEATURE_FPU))
+ if (!boot_cpu_has(X86_FEATURE_FPU))
return fpregs_soft_set(target, regset, pos, count, kbuf, ubuf);
if (!boot_cpu_has(X86_FEATURE_FXSR))
--
2.7.3
[toc] | [prev] | [next] | [standalone]
| From | Brian Gerst <brgerst@gmail.com> |
|---|---|
| Date | 2016-04-05 16:00 +0200 |
| Subject | Re: [PATCH 1/6] x86/fpu/regset: Use boot_cpu_has() |
| Message-ID | <rkzGq-4wA-1@gated-at.bofh.it> |
| In reply to | #1371269 |
On Tue, Apr 5, 2016 at 2:29 AM, Borislav Petkov <bp@alien8.de> wrote:
> From: Borislav Petkov <bp@suse.de>
>
> fpregs_{g,s}et() are not sizzling-hot paths to justify the need for
> static_cpu_has(). Use the normal boot_cpu_has() helper.
>
> Signed-off-by: Borislav Petkov <bp@suse.de>
> ---
> arch/x86/kernel/fpu/regset.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kernel/fpu/regset.c b/arch/x86/kernel/fpu/regset.c
> index bc5e76c1d7c5..81422dfb152b 100644
> --- a/arch/x86/kernel/fpu/regset.c
> +++ b/arch/x86/kernel/fpu/regset.c
> @@ -278,7 +278,7 @@ int fpregs_get(struct task_struct *target, const struct user_regset *regset,
>
> fpu__activate_fpstate_read(fpu);
>
> - if (!static_cpu_has(X86_FEATURE_FPU))
> + if (!boot_cpu_has(X86_FEATURE_FPU))
> return fpregs_soft_get(target, regset, pos, count, kbuf, ubuf);
>
> if (!boot_cpu_has(X86_FEATURE_FXSR))
> @@ -309,7 +309,7 @@ int fpregs_set(struct task_struct *target, const struct user_regset *regset,
> fpu__activate_fpstate_write(fpu);
> fpstate_sanitize_xstate(fpu);
>
> - if (!static_cpu_has(X86_FEATURE_FPU))
> + if (!boot_cpu_has(X86_FEATURE_FPU))
> return fpregs_soft_set(target, regset, pos, count, kbuf, ubuf);
>
> if (!boot_cpu_has(X86_FEATURE_FXSR))
I think the general rule should be always use static_cpu_has() for
runtime checks, since it reduces down to a single jmp/nop instruction
after alternatives run. Even if it's not a hot path, it saves a bit
of runtime memory. boot_cpu_has() is fine for run-once init code.
--
Brian Gerst
[toc] | [prev] | [next] | [standalone]
| From | Borislav Petkov <bp@alien8.de> |
|---|---|
| Date | 2016-04-05 17:20 +0200 |
| Subject | Re: [PATCH 1/6] x86/fpu/regset: Use boot_cpu_has() |
| Message-ID | <rkAVP-5Pw-1@gated-at.bofh.it> |
| In reply to | #1371614 |
On Tue, Apr 05, 2016 at 09:51:55AM -0400, Brian Gerst wrote:
> I think the general rule should be always use static_cpu_has() for
> runtime checks, since it reduces down to a single jmp/nop instruction
> after alternatives run. Even if it's not a hot path, it saves a bit
> of runtime memory.
So gcc generates a MOV and a TEST for boot_cpu_has(). Not exactly the
bloat or slowdown.
So I look at those differently: static_cpu_has()
a) should be used on hotpaths
b) is used as such to annotate those - i.e., "ah, there's a
static_cpu_has(), this is a hot path, I better be careful what I'm doing
here."
boot_cpu_has() in all the rest.
And saving a couple of bytes per call site but increasing alternatives
application time by milli- or microseconds... Meh. I don't see it being
really worth the trouble. But this is just me.
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Borislav Petkov <tipbot@zytor.com> |
|---|---|
| Date | 2016-04-13 13:50 +0200 |
| Subject | [tip:x86/asm] x86/fpu/regset: Replace static_cpu_has() usage with boot_cpu_has() |
| Message-ID | <rnrsZ-BH-5@gated-at.bofh.it> |
| In reply to | #1371269 |
Commit-ID: 78df526c74a4db696e1e058b9869471937d0773b
Gitweb: http://git.kernel.org/tip/78df526c74a4db696e1e058b9869471937d0773b
Author: Borislav Petkov <bp@suse.de>
AuthorDate: Tue, 5 Apr 2016 08:29:50 +0200
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 13 Apr 2016 11:37:42 +0200
x86/fpu/regset: Replace static_cpu_has() usage with boot_cpu_has()
fpregs_{g,s}et() are not sizzling-hot paths to justify the need for
static_cpu_has(). Use the normal boot_cpu_has() helper.
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1459837795-2588-2-git-send-email-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/kernel/fpu/regset.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/fpu/regset.c b/arch/x86/kernel/fpu/regset.c
index bc5e76c..81422df 100644
--- a/arch/x86/kernel/fpu/regset.c
+++ b/arch/x86/kernel/fpu/regset.c
@@ -278,7 +278,7 @@ int fpregs_get(struct task_struct *target, const struct user_regset *regset,
fpu__activate_fpstate_read(fpu);
- if (!static_cpu_has(X86_FEATURE_FPU))
+ if (!boot_cpu_has(X86_FEATURE_FPU))
return fpregs_soft_get(target, regset, pos, count, kbuf, ubuf);
if (!boot_cpu_has(X86_FEATURE_FXSR))
@@ -309,7 +309,7 @@ int fpregs_set(struct task_struct *target, const struct user_regset *regset,
fpu__activate_fpstate_write(fpu);
fpstate_sanitize_xstate(fpu);
- if (!static_cpu_has(X86_FEATURE_FPU))
+ if (!boot_cpu_has(X86_FEATURE_FPU))
return fpregs_soft_set(target, regset, pos, count, kbuf, ubuf);
if (!boot_cpu_has(X86_FEATURE_FXSR))
[toc] | [prev] | [next] | [standalone]
| From | Borislav Petkov <bp@alien8.de> |
|---|---|
| Date | 2016-04-05 08:40 +0200 |
| Subject | [PATCH 5/6] x86/fpu: Remove check_fpu() indirection |
| Message-ID | <rksOD-7th-33@gated-at.bofh.it> |
| In reply to | #1371265 |
From: Borislav Petkov <bp@suse.de>
Rename it to fpu__init_check_bugs() and do the CPU feature check at
entry, thus getting rid of the old fpu__init_check_bugs() wrapper.
Signed-off-by: Borislav Petkov <bp@suse.de>
---
arch/x86/kernel/fpu/bugs.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/arch/x86/kernel/fpu/bugs.c b/arch/x86/kernel/fpu/bugs.c
index 224b5ec52195..aad34aafc0e0 100644
--- a/arch/x86/kernel/fpu/bugs.c
+++ b/arch/x86/kernel/fpu/bugs.c
@@ -21,11 +21,15 @@ static double __initdata y = 3145727.0;
* We should really only care about bugs here
* anyway. Not features.
*/
-static void __init check_fpu(void)
+void __init fpu__init_check_bugs(void)
{
u32 cr0_saved;
s32 fdiv_bug;
+ /* kernel_fpu_begin/end() relies on patched alternative instructions. */
+ if (!boot_cpu_has(X86_FEATURE_FPU))
+ return;
+
/* We might have CR0::TS set already, clear it: */
cr0_saved = read_cr0();
write_cr0(cr0_saved & ~X86_CR0_TS);
@@ -59,13 +63,3 @@ static void __init check_fpu(void)
pr_warn("Hmm, FPU with FDIV bug\n");
}
}
-
-void __init fpu__init_check_bugs(void)
-{
- /*
- * kernel_fpu_begin/end() in check_fpu() relies on the patched
- * alternative instructions.
- */
- if (boot_cpu_has(X86_FEATURE_FPU))
- check_fpu();
-}
--
2.7.3
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Borislav Petkov <tipbot@zytor.com> |
|---|---|
| Date | 2016-04-13 13:50 +0200 |
| Subject | [tip:x86/asm] x86/fpu: Remove check_fpu() indirection |
| Message-ID | <rnrt0-BH-33@gated-at.bofh.it> |
| In reply to | #1371271 |
Commit-ID: de82fbc3823b7b15ee03466ebfb1c5ec7cc1a941
Gitweb: http://git.kernel.org/tip/de82fbc3823b7b15ee03466ebfb1c5ec7cc1a941
Author: Borislav Petkov <bp@suse.de>
AuthorDate: Tue, 5 Apr 2016 08:29:54 +0200
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 13 Apr 2016 11:37:43 +0200
x86/fpu: Remove check_fpu() indirection
Rename it to fpu__init_check_bugs() and do the CPU feature check at
entry, thus getting rid of the old fpu__init_check_bugs() wrapper.
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1459837795-2588-6-git-send-email-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/kernel/fpu/bugs.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/arch/x86/kernel/fpu/bugs.c b/arch/x86/kernel/fpu/bugs.c
index 224b5ec..aad34aa 100644
--- a/arch/x86/kernel/fpu/bugs.c
+++ b/arch/x86/kernel/fpu/bugs.c
@@ -21,11 +21,15 @@ static double __initdata y = 3145727.0;
* We should really only care about bugs here
* anyway. Not features.
*/
-static void __init check_fpu(void)
+void __init fpu__init_check_bugs(void)
{
u32 cr0_saved;
s32 fdiv_bug;
+ /* kernel_fpu_begin/end() relies on patched alternative instructions. */
+ if (!boot_cpu_has(X86_FEATURE_FPU))
+ return;
+
/* We might have CR0::TS set already, clear it: */
cr0_saved = read_cr0();
write_cr0(cr0_saved & ~X86_CR0_TS);
@@ -59,13 +63,3 @@ static void __init check_fpu(void)
pr_warn("Hmm, FPU with FDIV bug\n");
}
}
-
-void __init fpu__init_check_bugs(void)
-{
- /*
- * kernel_fpu_begin/end() in check_fpu() relies on the patched
- * alternative instructions.
- */
- if (boot_cpu_has(X86_FEATURE_FPU))
- check_fpu();
-}
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web