FreeBSD Bugzilla – Attachment 198774 Details for
Bug 228768
EARLY_AP_STARTUP causes panic on amd machines
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
lock_delay.patch
file_228768.txt (text/plain), 1.54 KB, created by
John Baldwin
on 2018-10-30 17:10:55 UTC
(
hide
)
Description:
lock_delay.patch
Filename:
MIME Type:
Creator:
John Baldwin
Created:
2018-10-30 17:10:55 UTC
Size:
1.54 KB
patch
obsolete
>Index: sys/kern/kern_mutex.c >=================================================================== >--- sys/kern/kern_mutex.c (revision 339923) >+++ sys/kern/kern_mutex.c (working copy) >@@ -1206,7 +1206,7 @@ > > ldap->spin_cnt++; > if (ldap->spin_cnt < 60000000 || kdb_active || panicstr != NULL) >- DELAY(1); >+ cpu_lock_delay(); > else { > td = mtx_owner(m); > >Index: sys/x86/include/x86_var.h >=================================================================== >--- sys/x86/include/x86_var.h (revision 339923) >+++ sys/x86/include/x86_var.h (working copy) >@@ -119,6 +119,7 @@ > bool acpi_get_fadt_bootflags(uint16_t *flagsp); > void *alloc_fpusave(int flags); > void busdma_swi(void); >+void cpu_lock_delay(void); > bool cpu_mwait_usable(void); > void cpu_probe_amdc1e(void); > void cpu_setregs(void); >Index: sys/x86/x86/delay.c >=================================================================== >--- sys/x86/x86/delay.c (revision 339923) >+++ sys/x86/x86/delay.c (working copy) >@@ -110,3 +110,28 @@ > 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. >+ */ >+ if (tsc_freq != 0) { >+ uint64_t end, freq, now; >+ >+ sched_pin(); >+ freq = tsc_freq; >+ now = rdtsc(); >+ end = now + freq / 1000000; >+ do { >+ cpu_spinwait(); >+ now = rdtsc(); >+ } while (now < end); >+ sched_unpin(); >+ } else >+ inb(0x84); >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 228768
: 198774