Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp87817rwa; Fri, 19 Aug 2022 23:06:03 -0700 (PDT) X-Google-Smtp-Source: AA6agR7tBBPs+Se4qBoo0QNnvS6WTMPTpWmbIxznA8bBCuYi/6H28SJqMZSY7rPq1vE0zWkW1vq1 X-Received: by 2002:a17:902:d487:b0:171:2818:6415 with SMTP id c7-20020a170902d48700b0017128186415mr10561338plg.21.1660975563761; Fri, 19 Aug 2022 23:06:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660975563; cv=none; d=google.com; s=arc-20160816; b=dJw2AnsenWSWLUrXgH8a/6onRv9Rx29r8RjhpnGF7++2DVLHPHkAigzYPGCqrI3uuf 4RBM7et+QLcBaNbq/mXEWjF+0v7p1aL8SBe3b/gtx3eBT+vD9/4xblBmcjYN2KcmxjUs W1YXd1dzAwXDoJ2exs/eQ+WddVpihujGOjbJmziEYs1ArVD/bL+csnDBTeYioDK+yOVu KR9N28p4/K4VB32eyy2bHwlyvYSJjnmtyPoNLZ8oRY8Ag78jc0UKkIiLQvTXpqe61ji+ tj53r3WDTLxfTDlYG9Fa7gUk6Ila3/yJFKes3+F/hhuZFbkDSn5sXaEXRpvkkXGpPIfL JtrA== 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=Bu0fMteTN2m8NrPPPu0UdvL3ZcxR9k2RylreyEOmyrQ=; b=OMISTa6Ai86yHh/sXHasg5wbnXofHTayimZGCLiXBY2l+ODtNpjSlo3B9opk2U/v9K JE8pN9wZz6dBZyLWNK0/2SGB7WwUs8QutqNGWHbO2RFReWM5/o51o+g9cywuXM49w0X1 02KB/4MNg19eo8/NYYSVqLoJ5IjQx+fiSH6DVBAS2U53KLyPnGwQfSdtbT6c1fZJ8JRa bZSabPyop1Favz+jpYUaAYlvCJO7CzxtnkuakK8UlYvvQE4Wrh/a+QQWcAKW4O1S1h+W bcc4y+fopzW3ydUz8C541HwwmSl0mpxQhjP5yg2NnuF7gEw/3fX5K04gtFkNMWz5D7Ls +7PA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SMEehBLM; 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 q8-20020a17090311c800b0016ee25d5004si6700157plh.347.2022.08.19.23.05.51; Fri, 19 Aug 2022 23:06:03 -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=SMEehBLM; 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 S1343552AbiHTGCK (ORCPT + 99 others); Sat, 20 Aug 2022 02:02:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244618AbiHTGAy (ORCPT ); Sat, 20 Aug 2022 02:00:54 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE84EA287E; Fri, 19 Aug 2022 23:00:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660975253; x=1692511253; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=k5e1P3AKVcgtCAeIF9Lz4zIaHf3w2yygo+9il05lYr4=; b=SMEehBLMSA+4yoWH1wiYWsdtvyqGzo4ASPsoRzcDmwK+Uv70iTh2CxxN y3UTBl3XRujWXUMvxIuSGgBr/Pxsel9Q0jUHheKApjcVe8aCimpVw5fgL xbvc9TTsjOiueTdNZ7ZbdVK5FCFrmLUO8xUOwpJBNT6yrmKOcNdK6IsMA j/PyKP3hlZYZpf70qLu8p8cdHyEGo95a9jL8tlOf5ZlwnHcFqdp/0HGUS K0NjdWBhXy7aXzJ6wicYQiM4MabZBBN3pn5qFv0u4OQ4G2celOKFaI5ic 6PQba/AuJgUt+vj026KLLnalvN9oPHw2O83jFDRkujF4IGDzz2S9nXZEX w==; X-IronPort-AV: E=McAfee;i="6500,9779,10444"; a="379448984" X-IronPort-AV: E=Sophos;i="5.93,250,1654585200"; d="scan'208";a="379448984" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Aug 2022 23:00:51 -0700 X-IronPort-AV: E=Sophos;i="5.93,250,1654585200"; d="scan'208";a="668857565" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Aug 2022 23:00:51 -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: [RFC PATCH 17/18] KVM: x86: Remove cpus_hardware_enabled and related sanity check Date: Fri, 19 Aug 2022 23:00:23 -0700 Message-Id: <305ce2cbf6bc01736091f7e7ef1302fb994a48ad.1660974106.git.isaku.yamahata@intel.com> 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 5aa6d5308ee8..f43caa8919ea 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