[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a453916f-40f0-7a25-2d16-fe8df425d83f@oracle.com>
Date: Mon, 16 May 2022 14:57:56 -0400
From: Boris Ostrovsky <boris.ostrovsky@...cle.com>
To: Oleksandr <olekstysh@...il.com>
Cc: Juergen Gross <jgross@...e.com>, xen-devel@...ts.xenproject.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
Stefano Stabellini <sstabellini@...nel.org>,
Julien Grall <julien@....org>,
Oleksandr Tyshchenko <oleksandr_tyshchenko@...m.com>,
"Michael S. Tsirkin" <mst@...hat.com>,
Christoph Hellwig <hch@...radead.org>
Subject: Re: [PATCH V2 2/7] xen/grants: support allocating consecutive grants
On 5/16/22 2:30 PM, Oleksandr wrote:
>
> On 16.05.22 19:00, Boris Ostrovsky wrote:
>
>
>>
>>
>> With the error handling in gnttab_init() fixed
>
> yes, this is a diff that I am going to apply for the next version:
>
>
> [snip]
>
> @@ -1596,19 +1601,20 @@ static int gnttab_expand(unsigned int req_entries)
> int gnttab_init(void)
> {
> int i;
> - unsigned long max_nr_grant_frames;
> + unsigned long max_nr_grant_frames, max_nr_grefs;
> unsigned int max_nr_glist_frames, nr_glist_frames;
> int ret;
>
> gnttab_request_version();
> max_nr_grant_frames = gnttab_max_grant_frames();
> + max_nr_grefs = max_nr_grant_frames *
> + gnttab_interface->grefs_per_grant_frame;
> nr_grant_frames = 1;
>
> /* Determine the maximum number of frames required for the
> * grant reference free list on the current hypervisor.
> */
> - max_nr_glist_frames = (max_nr_grant_frames *
> - gnttab_interface->grefs_per_grant_frame / RPP);
> + max_nr_glist_frames = max_nr_grefs / RPP;
>
> gnttab_list = kmalloc_array(max_nr_glist_frames,
> sizeof(grant_ref_t *),
> @@ -1625,8 +1631,7 @@ int gnttab_init(void)
> }
> }
>
> - i = gnttab_interface->grefs_per_grant_frame * max_nr_grant_frames;
> - gnttab_free_bitmap = bitmap_zalloc(i, GFP_KERNEL);
> + gnttab_free_bitmap = bitmap_zalloc(max_nr_grefs, GFP_KERNEL);
> if (!gnttab_free_bitmap) {
> ret = -ENOMEM;
> goto ini_nomem;
>
Looks good, thanks.
-boris
Powered by blists - more mailing lists