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

RE: [PATCH V4 10/10] xen/arm: introduce allocate_static_memory


  • To: Julien Grall <julien@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>
  • From: Penny Zheng <Penny.Zheng@xxxxxxx>
  • Date: Tue, 17 Aug 2021 02:36:08 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.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-SenderADCheck; bh=ao8tY2uYVPOyB3GRe+jgp5JI2yFOB+llMESktlBYimc=; b=fP54ShHFcMxn7/U6lnMuRr1FR0hCetAYZMxeqYQrwr9MEGGfvpcgZuts6+E5W/yYu1otpjbxssYDlyA0KZ0E26ghleK8ARrs8/INh662+zOpsh1nhp6RcbT780wKAgRaaAVw72MuoPKDmMWhEOjP3Wg7jzR9H1H8m/nMHvGBM+IMTyaYvoO/ApWSs6SP4tyNAaBV5N0DW168/xzmlPmnXUFDYkJMdKLjhKQpCRKtPdsDZfALLBT7OV/x7p9S1cg+bOwbfd1UwVbyz3DL99v5IcGTGyEEmkVhcTUIInj2132PihdS7hUJkPCqxgSujo3GgbrB3zSHYEf/YOivkqAE6A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kL3ZYxyq/S0tsI4NZ+kM6Ndc84R6gHHFPoJcZ3WtMbP0f2zWjSG0GpahD10KLwEdZl0fKPugiXNiSBi1pQK5ksPNnHDMNA+ctQwJOpc1g0cVocFwHntAi+54oDkMe5kkW78mrRlhotJs6uds64o9/d5J6Jhx7ZfDgu7a3cSGkyiklkq9ce8diyF68cWqKLRUlhR+mxAvfqC8zYqQA7KTH5ilzf5NdMoqs+KiIRxG19gc8ubZwTwoWK2N7GeXJq5t96bDilwDaXoAekQfk1grx7R3KN7xPtL8CvHBXgYhXu5atds0dNbucCG1DG04xhGIS/dvuhK4l8LtQjzHqGKa0g==
  • Authentication-results-original: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=arm.com;
  • Cc: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Wei Chen <Wei.Chen@xxxxxxx>, nd <nd@xxxxxxx>
  • Delivery-date: Tue, 17 Aug 2021 02:36:24 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHXg5tmckYE8huhnkmylKsegZp2dKtxiU+AgARGWQCAALjdgIAAkPyA
  • Thread-topic: [PATCH V4 10/10] xen/arm: introduce allocate_static_memory


> -----Original Message-----
> From: Julien Grall <julien@xxxxxxx>
> Sent: Tuesday, August 17, 2021 1:55 AM
> To: Penny Zheng <Penny.Zheng@xxxxxxx>; xen-devel@xxxxxxxxxxxxxxxxxxxx;
> sstabellini@xxxxxxxxxx
> Cc: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>; Wei Chen
> <Wei.Chen@xxxxxxx>; nd <nd@xxxxxxx>
> Subject: Re: [PATCH V4 10/10] xen/arm: introduce allocate_static_memory
> 
> 
> 
> On 16/08/2021 08:51, Penny Zheng wrote:
> >>> +               d, bank, pbase, pbase + psize);
> >>> +
> >>> +        /*
> >>> +         * It shall be mapped to the fixed guest RAM address rambase[i],
> >>> +         * And until it exhausts the ramsize[i], it will seek to the next
> >>> +         * rambase[i+1].
> >>> +         */
> >>> +        while ( 1 )
> >>> +        {
> >>> +            /*
> >>> +             * The current physical bank is fully mapped.
> >>> +             * Handle the next physical bank.
> >>> +             */
> >>> +            if ( gsize >= psize )
> >>> +            {
> >>> +                if ( !append_static_memory_to_bank(d, &kinfo-
> >mem.bank[gbank],
> >>> +                                                   smfn, psize) )
> >>> +                    goto fail;
> >>> +
> >>> +                gsize = gsize - psize;
> >>> +                bank++;
> >>> +                break;
> >>> +            }
> >>> +            /*
> >>> +             * Current guest bank memory is not enough to map.
> >>> +             * Check if we have another guest bank available.
> >>> +             * gbank refers guest memory bank index.
> >>> +             */
> >>> +            else if ( (gbank + 2) > GUEST_RAM_BANKS ) {
> >>
> >> I don't understand the +2. Can you clarify it?
> >>
> >
> > gbank refers to the index of the guest bank, and here since current guest
> bank(gbank)
> >   memory is not enough to map, users seeks to the next one(gbank + 1),
> >
> > gbank + 2 is the number of requested guest memory banks right now, and
> > shall not be larger than GUEST_RAM_BANKS.
> 
> Thanks for the clarification. When I read "2" I tend to think we are checking
> the bank after the next. How about writing:
> 
> (gbank + 1) >= GUEST_RAM_BANKS
> 
> or
> 
> gbank >= (GUEST_RAM_BANKS - 1)
> 
> This as the same end results, but we check the index rather than the number of
> banks.
> 
> Anyway, I can settle with 2 if you really prefer it.
> 

Nah, I'll take your suggestion. Yours is more generic.
 
> Cheers,
> 
> --
> Julien Grall

 


Rackspace

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