[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/5] x86: introduce read_sregs() to allow storing to memory directly


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Mon, 28 Sep 2020 16:11:10 +0100
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Mon, 28 Sep 2020 15:11:26 +0000
  • Ironport-sdr: vHMFv8cmrHyul5TR3ZeHGqtuuMlJQFGc2mMSCvOLMVfkid3rGwurBnjWAHOaOID/xL7mUhGjrV juDQ0bessp5Eea/SiLnqNecx99o++yI+6lJ7KH5eDzuzTdV89lME6ZIicBRUNb2QMOOqmx/IMG p0X2LE/rqsM4NMi+9BetU/surtcfUL0P7N/F32NI5/5EKYXgyC1CZTWfYtio7FoIWC2PdX0eGx a2H0Wh0NnYI4SyoF7HqyIVSuJumr6FJbWnyo/9pFNZV55wL6iqX+YS9G0KmT5OoZ721MUAqJWa ZEg=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 28/09/2020 15:49, Jan Beulich wrote:
> On 28.09.2020 14:47, Andrew Cooper wrote:
>> On 28/09/2020 13:05, Jan Beulich wrote:
>>> --- a/xen/include/asm-x86/regs.h
>>> +++ b/xen/include/asm-x86/regs.h
>>> @@ -15,4 +15,18 @@
>>>      (diff == 0);                                                           
>>>    \
>>>  })
>>>  
>>> +#define read_sreg(name) ({                                    \
>>> +    unsigned int __sel;                                       \
>>> +    asm volatile ( "mov %%" STR(name) ",%0" : "=r" (__sel) ); \
>>> +    __sel;                                                    \
>>> +})
>>> +
>>> +static inline void read_sregs(struct cpu_user_regs *regs)
>>> +{
>>> +    asm volatile ( "mov %%ds, %0" : "=m" (regs->ds) );
>>> +    asm volatile ( "mov %%es, %0" : "=m" (regs->es) );
>>> +    asm volatile ( "mov %%fs, %0" : "=m" (regs->fs) );
>>> +    asm volatile ( "mov %%gs, %0" : "=m" (regs->gs) );
>> It occurs to me that reads don't need to be volatile.  There are no side
>> effects.
> I'll do the same for what patches 3 and 5 alter anyway, assuming
> this won't invalidate your R-b there.

3 is fine.  5 is a little more problematic, because there are
serialising side effects, but I suppose we really don't care here.

~Andrew



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.