From: Aubrey Li <aubrey.li@linux.intel.com>
To: tglx@linutronix.de, mingo@redhat.com, peterz@infradead.org,
hpa@zytor.com
Cc: ak@linux.intel.com, tim.c.chen@linux.intel.com,
dave.hansen@intel.com, arjan@linux.intel.com,
adobriyan@gmail.com, akpm@linux-foundation.org,
aubrey.li@intel.com, linux-api@vger.kernel.org,
linux-kernel@vger.kernel.org,
Aubrey Li <aubrey.li@linux.intel.com>,
Andy Lutomirski <luto@kernel.org>
Subject: [PATCH v17 1/3] proc: add /proc/<pid>/arch_status
Date: Mon, 22 Apr 2019 02:35:27 +0800 [thread overview]
Message-ID: <20190421183529.9141-1-aubrey.li@linux.intel.com> (raw)
The architecture specific information of the running processes
could be useful to the userland. Add /proc/<pid>/arch_status
interface support to examine process architecture specific
information externally.
Signed-off-by: Aubrey Li <aubrey.li@linux.intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Tim Chen <tim.c.chen@linux.intel.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Linux API <linux-api@vger.kernel.org>
---
arch/x86/Kconfig | 1 +
fs/proc/Kconfig | 10 ++++++++++
fs/proc/base.c | 23 +++++++++++++++++++++++
3 files changed, 34 insertions(+)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 5ad92419be19..d5a9c5ddd453 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -208,6 +208,7 @@ config X86
select USER_STACKTRACE_SUPPORT
select VIRT_TO_BUS
select X86_FEATURE_NAMES if PROC_FS
+ select PROC_PID_ARCH_STATUS if PROC_FS
config INSTRUCTION_DECODER
def_bool y
diff --git a/fs/proc/Kconfig b/fs/proc/Kconfig
index 817c02b13b1d..101bf5054e81 100644
--- a/fs/proc/Kconfig
+++ b/fs/proc/Kconfig
@@ -97,3 +97,13 @@ config PROC_CHILDREN
Say Y if you are running any user-space software which takes benefit from
this interface. For example, rkt is such a piece of software.
+
+config PROC_PID_ARCH_STATUS
+ bool "Enable /proc/<pid>/arch_status file"
+ default n
+ help
+ Provides a way to examine process architecture specific information.
+ See <file:Documentation/filesystems/proc.txt> for more information.
+
+ Say Y if you are running any user-space software which wants to obtain
+ process architecture specific information from this interface.
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 6a803a0b75df..a890d9f12851 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -94,6 +94,7 @@
#include <linux/sched/debug.h>
#include <linux/sched/stat.h>
#include <linux/posix-timers.h>
+#include <linux/processor.h>
#include <trace/events/oom.h>
#include "internal.h"
#include "fd.h"
@@ -2957,6 +2958,22 @@ static int proc_stack_depth(struct seq_file *m, struct pid_namespace *ns,
}
#endif /* CONFIG_STACKLEAK_METRICS */
+/*
+ * Add support for task architecture specific output in /proc/pid/arch_status.
+ * task_arch_status() must be defined in asm/processor.h
+ */
+#ifdef CONFIG_PROC_PID_ARCH_STATUS
+# ifndef task_arch_status
+# define task_arch_status(m, task)
+# endif
+static int proc_pid_arch_status(struct seq_file *m, struct pid_namespace *ns,
+ struct pid *pid, struct task_struct *task)
+{
+ task_arch_status(m, task);
+ return 0;
+}
+#endif /* CONFIG_PROC_PID_ARCH_STATUS */
+
/*
* Thread groups
*/
@@ -3061,6 +3078,9 @@ static const struct pid_entry tgid_base_stuff[] = {
#ifdef CONFIG_STACKLEAK_METRICS
ONE("stack_depth", S_IRUGO, proc_stack_depth),
#endif
+#ifdef CONFIG_PROC_PID_ARCH_STATUS
+ ONE("arch_status", S_IRUGO, proc_pid_arch_status),
+#endif
};
static int proc_tgid_base_readdir(struct file *file, struct dir_context *ctx)
@@ -3449,6 +3469,9 @@ static const struct pid_entry tid_base_stuff[] = {
#ifdef CONFIG_LIVEPATCH
ONE("patch_state", S_IRUSR, proc_pid_patch_state),
#endif
+#ifdef CONFIG_PROC_PID_ARCH_STATUS
+ ONE("arch_status", S_IRUGO, proc_pid_arch_status),
+#endif
};
static int proc_tid_base_readdir(struct file *file, struct dir_context *ctx)
--
2.17.1
next reply other threads:[~2019-04-21 18:35 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-21 18:35 Aubrey Li [this message]
2019-04-21 18:35 ` [PATCH v17 2/3] /proc/pid/arch_status: Add AVX-512 usage elapsed time Aubrey Li
2019-04-24 21:19 ` Thomas Gleixner
2019-04-21 18:35 ` [PATCH v17 3/3] Documentation/filesystems/proc.txt: add arch_status file Aubrey Li
2019-04-24 21:27 ` Thomas Gleixner
2019-04-24 21:18 ` [PATCH v17 1/3] proc: add /proc/<pid>/arch_status Thomas Gleixner
2019-04-25 1:50 ` Li, Aubrey
2019-04-25 7:20 ` Thomas Gleixner
2019-04-25 8:12 ` Li, Aubrey
2019-04-25 8:20 ` Thomas Gleixner
2019-04-25 8:24 ` Li, Aubrey
2019-04-25 10:11 ` Enrico Weigelt, metux IT consult
2019-04-25 10:42 ` Li, Aubrey
2019-04-25 10:46 ` Enrico Weigelt, metux IT consult
2019-04-25 10:50 ` Thomas Gleixner
2019-04-26 11:20 ` Enrico Weigelt, metux IT consult
2019-04-26 13:38 ` Thomas Gleixner
2019-04-25 10:40 ` Enrico Weigelt, metux IT consult
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190421183529.9141-1-aubrey.li@linux.intel.com \
--to=aubrey.li@linux.intel.com \
--cc=adobriyan@gmail.com \
--cc=ak@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=arjan@linux.intel.com \
--cc=aubrey.li@intel.com \
--cc=dave.hansen@intel.com \
--cc=hpa@zytor.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=tim.c.chen@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).