Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F178140283
D62206.1796089258.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
674 B
Referenced Files
None
Subscribers
None
D62206.1796089258.diff
View Options
diff --git a/sys/amd64/amd64/fpu.c b/sys/amd64/amd64/fpu.c
--- a/sys/amd64/amd64/fpu.c
+++ b/sys/amd64/amd64/fpu.c
@@ -820,8 +820,17 @@
{
if ((td->td_pflags & TDP_KTHREAD) != 0 || !PCB_USER_FPU(td->td_pcb)) {
- PCPU_SET(fpcurthread, NULL);
- fpu_disable();
+ /*
+ * CR0.TS is clear only while a thread owns the FPU, and the
+ * only possible owner here is the old thread.
+ */
+ if (PCPU_GET(fpcurthread) != NULL) {
+ PCPU_SET(fpcurthread, NULL);
+ fpu_disable();
+ } else {
+ KASSERT((rcr0() & CR0_TS) != 0,
+ ("%s: CR0.TS clear without FPU owner", __func__));
+ }
} else if (PCPU_GET(fpcurthread) != td) {
restore_fpu_curthread(td);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 1, 1:40 AM (23 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42113037
Default Alt Text
D62206.1796089258.diff (674 B)
Attached To
Mode
D62206: amd64: Avoid redundant CR0 writes on switches to kernel threads
Attached
Detach File
Event Timeline