[PATCH RFC 2/2] xen/kexec: Reserve KEXEC_TYPE_LIVEUPDATE and KEXEC_RANGE_MA_LIVEUPDATE

Julien Grall posted 2 patches 3 years, 6 months ago
[PATCH RFC 2/2] xen/kexec: Reserve KEXEC_TYPE_LIVEUPDATE and KEXEC_RANGE_MA_LIVEUPDATE
Posted by Julien Grall 3 years, 6 months ago
From: Julien Grall <jgrall@amazon.com>

Unfortunately, the code to support Live Update has already been merged in
Kexec and shipped since 2.0.21. Reserve the IDs used by Kexec before they
end up to be re-used for a different purpose.

This patch reserves two IDs:
    * KEXEC_TYPE_LIVEUPDATE: New operation to request Live Update
    * KEXEC_MA_RANGE_LIVEUPDATE: New range to query the Live Update
      area below Xen

Signed-off-by: Julien Grall <jgrall@amazon.com>
---
 xen/include/public/kexec.h | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/xen/include/public/kexec.h b/xen/include/public/kexec.h
index 3f2a118381ba..650d2feb036f 100644
--- a/xen/include/public/kexec.h
+++ b/xen/include/public/kexec.h
@@ -71,17 +71,22 @@
  */
 
 /*
- * Kexec supports two types of operation:
+ * Kexec supports three types of operation:
  * - kexec into a regular kernel, very similar to a standard reboot
  *   - KEXEC_TYPE_DEFAULT is used to specify this type
  * - kexec into a special "crash kernel", aka kexec-on-panic
  *   - KEXEC_TYPE_CRASH is used to specify this type
  *   - parts of our system may be broken at kexec-on-panic time
  *     - the code should be kept as simple and self-contained as possible
+ * - Live update into a new Xen, preserving all running domains
+ *   - KEXEC_TYPE_LIVE_UPDATE is used to specify this type
+ *   - Xen performs non-cooperative live migration and stores live
+ *     update state in memory, passing it to the new Xen.
  */
 
-#define KEXEC_TYPE_DEFAULT 0
-#define KEXEC_TYPE_CRASH   1
+#define KEXEC_TYPE_DEFAULT      0
+#define KEXEC_TYPE_CRASH        1
+#define KEXEC_TYPE_LIVEUPDATE   2
 
 
 /* The kexec implementation for Xen allows the user to load two
@@ -150,6 +155,8 @@ typedef struct xen_kexec_load_v1 {
 #define KEXEC_RANGE_MA_EFI_MEMMAP 5 /* machine address and size of
                                      * of the EFI Memory Map */
 #define KEXEC_RANGE_MA_VMCOREINFO 6 /* machine address and size of vmcoreinfo */
+/* machine address and size of the Live Update area below Xen */
+#define KEXEC_RANGE_MA_LIVEUPDATE 7
 
 /*
  * Find the address and size of certain memory areas
-- 
2.17.1


Re: [PATCH RFC 2/2] xen/kexec: Reserve KEXEC_TYPE_LIVEUPDATE and KEXEC_RANGE_MA_LIVEUPDATE
Posted by Hongyan Xia 3 years, 6 months ago
On Thu, 2021-05-06 at 11:42 +0100, Julien Grall wrote:
> From: Julien Grall <jgrall@amazon.com>
> 
> Unfortunately, the code to support Live Update has already been
> merged in
> Kexec and shipped since 2.0.21. Reserve the IDs used by Kexec before
> they
> end up to be re-used for a different purpose.
> 
> This patch reserves two IDs:
>     * KEXEC_TYPE_LIVEUPDATE: New operation to request Live Update
>     * KEXEC_MA_RANGE_LIVEUPDATE: New range to query the Live Update
>       area below Xen
> 
> Signed-off-by: Julien Grall <jgrall@amazon.com>

Reviewed-by: Hongyan Xia <hongyxia@amazon.com>

> ---
>  xen/include/public/kexec.h | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/xen/include/public/kexec.h b/xen/include/public/kexec.h
> index 3f2a118381ba..650d2feb036f 100644
> --- a/xen/include/public/kexec.h
> +++ b/xen/include/public/kexec.h
> @@ -71,17 +71,22 @@
>   */
>  
>  /*
> - * Kexec supports two types of operation:
> + * Kexec supports three types of operation:
>   * - kexec into a regular kernel, very similar to a standard reboot
>   *   - KEXEC_TYPE_DEFAULT is used to specify this type
>   * - kexec into a special "crash kernel", aka kexec-on-panic
>   *   - KEXEC_TYPE_CRASH is used to specify this type
>   *   - parts of our system may be broken at kexec-on-panic time
>   *     - the code should be kept as simple and self-contained as
> possible
> + * - Live update into a new Xen, preserving all running domains
> + *   - KEXEC_TYPE_LIVE_UPDATE is used to specify this type
> + *   - Xen performs non-cooperative live migration and stores live
> + *     update state in memory, passing it to the new Xen.
>   */
>  
> -#define KEXEC_TYPE_DEFAULT 0
> -#define KEXEC_TYPE_CRASH   1
> +#define KEXEC_TYPE_DEFAULT      0
> +#define KEXEC_TYPE_CRASH        1
> +#define KEXEC_TYPE_LIVEUPDATE   2
>  
>  
>  /* The kexec implementation for Xen allows the user to load two
> @@ -150,6 +155,8 @@ typedef struct xen_kexec_load_v1 {
>  #define KEXEC_RANGE_MA_EFI_MEMMAP 5 /* machine address and size of
>                                       * of the EFI Memory Map */
>  #define KEXEC_RANGE_MA_VMCOREINFO 6 /* machine address and size of
> vmcoreinfo */
> +/* machine address and size of the Live Update area below Xen */
> +#define KEXEC_RANGE_MA_LIVEUPDATE 7

