Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753343AbdC2Frl (ORCPT ); Wed, 29 Mar 2017 01:47:41 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:55304 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753174AbdC2Frj (ORCPT ); Wed, 29 Mar 2017 01:47:39 -0400 Date: Wed, 29 Mar 2017 07:47:26 +0200 (CEST) From: Thomas Gleixner To: Kan Liang cc: peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org, bp@alien8.de, acme@kernel.org, eranian@google.com, jolsa@kernel.org, ak@linux.intel.com Subject: Re: [PATCH V4 1/2] x86/msr: expose msr_flip_bit function In-Reply-To: <1490751920-44720-2-git-send-email-kan.liang@intel.com> Message-ID: References: <1490751920-44720-1-git-send-email-kan.liang@intel.com> <1490751920-44720-2-git-send-email-kan.liang@intel.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 797 Lines: 28 On Tue, 28 Mar 2017, kan.liang@intel.com wrote: > From: Kan Liang > > 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