[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f82e57ce-f33f-4ace-514e-75fcba42b5ba@redhat.com>
Date: Tue, 15 Oct 2019 09:25:45 -0400
From: Joe Lawrence <joe.lawrence@...hat.com>
To: Miroslav Benes <mbenes@...e.cz>
Cc: rostedt@...dmis.org, mingo@...hat.com, jpoimboe@...hat.com,
jikos@...nel.org, pmladek@...e.com, linux-kernel@...r.kernel.org,
live-patching@...r.kernel.org
Subject: Re: [PATCH v2] ftrace: Introduce PERMANENT ftrace_ops flag
On 10/15/19 7:23 AM, Miroslav Benes wrote:
>> Hi Miroslav,
>>
>> Maybe we should add a test to verify this new behavior? See sample
>> version below (lightly tested). We can add to this one, or patch
>> seperately if you prefer.
>
> Thanks a lot, Joe. It looks nice. I'll include it in v3. One question
> below.
>
>> -->8-- -->8-- -->8-- -->8-- -->8-- -->8-- -->8-- -->8-- -->8-- -->8--
>>
>>
>> >From c8c9f22e3816ca4c90ab7e7159d2ce536eaa5fad Mon Sep 17 00:00:00 2001
>> From: Joe Lawrence <joe.lawrence@...hat.com>
>> Date: Mon, 14 Oct 2019 18:25:01 -0400
>> Subject: [PATCH] selftests/livepatch: test interaction with ftrace_enabled
>>
>> Since livepatching depends upon ftrace handlers to implement "patched"
>> functionality, verify that the ftrace_enabled sysctl value interacts
>> with livepatch registration as expected.
>>
>> Signed-off-by: Joe Lawrence <joe.lawrence@...hat.com>
>> ---
>> tools/testing/selftests/livepatch/Makefile | 3 +-
>> .../testing/selftests/livepatch/functions.sh | 18 +++++
>> .../selftests/livepatch/test-ftrace.sh | 65 +++++++++++++++++++
>> 3 files changed, 85 insertions(+), 1 deletion(-)
>> 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 79b0affd21fb..556252efece0 100644
>> --- a/tools/testing/selftests/livepatch/functions.sh
>> +++ b/tools/testing/selftests/livepatch/functions.sh
>> @@ -52,6 +52,24 @@ function set_dynamic_debug() {
>> EOF
>> }
>>
>> +function push_ftrace_enabled() {
>> + FTRACE_ENABLED=$(sysctl --values kernel.ftrace_enabled)
>> +}
>
> Shouldn't we call push_ftrace_enabled() somewhere at the beginning of the
> test script? set_dynamic_debug() calls its push_dynamic_debug() directly,
> but set_ftrace_enabled() is different, because it is called more than once
> in the script.
>
> One could argue that ftrace_enabled has to be true at the beginning of
> testing anyway, but I think it would be cleaner. Btw, we should probably
> guarantee that ftrace_enabled is true when livepatch selftests are
> invoked.
>
Ah yes, that occurred to me while creating that piece of the patch.
Something like setup_test_config() that pushes both ftrace and the
debugfs, etc. would be cleaner for all scripts. If you're onboard with
that idea, I can make that revision.
-- Joe
Powered by blists - more mailing lists