[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 4/7] x86/pv: Drop priv_op_ctxt.bpmatch and use pending_dbg instead
On 16/09/2023 8:36 am, Jinoh Kang wrote: > On 9/16/23 05:36, Andrew Cooper wrote: >> @@ -658,7 +660,7 @@ static int cf_check rep_ins( >> >> ++*reps; >> >> - if ( poc->bpmatch || hypercall_preempt_check() ) >> + if ( poc->ctxt.retire.pending_dbg || hypercall_preempt_check() ) >> break; >> >> /* x86_emulate() clips the repetition count to ensure we don't >> wrap. */ > (snip) > >> @@ -726,7 +729,7 @@ static int cf_check rep_outs( >> >> ++*reps; >> >> - if ( poc->bpmatch || hypercall_preempt_check() ) >> + if ( poc->ctxt.retire.pending_dbg || hypercall_preempt_check() ) >> break; >> >> /* x86_emulate() clips the repetition count to ensure we don't >> wrap. */ > These two hunks look like a behavioral change in singlestep mode. > > This is actually a fix, assuming the emulator previously did not handle > 'rep {in,out}s' in singlestep mode correctly, since it now checks for > PENDING_DBG.BS in addition to PENDING_DBG.B[0-4]. The emulator should handle this correctly already. I had been meaning to test this, but hadn't so far - guess I should fix that. x86_emulate.c line 511 in get_rep_prefix() sets max_reps to 1 if SingleStepping is active. This in turn causes the emulator to use the io_{read,write}() hook rather than the rep hook. This is important, because singlestepping becoming pending is normally evaluated at the end of the instruction. i.e. in this example it wouldn't show up in pending_dbg (yet). What definitely is broken here is the recognition of a data breakpoint on the memory operand of the INS/OUTS instruction, but it's broken everywhere else for PV guest emulation too, so needs to go on the TODO list. > If this is the case, (at least) this part of the patch looks like a stable > candidate. You might want to edit the commit message to reflect that. We're going to try and get all the %dr6 handling issues sorted, then decide whether to backport the lot or not. It will entirely depend on how invasive the fixes end up being, but I hope they'll be ok to backport. > (Ideally all the HWBP handling should be part of the emulator logic, but > I don't see an easy way to generalize the PV-specific logic. It could > be its own patch anyway.) The emulator does have HWBP handling for HVM guests, because that's architectural behaviour to look in the TSS. PV guests are the odd-ones-out with non-standard behaviour. ~Andrew
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |