Re: [Xen-devel] [PATCH lp-metadata 3/3] livepatch: Add metadata runtime retrieval mechanism

2019-08-16 Thread Wei Liu
On Fri, Aug 16, 2019 at 12:54:12PM +, Wieczorkiewicz, Pawel wrote:
> 
> > On 16. Aug 2019, at 14:44, Wei Liu  wrote:
> > 
> > On Thu, Aug 15, 2019 at 11:27:50AM +, Pawel Wieczorkiewicz wrote:
> >> Extend the livepatch list operation to fetch also payloads' metadata.
> >> This is achieved by extending the sysctl list interface with 2 extra
> >> guest handles:
> >> * metadata - an array of arbitrary size strings
> >> * metadata_len - an array of metadata strings' lengths (uin32_t each)
> 
> …snip...
> 
> >> Signed-off-by: Pawel Wieczorkiewicz 
> >> Reviewed-by: Andra-Irina Paraschiv 
> >> Reviewed-by: Martin Pohlack 
> >> Reviewed-by: Norbert Manthey 
> >> ---
> >> tools/libxc/include/xenctrl.h | 22 +++
> >> tools/libxc/xc_misc.c | 66 
> >> +++
> >> tools/misc/xen-livepatch.c| 43 ++--
> >> xen/common/livepatch.c| 22 +++
> >> xen/include/public/sysctl.h   | 19 +
> > 
> > Mostly look good. One comment below...
> > 
> >> diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h
> >> index b86804b7a6..e4c8f4fe63 100644
> >> --- a/xen/include/public/sysctl.h
> >> +++ b/xen/include/public/sysctl.h
> > 
> > If it hasn't been done for this release already, changing sysctl interface 
> > requires
> > bumping the version number in this header.
> > 
> 
> ACK. Will do (also for earlier patches…).
> 

We only need to do it once per release. :-)

Wei.

___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH lp-metadata 3/3] livepatch: Add metadata runtime retrieval mechanism

2019-08-16 Thread Wieczorkiewicz, Pawel

> On 16. Aug 2019, at 14:44, Wei Liu  wrote:
> 
> On Thu, Aug 15, 2019 at 11:27:50AM +, Pawel Wieczorkiewicz wrote:
>> Extend the livepatch list operation to fetch also payloads' metadata.
>> This is achieved by extending the sysctl list interface with 2 extra
>> guest handles:
>> * metadata - an array of arbitrary size strings
>> * metadata_len - an array of metadata strings' lengths (uin32_t each)

…snip...

>> Signed-off-by: Pawel Wieczorkiewicz 
>> Reviewed-by: Andra-Irina Paraschiv 
>> Reviewed-by: Martin Pohlack 
>> Reviewed-by: Norbert Manthey 
>> ---
>> tools/libxc/include/xenctrl.h | 22 +++
>> tools/libxc/xc_misc.c | 66 
>> +++
>> tools/misc/xen-livepatch.c| 43 ++--
>> xen/common/livepatch.c| 22 +++
>> xen/include/public/sysctl.h   | 19 +
> 
> Mostly look good. One comment below...
> 
>> diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h
>> index b86804b7a6..e4c8f4fe63 100644
>> --- a/xen/include/public/sysctl.h
>> +++ b/xen/include/public/sysctl.h
> 
> If it hasn't been done for this release already, changing sysctl interface 
> requires
> bumping the version number in this header.
> 

ACK. Will do (also for earlier patches…).

> Wei.

Best Regards,
Pawel Wieczorkiewicz


signature.asc
Description: Message signed with OpenPGP



Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Ralf Herbrich
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879


___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] [PATCH lp-metadata 3/3] livepatch: Add metadata runtime retrieval mechanism

2019-08-16 Thread Wei Liu
On Thu, Aug 15, 2019 at 11:27:50AM +, Pawel Wieczorkiewicz wrote:
> Extend the livepatch list operation to fetch also payloads' metadata.
> This is achieved by extending the sysctl list interface with 2 extra
> guest handles:
> * metadata - an array of arbitrary size strings
> * metadata_len - an array of metadata strings' lengths (uin32_t each)
> 
> Payloads' metadata is a string of arbitrary size and does not have an
> upper bound limit. It may also vary in size between payloads.
> 
> In order to let the userland allocate enough space for the incoming
> data add a metadata total size field to the list sysctl operation and
> fill it with total size of all payloads' metadata.
> 
> Extend the libxc to handle the metadata back-to-back data transfers
> as well as metadata length array data transfers.
> 
> The xen-livepatch userland tool is extended to always display the
> metadata for each received module. The metadata is received with the
> following format: key=value\0key=value\0...key=value\0. The format is
> modified to the following one: key=value;key=value;...key=value.
> The new format allows to easily parse the metadata for a given module
> by a machine.
> 
> Signed-off-by: Pawel Wieczorkiewicz 
> Reviewed-by: Andra-Irina Paraschiv 
> Reviewed-by: Martin Pohlack 
> Reviewed-by: Norbert Manthey 
> ---
>  tools/libxc/include/xenctrl.h | 22 +++
>  tools/libxc/xc_misc.c | 66 
> +++
>  tools/misc/xen-livepatch.c| 43 ++--
>  xen/common/livepatch.c| 22 +++
>  xen/include/public/sysctl.h   | 19 +

