Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp286378pxm; Wed, 2 Mar 2022 15:28:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJxhqmNiz5jLvnxBt1i4N58Xb3v/ftOd82aVYL7cxcuHuZWyQvox0FU0C528/GkXB2rP3gcY X-Received: by 2002:a17:902:b60b:b0:150:c60:28d0 with SMTP id b11-20020a170902b60b00b001500c6028d0mr33034416pls.116.1646263681253; Wed, 02 Mar 2022 15:28:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646263681; cv=none; d=google.com; s=arc-20160816; b=PNpDkHz9X9cuo0Hd4TIe0CnQ8kiMaOU5n62brD96ni/Khb2WY+ti+LytrgqFKe/542 uBgiMtXgZ6NhQDl5aDAEs1P18yZ3GLAoXEsDmpuowQKbUB1l35wU74OADZ35UqFJbxHq LZ+3Nkiss7mZOaBVPbrCT+kmAjyasrMOL99kB+9O9OimAE2Ult8K29bkODPmCDy6aQkI R6k/yYLSB7b2+YLbHE/9n1Imc+oTb0DPahse3lgZF8wFjNVOs2y/U7FDj8+trZp8gTvH Cggf0lGhq0pJrk6M4oJD+WglzHf0AGOaCgeJ966Nak27vLSmUSkj0P/+BhAouv3YqlDp 1BUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=hVPJAaQMiU/UUVUed6uCDuKTMuf559KPWfX+wu4fTKk=; b=rfwT/GOH+qnvxoK3ZaPOZN5HO6LujCDZJzjPD5a8j/xce7dQgmFt38W8bFbbiW9rS2 IqynHOn35eKvn0BZly/bBSmrcSPSTPbCCe6sfNhK0ZG3elJ/xLyshcYeAQOPsIBnKbPX XnklQbQjQ0StZrPFE8arTMVvq6V63W4GHlGp8PcPKVIk7wX615S5J/7VUhG2kgjJAmIW 9NXuQQv5thoB9ADScaodPpHm7dSNm56EanVm6y6lYRSB6adG7msU0UUIVTtc26OeoGeN AfvVjl5tSIt2qbkqnUM9/3zoJEus1dedbpDNp6uL8JGIY5i2qhM7yz6W0Gn4qXBfS9oe AOxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JLyr3XVR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id m68-20020a625847000000b004e1be993018si398825pfb.192.2022.03.02.15.28.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 15:28:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JLyr3XVR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7476014344D; Wed, 2 Mar 2022 15:00:05 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237012AbiCBUPU (ORCPT + 99 others); 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-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 X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE 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 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