[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH V2 2/7] xen/grants: support allocating consecutive grants


  • To: Oleksandr <olekstysh@xxxxxxxxx>
  • From: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
  • Date: Mon, 16 May 2022 14:57:56 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4olkkxipV5iBgWH0NsT2vT3vMCEIkKfDcstu9Ms0s38=; b=Qx/qfb5FvD5QZ5rENDsfGmylPwMIo4Se54qSHXZS9ZJrJtBc7HkkpoRN0muMwxMKiTw++hOZnlsgKOOV6lY+XOves7ID0wNUtCkh8tL87oZL8sg1vADLkST6yXpET4ZERLACFPUNhPsP71rVfV8v+cIHlGfR2OwZ5vDhacJrpGwpUAGB1eE/eyiyK8p0htjgkrgK7SzrTnlGBJbg7j6sqcRZku/jZHPipzCpwi4orLs1O+C8dEualHMu2b2whmPytP6nnGqmX5LSdwi/WKGI21KO05GL15oQ5y1Ak5bO1qZJL6TWQM93a71zq4Dx82mzDB9/j/aZygh+dY3ROPhofQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h9HGbFi1yJdlYpDw0w/tX3MCuN9Co/v2HQ5KeK11Gk5h1nEJK4qfrvgXWhZTO0CtRYN8QPnRmG5vKLLF9N/O0MAbe0FEWfPwLy1NyhD49euKPUNuSM9mS6dgpfhCz01xksSMg+gtpBEWIIuJtWyYBTRmn5jliszJvbu7n3EwpvTS9PRdvX0Bj6wF5l4xoZG92Ewch7pJXkd5/8e8lKBC55z7EOEAEzySdR4LadgMhrroSxZBpEtwLTdv74/PPSdCa4sFUtPTSFvKEFXS+y/l7lYB7LqnVSjucH3BG7KaOcwwPzfnqt+nlA8hoQCaRhxqWaiHkvVMOhLCro7HNU8aWA==
  • Cc: Juergen Gross <jgross@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>, "Michael S. Tsirkin" <mst@xxxxxxxxxx>, Christoph Hellwig <hch@xxxxxxxxxxxxx>
  • Delivery-date: Mon, 16 May 2022 18:58:26 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


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




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.