Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp3816771pxy; Tue, 4 May 2021 10:32:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIC/f8fKKUJ+rZnyZXlq8DG5nhEKOy2Ut8hPCEegieMKO7K3IWcNdzoSS8VCq23WdhdD6s X-Received: by 2002:a05:6a00:cd3:b029:27f:c296:4a5d with SMTP id b19-20020a056a000cd3b029027fc2964a5dmr24844152pfv.38.1620149534321; Tue, 04 May 2021 10:32:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620149534; cv=none; d=google.com; s=arc-20160816; b=i0EzlFfWn3oUN7/5yfpKFiy6fhiWYFdP8Tg04HdMBjDSz8D0rxrN7Bgew4Ie7Zl14M DVH74pTLPCDm8SQNG+inXJbJNexxxQsqnHIx/WnTB4V2D1kTanic9xkA/KoUvjjQbtyF UV4Z4TbzUcZIlJJk81WE/qb+QflpNopEJtdELS136rtV+6dcRKreZIDZjkwCMgQDVduW anJs2OsDV0uVmbXtW9QjV9ePstFpq2oofwf9aBOWcuRYOx2NOAHy9JOkuvMhh9Qyq2gg byNgs/Ac9D8X7JnKzaExpP/RCNH8Woyj4Je2kLVKMyOITh9+3cPYzurO+yHvFCqUbBFq at1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=nSjAAu8/uv2OHnvht3tsCA/NqO7UE0bjKWBDG7VyVvs=; b=fyODNjHWqTp8qtbG+p5Wl5kpldES9BxVoUuQkMvMi6LRlzRaLZ8DRXBzS1M1mKaZ6X R+ieZ4t8FpsrpoDdZMLq5Z5hOAB6DVl2x4XSUjgDsuhz6l9YPN0341tO1qC0WIngXkF9 IxEAeqgk/djQUhmOpWwr6+vQa9HBR4ui1HPspBqI6/2I8YOVA7T96G64GWdPuueldNDI UlSi7RCl4rJWF0twsF2iMQUBPDm512qtURI86SChiQCDrQ3A+MjWe3wySNpyzGPVKKgz gHu9G+xuAzIjSdGqYxF32lb6GMo2SYn9Aa9Q8Ep1HZSwR/HGwOIBLRg61UhfBfaxaq0I /2mQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=fR+qBddI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 84si17477966pfu.307.2021.05.04.10.31.59; Tue, 04 May 2021 10:32:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=fR+qBddI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S230256AbhEDR3e (ORCPT + 99 others); Tue, 4 May 2021 13:29:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230379AbhEDR3d (ORCPT ); Tue, 4 May 2021 13:29:33 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C4D6C06174A for ; Tue, 4 May 2021 10:28:38 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id u13so8697341edd.3 for ; Tue, 04 May 2021 10:28:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=nSjAAu8/uv2OHnvht3tsCA/NqO7UE0bjKWBDG7VyVvs=; b=fR+qBddIZH/jxUspHZqc2eSdJx08Os3neWEKcaxQHMt+9ypWw6vZq//LjxaT/Q6VAd 1+u3o6EoIDeKvuQxbNTlCKOT9PT8CFxOPjUwEbCrAA9GC9Qiw7HxBW6AGlFF70RIc4Dz tLi2r65CF7MVh5bcUWd2RP5tqbKiQmlaV9lFgBwEKm3ShCg3dAUNU9fUa20lmv5czMtA jKzRNwpon3/Z5MC3oIwK8T+Q+UjRpzJK5raqx3e35nsa1Up+In/TiarYlMQc2AKNGtkW n9aDMkbRF8jG1sr6+IyDhwwmR9E/WcNl3yUx+xSSNsJF23vvqi7R2jrWFWKx890V8Ycj dWyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=nSjAAu8/uv2OHnvht3tsCA/NqO7UE0bjKWBDG7VyVvs=; b=CfTcmHO823l68nC4cC1p64DeHersmpYYz/NVzXl/l33EP4cWBWZ7l6SEmsWwiEhgxX A9cJ3Q7Z03Wblbr5WMBV6/UM76D1RBKr0fNVkbdGwwa0x0dK/KlZjk2kbe0FBMPwhnNH KyBd0pSZteFWBi9wngGe+ahfknY3hGby+qyIkYTs6fzeORKOU1ypujkiAWRk48xyogHL /lBjC9tiXgDk1oTJ7NTbVxGRCbw9HXvx4QfzhjUj7ajF3xWjUcsQzPncmClz0RJPrSZc 54sKNyeFWP9Q8sKcH5/vd3A6D+9twDBkRZdOhcDgQgV/mEQkzCeGvT8dKwybrGQfN6Nw PK0A== X-Gm-Message-State: AOAM5328btvRAC/TQ+tnhsA1t2VJ6L8/WyuVMuidNyYUZmqTFGUp8L/v POUpMMpnuIeMju2roZdO6dATZd/RFZyA9V+vu5uCrw== X-Received: by 2002:a05:6402:3090:: with SMTP id de16mr27183674edb.177.1620149317162; Tue, 04 May 2021 10:28:37 -0700 (PDT) MIME-Version: 1.0 References: <20210429211833.3361994-1-bgardon@google.com> <4d27e9d6-42db-3aa1-053a-552e1643f46d@redhat.com> In-Reply-To: <4d27e9d6-42db-3aa1-053a-552e1643f46d@redhat.com> From: Ben Gardon Date: Tue, 4 May 2021 10:28:24 -0700 Message-ID: Subject: Re: [PATCH v2 0/7] Lazily allocate memslot rmaps To: Paolo Bonzini Cc: LKML , kvm , Peter Xu , Sean Christopherson , Peter Shier , Junaid Shahid , Jim Mattson , Yulei Zhang , Wanpeng Li , Vitaly Kuznetsov , Xiao Guangrong Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 4, 2021 at 12:21 AM Paolo Bonzini wrote: > > On 03/05/21 19:31, Ben Gardon wrote: > > On Mon, May 3, 2021 at 6:45 AM Paolo Bonzini wrote: > >> > >> On 29/04/21 23:18, Ben Gardon wrote: > >>> This series enables KVM to save memory when using the TDP MMU by waiting > >>> to allocate memslot rmaps until they are needed. To do this, KVM tracks > >>> whether or not a shadow root has been allocated. In order to get away > >>> with not allocating the rmaps, KVM must also be sure to skip operations > >>> which iterate over the rmaps. If the TDP MMU is in use and we have not > >>> allocated a shadow root, these operations would essentially be op-ops > >>> anyway. Skipping the rmap operations has a secondary benefit of avoiding > >>> acquiring the MMU lock in write mode in many cases, substantially > >>> reducing MMU lock contention. > >>> > >>> This series was tested on an Intel Skylake machine. With the TDP MMU off > >>> and on, this introduced no new failures on kvm-unit-tests or KVM selftests. > >> > >> Thanks, I only reported some technicalities in the ordering of loads > >> (which matter since the loads happen with SRCU protection only). Apart > >> from this, this looks fine! > > > > Awesome to hear, thank you for the reviews. Should I send a v3 > > addressing those comments, or did you already make those changes when > > applying to your tree? > > No, I didn't (I wanted some oversight, and this is 5.14 stuff anyway). Ah, okay I'll send out a v3 soon, discussion on the other patches settles. > > Paolo >