xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86: drop raw_write_cr4() again
@ 2016-03-22 12:54 Jan Beulich
  2016-03-22 13:25 ` Andrew Cooper
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2016-03-22 12:54 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper, Keir Fraser

[-- Attachment #1: Type: text/plain, Size: 1360 bytes --]

The bypassing of the memory cache is, namely in the context of the
32-bit PV SMEP/SMAP workaround series (as Andrew validly points out),
making the overall correctness more difficult to verify. Hence go
back to uniform writes.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/include/asm-x86/processor.h
+++ b/xen/include/asm-x86/processor.h
@@ -328,11 +328,6 @@ static inline unsigned long read_cr2(voi
     return cr2;
 }
 
-static inline void raw_write_cr4(unsigned long val)
-{
-    asm volatile ( "mov %0,%%cr4" : : "r" (val) );
-}
-
 static inline unsigned long read_cr4(void)
 {
     return get_cpu_info()->cr4;
@@ -341,7 +336,7 @@ static inline unsigned long read_cr4(voi
 static inline void write_cr4(unsigned long val)
 {
     get_cpu_info()->cr4 = val;
-    raw_write_cr4(val);
+    asm volatile ( "mov %0,%%cr4" : : "r" (val) );
 }
 
 /* Clear and set 'TS' bit respectively */
@@ -385,10 +380,10 @@ static inline unsigned int read_pkru(voi
      * so that X86_CR4_PKE  is disabled on hypervisor. To use RDPKRU, CR4.PKE
      * gets temporarily enabled.
      */
-    raw_write_cr4(cr4 | X86_CR4_PKE);
+    write_cr4(cr4 | X86_CR4_PKE);
     asm volatile (".byte 0x0f,0x01,0xee"
         : "=a" (pkru) : "c" (0) : "dx");
-    raw_write_cr4(cr4);
+    write_cr4(cr4);
 
     return pkru;
 }




[-- Attachment #2: x86-CR4-no-raw-write.patch --]
[-- Type: text/plain, Size: 1389 bytes --]

x86: drop raw_write_cr4() again

The bypassing of the memory cache is, namely in the context of the
32-bit PV SMEP/SMAP workaround series (as Andrew validly points out),
making the overall correctness more difficult to verify. Hence go
back to uniform writes.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/include/asm-x86/processor.h
+++ b/xen/include/asm-x86/processor.h
@@ -328,11 +328,6 @@ static inline unsigned long read_cr2(voi
     return cr2;
 }
 
-static inline void raw_write_cr4(unsigned long val)
-{
-    asm volatile ( "mov %0,%%cr4" : : "r" (val) );
-}
-
 static inline unsigned long read_cr4(void)
 {
     return get_cpu_info()->cr4;
@@ -341,7 +336,7 @@ static inline unsigned long read_cr4(voi
 static inline void write_cr4(unsigned long val)
 {
     get_cpu_info()->cr4 = val;
-    raw_write_cr4(val);
+    asm volatile ( "mov %0,%%cr4" : : "r" (val) );
 }
 
 /* Clear and set 'TS' bit respectively */
@@ -385,10 +380,10 @@ static inline unsigned int read_pkru(voi
      * so that X86_CR4_PKE  is disabled on hypervisor. To use RDPKRU, CR4.PKE
      * gets temporarily enabled.
      */
-    raw_write_cr4(cr4 | X86_CR4_PKE);
+    write_cr4(cr4 | X86_CR4_PKE);
     asm volatile (".byte 0x0f,0x01,0xee"
         : "=a" (pkru) : "c" (0) : "dx");
-    raw_write_cr4(cr4);
+    write_cr4(cr4);
 
     return pkru;
 }

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86: drop raw_write_cr4() again
  2016-03-22 12:54 [PATCH] x86: drop raw_write_cr4() again Jan Beulich
@ 2016-03-22 13:25 ` Andrew Cooper
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cooper @ 2016-03-22 13:25 UTC (permalink / raw)
  To: Jan Beulich, xen-devel; +Cc: Keir Fraser

On 22/03/16 12:54, Jan Beulich wrote:
> The bypassing of the memory cache is, namely in the context of the
> 32-bit PV SMEP/SMAP workaround series (as Andrew validly points out),
> making the overall correctness more difficult to verify. Hence go
> back to uniform writes.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-22 13:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-22 12:54 [PATCH] x86: drop raw_write_cr4() again Jan Beulich
2016-03-22 13:25 ` Andrew Cooper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).