On 22.12.2025 17:40, Oleksii Kurochko wrote:
> --- a/xen/common/domain.c
> +++ b/xen/common/domain.c
> @@ -690,6 +690,27 @@ static int domain_teardown(struct domain *d)
>      return 0;
>  }
>  
> +static struct domain *alloc_domain_struct(void)
> +{
> +#ifndef arch_domain_struct_memflags
> +# define arch_domain_struct_memflags() 0
> +#endif
> +
> +    struct domain *d = alloc_xenheap_pages(0, arch_domain_struct_memflags());
> +
> +    BUILD_BUG_ON(sizeof(*d) > PAGE_SIZE);
> +
> +    if ( d )
> +        clear_page(d);
> +
> +    return d;
> +}
> +
> +static void free_domain_struct(struct domain *d)
> +{
> +    free_xenheap_page(d);
> +}
> +
>  /*
>   * Destroy a domain once all references to it have been dropped.  Used either
>   * from the RCU path, or from the domain_create() error path before the 
> domain

I think this is unfortunate placement: You put the two functions between two
other related ones, which imo would better stay together. I would suggest to
put them (and the ones moved by patch 3) ahead of vcpu_teardown(), or ahead
of vmtrace_free_buffer().

Jan

Reply via email to