[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <00a9467a-3e48-9c68-1ac2-7ec2c7380d97@gmail.com>
Date: Tue, 9 Nov 2021 20:51:54 +0200
From: Oleksandr <olekstysh@...il.com>
To: Boris Ostrovsky <boris.ostrovsky@...cle.com>
Cc: xen-devel@...ts.xenproject.org, linux-kernel@...r.kernel.org,
Oleksandr Tyshchenko <oleksandr_tyshchenko@...m.com>,
Juergen Gross <jgross@...e.com>,
Stefano Stabellini <sstabellini@...nel.org>,
Julien Grall <julien@....org>
Subject: Re: [PATCH V2 3/4] xen/unpopulated-alloc: Add mechanism to use Xen
resource
On 28.10.21 22:08, Boris Ostrovsky wrote:
Hi Boris
I am sorry for the late response.
>
> On 10/26/21 12:05 PM, Oleksandr Tyshchenko wrote:
>> +static void unpopulated_init(void)
>> +{
>> + static bool inited = false;
>> + int ret;
>> +
>> + if (inited)
>> + return;
>> +
>> + /*
>> + * Try to initialize Xen resource the first and fall back to
>> default
>> + * resource if arch doesn't offer one.
>> + */
>> + ret = arch_xen_unpopulated_init(&xen_resource);
>> + if (!ret)
>> + target_resource = &xen_resource;
>> + else if (ret == -ENOSYS)
>> + target_resource = &iomem_resource;
>> + else
>> + pr_err("Cannot initialize Xen resource\n");
>
>
> I'd pass target_resource as a parameter to arch_xen_unpopulated_init()
> instead. Default routine will assign it iomem_resource and you won't
> have to deal with -ENOSYS.
That would be much better, thank you. Will do.
>
>
>
> Also, what happens in case of error? Is it fatal? I don't think your
> changes in fill_list() will work.
The error is fatal as we don't have a suitable resource to allocate a
region from, and yes, the fill_list() must not be called.
>
>
>
>> +
>> + inited = true;
>
>
> I agree with Stefano in that it would be better to call this from an
> init function, and you won't have t worry about multiple calls here.
Yes, that's good point, thank you. Will do.
>
>
>
> -boris
--
Regards,
Oleksandr Tyshchenko
Powered by blists - more mailing lists