Very nit: I tend to say "right below" Xen, since below sounds like it
could be anywhere. In the design doc we also said "just below".

Hongyan


Re: [PATCH RFC 2/2] xen/kexec: Reserve KEXEC_TYPE_LIVEUPDATE and KEXEC_RANGE_MA_LIVEUPDATE
Posted by Jan Beulich 3 years, 6 months ago
On 07.05.2021 10:24, Hongyan Xia wrote:
> On Thu, 2021-05-06 at 11:42 +0100, Julien Grall wrote:
>> @@ -150,6 +155,8 @@ typedef struct xen_kexec_load_v1 {
>>  #define KEXEC_RANGE_MA_EFI_MEMMAP 5 /* machine address and size of
>>                                       * of the EFI Memory Map */
>>  #define KEXEC_RANGE_MA_VMCOREINFO 6 /* machine address and size of
>> vmcoreinfo */
>> +/* machine address and size of the Live Update area below Xen */
>> +#define KEXEC_RANGE_MA_LIVEUPDATE 7
> 
> Very nit: I tend to say "right below" Xen, since below sounds like it
> could be anywhere. In the design doc we also said "just below".

But is this a hard requirement, i.e. something that needs specifying
here?

Jan

Re: [PATCH RFC 2/2] xen/kexec: Reserve KEXEC_TYPE_LIVEUPDATE and KEXEC_RANGE_MA_LIVEUPDATE
Posted by Paul Durrant 3 years, 6 months ago
On 06/05/2021 11:42, Julien Grall wrote:
> From: Julien Grall <jgrall@amazon.com>
> 
> Unfortunately, the code to support Live Update has already been merged in
> Kexec and shipped since 2.0.21. Reserve the IDs used by Kexec before they
> end up to be re-used for a different purpose.
> 
> This patch reserves two IDs:
>      * KEXEC_TYPE_LIVEUPDATE: New operation to request Live Update
>      * KEXEC_MA_RANGE_LIVEUPDATE: New range to query the Live Update
>        area below Xen
> 
> Signed-off-by: Julien Grall <jgrall@amazon.com>

Reviewed-by: Paul Durrant <paul@xen.org>

> ---
>   xen/include/public/kexec.h | 13 ++++++++++---
>   1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/xen/include/public/kexec.h b/xen/include/public/kexec.h
> index 3f2a118381ba..650d2feb036f 100644
> --- a/xen/include/public/kexec.h
> +++ b/xen/include/public/kexec.h
> @@ -71,17 +71,22 @@
>    */
>   
>   /*
> - * Kexec supports two types of operation:
> + * Kexec supports three types of operation:
>    * - kexec into a regular kernel, very similar to a standard reboot
>    *   - KEXEC_TYPE_DEFAULT is used to specify this type
>    * - kexec into a special "crash kernel", aka kexec-on-panic
>    *   - KEXEC_TYPE_CRASH is used to specify this type
>    *   - parts of our system may be broken at kexec-on-panic time
>    *     - the code should be kept as simple and self-contained as possible
> + * - Live update into a new Xen, preserving all running domains
> + *   - KEXEC_TYPE_LIVE_UPDATE is used to specify this type
> + *   - Xen performs non-cooperative live migration and stores live
> + *     update state in memory, passing it to the new Xen.
>    */
>   
> -#define KEXEC_TYPE_DEFAULT 0
> -#define KEXEC_TYPE_CRASH   1
> +#define KEXEC_TYPE_DEFAULT      0
> +#define KEXEC_TYPE_CRASH        1
> +#define KEXEC_TYPE_LIVEUPDATE   2
>   
>   
>   /* The kexec implementation for Xen allows the user to load two
> @@ -150,6 +155,8 @@ typedef struct xen_kexec_load_v1 {
>   #define KEXEC_RANGE_MA_EFI_MEMMAP 5 /* machine address and size of
>                                        * of the EFI Memory Map */
>   #define KEXEC_RANGE_MA_VMCOREINFO 6 /* machine address and size of vmcoreinfo */
> +/* machine address and size of the Live Update area below Xen */
> +#define KEXEC_RANGE_MA_LIVEUPDATE 7
>   
>   /*
>    * Find the address and size of certain memory areas
>