On Sat, Feb 13, 2010 at 07:41:35PM +0100, Jan Kiszka wrote: > Gleb Natapov wrote: > > On Sat, Feb 13, 2010 at 06:49:44PM +0100, Jan Kiszka wrote: > >> Gleb Natapov wrote: > >>> On Sat, Feb 13, 2010 at 10:51:40AM +0100, Jan Kiszka wrote: > >>>> From: Jan Kiszka <jan.kiszka@xxxxxxxxxxx> > >>>> > >>>> VMX requires a properly set instruction length VM entry field when > >>>> trying to inject soft exception and interrupts. We have to preserve this > >>>> state across VM save/restore to avoid breaking the re-injection of such > >>>> events on Intel. So add it to the new VCPU event state. > >>>> > >>> We shouldn't re-inject soft exceptions/interrupts after migration, but > >>> re-execute instruction instead. Instruction length field doesn't exist > >>> on SVM and migration shouldn't expose implementation details. > >>> > >> Hmm, then I guess this totally untested patch should fly: > >> > > I don't understand what problem are you trying to solve by your patch. > > During normal operation event_exit_inst_len will be set to correct > > value. After migration rip will point to int instruction an no even will > > be pending at all. Here is the patch: > > The patch will cause an endless loop if BP interception is enabled. > How? This code path is not executed normally. > What is the purpose of keeping event_exit_inst_len around? Either we > need it also across user space exists, then we have to save/restore or > reconstruct it, or we don't need it, then simply drop it. > Why we need to save/restore is if we need it across user space exits? We need to save/restore it only if we nedd it across migration. When exception happens during soft interrupt/exception delivery soft i/e should be retried somehow. There are two ways to do that. First one is just reenter guest with the same rip. Instruction will be reexecuted and event redelivered. Another is to reinject event via event reinjection mechanism and for that we need to tell CPU how to calculate rip of a next instruction and this is done by providing event_exit_inst_len. The problem is that SVM supports only the first way. Intel advised us to use reinjection mechanism, so that what we use on VMX, but since migration can happen from Intel to AMD and vice versa we chose to reexecute instruction after migration on those rare occasions that migration happens exactly after intercepted soft i/e. -- Gleb. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html