Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1904842yba; Thu, 25 Apr 2019 07:34:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqwVTHFj+jX7do4kgmsoz1AuBQWIvJbXLCVJaXdL+RH1TUq0PrQkjvkrZs/cOKXPTjzAcHjA X-Received: by 2002:a65:5003:: with SMTP id f3mr37844094pgo.29.1556202878501; Thu, 25 Apr 2019 07:34:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556202878; cv=none; d=google.com; s=arc-20160816; b=gQlVah8GL/n9E1qykP4B100o7TpiAcvapSD8vK0DNcS0bAKZbiLH/rykAIhuCUHWMe kr9MpMmFrT+Ci9NGjIMUCB06mbf6xcNd6GxaSK08nWQxScKANQs+1qgTplfFwtMqYz0b JdN8n3HGwBxBbIk7ZIzcuyIKmsYndGXGf6cI1S5RXAvXguTxuypMQdngbgo5rbCoA80+ L06HQUvWkCbGVVFoVxAP7Q64gu0X/bEXi2Q1a9vi0k2sGkO6OeB7SJR/8g3Hab/uwBpm J7s9o5mBDVgUeelAHSuXRt9gxZgCD/MtaJ+pud/B11ltgARlLz+KBWbWXpn6SLGb8x6p Kqug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=QeT2FgMhLHdIrjXQDijNHAlrpB7L0WoU4REeT1E8LqQ=; b=Qh90AFxOdpS10Jgh9NmnN+byBng3kzDv/L1nTYfYqQSzYGHq6MwQel1m6NC0bHN4Mb uBNsEpD+9p7rEypF8Jegu6g6vQXEx5CsTHOdiapOgn1eIHySXm8nOhM4rv5qcUh2/R2I sUWgg8BWYGdMknk5vU2eGFOEeoKN15ge2E8+AXh5I8jh/XQ+jpUyWsuZwd/eWTX0Hl5z 58zVDQM8R8b82KJyVav6LeUgqHykHn5PIDSrxi4ssVkDN0bCLrNkC4jaB0TX8uwxqo+w SsUl9CoMDQS4YkgUv+D4pSzvIlqP3SkxgxKaJtlspm1yJOfpW0/Y0rwKyLqu3dA/X172 RLmQ== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r12si22358315pfn.135.2019.04.25.07.34.21; Thu, 25 Apr 2019 07:34:38 -0700 (PDT) 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726622AbfDYOd2 (ORCPT + 99 others); Thu, 25 Apr 2019 10:33:28 -0400 Received: from mga17.intel.com ([192.55.52.151]:50006 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725900AbfDYOd2 (ORCPT ); Thu, 25 Apr 2019 10:33:28 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Apr 2019 07:33:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,394,1549958400"; d="scan'208";a="134317349" Received: from aubrey-skl.sh.intel.com ([10.239.53.6]) by orsmga007.jf.intel.com with ESMTP; 25 Apr 2019 07:33:25 -0700 From: Aubrey Li 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 , Andy Lutomirski Subject: [PATCH v18 1/3] proc: add /proc//arch_status Date: Thu, 25 Apr 2019 22:32:17 +0800 Message-Id: <20190425143219.102258-1-aubrey.li@linux.intel.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The architecture specific information of the running processes could be useful to the userland. Add /proc//arch_status interface support to examine process architecture specific information externally. Signed-off-by: Aubrey Li Cc: Thomas Gleixner Cc: Peter Zijlstra Cc: Andi Kleen Cc: Tim Chen Cc: Dave Hansen Cc: Arjan van de Ven Cc: Alexey Dobriyan Cc: Andrew Morton Cc: Andy Lutomirski Cc: Linux API --- 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 6a803a0b75df..8c71eba47031 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -3061,6 +3061,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 +3452,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