Hi Andrew,

On 10/04/2024 20:42, Andrew Cooper wrote:
> 
> 
> Given 3 statically initialised objects, its easy to link the list at build
> time.  There's no need to do it during runtime at boot (and with IRQs-off,
> even).
> 
> As a consequence, register_virtual_region() can now move inside ifdef
> CONFIG_LIVEPATCH like unregister_virtual_region().
> 
> Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com>
Reviewed-by: Michal Orzel <michal.or...@amd.com>

Maybe with ...
> ---
> CC: Jan Beulich <jbeul...@suse.com>
> CC: Roger Pau Monné <roger....@citrix.com>
> CC: Wei Liu <w...@xen.org>
> CC: Stefano Stabellini <sstabell...@kernel.org>
> CC: Julien Grall <jul...@xen.org>
> CC: Volodymyr Babchuk <volodymyr_babc...@epam.com>
> CC: Bertrand Marquis <bertrand.marq...@arm.com>
> CC: Michal Orzel <michal.or...@amd.com>
> CC: Oleksii Kurochko <oleksii.kuroc...@gmail.com>
> CC: Shawn Anastasio <sanasta...@raptorengineering.com>
> CC: Konrad Rzeszutek Wilk <konrad.w...@oracle.com>
> CC: Ross Lagerwall <ross.lagerw...@citrix.com>
> 
> v2:
>  * Collect the initialisers togoether too.
> ---
>  xen/common/virtual_region.c | 37 ++++++++++++++++++++++---------------
>  1 file changed, 22 insertions(+), 15 deletions(-)
> 
> diff --git a/xen/common/virtual_region.c b/xen/common/virtual_region.c
> index 7d8bdeb61282..db3e0dc9fe74 100644
> --- a/xen/common/virtual_region.c
> +++ b/xen/common/virtual_region.c
> @@ -15,8 +15,18 @@ extern const struct bug_frame
>      __start_bug_frames_2[], __stop_bug_frames_2[],
>      __start_bug_frames_3[], __stop_bug_frames_3[];
> 
> +/*
> + * For the built-in regions, the double linked list can be constructed at
> + * build time.  Forward-declare the elements and their initialisers.
> + */
> +static struct list_head virtual_region_list;
> +static struct virtual_region core, core_init;
... empty line here for better readability

> +#define LIST_ENTRY_HEAD() { .next = &core.list,           .prev = 
> &core_init.list }
> +#define LIST_ENTRY_CORE() { .next = &core_init.list,      .prev = 
> &virtual_region_list }
> +#define LIST_ENTRY_INIT() { .next = &virtual_region_list, .prev = &core.list 
> }

~Michal

Reply via email to