linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Jessica Yu <jeyu@redhat.com>, Jiri Kosina <jikos@kernel.org>,
	Miroslav Benes <mbenes@suse.cz>, Petr Mladek <pmladek@suse.com>
Cc: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org,
	Michael Ellerman <mpe@ellerman.id.au>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	x86@kernel.org, linuxppc-dev@lists.ozlabs.org,
	linux-s390@vger.kernel.org, Vojtech Pavlik <vojtech@suse.com>,
	Jiri Slaby <jslaby@suse.cz>,
	Chris J Arges <chris.j.arges@canonical.com>,
	Andy Lutomirski <luto@kernel.org>, Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>,
	Balbir Singh <bsingharora@gmail.com>
Subject: [PATCH v5 14/15] livepatch: add /proc/<pid>/patch_state
Date: Mon, 13 Feb 2017 19:42:41 -0600	[thread overview]
Message-ID: <b3dfb200a0d062737717a86d48488df9b603baab.1487036215.git.jpoimboe@redhat.com> (raw)
In-Reply-To: <cover.1487036215.git.jpoimboe@redhat.com>

Expose the per-task patch state value so users can determine which tasks
are holding up completion of a patching operation.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Reviewed-by: Miroslav Benes <mbenes@suse.cz>
---
 Documentation/filesystems/proc.txt | 18 ++++++++++++++++++
 fs/proc/base.c                     | 15 +++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
index c94b467..9036dbf 100644
--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -44,6 +44,7 @@ Table of Contents
   3.8   /proc/<pid>/fdinfo/<fd> - Information about opened file
   3.9   /proc/<pid>/map_files - Information about memory mapped files
   3.10  /proc/<pid>/timerslack_ns - Task timerslack value
+  3.11	/proc/<pid>/patch_state - Livepatch patch operation state
 
   4	Configuring procfs
   4.1	Mount options
@@ -1887,6 +1888,23 @@ Valid values are from 0 - ULLONG_MAX
 An application setting the value must have PTRACE_MODE_ATTACH_FSCREDS level
 permissions on the task specified to change its timerslack_ns value.
 
+3.11	/proc/<pid>/patch_state - Livepatch patch operation state
+-----------------------------------------------------------------
+When CONFIG_LIVEPATCH is enabled, this file displays the value of the
+patch state for the task.
+
+A value of '-1' indicates that no patch is in transition.
+
+A value of '0' indicates that a patch is in transition and the task is
+unpatched.  If the patch is being enabled, then the task hasn't been
+patched yet.  If the patch is being disabled, then the task has already
+been unpatched.
+
+A value of '1' indicates that a patch is in transition and the task is
+patched.  If the patch is being enabled, then the task has already been
+patched.  If the patch is being disabled, then the task hasn't been
+unpatched yet.
+
 
 ------------------------------------------------------------------------------
 Configuring procfs
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 6e86558..5145f40 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2828,6 +2828,15 @@ static int proc_pid_personality(struct seq_file *m, struct pid_namespace *ns,
 	return err;
 }
 
+#ifdef CONFIG_LIVEPATCH
+static int proc_pid_patch_state(struct seq_file *m, struct pid_namespace *ns,
+				struct pid *pid, struct task_struct *task)
+{
+	seq_printf(m, "%d\n", task->patch_state);
+	return 0;
+}
+#endif /* CONFIG_LIVEPATCH */
+
 /*
  * Thread groups
  */
@@ -2927,6 +2936,9 @@ static const struct pid_entry tgid_base_stuff[] = {
 	REG("timers",	  S_IRUGO, proc_timers_operations),
 #endif
 	REG("timerslack_ns", S_IRUGO|S_IWUGO, proc_pid_set_timerslack_ns_operations),
+#ifdef CONFIG_LIVEPATCH
+	ONE("patch_state",  S_IRUSR, proc_pid_patch_state),
+#endif
 };
 
 static int proc_tgid_base_readdir(struct file *file, struct dir_context *ctx)
@@ -3309,6 +3321,9 @@ static const struct pid_entry tid_base_stuff[] = {
 	REG("projid_map", S_IRUGO|S_IWUSR, proc_projid_map_operations),
 	REG("setgroups",  S_IRUGO|S_IWUSR, proc_setgroups_operations),
 #endif
+#ifdef CONFIG_LIVEPATCH
+	ONE("patch_state",  S_IRUSR, proc_pid_patch_state),
+#endif
 };
 
 static int proc_tid_base_readdir(struct file *file, struct dir_context *ctx)
