[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] x86/irq: Improve local_irq_restore() code generation and performance
- To: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
- Date: Mon, 6 Dec 2021 13:38:28 +0000
- Authentication-results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
- Delivery-date: Mon, 06 Dec 2021 13:38:54 +0000
- Ironport-data: A9a23:DDlvNqCLCZOGTBVW/xLkw5YqxClBgxIJ4kV8jS/XYbTApDwmhjUBx jRNDGmCOK3cajehfIp+atu/8kgPvZfWnNIxQQY4rX1jcSlH+JHPbTi7wuYcHM8wwunrFh8PA xA2M4GYRCwMo/u1Si6FatANl1ElvU2zbue6WLGs1hxZH1c+EX570Uw7wobVv6Yz6TSHK1LV0 T/Ni5W31G+Ng1aY5UpNtspvADs21BjDkGtwUm4WPJinj3eH/5UhN7oNJLnZEpfNatI88thW5 Qr05OrREmvxp3/BAz4++1rxWhVirrX6ZWBihpfKMkQLb9crSiEai84G2PQghUh/jC+jhdNK4 9V0qL+aa1x0favcucItakwNe81+FfUuFL7vJHG+tYqYzlHccmuqyPJrZK00FdRGoKAtWzgIr KFGbmBWBvyAr7veLLaTY+9gnMk8auLsO5sSoCpIxjDFF/c2B5vERs0m4PcFjWhs2p4RRp4yY eIabBtJQhaQZyESFWsJKYBhs8L4in7gJmgwRFW9+vNsvjm7IBZK+KfpGMrYfJqNX8o9tmSyq 3/C/m/5KgoHL9HZwj2Amlq8i+mKkS7lVYY6ELyj6uUskFCV3nYUChAdSR28u/bRt6Klc4sBc QpOoHNo9PVsshzwJjXgY/GmiHmelAQfYPFQKvAZwiPWl+nS8ye/NlFRG1atd+canMMxQDUr0 Hq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QlEYQunqvbTw5dLbSC9DIyRixBiFjDuu5rK/OQOfxA0iXzRGxqpn2X TZkjb++r6ov5iAu1zhPi7ontZrcenau59+7f+3+48owwDX+0OVjN4IYcz9gNl6mpDo1L9gqq ixn/5pBbUD15qWRBDtnfMosDOQiwrHLBTZuAelaDLY0LzErGdTMbsyuatJNhTe8EYup9d6ze ZC2H+YrYNeCVfakD36/MWgbWAkqqOYmwturQcotQ0SbWLeUs4ZkaUPuEdOVJsQFiPz744qVO FoEcHH/f5TNUiXanjI11MfiuBFdhwIb2K7qmFrgL3n79GXpgEz86I1/r1pop4wzuN0d3Af3Z WxDk1BrsA5cvMr
- Ironport-sdr: tlTJxcwR8AbYtJyTpjGo0Pkh/WsShdyJCJfDD0UNxjIB2hqhbpmgjkTWVKzefjRwOKxNAjdHSn Ar6TFbmeMOWalMI9w30orSGt8CE8F8G6bfhjvN80Kz6r9+aI+wqZByo6UIjmqX0Tg6HFcbkyeq l2r6xWrF1zCqTic0/IE0iRlT3VYe9c8zH7a2qfL2WNFshR9Sypm9ZphIu9p1wZEBwRULSIOpjR M7dxGmwsXFVcDmU+zItu6pWTx9/fwc55QdHw8XZy1/c6YbUT0EDeW54Nz1K5ZJ2BpiOY1dZfIx 8wlqEZaP+zU+28nChD6Rp0Ry
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
popf is a horribly expensive instruction, while sti is an optimised fastpath.
Switching popf for a conditional branch and sti caused an 8% perf improvement
in various linux measurements.
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>
CC: Wei Liu <wl@xxxxxxx>
---
xen/include/asm-x86/system.h | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/xen/include/asm-x86/system.h b/xen/include/asm-x86/system.h
index 65e63de69a67..4be235472ecd 100644
--- a/xen/include/asm-x86/system.h
+++ b/xen/include/asm-x86/system.h
@@ -267,13 +267,8 @@ static inline unsigned long
array_index_mask_nospec(unsigned long index,
})
#define local_irq_restore(x) \
({ \
- BUILD_BUG_ON(sizeof(x) != sizeof(long)); \
- asm volatile ( "pushfq\n\t" \
- "andq %0, (%%rsp)\n\t" \
- "orq %1, (%%rsp)\n\t" \
- "popfq" \
- : : "i?r" ( ~X86_EFLAGS_IF ), \
- "ri" ( (x) & X86_EFLAGS_IF ) ); \
+ if ( (x) & X86_EFLAGS_IF ) \
+ local_irq_enable(); \
})
static inline int local_irq_is_enabled(void)
--
2.11.0
|