[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] xen/wait: Describe RSB safety
- To: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
- Date: Fri, 5 Aug 2022 11:38:40 +0100
- Authentication-results: esa6.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: Fri, 05 Aug 2022 10:39:08 +0000
- Ironport-data: A9a23:aXToTqy2gZGQGtED8J16t+dZxirEfRIJ4+MujC+fZmUNrF6WrkUOm GtLUGyOPa6KZzDzKN9xbISz9ksAuMDXytUyHVRuqSAxQypGp/SeCIXCJC8cHc8zwu4v7q5Dx 59DAjUVBJlsFhcwnj/0bv676yEUOZigHtLUEPTDNj16WThqQSIgjQMLs+Mii8tjjMPR7zml4 LsemOWCfg7+s9JIGjhMsfjb+Esz5K+aVA4w5TTSW9ga5DcyqFFNZH4vDfnZB2f1RIBSAtm7S 47rpF1u1jqEl/uFIorNfofTKiXmcJaLVeS9oiM+t5yZqgpDvkQPPpMTb5LwX6v1ZwKhxLidw P0V3XC5pJxA0qfkwIzxWDEAe81y0DEvFBYq7hFTvOTKp3AqfUcAzN1fFnttE40o2N1ZJlBz5 6JCATYGYjyq0rfeLLKTEoGAh+wmJcjveogepmth3XfSCvNOrZLrGvuQo4UChXFp254ITa22i 8kxMFKDaDzpZRFVN0hRI5U5hOqy3VH0ciFCqULTrq0yi4TW5FMuiuGwaIaFEjCMbf97uEqHv m7nxn/wWRg7CoWA6hbY90v504cjmgukAdlPRdVU7MVCn1m71mEVThoMWjOTg9O0l0q/UNJ3M FEP92wlqq1a3FymSJzxUgO1pFaAvwUAQJxAHusi8gaPx6HIpQGDCQA5oiVpMYJ88pVsHHpzi wHPz4iB6SFTXKO9eGinrZmUnRGJFw8kEH1cPwYCRgcpyoy2yG0stS4jXuqPAYbs0ICkR2+tn GnWxMQtr+5N1JBWjs1X6XiC2mvx/caRE2bZ8y2NBgqYAhVFiJlJjmBCwXzS9r5+IYmQVTFtV 1BUypHFvIji4Xxg/RFhodnh/5nzvp5pyBWG3TZS82AJrlxBAUKLc4FK+y1ZL0x0KMsCcjKBS BaN5FIPv88KbSrwMf4fj2eN5yMCncDd+SnNDKiIPrKinLArHON4wM2eTRHJhD28+KTduao+J Y2aYa6RMJruMow+lWLeb7pMjtcWKtUWnzy7qWbTk0v6itJzpRe9Fd84Dbd5Rrpns/PV+liEr ow32gnj40w3bdASqxL/qeY7RW3m51BibXwqg6S7rtK+Hzc=
- Ironport-hdrordr: A9a23:R8Gfha1zD36yff5xi8ku5QqjBL4kLtp133Aq2lEZdPRUGvb3qy nIpoV96faUskd0ZJhOo7C90cW7LU80lqQFhLX5X43SPzUO0VHAROoJgLcKqweQfREWndQ96U 4PScdD4aXLfDpHsfo=
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
It turns out that we do in fact have RSB safety here, but not for obvious
reasons.
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/common/wait.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/xen/common/wait.c b/xen/common/wait.c
index e45345ede704..1a3b348a383a 100644
--- a/xen/common/wait.c
+++ b/xen/common/wait.c
@@ -210,6 +210,26 @@ void check_wakeup_from_wait(void)
}
/*
+ * We are about to jump into a deeper call tree. In principle, this risks
+ * executing more RET than CALL instructions, and underflowing the RSB.
+ *
+ * However, we are pinned to the same CPU as previously. Therefore,
+ * either:
+ *
+ * 1) We've scheduled another vCPU in the meantime, and the context
+ * switch path has (by default) issued IPBP which flushes the RSB, or
+ *
+ * 2) We're still in the same context. Returning back to the deeper
+ * call tree is resuming the execution path we left, and remains
+ * balanced as far as that logic is concerned.
+ *
+ * In fact, the path though the scheduler will execute more CALL than
+ * RET instructions, making the RSB unbalanced in the safe direction.
+ *
+ * Therefore, no actions are necessary here to maintain RSB safety.
+ */
+
+ /*
* Hand-rolled longjmp().
*
* check_wakeup_from_wait() is always called with a shallow stack,
--
2.11.0
|