Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4244201rdh; Tue, 28 Nov 2023 16:31:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IFfU+hXAMhGRvVsZsZa+3t4dwkzFNyfJroZJjBWaa9HMo1emUzLqB4xbM5Em/WOuR8h9t1d X-Received: by 2002:a17:902:f691:b0:1cf:dbda:7307 with SMTP id l17-20020a170902f69100b001cfdbda7307mr6722632plg.39.1701217916568; Tue, 28 Nov 2023 16:31:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701217916; cv=none; d=google.com; s=arc-20160816; b=pBcM7kloeVCe644nqXP62EppMT/ux4USGjLeBHyq+R71ySdhiTUqCc/5p2rwbXup5H Jj3FvlksSgg0999BY/4SX5grWV/CL9E/30NPla6ojDdTDri29diSexPQonnTwXM0En51 1Ls4Ym3qCporFGJKozQN5V5oC+IoM1OBlXcqIixusDdtF3P99unlz3xvuN/QGqwWyKEf kBet6zusdfGrkq+mG5bv+Ur4wLw2LWxrJnrJ+bqi3Cvy0u5Jk3EOV121DKb+n4znO6tL TDOZbm1zxZMBEGJm7TgKNAujF82Xmwfgi0yfMT/UWYUDILyrh9hhbq7KBLcA06yc6OpL 9U3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=yDVw23sOg2UrJKrxIvmA3Ztov9BQ3aaP2pKc9NVQp+Q=; fh=wNKTS6x2D9eXMgRxue3pIp+w2ZGkCpquAMf/QWqFMsU=; b=VGQRmr69r1lsgexUBSLESDBhfoKus04avBDiM6JzwXJGEF04fzRp6HwduNTUKPmElR cTOMm5afuWvyYTEQfb5b6Kvn29u+LKg532ERuURjgzIsxDuqgHVmomCi2M7cOeWQEnry u8JeUjs86hD+90eu4Jq6OBIwbDag1ENZUFEX0Q00Sgkn9YMtfxwFWRWd3U1EnS6NWNHr o01pZSBWF/Y1LATlk2yNsTOORKG3P+WpnLUqd19AsTO+KabYNa5QhI3blNi2iR8tx4cc t4fvILauq5ZTOCKNp1rEIPgPjYyAvKL/aqTl9FxJrd/ETSVh6wjG8Mxux24UVIzACvuw Y8mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=gDwjyiF7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id i7-20020a170902c94700b001cfdd05b56esi4210641pla.202.2023.11.28.16.31.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 16:31:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=gDwjyiF7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id C60E18087251; Tue, 28 Nov 2023 16:31:13 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376673AbjK2AbB (ORCPT + 99 others); Tue, 28 Nov 2023 19:31:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229718AbjK2AbA (ORCPT ); Tue, 28 Nov 2023 19:31:00 -0500 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EDC619AA for ; Tue, 28 Nov 2023 16:31:05 -0800 (PST) Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-a00ac0101d9so836583366b.0 for ; Tue, 28 Nov 2023 16:31:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701217863; x=1701822663; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=yDVw23sOg2UrJKrxIvmA3Ztov9BQ3aaP2pKc9NVQp+Q=; b=gDwjyiF7xNTtWpq7+MYFD/sxdzxaRyGsMPmmguE6RLn9kMovj79BXTluE+6i4TQyWC /sVq1cKGb+r9h7ZU21fez0kbz3B6t2VAohfsCM3+3AaLjFTOhrwuGJ6lkhxbobIG/sIl N3U5AwUGZXsTAJ2WcKn1qO0yCbQdipNorV4GlHJKl0EyMJKmM2yMY8TTl1x/GBNiLRnj eEg/gnWreW4Ql8i3VMqQyOt7wAjrmbgNfd4pH1QdTnxKlV2FUXP7ZpTUWX4ydvmDAI4x jMUcsziXQf71dqjWrWOHnMAqxfmly1bHEKlaZp1DIOrJVbVAtd+Ul9CbM8qtQzUQvY1I GqlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701217863; x=1701822663; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yDVw23sOg2UrJKrxIvmA3Ztov9BQ3aaP2pKc9NVQp+Q=; b=kJRuH+5lkI0tA2pG52SuSimrWCdbYzFWY+JAV0gmml2e2nG8x7/L1nILKI64Km6w8E PgZEopgzYBIwdnIWzOAEWuBZkb//sp3sCfPt3zl1hJ9hNR8/m8upzXkNNtRzmhYIDgxx 4Zyq9ZqjXkbAALKBJ7GhsSmgl0lhAXDMelTHfZbTVIoZaXkGkOdTjK6usoKI8fxYxWMT /J84I0yLnEc3WdhlGSut+O8uApe5Ak+Yiyz/UpBYHw/BZO6S3RNmF9acqQP0c3Bf/BXZ cVLudHbHKTcYdyybJLn89K7IZBNKQYUhf2htg8AUHqbswA6HYziIhSx81hTS6fZ9+Bra h+sA== X-Gm-Message-State: AOJu0Yw1oc//p7WjeN//7RiHRTAfvZCRR5jPBrmvxR0jP270nVTtI8Zj fQbnIeW3t3Zk+WhZBF8ac7fBGqZB0ScOt++h6XYd0Q== X-Received: by 2002:a17:906:48d5:b0:a11:7ba8:6891 with SMTP id d21-20020a17090648d500b00a117ba86891mr5048211ejt.67.1701217863358; Tue, 28 Nov 2023 16:31:03 -0800 (PST) MIME-Version: 1.0 References: <20231128204938.1453583-1-pasha.tatashin@soleen.com> <20231128235214.GD1312390@ziepe.ca> <20231129002826.GG1312390@ziepe.ca> In-Reply-To: <20231129002826.GG1312390@ziepe.ca> From: Yosry Ahmed Date: Tue, 28 Nov 2023 16:30:27 -0800 Message-ID: Subject: Re: [PATCH 00/16] IOMMU memory observability To: Jason Gunthorpe Cc: Pasha Tatashin , akpm@linux-foundation.org, alex.williamson@redhat.com, alim.akhtar@samsung.com, alyssa@rosenzweig.io, asahi@lists.linux.dev, baolu.lu@linux.intel.com, bhelgaas@google.com, cgroups@vger.kernel.org, corbet@lwn.net, david@redhat.com, dwmw2@infradead.org, hannes@cmpxchg.org, heiko@sntech.de, iommu@lists.linux.dev, jasowang@redhat.com, jernej.skrabec@gmail.com, jonathanh@nvidia.com, joro@8bytes.org, kevin.tian@intel.com, krzysztof.kozlowski@linaro.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-rockchip@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-tegra@vger.kernel.org, lizefan.x@bytedance.com, marcan@marcan.st, mhiramat@kernel.org, mst@redhat.com, m.szyprowski@samsung.com, netdev@vger.kernel.org, paulmck@kernel.org, rdunlap@infradead.org, robin.murphy@arm.com, samuel@sholland.org, suravee.suthikulpanit@amd.com, sven@svenpeter.dev, thierry.reding@gmail.com, tj@kernel.org, tomas.mudrunka@gmail.com, vdumpa@nvidia.com, virtualization@lists.linux.dev, wens@csie.org, will@kernel.org, yu-cheng.yu@intel.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 28 Nov 2023 16:31:13 -0800 (PST) On Tue, Nov 28, 2023 at 4:28=E2=80=AFPM Jason Gunthorpe wrot= e: > > On Tue, Nov 28, 2023 at 04:25:03PM -0800, Yosry Ahmed wrote: > > > > > Right, but as I mention above, if userspace starts depending on thi= s > > > > equation, we won't be able to add any more classes of "secondary" p= age > > > > tables to SecPageTables. I'd like to avoid that if possible. We can= do > > > > the subtraction in the kernel. > > > > > > What Sean had suggested was that SecPageTables was always intended to > > > account all the non-primary mmu memory used by page tables. If this i= s > > > the case we shouldn't be trying to break it apart into finer > > > counters. These are big picture counters, not detailed allocation by > > > owner counters. > > > > Right, I agree with that, but if SecPageTables includes page tables > > from multiple sources, and it is observed to be suspiciously high, the > > logical next step is to try to find the culprit, right? > > You can make that case already, if it is high wouldn't you want to > find the exact VMM process that was making it high? > > It is a sign of fire, not a detailed debug tool. Fair enough. We can always add separate counters later if needed, potentially under KVM stats to get more fine-grained details as you mentioned. I am only worried about users subtracting the iommu-only counter to get a KVM counter. We should at least document that SecPageTables may be expanded to include other sources later to avoid that. > > Jason