Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3652458pxv; Mon, 19 Jul 2021 05:42:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4xhgTxYrF785tI+fqA7uIQs1n9rzzmi7vv4eF4wq8VxSSuq7aKkNw3jyivtInEZ3VyRoT X-Received: by 2002:a05:6402:3482:: with SMTP id v2mr34305237edc.116.1626698566883; Mon, 19 Jul 2021 05:42:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626698566; cv=none; d=google.com; s=arc-20160816; b=RuTIXKk6i2TBF4OJmuB7g5XVHi4pupubUBSqBgMn9RALdmAWYhNla0sP26CFRla8TQ 7IFd2w02xK2WHmbiDk2nSw4xwMzGVebiWySz4F7NjBTUZpKQmQmbOclwdI7LsY4UESwk 8t1S6od/p2M6/CiYL0vmmYMSQXUI8XHLngE/byuzrPGNMU75G+9VsE0QFFmIAHugRhZH aKqlN636ZEFRNJwPkLogB3IQduIsaZJeHCtxORS4oVE871NqIJLfBRfkvyZ6dbZicheW pYlVLcHQ680W+hhd6z7di3rtV+6E8Pvs7N+RbHecw1iqlj8/j4iqzoGtx5Gohhhz/8DW C6YA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=Dx7NDWNM8IgL5A1WBkYf62velOKUtDkMfxNJjwdbjts=; b=DpcumQJK7eNK1MZxiHq9Si6ufnroOHdoOOIcrGYg3z9WmOj68RiO3IrIqOtQFEaiSX iVPcUjtt8adPFIMh2c4P0UIYONUuNBzVy/UpkiQFlQ3I/KCwBRl91kvf7KAh7anJ6n0W ohQjqZ7AgHKAT8VUkMlfjQKlP8mGmYmiyS+yghEyE6bKZSg36I6Wj/+9F+Gg//+D50Ln m/8q1ssJnWIfG1WeppGw9RdUEckHbH+bOSPdJVHWpmj8bQnYPP8/VUPWbTYeUMbjRomX B2BrlZtrxE62eK231Efs2hYXsjJhahQaTpjs7jWetfHrl2IyfjIKDGd6rs0of1awpC7K 70Gg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h8si24552405ejj.750.2021.07.19.05.42.24; Mon, 19 Jul 2021 05:42:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236831AbhGSL6k (ORCPT + 99 others); Mon, 19 Jul 2021 07:58:40 -0400 Received: from mga01.intel.com ([192.55.52.88]:3319 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236811AbhGSL6j (ORCPT ); Mon, 19 Jul 2021 07:58:39 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10049"; a="232817083" X-IronPort-AV: E=Sophos;i="5.84,252,1620716400"; d="scan'208";a="232817083" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jul 2021 05:39:19 -0700 X-IronPort-AV: E=Sophos;i="5.84,252,1620716400"; d="scan'208";a="499901418" Received: from zengguan-mobl.ccr.corp.intel.com (HELO [10.254.211.183]) ([10.254.211.183]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jul 2021 05:39:14 -0700 Subject: Re: [PATCH 6/6] KVM: VMX: enable IPI virtualization To: Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , "kvm@vger.kernel.org" , Dave Hansen , "Luck, Tony" , Kan Liang , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Kim Phillips , Jarkko Sakkinen , Jethro Beekman , "Huang, Kai" Cc: "x86@kernel.org" , "linux-kernel@vger.kernel.org" , "Hu, Robert" , "Gao, Chao" , Emanuele Giuseppe Esposito References: <20210716064808.14757-1-guang.zeng@intel.com> <20210716064808.14757-7-guang.zeng@intel.com> <8aed2541-082d-d115-09ac-e7fcc05f96dc@redhat.com> <89f240cb-cb3a-c362-7ded-ee500cc12dc3@intel.com> <0d6f7852-95b3-d628-955b-f44d88a86478@redhat.com> From: Zeng Guang Message-ID: <949abcb7-5f24-2107-a089-5e6c1bee8cf2@intel.com> Date: Mon, 19 Jul 2021 20:38:32 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <0d6f7852-95b3-d628-955b-f44d88a86478@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/19/2021 4:32 AM, Paolo Bonzini wrote: > On 17/07/21 05:55, Zeng Guang wrote: >>>> +    if (vmx->ipiv_active) >>>> +        install_pid(vmx); >>> This should be if (enable_ipiv) instead, I think. >>> >>> In fact, in all other places that are using vmx->ipiv_active, you can >>> actually replace it with enable_ipiv; they are all reached only with >>> kvm_vcpu_apicv_active(vcpu) == true. >>> >> enable_ipiv as a global variable indicates the hardware capability to >> enable IPIv. Each VM may have different IPIv configuration according to >> kvm_vcpu_apicv_active status. So we use ipiv_active per VM to enclose >> IPIv related operations. > Understood, but in practice all uses of vmx->ipiv_active are guarded by > kvm_vcpu_apicv_active so they are always reached with vmx->ipiv_active > == enable_ipiv. > > The one above instead seems wrong and should just use enable_ipiv. enable_ipiv associate with "IPI virtualization" setting in tertiary exec controls and enable_apicv which depends on cpu_has_vmx_apicv(). kvm_vcpu_apicv_active still can be false even if enable_ipiv is true, e.g. in case irqchip not emulated in kernel. It's ok to use enable_ipiv here. vmcs setup succeed for IPIv but it won't take into effect as false kvm_vcpu_apicv_active disable “IPI virtualization" in this case. > Paolo >