Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1443705rwe; Thu, 1 Sep 2022 19:47:48 -0700 (PDT) X-Google-Smtp-Source: AA6agR7EU0ij2rFV3UWDESbxbfftvr46aC+dMbGFFM9o3n1aU9TuUTvXIN1VZ0U2JKAeAx2VaFPg X-Received: by 2002:a05:6402:248d:b0:437:dd4c:e70e with SMTP id q13-20020a056402248d00b00437dd4ce70emr30278470eda.75.1662086868201; Thu, 01 Sep 2022 19:47:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662086868; cv=none; d=google.com; s=arc-20160816; b=jwF+HzbzS0VIrLLjf86twRgfFQLSRFjQp9Fy4AbmWDdbitMIKgE+m+ZKZ9wRNyWtFM O7CpT5geHkFjJAVJDFcpuBDguGKbKpxKXcbVt2pt5n+WniZmwXOkUjChOwbUCpGu9Nu5 dbyzeZ4Ii2fpeZavmkIpjYqPAXbFv/5iITknOuX9L3hior0Z8bPRrEpFwl2gKx6uugrO O/UMqmdloMMvAyYzdFAlMTRj6BCPRvHceIllV6tboGmD68r4Egqij5u3r58w49/IdARM LgYmGWXleEovplVypG6iltUAlGTCLiwIed7x9wmr+Tz16WKXfmyBl+KBbyWJhsnXqOdZ UbeQ== 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=m/NCO+fWIYdHHVwBvYk+DxUePA1VN7KoBF0/vLDkENA=; b=ZRwiVUEruiKH1c4m34oL9hP55IT5aA3nv7aeH/3jamu7HVAIuUkA0kMgLtWUyjeTG3 XctMxoqVN7OyQ6ZMpsLWpnKMU7hFizwdkq6cA7GQSHLRVLp+6JZQHiw+XYIgZc4vXySu s4KAebv9dVo9yHeujhRSy4syBvcvGycoHVOvRz3xTnRYXoNy2VHVglLM52U0nXei6n8e QyNG7QWIf7+rkVOA+Y/rN6rbEwRoik1OvSrpeJnwDxuihiJR+Wfb6v5xv4x7hErVrLYk 1cpqzJNPhFHAR2vAwrCchJqEo0Na6NLPjo5/VcnScpo7mJPG47WKUmolBwuKI268CFK/ it2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mIHtEQ0h; 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 u19-20020a05640207d300b004483d170521si527991edy.607.2022.09.01.19.47.23; Thu, 01 Sep 2022 19:47:48 -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=mIHtEQ0h; 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 S235205AbiIBCTw (ORCPT + 99 others); Thu, 1 Sep 2022 22:19:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235111AbiIBCSe (ORCPT ); Thu, 1 Sep 2022 22:18:34 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28EEDAB059; Thu, 1 Sep 2022 19:18:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662085102; x=1693621102; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mjHCuUh4QzwKqJ2CYqtbn0vRlgOAmqqF6RfZuHZQYJ0=; b=mIHtEQ0h3nWkSjD0VmycGblcOc1uxMyTEE8uHMZt/7PtJeT16uceMr+M KiPUdYmhgcImkj8wewkjGsQxvpdzC/YAUmgZZS+EtnEWFiqF5oOQHqzCW PaLOmqCQSfikB1CY5bI0YJAa/x5Db07HYlXoOH6P5iLXJCadMxzCOwdiu a8OxEl4E/JRNxmFBPi5VVGTorf1ex00+/fZuAxUrClu6Bk4j7PE2x7WW4 3uM5QcKi2zhCaqZM1Z67t9vnY4s8ezHCXv03SWvl2VaE06/ba3A1QCERr poIU9I3DB9mOgRQA2OnmdfYTQFzX8bpj33lWgRb6QlVlcf8uZmKSdhGJD g==; X-IronPort-AV: E=McAfee;i="6500,9779,10457"; a="297157868" X-IronPort-AV: E=Sophos;i="5.93,281,1654585200"; d="scan'208";a="297157868" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Sep 2022 19:18:21 -0700 X-IronPort-AV: E=Sophos;i="5.93,281,1654585200"; d="scan'208";a="608835676" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Sep 2022 19:18:21 -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 , Qi Liu , John Garry , Daniel Lezcano , Huang Ying , Huacai Chen , Dave Hansen , Borislav Petkov Subject: [PATCH v3 21/22] RFC: KVM: x86: Remove cpus_hardware_enabled and related sanity check Date: Thu, 1 Sep 2022 19:17:56 -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 f0382f3d5baf..15e123757b11 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -11834,23 +11834,16 @@ 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 *caller_name) { - 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_warn("kvm: enabling virtualization on CPU%d failed during %s()\n", - cpu, (const char *)caller_name); - else - cpumask_set_cpu(cpu, &cpus_hardware_enabled); + smp_processor_id(), (const char *)caller_name); return r; } @@ -11864,13 +11857,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