On Fri, May 13, 2022 at 11:22 AM Jue Wang <juew@xxxxxxxxxx> wrote: > > This patch series implement emulation for Corrected Machine Check > Interrupt (CMCI) signaling and UnCorrectable No Action required (UCNA) > error injection. Can you add some selftest or kvm-unit-test coverage for this feature? I imagine selftests would be the best approach so that you can control both the guest and the VMM (e.g. you can inject a CMCI/UCNA error from the test and then make sure it makes it into the guest properly according to how the Local APIC has been programmed). > > UCNA errors signaled via CMCI allow a guest to be notified as soon as > uncorrectable memory errors get detected by some background threads, > e.g., threads that migrate guest memory across hosts or threads that > constantly scan system memory for errors [1]. > > Upon receiving UCNAs, guest kernel isolates the poisoned pages which may > still be free, preventing future accesses that may cause fatal MCEs. > > 1. https://lore.kernel.org/linux-mm/8eceffc0-01e8-2a55-6eb9-b26faa9e3caf@xxxxxxxxx/t/ > > > Patch 1-3 clean up KVM APIC LVT logic. > > Patch 4 adds CMCI emulation to lapic. > > Patch 5 updates the allocation of mce_array to use array allocation api: > kcalloc. > > Patch 6 adds emulation for the per-bank MSR_IA32_MCx_CTL2 MSRs that > controls CMCI signaling. > > Patch 7 enables MCG_CMCI_P on x86 and handles injected UCNA errors. > > > v3 changes > - Incorporate feedback from Sean Christopherson <seanjc@xxxxxxxxxx> > - Split clean up to KVM APIC LVT logic to 3 patches. > - Put the clean up of mce_array allocation in a separate patch. > - Base the MCi_CTL2 register emulation on Sean's clean up and fix > series [2] > - Fix bugs around MCi_CTL2 register offset validation and the free of > mci_ctl2_banks array. > - Rewrite the change log with more details in architectural information > about CMCI, UCNA and MCG_CMCI_P. > - Fix various comments and wrapping style. > > 2. https://lore.kernel.org/lkml/20220512222716.4112548-1-seanjc@xxxxxxxxxx/T/ > > > v2 chanegs > - Incorporate feedback from Sean Christopherson <seanjc@xxxxxxxxxx> > - Split the single patch into 4: > 1). clean up KVM APIC LVT logic > 2). add CMCI emulation to lapic > 3). add emulation of MSR_IA32_MCx_CTL2 > 4). enable MCG_CMCI_P and handle injected UCNAs > - Fix various style issues. > > Jue Wang (7): > KVM: x86: Make APIC_VERSION capture only the magic 0x14UL. > KVM: x86: Fill apic_lvt_mask with enums / explicit entries. > KVM: x86: Add APIC_LVTx() macro. > KVM: x86: Add Corrected Machine Check Interrupt (CMCI) emulation to > lapic. > KVM: x86: Use kcalloc to allocate the mce_banks array. > KVM: x86: Add emulation for MSR_IA32_MCx_CTL2 MSRs. > KVM: x86: Enable MCG_CMCI_P and handle injected UCNAs. > > arch/x86/include/asm/kvm_host.h | 1 + > arch/x86/kvm/lapic.c | 58 +++++++--- > arch/x86/kvm/lapic.h | 15 ++- > arch/x86/kvm/vmx/vmx.c | 1 + > arch/x86/kvm/x86.c | 182 +++++++++++++++++++++++++------- > 5 files changed, 200 insertions(+), 57 deletions(-) > > -- > 2.36.0.550.gb090851708-goog >