lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220719181256.GB1379820@ls.amr.corp.intel.com>
Date:   Tue, 19 Jul 2022 11:12:56 -0700
From:   Isaku Yamahata <isaku.yamahata@...il.com>
To:     Chao Gao <chao.gao@...el.com>
Cc:     Yuan Yao <yuan.yao@...ux.intel.com>, isaku.yamahata@...el.com,
        kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
        isaku.yamahata@...il.com, Paolo Bonzini <pbonzini@...hat.com>
Subject: Re: [PATCH v7 053/102] KVM: TDX: don't request
 KVM_REQ_APIC_PAGE_RELOAD

On Tue, Jul 12, 2022 at 02:14:45PM +0800,
Chao Gao <chao.gao@...el.com> wrote:

> On Tue, Jul 12, 2022 at 11:47:43AM +0800, Yuan Yao wrote:
> >On Mon, Jun 27, 2022 at 02:53:45PM -0700, isaku.yamahata@...el.com wrote:
> >> From: Isaku Yamahata <isaku.yamahata@...el.com>
> >>
> >> TDX doesn't need APIC page depending on vapic and its callback is
> >> WARN_ON_ONCE(is_tdx).  To avoid unnecessary overhead and WARN_ON_ONCE(),
> >> skip requesting KVM_REQ_APIC_PAGE_RELOAD when TD.
> 
> !kvm_gfn_shared_mask() doesn't ensure the VM is a TD. Right?


That's right. I changed the check as follows.

commit 6753fc53f3b3fcbbd07ac688578ff5fb7f7f7d96 (HEAD)
Author: Isaku Yamahata <isaku.yamahata@...el.com>
Date:   Wed Mar 30 22:32:03 2022 -0700

    KVM: TDX: don't request KVM_REQ_APIC_PAGE_RELOAD
    
    TDX doesn't need APIC page depending on vapic and its callback is
    WARN_ON_ONCE(is_tdx).  To avoid unnecessary overhead and WARN_ON_ONCE(),
    skip requesting KVM_REQ_APIC_PAGE_RELOAD when TD.
    
      WARNING: arch/x86/kvm/vmx/main.c:696 vt_set_apic_access_page_addr+0x3c/0x50 [kvm_intel]
      RIP: 0010:vt_set_apic_access_page_addr+0x3c/0x50 [kvm_intel]
      Call Trace:
       vcpu_enter_guest+0x145d/0x24d0 [kvm]
       kvm_arch_vcpu_ioctl_run+0x25d/0xcc0 [kvm]
       kvm_vcpu_ioctl+0x414/0xa30 [kvm]
       __x64_sys_ioctl+0xc0/0x100
       do_syscall_64+0x39/0xc0
       entry_SYSCALL_64_after_hwframe+0x44/0xae
    
    Signed-off-by: Isaku Yamahata <isaku.yamahata@...el.com>

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 51ba2d163ec4..bfd7ed6ba385 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -10045,7 +10045,9 @@ void kvm_arch_mmu_notifier_invalidate_range(struct kvm *kvm,
         * Update it when it becomes invalid.
         */
        apic_address = gfn_to_hva(kvm, APIC_DEFAULT_PHYS_BASE >> PAGE_SHIFT);
-       if (start <= apic_address && apic_address < end)
+       /* TDX doesn't need APIC page. */
+       if (kvm->arch.vm_type != KVM_X86_TDX_VM &&
+           start <= apic_address && apic_address < end)
                kvm_make_all_cpus_request(kvm, KVM_REQ_APIC_PAGE_RELOAD);
 }
 

-- 
Isaku Yamahata <isaku.yamahata@...il.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