Received: by 2002:a05:6358:795:b0:dc:4c66:fc3e with SMTP id n21csp1440455rwj; Sun, 30 Oct 2022 00:22:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM70mxoYIVG47AcPF5NnZoeZH8o+XTwpP0oePMBolz+zOjs7NMkxRJMawa6V0X6oFA6ZStyu X-Received: by 2002:a17:90a:1197:b0:212:cfa7:8388 with SMTP id e23-20020a17090a119700b00212cfa78388mr8486015pja.4.1667114561141; Sun, 30 Oct 2022 00:22:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667114561; cv=none; d=google.com; s=arc-20160816; b=zAnGIceSIDGyYeCuvm7ngqnm82y9SFeXqvRhHHKdzZDAHZdvLi99WQEW3ud39uQ5L5 Vz+7rZqF0IB3JgkfelnocyUqGkiUsWLfWFZWbqh5SEUWT3GCg/CNmLoTbffXMKfqLSB+ CVbXUfAFiLaU6yAymrRBqMc9DXPBKi1BFzufX3lXTEs1d5wVUcHoXbp8IJ1vG1f3EnQb GiN8LkX/4UoPZ7Y7uwL8Y1mHXXwiipjFeLD9Ms0Z3o7c9ygQK7ZnHApk/SPJq4xI1Wwb 9J05J7YqbIQE9883b4AMhRZS/0ofk1dcaW8/2s7WU+7BkwzR6mixvzBcMClO5RQubKd1 /sfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=me9bWRiTZ5mTreuBxbpHPwy2YoWGfS4FgLnMaxiHSls=; b=BSgmkXgsm6E5fbP06CpShb6UpTUXpDyasTt1+rVfo0KpEggxbMZt74pWp6fBX6wwBX ZonAsGmQiBdxdYbqXnmUkIIwHeMQD+eklWnOJTD/nMKagWbhYWADmt+skRhey1m8HioM AzQqRTSMc1Oy7zYic1zjt/SFMjBbuWYdRENPxJ6mYhu+S+4bS2vktuMRHYTAn+CnlT4N D5KXLJcQ+Z+0CWQqm/W7GK7LhWWgFq2g0kY9HX5oBE5FwsMa4p55dIUCltLPe1Ca2eRZ gzsldyCP8/Cgj1xRTMui9GbwNJ2r7EjtHvSY2akokl/lnqmTmEzhY8Hyg4R2672waMMG rj7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PTtuyg9C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q21-20020a63d615000000b00442e77a852dsi4661863pgg.509.2022.10.30.00.22.29; Sun, 30 Oct 2022 00:22:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PTtuyg9C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230127AbiJ3G2l (ORCPT + 99 others); Sun, 30 Oct 2022 02:28:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230084AbiJ3GZF (ORCPT ); Sun, 30 Oct 2022 02:25:05 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91F7B1DD; Sat, 29 Oct 2022 23:24:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667111053; x=1698647053; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=elmKS02WiygU5IrlA++TZV5oI8cDn28t+pY/4QpTrh0=; b=PTtuyg9CnidcTcQ70FemTdfk9KIJyp1nl+N8JoRCWwgWMjH6Aif+pY8x axuIwHsPh0q1UaFnkpwqVGl/wbaMVvzEUoAD6bgdQM4yE8gIc0YyiVXPD HCS6SUnkF/bC4p0xscUYSPCX7h7IBrPshxJ+uEQ7TLAInksCkJaRKDHgN WBWdlIdhAZ4SZMMwndjGdEigum6Xlyv9xIHVFAPmrW7keZcgRaCgg4Iiy JN077KBuuXFqxm7rfqubZIUtWo6QhPiTTV4t/6bnsz+jiBhRljdii/RM9 YufRrkZLGwmk6ok7Zuuu9owDXU5jnLHnq2A7w7IHMab5vuGjkVm55hL63 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10515"; a="395037169" X-IronPort-AV: E=Sophos;i="5.95,225,1661842800"; d="scan'208";a="395037169" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2022 23:24:06 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10515"; a="878393027" X-IronPort-AV: E=Sophos;i="5.95,225,1661842800"; d="scan'208";a="878393027" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2022 23:24:06 -0700 From: isaku.yamahata@intel.com To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: isaku.yamahata@intel.com, isaku.yamahata@gmail.com, Paolo Bonzini , erdemaktas@google.com, Sean Christopherson , Sagi Shahar , David Matlack Subject: [PATCH v10 056/108] KVM: TDX: don't request KVM_REQ_APIC_PAGE_RELOAD Date: Sat, 29 Oct 2022 23:22:57 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Isaku Yamahata 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 --- arch/x86/kvm/x86.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 3868605462ed..5dadd0f9a10e 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -10487,7 +10487,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); } -- 2.25.1