Changeset 95134 in vbox for trunk/src/VBox/HostDrivers
- Timestamp:
- May 27, 2022 2:50:17 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
r95125 r95134 41 41 #include <iprt/initterm.h> 42 42 #include <iprt/process.h> 43 #include <iprt/thread.h> 43 44 #include <VBox/err.h> 44 45 #include <iprt/mem.h> … … 1733 1734 { 1734 1735 RT_NOREF(fCtxHook); 1735 #if RTLNX_VER_MIN(4,19,0) 1736 #if RTLNX_VER_MIN(4,19,0) /* Going back to 4.19.0 for better coverage, we 1737 probably only need 5.17.7+ in the end. */ 1738 /* 1739 * HACK ALERT! 1740 * 1741 * We'd like to use the old __kernel_fpu_begin() API which was removed in 1742 * early 2019, because we typically run with preemption enabled and have an 1743 * preemption hook installed which will call kernel_fpu_end() in case we're 1744 * scheduled out after getting in here. The preemption hook is almost 1745 * useless if we run with preemption disabled. 1746 * 1747 * For the case where the kernel does not have preemption hooks, we get here 1748 * with preemption already disabled and one more count doesn't make any 1749 * difference. 1750 * 1751 * So, after the kernel_fpu_begin() call we undo the implicit preempt_disable() 1752 * call it does, so the preemption hook can do its work and the VBox user has 1753 * a more responsive system. 1754 * 1755 * See @bugref{10209#c12} and onwards for more details. 1756 */ 1757 Assert(fCtxHook || !RTThreadPreemptIsEnabled(NIL_RTTHREAD)); 1736 1758 kernel_fpu_begin(); 1737 /* if (fCtxHook) */ 1738 preempt_enable(); /* HACK ALERT! undo the implicit preempt_disable() in kernel_fpu_begin(). */ 1739 return true; 1759 # if 0 /* Always do it for now for better test coverage. */ 1760 if (fCtxHook) 1761 # endif 1762 preempt_enable(); 1763 return false; /** @todo Not sure if we have license to use any extended state, or 1764 * if we're limited to the SSE & x87 FPU. If it's the former, 1765 * we should return @a true and the caller can skip 1766 * saving+restoring the host state and save some time. */ 1740 1767 #else 1741 1768 return false; … … 1749 1776 RT_NOREF(fCtxHook); 1750 1777 #if RTLNX_VER_MIN(4,19,0) 1751 /* if (fCtxHook) */ 1752 preempt_disable(); /* HACK ALERT! undo the implicit preempt_enable() in SUPR0FpuBegin(). */ 1778 /* HACK ALERT! See SUPR0FpuBegin for an explanation of this. */ 1779 Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD)); 1780 # if 0 /* Always do it for now for better test coverage. */ 1781 if (fCtxHook) 1782 # endif 1783 preempt_disable(); 1753 1784 kernel_fpu_end(); 1754 1785 #endif
Note:
See TracChangeset
for help on using the changeset viewer.