Xen (HVM) and NMI

Andriy Gapon avg at FreeBSD.org
Fri Nov 8 13:15:46 UTC 2019


On 08/11/2019 11:57, Roger Pau Monné wrote:
> On Fri, Nov 08, 2019 at 10:19:01AM +0200, Andriy Gapon wrote:
>>> I found this in Linux code:
>>>     HYPERVISOR_vcpu_op(VCPUOP_send_nmi, xen_vcpu_nr(cpu), NULL);
>>> It's in xen_send_IPI_one().
>>> I wonder if that's that or if there is more to this than meets the eye.
> 
> Yes, something along this lines should work, we could even use the
> native NMI signaling using the local APIC, but the hypercall shortcut
> should be faster in most cases.
> 
>> I also found this in an old post.
>> Ian Campbell wrote:
>>> You need to register a callback with CALLBACKOP_register
>>> CALLBACKTYPE_nmi. You also need to write the code in entry.S to receive
>>> that callback. IIRC you also need to arrange that returning from an NMI
>>> is always done with HYPERVISOR_iret and not optimised to a direct iret
>>> as it can be otherwise. This is to allow the hypervisor to implement NMI
>>> masking correctly.
> 
> That's AFAIK for PV guests which use a completely different mechanism
> in order to receive interrupts. None of this is needed for FreeBSD
> because there's no classic PV support.

Perhaps HYPERVISOR_iret is still needed even for us?
This is said with zero knowledge of the topic.

> Can you try the patch below?

I tried it and, unfortunately, it was not a success.  And I don't have much
diagnostic.
My test was:
- run a busy process, I used dd if=/dev/random of=/dev/null bs=16k
- run procstat -kk on that process
After this the test system locked up hard and I could not get anything out of
it.  It being an EC2 instance did not help either.
Unfortunately, I do not have any local Xen deployment.

-- 
Andriy Gapon


More information about the freebsd-xen mailing list