Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3124628rwb; Wed, 30 Nov 2022 15:58:10 -0800 (PST) X-Google-Smtp-Source: AA0mqf7pMdnq2BYCvgke0Cr1IwFGvTV8VIOi/HIbuu9XFDUq7dfMRUeqyknnfCqbZeDNp/ia0MPI X-Received: by 2002:a17:906:144c:b0:7ad:cda3:93c7 with SMTP id q12-20020a170906144c00b007adcda393c7mr54830020ejc.500.1669852690165; Wed, 30 Nov 2022 15:58:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669852690; cv=none; d=google.com; s=arc-20160816; b=q+5jgWjyv4SvYcL6ZtpQjIL4bBsEJpkcgjElc5VctJjnmE1Al5Z7JcM4HXQ4XMNmVP Q0qtLzy0yndQ5WSTa+2tp3u0IoXX6Ei+EqvZQa0bzwacK5BrlqMiQ5/cfbE6X1cnokDp yiwQHT6OW/xpkdUYVIAWWOnYRR+11UIhHRcJhkc2lr5BLKfbIXWeq0f7ITux0L7BNSqx GtxeAd1K2nNFqaZX+NmPxqw3KmLOuZvalHunn4CKu9b4BdYnOn5mM/9ZWPvKlCaxtESG uWozIQzHOREhzgBrgQ7troBrThG5hEpaKkiu/b1RXa/WFHNeFgt6fouXrMwu/i6Q2S1B WmWA== 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=feUvU0TLPbMF/Oljy4/vBwowA1Kv3aShJc2OjvbIIRg=; b=CkVes0hP9w11y3igbJeerpfjoy/0ExXtWwhjSdsg/pSPencNtBOnb07EApsrnbX46i 04CJD0MOLgrFF1N+LAbrWORCNPRBuQ1m4GASgmBWDBd3xQm8MCH1q46z+2cNClqy5Dlf dY16eorXlfgiIQkQJ6uoj0LuFvaXFJmtjeYkPdk+FB29X6Wu5x+yPW0l2VOUP3mWiNzV XTUffFMVHxY0ziFGJACmatQjCbvnY7ahLCayWpcbJjeYR8Ursp6PchE99N3yv3v2ntIn XvxBRxD/ln1m9XjNGu0G0tSqyEVXGRlT2jGebCJ09gsieB3CHwesDO55m2DvMKsJcCev 9ZvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=XCz6nxyH; 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 f11-20020a056402354b00b00462e7873c10si2458901edd.337.2022.11.30.15.57.50; Wed, 30 Nov 2022 15:58:10 -0800 (PST) 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=XCz6nxyH; 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 S230203AbiK3XQz (ORCPT + 83 others); Wed, 30 Nov 2022 18:16:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230198AbiK3XQL (ORCPT ); Wed, 30 Nov 2022 18:16:11 -0500 Received: from mail-pl1-x649.google.com (mail-pl1-x649.google.com [IPv6:2607:f8b0:4864:20::649]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B7D8A322B for ; Wed, 30 Nov 2022 15:11:40 -0800 (PST) Received: by mail-pl1-x649.google.com with SMTP id m1-20020a170902db0100b00188eec2726cso19126226plx.18 for ; Wed, 30 Nov 2022 15:11:40 -0800 (PST) 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=feUvU0TLPbMF/Oljy4/vBwowA1Kv3aShJc2OjvbIIRg=; b=XCz6nxyHGgxyXLRmcMfZAC0EtbhsJIztANoSGpUb1GyxR0U89bx0wlthHvMKMPI0ma xTY/WZ7Fnj2wVoHKg3Vrqyc1suf4XCMLsHgGlIH3pS8IMgIqbDNn8Omsv3AOuHpjB+t4 oJgjvYZQ+8fVUpIqLH/jYWFcOCZ826P4/OUhmmvNmOkV9CXcwA4ogZ7MlttInnuYA3IQ qZwoJRmoUlDf0X9EXI/DaNlV615GX7fyKck9fxTOKS6fYcbuWk1qBQZKq1fDAhiXHC8W oTikmOFUnyHawi/4Gg7a9PphvtU6rlpDzwiPDXnAHDvGYvOqtwCfNDpZ92x3xkT78SFn sWLQ== 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=feUvU0TLPbMF/Oljy4/vBwowA1Kv3aShJc2OjvbIIRg=; b=KTUQ/InLIqlqE3vwx6LmsX9lB14BaloMxW3zm1jGbT49tAUxlkuB2ye9cYDJ+/9Prh EgJBmpdxztV/SNSH/npiZay47HM7kxmFrEXZOhHgf3SFqoLUMGsuz9afRI3RDG590rQz TicKKlLHbU00LLrN/qUqL/9OrYlBd98x7ybx6vNxismVMjG58rk43aQKJJsA7u5mZjF5 rmGCiUkUSh5L1Tiz+uPXGMOapJpGrWjsdwmzohNhOwA+QSzrok53Cz5P5ewGQoC+1uSO eogFaLUnALuao/YL8fXxdv6nyTLHkdbTNqmeUwYXkCw0hOsaadaFxWoTJMT98OOPa4tW 6Lwg== X-Gm-Message-State: ANoB5pkMzwi9NwReF0CblyXbWe0+9IjMuIYWjadX2NamLIrY+jRIDmUo 81qgD9T5kjmlZLBCne2KyFwD6YV+KwE= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:903:268d:b0:189:a50d:2a23 with SMTP id jf13-20020a170903268d00b00189a50d2a23mr7180858plb.32.1669849855698; Wed, 30 Nov 2022 15:10:55 -0800 (PST) Reply-To: Sean Christopherson Date: Wed, 30 Nov 2022 23:09:29 +0000 In-Reply-To: <20221130230934.1014142-1-seanjc@google.com> Mime-Version: 1.0 References: <20221130230934.1014142-1-seanjc@google.com> X-Mailer: git-send-email 2.38.1.584.g0f3c55d4c2-goog Message-ID: <20221130230934.1014142-46-seanjc@google.com> Subject: [PATCH v2 45/50] 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 , David Woodhouse , Paul Durrant 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, Yuan Yao , Cornelia Huck , Isaku Yamahata , "=?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?=" , Fabiano Rosas , Michael Ellerman , Kai Huang , Chao Gao , Thomas Gleixner 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 6a8fb53b32f0..a27ded004644 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -5981,7 +5981,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.584.g0f3c55d4c2-goog