[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/5] x86/pv: Fix the determiniation of whether to inject #DB
- To: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
- Date: Wed, 13 Sep 2023 00:21:09 +0100
- Authentication-results: esa4.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>, Jinoh Kang <jinoh.kang.kr@xxxxxxxxx>
- Delivery-date: Tue, 12 Sep 2023 23:21:42 +0000
- Ironport-data: A9a23:3t7r/65G8mg84RJrkWikRQxRtBDHchMFZxGqfqrLsTDasY5as4F+v jEXDzyOOPeOMDH0Lt9wYY3g9EJTvsPVz9JgT1M4/CxhHi5G8cbLO4+Ufxz6V8+wwm8vb2o8t plDNYOQRCwQZiWBzvt4GuG59RGQ7YnRG/ykTraCY3gtLeNdYH9JoQp5nOIkiZJfj9G8Agec0 fv/uMSaM1K+s9JOGjt8B5mr9lU35pwehBtC5gZlPaES5geD/5UoJMl3yZ+ZfiOQrrZ8RoZWd 86bpJml82XQ+QsaC9/Nut4XpWVTH9Y+lSDX4pZnc/DKbipq/0Te4Y5iXBYoUm9Fii3hojxE4 I4lWapc6+seFvakdOw1C3G0GszlVEFM0OevzXOX6aR/w6BaGpdFLjoH4EweZOUlFuhL7W5m8 9tGdhxcLTe6xPOG+6K6eLFqhJ8vM5y+VG8fkikIITDxCP8nRdbIQrnQ5M8e1zA17ixMNa+AP YxDM2MpNUmeJUQVYT/7C7pn9AusrlD5fydVtxS+oq0v7nKI5AdwzKLsIJzefdniqcB9xxzF/ zyWozigav0cHNbCzSGL70P1vcDKrATWcbMCNJKI6Nc/1TV/wURMUUZLBDNXu8KRmkO4Ht5SN UEQ0i4vtrQpslymSMHnWB+1q2LCuQQTM/JyOeAn7ACGyoLP/h2UQGMDS1Zpd9gOpMIwAzsw2 TehndLvAjwps7STRjSe7J+bqDqzPW4eKmpqWMMfZVJbuZ+5+th110+RCI85S8ZZk+EZBxn25 G7UgHl9oIxQnP4wx6SJpVbF2D6z882hohEO2i3bWWes7wVcbYGjZpC15VWz0cusPLp1XXHa4 iFaxpH2APQmSMjUyXfTGLll8KSBva7tDdHKvbJ483DNHRyJ8mXrQ41f6SoWyKxBYpddIm+Bj KM+VGpsCH5v0JmCN/8fj2GZUZ5CIU3c+TPND6q8Uza2SsItHDJrBQk3DaJq40jjkVI3jYY0M oqBfMCnAB4yUPo2kGfqHLlAiOJ2n0jSIF8/orihk3yaPUe2PibJGd/pznPeBgzG0E90iFqMq IsOXyd74x5eTPf/ckHqHX07dDg3wYwALcmu8aR/L7fTSjeK7Ul9U5c9N5t9Id0690mU/8+Ul kyAtrhwkQOh3iWXcFvSOxiOqtrHBP5CkJ7yBgR0VX7A5pTpSdzHAHs3H3fvQYQayQ==
- Ironport-hdrordr: A9a23:Rtgxxq92BiJh1OibzVZuk+DiI+orL9Y04lQ7vn2ZHyYlFfBw8P re/8jztCWVtN9/YhodcLy7UpVoIkm8yXcW2+Ys1OyZLW3bUQKTRelfBO3ZrgEIcBeRygcy78 tdmwcVMqyXMbDX5/yKgjVRsrwbsby6zJw=
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
We long ago fixed the emulator to not inject exceptions behind our back.
Therefore, assert that that a PV event (including interrupts, because that
would be buggy too) isn't pending, rather than skipping the #DB injection if
one is.
On the other hand, the io_emul() stubs which use X86EMUL_DONE rather than
X86EMUL_OKAY may have pending breakpoints to inject after the IO access is
complete, not to mention a pending singlestep.
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>
CC: Jinoh Kang <jinoh.kang.kr@xxxxxxxxx>
---
xen/arch/x86/pv/emul-priv-op.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 142bc4818cb5..257891a2a2dd 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -1358,14 +1358,18 @@ int pv_emulate_privileged_op(struct cpu_user_regs *regs)
switch ( rc )
{
case X86EMUL_OKAY:
+ case X86EMUL_DONE:
+ ASSERT(!curr->arch.pv.trap_bounce.flags);
+
if ( ctxt.ctxt.retire.singlestep )
ctxt.bpmatch |= DR_STEP;
+
if ( ctxt.bpmatch )
{
curr->arch.dr6 |= ctxt.bpmatch | DR_STATUS_RESERVED_ONE;
- if ( !(curr->arch.pv.trap_bounce.flags & TBF_EXCEPTION) )
- pv_inject_hw_exception(X86_EXC_DB, X86_EVENT_NO_EC);
+ pv_inject_hw_exception(X86_EXC_DB, X86_EVENT_NO_EC);
}
+
/* fall through */
case X86EMUL_RETRY:
return EXCRET_fault_fixed;
--
2.30.2
|