From patchwork Thu Sep 22 18:20:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaku Yamahata X-Patchwork-Id: 12985660 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83A2DC6FA82 for ; Thu, 22 Sep 2022 18:22:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232572AbiIVSWz (ORCPT ); Thu, 22 Sep 2022 14:22:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232439AbiIVSWg (ORCPT ); Thu, 22 Sep 2022 14:22:36 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57E6D5051C; Thu, 22 Sep 2022 11:21:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663870903; x=1695406903; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zLkocjxLuN7GyCmVtTNHRtyAuGH+UIMI58rO1Z93uSw=; b=d2gYifdrcDkB7Lzb/7WPNWC/uHXlfNy0MXn6q/tXa0qvQM4iImTnoDAk MwPmsqqHwCeqzgWbofsxvtp97Ub5Urrtw7t/Uf9BnKZSya8NQCH5Mxeu+ /7p7yUDbEJ1tuVEv7ErjeXEQmIYJZKE/5Pho7NU1EDsWrm7lM+dGcKlTj 7I6Co2Hydr3PzfdGxMdxDJaZCMABuxPe/m8MRRUMbGpnCJItdbftYZ66Q qL0jAUEGhfAavx2rso4nGNG/gYRCcJKUjQqRsyBsQqdQR4oHkLZq9RoAY n3sRwGgJHdjR+vx9j0/TU9JiWo62xmGlY0AXO6ovhjyjS2uX5dkVyM8Jp Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10478"; a="326712889" X-IronPort-AV: E=Sophos;i="5.93,337,1654585200"; d="scan'208";a="326712889" 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:22 -0700 X-IronPort-AV: E=Sophos;i="5.93,337,1654585200"; d="scan'208";a="653086754" 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: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 , Daniel Lezcano , Huang Ying , Huacai Chen , Dave Hansen , Borislav Petkov Subject: [PATCH v5 16/30] KVM: Remove on_each_cpu(hardware_disable_nolock) in kvm_exit() Date: Thu, 22 Sep 2022 11:20:45 -0700 Message-Id: <54c7065fa08a65f1fcd7f47492f1a83e6f7a3746.1663869838.git.isaku.yamahata@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Isaku Yamahata hardware_enable/disable_nolock() check if the hardware is already enabled/disabled and work as nop when they are called multiple times. When VM is created/destroyed, on_each_cpu(hardware_enable/disable_nolock) via kvm_arch_add/del_vm() and module_get/put() are called. It means when kvm module is removed, it's guaranteed that there is no vm and that hardware_disable_nolock() was called on each cpus. Although the module exit function, kvm_exit(), calls on_each_cpu(hardware_disable_nolock), it's essentially nop. Eliminate nop call in kvm_exit(). Signed-off-by: Isaku Yamahata --- virt/kvm/kvm_main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index ad9b8b7d21fa..d7c3bc14691f 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -6034,7 +6034,6 @@ void kvm_exit(void) unregister_syscore_ops(&kvm_syscore_ops); unregister_reboot_notifier(&kvm_reboot_notifier); cpuhp_remove_state_nocalls(CPUHP_AP_KVM_ONLINE); - on_each_cpu(hardware_disable_nolock, NULL, 1); kvm_arch_hardware_unsetup(); kvm_arch_exit(); kvm_irqfd_exit();