[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] x86/flushtlb: remove flush_area check on system state
- To: Roger Pau Monne <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
- Date: Mon, 16 May 2022 14:47:20 +0000
- Accept-language: en-GB, en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GrZuouA6oEommE4sLjASyksaMTj+J+pY0ygEu41Tl/E=; b=CcXgpDZIjiJ7cizXcs5xDrJgqukYMld70DE7kHa1R7nqLgN2hEbNW32uaMR6FXwdBa0ERWaIVOxhYhEyEVe15w3f5T6TwTXBf5Vg4jxz11BfeAIQPHIdxzzJrJgAsmkAtAVRn7DZd1M5lGvPAdBEYLEWTfZoFhMsZonlqZO2Yfluz3KDqTkgb9FvrCVK2WBa7zpg3x2Yjf7WNmEZOb+Lq1/1CdTM0H6oLGINLElsMj+bpAru+TcUATemWB4aAV0Krl1o0h1sm5tAgCRavIiPk2c4qpn83OD4s5vUrq0xRLQyKHZXjHr78vnvioW87QlguE6LEPJ972Kgr/E9I1fSYg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gY9fGxznmxu2pna5gMyicrakYkbeOEdWer/kJTds3Xe0Cz3qph1TSxQmScXfsmZGaVr6OvFoiKtEXivjlDrJ68MNidQ9DCgWUjSn71icAxAES7oGIOGe/+yJWYGxouHonzmLOGvEkbWBLqkjiLlek3YP8YuIrfp32xLtLH0+DiL5HOMPbmy14Xghi6Gyk8ivqzyT7XoS4/mn8LpPgUPuFeHFdpQ099uX2SdMX3+SYCGdMhTc3ggZ6IIatWOSXnqkxvz5oZ4dPOvtg4D2GeM/C4OOfFxYNXXCIxbYgw/EOSw5vAl9TpLJwTYl+1hanG6XIOzjdeBE45OEIXJQD4w5Vw==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: Jan Beulich <jbeulich@xxxxxxxx>, Wei Liu <wl@xxxxxxx>
- Delivery-date: Mon, 16 May 2022 14:48:12 +0000
- Ironport-data: A9a23:75ZUU6/t9RWB+W36Q5DBDrUD8n+TJUtcMsCJ2f8bNWPcYEJGY0x3n 2BLDWyDP/7YYjShedpxOo3noRwGu5fTxtNrTQdpryw8E34SpcT7XtnIdU2Y0wF+jyHgoOCLy +1EN7Es+ehtFie0Si+Fa+Sn9T8mvU2xbuKU5NTsY0idfic5DnZ44f5fs7Rh2NQw3IHnW1rlV e7a+KUzBnf0g1aYDUpMg06zgEsHUCPa4W5wUvQWPJinjXeG/5UnJMt3yZKZdhMUdrJ8DO+iL 9sv+Znilo/vE7XBPfv++lrzWhVirrc/pmFigFIOM0SpqkAqSiDfTs/XnRfTAKtao2zhojx/9 DlCnayTRkR2Oq3oo90AWBRWPDsmAq5+xZaSdBBTseTLp6HHW13F5q00SXoQZMgf8OsxBnxS/ /sFLjxLdgqEm++93LO8TK9rm9gnK87oeogYvxmMzxmAVapgHc+FHvqMuYMwMDQY36iiGd73Y cYDZCUpRxPHexBVYX8cCY4knffujX76G9FdgA3M//VuszOCpOB3+JWzb8uWXfuPfNtIv0GAu GzdpWrdPQ5PYbRzzhLAqBpAnNTnjS79HY4fCrC83vprm0GIgHweDgUMUlm2quX/jVSxM/pdI UEJ/islrYAp6VemCNL6WnWQv3qsrhMaHd1KHIUHBBqlz6PV50OCADENSDdEMIYirJVuGWBs0 UKVldT0AzApqKeSVX+W6raTq3W1JDQRKmgBIyQDSGPp/uXenW36tTqXJv4LLUJ/poOlcd0s6 1hmdBQDuog=
- Ironport-hdrordr: A9a23:gyv/D6HLTBONcVojpLqFsZLXdLJyesId70hD6qkvc3Fom52j/f xGws5x6fatskdrZJkh8erwW5Vp2RvnhNJICPoqTM2ftW7dySSVxeBZnMbfKljbdxEWmdQtsp uIH5IeNDS0NykDsS+Y2nj3Lz9D+qjgzEnAv463oBlQpENRGthdBmxCe2Sm+zhNNW177O0CZf +hD6R8xwaISDAyVICWF3MFV+/Mq5ngj5T9eyMLABYh9U2nkS6owKSSKWnZ4j4uFxd0hZsy+2 nMlAL0oo+5teug9xPa32jPq7xLhdrazMdZDsDksLlXFtyssHfrWG1SYczHgNkHmpDp1L/sqq iLn/4UBbU315oWRBDtnfKi4Xi57N9k0Q6e9bbRuwqenSW+fkN6NyMJv/MmTvOSgXBQw+1Uwe ZF2XmUuIFQCg6FlCPh58LQXxUvjUasp2E++NRjx0C3fLFuHoO5l7ZvtX+90a1wbh7S+cQiCq 1jHcvc7PFZfReTaG3YpHBmxJipUm4oFhmLT0AesojNugIm1kxR3g8d3ogSj30A/JUyR91N4P nFKL1hkPVLQtUNZaxwCe8dSY+8C3DLQxjLLGWOSG6XX50vKjbIsdr68b817OaldNgBy4Yzgo 3IVBdCuWs7ayvVeLqzNV1wg2TwqUmGLETQI5tllulEU5XHNcnWGDzGTkwymM29pPhaCtHHWp +ISedrP8M=
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHYaTGgFt663HYNJUGkqeLNHlrlz60hlU0A
- Thread-topic: [PATCH] x86/flushtlb: remove flush_area check on system state
On 16/05/2022 15:31, Roger Pau Monne wrote:
> Booting with Shadow Stacks leads to the following assert on a debug
> hypervisor:
>
> (XEN) [ 11.625166] Assertion 'local_irq_is_enabled()' failed at
> arch/x86/smp.c:265
> (XEN) [ 11.629410] ----[ Xen-4.17.0-10.24-d x86_64 debug=y Not tainted
> ]----
> (XEN) [ 11.633679] CPU: 0
> (XEN) [ 11.637834] RIP: e008:[<ffff82d040345300>]
> flush_area_mask+0x40/0x13e
> [...]
> (XEN) [ 11.806158] Xen call trace:
> (XEN) [ 11.811255] [<ffff82d040345300>] R flush_area_mask+0x40/0x13e
> (XEN) [ 11.816459] [<ffff82d040338a40>] F modify_xen_mappings+0xc5/0x958
> (XEN) [ 11.821689] [<ffff82d0404474f9>] F
> arch/x86/alternative.c#_alternative_instructions+0xb7/0xb9
> (XEN) [ 11.827053] [<ffff82d0404476cc>] F alternative_branches+0xf/0x12
> (XEN) [ 11.832416] [<ffff82d04044e37d>] F __start_xen+0x1ef4/0x2776
> (XEN) [ 11.837809] [<ffff82d040203344>] F __high_start+0x94/0xa0
>
>
> This is due to SYS_STATE_smp_boot being set before calling
> alternative_branches(), and the flush in modify_xen_mappings() then
> using flush_area_all() with interrupts disabled. Note that
> alternative_branches() is called before APs are started, so the flush
> must be a local one (and indeed the cpumask passed to
> flush_area_mask() just contains one CPU).
>
> Take the opportunity to simplify a bit the logic and make flush_area()
> an alias for flush_area_mask(&cpu_online_map...), taking into account
> that cpu_online_map just contains the BSP before APs are started.
> This requires widening the assert in flush_area_mask() to allow
> being called with interrupts disabled as long as it's strictly a local
> only flush.
>
> The overall result is that a conditional can be removed from
> flush_area().
>
> Fixes: (78e072bc37 'x86/mm: avoid inadvertently degrading a TLB flush to
> local only')
> Suggested-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Tentatively Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
This seems like the least bad option of a lot of bad options. I'd say
it's more than just removing a conditional from flush_area(); it's
removing a runtime special case for init-time code.
~Andrew
|