Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp688943rwi; Wed, 2 Nov 2022 17:16:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM585yccdeS5ix9n7Z2pH2ApEPw5Krzyo0JUNP5WF0udMC7iBoN+AghjwabgGNrCYMfF+X+h X-Received: by 2002:a17:902:820b:b0:185:b9a:8ac1 with SMTP id x11-20020a170902820b00b001850b9a8ac1mr27985324pln.111.1667434587311; Wed, 02 Nov 2022 17:16:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667434587; cv=none; d=google.com; s=arc-20160816; b=SCQlc/BbSMtsbFOkgpLR00jCTnjKJR5fSmFkWtmlHDKtYj8rgGus566k3XhMa076qK yn6B/3/KWURS8UjKES0bsKtVz65LZ/MTnv1u1dzBvfI77Qh9WgY/mGA6BSW8eVQKB2CF JmtqwLsDHED2fCayQNa4Ob4ldT8o6V6/K4sEW7u5Ri9PKUd3HgvIk257FBoxnBozTun2 yNxA17qzsutyBZPOXTIFhE1xFeU3wJYm/aEXSUWVBCPPKYOYxzAIBF+6l15AupDRwidt Scjib2LGzOBpoKPMIfoqr+M0OlZZSKQlvSXvyN8cK+wpnxn3nqS3snXgKn8UQ/Wb0ZAb kGaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:reply-to:dkim-signature; bh=7o9E6ByEEHcjl3SJug2mMi0pvOLBLqCZLDtYGdzM9zU=; b=pEQAxvCHjC+QYI07hVdZDJ4Gb5OdDGYYiVAGrvQzn5JJ0ZjmCqrFFKnObp/gDgZBAc BTAP7pvqhQXQkte88oiwIndkKgV5F60HC9xzVBuqRW0RomabSXKp07VNX85tI/TsiXGt PaGCnkZSbrmjIGc3FqjM/vhq7dRSfmoPacOfZzVgPDyPPp5sX8v7SSCzMQe3JIdNIsEi Nx20rnvAKAG3SaneBKG4rM10uFbpGfkKV0VGvcRnQXYI/9V9mdvAK4DUkORYGOD+41m9 g8LZiKQh01zfnHEzcDHQh7UdyZnF7ZSLffB9IXlk7D4qxKJZcr3agd9/szRd2Fy3AGK+ rAMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=igGQ2Ish; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x69-20020a638648000000b0043cb5d08908si2705978pgd.138.2022.11.02.17.16.15; Wed, 02 Nov 2022 17:16: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=@google.com header.s=20210112 header.b=igGQ2Ish; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231165AbiKBX0b (ORCPT + 97 others); Wed, 2 Nov 2022 19:26:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231160AbiKBXY5 (ORCPT ); Wed, 2 Nov 2022 19:24:57 -0400 Received: from mail-pj1-x104a.google.com (mail-pj1-x104a.google.com [IPv6:2607:f8b0:4864:20::104a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 217922DE6 for ; Wed, 2 Nov 2022 16:20:40 -0700 (PDT) Received: by mail-pj1-x104a.google.com with SMTP id q1-20020a17090aa00100b002139a592adbso2500553pjp.1 for ; Wed, 02 Nov 2022 16:20:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=7o9E6ByEEHcjl3SJug2mMi0pvOLBLqCZLDtYGdzM9zU=; b=igGQ2Ishg8aW6R16oe+upaVPlGZAayIzpaWDE8opgJQMS6iOjhkUCLTlEhQKtzbBll IdlAKyPdahqXXt0dn4MTEFgukQG0ZCIqNyG5cI01/hw0JIAYQcoPp2BpnzUD0jxS7Ya/ +nFRYynF3Dt5MSnjg1t4pKoFk0Qf9803yI4SDdLZfxDyQop67DTJX+MNPzB4mGdTHTI/ UetXl5t7icKMI/ai8krB+aFqS3nK2vJC9U3C1mIJKmfCvYut3D46hBaxcevJzvvlHDGm CTwO6YCLjzVqPj4Wwm3tv83DTC33l/N5jui9O7iqtMw8SKOspotJDO5ne6iRoF09KXOw O2Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=7o9E6ByEEHcjl3SJug2mMi0pvOLBLqCZLDtYGdzM9zU=; b=RyikzrFdAKi4qx/GgRBuinQ2UnDpXsk4O8dDEhenDDGX9pMKkPzgb4hJd1t5ih9j6G 2mQZq8x61FpDVF/40cdKlD1oBerEOAlkSc/MaXqnwtTDZ5owQpUPOx3Ugk0V8Uq7m3+J xBd2okTAjydB3zfnNTBy725OnCvNNf/bBFMXPYGOfGtez3Xln4mprwn56rgPKByVH0Hn Pzs1OpbLeqfPDcSomnGd13Fo5eTWNTLEV4ap1gXtTrwavLnXxFGW+KIc6ZewE/euouIX Yp6grV7lPmhpRIAi8xjg6ZfW8uTSB6uEZRvwAW3jrOagYOQLndFry+FZEyV6gEQUQeUU cuQQ== X-Gm-Message-State: ACrzQf19pmYFquhRvlgxM4TkiUOqKiHX9BNrXurd/moXyMi++YMpg5QV HiKhah2CxLyI58Gy3MnMC8w0CIGuIg0= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:902:c7c4:b0:186:5ebe:38e with SMTP id r4-20020a170902c7c400b001865ebe038emr27249054pla.33.1667431222881; Wed, 02 Nov 2022 16:20:22 -0700 (PDT) Reply-To: Sean Christopherson Date: Wed, 2 Nov 2022 23:19:07 +0000 In-Reply-To: <20221102231911.3107438-1-seanjc@google.com> Mime-Version: 1.0 References: <20221102231911.3107438-1-seanjc@google.com> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog Message-ID: <20221102231911.3107438-41-seanjc@google.com> Subject: [PATCH 40/44] KVM: Remove on_each_cpu(hardware_disable_nolock) in kvm_exit() From: Sean Christopherson To: Paolo Bonzini , Marc Zyngier , Huacai Chen , Aleksandar Markovic , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Matthew Rosato , Eric Farman , Sean Christopherson , Vitaly Kuznetsov Cc: James Morse , Alexandru Elisei , Suzuki K Poulose , Oliver Upton , Atish Patra , David Hildenbrand , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, Isaku Yamahata , Fabiano Rosas , Michael Ellerman , Chao Gao , Thomas Gleixner , Yuan Yao Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable 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 Drop the superfluous invocation of hardware_disable_nolock() during kvm_exit(), as it's nothing more than a glorified nop. KVM automatically disables hardware on all CPUs when the last VM is destroyed, and kvm_exit() cannot be called until the last VM goes away as the calling module is pinned by an elevated refcount of the fops associated with /dev/kvm. This holds true even on x86, where the caller of kvm_exit() is not kvm.ko, but is instead a dependent module, kvm_amd.ko or kvm_intel.ko, as kvm_chardev_ops.owner is set to the module that calls kvm_init(), not hardcoded to the base kvm.ko module. Signed-off-by: Isaku Yamahata [sean: rework changelog] Signed-off-by: Sean Christopherson --- 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 c8d92e6c3922..4a42b78bfb0e 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -5966,7 +5966,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_irqfd_exit(); free_cpumask_var(cpus_hardware_enabled); } -- 2.38.1.431.g37b22c650d-goog