Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp1996849rwi; Thu, 3 Nov 2022 11:22:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Y9OkqDlJpXe5G0aebjbTI/LEUgn3KvH75venhm4tBaImEY+JQpMbCF/7zpAxNgLQqhqH4 X-Received: by 2002:a17:907:5ce:b0:730:bae0:deb with SMTP id wg14-20020a17090705ce00b00730bae00debmr31110145ejb.181.1667499764804; Thu, 03 Nov 2022 11:22:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667499764; cv=none; d=google.com; s=arc-20160816; b=jlNN/Hs6pAc3H54/4lfsTNiZjWf6gRmoKNoqJ9hJb1V98K3SMMN2fMwXZo5KAensOc xfK6xFb1mGJca3aGancxy8sMyj15Nl9b1N4NWYW3P9e8GEchVwWjIfIv2x7Pq5/fxGSU /wAjX4mvgxflZNkdFAyJt+mu5uzjmz2aUU1LfWC/xX3v9aZFaiJwuIBq79AT4r+vJETs fcDFwFWjSAfmstGOO22rdTm0HSbMZeXY2Gkae9Yc2gGiJkZt3U5SsbRlWRo9sM2kCj5l ORPgaYIhXuqUPiRPUJOMBPYzV2c3gFiVimSuCl0iM5ebUaz+LudufLtmnUe90rSruzgs HZaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=3tXwq1v6tJCedr2VtV8ELYd8BpIXTKwmGjuY8weIxs8=; b=KHLCWz48bLKdhNQT/Ijw8PdpMZ9jb3ajpD6nJwg/ARyUEEzFE4cRAOb2lqV7Rb7TO9 b07PVqP0hsE8A7m7wkIZ+ed0tQvZX5WIGKDQCtZQhPaZWUzm0PI/F7g38n3YgYNdUMPS 7uySEZCO9v6MvWS5J3w5b3Zysj+EiSbVel86axC+OKYF8jBaw5yE74BCzWhFOyrBlCoF Rz0d3L0aln/0c3PdIfyKAht0wJiI7iIhqB2+nB+aPFY1wuir4AovZoJ5J9GAA/4+m60e RyLpcLIAqK2wO8N+aysoVaraK/2J+SNPVED3Z+CD1ZPwVZ2QyV2WrbQMqEKDv9tJm12c s4KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=gjqnoLy1; 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 hs1-20020a1709073e8100b007829d30452asi2175892ejc.583.2022.11.03.11.22.19; Thu, 03 Nov 2022 11:22:44 -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=gjqnoLy1; 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 S231825AbiKCRxn (ORCPT + 97 others); Thu, 3 Nov 2022 13:53:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231796AbiKCRxj (ORCPT ); Thu, 3 Nov 2022 13:53:39 -0400 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CDD51C116 for ; Thu, 3 Nov 2022 10:53:36 -0700 (PDT) Received: by mail-pg1-x52e.google.com with SMTP id h193so2298642pgc.10 for ; Thu, 03 Nov 2022 10:53:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=3tXwq1v6tJCedr2VtV8ELYd8BpIXTKwmGjuY8weIxs8=; b=gjqnoLy192oz/Zxvag+BlBreQGGSfkeJOmpmCEx7rtJpm2GzAgZsoDzOerCZhLAwiY s4s7ScvfoZl8zwg6HI1Ymb7QpOkn2NxzwKs5NTcMl1wbeFQ/hmv3VmCXwSollG4iohk8 ZfCLF4UOQot0TZFoB2ZSgy0wzT2PFfm47J97NCOCE8O1C25eIzJzc1jTDAryWTakKtb6 +QR4ykcFsYtONZVST62uH0g9I4NSfzwB8k/a9JLQz8I+tNs7JhVckzNuFRTBv1+mgFsk IdkM799qrsruF4xx+MeYDtb4Sd8Y4cxbHh++70LJo94wIuv8aLLKYeYlUVyl7mOC3bBK Ww4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=3tXwq1v6tJCedr2VtV8ELYd8BpIXTKwmGjuY8weIxs8=; b=bzEak8l3kA4AcW6IHFG22RpcAgH2YCnPQ+YhTkInwXbz/BuVSBsnWAIRxtSF0SJeBO SlDmoIyvTn25+KDy9cE1dQqaEPmHDDLFse9mMZZsv+nBuLJmryuPdRuoxcbqOAAoNNdP HTsXasGI7Y2KqAdYpDxfslVij20tubAPbVhEhwq3oWwP1xiO7gLC8ixVBOjZl4AAAE7W CHZkB+nsiUtYVZCuHVzNp01BIawyMSP+PL3HB99U034+0cK4IfkUSnBFzbm/GySeuQyB JsFwTpWzsuG7w8LZvDptDnALb1fRGvO43KGQcD5U5n6opNNAJxY92JS8zJRexE/R6KOR FD3Q== X-Gm-Message-State: ACrzQf0KKipJYrrWUFqjNw0AqS/b67rmE42STFxyqnGraJ8hgO8wZ6Ld gcVXCsbqbWm40/Z2PpLD0n/thg== X-Received: by 2002:a05:6a00:999:b0:56c:3d0d:96fe with SMTP id u25-20020a056a00099900b0056c3d0d96femr31657100pfg.12.1667498015565; Thu, 03 Nov 2022 10:53:35 -0700 (PDT) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id e20-20020a63e014000000b0045ff216a0casm1080329pgh.3.2022.11.03.10.53.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Nov 2022 10:53:35 -0700 (PDT) Date: Thu, 3 Nov 2022 17:53:31 +0000 From: Sean Christopherson To: Paolo Bonzini Cc: Marc Zyngier , Huacai Chen , Aleksandar Markovic , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Matthew Rosato , Eric Farman , Vitaly Kuznetsov , 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 Subject: Re: [PATCH 39/44] KVM: Drop kvm_count_lock and instead protect kvm_usage_count with kvm_lock Message-ID: References: <20221102231911.3107438-1-seanjc@google.com> <20221102231911.3107438-40-seanjc@google.com> <7b6ce80e-7f1f-11cd-8bde-8d8fa9fd7e1d@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7b6ce80e-7f1f-11cd-8bde-8d8fa9fd7e1d@redhat.com> X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,FSL_HELO_FAKE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_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 On Thu, Nov 03, 2022, Paolo Bonzini wrote: > On 11/3/22 00:19, Sean Christopherson wrote: > > +- kvm_lock is taken outside kvm->mmu_lock > > Not surprising since one is a mutex and one is an rwlock. :) Heh, Signed-off-by: Captain Obvious > You can drop this hunk as well as the "Opportunistically update KVM's locking > documentation" sentence in the commit message. Will do. > > - vcpu->mutex is taken outside kvm->arch.hyperv.hv_lock > > - kvm->arch.mmu_lock is an rwlock. kvm->arch.tdp_mmu_pages_lock and > > @@ -216,15 +220,11 @@ time it will be set using the Dirty tracking mechanism described above. > > :Type: mutex > > :Arch: any > > :Protects: - vm_list > > - > > -``kvm_count_lock`` > > -^^^^^^^^^^^^^^^^^^ > > - > > -:Type: raw_spinlock_t > > -:Arch: any > > -:Protects: - hardware virtualization enable/disable > > -:Comment: 'raw' because hardware enabling/disabling must be atomic /wrt > > - migration. > > + - kvm_usage_count > > + - hardware virtualization enable/disable > > + - module probing (x86 only) > > What do you mean exactly by "module probing"? Is it anything else than what > is serialized by vendor_module_lock? Ooh, I forgot to update this patch after switching to vendor_module_lock. I added the above after fixing the first deadlock between kvm_lock and cpu_hotplug_lock, but later gave up on trying to use kvm_lock after deadlock #2, which is when I when I realized piggybacking kvm_lock was going to be a maintainance nightmare due.