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 C12D3C433F5 for ; Wed, 2 Mar 2022 20:14:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239654AbiCBUPU (ORCPT ); Wed, 2 Mar 2022 15:15:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229603AbiCBUPT (ORCPT ); Wed, 2 Mar 2022 15:15:19 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 71909CD5E6 for ; Wed, 2 Mar 2022 12:14:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646252074; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hVPJAaQMiU/UUVUed6uCDuKTMuf559KPWfX+wu4fTKk=; b=JLyr3XVRdF+iNO2pTKCk5TZJk8vHcFRgOUaAr5KontrZHrury0+9V5KoS7TUunmjQkAJLq J7wNnPwzhupsfEU+HruG/8iXxtIx6zVMAKtGleYhS5U6lr9Ij8A00wUR05R23ZvUwFV0MT F4nosfsFq0nFobw3gvMir7Kuaaor8t8= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-3-SyPjmeHkPo-aCibTrLHFvw-1; Wed, 02 Mar 2022 15:14:33 -0500 X-MC-Unique: SyPjmeHkPo-aCibTrLHFvw-1 Received: by mail-wr1-f70.google.com with SMTP id ay18-20020a5d6f12000000b001efe36eb038so1032621wrb.17 for ; Wed, 02 Mar 2022 12:14:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=hVPJAaQMiU/UUVUed6uCDuKTMuf559KPWfX+wu4fTKk=; b=bwiNlFghp/E8R4xMs2NX+MYcvK81A5mEU1Sagv1l5ho7yXAEdgFz0PUyG66+chYb/4 t5tLVYh/lc6ildtUgOfkjWog+ZH31wWe5U9h9LlDS8SRVnyavjPmF/1Vq84B+0kJ0OQ/ hxcIsZd4cDRnVZBw6D6zdKfruKQ52zAu3+r/ceSwa/9g8JUUFUz4pStN9VhKyrAC3sUp ydo0xTzOw0c9jNshxukjm00yVHtquTgMuDnAhdDDZusM3NM1Ipq9zQkgLfiwWZ2YSiyv SI6lvIl5YcKa+1FqEiLeXmGoxahqVyIqjNzQJY2rD9UJPHYQHCc2LXuOqlSyVlP0MIfe D+Gg== X-Gm-Message-State: AOAM531i/qrs6aeKeqpHgIC/hGZMFIgSmL+2Jq1NHi+AZZfyfx14vZS5 0PlQckcuZS8kbZ/GQVpr3rOU76ab9KDBl1F9TOd5fYp+sUyejpHvPLLc/wXgKBJ8CkRQ0JalOqk LuyC/GWYn6l8vPTIlBVx9nxFJ X-Received: by 2002:adf:f201:0:b0:1ed:c254:c1a2 with SMTP id p1-20020adff201000000b001edc254c1a2mr23961958wro.106.1646252072321; Wed, 02 Mar 2022 12:14:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJx1zw1C/i+VIT8MtTcEQD8KuDJhh889JvGLZ/u+ULO+AHhA9U6wjqYo14xKshNpXSJG0n0dqw== X-Received: by 2002:adf:f201:0:b0:1ed:c254:c1a2 with SMTP id p1-20020adff201000000b001edc254c1a2mr23961947wro.106.1646252072075; Wed, 02 Mar 2022 12:14:32 -0800 (PST) Received: from ?IPV6:2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e? ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.googlemail.com with ESMTPSA id g7-20020a5d5407000000b001e2628b6490sm17993wrv.17.2022.03.02.12.14.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Mar 2022 12:14:31 -0800 (PST) Message-ID: <442859af-6454-b15e-b2ad-0fc7c4e22909@redhat.com> Date: Wed, 2 Mar 2022 21:14:25 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v3 22/28] KVM: x86/mmu: Zap defunct roots via asynchronous worker Content-Language: en-US To: Sean Christopherson Cc: Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , David Hildenbrand , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, David Matlack , Ben Gardon , Mingwei Zhang References: <20220226001546.360188-1-seanjc@google.com> <20220226001546.360188-23-seanjc@google.com> From: Paolo Bonzini In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/2/22 20:33, Sean Christopherson wrote: > What about that idea? Put roots invalidated by "fast zap" on_another_ list? > My very original idea of moving the roots to a separate list didn't work because > the roots needed to be reachable by the mmu_notifier. But we could just add > another list_head (inside the unsync_child_bitmap union) and add the roots to > _that_ list. Perhaps the "separate list" idea could be extended to have a single worker for all kvm_tdp_mmu_put_root() work, and then indeed replace kvm_tdp_mmu_zap_invalidated_roots() with a flush of _that_ worker. The disadvantage is a little less parallelism in zapping invalidated roots; but what is good for kvm_tdp_mmu_zap_invalidated_roots() is just as good for kvm_tdp_mmu_put_root(), I suppose. If one wants separate work items, KVM could have its own workqueue, and then you flush that workqueue. For now let's do it the simple but ugly way. Keeping next_invalidated_root() does not make things worse than the status quo, and further work will be easier to review if it's kept separate from this already-complex work. Paolo