Re: exception vs SIGALRM race (was: Re: guest/host mem out of sync on core2duo?)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jun 20, 2021 at 7:34 PM stsp <stsp2@xxxxxxxxx> wrote:
>
> 19.06.2021 00:07, Jim Mattson пишет:
> > I believe DS is illegal. Per the SDM, Checks on Guest Segment Registers:
> OK, so this indeed have solved
> the biggest part of the problem,
> thanks again.
>
> Now back to the original problem,
> where I was getting a page fault
> on some CPUs sometimes.
> I digged a bit more.
> It seems I am getting a race of
> this kind: exception in guest happens
> at the same time when the host's
> SIGALRM arrives. KVM returns to
> host with the exception somehow
> "pending", but its still on ring3, not
> switched to the ring0 handler.
>
> Then from host I inject the interrupt
> (which is what SIGALRM asks for),
> and when I enter the guest, it throws
> the pending exception instead of
> executing the interrupt handler.
> I suspect the bug is again on my side,
> but I am not sure how to handle that
> kind of race. I suppose I need to look
> at some interruptibility state to find
> out that the interrupt cannot be injected
> at that time. But I can't find if KVM
> exports the interruptibility state, other
> than guest's IF/VIF flag, which is not
> enough in this case.

Maybe what you want is run->ready_for_interrupt_injection? And, if
that's not set, try KVM_RUN with run->request_interrupt_window set?

> Also I am a bit puzzled why I can't
> see such race on an I7 CPU even
> after disabling the unrestricted_guest.
>
> Any ideas? :)

I'm guessing that your core2duo doesn't have a VMX preemption timer,
and this has some subtle effect on how the alarm interrupts VMX
non-root operation. On the i7, try setting the module parameter
preemption_timer to 0.




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux