Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1570789 > unrolled thread

Re: [PATCH v4 14/15] livepatch: add /proc/<pid>/patch_state

Started byMiroslav Benes <mbenes@suse.cz>
First post2017-01-31 15:40 +0100
Last post2017-02-01 10:00 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v4 14/15] livepatch: add /proc/<pid>/patch_state Miroslav Benes <mbenes@suse.cz> - 2017-01-31 15:40 +0100
    Re: [PATCH v4 14/15] livepatch: add /proc/<pid>/patch_state Josh Poimboeuf <jpoimboe@redhat.com> - 2017-01-31 16:10 +0100
      Re: [PATCH v4 14/15] livepatch: add /proc/<pid>/patch_state Miroslav Benes <mbenes@suse.cz> - 2017-02-01 10:00 +0100

#1570789 — Re: [PATCH v4 14/15] livepatch: add /proc/<pid>/patch_state

FromMiroslav Benes <mbenes@suse.cz>
Date2017-01-31 15:40 +0100
SubjectRe: [PATCH v4 14/15] livepatch: add /proc/<pid>/patch_state
Message-ID<t5HLb-1Ot-7@gated-at.bofh.it>
On Thu, 19 Jan 2017, Josh Poimboeuf wrote:

> 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 72624a1..85c501b 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
> @@ -1886,6 +1887,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.
> +

Despite my review I thought about this some more. I think the logic make 
sense internally but when exposed it can be confusing. We do not export 
klp_target_state value, so users have to know if a patch is being enabled 
or disabled. Of course, they should know that, but I guess they'd like to 
use an userspace tool for this. Such tool needs to look at 
/proc/<pid>/patch_state to find out which tasks are blocking the 
completion and that is it. No more information anywhere.

We can either export klp_target_state, or change /proc/<pid>/patch_state 
to show only two states - task is in transition (1), task is patched (0).

What do you think?

Miroslav

[toc] | [next] | [standalone]


#1570810

FromJosh Poimboeuf <jpoimboe@redhat.com>
Date2017-01-31 16:10 +0100
Message-ID<t5Ied-2dH-3@gated-at.bofh.it>
In reply to#1570789
On Tue, Jan 31, 2017 at 03:31:39PM +0100, Miroslav Benes wrote:
> On Thu, 19 Jan 2017, Josh Poimboeuf wrote:
> 
> > 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 72624a1..85c501b 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
> > @@ -1886,6 +1887,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.
> > +
> 
> Despite my review I thought about this some more. I think the logic make 
> sense internally but when exposed it can be confusing. We do not export 
> klp_target_state value, so users have to know if a patch is being enabled 
> or disabled. Of course, they should know that, but I guess they'd like to 
> use an userspace tool for this. Such tool needs to look at 
> /proc/<pid>/patch_state to find out which tasks are blocking the 
> completion and that is it. No more information anywhere.
> 
> We can either export klp_target_state, or change /proc/<pid>/patch_state 
> to show only two states - task is in transition (1), task is patched (0).
> 
> What do you think?

Isn't this information already available in
/sys/kernel/livepatch/<patch>/{enabled,transition}?

-- 
Josh

[toc] | [prev] | [next] | [standalone]


#1571339

FromMiroslav Benes <mbenes@suse.cz>
Date2017-02-01 10:00 +0100
Message-ID<t5YVI-3Cf-21@gated-at.bofh.it>
In reply to#1570810
On Tue, 31 Jan 2017, Josh Poimboeuf wrote:

> On Tue, Jan 31, 2017 at 03:31:39PM +0100, Miroslav Benes wrote:
> > On Thu, 19 Jan 2017, Josh Poimboeuf wrote:
> > 
> > > 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 72624a1..85c501b 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
> > > @@ -1886,6 +1887,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.
> > > +
> > 
> > Despite my review I thought about this some more. I think the logic make 
> > sense internally but when exposed it can be confusing. We do not export 
> > klp_target_state value, so users have to know if a patch is being enabled 
> > or disabled. Of course, they should know that, but I guess they'd like to 
> > use an userspace tool for this. Such tool needs to look at 
> > /proc/<pid>/patch_state to find out which tasks are blocking the 
> > completion and that is it. No more information anywhere.
> > 
> > We can either export klp_target_state, or change /proc/<pid>/patch_state 
> > to show only two states - task is in transition (1), task is patched (0).
> > 
> > What do you think?
> 
> Isn't this information already available in
> /sys/kernel/livepatch/<patch>/{enabled,transition}?

transition no. That only gives the hint that something is happening with 
the patch. But yes, enabled is the one I wanted. I don't know how I missed 
that. Combined with /proc/<pid>/task it is exactly what a tool needs.

Miroslav

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web