mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Borislav Petkov <borislav.petkov@amd.com>
To: <hpa@zytor.com>
Cc: <linux-kernel@vger.kernel.org>, <x86@kernel.org>
Subject: [PATCH] x86, msr: execute on the correct CPU subset
Date: Thu, 30 Jul 2009 11:10:01 +0200	[thread overview]
Message-ID: <1248945002-2931-1-git-send-email-borislav.petkov@amd.com> (raw)
In-Reply-To: <4A7099E8.30003@zytor.com>

Make rdmsr_on_cpus/wrmsr_on_cpus execute on the current CPU only if it
is in the supplied bitmask.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
---
 arch/x86/lib/msr.c |   26 ++++++++++----------------
 1 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/arch/x86/lib/msr.c b/arch/x86/lib/msr.c
index 1440b9c..caa24ac 100644
--- a/arch/x86/lib/msr.c
+++ b/arch/x86/lib/msr.c
@@ -89,16 +89,13 @@ void rdmsr_on_cpus(const cpumask_t *mask, u32 msr_no, struct msr *msrs)
 	rv.msrs	  = msrs;
 	rv.msr_no = msr_no;
 
-	preempt_disable();
-	/*
-	 * FIXME: handle the CPU we're executing on separately for now until
-	 * smp_call_function_many has been fixed to not skip it.
-	 */
-	this_cpu = raw_smp_processor_id();
-	smp_call_function_single(this_cpu, __rdmsr_on_cpu, &rv, 1);
+	this_cpu = get_cpu();
+
+	if (cpumask_test_cpu(this_cpu, mask))
+		__rdmsr_on_cpu(&rv);
 
 	smp_call_function_many(mask, __rdmsr_on_cpu, &rv, 1);
-	preempt_enable();
+	put_cpu();
 }
 EXPORT_SYMBOL(rdmsr_on_cpus);
 
@@ -121,16 +118,13 @@ void wrmsr_on_cpus(const cpumask_t *mask, u32 msr_no, struct msr *msrs)
 	rv.msrs   = msrs;
 	rv.msr_no = msr_no;
 
-	preempt_disable();
-	/*
-	 * FIXME: handle the CPU we're executing on separately for now until
-	 * smp_call_function_many has been fixed to not skip it.
-	 */
-	this_cpu = raw_smp_processor_id();
-	smp_call_function_single(this_cpu, __wrmsr_on_cpu, &rv, 1);
+	this_cpu = get_cpu();
+
+	if (cpumask_test_cpu(this_cpu, mask))
+		__wrmsr_on_cpu(&rv);
 
 	smp_call_function_many(mask, __wrmsr_on_cpu, &rv, 1);
-	preempt_enable();
+	put_cpu();
 }
 EXPORT_SYMBOL(wrmsr_on_cpus);
 
-- 
1.6.3.3



  reply	other threads:[~2009-07-30  9:11 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-06 14:29 [PATCH] [x86, msr]: remove code duplication Borislav Petkov
2009-07-06 21:31 ` H. Peter Anvin
2009-07-07 10:37   ` Borislav Petkov
2009-07-07 15:56     ` H. Peter Anvin
2009-07-08 11:19       ` [PATCH] [x86, msr]: execute on the correct CPU subset (was: Re: [PATCH] [x86, msr]: remove code duplication) Borislav Petkov
2009-07-16 16:51         ` Borislav Petkov
2009-07-16 17:24           ` [PATCH] [x86, msr]: execute on the correct CPU subset H. Peter Anvin
2009-07-27 20:46         ` H. Peter Anvin
2009-07-28 10:29           ` Borislav Petkov
2009-07-29 16:49           ` Borislav Petkov
2009-07-29 17:30             ` H. Peter Anvin
2009-07-29 18:02               ` Borislav Petkov
2009-07-29 18:05                 ` H. Peter Anvin
2009-07-29 18:46                   ` Borislav Petkov
2009-07-29 18:50                     ` H. Peter Anvin
2009-07-30  9:10                       ` Borislav Petkov [this message]
2009-07-30  9:10                       ` [PATCH] x86, msr: unify rdmsr_on_cpus/wrmsr_on_cpus Borislav Petkov
2009-09-14 12:55                         ` 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=1248945002-2931-1-git-send-email-borislav.petkov@amd.com \
    --to=borislav.petkov@amd.com \
    --cc=hpa@zytor.com \
    --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

Powered by JetHome