From: Joe Lawrence <joe.lawrence@redhat.com>
To: Petr Mladek <pmladek@suse.com>
Cc: Jiri Kosina <jikos@kernel.org>,
Josh Poimboeuf <jpoimboe@redhat.com>,
Miroslav Benes <mbenes@suse.cz>, Jason Baron <jbaron@akamai.com>,
Jessica Yu <jeyu@kernel.org>,
Evgenii Shatokhin <eshatokhin@virtuozzo.com>,
live-patching@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v10 00/10] livepatch: Atomic replace feature
Date: Mon, 26 Mar 2018 14:12:03 -0400 [thread overview]
Message-ID: <6b1c58e4-9dc3-36bd-1fb6-e136605d0c66@redhat.com> (raw)
In-Reply-To: <20180326105610.fzjfotkaljbuoa57@pathway.suse.cz>
On 03/26/2018 06:56 AM, Petr Mladek wrote:
> On Mon 2018-03-12 14:57:04, Joe Lawrence wrote:
>> Hi Petr,
>>
>> These are the callback tests that I hacked up into a livepatch
>> kselftest. (Basically I copied a bunch of the sample modules and
>> verified the expected dmesg output as I had listed in in the
>> Documentation/livepatch/callbacks.txt file.) The script is still a
>> little rough and maybe this isn't the direction we want to go for proper
>> kselftests, but perhaps it saves you some time/sanity for verifying this
>> patchset.
>
>
>
>> Hope this helps,
>>
>> -- Joe
>>
>> -- >8 -- >8 -- >8 -- >8 --
>>
>> >From 0364430c53e12e21923bed20cb651374b4cf9ba9 Mon Sep 17 00:00:00 2001
>> From: Joe Lawrence <joe.lawrence@redhat.com>
>> Date: Tue, 6 Mar 2018 17:32:25 -0500
>> Subject: WIP - livepatch kselftest
>>
>> CONFIG_TEST_LIVEPATCH=m
>> % make -C tools/testing/selftests TARGETS=livepatch run_tests
>>
>> Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
>> ---
>> lib/Kconfig.debug | 11 +
>> lib/Makefile | 9 +
>> lib/test_klp_callbacks_busy.c | 58 ++
>> lib/test_klp_callbacks_demo.c | 205 +++++++
>> lib/test_klp_callbacks_demo2.c | 149 +++++
>> lib/test_klp_callbacks_mod.c | 39 ++
>
> I would suggest to put it into lib/livepatch/ subdirectory. I hope
> that we will add more tests in the long term.
Good idea, we should encourage more tests in a livepatch/ subdir and not
clutter up the lib/ directory.
>> diff --git a/tools/testing/selftests/livepatch/livepatch-test b/tools/testing/selftests/livepatch/livepatch-test
>> new file mode 100755
>> index 000000000000..798317bf69f6
>> --- /dev/null
>> +++ b/tools/testing/selftests/livepatch/livepatch-test
>
> s/livepatch-test/livepatch-test.sh/ ?
>
> It seems to be common to add .sh suffix for bash script names.
I'll rename with the suffix.
>> @@ -0,0 +1,658 @@
>> +#!/bin/bash
>> +# SPDX-License-Identifier: GPL-2.0
>> +# Copyright (C) 2018 Joe Lawrence <joe.lawrence@redhat.com>
>> +
>> +MAX_RETRIES=30
>> +RETRY_INTERVAL=2 # seconds
>> +BETWEEN_TESTS=20 # seconds
>
> These 20 seconds kept me in a tense (waiting for the final result)
> for a very long time ;-) Is there any particular reason for such
> a long delay?
It certainly builds suspense :)
> I wonder if we need a delay at all or if let's say 2 seconds might
> be enough.
I removed the delays completely and the tests ran successfully. What
might be better than a between test delay would be some kind of
initial-condition verification, ie, make sure that the test starts/ends
with none of the livepatch test modules loaded.
For the test cases which load multiple livepatches, is there an easy way
to determine the patch stack order from userspace? I think that would
be helpful when trying to remove all of them.
>> +echo -n "TEST1 ... "
>> +dmesg -C
>> +
>> +load_mod $MOD_TARGET
>> +load_mod $MOD_LIVEPATCH
>> +wait_for_transition $MOD_LIVEPATCH
>> +disable_lp $MOD_LIVEPATCH
>> +unload_mod $MOD_LIVEPATCH
>> +unload_mod $MOD_TARGET
>> +
>> +check_result "% modprobe $MOD_TARGET
>> +$MOD_TARGET: livepatch_callbacks_mod_init
>> +% modprobe $MOD_LIVEPATCH
>> +livepatch: enabling patch '$MOD_LIVEPATCH'
>> +livepatch: '$MOD_LIVEPATCH': initializing patching transition
>> +$MOD_LIVEPATCH: pre_patch_callback: $MOD_TARGET -> [MODULE_STATE_LIVE] Normal state
>> +$MOD_LIVEPATCH: pre_patch_callback: vmlinux
>> +livepatch: '$MOD_LIVEPATCH': starting patching transition
>> +livepatch: '$MOD_LIVEPATCH': completing patching transition
>> +$MOD_LIVEPATCH: post_patch_callback: $MOD_TARGET -> [MODULE_STATE_LIVE] Normal state
>> +$MOD_LIVEPATCH: post_patch_callback: vmlinux
>> +livepatch: '$MOD_LIVEPATCH': patching complete
>> +% echo 0 > /sys/kernel/livepatch/$MOD_LIVEPATCH/enabled
>> +livepatch: '$MOD_LIVEPATCH': initializing unpatching transition
>> +$MOD_LIVEPATCH: pre_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_LIVE] Normal state
>> +$MOD_LIVEPATCH: pre_unpatch_callback: vmlinux
>> +livepatch: '$MOD_LIVEPATCH': starting unpatching transition
>> +livepatch: '$MOD_LIVEPATCH': completing unpatching transition
>> +$MOD_LIVEPATCH: post_unpatch_callback: $MOD_TARGET -> [MODULE_STATE_LIVE] Normal state
>> +$MOD_LIVEPATCH: post_unpatch_callback: vmlinux
>> +livepatch: '$MOD_LIVEPATCH': unpatching complete
>> +% rmmod $MOD_LIVEPATCH
>> +% rmmod $MOD_TARGET
>> +$MOD_TARGET: livepatch_callbacks_mod_exit"
>
> I was a bit surprised when seeing this way of checking results.
> But on the other hand, it looks pretty effective, especially for
> the callbacks. And the 3rd look, any patched function might write
> something into the log when called.
This was a quickly scripted version of what I was manually verifying
with the sample example livepatches. I don't know if it will scale, but
it was pretty easy to add tests this way.
I wonder though if better dmesg filters will be required as the
livepatch core adds more debug msgs?
> I like it. Let's see how it works in the long term. But I am rather
> positive.
>
> Thanks a lot for working on it.
Thanks for taking a look and running the tests. I'll make some of your
suggested changes and send it up for a proper review soon.
-- Joe
next prev parent reply other threads:[~2018-03-26 18:12 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-07 8:20 Petr Mladek
2018-03-07 8:20 ` [PATCH v10 01/10] livepatch: Use lists to manage patches, objects and functions Petr Mladek
2018-03-13 22:38 ` Josh Poimboeuf
2018-03-07 8:20 ` [PATCH v10 02/10] livepatch: Free only structures with initialized kobject Petr Mladek
2018-03-13 22:38 ` Josh Poimboeuf
2018-03-14 15:50 ` Petr Mladek
2018-03-07 8:20 ` [PATCH v10 03/10] livepatch: Initial support for dynamic structures Petr Mladek
2018-03-13 22:44 ` Josh Poimboeuf
2018-03-19 13:10 ` Petr Mladek
2018-03-07 8:20 ` [PATCH v10 04/10] livepatch: Allow to unpatch only functions of the given type Petr Mladek
2018-03-07 8:20 ` [PATCH v10 05/10] livepatch: Support separate list for replaced patches Petr Mladek
2018-03-13 22:46 ` Josh Poimboeuf
2018-03-19 15:02 ` Petr Mladek
2018-03-19 21:43 ` Josh Poimboeuf
2018-03-20 12:25 ` Petr Mladek
2018-03-20 12:48 ` Evgenii Shatokhin
2018-03-20 13:30 ` Miroslav Benes
2018-03-20 20:15 ` Josh Poimboeuf
2018-03-23 9:45 ` Petr Mladek
2018-03-23 22:44 ` Josh Poimboeuf
2018-03-26 10:11 ` Petr Mladek
2018-04-06 19:50 ` Josh Poimboeuf
2018-04-10 8:34 ` Petr Mladek
2018-04-10 13:21 ` Miroslav Benes
2018-04-10 13:56 ` Evgenii Shatokhin
2018-04-10 17:47 ` Josh Poimboeuf
2018-04-11 7:56 ` Miroslav Benes
2018-04-10 17:42 ` Josh Poimboeuf
2018-04-11 8:07 ` Miroslav Benes
2018-04-11 12:32 ` Josh Poimboeuf
2018-04-11 13:39 ` Miroslav Benes
2018-04-11 14:17 ` Petr Mladek
2018-04-11 15:48 ` Josh Poimboeuf
2018-04-16 14:58 ` Petr Mladek
2018-04-16 19:04 ` Josh Poimboeuf
2018-04-17 8:23 ` Miroslav Benes
2018-04-17 15:37 ` Petr Mladek
2018-04-17 17:57 ` Josh Poimboeuf
2018-03-07 8:20 ` [PATCH v10 06/10] livepatch: Add atomic replace Petr Mladek
2018-03-13 22:48 ` Josh Poimboeuf
2018-03-20 14:35 ` Petr Mladek
2018-03-20 21:26 ` Josh Poimboeuf
2018-03-22 15:43 ` Petr Mladek
2018-03-07 8:20 ` [PATCH v10 07/10] livepatch: Correctly handle atomic replace for not yet loaded modules Petr Mladek
2018-03-13 14:55 ` Petr Mladek
2018-03-07 8:20 ` [PATCH v10 08/10] livepatch: Improve dynamic struct klp_object detection and manipulation Petr Mladek
2018-03-07 8:20 ` [PATCH v10 09/10] livepatch: Allow to replace even disabled patches Petr Mladek
2018-03-07 8:20 ` [PATCH v10 10/10] livepatch: Atomic replace and cumulative patches documentation Petr Mladek
2018-03-07 21:55 ` [PATCH v10 00/10] livepatch: Atomic replace feature Joe Lawrence
2018-03-08 15:01 ` Petr Mladek
2018-03-08 15:09 ` Joe Lawrence
2018-03-12 18:57 ` Joe Lawrence
2018-03-20 13:16 ` Miroslav Benes
2018-03-26 10:56 ` Petr Mladek
2018-03-26 18:12 ` Joe Lawrence [this message]
2018-03-27 8:22 ` Petr Mladek
2018-08-17 10:17 ` Evgenii Shatokhin
2018-08-17 14:53 ` Petr Mladek
2018-08-17 15:33 ` Evgenii Shatokhin
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=6b1c58e4-9dc3-36bd-1fb6-e136605d0c66@redhat.com \
--to=joe.lawrence@redhat.com \
--cc=eshatokhin@virtuozzo.com \
--cc=jbaron@akamai.com \
--cc=jeyu@kernel.org \
--cc=jikos@kernel.org \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=pmladek@suse.com \
/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
all inboxes | Powered by JetHome®