From patchwork Wed Nov 2 23:19:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 14559 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp201945wru; Wed, 2 Nov 2022 16:27:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM53TCD3kSZEMeaPYcNpiWXdjosPDsvn95OSFrG8XKVXPWgXQ0j77hou+oGiHTXLbHJgMHOU X-Received: by 2002:a17:907:9609:b0:7ad:d7de:6090 with SMTP id gb9-20020a170907960900b007add7de6090mr17046031ejc.705.1667431668650; Wed, 02 Nov 2022 16:27:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667431668; cv=none; d=google.com; s=arc-20160816; b=LvVasorU5zgfauScLfVzDPlC8zDBZbhWQ93M3qf988nw4dIhwMKYvuRFiol95PkPF2 QeqGzpBWv7ZiW80Aa03A9gVec+O+uvGv+yuOoB/4jwLjeGq6yxarYQtcq7GtnQhHSI6k 1h3mFBxnya0CcMNsWeWFep7auwMnLXJfDkvMFWa4qLq2CNjAH1sg9Ns94FZNBu1XGxxj 2kHFZvFSs5Zw21/d/5L05GJQKkTyK4sPU4HNqqN5PhyhV6wdqJ0jyPo/38NATYCXGJ03 opTPPYi8Gn/nHeFTbVeDA281qHNBp6cmbyc8ILyqt1hisHSOu6xaSbv7I51SwPUPSwyh 7PVA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v10-20020aa7dbca000000b00461e63fe88fsi14011227edt.596.2022.11.02.16.27.25; Wed, 02 Nov 2022 16:27: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=@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 + 99 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748428829091211881?= X-GMAIL-MSGID: =?utf-8?q?1748428829091211881?= 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); }