Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp88113rwa; Fri, 19 Aug 2022 23:06:27 -0700 (PDT) X-Google-Smtp-Source: AA6agR6xQUo7nU3c6kGVTidgsxMVclksevJjP2YqNk/+Ew4xtlhk0mWF1AvYyYjYvLDRMXa9RbTH X-Received: by 2002:a17:902:b484:b0:170:a2d8:80f6 with SMTP id y4-20020a170902b48400b00170a2d880f6mr10541675plr.97.1660975587017; Fri, 19 Aug 2022 23:06:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660975587; cv=none; d=google.com; s=arc-20160816; b=koF9xKpmSawwpfSIsyrlo/dnMDAo8mWf+uv7fKAx5474vWykJv1R6AFbDNlgFNwUA1 W1Uvg7/BYOuFxwbHUuDrIkXE/wegEv3WHKawzCfn/0L0PaN1Q2e8Vbnwo/cisYUEcn0Q hJ0a4o20mscu2UX9eyLu6x3Gb9rHWLztxfcGroOsN/oYZ12MT/xyrm8IF3p0eqphQumd JRmFWgMp821L80hx5Qh9b3u3bgH4jSrdK6T/ONLYDz6wAG7oeM/ed4cOhT7zKLKxhuva Dx/FmwTi+pj6z3TsIl8aLrFAseSMtZOQ4BxksTw7mIrRz3VGDMOZapiYUURBL5qcB1x+ d9+w== 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=9hyeXAPW4DaDO69Xcp5vz7Xn3L9TjOVIp6fJ/+FqYXY=; b=ivChtgwKwEO3WdZQzO7oO98oHtiTQNth+yIqPK5UFKZBI2Q2YUQtu1RgCfYZ6TnKfo iyCj0yuC21DhsTOcM1VeSYpxLmtlY6HiZX1mk3ZJCbM7OhqENDG4Py/Xw50mGd1qQJlB UjKW505qU4dALwps8dRttxPqxjNppphGDuCCRqbPpDpVrJPlHbKlSCQSPaxck4UR0ewz 2OSAITWKf9VicgXx2O2knQ7Co+i2McloJUtTf+WtOQ0e85DP3csBLiLKEXNFdme6pOHb rdCEN4p3KraQ1jjHnoQBwN61eK4OP6i7/pzXDlrEFSWKzPWQXYMK2nhdek9ezxEohoec t4TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Z7QVp+LH; 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 10-20020a17090a08ca00b001f513c483d4si8793179pjn.126.2022.08.19.23.06.15; Fri, 19 Aug 2022 23:06:27 -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=Z7QVp+LH; 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 S1343574AbiHTGCO (ORCPT + 99 others); Sat, 20 Aug 2022 02:02:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244609AbiHTGAy (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 497F8A344F; Fri, 19 Aug 2022 23:00:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660975254; x=1692511254; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=u4ijRhNdXBygE+nv8mY+JqN2kz1+O4efqM0hIzJAU60=; b=Z7QVp+LHwcHYj5ohuC0c0l4ze+PiwXvUYJxrXB7OK87ywSNotUcAmk9Y nqBOb8xNRb6RyjEMyLRcCnZSk1MxoOJ4DjiAFcjQxeWjohOTCYwHRl0vk 2Xy+iMT7IAglhMDfp+a4d2PVTDELDEgzpGpKeVy39Tlx+GNLuy7eArV/y B5WqjNWGUvmrqt2N26mIt/CiOMViH3j6rcR/jR6jYEOwvHlAap4Xb2fNB EIDbZnBY6ZtX4/dA7zb6Fhb/DZUimBOotZlKtqtoQxeAaUC+JlViY17GD TzPRpVoZzkO+rZlRkIwFNvrzVtCuGW17de+msB/8DKtgH8Pe7Gd51k/Ua A==; X-IronPort-AV: E=McAfee;i="6500,9779,10444"; a="379448986" X-IronPort-AV: E=Sophos;i="5.93,250,1654585200"; d="scan'208";a="379448986" 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="668857568" 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 18/18] KVM: Remove cpus_hardware_enabled and related sanity check Date: Fri, 19 Aug 2022 23:00:24 -0700 Message-Id: <5dc935a4f03af56a38128701847935afe676307c.1660974107.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 --- virt/kvm/kvm_arch.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/virt/kvm/kvm_arch.c b/virt/kvm/kvm_arch.c index 94dd57bbc8bd..03946321a21c 100644 --- a/virt/kvm/kvm_arch.c +++ b/virt/kvm/kvm_arch.c @@ -12,22 +12,16 @@ #include -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 = kvm_arch_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; } @@ -41,13 +35,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); kvm_arch_hardware_disable(); } -- 2.25.1