All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v19 1/3] proc: add /proc/<pid>/arch_status
@ 2019-06-06  1:22 Aubrey Li
  2019-06-06  1:22 ` [PATCH v19 2/3] x86,/proc/pid/arch_status: Add AVX-512 usage elapsed time Aubrey Li
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Aubrey Li @ 2019-06-06  1:22 UTC (permalink / raw)
  To: akpm, tglx, mingo, peterz, hpa
  Cc: ak, tim.c.chen, dave.hansen, arjan, adobriyan, aubrey.li,
	linux-api, linux-kernel, Aubrey Li, Andy Lutomirski

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.

v3:
  Add a /proc/<pid>/arch_state interface to expose per-task
  cpu specific state values.
v5:
  Change the interface to /proc/pid/status since no other
  architectures need a separated CPU specific interface.
v18:
  Change the interface to /proc/pid/arch_status. The interface
  /proc/<pid>/status should not be different on different
  architectures. It would be better to separate the arch staff
  into its own file /proc/<pid>/arch_status and make sure that
  everything in it is namespaced.

Signed-off-by: Aubrey Li <aubrey.li@linux.intel.com>
Acked-by: Andrew Morton <akpm@linux-foundation.org>
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>
---
 fs/proc/Kconfig         | 4 ++++
 fs/proc/base.c          | 6 ++++++
 include/linux/proc_fs.h | 9 +++++++++
 3 files changed, 19 insertions(+)

diff --git a/fs/proc/Kconfig b/fs/proc/Kconfig
index 817c02b13b1d..d80ebf19d5f1 100644
--- a/fs/proc/Kconfig
+++ b/fs/proc/Kconfig
@@ -97,3 +97,7 @@ 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
+	def_bool n
+	depends on PROC_FS
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 0c9bef89ac43..39ce939d8964 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -3066,6 +3066,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)
@@ -3454,6 +3457,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)
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 52a283ba0465..a705aa2d03f9 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -75,6 +75,15 @@ struct proc_dir_entry *proc_create_net_single_write(const char *name, umode_t mo
 						    void *data);
 extern struct pid *tgid_pidfd_to_pid(const struct file *file);
 
+#ifdef CONFIG_PROC_PID_ARCH_STATUS
+/*
+ * The architecture which selects CONFIG_PROC_PID_ARCH_STATUS must
+ * provide proc_pid_arch_status() definition.
+ */
+int proc_pid_arch_status(struct seq_file *m, struct pid_namespace *ns,
+			struct pid *pid, struct task_struct *task);
+#endif /* CONFIG_PROC_PID_ARCH_STATUS */
+
 #else /* CONFIG_PROC_FS */
 
 static inline void proc_root_init(void)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-06-12 12:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-06  1:22 [PATCH v19 1/3] proc: add /proc/<pid>/arch_status Aubrey Li
2019-06-06  1:22 ` [PATCH v19 2/3] x86,/proc/pid/arch_status: Add AVX-512 usage elapsed time Aubrey Li
2019-06-12 12:35   ` [tip:x86/core] x86/process: Add AVX-512 usage elapsed time to /proc/pid/arch_status tip-bot for Aubrey Li
2019-06-06  1:22 ` [PATCH v19 3/3] Documentation/filesystems/proc.txt: add arch_status file Aubrey Li
2019-06-12 12:36   ` [tip:x86/core] Documentation/filesystems/proc.txt: Add " tip-bot for Aubrey Li
2019-06-06 21:34 ` [PATCH v19 1/3] proc: add /proc/<pid>/arch_status Andrew Morton
2019-06-12 12:34 ` [tip:x86/core] proc: Add /proc/<pid>/arch_status tip-bot for Aubrey Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.