Page MenuHomeFreeBSD

D17851.id.diff
No OneTemporary

D17851.id.diff

Index: head/sys/amd64/include/cpu.h
===================================================================
--- head/sys/amd64/include/cpu.h
+++ head/sys/amd64/include/cpu.h
@@ -50,7 +50,6 @@
#define cpu_getstack(td) ((td)->td_frame->tf_rsp)
#define cpu_setstack(td, ap) ((td)->td_frame->tf_rsp = (ap))
#define cpu_spinwait() ia32_pause()
-#define cpu_lock_delay() DELAY(1)
#define TRAPF_USERMODE(framep) \
(ISPL((framep)->tf_cs) == SEL_UPL)
@@ -78,6 +77,7 @@
extern void (*vmm_resume_p)(void);
void cpu_halt(void);
+void cpu_lock_delay(void);
void cpu_reset(void);
void fork_trampoline(void);
void swi_vm(void *);
Index: head/sys/i386/include/cpu.h
===================================================================
--- head/sys/i386/include/cpu.h
+++ head/sys/i386/include/cpu.h
@@ -50,7 +50,6 @@
#define cpu_getstack(td) ((td)->td_frame->tf_esp)
#define cpu_setstack(td, ap) ((td)->td_frame->tf_esp = (ap))
#define cpu_spinwait() ia32_pause()
-#define cpu_lock_delay() DELAY(1)
#define TRAPF_USERMODE(framep) \
((ISPL((framep)->tf_cs) == SEL_UPL) || ((framep)->tf_eflags & PSL_VM))
@@ -73,6 +72,7 @@
extern char etext[];
void cpu_halt(void);
+void cpu_lock_delay(void);
void cpu_reset(void);
void fork_trampoline(void);
void swi_vm(void *);
Index: head/sys/x86/x86/delay.c
===================================================================
--- head/sys/x86/x86/delay.c
+++ head/sys/x86/x86/delay.c
@@ -122,3 +122,22 @@
init_ops.early_delay(n);
TSEXIT();
}
+
+void
+cpu_lock_delay(void)
+{
+
+ /*
+ * Use TSC to wait for a usec if present, otherwise fall back
+ * to reading from port 0x84. We can't call into timecounters
+ * for this delay since timecounters might use spin locks.
+ *
+ * Note that unlike delay_tc(), this uses the TSC even if it
+ * is not P-state invariant. For this function it is ok to
+ * wait even a few usecs.
+ */
+ if (tsc_freq != 0)
+ delay_tsc(1);
+ else
+ inb(0x84);
+}

File Metadata

Mime Type
text/plain
Expires
Fri, Oct 24, 5:30 AM (8 m, 18 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24091051
Default Alt Text
D17851.id.diff (1 KB)

Event Timeline