Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1611597

Re: [PATCH V4 1/2] x86/msr: expose msr_flip_bit function

From Thomas Gleixner <tglx@linutronix.de>
Newsgroups linux.kernel
Subject Re: [PATCH V4 1/2] x86/msr: expose msr_flip_bit function
Date 2017-03-29 07:50 +0200
Message-ID <tqeEy-2pZ-21@gated-at.bofh.it> (permalink)
References <tqbdE-8tJ-9@gated-at.bofh.it> <tqbdE-8tJ-29@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, 28 Mar 2017, kan.liang@intel.com wrote:
> From: Kan Liang <Kan.liang@intel.com>
> 
> There is no exported kernel interfaces which can flip a MSR bit. It has
> to do read-modify-write operation on the MSR through rd/wrmsr*
> interfaces. But the method is not atomic.
> 
> There is already __flip_bit support. Just rename and expose it.

This function is not atomic either. Protection has to be provided by the
caller.

> -static inline int __flip_bit(u32 msr, u8 bit, bool set)
> +int msr_flip_bit(u32 msr, u8 bit, bool set)
>  {
>  	struct msr m, m1;
>  	int err = -EINVAL;
> @@ -85,6 +85,7 @@ static inline int __flip_bit(u32 msr, u8 bit, bool set)
>  
>  	return 1;
>  }
> +EXPORT_SYMBOL_GPL(msr_flip_bit);

That export is not required. The call site is always built in.

Thanks,

	tglx

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH V4 0/2] measure SMI cost (kernel) kan.liang@intel.com - 2017-03-29 04:10 +0200
  [PATCH V4 1/2] x86/msr: expose msr_flip_bit function kan.liang@intel.com - 2017-03-29 04:10 +0200
    Re: [PATCH V4 1/2] x86/msr: expose msr_flip_bit function Thomas Gleixner <tglx@linutronix.de> - 2017-03-29 07:50 +0200
      RE: [PATCH V4 1/2] x86/msr: expose msr_flip_bit function "Liang, Kan" <kan.liang@intel.com> - 2017-03-29 15:10 +0200

csiph-web