VCPUOP_send_nmi returns -38

From: Andriy Gapon <avg_at_FreeBSD.org>
Date: Tue, 11 Jan 2022 09:50:53 UTC
Recently I got a report of crashes related to using procstat -k on one of our 
systems.  The system runs FreeBSD 12.2 on an AWS Xen-based instance (can get 
more specifics about it later).

It immediately reminded me of an older issue (Subject: Xen (HVM) and NMI) where 
the root cause was that NMIs were delivered as regular interrupts.
But 12.2 has the newer code that delivers NMIs as NMIs.

After some investigation it became evident that NMIs are not delivered at all.
I modified send_nmi() in sys/x86/xen/xen_apic.c to capture and report errors 
from HYPERVISOR_vcpu_op(VCPUOP_send_nmi) calls.
That revealed that the call returns -38 which appears to mean ENOSYS.

I am not sure what that could mean.
Perhaps NMI is somehow disabled in the Xen configuration (for that specific 
instance type)?
I am out of better ideas.

P.S.
It appears that FreeBSD does not expect that an IPI, including NMI, can fail.
So, there is no way to propagate the error to callers.
I think that we could either printf it or, perhaps, even panic on such a failure.

-- 
Andriy Gapon