Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp4118110rwe; Tue, 30 Aug 2022 05:06:14 -0700 (PDT) X-Google-Smtp-Source: AA6agR6ScT8uc7SUlkET8DeFTvSFDRzPcte6XfxalyddtU2FEUTBxHPPMoxmQQgMMBFbx5eTdQ5y X-Received: by 2002:a17:903:1c5:b0:173:43b9:78f7 with SMTP id e5-20020a17090301c500b0017343b978f7mr20991820plh.81.1661861173816; Tue, 30 Aug 2022 05:06:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661861173; cv=none; d=google.com; s=arc-20160816; b=FxNf6+XJ6wi3Mie5NPtY45Wz7ypSZ8viGvcOZ04TsBXmIGlfOjN3tu9tWxaTlnVdfm DBHCznZC0atpDCdw1jjYYI0/Lwp4SuMNv2Kjd66huSfWavwo9CH1J5ABa+I5qEknxfr/ e39PUQFvYvE/c5QBQiCHG8hxR9XY8DwYZDFmPqGET4lHH4DbmDwyjMX+3G50OgNdvQFp c5oBm36wjfFpHPjiH9DpL1NifBCMS1tGpMvTUDW42ddcz7xvE3cGRBrlsaF9WHxIGD1N DFnzT9KU64isNghkCzfwzBfMf7PtHkq6x2/WWf0PY5GNW1ztiu3fdSe4d93wTGcvCQPv CxkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=E3bvdWEdcZsBW8UrspR+zQV34u9XFlQMD68ynjwb+G0=; b=dk+Vi8Bnua+K45duxJ0DX0qA5tMArz+l23ZMas1mO1ZPJ7/oYaU2tAS585DHvbuIMg zWzd/jW+Cks6zcfyAaqFbba1u5qV6qWzghvPKqlMbaLPGxemHSRNqnRNyylI8nmj4aPl OTLn8jhPQSqSl5NHuEv5mIaLXTsqhLFulzwIN6KBkZzEQlZ4CmrAVT45J/S9uoDrSYb9 ag0xlQWrI4W0DZCfzAeAGflVjLXkj/R4jxp5FB5WE1yeZl2uVL6J+AD+51EaVbGZ14fi tUpeM6EobWqfzqGUytkGuDrTAZCKNThiIp4iVk0W6+kjaBqxahH4KsGe9X/47djV8E7Z RWqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=TJtyW0zv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i25-20020a635419000000b0041beb6e9d14si2067594pgb.525.2022.08.30.05.06.02; Tue, 30 Aug 2022 05:06:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=TJtyW0zv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229646AbiH3MDR (ORCPT + 99 others); Tue, 30 Aug 2022 08:03:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230393AbiH3MCP (ORCPT ); Tue, 30 Aug 2022 08:02:15 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6B2AEEF03; Tue, 30 Aug 2022 05:02:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661860926; x=1693396926; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DKukNtisSOiD+eagzRE30K2nu8p0CySa/kXhW91x3mY=; b=TJtyW0zvQccpI3+wUx8aXF7K3yPlxLhge+Drf7iP9M015vuzHkrysB5z K/gaY1Jn4IFiOVi0KGTM/SfBg45yo3GFpjsf1sSdmF7qo6J8ef/6BNh41 +oeK8ajK7+92jjvmxPV/q0yCKLpQt0KC86uWR7hstOkT5ZDiKpjgSOn8t cCmu6Lq5ShYL5AVbqlWGGEXToWGKzImLTgbqzD9caeeBJNMbWmcUeN6WI 9LFECkyLitUdk/wZ1yvcXaBwWM6Y235C8Npy5NPQNXVp3m5RQhfu5Tfln EZKex8od5r2HoB7Q5Ri7tRH2YVpS4QSgbnDrJCNUksTKvZcQ3IpZ8d1hb A==; X-IronPort-AV: E=McAfee;i="6500,9779,10454"; a="356871005" X-IronPort-AV: E=Sophos;i="5.93,274,1654585200"; d="scan'208";a="356871005" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Aug 2022 05:02:01 -0700 X-IronPort-AV: E=Sophos;i="5.93,274,1654585200"; d="scan'208";a="787469675" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Aug 2022 05:02:01 -0700 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 , Sean Christopherson , Kai Huang , Chao Gao , Will Deacon Subject: [PATCH v2 18/19] RFC: KVM: x86: Remove cpus_hardware_enabled and related sanity check Date: Tue, 30 Aug 2022 05:01:33 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Isaku Yamahata cpus_hardware_enabled mask seems incomplete protection against other kernel component using CPU virtualization feature. Because it's obscure and incomplete, remove the check. Signed-off-by: Isaku Yamahata --- arch/x86/kvm/x86.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 14a464f7302b..10b83cbb29ba 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -11830,22 +11830,15 @@ void kvm_vcpu_deliver_sipi_vector(struct kvm_vcpu *vcpu, u8 vector) } EXPORT_SYMBOL_GPL(kvm_vcpu_deliver_sipi_vector); -static cpumask_t cpus_hardware_enabled = CPU_MASK_NONE; - static int __hardware_enable(void) { - int cpu = raw_smp_processor_id(); int r; WARN_ON_ONCE(preemptible()); - if (cpumask_test_cpu(cpu, &cpus_hardware_enabled)) - return 0; r = static_call(kvm_x86_hardware_enable)(); if (r) - pr_info("kvm: enabling virtualization on CPU%d failed\n", cpu); - else - cpumask_set_cpu(cpu, &cpus_hardware_enabled); + pr_info("kvm: enabling virtualization on CPU%d failed\n", smp_processor_id()); return r; } @@ -11859,13 +11852,7 @@ static void hardware_enable(void *arg) static void hardware_disable(void *junk) { - int cpu = raw_smp_processor_id(); - WARN_ON_ONCE(preemptible()); - - if (!cpumask_test_cpu(cpu, &cpus_hardware_enabled)) - return; - cpumask_clear_cpu(cpu, &cpus_hardware_enabled); static_call(kvm_x86_hardware_disable)(); drop_user_return_notifiers(); } -- 2.25.1