Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp161471rdb; Mon, 22 Jan 2024 15:56:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IHDXQpXs9TLjmUndjsGOHd+8LH1sIlqx+kEutQKsacK0QwMiuDd39nI/FKR5Hr35tLNIc9g X-Received: by 2002:a17:902:bb01:b0:1d4:669:3454 with SMTP id im1-20020a170902bb0100b001d406693454mr4338355plb.69.1705967771863; Mon, 22 Jan 2024 15:56:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705967771; cv=pass; d=google.com; s=arc-20160816; b=L8lNeZsB2rw36XlGz+9iVS7E5zGdbOIWGpyTuu1UyVJgPhCvee8hBAiomtWXpl9vBh Wg+v3fg5TKZuXZxL93aGiwn9ymRUl1LFlO7GkWXTKjwTxNIaltZ7HuFxNCeTdfiPbMmv JX5dCSZ+4dFOJmi2Bhg0J4Ivwl9NfnRJzQqzdxpRdpZWMwkWswiSpQtFvMHLokC4g2S+ 6xV6xsI4WYqFkmFi8hb3gmOeL/k44FR5V+05KfBf8Fr0MFXHFT8ilDypaFtIbf9+D3TJ IMt1LQxp4zbK89qI/6+FykLvSrKGzVyo6xJcQhCuYvDQllldcVMe5kN278ZrmE+oVQpm 5plQ== 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=86q+ewptEnccOgB8x3Mgzrz/t86kNzY0y7+q11tP/T8=; fh=Itbyk7CEvizIrzGEESCqq3I2tZgG1kc/GkVOa3S7Hsg=; b=aEEUMPghHOBqUR1MkI9bSe1HLoHEKeCxMw0D3jf8zc6FnNoPAn+fbQpdSRdCbs1srg yRf1XkCxNza5JeB2V7qz9n+NLngROcCc6UZWboWZ49avVexkEzxeTb48UIzzPRUVhAv/ FhTrF6CxjeZNwultT6XNznKID53rjKLEF48IWE2gbmYhhxqtYRDC0QlVveDeK6CwQcU4 H/g5DoSQQchZbwJJylHqD+03iguAro9Fg7HE+J83H44kLiEE+aQr/ATuPlSZ0kxC2jVk 2aykmqRIf9Z+k+ac2gR1WKrMcSrfElQ25CHt/0fx65iAz8SOSy7Mvafq7GV4sHehG4Es Q0hg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZEn2Jglr; 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-34313-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34313-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 f2-20020a170902ff0200b001d71de11ca5si6878228plj.493.2024.01.22.15.56.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 15:56:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-34313-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=ZEn2Jglr; 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-34313-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34313-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 8008D28B0CC for ; Mon, 22 Jan 2024 23:56:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E935B50244; Mon, 22 Jan 2024 23:54:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ZEn2Jglr" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (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 921C94F209; Mon, 22 Jan 2024 23:54:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705967697; cv=none; b=ryOTFkO+cK+Fmx7AGffg3WTXgAMF+UmKQOnrnDf09ZHqIbVWaL+9WQSAXRJMgPYuRuRKkGh4uzoWG9H+fsjDJ07K1DEQyRFsltEG75v8W99myd52Vsyakh3ivS4JaMaySAaV0M1Y75DrKOAR+XElLdn/xSqN6d+gpocMBgLUrdI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705967697; c=relaxed/simple; bh=w5Qeo1eALpoG+9WS05VfgzNYlYM5leha1sNWs649lTo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SmNHNi572zguIa09HsmaVlYidJ4h14maNpDwP2NKBI8yDne4rEhCVgIN2AyR365Wi/eFIioN65r3gEqx9hNsCmio4ISQhlsf3E29dknyBf+hGSlpDSETUUDe5WLGXuCyOCVj3a56QCZrFmqYmeBb0P2v03YRHgCQ/MjYFhPDj94= 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=ZEn2Jglr; arc=none smtp.client-ip=192.198.163.12 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=1705967696; x=1737503696; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=w5Qeo1eALpoG+9WS05VfgzNYlYM5leha1sNWs649lTo=; b=ZEn2JglrPCML1i6r5S/P/mW6wzUlLk5NuQ2MMj0W6xPMC7lvOuSW2HBd 4WcRPdDbsBMAJBbk8ihdBc7rkKWR63TQkU3tJAGh7e+nfbtNVLKvQaD6U e3YPrRFpnDR8+GbOdOOp20aqtv9GOD2ulJAM/P/DQjWCditoP5iBd2KJ0 zM1WHVd2oc5NWBM/fLIEI5nTUfWj5wW4xhauJ/Q4HV+rq4D0aYc/RhvLd aPt6FtZhabvgxJaw9M8jQ5l+hFfIdum8oxCk5ACI7/bQp+t+ACoXDRSiu 1Ng+tHW7Z52xigDypNZ4vIxn2ZWt8DvNOjfur6hVUvekldaCW/aWqYtSr w==; X-IronPort-AV: E=McAfee;i="6600,9927,10961"; a="1217815" X-IronPort-AV: E=Sophos;i="6.05,212,1701158400"; d="scan'208";a="1217815" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2024 15:54:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,212,1701158400"; d="scan'208";a="1350122" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2024 15:54:53 -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 Subject: [PATCH v18 005/121] KVM: x86/vmx: initialize loaded_vmcss_on_cpu in vmx_hardware_setup() Date: Mon, 22 Jan 2024 15:52:41 -0800 Message-Id: <51c5466c541e1eddad928af602bd889721524d34.1705965634.git.isaku.yamahata@intel.com> 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 --- v18: - Move the vmcss_on_cpu initialization from vmx_hardware_setup() to early point of vmx_init() by Binbin --- 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 55597b3bdc55..77011799b1f4 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