[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 7/7] x86/pv: Rewrite %dr6 handling
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, regs) && v->domain->debugger_attached ) >>>> { >>>> + /* Save debug status register where gdbsx can peek at it */ >>>> + v->arch.dr6 = x86_merge_dr6(v->domain->arch.cpu_policy, >>>> + v->arch.dr6, pending_dbg); >>>> domain_pause_for_debugger(); >>>> return; >>>> } >>>> >>>> - pv_inject_hw_exception(X86_EXC_DB, X86_EVENT_NO_EC); >>>> + pv_inject_DB(pending_dbg); >> ... this, which will merge all new pending bits into the guest's DR6. >> >> If the guest chooses not to clean out DR6 each time, then it will see >> content accumulate. >> >> To your earlier point of shadowing, we already have to do that. DR6 is >> just one of many registers we need to context switch for the vCPU. >> >> PV guests, being ring-deprivieged, trap into Xen for every DR access, >> and Xen handles every one of their #DB exceptions. This is one reason >> why I split the work into several parts. PV guests are easier to get >> sorted properly, and patch 1,2,5,6 are all common improvements relevant >> to HVM too. > That confirms my knowledge. Honestly if I got such a foolish remark > I would question the reviewer's understanding of PV mode (not that you did > anything wrong). Sorry for wasting your time. Not at all. This is exceptionally tricky, and as you can see from the v1 series, don't assume that I know it all perfectly. The specifics of PV guests are unique to Xen, and there are 0 people who understand it fully. For example, doing the sanity testing for this v2 series, I rediscovered the completely undocumented properly that a PV guests IOPL is separate from an architectural ideal of IOPL, defaults to 0 which has the meaning "guest kernel takes a #GP for access to IO ports". Please do continue to ask questions like this if you're not sure. It is not a waste of time cross-checking that the logic is correct. ~Andrew
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |