Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1965762lql; Wed, 13 Mar 2024 13:17:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV22L1ab38Lac3E+x8FbI7YLTckkqcsUzPJQuDzhP22rEIuorPM8jnrfRlOW2QOstu4OkJJ3tIF79xxXYIwuw3piKqTdXVGsht4RH3v4w== X-Google-Smtp-Source: AGHT+IG+ndP6TumIpCx8+wFlzUm7POY2vJAVPFZRpQi/2Gi/7vdyA7Mj1gZfqMkyJfcEKtAT01Jt X-Received: by 2002:a17:906:4e92:b0:a46:5478:eec2 with SMTP id v18-20020a1709064e9200b00a465478eec2mr2045638eju.44.1710361025901; Wed, 13 Mar 2024 13:17:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710361025; cv=pass; d=google.com; s=arc-20160816; b=wv0Fts8zw8S3C7p+PhvVoc28r3ncYfVJb9k8+gPBRQRfER3g6qCxyC5Jh5KGYYWDQd ahyTX+O2j5PWgcVgDkXqaoCSb0xKUMLX0NhgJ8Hv5ckHyPNSPIeX4ZJV5fujojOElu7K 58s22C8BHaKFWaoTPUr0JuemBgR6TdEqMVS0VRCGHLDQ7ki+KuP3IriQyYi70zhY6P/p 8Fm61OMCMWH5vMRlCB8RczgzREW9pT+TFpHw2jTQ7qp18VIMXXaAkWSb/iojEaEGYyP8 DUw7Cbrejdp6W7AQJFrxJKPdf0WhvZRO8sKKCTF+YKm/lOVGelpAYiEDg5TWrx20WKn9 VI9A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:date:message-id:dkim-signature; bh=6PEY3oqGBd5YOVPr31JypqMhPFZx/LnEQ6uEZg+hJ44=; fh=jnqbgpFM9/9RdRxE6YSSvxY4givMT7+eUt9mUnowU0Q=; b=YYQDjUb4QFEzFwmNBGNjY5n9E3DUYge52cigBof/V0qWinkJyyUFlMXQi4e2zJddt8 bMB/MuRqLJ8yivdpM2Nxg/YWaSwsqR7WNWQRNVcuXrYaebFthY+ObVy/Dq8kyMqb0cgD +bWV3TdFOkP7eXCsfVymvS3ehBEGRAbW5Sc0hcWv/idId+fny3GO4bPDkZuK6MfNTjN6 zTT1s85+0fIr0XZkP7eoy1sNkacQbKV5O0hmNJuaFrt9b9/wn3gPcYFSrGzG1eOG0ry8 PN0JiJO6LKvGHb+lxHS5QdtIIOz1ZXuXz24HKICzJqk2DIx1rj0+G59VJUur+g+1/Ays Ty1A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=XGVxzUqE; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-101679-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101679-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id by9-20020a170906a2c900b00a4637091d72si2468413ejb.865.2024.03.13.13.17.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 13:17:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-101679-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=XGVxzUqE; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-101679-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101679-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 0C60B1F22DBE for ; Wed, 13 Mar 2024 15:30:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BEA8547A73; Wed, 13 Mar 2024 15:30:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="XGVxzUqE" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1359147A52; Wed, 13 Mar 2024 15:30:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.9 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710343819; cv=none; b=iJctAn97m99WGnZFczDsElljdVpzUkZNG/TVUq99i47fiASRCtQER4MQWIpdtANTpRKr2dQekuycoNIMVWq4+pJef1mHjARgjyaYw87xnyojvvco6KDiLGzuLG6CcQuNfI03886/gpR3fQmJAKQqtQAfvQL0ZMvNYQZCjN90Hz0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710343819; c=relaxed/simple; bh=6YkpdduqF4HnEdxpbqFhxmHLrelbL/HBKCE3WIC3SQE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=iGiMVzgr+quc+YyY4WH3P0P+PqNnY6fYHgtEXWmqaeohChPoMnl+KQIUPmE9lL68+TpGNS6WSsux4++Fnql/i18t78c4iK2i2J9Pnu0UJE+t4eU5YO1LUiF0actSaEgW2+MEd0NdXQA8PwFw7+lFNX3j920sqQXa2TTfZG7b8Fg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=XGVxzUqE; arc=none smtp.client-ip=198.175.65.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710343818; x=1741879818; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=6YkpdduqF4HnEdxpbqFhxmHLrelbL/HBKCE3WIC3SQE=; b=XGVxzUqE/ZMTl+vm4Eqxr0yqDFyC2T12AmD9mCLJYdJr84TIMHMRdwZg wxx3B3kckp1De890W19mumDadkJVcSCiSboNUJ/juE7HuA7tjxbD5KB72 ojv79Xm2WPzh9oaT6BdwQq/O3pQIJP8nHz9xVVMSOh8fYI4Sh3KA1dLrf GN/pbSC/gdgcg46+cAjUjeQTK+gutC5dZfR5rw11nFIxpOMqnzzjidYeb Ms7aJgBbi4R6QXKsHte6pK/o78sQHrPLlh2Vvef5wVYu0SMnLcabmooR3 D6agQN+ML5gMKZPIkgujpWNvvZgNiFrGeXdXJNwMKQf33vX+rona0/Gri w==; X-IronPort-AV: E=McAfee;i="6600,9927,11011"; a="27595144" X-IronPort-AV: E=Sophos;i="6.07,122,1708416000"; d="scan'208";a="27595144" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Mar 2024 08:30:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,122,1708416000"; d="scan'208";a="12532232" Received: from binbinwu-mobl.ccr.corp.intel.com (HELO [10.124.236.140]) ([10.124.236.140]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Mar 2024 08:30:14 -0700 Message-ID: Date: Wed, 13 Mar 2024 23:30:11 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v19 021/130] KVM: x86/vmx: initialize loaded_vmcss_on_cpu in vmx_init() To: isaku.yamahata@intel.com Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, isaku.yamahata@gmail.com, Paolo Bonzini , erdemaktas@google.com, Sean Christopherson , Sagi Shahar , Kai Huang , chen.bo@intel.com, hang.yuan@intel.com, tina.zhang@intel.com, Yuan Yao References: From: Binbin Wu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2/26/2024 4:25 PM, isaku.yamahata@intel.com wrote: > From: Isaku Yamahata > > vmx_hardware_disable() accesses loaded_vmcss_on_cpu via > hardware_disable_all(). To allow hardware_enable/disable_all() before > kvm_init(), initialize it in before kvm_x86_vendor_init() in vmx_init() > so that tdx module initialization, hardware_setup method, can reference > the variable. > > Signed-off-by: Isaku Yamahata > Reviewed-by: Yuan Yao The shortlog should be this? KVM: VMX: Initialize loaded_vmcss_on_cpu in vmx_init() Others, Reviewed-by: Binbin Wu > > --- > v19: > - Fix the subject to match the patch by Yuan > > v18: > - Move the vmcss_on_cpu initialization from vmx_hardware_setup() to > early point of vmx_init() by Binbin > > Signed-off-by: Isaku Yamahata > --- > arch/x86/kvm/vmx/vmx.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c > index 434f5aaef030..8af0668e4dca 100644 > --- a/arch/x86/kvm/vmx/vmx.c > +++ b/arch/x86/kvm/vmx/vmx.c > @@ -8539,6 +8539,10 @@ static int __init vmx_init(void) > */ > hv_init_evmcs(); > > + /* vmx_hardware_disable() accesses loaded_vmcss_on_cpu. */ > + for_each_possible_cpu(cpu) > + INIT_LIST_HEAD(&per_cpu(loaded_vmcss_on_cpu, cpu)); > + > r = kvm_x86_vendor_init(&vt_init_ops); > if (r) > return r; > @@ -8554,11 +8558,8 @@ static int __init vmx_init(void) > if (r) > goto err_l1d_flush; > > - for_each_possible_cpu(cpu) { > - INIT_LIST_HEAD(&per_cpu(loaded_vmcss_on_cpu, cpu)); > - > + for_each_possible_cpu(cpu) > pi_init_cpu(cpu); > - } > > cpu_emergency_register_virt_callback(vmx_emergency_disable); >