-- 
2.7.4

  parent reply	other threads:[~2017-02-14  1:43 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-14  1:42 [PATCH v5 00/15] livepatch: hybrid consistency model Josh Poimboeuf
2017-02-14  1:42 ` [PATCH v5 01/15] stacktrace/x86: add function for detecting reliable stack traces Josh Poimboeuf
2017-02-15 12:18   ` Miroslav Benes
2017-02-15 14:40     ` Josh Poimboeuf
2017-03-07  6:50   ` Balbir Singh
2017-03-07 16:12     ` Josh Poimboeuf
2017-03-08  9:47       ` Balbir Singh
2017-04-10 15:40   ` Petr Mladek
2017-02-14  1:42 ` [PATCH v5 02/15] x86/entry: define _TIF_ALLWORK_MASK flags explicitly Josh Poimboeuf
2017-02-14  1:42 ` [PATCH v5 03/15] livepatch: create temporary klp_update_patch_state() stub Josh Poimboeuf
2017-02-14  1:42 ` [PATCH v5 04/15] livepatch/x86: add TIF_PATCH_PENDING thread flag Josh Poimboeuf
2017-02-14  1:42 ` [PATCH v5 05/15] livepatch/powerpc: " Josh Poimboeuf
2017-03-07  6:46   ` Balbir Singh
2017-03-08  4:02   ` Michael Ellerman
2017-02-14  1:42 ` [PATCH v5 06/15] livepatch/s390: reorganize TIF thread flag bits Josh Poimboeuf
2017-02-14  1:42 ` [PATCH v5 07/15] livepatch/s390: add TIF_PATCH_PENDING thread flag Josh Poimboeuf
2017-02-14  1:42 ` [PATCH v5 08/15] livepatch: separate enabled and patched states Josh Poimboeuf
2017-02-14  1:42 ` [PATCH v5 09/15] livepatch: remove unnecessary object loaded check Josh Poimboeuf
2017-02-14  1:42 ` [PATCH v5 10/15] livepatch: move patching functions into patch.c Josh Poimboeuf
2017-02-14  1:42 ` [PATCH v5 11/15] livepatch: use kstrtobool() in enabled_store() Josh Poimboeuf
2017-02-14  1:42 ` [PATCH v5 12/15] livepatch: store function sizes Josh Poimboeuf
2017-02-14  1:42 ` [PATCH v5 13/15] livepatch: change to a per-task consistency model Josh Poimboeuf
2017-02-16 14:33   ` Miroslav Benes
2017-02-16 20:31     ` Josh Poimboeuf
2017-02-17  8:51       ` Miroslav Benes
2017-02-21 21:21         ` Josh Poimboeuf
2017-02-22  9:03           ` Miroslav Benes
2017-03-07 14:16   ` Miroslav Benes
2017-04-11 12:35   ` Petr Mladek
2018-01-25  9:04   ` Peter Zijlstra
2018-01-25 10:24     ` Petr Mladek
2018-01-25 10:38       ` Peter Zijlstra
2018-01-25 12:13         ` Petr Mladek
2018-01-25 12:44           ` Peter Zijlstra
2017-02-14  1:42 ` Josh Poimboeuf [this message]
2017-02-14  1:42 ` [PATCH v5 15/15] livepatch: allow removal of a disabled patch Josh Poimboeuf
2017-03-06 17:20   ` [PATCH v5.1 " Josh Poimboeuf
2017-03-07 14:50     ` Miroslav Benes
2017-02-17  8:55 ` [PATCH v5 00/15] livepatch: hybrid consistency model Miroslav Benes
2017-03-07  8:53 ` Ingo Molnar
2017-03-08  9:06 ` Jiri Kosina

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=b3dfb200a0d062737717a86d48488df9b603baab.1487036215.git.jpoimboe@redhat.com \
    --to=jpoimboe@redhat.com \
    --cc=bsingharora@gmail.com \
    --cc=chris.j.arges@canonical.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=jeyu@redhat.com \
    --cc=jikos@kernel.org \
    --cc=jslaby@suse.cz \
    --cc=kamalesh@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=live-patching@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mbenes@suse.cz \
    --cc=mingo@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=peterz@infradead.org \
    --cc=pmladek@suse.com \
    --cc=vojtech@suse.com \
    --cc=x86@kernel.org \
    /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).