All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Oleksandr Tyshchenko <olekstysh@gmail.com>,
	xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org
Cc: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>,
	Juergen Gross <jgross@suse.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Julien Grall <julien@xen.org>
Subject: Re: [PATCH V2 3/4] xen/unpopulated-alloc: Add mechanism to use Xen resource
Date: Thu, 28 Oct 2021 15:08:51 -0400	[thread overview]
Message-ID: <0b1837f9-57ef-8deb-df78-cb7841d93d68@oracle.com> (raw)
In-Reply-To: <1635264312-3796-4-git-send-email-olekstysh@gmail.com>


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.


Also, what happens in case of error? Is it fatal? I don't think your changes in fill_list() will work.


> +
> +	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.


-boris

  parent reply	other threads:[~2021-10-28 19:09 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-26 16:05 [PATCH V2 0/4] xen: Add support of extended regions (safe ranges) on Arm Oleksandr Tyshchenko
2021-10-26 16:05 ` Oleksandr Tyshchenko
2021-10-26 16:05 ` [PATCH V2 1/4] xen/unpopulated-alloc: Drop check for virt_addr_valid() in fill_list() Oleksandr Tyshchenko
2021-10-28 18:57   ` Boris Ostrovsky
2021-10-26 16:05 ` [PATCH V2 2/4] arm/xen: Switch to use gnttab_setup_auto_xlat_frames() for DT Oleksandr Tyshchenko
2021-10-26 16:05   ` Oleksandr Tyshchenko
2021-10-28  1:28   ` Stefano Stabellini
2021-10-28  1:28     ` Stefano Stabellini
2021-11-10 22:14     ` Oleksandr
2021-11-10 22:14       ` Oleksandr
2021-11-19  0:32       ` Stefano Stabellini
2021-11-19  0:32         ` Stefano Stabellini
2021-11-19 18:25         ` Oleksandr
2021-11-19 18:25           ` Oleksandr
2021-10-26 16:05 ` [PATCH V2 3/4] xen/unpopulated-alloc: Add mechanism to use Xen resource Oleksandr Tyshchenko
2021-10-28 16:37   ` Stefano Stabellini
2021-11-09 18:34     ` Oleksandr
2021-11-19  0:59       ` Stefano Stabellini
2021-11-19 18:18         ` Oleksandr
2021-11-20  2:19           ` Stefano Stabellini
2021-11-23 16:46             ` Oleksandr
2021-11-23 21:25               ` Stefano Stabellini
2021-11-24  9:33                 ` Oleksandr
2021-11-24  5:16               ` Juergen Gross
2021-11-24  9:37                 ` Oleksandr
2021-10-28 19:08   ` Boris Ostrovsky [this message]
2021-11-09 18:51     ` Oleksandr
2021-10-26 16:05 ` [PATCH V2 4/4] arm/xen: Read extended regions from DT and init " Oleksandr Tyshchenko
2021-10-26 16:05   ` Oleksandr Tyshchenko
2021-10-28  1:40   ` Stefano Stabellini
2021-10-28  1:40     ` Stefano Stabellini
2021-11-10 20:21     ` Oleksandr
2021-11-10 20:21       ` Oleksandr
2021-11-19  1:19       ` Stefano Stabellini
2021-11-19  1:19         ` Stefano Stabellini
2021-11-19 20:23         ` Oleksandr
2021-11-19 20:23           ` Oleksandr
2021-11-20  2:36           ` Stefano Stabellini
2021-11-20  2:36             ` Stefano Stabellini
2021-11-20 13:38             ` Oleksandr
2021-11-20 13:38               ` Oleksandr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0b1837f9-57ef-8deb-df78-cb7841d93d68@oracle.com \
    --to=boris.ostrovsky@oracle.com \
    --cc=jgross@suse.com \
    --cc=julien@xen.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleksandr_tyshchenko@epam.com \
    --cc=olekstysh@gmail.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.