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 A82E8D7877B for ; Thu, 21 Nov 2024 15:49:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0839F6B007B; Thu, 21 Nov 2024 10:49:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 033CF6B0082; Thu, 21 Nov 2024 10:49:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E3D346B0083; Thu, 21 Nov 2024 10:49:41 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id C899C6B007B for ; Thu, 21 Nov 2024 10:49:41 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 8037C1A0F0F for ; Thu, 21 Nov 2024 15:49:41 +0000 (UTC) X-FDA: 82810533666.17.4972AEC Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.173]) by imf28.hostedemail.com (Postfix) with ESMTP id 9D501C0011 for ; Thu, 21 Nov 2024 15:48:42 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=gourry.net header.s=google header.b=GOwmQbbr; dmarc=none; spf=pass (imf28.hostedemail.com: domain of gourry@gourry.net designates 209.85.160.173 as permitted sender) smtp.mailfrom=gourry@gourry.net ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732203993; a=rsa-sha256; cv=none; b=qLGG7E2MF9VJGsbu49hOLmMhwnNqcMsUQz8+/Ac9YXzVBIFCMj5dQ6EUI7GTEXZOAizVIT jVHLalgG6EB8+ltdbd6c2Cb4kufvbennJ9J8Ixb88fDR9UKvUI5S6mTonbxqvqy5QJB1Hc Kmk7CPowWqK8qDSQMwesQwvbLMiccf0= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=gourry.net header.s=google header.b=GOwmQbbr; dmarc=none; spf=pass (imf28.hostedemail.com: domain of gourry@gourry.net designates 209.85.160.173 as permitted sender) smtp.mailfrom=gourry@gourry.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1732203993; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=imGyslVzf4MtAURe8zmBJ1AT4ZR15AATmZm1LrrG9KI=; b=eRQLi/wasUuQ6x44A+lYxDDiGKHmPi1474DSJ94eMM62SQVkCjTLZMfMWOLzYsbU8d3Gmx U+KLI9WddNufH2/oU6kWP+Zh0h7bD0d6zAkAPxWTw2Yf5MPN/0Q2EO686BfY6vOPFCEJUQ TbAmVWy4WG9TucOkXUwyLMTKJW4ESGQ= Received: by mail-qt1-f173.google.com with SMTP id d75a77b69052e-4609beb631aso6331261cf.2 for ; Thu, 21 Nov 2024 07:49:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1732204178; x=1732808978; darn=kvack.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=imGyslVzf4MtAURe8zmBJ1AT4ZR15AATmZm1LrrG9KI=; b=GOwmQbbrBrr73jRnry4ElchDcru/vMr02yGqCUV3aSZJXGd1ndrQzMxoUq+lrNJtx7 JuuJIJszx1j2dspNm/ZqAbqojwNLaHIs0j4DYW07KtBD98My7EE0qSEI/8asSILzDy+k hCA9kLP7C6Op/skQc7OyUxHPaKHiOBvmOI0+Cqugr+SqJMlVSh4pN0KLM0IVf93mIung HTIB52axyjr5MKy/ewjGcZu1sbN5JngfJWEal7rJ//CDjPDI8tigxDM+vfrCrviQCmXV k6jYBB259z+32ANNxpF79n0QxmGVwf+uk1ksWEzRP+zYnrLX8HJaj0wnpK+1EC0MlrIS AWYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732204178; x=1732808978; h=in-reply-to: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=imGyslVzf4MtAURe8zmBJ1AT4ZR15AATmZm1LrrG9KI=; b=e088AGTMhEymDayMHlBlqTfQTdDR8+GKQ97QeD64HI9bWRagw4mJNuV5GtfnSyxBGU LB6bOYLJTrB9f1k07TnQXYTT3SiZfS17yoO6R6DOcPSXNxTdQRepZvo0DVd/5AsKb2Bk WiZ1EA8HjFOomOavv+jwhzTb1H5LA3sUR7dcHOeqqfZzFYcUplaeB9a4xWF6ruxuU+L+ +hxH99cjYvuntXtfWUcnliJsqR4WGVsQyivnD1gNQk0BIlNsQLYjBNAVGOynvCR5l0lF bhMF+rWvicZJaTGrMg9bpNHmlJFnEUddGNqWvtlIVai70bntmrEoyGbJNmkz7Bd12bri j3Vw== X-Forwarded-Encrypted: i=1; AJvYcCVdrTmLk+vvHUmsKQEPTneuWcfnFKMLLronchBE2rWxiEhaoK37d32h9S//9YxBpBJCMTzpd6p1pw==@kvack.org X-Gm-Message-State: AOJu0Yx6BzToF1jcjFOF185eOE1gFI8ONjvu1udhSPXX9f2PciEqF/Qw JX8u+JyqPmek/UYR3RnEq4txDTtKc6Y1my9WcsIXXa6wWjrGCWD5shOBqQdhXck= X-Gm-Gg: ASbGncv4C93GU4fpAvnHdU18SaBn3xTr2l1ZlbMsPs42o/zluUgomnP8uAfZzhVIOT9 w+vgNw36A3ATZyx6iTVdzfH+PU7+uOmakR1NSkM3/tKW0PHNdiSMoUZiZq0L6Tu7U8jXYef2PC4 yPQq0uKrDCED2rp3WLlPf6Y92r3zEv0Zyq+cn3oq3GLSfDj/NCdytW/a3+Q/1BY6rj1WkGRCh7G 7eWc5XVTGmaw5vJnObHCx/0k6X33/SUAyKewjALlxiv/TmuzrfsC6LW9aBUwKSE+BW8TBZZcWSZ FoUL+yT2IRuJxHzSatOrTDOVqYZ00N+sfgg= X-Google-Smtp-Source: AGHT+IHfa6uG1/ElJG3c1ctd03gnOTTo/GnY7T0aRJbPucnRyYeXTT/g4/UhflcfSiPSDaYXjPo35A== X-Received: by 2002:ac8:5e4d:0:b0:460:a730:3176 with SMTP id d75a77b69052e-464777e23f3mr93728941cf.11.1732204178485; Thu, 21 Nov 2024 07:49:38 -0800 (PST) Received: from PC2K9PVX.TheFacebook.com (pool-173-79-56-208.washdc.fios.verizon.net. [173.79.56.208]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4646a63da08sm23720671cf.63.2024.11.21.07.49.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2024 07:49:37 -0800 (PST) Date: Thu, 21 Nov 2024 10:49:29 -0500 From: Gregory Price To: Jonathan Cameron Cc: linux-cxl@vger.kernel.org, linux-mm@kvack.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linuxarm@huawei.com, tongtiangen@huawei.com, Yicong Yang , Niyas Sait , ajayjoshi@micron.com, Vandana Salve , Davidlohr Bueso , Dave Jiang , Alison Schofield , Ira Weiny , Dan Williams , Alexander Shishkin , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Huang Ying Subject: Re: [RFC PATCH 0/4] CXL Hotness Monitoring Unit perf driver Message-ID: References: <20241121101845.1815660-1-Jonathan.Cameron@huawei.com> <20241121145852.00000460@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20241121145852.00000460@huawei.com> X-Stat-Signature: w13mwm7x4i7jiktqx4dwrsezzizms3er X-Rspamd-Queue-Id: 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Ktvq824XlTVQsGuzqlFdGY0/JYNMUSbRu6fJ2uD1wkjnGuxaYNcMPchpq8o/QBIy1jRw9ab49tHl3h5+HF7Za6PLI9su/q+9z0fgT3Ezydm12JbZCSBZYrwcp6KZue4WvImsEbUK/vRruS5AQrh+YQNpXB6Yt6lVmyCczWxdYioJcAHYPBBnXIyHfpqkUya69885eKhZG9/QrdW99OOnmKfDAvsGNIXxMOkd/RPzsBi+zcw4hioug4GCMEKCawQktzaYpcTyjVpUYHsZcKbdevczSniD80oxWisMHaqgITfmASVMAZUszlf0KVkHVqmIvxCWqm3WsguU8Ra56234l1K3d+CHUiCOm1S0P1Co9247mZVc3q/LDqV3Kw52EaBfEdxRI3qsJbRJAQN+fmi7f7w3RxjLIffXcPuqQc/pbgNIHyNuMB2K4LTjx1SlC7mjSlCP+gOR12YGpZaGtLBkQ== 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: List-Subscribe: List-Unsubscribe: On Thu, Nov 21, 2024 at 02:58:52PM +0000, Jonathan Cameron wrote: > On Thu, 21 Nov 2024 09:24:43 -0500 > Gregory Price wrote: > > > On Thu, Nov 21, 2024 at 10:18:41AM +0000, Jonathan Cameron wrote: > > > The CXL specification release 3.2 is now available under a click through at > > > https://computeexpresslink.org/cxl-specification/ and it brings new > > > shiny toys. > > > > > > RFC reason > > > - Whilst trace capture with a particular configuration is potentially useful > > > the intent is that CXL HMU units will be used to drive various forms of > > > hotpage migration for memory tiering setups. This driver doesn't do this > > > (yet), but rather provides data capture etc for experimentation and > > > for working out how to mostly put the allocations in the right place to > > > start with by tuning applications. > > > > > > CXL r3.2 introduces a CXL Hotness Monitoring Unit definition. The intent > > > of this is to provide a way to establish which units of memory (typically > > > pages or larger) in CXL attached memory are hot. The implementation details > > > and algorithm are all implementation defined. The specification simply > > > describes the 'interface' which takes the form of ring buffer of hotness > > > records in a PCI BAR and defined capability, configuration and status > > > registers. > > > > > > The hardware may have constraints on what it can track, granularity etc > > > and on how accurately it tracks (e.g. counter exhaustion, inaccurate > > > trackers). Some of these constraints are discoverable from the hardware > > > registers, others such as loss of accuracy have no universally accepted > > > measures as they are typically access pattern dependent. Sadly it is > > > very unlikely any hardware will implement a truly precise tracker given > > > the large resource requirements for tracking at a useful granularity. > > > > > > There are two fundamental operation modes: > > > > > > * Epoch based. Counters are checked after a period of time (Epoch) and > > > if over a threshold added to the hotlist. > > > * Always on. Counters run until a threshold is reached, after that the > > > hot unit is added to the hotlist and the counter released. > > > > > > Counting can be filtered on: > > > > > > * Region of CXL DPA space (256MiB per bit in a bitmap). > > > * Type of access - Trusted and non trusted or non trusted only, R/W/RW > > > > > > Sampling can be modified by: > > > > > > * Downsampling including potentially randomized downsampling. > > > > > > The driver presented here is intended to be useful in its own right but > > > also to act as the first step of a possible path towards hotness monitoring > > > based hot page migration. Those steps might look like. > > > > > > 1. Gather data - drivers provide telemetry like solutions to get that > > > data. May be enhanced, for example in this driver by providing the > > > HPA address rather than DPA Unit Address. Userspace can access enough > > > information to do this so maybe not. > > > 2. Userspace algorithm development, possibly combined with userspace > > > triggered migration by PA. Working out how to use different levels > > > of constrained hardware resources will be challenging. > > > > FWIW this is what i was thinking about for this extension: > > > > https://lore.kernel.org/all/20240319172609.332900-1-gregory.price@memverge.com/ > > Yup. I had that in mind. Forgot to actually add a link. > > > > > At least for testing CHMU stuff. So if anyone is poking at testing such > > things, they can feel free to use that for prototyping. However, I think > > there is general discomfort around userspace handling HPA/DPA. > > > > So it might look more like > > > > echo nr_pages > /sys/.../tiering/nodeN/promote_pages > > > > rather than handling the raw data from the CHMU to make decisions. > > Agreed, but I think we are far away from a point where we can implement that. > > Just working out how to tune the hardware to grab useful data is going > to take a while to figure out, let alone doing anything much with it. > > Without care you won't get a meaningful signal for what is actually > hot out of the box. Lots of reasons why including: > a) Exhaustion of tracking resources, due to looking at too large a window > or for too long. Will probably need some form of auto updating of > what is being scanning (coarse to fine might work though I'm doubtful, > scanning across small regions maybe). > b) Threshold too high, no detections. > c) Threshold too low, everything hot. > d) Wrong timescales. Hot is not a well defined thing. > e) Hardware that won't do tracking at fine enough granularity. > f) How does this even work with interleaving on larger pools :B It's pretend-addressing all the way down :D Lots of conceptually complex and fun questions here. ~Gregory