Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1817868imu; Thu, 17 Jan 2019 03:51:49 -0800 (PST) X-Google-Smtp-Source: ALg8bN5nurI2VC58Y/NzSHPzqozNQOAUmuOQmXSaAEZhFQM4SwC1oJijIUDEmMF8ZAg4IMHV6as2 X-Received: by 2002:a62:220d:: with SMTP id i13mr14582197pfi.162.1547725909046; Thu, 17 Jan 2019 03:51:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547725909; cv=none; d=google.com; s=arc-20160816; b=hV3JzCPAkz1Il4U3IQMGBpRmOxI4kMfZ4oe4vAabAntnEG8+sAg6jwrBOtP+qCeway /6CMGwTb3SFitXpZDjK5wbBWuSF7b7U9Y8uA5I0Oy/gdKgwGgpElI1jjYdGBFB1ACt27 NFq2pGxugmU5t6ZUDgB3pArBH4iqYvEvfWppHwDkmja6dZDL200gqAOSs4/vRO0dTBS6 dNHlVAmkOVfcMymoNdUht2f/jCIOWUmaKHI2tUXG+zbjiz9xqbCm8G9FGkJiI3zXmVH5 ZvywT96S3ovJ5uhuckWnf2SeZSuHi4E+Aetjt+cPxnVz7wq/Pwf9DFr/lB8UCflqjm+/ QY1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=+Lw2WQMOYvQqN57P2A8zIzSFAHgU0oFB/MCvtZM0Klw=; b=vQI3pk13C0sB4RTtClAeFwieGTgwhpoNDlIAhmwOXJOjDkHu2GexGkIIoO/8KUipYH /ICoCEyieKQXPRebYtZS99QRlIngUHgEPhTRzgmZlcak4tN7MsucB4glaCxYGLzhKNP/ W7QEAesKKZ320axl+rZo28UyDWTRhUaP9zeWDLoUdeZ79pmNzEIIl0vUmlo/7e6CgBnG mmrQ9pbRZPqxosE0+X3jGO3QzijBonKNayHNU4ib9nh7s5HJm75BFKnhHnS0syPUSelg zd0Gm1NXrAmoHSyQOxmbZo/4WJL5Eum3ZJ8Hez6f7BHtBpGBQ1YGZHiS6bUHtV0DlN+H d0Kg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i7si1488496pgc.144.2019.01.17.03.51.32; Thu, 17 Jan 2019 03:51:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728691AbfAQL03 (ORCPT + 99 others); Thu, 17 Jan 2019 06:26:29 -0500 Received: from mail-oi1-f196.google.com ([209.85.167.196]:45476 "EHLO mail-oi1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725889AbfAQL03 (ORCPT ); Thu, 17 Jan 2019 06:26:29 -0500 Received: by mail-oi1-f196.google.com with SMTP id y1so5836824oie.12; Thu, 17 Jan 2019 03:26:28 -0800 (PST) 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=+Lw2WQMOYvQqN57P2A8zIzSFAHgU0oFB/MCvtZM0Klw=; b=qwfXYVOUFKCbeDjt9ohgliWwHEDSttDAQaaxznzJ3UpgEccHFzJthQe3r2n856OK1n D0JMez7t4gZf5k3Vp7e+q3umK04giGUemk3LECEkEvb3zbQpQpM8UklzhFkdORK6Lf4G BQhSFVU4tiyPMZyYJOR7Ex+7jI9L2KMBucOgfxsEdyZgPjjLTfgm4z5o/ANgVYg225FQ RMm7IUSTMGFr8qK9KCMdbdS8OwVXe8Cl+4mdBkCy3qdzDp+zEwtgY+0RthohQGZhVtFB AtzfLqAayMOWVrXp/pRZtm99TpaC6gl2tkeefqK7lfu+CFrq3aR9X1rBLpjB6jNx20BH FcIA== X-Gm-Message-State: AJcUukfrF/OUXtgp2SebwTBeBYgxzlysCNOrcEbOpw1uGPeXaK6/Kl12 hKIuAIfcXqi5yOKKy8lQ6yNUgA0kceKClKhaGvc= X-Received: by 2002:aca:195:: with SMTP id 143mr4767332oib.322.1547724387887; Thu, 17 Jan 2019 03:26:27 -0800 (PST) MIME-Version: 1.0 References: <20190116175804.30196-1-keith.busch@intel.com> <20190116175804.30196-5-keith.busch@intel.com> In-Reply-To: <20190116175804.30196-5-keith.busch@intel.com> From: "Rafael J. Wysocki" Date: Thu, 17 Jan 2019 12:26:16 +0100 Message-ID: Subject: Re: [PATCHv4 04/13] node: Link memory nodes to their compute nodes To: Keith Busch Cc: Linux Kernel Mailing List , ACPI Devel Maling List , Linux Memory Management List , Greg Kroah-Hartman , Rafael Wysocki , Dave Hansen , Dan Williams Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 16, 2019 at 6:59 PM Keith Busch wrote: > > Systems may be constructed with various specialized nodes. Some nodes > may provide memory, some provide compute devices that access and use > that memory, and others may provide both. Nodes that provide memory are > referred to as memory targets, and nodes that can initiate memory access > are referred to as memory initiators. > > Memory targets will often have varying access characteristics from > different initiators, and platforms may have ways to express those > relationships. In preparation for these systems, provide interfaces > for the kernel to export the memory relationship among different nodes > memory targets and their initiators with symlinks to each other's nodes, > and export node lists showing the same relationship. > > If a system provides access locality for each initiator-target pair, nodes > may be grouped into ranked access classes relative to other nodes. The new > interface allows a subsystem to register relationships of varying classes > if available and desired to be exported. A lower class number indicates > a higher performing tier, with 0 being the best performing class. > > A memory initiator may have multiple memory targets in the same access > class. The initiator's memory targets in given class indicate the node's > access characteristics perform better relative to other initiator nodes > either unreported or in lower class numbers. The targets within an > initiator's class, though, do not necessarily perform the same as each > other. > > A memory target node may have multiple memory initiators. All linked > initiators in a target's class have the same access characteristics to > that target. > > The following example show the nodes' new sysfs hierarchy for a memory > target node 'Y' with class 0 access from initiator node 'X': > > # symlinks -v /sys/devices/system/node/nodeX/class0/ > relative: /sys/devices/system/node/nodeX/class0/targetY -> ../../nodeY If you added one more directory level and had "targets" and "initiators" under "class0", the names of the symlinks could be the same as the names of the nodes themselves, that is /sys/devices/system/node/nodeX/class0/targets/nodeY -> ../../../nodeY and the whole "nodelist" part wouldn't be necessary any more. Also, it looks like "class0" is just a name at this point, but it will represent an access class going forward. Maybe it would be better to use the word "access" in the directory name to indicate that (so there would be "access0" instead of "class0"). > > # symlinks -v /sys/devices/system/node/nodeY/class0/ > relative: /sys/devices/system/node/nodeY/class0/initiatorX -> ../../nodeX > > And the same information is reflected in the nodelist: > > # cat /sys/devices/system/node/nodeX/class0/target_nodelist > Y > > # cat /sys/devices/system/node/nodeY/class0/initiator_nodelist > X > > Signed-off-by: Keith Busch > --- > drivers/base/node.c | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++- > include/linux/node.h | 6 ++- > 2 files changed, 131 insertions(+), 2 deletions(-) > > diff --git a/drivers/base/node.c b/drivers/base/node.c > index 86d6cd92ce3d..1da5072116ab 100644 > --- a/drivers/base/node.c > +++ b/drivers/base/node.c > @@ -17,6 +17,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -59,6 +60,91 @@ static inline ssize_t node_read_cpulist(struct device *dev, > static DEVICE_ATTR(cpumap, S_IRUGO, node_read_cpumask, NULL); > static DEVICE_ATTR(cpulist, S_IRUGO, node_read_cpulist, NULL); > A kerneldoc describing the struct type, please. > +struct node_class_nodes { > + struct device dev; > + struct list_head list_node; > + unsigned class; > + nodemask_t initiator_nodes; > + nodemask_t target_nodes; > +}; > +#define to_class_nodes(dev) container_of(dev, struct node_class_nodes, dev) > + Generally speaking, your code is devoid of comments. To a minimum, there should be kerneldoc comments for non-static functions to explain what they are for.