From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Joe Lawrence <joe.lawrence@redhat.com>
Cc: Miroslav Benes <mbenes@suse.cz>,
live-patching@vger.kernel.org, linux-kernel@vger.kernel.org,
Jessica Yu <jeyu@redhat.com>, Jiri Kosina <jikos@kernel.org>,
Petr Mladek <pmladek@suse.com>
Subject: Re: [PATCH v2 1/2] livepatch: introduce shadow variable API
Date: Thu, 20 Jul 2017 15:23:09 -0500 [thread overview]
Message-ID: <20170720202309.rzwfzazpzyb4doco@treble> (raw)
In-Reply-To: <164836e1-2d33-ec32-46ac-d6360f671b17@redhat.com>
On Thu, Jul 20, 2017 at 11:48:41AM -0400, Joe Lawrence wrote:
> On a related note, if we keep the allocations and memcpy, how about I
> shift around the attach/get calls like so:
>
> __klp_shadow_attach
> set shadow variable member values
> memcpy
> add to hash
>
> klp_shadow_attach
> alloc new shadow var
> lock
> call __klp_shadow_attach with new alloc
> unlock
>
> klp_shadow_get_or_attach
> be optimistic, call klp_shadow_get (if found, return it)
> be pessimistic, alloc new shadow var
> lock
> call klp_shadow_get again
> if unlikely found
> kfree unneeded alloc
> else
> call __klp_shadow_attach with new alloc
> unlock
> return whichever shadow var we used
>
> This way both calls can accept gfp_flags that may sleep, with the only
> downside that klp_shadow_get_or_attach may allocate an unnecessary
> shadow variable in the unlikely case that it's found on the second
> klp_shadow_get attempt (under the lock). No more clunky "bool lock"
> flag either. :)
Sounds good to me!
--
Josh
next prev parent reply other threads:[~2017-07-20 20:23 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-28 15:37 [PATCH v2 0/2] livepatch: add " Joe Lawrence
2017-06-28 15:37 ` [PATCH v2 1/2] livepatch: introduce " Joe Lawrence
2017-06-30 13:49 ` kbuild test robot
2017-07-07 18:05 ` Joe Lawrence
2017-07-14 0:41 ` Josh Poimboeuf
2017-07-17 15:35 ` Miroslav Benes
2017-07-18 13:00 ` Petr Mladek
2017-07-18 19:36 ` Joe Lawrence
2017-07-19 15:19 ` Petr Mladek
2017-07-19 18:50 ` Miroslav Benes
2017-07-17 15:29 ` Miroslav Benes
2017-07-18 20:21 ` Joe Lawrence
2017-07-19 2:28 ` Josh Poimboeuf
2017-07-19 19:01 ` Miroslav Benes
2017-07-20 14:45 ` Miroslav Benes
2017-07-20 15:48 ` Joe Lawrence
2017-07-20 20:23 ` Josh Poimboeuf [this message]
2017-07-21 8:42 ` Petr Mladek
2017-07-21 8:59 ` Miroslav Benes
2017-07-18 12:45 ` Petr Mladek
2017-07-20 20:30 ` Joe Lawrence
2017-07-21 9:12 ` Miroslav Benes
2017-07-21 9:27 ` Petr Mladek
2017-07-21 9:13 ` Petr Mladek
2017-07-21 13:55 ` Joe Lawrence
2017-07-24 15:04 ` Josh Poimboeuf
2017-06-28 15:37 ` [PATCH v2 2/2] livepatch: add shadow variable sample programs Joe Lawrence
2017-07-18 14:47 ` Petr Mladek
2017-07-18 19:15 ` Joe Lawrence
2017-07-19 14:44 ` Petr Mladek
2017-07-19 15:06 ` 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=20170720202309.rzwfzazpzyb4doco@treble \
--to=jpoimboe@redhat.com \
--cc=jeyu@redhat.com \
--cc=jikos@kernel.org \
--cc=joe.lawrence@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®