From mboxrd@z Thu Jan 1 00:00:00 1970 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 6C2B3C433FE for ; Tue, 8 Mar 2022 21:29:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350458AbiCHVaK (ORCPT ); Tue, 8 Mar 2022 16:30:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350480AbiCHVaH (ORCPT ); Tue, 8 Mar 2022 16:30:07 -0500 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8047649CB1 for ; Tue, 8 Mar 2022 13:29:09 -0800 (PST) Received: by mail-pg1-x52f.google.com with SMTP id 132so243500pga.5 for ; Tue, 08 Mar 2022 13:29:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=LMQ8AOMqqmqopzig17jUsU9/I303Wa2KV8iSyK2C8QA=; b=WNDbXoXIOar/wXxjMrbLZybR4KUBP9I7doIbDaHXlaOZvNyWWyEki6sfU6jGydFaRk eXOv1p69nRIvQy5jat7OAdT48dIFywwEon4KKy1nYiLVVs+i6fMpNzUbGueLFWYLr6I9 2rQbA023WRUUnsPQW32MJnzDsUOYuvgwdHOrDBgHBVU6mOJX4XfkQG7S2orpc15vMA9G 0krpTjx4KgzEzHwMv4rJOZmsTRKBZ/ks2icky8g2MiZ7cCnou26T1teHclapxVJAGYIG nXqx4joM5vxY6I4TLRX4ZFKuOd0IerD3ZeF6h1/jPnGRcGYo0D1BTsHJucbuZ9xlFQAY 4mpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=LMQ8AOMqqmqopzig17jUsU9/I303Wa2KV8iSyK2C8QA=; b=eID6+ZPVgsRRS0K97Ex/Gvo6i6me4eb/HS3fbdl7nEkq8k2H/Cz+h8Pl4APQHr3dKf 4g8kp1wcso3U5gkYxilh9uiUnfWYKm8aJzQyrMeGGeIwxapX+aK+VHxNGPDtw6EsjG5+ ROgRms0UFVb7ok+nsU+zJemtfwjI+D6Xb+KlztIN769YRAwVnPEN0J9NazFOW7qRw9vs o+iZ7H+wMeIO1MT0o73opO1yfXYYPfWDCZHSyQ/7t13fo+zL3lg6Po8VAuAnvUYuY+0U OMTte3UBq3NK9UbbBxl02VWQlK5YL3gfA0oEBsgicDQ3a0R8PXhFgjbNtuxu9e39NSmB VfQw== X-Gm-Message-State: AOAM5304luAI8mK/jqXClHM8J1N4yza8f29p8ZAsB/j6ljbYfqocuYgC GljMt3kNabqHdB5ZltGCYkK4DQ== X-Google-Smtp-Source: ABdhPJxaudcIUUVL6UZGM/dSdkzC6iFnk2758wDZzs2B1y5Sgh+P0ylUpx0H2Bb0QaOPv2Z/zEl48w== X-Received: by 2002:a63:e84b:0:b0:372:a079:302 with SMTP id a11-20020a63e84b000000b00372a0790302mr15745200pgk.272.1646774948794; Tue, 08 Mar 2022 13:29:08 -0800 (PST) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id o1-20020a637e41000000b003804d0e2c9esm51728pgn.35.2022.03.08.13.29.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 13:29:07 -0800 (PST) Date: Tue, 8 Mar 2022 21:29:04 +0000 From: Sean Christopherson To: Paolo Bonzini Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , David Hildenbrand , David Matlack , Ben Gardon , Mingwei Zhang Subject: Re: [PATCH v4 21/30] KVM: x86/mmu: Zap invalidated roots via asynchronous worker Message-ID: References: <20220303193842.370645-1-pbonzini@redhat.com> <20220303193842.370645-22-pbonzini@redhat.com> <8b8c28cf-cf54-f889-be7d-afc9f5430ecd@redhat.com> <20497464-0606-7ea5-89b8-8f5cd56a1a68@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20497464-0606-7ea5-89b8-8f5cd56a1a68@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Mar 05, 2022, Paolo Bonzini wrote: > On 3/5/22 01:34, Sean Christopherson wrote: > > On Fri, Mar 04, 2022, Paolo Bonzini wrote: > > > On 3/4/22 17:02, Sean Christopherson wrote: > > > > On Fri, Mar 04, 2022, Paolo Bonzini wrote: > > > > > On 3/3/22 22:32, Sean Christopherson wrote: > > > > > I didn't remove the paragraph from the commit message, but I think it's > > > > > unnecessary now. The workqueue is flushed in kvm_mmu_zap_all_fast() and > > > > > kvm_mmu_uninit_tdp_mmu(), unlike the buggy patch, so it doesn't need to take > > > > > a reference to the VM. > > > > > > > > > > I think I don't even need to check kvm->users_count in the defunct root > > > > > case, as long as kvm_mmu_uninit_tdp_mmu() flushes and destroys the workqueue > > > > > before it checks that the lists are empty. > > > > > > > > Yes, that should work. IIRC, the WARN_ONs will tell us/you quite quickly if > > > > we're wrong :-) mmu_notifier_unregister() will call the "slow" kvm_mmu_zap_all() > > > > and thus ensure all non-root pages zapped, but "leaking" a worker will trigger > > > > the WARN_ON that there are no roots on the list. > > > > > > Good, for the record these are the commit messages I have: > > I'm seeing some hangs in ~50% of installation jobs, both Windows and Linux. > I have not yet tried to reproduce outside the automated tests, or to bisect, > but I'll try to push at least the first part of the series for 5.18. Out of curiosity, what was the bug? I see this got pushed to kvm/next.