From: Petr Mladek <pmladek@suse.com>
To: Joe Lawrence <joe.lawrence@redhat.com>
Cc: live-patching@vger.kernel.org, linux-kernel@vger.kernel.org,
Josh Poimboeuf <jpoimboe@redhat.com>,
Jessica Yu <jeyu@redhat.com>, Jiri Kosina <jikos@kernel.org>,
Miroslav Benes <mbenes@suse.cz>
Subject: Re: [PATCH 2/3] livepatch: add shadow variable documentation
Date: Wed, 14 Jun 2017 15:10:40 +0200 [thread overview]
Message-ID: <20170614131040.GD15013@pathway.suse.cz> (raw)
In-Reply-To: <1496341526-19061-3-git-send-email-joe.lawrence@redhat.com>
On Thu 2017-06-01 14:25:25, Joe Lawrence wrote:
> Document the new shadow variable API, including a few common use cases.
>
> Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
> ---
> Documentation/livepatch/shadow-vars.txt | 175 ++++++++++++++++++++++++++++++++
> 1 file changed, 175 insertions(+)
> create mode 100644 Documentation/livepatch/shadow-vars.txt
>
> diff --git a/Documentation/livepatch/shadow-vars.txt b/Documentation/livepatch/shadow-vars.txt
> new file mode 100644
> index 000000000000..7df99ade4615
> --- /dev/null
> +++ b/Documentation/livepatch/shadow-vars.txt
> +API
> +---
> +
> +void *klp_shadow_attach(void *obj, char *var, gfp_t gfp, void *data);
> +
> + Description: Allocate and attach a new shadow variable.
> + Parameters:
> +
> + void *obj - pointer to original data
> + char *var - string key describing new data
> + gfp_t gfp - GFP flags used to allocate shadow variable metadata
> + void *data - pointer to new data
> +
> + Returns: the shadow variable data element, otherwise NULL on failure.
> +
> +
> +void klp_shadow_detach(void *obj, char *var);
> +
> + Description: Detach and free a shadow variable.
> + Parameters:
> +
> + void *obj - pointer to original data
> + char *var - string key describing new data
> +
> +
> +void *klp_shadow_get(void *obj, char *var);
> +
> + Description: Retrieve a shadow variable data pointer.
> + Parameters:
> +
> + void *obj - pointer to original data
> + char *var - string key describing new data
> +
> + Returns: the shadow variable data element, otherwise NULL if the
> + <obj, var> combination is not found.
I would convert all the above into comments of the function definitions
in shadow.c. It is really helpful when you try to undestand the code
using cscope. Also it is much easier to keep the documentation
and code in sync when they are in the same file.
> +
> +Concurrency notes:
> +
> +* The shadow variable API simply provides a relationship between an
> +<obj, var> pair and a pointer value. It is the responsibility of the
> +caller to provide any mutual exclusion required of the shadow data.
> +
> +* Once klp_shadow_attach() adds a shadow variable to the
> +klp_shadow_hash, it is considered live and klp_shadow_get() may
> +return the shadow variable's data pointer. Therefore, initialization of
> +shadow data should be completed before attaching the shadow variable.
> +
> +* If the API is called under a special context (like spinlocks),
> +set the GFP flags passed to klp_shadow_attach() accordingly.
> +
> +* The klp_shadow_hash is an RCU-enabled hashtable and should be safe
> +against concurrent klp_shadow_detach() and klp_shadow_get() operations.
I would prefer to have this in the source file as well.
Otherwise, I like the descriptions and the examples.
Best Regards,
Petr
next prev parent reply other threads:[~2017-06-14 13:10 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-01 18:25 [PATCH 0/3] livepatch: add shadow variable API Joe Lawrence
2017-06-01 18:25 ` [PATCH 1/3] livepatch: introduce " Joe Lawrence
2017-06-08 16:49 ` Josh Poimboeuf
2017-06-09 15:36 ` Joe Lawrence
2017-06-09 18:34 ` Josh Poimboeuf
2017-06-12 13:49 ` Joe Lawrence
2017-06-14 12:59 ` Petr Mladek
2017-06-14 13:17 ` Josh Poimboeuf
2017-06-14 14:26 ` Petr Mladek
2017-06-19 16:09 ` Miroslav Benes
2017-06-01 18:25 ` [PATCH 2/3] livepatch: add shadow variable documentation Joe Lawrence
2017-06-14 13:10 ` Petr Mladek [this message]
2017-06-01 18:25 ` [PATCH 3/3] livepatch: add shadow variable sample program Joe Lawrence
2017-06-09 18:38 ` Josh Poimboeuf
2017-06-09 19:05 ` Joe Lawrence
2017-06-13 11:00 ` Miroslav Benes
2017-06-13 17:32 ` Joe Lawrence
2017-06-14 7:45 ` Miroslav Benes
2017-06-14 14:21 ` Petr Mladek
2017-06-14 14:57 ` Josh Poimboeuf
2017-06-15 10:59 ` Petr Mladek
2017-06-15 13:49 ` Josh Poimboeuf
[not found] ` <20170615143800.d6f5p5bdm4ueecly@redhat.com>
2017-06-15 15:23 ` Josh Poimboeuf
2017-06-19 16:56 ` Miroslav Benes
2017-06-30 20:32 ` Josh Poimboeuf
2017-07-01 6:53 ` Miroslav Benes
2017-06-14 15:15 ` Joe Lawrence
2017-06-19 16:43 ` Miroslav Benes
2017-06-01 20:05 ` [PATCH 0/3] livepatch: add shadow variable API Jiri Kosina
2017-06-01 20:23 ` Joe Lawrence
2017-06-01 20:32 ` Jiri Kosina
2017-06-13 10:19 ` Miroslav Benes
2017-06-13 17:29 ` Joe Lawrence
2017-06-14 8:02 ` Miroslav Benes
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=20170614131040.GD15013@pathway.suse.cz \
--to=pmladek@suse.com \
--cc=jeyu@redhat.com \
--cc=jikos@kernel.org \
--cc=joe.lawrence@redhat.com \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=mbenes@suse.cz \
/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