Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3469647rwb; Fri, 30 Sep 2022 04:11:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6y2tcXJE5NSIqQKMLlaauoxdo9Gwumzx1dUCZBaDhe6fZzv8EAG8mMvSFBtD0wLiUXvRSC X-Received: by 2002:a17:90a:8046:b0:205:de11:4867 with SMTP id e6-20020a17090a804600b00205de114867mr9122445pjw.198.1664536296131; Fri, 30 Sep 2022 04:11:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664536296; cv=none; d=google.com; s=arc-20160816; b=yFI3GF1auccBFWVCqJRAKu+bGKSHlHg7Mu0akiuCeLKvPyWm6/SCxqiv8dHAmmwzuP U95wv9eBU03xStTDOZvLoU6/ScyG+pFSLnbPZibTmQHh9E4iiGdKXexjaOfJwPEN9LME 3kmTup0pK3jFZwOyq/KZvtKnCxChHtzyOrQ15mEKHIGhKrOlVXyk7Ka4BWXTHOVLBWly 1c8PbP6EbVPgZOsp/CWz5+QDuUyccq/smIBxfQ/yDZtT/ooQ9Q7ne2+ocag1v7ZaspbI iHpCFMOSGV6TO4f2V9MVVVb8Qm/o1zxs1KqmZSUR0+08p11bulR6WRH+3vdTc7uexwhN wkxA== 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=Kw3arVf4eCzgLY3QIjWOdVfLdZrKDR9Gi0TVwrFpuBY=; b=plIB9xKeNVW7ZtRY7qYAe/yCdmif0uR4YTys7lUplQZA/xTJfTu2JDkHJKgNBxxhO2 nnoiQOU9x3qjig4sNpmgqK6L5G/u3iKi8YD3CgMYqDR6+E1toSEywKGcfFg++aoqjPdA CHQurCI2LxG/gNW9YISZWhDIZIzTK2GpgYLCbZCBRlS6EGze3zjlTobt0CbGmnOEiMtw S7Ldn5IhqewhBJkfWvh0gsXxKMtnS6DZoU+0m5OZ9h4zApP6QhRGHYMve7i4Ig9ePPfk YzHnd4/1+yGAdhYULuaeO0VzekSCttPgbeOi6ov/uF4BN+4AxxkIjU9nSK93sxh1xvAP FjCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jfs3mbF6; 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 s5-20020a170902ea0500b0017811e39246si276560plg.397.2022.09.30.04.11.24; Fri, 30 Sep 2022 04:11:36 -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=jfs3mbF6; 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 S232356AbiI3KZg (ORCPT + 99 others); Fri, 30 Sep 2022 06:25:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231855AbiI3KUj (ORCPT ); Fri, 30 Sep 2022 06:20:39 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5B661F8C05; Fri, 30 Sep 2022 03:19: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=1664533153; x=1696069153; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Igv22U9RXdZA7/q9wQNPPWJH+RI/ZzPv1pGdYvbYSTE=; b=jfs3mbF6cR+v8nMo9tE9pBhRJ7zPIDtnAI/4JEdlRAk7Ha31ki00opY2 wVguD0wgLcdIAmKcsCc32yXth2LrLAGrGoowfM8hyIhXgYc+eOzQ1LF0V xTX//ye5k4Q9B0h07G+0AaoHca4wFP+nsQfqqL27/q/Ot4tG5OqaWXem/ IWg9gywznl3CItMnwp6Osgm3V3CjapEmzsF8ZLHKvVuo8nohWJP58BOGk fWE5byIzQZorrwgpGIDASU+QKkRp4MHadkGutuTOFzMSUIqz8Amd/P9d8 RyKjjWzrBskxvCHL8ldculFXXX0yfVG7Eeas/NpVmxhtjHCWQFsYV8tPw w==; X-IronPort-AV: E=McAfee;i="6500,9779,10485"; a="281870114" X-IronPort-AV: E=Sophos;i="5.93,358,1654585200"; d="scan'208";a="281870114" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Sep 2022 03:19:00 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10485"; a="726807675" X-IronPort-AV: E=Sophos;i="5.93,358,1654585200"; d="scan'208";a="726807675" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Sep 2022 03:19:00 -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 Subject: [PATCH v9 053/105] KVM: TDX: don't request KVM_REQ_APIC_PAGE_RELOAD Date: Fri, 30 Sep 2022 03:17:47 -0700 Message-Id: <6160295eb8f008fe5cd123f60c40a0dbf3ea9ecb.1664530907.git.isaku.yamahata@intel.com> 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.5 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_PASS,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 9060ca2b19ee..f6f0a4b56263 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -10248,7 +10248,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