Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4253931rdh; Tue, 28 Nov 2023 16:55:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IFwiRLQYiluIGLM2D/UPR2CDRQxTPm3NXBYlUvgmWU0crcLffc5J/Th6zN82lgi0J4ZfGtI X-Received: by 2002:a05:6a21:99a7:b0:18a:b5c3:55db with SMTP id ve39-20020a056a2199a700b0018ab5c355dbmr18607009pzb.50.1701219308697; Tue, 28 Nov 2023 16:55:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701219308; cv=none; d=google.com; s=arc-20160816; b=SLcPLITrS2tyZrRtJ/LKAscuEggmjMZoEuvvuEFD3LAWWyOwZGqjwBL09qtcV7/ngD psW4SFgjh1M6eTajhLYmWIMT5OL6YwWwqViLEzMuqUEzO2y6aSVuWkV8qdRDe5qzYk9f IreZ3tYsjTN4RhMbRGlHIvFBqcshvlFnOpu1gcSNjLqc8uypMbbe5PPnGasxy99a4RU9 o29mPiYpFNs687gUDud063eC/Qi3w8YazFfgCyyTdUCNga0e8XcBKKE5eFOmB17EwzJd 2SRvKMAkDDUzCm4XKWTos9UPG7kd5u1XHrp80LcKkdnWaodNQdYPVUSNSxWRMOFJpv5H D4Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=KD7A1Mi78WcdpTbacYeqydWRhhJC6MIZ9wADFHK3ceE=; fh=g4+ZW7ASIywGuNCC0Wm7rM0plAAEd7bcskC+L9FqYAo=; b=aqYxnh7aQBUiuNSIhpw1mBkWs8SPEoSn+y7KvWk6BDOVAjPfzWzspUVudz5mtwvlnA TR41l7kkFH/Gl7Oyk/ualItc0U/Skl1pF9S6NU/20ORM2lln8F1ZSSe9YGD1JwG+Jod9 jyZQy23ktzil31wAvvvOIyRR3zE6RSue6oiCVGajz8t2ojmYJbccSKbJN2daWuI8wyUU RBVJQTbRmKkIvVTgRdJf2jVdbd6/armubDlWbFQhT9xU7TuY0EPQ/fg+f6UmpwWngOG4 Du/uWMfJCeUd9FzyE9FzHfpPw3mV+D7BxCUIEtlXtsKhfLbBo0u1FdA2nd2Bxd22GBwf e+TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b="NBZBGb/8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id jb1-20020a170903258100b001cfdfa28b70si3609239plb.469.2023.11.28.16.55.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 16:55:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b="NBZBGb/8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 3D43A82072DD; Tue, 28 Nov 2023 16:55:06 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229987AbjK2Ayr (ORCPT + 99 others); Tue, 28 Nov 2023 19:54:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229526AbjK2Ayr (ORCPT ); Tue, 28 Nov 2023 19:54:47 -0500 Received: from mail-oa1-x31.google.com (mail-oa1-x31.google.com [IPv6:2001:4860:4864:20::31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C38B19AE for ; Tue, 28 Nov 2023 16:54:52 -0800 (PST) Received: by mail-oa1-x31.google.com with SMTP id 586e51a60fabf-1fa25d9cddbso2264294fac.1 for ; Tue, 28 Nov 2023 16:54:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1701219291; x=1701824091; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=KD7A1Mi78WcdpTbacYeqydWRhhJC6MIZ9wADFHK3ceE=; b=NBZBGb/8+4eEITunAzUMzigxc8uz6j8Dg75wyZQthgQUON4ZqrN+peLBlg8XoqnyxL VzfbbSiO2lV6MNm9UL5EY3n8AZSt0kSidXdfjXdCir/k5UuGgrvCx6BJzGmE0WpMrqAg scj6RRezMFx8SkhZqpj/Zz8ZGtyuCss6g3c/ywM4zwBSg1maf2tINNcQJOgAz7bA2zXp KgKhrCTKmkjAsmCBk96zKknUm3+Q3dRWHkyW9UO5fKyYTAfTmbkzkWCTNEbDyVa8Y2HG 451mq05zv3EOdmPVl+h/+cRaKbiHjyXaeZgbzOMoKFUqItjWAfFRqXT0AUSxxcAymGRF 7SPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701219291; x=1701824091; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KD7A1Mi78WcdpTbacYeqydWRhhJC6MIZ9wADFHK3ceE=; b=piRXvMhly1hExBphi3EEkE9oKGOeVQ5/Xcvo2AILli4cy6pr+1cWQ06WQoklhHkLLn SkC2d/c9ApZ/ZgPdDFzkSsteWJlfyitaPm59KvFxKCS7P8KypXEAFEZoKYjTifnblbCH bFr4yPPneelsC5ds7imD79RU5W8dpiWjdOac4M/7ZLkBDnQg5ZkfQkyNdo+SkRkwv+3O p+OOk+INXS9JGxxJbdVQWPVnImMFVhFKQ1rj9Ghtp+9+olv8KcQhSqByDmV/rR9IwsKy Mi5GRc5FNVE7iR4bOLhz0PhtQ4QbgfI2+sFNrmrhQvfEmpRUlqS4ZPj3fmnhEmxZzszE JRgQ== X-Gm-Message-State: AOJu0YwI8dLhoaxx3dEqagHOYHulBHbmI1w3UW/yp9bmjq3pXfAEbmnc JxDrOsDwzGf1C9eWT3C0iapGzg== X-Received: by 2002:a05:6870:c690:b0:1fa:2f8:c734 with SMTP id cv16-20020a056870c69000b001fa02f8c734mr16951479oab.5.1701219291679; Tue, 28 Nov 2023 16:54:51 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-134-23-187.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.134.23.187]) by smtp.gmail.com with ESMTPSA id b1-20020a056830344100b006d81e704023sm945291otu.2.2023.11.28.16.54.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 16:54:51 -0800 (PST) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1r88qo-005kIY-2m; Tue, 28 Nov 2023 20:54:50 -0400 Date: Tue, 28 Nov 2023 20:54:50 -0400 From: Jason Gunthorpe To: Yosry Ahmed 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 Subject: Re: [PATCH 00/16] IOMMU memory observability Message-ID: <20231129005450.GH1312390@ziepe.ca> References: <20231128204938.1453583-1-pasha.tatashin@soleen.com> <20231128235214.GD1312390@ziepe.ca> <20231129002826.GG1312390@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,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 morse.vger.email 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 (morse.vger.email [0.0.0.0]); Tue, 28 Nov 2023 16:55:06 -0800 (PST) On Tue, Nov 28, 2023 at 04:30:27PM -0800, Yosry Ahmed wrote: > On Tue, Nov 28, 2023 at 4:28 PM Jason Gunthorpe wrote: > > > > On Tue, Nov 28, 2023 at 04:25:03PM -0800, Yosry Ahmed wrote: > > > > > > > Right, but as I mention above, if userspace starts depending on this > > > > > equation, we won't be able to add any more classes of "secondary" page > > > > > 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 is > > > > 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. Well, we just broke it already, anyone thinking it was only kvm counters is going to be sad now :) As I understand it was already described to be more general that kvm so probably nothing to do really Jason