live-patching.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Miroslav Benes <mbenes@suse.cz>
Cc: rostedt@goodmis.org, jikos@kernel.org, joe.lawrence@redhat.com,
	jpoimboe@redhat.com, mingo@redhat.com, shuah@kernel.org,
	kamalesh@linux.vnet.ibm.com, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org, live-patching@vger.kernel.org
Subject: Re: [PATCH v3 3/3] selftests/livepatch: Test interaction with ftrace_enabled
Date: Wed, 16 Oct 2019 17:07:41 +0200	[thread overview]
Message-ID: <20191016150741.vrnwik5kkzcxubr2@pathway.suse.cz> (raw)
In-Reply-To: <20191016113316.13415-4-mbenes@suse.cz>

On Wed 2019-10-16 13:33:15, Miroslav Benes wrote:
> From: Joe Lawrence <joe.lawrence@redhat.com>
> 
> Since livepatching depends upon ftrace handlers to implement "patched"
> code functionality, verify that the ftrace_enabled sysctl value
> interacts with livepatch registration as expected.  At the same time,
> ensure that ftrace_enabled is set and part of the test environment
> configuration that is saved and restored when running the selftests.
> 
> Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
> Signed-off-by: Miroslav Benes <mbenes@suse.cz>
> ---
>  tools/testing/selftests/livepatch/Makefile    |  3 +-
>  .../testing/selftests/livepatch/functions.sh  | 14 +++-
>  .../selftests/livepatch/test-ftrace.sh        | 65 +++++++++++++++++++
>  3 files changed, 80 insertions(+), 2 deletions(-)
>  create mode 100755 tools/testing/selftests/livepatch/test-ftrace.sh
> 
> diff --git a/tools/testing/selftests/livepatch/Makefile b/tools/testing/selftests/livepatch/Makefile
> index fd405402c3ff..1886d9d94b88 100644
> --- a/tools/testing/selftests/livepatch/Makefile
> +++ b/tools/testing/selftests/livepatch/Makefile
> @@ -4,6 +4,7 @@ TEST_PROGS_EXTENDED := functions.sh
>  TEST_PROGS := \
>  	test-livepatch.sh \
>  	test-callbacks.sh \
> -	test-shadow-vars.sh
> +	test-shadow-vars.sh \
> +	test-ftrace.sh
>  
>  include ../lib.mk
> diff --git a/tools/testing/selftests/livepatch/functions.sh b/tools/testing/selftests/livepatch/functions.sh
> index b7e5a67ae434..31eb09e38729 100644
> --- a/tools/testing/selftests/livepatch/functions.sh
> +++ b/tools/testing/selftests/livepatch/functions.sh
> @@ -32,12 +32,16 @@ function die() {
>  function push_config() {
>  	DYNAMIC_DEBUG=$(grep '^kernel/livepatch' /sys/kernel/debug/dynamic_debug/control | \
>  			awk -F'[: ]' '{print "file " $1 " line " $2 " " $4}')
> +	FTRACE_ENABLED=$(sysctl --values kernel.ftrace_enabled)
>  }
>  
>  function pop_config() {
>  	if [[ -n "$DYNAMIC_DEBUG" ]]; then
>  		echo -n "$DYNAMIC_DEBUG" > /sys/kernel/debug/dynamic_debug/control
>  	fi
> +	if [[ -n "$FTRACE_ENABLED" ]]; then
> +		sysctl kernel.ftrace_enabled="$FTRACE_ENABLED" &> /dev/null
> +	fi
>  }
>  
>  function set_dynamic_debug() {
> @@ -47,12 +51,20 @@ function set_dynamic_debug() {
>  		EOF
>  }
>  
> +function set_ftrace_enabled() {
> +	local sysctl="$1"

The variable is not later used.

> +	result=$(sysctl kernel.ftrace_enabled="$1" 2>&1 | paste --serial --delimiters=' ')
> +	echo "livepatch: $result" > /dev/kmsg
> +}

Otherwise, the patch looks good to me. After removing or using the
variable:

Reviewed-by: Petr Mladek <pmladek@suse.com>

Best Regards,
Petr

  reply	other threads:[~2019-10-16 15:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-16 11:33 [PATCH v3 0/3] ftrace: Introduce PERMANENT ftrace_ops flag Miroslav Benes
2019-10-16 11:33 ` [PATCH v3 1/3] " Miroslav Benes
2019-10-16 13:48   ` Steven Rostedt
2019-10-16 14:25     ` Steven Rostedt
2019-10-16 11:33 ` [PATCH v3 2/3] selftests/livepatch: Make dynamic debug setup and restore generic Miroslav Benes
2019-10-16 15:08   ` Petr Mladek
2019-10-16 17:10   ` Kamalesh Babulal
2019-10-16 21:39     ` Joe Lawrence
2019-10-16 11:33 ` [PATCH v3 3/3] selftests/livepatch: Test interaction with ftrace_enabled Miroslav Benes
2019-10-16 15:07   ` Petr Mladek [this message]
2019-10-16 17:06   ` Kamalesh Babulal
2019-10-16 21:47     ` Joe Lawrence
2019-10-17  7:25       ` Kamalesh Babulal
2019-10-16 14:58 ` [PATCH v3 0/3] ftrace: Introduce PERMANENT ftrace_ops flag Steven Rostedt
2019-10-16 15:01   ` Miroslav Benes

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=20191016150741.vrnwik5kkzcxubr2@pathway.suse.cz \
    --to=pmladek@suse.com \
    --cc=jikos@kernel.org \
    --cc=joe.lawrence@redhat.com \
    --cc=jpoimboe@redhat.com \
    --cc=kamalesh@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=shuah@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).