Re: [PATCH 1/2] x86/msr: add on cpu read/modify/write function

2015-12-20 Thread Borislav Petkov
On Sun, Dec 20, 2015 at 02:28:48PM +0100, Thomas Gleixner wrote: > So this is a copy of the above !SMP inline. What's wrong with providing: > > int rmwmsrl_safe(msr_no, clear_mask, set_mask) > > in x86/lib/msr.c and make the !SMP variant of rdmsrl_safe_on_cpu() and that > variant for the SMP cas

Re: [PATCH 1/2] x86/msr: add on cpu read/modify/write function

2015-12-20 Thread Thomas Gleixner
Jacob, On Fri, 11 Dec 2015, Jacob Pan wrote: > +static inline int rmwmsrl_safe_on_cpu(unsigned int cpu, u32 msr_no, u64 > mask, u64 bits) > +{ > + int err; > + u64 val; > + > + err = rdmsrl_safe(msr_no, &val); > + if (err) > + goto out; > + > + val &= ~mask; > +

[PATCH 1/2] x86/msr: add on cpu read/modify/write function

2015-12-11 Thread Jacob Pan
Remote CPU read/modify/write is often needed but currently without a lib call. This patch adds an API to perform on CPU safe read/modify/write so that callers don't have to invent such function. Based on initial code from: Peter Zijlstra Suggested-by: Srinivas Pandruvada Signed-off-by: Jacob Pa