Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp691384ybc; Sat, 16 Nov 2019 07:03:17 -0800 (PST) X-Google-Smtp-Source: APXvYqw3CM4TlHsJyX/ttPJPF5lZKIycPQNerrdUD0C//EjcZavnRYXredGb8JvxiPzNOCHxcgfz X-Received: by 2002:a1c:a512:: with SMTP id o18mr19241928wme.4.1573916597092; Sat, 16 Nov 2019 07:03:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573916597; cv=none; d=google.com; s=arc-20160816; b=opF2XrqHFcJ4gsKm19TwJLNoMjxXK42TYw1IGLo5JL28HAD/KrlvRhOiNykFhiVqe1 7iAVWhu9yOHCo0sJjMvt5LHulUZDg28VaKun7CzdMcLTzkJ46Hj6CTyI2dVH+zjGITga G6WG/j8ddS3yIlf6e5GohY69HKValNPNTA9YgOh8qVh/7nP17cZJ1YxSTLQOKErEZG7S YK+kjHJh6R/MkTU5iBJmr6VQtUrezwB/nvP+5R+ejYnKJX9C1zGfjm392NncWF1B6Sje 7e5IkUwK/YQ0dNtVFIY5RhaeldaOjlWgiqzRz7RwWv4pKrpjuWKpJYXoxPKeoa2IOkky TY8w== 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:dkim-signature; bh=70Jvx3vkhwPfIehKPa34OVbS25rHZjyV2djtKv+JlWE=; b=lgVmYbpYlbkBw/UTqBuvEg/dMoRz17MeMou4KSD4gXoG9/MO+ahPYjo4KtTXwsY9JK X3+HJacliqzG9F5vbR+9aRZ+iScHMPp+vr27TyU5EXBDJgy1iplbPetDbJ/K9o04HtFx huGiU1aZrupZfeI7b9kWjEX8COV7UHngd+mTkV6BvRJvviVHqmWGQqLH0QgrwaG337cr ++pzfCJhXeAoEQIWT1yr8BOOladST3BF87qK7M/5D8M2fhKSlEL9Rw+fAzDnVXkF7ffy zd4NGF7eS+aCf6l/WfBuDRPaGt5Nq4mH8RDmk6M7Ga+JNwb7JP/unrVM6yg6lI2NCTA1 b0hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=H7PIYRUD; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d15si8917275edn.49.2019.11.16.07.02.51; Sat, 16 Nov 2019 07:03:17 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=H7PIYRUD; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727752AbfKPPB0 (ORCPT + 99 others); Sat, 16 Nov 2019 10:01:26 -0500 Received: from mail-io1-f67.google.com ([209.85.166.67]:43351 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727123AbfKPPB0 (ORCPT ); Sat, 16 Nov 2019 10:01:26 -0500 Received: by mail-io1-f67.google.com with SMTP id r2so8599443iot.10; Sat, 16 Nov 2019 07:01:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=70Jvx3vkhwPfIehKPa34OVbS25rHZjyV2djtKv+JlWE=; b=H7PIYRUDbc6WJrQp87zP4xTZ/29c7hX5O8LQqbCOEYR2zJZEYNBl8zkRUyMIgVAGMP KfkuHKN00XyfOle2o8EkV9sQSg9zAURlcr4Qm1QreMqvJCeHBPkVCy0WGr2nkjslxjDT mPGRxxb0G4WdDYvkHB2kMAnrgMPVkd6npO8qKPnTg+ISRXmGbMttGEZVa7xzjGTJdoLg ZfJo7rd+16kzXZBAjZvoz643nqNFKnDnKBlYqH5Jym4gNBJfP5rK6BghgIf8/p81QX40 fWorpFLbGrrFPj0DOHBqE0CoLZznc2JtrOBXH1acWiVjiEI3/oQAafU9OnLxLXBBCZxx wSCg== 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=70Jvx3vkhwPfIehKPa34OVbS25rHZjyV2djtKv+JlWE=; b=CfblOujECdPSIuvtfPBErfD9vBltVfVoMu7+vxKe9aadaWcGihGXt2UP4r6r8Uap28 tbri+PcleWKOMCoeLFhEgLX+vyPHWG0oLFVQXjkV6Poh9Oz/e1Y/rUo9/clrBaurNJ1h kGVYj7KMKnjnf55ajSYRHDjCt+JE16Z2uEQuF9Gox1Jovfei/YeH/13AkxfauNN4thTd mL0jLStPgfoFUW9ePIb/oyG5i4St2oIWeimePtaw3rJUxn4CHfqFZm6U8l3NhV4cquBn 3W774mL6ZSY9tHRITFUAbe9lNwMa3XjSlkZuWujyXQpHbNMptXevZzLTKMnYKl6iksDw BK6w== X-Gm-Message-State: APjAAAXe3El1g9K9q1jnJ4vIPj1e1u/3JwzTnYeS4skw43todYJ87GZB 9U/0d0qJJ5oxePA9NRdegYMhhpEB+gtD+MRW6Rw= X-Received: by 2002:a6b:8bcc:: with SMTP id n195mr5557079iod.135.1573916483656; Sat, 16 Nov 2019 07:01:23 -0800 (PST) MIME-Version: 1.0 References: <5dcd6580b51342c0803db6bc27866dd569914b0d.1573788882.git.yu.c.chen@intel.com> <20191115092420.GF18929@zn.tnic> In-Reply-To: <20191115092420.GF18929@zn.tnic> From: Ryan Chen Date: Sat, 16 Nov 2019 23:01:12 +0800 Message-ID: Subject: Re: [PATCH 2/2][v2] x86/resctrl: Add task resctrl information display To: Borislav Petkov Cc: Chen Yu , "the arch/x86 maintainers" , "H. Peter Anvin" , Ingo Molnar , Thomas Gleixner , Peter Zijlstra , Will Deacon , Fenghua Yu , Reinette Chatre , Tony Luck , Andrew Morton , Alexey Dobriyan , Michal Hocko , Kees Cook , Christian Brauner , Shakeel Butt , Casey Schaufler , Konstantin Khlebnikov , Kent Overstreet , Linus Torvalds , Linux Kernel Mailing List , linux-fsdevel@vger.kernel.org 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 Hi Boris, On Fri, Nov 15, 2019 at 5:25 PM Borislav Petkov wrote: > > On Fri, Nov 15, 2019 at 01:25:06PM +0800, Chen Yu wrote: > > Monitoring tools that want to find out which resctrl CTRL > > and MONITOR groups a task belongs to must currently read > > the "tasks" file in every group until they locate the process > > ID. > > > > Add an additional file /proc/{pid}/resctrl to provide this > > information. > > > > For example: > > cat /proc/1193/resctrl > > CTRL_MON:/ctrl_grp0 > > MON:/ctrl_grp0/mon_groups/mon_grp0 > > > > If the resctrl filesystem has not been mounted, > > reading /proc/{pid}/resctrl returns an error: > > cat: /proc/1193/resctrl: No such device > > Eww, this doesn't sound very user-friendly. How is the user supposed to > know that the resctrl fs needs to be mounted for this to work? > > Why does the resctrl fs need to be mounted at all to show this? > > I'm guessing if it is not mounted, you have no groups so you don't have > to return an error - you simply return "". Right? > Right, we can return 'blank' to user and let the user to parse the information. And there is a similar behavior in cgroup that, for kernel thread that does not belong to any cgroup, /proc/{pid}/cgroup just show 'blank' without returning an error. > > Tested-by: Jinshi Chen > > Reviewed-by: Reinette Chatre > > Reviewed-by: Fenghua Yu > > Reviewed-by: Tony Luck > > When you send a new version which has non-trivial changes, you should > drop those tags because they don't apply anymore. Unless those people > have managed to review and test the new version ... > Got it, thanks for telling me this. > Looking at CONFIG_PROC_PID_ARCH_STATUS for an example of proc/ calling > arch-specific functions, I guess you need to do: > > select CPU_RESCTRL if PROC_FS > Yes, only when PROC_FS is set, /proc/{pid}/resctrl can be displayed. However, CPU_RESCTRL might not depend on proc fs, it is possible that the CPU_RESCTRL is enabled but without PROC_FS set. If I understand correctly, CPU_RESCTRL is the 'root' config for X86_CPU_RESCTRL, after reading this thread: https://lists.gt.net/linux/kernel/3211659 If this is the case, shall we add the new file at kernel/resctrl/resctrl.c? And the generic proc_resctrl_show() could be put into this file. In the future the generic code for resctrl could be added/moved to kernel/resctrl/resctrl.c Thanks, Chenyu > Thx. > > -- > Regards/Gruss, > Boris. > > https://people.kernel.org/tglx/notes-about-netiquette