From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750862AbdAaOb4 (ORCPT ); Tue, 31 Jan 2017 09:31:56 -0500 Received: from mx2.suse.de ([195.135.220.15]:35751 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750910AbdAaObs (ORCPT ); Tue, 31 Jan 2017 09:31:48 -0500 Date: Tue, 31 Jan 2017 15:31:39 +0100 (CET) From: Miroslav Benes To: Josh Poimboeuf cc: Jessica Yu , Jiri Kosina , Petr Mladek , linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, Michael Ellerman , Heiko Carstens , x86@kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, Vojtech Pavlik , Jiri Slaby , Chris J Arges , Andy Lutomirski , Ingo Molnar , Peter Zijlstra , Kamalesh Babulal , Balbir Singh Subject: Re: [PATCH v4 14/15] livepatch: add /proc//patch_state In-Reply-To: <2c3b793fc23910f8fe15033b2b35e53b0b5dbaf3.1484839971.git.jpoimboe@redhat.com> Message-ID: References: <2c3b793fc23910f8fe15033b2b35e53b0b5dbaf3.1484839971.git.jpoimboe@redhat.com> User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Reviewed-by: Petr Mladek > Reviewed-by: Miroslav Benes > --- > 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//fdinfo/ - Information about opened file > 3.9 /proc//map_files - Information about memory mapped files > 3.10 /proc//timerslack_ns - Task timerslack value > + 3.11 /proc//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//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//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//patch_state to show only two states - task is in transition (1), task is patched (0). What do you think? Miroslav