Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1229500rwb; Thu, 22 Sep 2022 11:56:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM44KJK8eTedNg0yOrpyc/xJ0+CuNlO5/5PRVZYJzoc7YUnfHiLdEbut1Rquqy69iYN8uAqV X-Received: by 2002:aa7:d3cd:0:b0:452:5457:6375 with SMTP id o13-20020aa7d3cd000000b0045254576375mr4813667edr.111.1663872965354; Thu, 22 Sep 2022 11:56:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663872965; cv=none; d=google.com; s=arc-20160816; b=FMbNGxYXFY7h+A6tBSP3RIJRP9wfbwb7i2mwjFlYN3Ifs+9/9QABlWD1mlIswcKqPC KO1FSrH/sf8Vrx5Fjb1fDKndIDdfKrsttegGY0yIkwMNA6y7/6HpI8JrSq2YvUWmVx3E T8B5j/L799MOx6bOKhCBFKMQ1DTACCQTh86BICwnQN3VS2C5F+mZ4BWWI9xbmu8iiJU8 NiS9aK+g94bnmVJs4nAarPYrhnTw+zuUlSSKP941kjNui7PUhntoysNLfhGACPihzqVc pjoU7PqypQfkJSbKhIEUD+v4LKFcdhKkB7WuLce6zyvZWBHU7CmfFuhKwU8bdvo88hmf alyg== 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=An6naKiSeGGExQHJKr7Lmb6AxfNXmRsO5fK6Bi228fg=; b=Zulb7xnnYhjUWdBpQ+yt0itBpAhl6NubQyoD4beqcQqmO1qZJAVf99X65ljXF78u46 hctnS8Sp59V6/j98fZlswQFf9CYL34NJCfiRBjhSWxvXphlZzSnTG8k7fGiE1GVQAqIe jN/xQkT9n0JKI0YtULtfwwCOhde3QFn1h3h9plFnbBEcnP4Hf44K0KjQs+PcrOIhD1cC nIRJC3zdwtICtaVn4V+Swm0EQhi9BWV9OmOvcJZuv5IZNBN2DK17K7DiBC/ZITkVaH04 PEt72XHJaApdr9pkBsrVAiKZaU6eKPavNQJL3j8LmIzGHw6/Zqnv/N3uCbl6FoyjYljn i3IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="AV/3lU3O"; 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 wt1-20020a170906ee8100b0077ac5f39842si6401707ejb.96.2022.09.22.11.55.39; Thu, 22 Sep 2022 11:56:05 -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="AV/3lU3O"; 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 S232699AbiIVSYt (ORCPT + 99 others); Thu, 22 Sep 2022 14:24:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232380AbiIVSXv (ORCPT ); Thu, 22 Sep 2022 14:23:51 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F4BD10D66E; Thu, 22 Sep 2022 11:22:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663870956; x=1695406956; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=e7eFeq+AhqW0LXyZEdeUIZ0W61VhBhwYbIGQ5iPG5f0=; b=AV/3lU3OvnOLkDEB851zm7NVzvzyGEpyvL1H2eqFJZO1L2bock6N79Cc YrIr6QCR0WWd5U7Ga6nqTQM2dhlUesvHHPT4N6Z4nBYJ42I7G3kPP6Cn7 9qOo9ZH7ot0ua0KA/pldBZmukrbkxSWfsh27I6kJJLeUT7Cue1LIhgkm5 gxqV3GsppHZJV2ZS2ktDUsz5a/k/WAs+RHOe6121LTexXk9Hm4H5/r4lf 0z5tYVf71a0zyZ80Jb88Qm6RwVcB/KC2XD83DCC0+TCUTrBpTiXzgVF1A rbMS0QUNQE2KLba6Lq+4pk+5Qz/CEJTOtFHgzVbO8HgBxgF3MQZ3oU5lI g==; X-IronPort-AV: E=McAfee;i="6500,9779,10478"; a="326712953" X-IronPort-AV: E=Sophos;i="5.93,337,1654585200"; d="scan'208";a="326712953" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2022 11:21:30 -0700 X-IronPort-AV: E=Sophos;i="5.93,337,1654585200"; d="scan'208";a="653086961" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2022 11:21:30 -0700 From: isaku.yamahata@intel.com To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson , Thomas Gleixner , Marc Zyngier , Will Deacon Cc: isaku.yamahata@intel.com, isaku.yamahata@gmail.com, Kai Huang , Chao Gao , Atish Patra , Shaokun Zhang , Daniel Lezcano , Huang Ying , Huacai Chen , Dave Hansen , Borislav Petkov Subject: [PATCH v5 30/30] RFC: KVM: Remove cpus_hardware_enabled and related sanity check Date: Thu, 22 Sep 2022 11:20:59 -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=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE 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. Suggested-by: Sean Christopherson Signed-off-by: Isaku Yamahata --- virt/kvm/kvm_arch.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/virt/kvm/kvm_arch.c b/virt/kvm/kvm_arch.c index 076a55d59988..e7708bfa0360 100644 --- a/virt/kvm/kvm_arch.c +++ b/virt/kvm/kvm_arch.c @@ -12,23 +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_warn("kvm: enabling virtualization on CPU%d failed during %pSb\n", - cpu, __builtin_return_address(0)); - else - cpumask_set_cpu(cpu, &cpus_hardware_enabled); + smp_processor_id(), __builtin_return_address(0)); return r; } @@ -42,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