On second thought, implement x86_pause() as a regular function. The small
delay from the call is useful for spinlock backoff.
This commit is contained in:
parent
ad9091c30f
commit
d0a255a895
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cpufunc.h,v 1.11 2007/01/12 20:22:04 ad Exp $ */
|
||||
/* $NetBSD: cpufunc.h,v 1.12 2007/01/14 14:03:00 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -49,11 +49,7 @@
|
||||
#include <machine/segments.h>
|
||||
#include <machine/specialreg.h>
|
||||
|
||||
static __inline void
|
||||
x86_pause(void)
|
||||
{
|
||||
__asm volatile("pause");
|
||||
}
|
||||
void x86_pause(void);
|
||||
|
||||
/*
|
||||
* XXX if lfence isn't available...
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cpufunc.h,v 1.34 2007/01/01 20:56:59 ad Exp $ */
|
||||
/* $NetBSD: cpufunc.h,v 1.35 2007/01/14 14:03:00 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -49,11 +49,7 @@
|
||||
#include <machine/segments.h>
|
||||
#include <machine/specialreg.h>
|
||||
|
||||
static __inline void
|
||||
x86_pause(void)
|
||||
{
|
||||
__asm volatile("pause");
|
||||
}
|
||||
void x86_pause(void);
|
||||
|
||||
/*
|
||||
* XXX it's better to use real lfence insn if available.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: x86_machdep.c,v 1.5 2006/12/26 10:43:44 elad Exp $ */
|
||||
/* $NetBSD: x86_machdep.c,v 1.6 2007/01/14 14:03:00 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2005 The NetBSD Foundation, Inc.
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.5 2006/12/26 10:43:44 elad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.6 2007/01/14 14:03:00 ad Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
@ -115,3 +115,17 @@ check_pa_acc(paddr_t pa, vm_prot_t prot)
|
||||
|
||||
return EPERM;
|
||||
}
|
||||
|
||||
/*
|
||||
* Issue the pause instruction (rep; nop) which acts as a hint to
|
||||
* HyperThreading processors that we are spinning on a lock.
|
||||
*
|
||||
* Not defined as an inline, because even if the CPU does not support
|
||||
* HT the delay resulting from a function call is useful for spin lock
|
||||
* back off.
|
||||
*/
|
||||
void
|
||||
x86_pause(void)
|
||||
{
|
||||
__asm volatile("pause");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user