Mostly look good. One comment below...

> diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h
> index b86804b7a6..e4c8f4fe63 100644
> --- a/xen/include/public/sysctl.h
> +++ b/xen/include/public/sysctl.h

If it hasn't been done for this release already, changing sysctl interface 
requires
bumping the version number in this header.

Wei.

___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

[Xen-devel] [PATCH lp-metadata 3/3] livepatch: Add metadata runtime retrieval mechanism

2019-08-15 Thread Pawel Wieczorkiewicz
Extend the livepatch list operation to fetch also payloads' metadata.
This is achieved by extending the sysctl list interface with 2 extra
guest handles:
* metadata - an array of arbitrary size strings
* metadata_len - an array of metadata strings' lengths (uin32_t each)

Payloads' metadata is a string of arbitrary size and does not have an
upper bound limit. It may also vary in size between payloads.

In order to let the userland allocate enough space for the incoming
data add a metadata total size field to the list sysctl operation and
fill it with total size of all payloads' metadata.

Extend the libxc to handle the metadata back-to-back data transfers
as well as metadata length array data transfers.

The xen-livepatch userland tool is extended to always display the
metadata for each received module. The metadata is received with the
following format: key=value\0key=value\0...key=value\0. The format is
modified to the following one: key=value;key=value;...key=value.
The new format allows to easily parse the metadata for a given module
by a machine.

Signed-off-by: Pawel Wieczorkiewicz 
Reviewed-by: Andra-Irina Paraschiv 
Reviewed-by: Martin Pohlack 
Reviewed-by: Norbert Manthey 
---
 tools/libxc/include/xenctrl.h | 22 +++
 tools/libxc/xc_misc.c | 66 +++
 tools/misc/xen-livepatch.c| 43 ++--
 xen/common/livepatch.c| 22 +++
 xen/include/public/sysctl.h   | 19 +
 5 files changed, 134 insertions(+), 38 deletions(-)

diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index e0ebb586b6..7a3762f44e 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -2561,7 +2561,7 @@ int xc_livepatch_get(xc_interface *xch,
 
 /*
  * Get a number of available payloads and get actual total size of
- * the payloads' name array.
+ * the payloads' name and metadata arrays.
  *
  * This functions is typically executed first before the xc_livepatch_list()
  * to obtain the sizes and correctly allocate all necessary data resources.
@@ -2572,13 +2572,16 @@ int xc_livepatch_get(xc_interface *xch,
  * will contain the hypercall error code value.
  */
 int xc_livepatch_list_get_sizes(xc_interface *xch, unsigned int *nr,
-uint64_t *name_total_size);
+uint64_t *name_total_size,
+uint64_t *metadata_total_size);
 
 /*
  * The heart of this function is to get an array of the following objects:
  *   - xen_livepatch_status_t: states and return codes of payloads
  *   - name: names of payloads
  *   - len: lengths of corresponding payloads' names
+ *   - metadata: payloads' metadata
+ *   - metadata_len: lengths of corresponding payloads' metadata
  *
  * However it is complex because it has to deal with the hypervisor
  * returning some of the requested data or data being stale
@@ -2591,12 +2594,13 @@ int xc_livepatch_list_get_sizes(xc_interface *xch, 
unsigned int *nr,
  *
  * It is expected that the caller of this function will first issue the
  * xc_livepatch_list_get_sizes() in order to obtain total sizes of names
- * as well as the current number of payload entries.
- * The total sizes are required and supplied via the 'name_total_size'
- * parameter.
+ * and all metadata as well as the current number of payload entries.
+ * The total sizes are required and supplied via the 'name_total_size' and
+ * 'metadata_total_size' parameters.
  *
  * The 'max' is to be provided by the caller with the maximum number of
- * entries that 'info', 'name', 'len' arrays can be filled up with.
+ * entries that 'info', 'name', 'len', 'metadata' and 'metadata_len' arrays
+ * can be filled up with.
  *
  * Each entry in the 'info' array is expected to be of xen_livepatch_status_t
  * structure size.
@@ -2605,6 +2609,10 @@ int xc_livepatch_list_get_sizes(xc_interface *xch, 
unsigned int *nr,
  *
  * Each entry in the 'len' array is expected to be of uint32_t size.
  *
+ * Each entry in the 'metadata' array may have an arbitrary size.
+ *
+ * Each entry in the 'metadata_len' array is expected to be of uint32_t size.
+ *
  * The return value is zero if the hypercall completed successfully.
  * Note that the return value is _not_ the amount of entries filled
  * out - that is saved in 'done'.
@@ -2619,6 +2627,8 @@ int xc_livepatch_list(xc_interface *xch, const unsigned 
int max,
   struct xen_livepatch_status *info,
   char *name, uint32_t *len,
   const uint64_t name_total_size,
+  char *metadata, uint32_t *metadata_len,
+  const uint64_t metadata_total_size,
   unsigned int *done, unsigned int *left);
 
 /*
diff --git a/tools/libxc/xc_misc.c b/tools/libxc/xc_misc.c
index d787f3f29f..618113011d 100644
--- a/tools/libxc/xc_misc.c
+++ b/tools/libxc/xc_misc.c
@@ -663,7 +663,7 @@