From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Jason Baron <jbaron@akamai.com>
Cc: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org,
jeyu@kernel.org, jikos@kernel.org, mbenes@suse.cz,
pmladek@suse.com
Subject: Re: [PATCH v3 1/2] livepatch: Add dynamic klp_object and klp_func iterators
Date: Tue, 10 Oct 2017 21:51:52 -0500 [thread overview]
Message-ID: <20171011025152.t42dztemjjzba7ua@treble> (raw)
In-Reply-To: <cca3497b-ba83-35eb-5f9b-e64fd2c9fa40@akamai.com>
On Tue, Oct 10, 2017 at 11:15:33AM -0400, Jason Baron wrote:
>
>
> On 10/06/2017 05:22 PM, Josh Poimboeuf wrote:
> > On Wed, Sep 27, 2017 at 11:41:29PM -0400, Jason Baron wrote:
> >> In preparation to introducing atomic replace, introduce iterators for
> >> klp_func and klp_object, such that objects and functions can be dynamically
> >> allocated (needed for atomic replace). This patch is intended to
> >> effectively be a no-op until atomic replace is introduced.
> >
> > Hi Jason,
> >
> > Sorry for coming in so late on this. This will be a nice feature. I
> > haven't gotten to the second patch yet, but I have a few comments
> > already.
> >
>
>
> Hi Josh,
>
> > 1) Having both static *and* dynamic lists seems to add a lot of
> > complexity and brittleness.
> >
> > The livepatch API is easier to use with static data structures, so I
> > don't think we should change the API. But I also don't think we
> > should allow the API to overly constrain our internal representation
> > of the data.
> >
> > What I'd *really* like to do is completely separate the user-supplied
> > data structures from our internal data . At registration time, we
> > can convert all the arrays to dynamic lists, and then never touch the
> > arrays again. Then managing the lists is completely straightforward.
> >
> > That would also allow us to have an external public struct and an
> > internal private struct, so the interface is more clear and we don't
> > have to worry about any patch modules accidentally messing with our
> > private data.
> >
>
> Separating the external/internal data structures makes sense. Another
> idea here would be to simply walk the static data structures at register
> time and then add them onto the dynamic lists. Then, all subsequent
> access can be done using the simple list walks. That would remove the
> complex iterators here. The external/internal division could still be
> done later but maybe doesn't couple as much to this patchset...
Sounds good.
> > 2) There seems to be a general consensus that the cumulative "replace"
> > model is the best one. In light of that, I wonder if we can simplify
> > our code a bit. Specifically, can we get rid of the func stack?
> >
> > If the user always uses replace, then the func stack will never have
> > more than one func. And we can reject a patch if the user doesn't
> > use replace when they're trying to patch a function which has already
> > been patched.
> >
> > Then the func stack doesn't have to be a stack, it can just be a
> > single func.
> >
> > That would allow us to simplify the code in several places for the
> > common case, yet still allow those who want to apply non-cumulative
> > patches to do so most of the time.
> >
> > It's not a *huge* simplification, but we've already made livepatch so
> > flexible that it's too complex to fit everything in your head at the
> > same time, and any simplification we can get away with is well worth
> > it IMO. And once we have replace, I wonder if anybody would really
> > miss the func stack.
> >
>
> I think that means instead of having a list of functions or the func
> stack, you have 2 pointers - one to the active patch and one to the
> previous patch. Maybe it would make sense to do in steps? IE have this
> patchset reject patches that patch a patch to existing function, leaving
> the func stack. And if that doesn't break any use-cases, switch to a
> model where there is just an active and previous patch?
Hm. Maybe I didn't think it through. I guess the func stack could have
at most *two* funcs -- not one. Let's just forget this idea for now...
--
Josh
next prev parent reply other threads:[~2017-10-11 2:52 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-28 3:41 [PATCH v3 0/2] livepatch: introduce atomic replace Jason Baron
2017-09-28 3:41 ` [PATCH v3 1/2] livepatch: Add dynamic klp_object and klp_func iterators Jason Baron
2017-10-06 21:22 ` Josh Poimboeuf
2017-10-10 15:15 ` Jason Baron
2017-10-11 2:51 ` Josh Poimboeuf [this message]
2017-10-16 14:47 ` Miroslav Benes
2017-09-28 3:41 ` [PATCH v3 2/2] livepatch: add atomic replace Jason Baron
2017-10-06 22:32 ` Josh Poimboeuf
2017-10-10 17:27 ` Jason Baron
2017-10-17 9:02 ` Miroslav Benes
2017-10-17 13:50 ` Miroslav Benes
2017-10-18 3:33 ` Jason Baron
2017-10-18 9:10 ` Miroslav Benes
2017-10-18 11:05 ` Josh Poimboeuf
2017-10-18 11:29 ` Miroslav Benes
2017-10-18 11:25 ` Petr Mladek
2017-10-19 21:44 ` Jason Baron
2017-10-20 7:44 ` Petr Mladek
2017-10-20 8:59 ` Miroslav Benes
2017-10-18 13:36 ` Jiri Kosina
2017-10-18 16:14 ` Josh Poimboeuf
2017-10-19 8:30 ` Miroslav Benes
2017-10-19 10:57 ` Josh Poimboeuf
2017-10-19 21:52 ` Jason Baron
2017-10-20 9:03 ` Miroslav Benes
2017-10-17 14:27 ` Petr Mladek
2017-10-10 17:19 ` [PATCH v3.1 2/3] livepatch: shuffle core.c function order Jason Baron
2017-10-10 17:19 ` [PATCH v3.1 3/3] livepatch: add atomic replace Jason Baron
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=20171011025152.t42dztemjjzba7ua@treble \
--to=jpoimboe@redhat.com \
--cc=jbaron@akamai.com \
--cc=jeyu@kernel.org \
--cc=jikos@kernel.org \
--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®