diff options
author | Josh Poimboeuf <jpoimboe@redhat.com> | 2017-02-13 20:42:41 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2017-03-08 03:38:19 -0500 |
commit | 7c23b330011690705613a66a8239d2ca64a41d4d (patch) | |
tree | 272edb45a2674e0df61c4a27e72b7bffc110b8fd | |
parent | d83a7cb375eec21f04c83542395d08b2f6641da2 (diff) |
livepatch: add /proc/<pid>/patch_state
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>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r-- | Documentation/filesystems/proc.txt | 18 | ||||
-rw-r--r-- | fs/proc/base.c | 15 |
2 files changed, 33 insertions, 0 deletions
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt index c94b4675d021..9036dbf16156 100644 --- a/Documentation/filesystems/proc.txt +++ b/Documentation/filesystems/proc.txt | |||
@@ -44,6 +44,7 @@ Table of Contents | |||
44 | 3.8 /proc/<pid>/fdinfo/<fd> - Information about opened file | 44 | 3.8 /proc/<pid>/fdinfo/<fd> - Information about opened file |
45 | 3.9 /proc/<pid>/map_files - Information about memory mapped files | 45 | 3.9 /proc/<pid>/map_files - Information about memory mapped files |
46 | 3.10 /proc/<pid>/timerslack_ns - Task timerslack value | 46 | 3.10 /proc/<pid>/timerslack_ns - Task timerslack value |
47 | 3.11 /proc/<pid>/patch_state - Livepatch patch operation state | ||
47 | 48 | ||
48 | 4 Configuring procfs | 49 | 4 Configuring procfs |
49 | 4.1 Mount options | 50 | 4.1 Mount options |
@@ -1887,6 +1888,23 @@ Valid values are from 0 - ULLONG_MAX | |||
1887 | An application setting the value must have PTRACE_MODE_ATTACH_FSCREDS level | 1888 | An application setting the value must have PTRACE_MODE_ATTACH_FSCREDS level |
1888 | permissions on the task specified to change its timerslack_ns value. | 1889 | permissions on the task specified to change its timerslack_ns value. |
1889 | 1890 | ||
1891 | 3.11 /proc/<pid>/patch_state - Livepatch patch operation state | ||
1892 | ----------------------------------------------------------------- | ||
1893 | When CONFIG_LIVEPATCH is enabled, this file displays the value of the | ||
1894 | patch state for the task. | ||
1895 | |||
1896 | A value of '-1' indicates that no patch is in transition. | ||
1897 | |||
1898 | A value of '0' indicates that a patch is in transition and the task is | ||
1899 | unpatched. If the patch is being enabled, then the task hasn't been | ||
1900 | patched yet. If the patch is being disabled, then the task has already | ||
1901 | been unpatched. | ||
1902 | |||
1903 | A value of '1' indicates that a patch is in transition and the task is | ||
1904 | patched. If the patch is being enabled, then the task has already been | ||
1905 | patched. If the patch is being disabled, then the task hasn't been | ||
1906 | unpatched yet. | ||
1907 | |||
1890 | 1908 | ||
1891 | ------------------------------------------------------------------------------ | 1909 | ------------------------------------------------------------------------------ |
1892 | Configuring procfs | 1910 | Configuring procfs |
diff --git a/fs/proc/base.c b/fs/proc/base.c index c87b6b9a8a76..9e3ac5c11780 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -2834,6 +2834,15 @@ static int proc_pid_personality(struct seq_file *m, struct pid_namespace *ns, | |||
2834 | return err; | 2834 | return err; |
2835 | } | 2835 | } |
2836 | 2836 | ||
2837 | #ifdef CONFIG_LIVEPATCH | ||
2838 | static int proc_pid_patch_state(struct seq_file *m, struct pid_namespace *ns, | ||
2839 | struct pid *pid, struct task_struct *task) | ||
2840 | { | ||
2841 | seq_printf(m, "%d\n", task->patch_state); | ||
2842 | return 0; | ||
2843 | } | ||
2844 | #endif /* CONFIG_LIVEPATCH */ | ||
2845 | |||
2837 | /* | 2846 | /* |
2838 | * Thread groups | 2847 | * Thread groups |
2839 | */ | 2848 | */ |
@@ -2933,6 +2942,9 @@ static const struct pid_entry tgid_base_stuff[] = { | |||
2933 | REG("timers", S_IRUGO, proc_timers_operations), | 2942 | REG("timers", S_IRUGO, proc_timers_operations), |
2934 | #endif | 2943 | #endif |
2935 | REG("timerslack_ns", S_IRUGO|S_IWUGO, proc_pid_set_timerslack_ns_operations), | 2944 | REG("timerslack_ns", S_IRUGO|S_IWUGO, proc_pid_set_timerslack_ns_operations), |
2945 | #ifdef CONFIG_LIVEPATCH | ||
2946 | ONE("patch_state", S_IRUSR, proc_pid_patch_state), | ||
2947 | #endif | ||
2936 | }; | 2948 | }; |
2937 | 2949 | ||
2938 | static int proc_tgid_base_readdir(struct file *file, struct dir_context *ctx) | 2950 | static int proc_tgid_base_readdir(struct file *file, struct dir_context *ctx) |
@@ -3315,6 +3327,9 @@ static const struct pid_entry tid_base_stuff[] = { | |||
3315 | REG("projid_map", S_IRUGO|S_IWUSR, proc_projid_map_operations), | 3327 | REG("projid_map", S_IRUGO|S_IWUSR, proc_projid_map_operations), |
3316 | REG("setgroups", S_IRUGO|S_IWUSR, proc_setgroups_operations), | 3328 | REG("setgroups", S_IRUGO|S_IWUSR, proc_setgroups_operations), |
3317 | #endif | 3329 | #endif |
3330 | #ifdef CONFIG_LIVEPATCH | ||
3331 | ONE("patch_state", S_IRUSR, proc_pid_patch_state), | ||
3332 | #endif | ||
3318 | }; | 3333 | }; |
3319 | 3334 | ||
3320 | static int proc_tid_base_readdir(struct file *file, struct dir_context *ctx) | 3335 | static int proc_tid_base_readdir(struct file *file, struct dir_context *ctx) |