Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1173433rbb; Mon, 26 Feb 2024 00:34:49 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWuFeOm2Qn/i2FdWEyhDJazoq+4oxbasNGvCajgQt+2b6x2ibpl+cDPLmcjHHJeAi2rkVJOS61+WTJGtgmwY3r7igSiOS/hrWfoRS3BLw== X-Google-Smtp-Source: AGHT+IFaGIvx/6BxaHxJrfHOKWy0ZzZIXnZHThiqm0gC8lb6JSBunGsTIONpiDiGoVn2cr9827PW X-Received: by 2002:a05:6a00:9083:b0:6e5:3b8e:bb6b with SMTP id jo3-20020a056a00908300b006e53b8ebb6bmr303501pfb.7.1708936489655; Mon, 26 Feb 2024 00:34:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708936489; cv=pass; d=google.com; s=arc-20160816; b=thKcLHnbVtZqa5PdNkQCIfmcT291k+pFB7DSBauqZvwRp2byRSKZI6LqUrh7KP4etQ 9jwlL2DbGfxhmyiTyo9v6dnZxMew8quQ8DuqiUo7n55nqQkOeIz4xeZRl1aPIG3HZYPT /uusoh80wi2i1/ysgpn2HNQv03k0fFXm+kA778vUl0LjVKCQnLoaHkk6+8Qc6gHCyhO7 +RWbBI19cQCsnPPhzewbMnDOuC1U0A3k0CHhpebYmhjIL63N4ZLpz8p8oucpGiJoeK4H YtgkgPa+5DC8+hJdh1Dmxihc/fQCJunW4feXGemaiqljsWMxsbBqNjM+itWsMZGh7+27 arKA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=8pfVY+8ABj2wJ7MA4XG+AbgA5wYOIyalozkbFP75ICM=; fh=BulJEP/GDUNqSgnAw+qaR8T1JQm2NqqUE6tOV+eEeR0=; b=0dmzCMDRnLBukz6yYiAd5xXIANJf8URkPsBCMnmmByg6WxPh8/+8PGvVCEMucgSH2p NhC7mtn/0H98tt7/lHkuOjueTGRLnL+txPxdjQPyisTtm08C/GPJnm2MYyYM+dk4ufvJ Qi6+4bYx5BYjkf36gaaZFUa2UlHSNfRakip1KF0lamrjXp84NtqB07+WkrgVNdW3ui5k 3d/5XUW1On4QRJL0aihEyY5dd8YAf97YwGQoNXy0MCLkNA0IkkghnUyNqNJXpAyXLvuq XgqYAWLyQb4mrxJQ0htdvcbknYrRFJTYP4U1wofuCMPgerb4YmP1uzkhMtMvSuAonckI W4xg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ny3P4K5p; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-80781-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80781-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id j73-20020a638b4c000000b00565db2812a0si3406843pge.60.2024.02.26.00.34.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 00:34:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-80781-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ny3P4K5p; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-80781-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80781-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 5D283280F83 for ; Mon, 26 Feb 2024 08:34:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6AD175578A; Mon, 26 Feb 2024 08:27:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ny3P4K5p" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (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 8A92353E2D; Mon, 26 Feb 2024 08:27:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708936073; cv=none; b=kXVgyIhMKh6BqkAOzyYYUQPxLB2g/6jhBAlhNr+HfUWmDzmOn8H8b++ZZfCNY+oIETTlRuiD/TS0UiRq7iGgm3lsJPOvzt1yR+dVu0W3t1jU0DE9kcdx7dX7Xze7KNVl3pn/Kn6JJrXTYGi6M5XJiKislCodLYjHf5wxaC03D8s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708936073; c=relaxed/simple; bh=ZOimDrQPGotChcrBFIpUTI6niKrsT5WJoO34ZaH7XfY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hFrL8eztccLKdBRwFiiRuZnFULM0vU17xim/0XTPi/sx3pHtBHxUX23Btm0SPpOEE4x2K/7eIwp29Hc/fDfrxtEXuDHA4XX4w8bWqR1Fhb1m2P0HG1/6B11JmZ06Jp1YKvJb3w5TCDP+WzdJUFsRT8hJLdx9a1MZ1skiFh921LQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ny3P4K5p; arc=none smtp.client-ip=192.198.163.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708936072; x=1740472072; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZOimDrQPGotChcrBFIpUTI6niKrsT5WJoO34ZaH7XfY=; b=ny3P4K5ptdLSYeHrYKkyoDcCZLnl+stGQM7hmahZPtx8heecEZzu4Ygt TVoNfUPbVaQ/56W+sT5768MyLSuOQ0HnJUxkXqtHAcZ9xw6AvMnaT7s22 3HJDJWx/H2zx1zhnfGBc5OEBgOvX1VbLxZaHhwzChhfeFjBAOE+YUUjA+ zZW46mzw8Ozgb2FPkyVAJJg1qrxPILDhHHXi1oFm2MfZ2fiHQlNE9qUTk weeJANb3ZU9q0kXZ9KnVKIHcSa5JNryOuIeHTofCV+0IJ0zB26tg+wZ7m ZifpJN5tsOcOKRaHTPnBNUNofQgNTwg9RBl+scyHGjHvaHPuM7Lc5vm1Q w==; X-IronPort-AV: E=McAfee;i="6600,9927,10995"; a="28631515" X-IronPort-AV: E=Sophos;i="6.06,185,1705392000"; d="scan'208";a="28631515" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 00:27:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,185,1705392000"; d="scan'208";a="6474365" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 00:27:45 -0800 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 , Kai Huang , chen.bo@intel.com, hang.yuan@intel.com, tina.zhang@intel.com, Yuan Yao Subject: [PATCH v19 021/130] KVM: x86/vmx: initialize loaded_vmcss_on_cpu in vmx_init() Date: Mon, 26 Feb 2024 00:25:23 -0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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); -- 2.25.1