* [PATCH] x86, msr: fix rdmsrl_safe_on_cpu()
@ 2018-03-28 3:22 Eric Dumazet
2018-03-28 8:38 ` [tip:x86/cleanups] x86/msr: Make rdmsrl_safe_on_cpu() scheduling safe as well tip-bot for Eric Dumazet
2018-03-28 10:08 ` [PATCH] x86, msr: fix rdmsrl_safe_on_cpu() Borislav Petkov
0 siblings, 2 replies; 4+ messages in thread
From: Eric Dumazet @ 2018-03-28 3:22 UTC (permalink / raw)
To: x86
Cc: lkml, Eric Dumazet, Eric Dumazet, H. Peter Anvin,
Thomas Gleixner, Ingo Molnar, Borislav Petkov
When changing rdmsr_safe_on_cpu() to schedule, I missed that
__rdmsr_safe_on_cpu() was also used by rdmsrl_safe_on_cpu()
Lets make rdmsrl_safe_on_cpu() a wrapper instead of copy/pasting
the code I added for the completion handling.
Fixes: 07cde313b2d2 ("x86/msr: Allow rdmsr_safe_on_cpu() to schedule")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
---
arch/x86/lib/msr-smp.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/arch/x86/lib/msr-smp.c b/arch/x86/lib/msr-smp.c
index 761ba062afdaf7f7d0603ed94ed6cc3e46b37f76..fee8b9c0520c9954e3cf9093332e1a9b53009b8b 100644
--- a/arch/x86/lib/msr-smp.c
+++ b/arch/x86/lib/msr-smp.c
@@ -225,16 +225,13 @@ EXPORT_SYMBOL(wrmsrl_safe_on_cpu);
int rdmsrl_safe_on_cpu(unsigned int cpu, u32 msr_no, u64 *q)
{
+ u32 low, high;
int err;
- struct msr_info rv;
- memset(&rv, 0, sizeof(rv));
+ err = rdmsr_safe_on_cpu(cpu, msr_no, &low, &high);
+ *q = (u64)high << 32 | low;
- rv.msr_no = msr_no;
- err = smp_call_function_single(cpu, __rdmsr_safe_on_cpu, &rv, 1);
- *q = rv.reg.q;
-
- return err ? err : rv.err;
+ return err;
}
EXPORT_SYMBOL(rdmsrl_safe_on_cpu);
--
2.17.0.rc1.321.gba9d0f2565-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [tip:x86/cleanups] x86/msr: Make rdmsrl_safe_on_cpu() scheduling safe as well
2018-03-28 3:22 [PATCH] x86, msr: fix rdmsrl_safe_on_cpu() Eric Dumazet
@ 2018-03-28 8:38 ` tip-bot for Eric Dumazet
2018-03-28 10:08 ` [PATCH] x86, msr: fix rdmsrl_safe_on_cpu() Borislav Petkov
1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Eric Dumazet @ 2018-03-28 8:38 UTC (permalink / raw)
To: linux-tip-commits
Cc: mingo, fengguang.wu, bp, linux-kernel, hpa, edumazet, eric.dumazet, tglx
Commit-ID: 9b9a51354cae933f5640b5bb73bbcd32f989122f
Gitweb: https://git.kernel.org/tip/9b9a51354cae933f5640b5bb73bbcd32f989122f
Author: Eric Dumazet <edumazet@google.com>
AuthorDate: Tue, 27 Mar 2018 20:22:33 -0700
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 28 Mar 2018 10:34:13 +0200
x86/msr: Make rdmsrl_safe_on_cpu() scheduling safe as well
When changing rdmsr_safe_on_cpu() to schedule, it was missed that
__rdmsr_safe_on_cpu() was also used by rdmsrl_safe_on_cpu()
Make rdmsrl_safe_on_cpu() a wrapper instead of copy/pasting the code which
was added for the completion handling.
Fixes: 07cde313b2d2 ("x86/msr: Allow rdmsr_safe_on_cpu() to schedule")
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Link: https://lkml.kernel.org/r/20180328032233.153055-1-edumazet@google.com
---
arch/x86/lib/msr-smp.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/arch/x86/lib/msr-smp.c b/arch/x86/lib/msr-smp.c
index 761ba062afda..fee8b9c0520c 100644
--- a/arch/x86/lib/msr-smp.c
+++ b/arch/x86/lib/msr-smp.c
@@ -225,16 +225,13 @@ EXPORT_SYMBOL(wrmsrl_safe_on_cpu);
int rdmsrl_safe_on_cpu(unsigned int cpu, u32 msr_no, u64 *q)
{
+ u32 low, high;
int err;
- struct msr_info rv;
- memset(&rv, 0, sizeof(rv));
+ err = rdmsr_safe_on_cpu(cpu, msr_no, &low, &high);
+ *q = (u64)high << 32 | low;
- rv.msr_no = msr_no;
- err = smp_call_function_single(cpu, __rdmsr_safe_on_cpu, &rv, 1);
- *q = rv.reg.q;
-
- return err ? err : rv.err;
+ return err;
}
EXPORT_SYMBOL(rdmsrl_safe_on_cpu);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] x86, msr: fix rdmsrl_safe_on_cpu()
2018-03-28 3:22 [PATCH] x86, msr: fix rdmsrl_safe_on_cpu() Eric Dumazet
2018-03-28 8:38 ` [tip:x86/cleanups] x86/msr: Make rdmsrl_safe_on_cpu() scheduling safe as well tip-bot for Eric Dumazet
@ 2018-03-28 10:08 ` Borislav Petkov
2018-03-28 16:33 ` Eric Dumazet
1 sibling, 1 reply; 4+ messages in thread
From: Borislav Petkov @ 2018-03-28 10:08 UTC (permalink / raw)
To: Eric Dumazet
Cc: x86, lkml, Eric Dumazet, H. Peter Anvin, Thomas Gleixner, Ingo Molnar
On Tue, Mar 27, 2018 at 08:22:33PM -0700, Eric Dumazet wrote:
> When changing rdmsr_safe_on_cpu() to schedule, I missed that
> __rdmsr_safe_on_cpu() was also used by rdmsrl_safe_on_cpu()
>
> Lets make rdmsrl_safe_on_cpu() a wrapper instead of copy/pasting
> the code I added for the completion handling.
>
> Fixes: 07cde313b2d2 ("x86/msr: Allow rdmsr_safe_on_cpu() to schedule")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Reported-by: kbuild test robot <fengguang.wu@intel.com>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Borislav Petkov <bp@alien8.de>
> ---
> arch/x86/lib/msr-smp.c | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/arch/x86/lib/msr-smp.c b/arch/x86/lib/msr-smp.c
> index 761ba062afdaf7f7d0603ed94ed6cc3e46b37f76..fee8b9c0520c9954e3cf9093332e1a9b53009b8b 100644
> --- a/arch/x86/lib/msr-smp.c
> +++ b/arch/x86/lib/msr-smp.c
> @@ -225,16 +225,13 @@ EXPORT_SYMBOL(wrmsrl_safe_on_cpu);
>
> int rdmsrl_safe_on_cpu(unsigned int cpu, u32 msr_no, u64 *q)
> {
> + u32 low, high;
> int err;
> - struct msr_info rv;
>
> - memset(&rv, 0, sizeof(rv));
> + err = rdmsr_safe_on_cpu(cpu, msr_no, &low, &high);
> + *q = (u64)high << 32 | low;
>
> - rv.msr_no = msr_no;
> - err = smp_call_function_single(cpu, __rdmsr_safe_on_cpu, &rv, 1);
> - *q = rv.reg.q;
> -
> - return err ? err : rv.err;
> + return err;
> }
> EXPORT_SYMBOL(rdmsrl_safe_on_cpu);
>
> --
I guess now that the rdmsr* side does this, you probably should convert
the wrmsr* side as well.
Thx.
--
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] x86, msr: fix rdmsrl_safe_on_cpu()
2018-03-28 10:08 ` [PATCH] x86, msr: fix rdmsrl_safe_on_cpu() Borislav Petkov
@ 2018-03-28 16:33 ` Eric Dumazet
0 siblings, 0 replies; 4+ messages in thread
From: Eric Dumazet @ 2018-03-28 16:33 UTC (permalink / raw)
To: Borislav Petkov, Eric Dumazet
Cc: x86, lkml, H. Peter Anvin, Thomas Gleixner, Ingo Molnar
On 03/28/2018 03:08 AM, Borislav Petkov wrote:
> I guess now that the rdmsr* side does this, you probably should convert
> the wrmsr* side as well.
Yes indeed, thanks for the reminder.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-03-28 16:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-28 3:22 [PATCH] x86, msr: fix rdmsrl_safe_on_cpu() Eric Dumazet
2018-03-28 8:38 ` [tip:x86/cleanups] x86/msr: Make rdmsrl_safe_on_cpu() scheduling safe as well tip-bot for Eric Dumazet
2018-03-28 10:08 ` [PATCH] x86, msr: fix rdmsrl_safe_on_cpu() Borislav Petkov
2018-03-28 16:33 ` Eric Dumazet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).