Re: [PATCH 7/7] x86/pv: Rewrite %dr6 handling

2023-09-18 Thread Jan Beulich
On 15.09.2023 22:36, Andrew Cooper wrote: > All #DB exceptions result in an update of %dr6, but this isn't handled > properly by Xen for any guest type. > > Remove all ad-hoc dr6 handling, leaving it to pv_inject_event() in most cases > and using the new x86_merge_dr6() helper. > > In do_debug(),

Re: [PATCH 7/7] x86/pv: Rewrite %dr6 handling

2023-09-16 Thread Andrew Cooper
On 16/09/2023 2:10 pm, Jinoh Kang wrote: > On 9/16/23 21:56, Andrew Cooper wrote: -/* Save debug status register where guest OS can peek at it */ -v->arch.dr6 |= (dr6 & ~X86_DR6_DEFAULT); -v->arch.dr6 &= (dr6 | ~X86_DR6_DEFAULT); - if ( guest_kernel_mode(v,

Re: [PATCH 7/7] x86/pv: Rewrite %dr6 handling

2023-09-16 Thread Jinoh Kang
On 9/16/23 21:56, Andrew Cooper wrote: >> We don't reset DR6 after reading it, and there is no guarantee that the PV >> guest >> will reset it either, so it doesn't match PENDING_DBG exactly IIRC. >> >> On the other hand, nothing will probably care about its double-accumulating >> quirk except per

Re: [PATCH 7/7] x86/pv: Rewrite %dr6 handling

2023-09-16 Thread Andrew Cooper
On 16/09/2023 8:50 am, Jinoh Kang wrote: > On 9/16/23 05:36, Andrew Cooper wrote: >> diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c >> index dead728ce329..447edc827b3a 100644 >> --- a/xen/arch/x86/traps.c >> +++ b/xen/arch/x86/traps.c >> @@ -1887,11 +1887,11 @@ void do_device_not_availabl

Re: [PATCH 7/7] x86/pv: Rewrite %dr6 handling

2023-09-16 Thread Jinoh Kang
On 9/16/23 05:36, Andrew Cooper wrote: > All #DB exceptions result in an update of %dr6, but this isn't handled > properly by Xen for any guest type. > > Remove all ad-hoc dr6 handling, leaving it to pv_inject_event() in most cases > and using the new x86_merge_dr6() helper. > > In do_debug(), sw

[PATCH 7/7] x86/pv: Rewrite %dr6 handling

2023-09-15 Thread Andrew Cooper
All #DB exceptions result in an update of %dr6, but this isn't handled properly by Xen for any guest type. Remove all ad-hoc dr6 handling, leaving it to pv_inject_event() in most cases and using the new x86_merge_dr6() helper. In do_debug(), swap the dr6 to pending_dbg in order to operate entirel