From: Joe Lawrence <joe.lawrence@redhat.com>
To: Petr Mladek <pmladek@suse.com>
Cc: Nicolai Stange <nstange@suse.de>,
live-patching@vger.kernel.org, linux-kernel@vger.kernel.org,
Josh Poimboeuf <jpoimboe@kernel.org>,
Miroslav Benes <mbenes@suse.cz>
Subject: Re: [PATCH v1 18/19] Documentation/livepatch: Update documentation for state, callbacks, and shadow variables
Date: Thu, 6 Mar 2025 17:54:41 -0500 [thread overview]
Message-ID: <c291e9ea-2e66-e9f5-216d-f27e01382bfe@redhat.com> (raw)
In-Reply-To: <20250115082431.5550-19-pmladek@suse.com>
On 1/15/25 03:24, Petr Mladek wrote:
> This commit updates the livepatch documentation to reflect recent changes
> in the behavior of states, callbacks, and shadow variables.
>
> Key changes include:
>
> - Per-state callbacks replace per-object callbacks, invoked only when a
> livepatch introduces or removes a state.
> - Shadow variable lifetime is now tied to the corresponding livepatch
> state lifetime.
> - The "version" field in `struct klp_state` has been replaced with the
> "block_disable" flag for improved compatibility handling.
> - The "data" field has been removed from `struct klp_state`; shadow
> variables are now the recommended way to store state-related data.
>
> This update ensures the documentation accurately describes the current
> livepatch functionality.
>
> Signed-off-by: Petr Mladek <pmladek@suse.com>
Hi Petr, I'm finally getting around to looking through these patches.
I've made it as far as the selftest cleanups, then skipped ahead to the
Documentation here. Before diving into code review, I just wanted to
clarify some things for my own understanding. Please correct anything
below that is incorrect. IMHO it is easy to step off the intended path
here :D
The original livepatch system states operated with a numeric .version
field. New livepatches could only be loaded if providing a new set of
states, or an equal-or-better version of states already loaded by
existing livepatches.
With that in mind, a livepatch state could be thought of as an
indication of "a context needing special handling in a (versioned) way".
Livepatches claiming to deal with a particular state, needed to do so
with its latest or current versioning. A livepatch without a particular
state was not bound to any restriction on that state, so nothing
prevented subsequent atomic replace patches from blowing away existing
states (those patches cleaned up their states on their disabling), or
subsequent non-atomic replace patches from adding to the collective
livepatch state.
This patchset does away with .version and adds .block_disable. This is
very different from versioning as prevents the associated state from
ever going away. In an atomic-replace series of livepatches, this means
once a state is introduced, all following patches must contain that
state. In non-atomic-replace series, there is no restriction on
subsequent patches, but the original patch introducing the state cannot
ever be disabled/unloaded. (I'm not going to consider future hybrid
mixed atomic/not use cases as my brain is already full.)
Finally, the patchset adds .is_shadow and .callbacks. A short sequence
of livepatches may look like:
klp_patch A | klp_patch B
.states[x] | .states[y]
.id = 42 | .id = 42
.callbacks | .callbacks
.block_disable | .block_disable
.is_shadow | .is_shadow
is there any harm or confusion if the two patches' state 42 contained
disparate .callbacks, .block_disable, or .is_shadow contents?
I /think/ this is allowed by the patchset (though I haven't gotten too
deep in my understanding), but I feel that I'm starting to stretch my
intuitive understanding of these livepatching states. Applying them to
a series of atomic-replace livepatches is fairly straightforward. But
then for a non-atomic-replace series, it starts getting weird as
multiple callback sets will exist in multiple patches.
In a perfect world, we could describe livepatching states absent
callbacks and shadow variables. The documentation is a bit circular as
one needs to understand them before fully grasping the purpose of the
states. But to use them, you will first need to understand how to set
them up in the states. :) Maybe there is no better way, but first I
need to correct my understanding.
Thanks,
--
Joe
next prev parent reply other threads:[~2025-03-06 22:55 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-15 8:24 [PATCH v1 00/19] livepatch: Better integrate callbacks and shadow variables with the states API Petr Mladek
2025-01-15 8:24 ` [PATCH v1 01/19] livepatch: Add callbacks for introducing and removing states Petr Mladek
2025-01-15 8:24 ` [PATCH v1 02/19] livepatch: Allow to handle lifetime of shadow variables using the livepatch state Petr Mladek
2025-01-15 8:24 ` [PATCH v1 03/19] selftests/livepatch: Use per-state callbacks in state API tests Petr Mladek
2025-01-15 8:24 ` [PATCH v1 04/19] livepatch: Add "block_disable" flag to per-state API and remove versioning Petr Mladek
2025-01-15 8:24 ` [PATCH v1 05/19] livepatch: Remove "data" from struct klp_state Petr Mladek
2025-01-15 8:24 ` [PATCH v1 06/19] selftests/livepatch: Remove callbacks from sysfs interface testing Petr Mladek
2025-01-15 8:24 ` [PATCH v1 07/19] selftests/livepatch: Substitute hard-coded /sys/module path Petr Mladek
2025-01-15 8:24 ` [PATCH v1 08/19] selftests/livepatch: Move basic tests for livepatching modules Petr Mladek
2025-01-15 8:24 ` [PATCH v1 09/19] selftests/livepatch: Convert testing of multiple target modules Petr Mladek
2025-01-15 8:24 ` [PATCH v1 10/19] selftests/livepatch: Create a simple selftest for state callbacks Petr Mladek
2025-01-15 8:24 ` [PATCH v1 11/19] selftests/livepatch: Convert selftests for failing pre_patch callback Petr Mladek
2025-01-15 8:24 ` [PATCH v1 12/19] selftests/livepatch: Convert selftest with blocked transition Petr Mladek
2025-01-15 8:24 ` [PATCH v1 13/19] selftests/livepatch: Add more tests for state callbacks with blocked transitions Petr Mladek
2025-01-15 8:24 ` [PATCH v1 14/19] selftests/livepatch: Convert selftests for testing callbacks with more livepatches Petr Mladek
2025-01-15 8:24 ` [PATCH v1 15/19] selftests/livepatch: Do not use a livepatch with the obsolete per-object callbacks in the basic selftests Petr Mladek
2025-01-15 8:24 ` [PATCH v1 16/19] selftests/livepatch: Remove obsolete test modules for per-object callbacks Petr Mladek
2025-01-15 8:24 ` [PATCH v1 17/19] samples/livepatch: Replace sample module with obsolete " Petr Mladek
2025-01-15 8:24 ` [PATCH v1 18/19] Documentation/livepatch: Update documentation for state, callbacks, and shadow variables Petr Mladek
2025-03-06 22:54 ` Joe Lawrence [this message]
2025-03-07 12:26 ` Petr Mladek
2025-03-07 15:50 ` Joe Lawrence
2025-03-17 11:17 ` Petr Mladek
2025-01-15 8:24 ` [PATCH v1 19/19] livepatch: Remove obsolete per-object callbacks Petr Mladek
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=c291e9ea-2e66-e9f5-216d-f27e01382bfe@redhat.com \
--to=joe.lawrence@redhat.com \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=nstange@suse.de \
--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