Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1489359rbb; Mon, 26 Feb 2024 10:49:23 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU4zSNIRQWRRcMu4pYta0PvGVF6g+XLj0Ky7j/uXM1ERtpy4A5nBKyaqO6FGwA7pi/jSu8pCQJPLEMPKsOAUq+CueKLCnF5Gg0MqpDq+Q== X-Google-Smtp-Source: AGHT+IFJp2xKMWd4msg4std/zY7HxKVCgx8jqH/yiC/kcAFJ0U+X6sy5eeJ6iYyGvm+XZTUQq6i7 X-Received: by 2002:a05:6214:5008:b0:68f:e532:488d with SMTP id jo8-20020a056214500800b0068fe532488dmr3341qvb.1.1708973363271; Mon, 26 Feb 2024 10:49:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708973363; cv=pass; d=google.com; s=arc-20160816; b=ukNkSCPVd2I/SsumvWB1MdwX2gW4gR2NMyZr0lQZlYZIMWcf04FLcY+JYj5MWWMUCd mqxlX0DtCZLBKG26ofACqpS8Zk6r5CQuFm+X2JEq5k47viHcCNacjD3n52jDI3sApQwT LrJ4lw/28Nx/E7455mAw03MZ+IlLtvt1ZyMke0iKqOstpZAaMYNvqLNcbr89pwOp2nVy EW5ojPVbHbKI5LK8en+w5Q4VbbwFJUxBm7I2KfDsMiycsTe4bZIVmHwh+XVw/GRVhwh/ oBJQrxRLNfVWo7du99qF4qDUgnjaGinboG1VZpXP2mVCrJ9wqTj5vnSLabg2lpWW+yGa Ypnw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=8qK5f3JyT7YGcdqB720ln9o7xO2XFbT9kRgwH3WHNHQ=; fh=kop/uqSFonfmdyOYMJEGv3irklNRkHNj6LOGomZP6Wg=; b=UwWFc7vSC0YSxvK9fSfHRzc/q0yobSekvoUNuB2uB53mkm1LqQUpq8Chnzexll4mYk f+0LhmvZosuoH9Iqh/PP29vKgDcMYe5J3cgpWjY9tDjbQYOoHOCkyjX/JtKzLZZhrTlQ SNOWBN5SSMIA0Dc9jFt6tvItRuyEH4tf3vq2JJ531Ams2vievGL5JEVtlnz6VJhnC4KA JNCY7s+v+jbswO0gxkarnEKtB/RZn5iCS+2p5HC7pCW4+nSn56R4xmaIsTpT+0ek7yk+ iIcXE4InGztfgc7QZSesCSU2fVypIbB9Z/pfOyE8FdCMe1IzIRNdUGMmP2Bvua9BhLYy Wuxg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=AuN+tr5W; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-82160-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82160-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id js12-20020a0562142aac00b0068fc83c08a3si5578504qvb.356.2024.02.26.10.49.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 10:49:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82160-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=AuN+tr5W; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-82160-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82160-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 091BC1C25406 for ; Mon, 26 Feb 2024 18:49:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0FB6D12F39C; Mon, 26 Feb 2024 18:48:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="AuN+tr5W" 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 340A612E1D5; Mon, 26 Feb 2024 18:48:54 +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=1708973337; cv=none; b=NzZHN+FzIxjNlnI28w96jk5QBcx0Fo1qbuOnuaK+75bLxS6bBKRzFw/veac+r6BkvHB7iDr6hWUJa+WcQ3t/ynx8h/v2ZeWntyeHdodDapDZJrJZCW8/2yj/55d01dGYJZLvDaNAdcMzPjIuj/8zdVib+TKt8+3KmIwSpiouKLc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708973337; c=relaxed/simple; bh=2iE21yaZVBmLCRtP2HeDQyOQN7fV3k0xIAcmqO7xdDs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NkYMKRZ8uPSU/Ji3pdGy460mld0gmkSrAIzTdk1/nD8SgbqIeKm36u8cvK2ARq4KsTj6sDhVdhOG8X73zf/7O6OPpIQg5YMCLaccx1pqyXRFnVdpOsXAq8IMLymPPJApE8Lsfbdblpvg19VotB210HWGhvxdCgfvBa7oIi/oJas= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=AuN+tr5W; arc=none smtp.client-ip=192.198.163.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.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=1708973335; x=1740509335; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=2iE21yaZVBmLCRtP2HeDQyOQN7fV3k0xIAcmqO7xdDs=; b=AuN+tr5WwH5fWOyUjCoNmo7fLn0QjYQMKcVLhr6opS1SAe2U4X7EcWv8 PbeRkPzFGeRRhytr+TzGiQKkUyL/deiivuQ2Z6GzDnTenRkukQftKz6RD Mu375kd/pRNGTexa/FUB7T9Qk6Xq0pZ6IukIzkfSFiS+u7nYCVgNhfZ1U +GKm/wh0XWeR6EOe8J7f2i9/dZVkCeSwvFVH88x99t/9GojT6AwV7hsxx HrVRKSrTMrgYsoV1q2dZE4f70fgWjygnYFMAo5MNyMxVSWsztx3lFXKBX dlfOxLQtw6MBW1mVdRNl2HgMwG+Ma7rTJ+BfUHfgoKowKNg6D90K6WeaB Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10996"; a="28723355" X-IronPort-AV: E=Sophos;i="6.06,186,1705392000"; d="scan'208";a="28723355" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 10:48:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,186,1705392000"; d="scan'208";a="7188026" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by orviesa006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 10:48:54 -0800 Date: Mon, 26 Feb 2024 10:48:52 -0800 From: Isaku Yamahata To: Xiaoyao Li Cc: isaku.yamahata@intel.com, 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, isaku.yamahata@linux.intel.com Subject: Re: [PATCH v18 007/121] KVM: VMX: Reorder vmx initialization with kvm vendor initialization Message-ID: <20240226184852.GH177224@ls.amr.corp.intel.com> References: <411a0b38c1a6f420a88b51cabf16ee871d6ca80d.1705965634.git.isaku.yamahata@intel.com> <413fd812-a6e6-4aff-860a-fd8cf4654157@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <413fd812-a6e6-4aff-860a-fd8cf4654157@intel.com> On Thu, Feb 01, 2024 at 05:34:44PM +0800, Xiaoyao Li wrote: > > diff --git a/arch/x86/kvm/vmx/main.c b/arch/x86/kvm/vmx/main.c > > index 18cecf12c7c8..443db8ec5cd5 100644 > > --- a/arch/x86/kvm/vmx/main.c > > +++ b/arch/x86/kvm/vmx/main.c > > @@ -171,7 +171,7 @@ struct kvm_x86_init_ops vt_init_ops __initdata = { > > static int __init vt_init(void) > > { > > unsigned int vcpu_size, vcpu_align; > > - int cpu, r; > > + int r; > > if (!kvm_is_vmx_supported()) > > return -EOPNOTSUPP; > > @@ -182,18 +182,14 @@ static int __init vt_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; > > - > > r = vmx_init(); > > if (r) > > goto err_vmx_init; > > + r = kvm_x86_vendor_init(&vt_init_ops); > > + if (r) > > + goto err_vendor_init; > > + > > we cannot simply change the calling order of vmx_init() and > kvm_x86_vendor_init(). There is dependency between them. > > e.g., > > kvm_x86_vendor_init() > -> ops->hardware_setup() > -> vmx_hardware_setup() > > will update 'enable_ept' based on hardware capability (e.g., if the hardware > support EPT or not), while 'enable_ept' is used in vmx_init(). I gave up this clean up to drop this patch with v19. -- Isaku Yamahata