]> xenbits.xensource.com Git - people/julieng/freebsd.git/commitdiff
xen: Replace all usage of cpu_relax by cpu_spinwait
authorJulien Grall <julien.grall@citrix.com>
Thu, 15 Oct 2015 17:24:19 +0000 (18:24 +0100)
committerJulien Grall <julien.grall@citrix.com>
Fri, 16 Oct 2015 16:31:43 +0000 (17:31 +0100)
The 2 macros are exactly the same (rep;nop = pause) so there is no need
to implement our own.

sys/dev/xen/grant_table/grant_table.c
sys/x86/include/xen/xen-os.h

index d3371a91095f0cbb8b291cac4e3d32e2ffef5ec9..18dabacc9f436b9c9f9ccd8aadb64cb0be04ba60 100644 (file)
@@ -25,6 +25,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/limits.h>
 #include <sys/rman.h>
 #include <machine/resource.h>
+#include <machine/cpu.h>
 
 #include <xen/xen-os.h>
 #include <xen/hypervisor.h>
@@ -289,13 +290,13 @@ gnttab_end_foreign_transfer_ref(grant_ref_t ref)
        while (!((flags = shared[ref].flags) & GTF_transfer_committed)) {
                if ( synch_cmpxchg(&shared[ref].flags, flags, 0) == flags )
                        return (0);
-               cpu_relax();
+               cpu_spinwait();
        }
 
        /* If a transfer is in progress then wait until it is completed. */
        while (!(flags & GTF_transfer_completed)) {
                flags = shared[ref].flags;
-               cpu_relax();
+               cpu_spinwait();
        }
 
        /* Read the frame number /after/ reading completion status. */
index b313a139b1b1bc14c35119114d290b5a9b41d847..115310520af0555619941f0917cd1c8708792e86 100644 (file)
 /* Everything below this point is not included by assembler (.S) files. */
 #ifndef __ASSEMBLY__
 
-/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
-static inline void rep_nop(void)
-{
-    __asm__ __volatile__ ( "rep;nop" : : : "memory" );
-}
-#define cpu_relax() rep_nop()
-
 #endif /* !__ASSEMBLY__ */
 
 #endif /* _MACHINE_X86_XEN_XEN_OS_H_ */