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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D37ECC433EF for ; Mon, 2 May 2022 16:41:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2869F6B0071; Mon, 2 May 2022 12:41:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 233CA6B0073; Mon, 2 May 2022 12:41:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0D49A6B0074; Mon, 2 May 2022 12:41:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id EF96B6B0071 for ; Mon, 2 May 2022 12:41:36 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id AB74F2A5C6 for ; Mon, 2 May 2022 16:41:36 +0000 (UTC) X-FDA: 79421368992.30.B6C86B3 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) by imf20.hostedemail.com (Postfix) with ESMTP id A583E1C0008 for ; Mon, 2 May 2022 16:41:30 +0000 (UTC) Received: by mail-wr1-f46.google.com with SMTP id j15so20296705wrb.2 for ; Mon, 02 May 2022 09:41:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=62IvqHI1fPfsDTYOxWAZqLaXvv0bxV93yimr+M9jpt0=; b=iHyOCwWrlVytNmY5kDXsFKgvgBdgQH093JMTVYtj7C6PiNMnkjycoz77hO2//mqSBu 0FV0FBD0afAWefBbtJc09h06uiwVGguAhFvxPvI6OoaoXbtGw394E557wKd0p3W9c4RS cXnCtuUMM9/47EHG6Y4VC9dKvVdb0tEs2s85Irpc7ugM0EQr2GzExoAWKSD/Y47cljaM mDRQk2ukFTBc2sLdpwVcfjIYmaQr9t/I9aQJfVseMfbQNnntZUQ3cUThoWda7/djKML1 zQgQqYTxkFPqf/yJCXbYGbRlstb5n3iL4Vz0+YKx20H8Fq5s4zVEjqyftbKsnF6Oc31F X9ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=62IvqHI1fPfsDTYOxWAZqLaXvv0bxV93yimr+M9jpt0=; b=axS4h/ML6QyKFozdScpNFIdgHKr3gj2jl8Q2+UvCRdR8cWQVc/9qIOjrhR9qZKNNJX 47GNmV99Pwk4xIsRIvT6MFiwyT1/No7KwEut/XoQxsJXBRpAeaYXddz5YsyJqIZenKRl oV7LGeyccmnJJwE+AGFJoCP2SeekJ4DMIyCmZl0H+9BLCCkm7ovQNukCcxQ+HgpdKWHm D3dX/IRr+m7J3JzDm26dlI1m5XcFCqaWZXO92R+Rvb+E96hoHF73qieTgJCN1um7+qCf pid2wKLOeoutjrFTPmJMZNyhW5eFfVeNQ/S1WTOhHp9Jnl/Dmc9uyzW0Lkva/yof8Q8z uLhg== X-Gm-Message-State: AOAM531gyECQYrte2xf/t8plH9OE3D0mt7i8ZCUR6Ptw+V/22I+LWI4v JW1wxvXe4pjV6EFF8MH+ybpbjAFdkkkNv1ZCgqd8Xw== X-Google-Smtp-Source: ABdhPJzw3szkktfP5cD9rxhTjLw4EIjWshOQOMc+1Sm/TArbNr+CWDqd6B+lq74OgNTIKetf+oIw0DNRJSjAbJP+jEU= X-Received: by 2002:a05:6000:1815:b0:20a:deee:3cf0 with SMTP id m21-20020a056000181500b0020adeee3cf0mr9846614wrh.210.1651509694568; Mon, 02 May 2022 09:41:34 -0700 (PDT) MIME-Version: 1.0 References: <20220429201131.3397875-1-yosryahmed@google.com> <20220429201131.3397875-5-yosryahmed@google.com> <87k0b4i7se.wl-maz@kernel.org> In-Reply-To: <87k0b4i7se.wl-maz@kernel.org> From: Yosry Ahmed Date: Mon, 2 May 2022 09:41:23 -0700 Message-ID: Subject: Re: [PATCH v4 4/4] KVM: arm64/mmu: count KVM s2 mmu usage in secondary pagetable stats To: Marc Zyngier Cc: Alexandru Elisei , Andrew Morton , James Morse , Jim Mattson , Joerg Roedel , Johannes Weiner , Michal Hocko , Oliver Upton , Paolo Bonzini , Roman Gushchin , Sean Christopherson , Shakeel Butt , Suzuki K Poulose , Tejun Heo , Vitaly Kuznetsov , Wanpeng Li , Zefan Li , cgroups@vger.kernel.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Content-Type: multipart/alternative; boundary="000000000000b0b71305de0a10c8" Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=iHyOCwWr; spf=pass (imf20.hostedemail.com: domain of yosryahmed@google.com designates 209.85.221.46 as permitted sender) smtp.mailfrom=yosryahmed@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspam-User: X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: A583E1C0008 X-Stat-Signature: y4yabmm5enetu13191z6fj831n6ys37t X-HE-Tag: 1651509690-460189 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: --000000000000b0b71305de0a10c8 Content-Type: text/plain; charset="UTF-8" On Mon, May 2, 2022 at 2:48 AM Marc Zyngier wrote: > On Mon, 02 May 2022 08:24:28 +0100, > Oliver Upton wrote: > > > > Hi Yosry, > > > > On Fri, Apr 29, 2022 at 08:11:31PM +0000, Yosry Ahmed wrote: > > > Count the pages used by KVM in arm64 for stage2 mmu in secondary > pagetable > > > stats. > > > > > > Signed-off-by: Yosry Ahmed > > > --- > > > arch/arm64/kvm/mmu.c | 35 +++++++++++++++++++++++++++++++---- > > > 1 file changed, 31 insertions(+), 4 deletions(-) > > > > > > diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c > > > index 53ae2c0640bc..fc5030307cce 100644 > > > --- a/arch/arm64/kvm/mmu.c > > > +++ b/arch/arm64/kvm/mmu.c > > > @@ -92,9 +92,13 @@ static bool kvm_is_device_pfn(unsigned long pfn) > > > static void *stage2_memcache_zalloc_page(void *arg) > > > { > > > struct kvm_mmu_memory_cache *mc = arg; > > > + void *virt; > > > > > > /* Allocated with __GFP_ZERO, so no need to zero */ > > > - return kvm_mmu_memory_cache_alloc(mc); > > > + virt = kvm_mmu_memory_cache_alloc(mc); > > > + if (virt) > > > + kvm_account_pgtable_pages(virt, +1); > > > > Sorry I didn't say it last time around, would now be a good time to > > clean up the funky sign convention of kvm_mod_used_mmu_pages()? Or limit > > the funk to just x86 :) > > Indeed. I pointed this out in my initial review of this series, and > expected these to be gone by now. Hey everyone, Sorry about that. Will clean that up in the next version. > > M. > > -- > Without deviation from the norm, progress is not possible. > --000000000000b0b71305de0a10c8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Mon, May 2, 2022 at 2:48 AM Marc Zyngier <maz@kernel.org> wrote:
On Mon, 02 May 2022 08:24:28 +0100,
Oliver Upton <oup= ton@google.com> wrote:
>
> Hi Yosry,
>
> On Fri, Apr 29, 2022 at 08:11:31PM +0000, Yosry Ahmed wrote:
> > Count the pages used by KVM in arm64 for stage2 mmu in secondary = pagetable
> > stats.
> >
> > Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
> > ---
> >=C2=A0 arch/arm64/kvm/mmu.c | 35 +++++++++++++++++++++++++++++++--= --
> >=C2=A0 1 file changed, 31 insertions(+), 4 deletions(-)
> >
> > diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
> > index 53ae2c0640bc..fc5030307cce 100644
> > --- a/arch/arm64/kvm/mmu.c
> > +++ b/arch/arm64/kvm/mmu.c
> > @@ -92,9 +92,13 @@ static bool kvm_is_device_pfn(unsigned long pf= n)
> >=C2=A0 static void *stage2_memcache_zalloc_page(void *arg)
> >=C2=A0 {
> >=C2=A0 =C2=A0 =C2=A0struct kvm_mmu_memory_cache *mc =3D arg;
> > +=C2=A0 =C2=A0void *virt;
> >=C2=A0
> >=C2=A0 =C2=A0 =C2=A0/* Allocated with __GFP_ZERO, so no need to ze= ro */
> > -=C2=A0 =C2=A0return kvm_mmu_memory_cache_alloc(mc);
> > +=C2=A0 =C2=A0virt =3D kvm_mmu_memory_cache_alloc(mc);
> > +=C2=A0 =C2=A0if (virt)
> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0kvm_account_pgtable_pag= es(virt, +1);
>
> Sorry I didn't say it last time around, would now be a good time t= o
> clean up the funky sign convention of kvm_mod_used_mmu_pages()? Or lim= it
> the funk to just x86 :)

Indeed. I pointed this out in my initial review of this series, and
expected these to be gone by now.

<= div dir=3D"auto">Hey everyone,

Sorry about that. Will clean that up in the next version.



=C2=A0 =C2=A0 =C2=A0 =C2=A0 M.

--
Without deviation from the norm, progress is not possible.
--000000000000b0b71305de0a10c8--