All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Liang, Kan" <kan.liang@intel.com>
To: Borislav Petkov <bp@alien8.de>
Cc: "peterz@infradead.org" <peterz@infradead.org>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"acme@kernel.org" <acme@kernel.org>,
	"eranian@google.com" <eranian@google.com>,
	"jolsa@kernel.org" <jolsa@kernel.org>,
	"ak@linux.intel.com" <ak@linux.intel.com>
Subject: RE: [PATCH V2 1/2] x86/msr: add msr_set/clear_bit_on_cpu/cpus access functions
Date: Mon, 27 Mar 2017 17:12:48 +0000	[thread overview]
Message-ID: <37D7C6CF3E00A74B8858931C1DB2F077536C5BFE@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <20170327165710.zvqa7y7e6adby5bc@pd.tnic>


> 
> On Mon, Mar 27, 2017 at 08:47:37AM -0700, kan.liang@intel.com wrote:
> > From: Kan Liang <Kan.liang@intel.com>
> >
> > Having msr_set/clear_bit on many cpus or given CPU can avoid extra
> > unnecessory IPIs
> 
> How does that happen?
>

My previous patch did a read-modify-write operation. Compared with the
single operation set/clear, it will has extra IPIs.
Sorry for the confusing wording.
I will change the description. 

> You have smp_call_function_many() sending IPIs to each CPU in the mask.
> Doesn't look like avoiding anything to me.
> 
> Now if you want to have interfaces set/clear_bit_on_cpu(s), that's a
> different story.
> 
> And those actually double the amount of IPIs the moment you do a read-
> modify-write operation on the MSR, i.e., you want to read *and* write
> afterwards.
> 
> If you only want to do a single operation - set or clear - like you're doing in
> your other patch, then I guess that's fine as it wraps the
> smp_call_function* boilerplate code.
> 
> > and simplify MSR content manipulation, when it only needs to flip a
> > bit.
> > There is already msr_set/clear_bit, but missing the _on_cpu and
> > _on_cpus version.
> >
> > Signed-off-by: Kan Liang <Kan.liang@intel.com>
> > ---
> >  arch/x86/include/asm/msr.h | 29 ++++++++++++++++++
> >  arch/x86/lib/msr-smp.c     | 76
> ++++++++++++++++++++++++++++++++++++++++++++++
> >  2 files changed, 105 insertions(+)
> >
> > diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h
> > index 898dba2..9bc999b 100644
> > --- a/arch/x86/include/asm/msr.h
> > +++ b/arch/x86/include/asm/msr.h
> > @@ -20,6 +20,11 @@ struct msr {
> >  	};
> >  };
> >
> > +struct msr_bit_info {
> > +	u32 msr_no;
> > +	u8 bit;
> > +};
> 
> No, not *another* struct msr*info. Please reuse msr_info.
> 

OK.

Thanks,
Kan

  reply	other threads:[~2017-03-27 17:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-27 15:47 [PATCH V2 0/2] measure SMI cost (kernel) kan.liang
2017-03-27 15:47 ` [PATCH V2 1/2] x86/msr: add msr_set/clear_bit_on_cpu/cpus access functions kan.liang
2017-03-27 16:57   ` Borislav Petkov
2017-03-27 17:12     ` Liang, Kan [this message]
2017-03-27 15:47 ` [PATCH V2 2/2] perf/x86: add sysfs entry to freeze counter on SMI kan.liang

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=37D7C6CF3E00A74B8858931C1DB2F077536C5BFE@SHSMSX103.ccr.corp.intel.com \
    --to=kan.liang@intel.com \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=eranian@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.