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

RE: [PATCH v3 05/19] xen/arm: mm: Add support for the contiguous bit


  • To: Julien Grall <julien@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Hongda Deng <Hongda.Deng@xxxxxxx>
  • Date: Mon, 21 Mar 2022 05:46:27 +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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HSv8N45yjCaI/ZJNr3x2ORl1tzjC7C2Q9iCmCO1Bmto=; b=dfylF3dWl62w/fHT3PpAKrTAc9JkCAvD6onhul7M5hHro1PWytf0W5uRgxXVUxItab8o8LOltonv90204iFsMft8I9gA3bStuikTUr79zQGf9+9OYf58kwJhSyM+I9BL+9ppyHHq73OukCtoRO72541lnIeI51RJTH7E3BTLnQ9BjQdxu//MsK7kCPCcVyBdTLI93F401oN2You6ItUap9MzC4cOgcaWbAm68aXZuy+3RiCuAQoK7QqDSfiOl3ICDxV7QGAGIjXGGmgkvolMGf48KOwJxFpJMPJqyrrnbRGtpaaGE2lY5p0OIgZscGz32Z83h6vyUk/5PuPnh/Y9jg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FYcowtAbEsu5Rq3bnqkwDmp24iPt49s2S4+IJoZGNvG8/xHOQ65HNoQkYfrf4kEhUIXijYAmrtkgunk/g68ZJML4CFW3sff2d4yCp6/7se6sy5vrVwpB+Y/bI56v9DmpJQjuN8DN0ymu8Dhtk8lhw1rAYy83hbnT+nLy/ZHX05lBGPlgvzx5OJvkgCKe8W2lqnu7v5VQvQxwqiE13JK0hInoUBQ1yADsCXkqbFZzmJ9dQy6JK/akWsuLCltU/o2QtvfhaQe5Grdl0hD6eByDmDsfCkdiAAMKpuagQC8kskB9HtqFt/niQKy6tTH5Ie8JpVdC+saVQyKtrm61XCZHrQ==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Julien Grall <jgrall@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Mon, 21 Mar 2022 05:47:03 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHYJwz6gD61KYQGFkmKC0/u3eFrX6ymQHyAgCM9yoA=
  • Thread-topic: [PATCH v3 05/19] xen/arm: mm: Add support for the contiguous bit

Hi Julien,

> -----Original Message-----
> From: Xen-devel <xen-devel-bounces@xxxxxxxxxxxxxxxxxxxx> On Behalf Of Julien
> Grall
> Sent: 2022年2月27日 3:30
> To: xen-devel@xxxxxxxxxxxxxxxxxxxx
> Cc: Julien Grall <jgrall@xxxxxxxxxx>; Stefano Stabellini
> <sstabellini@xxxxxxxxxx>; Bertrand Marquis <Bertrand.Marquis@xxxxxxx>;
> Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
> Subject: Re: [PATCH v3 05/19] xen/arm: mm: Add support for the contiguous bit
> 
> Hi,
> 
> On 21/02/2022 10:22, Julien Grall wrote:
> > @@ -1333,21 +1386,34 @@ static int xen_pt_update(unsigned long virt,
> >       while ( left )
> >       {
> >           unsigned int order, level;
> > +        unsigned int nr_contig;
> > +        unsigned int new_flags;
> >
> >           level = xen_pt_mapping_level(vfn, mfn, left, flags);
> >           order = XEN_PT_LEVEL_ORDER(level);
> >
> >           ASSERT(left >= BIT(order, UL));
> >
> > -        rc = xen_pt_update_entry(root, pfn_to_paddr(vfn), mfn, level, 
> > flags);
> > -        if ( rc )
> > -            break;
> > +        /*
> > +         * Check if we can set the contiguous mapping and update the
> > +         * flags accordingly.
> > +         */
> > +        nr_contig = xen_pt_check_contig(vfn, mfn, level, left, flags);
> > +        new_flags = flags | ((nr_contig > 1) ? _PAGE_CONTIG : 0);
> >
> > -        vfn += 1U << order;
> > -        if ( !mfn_eq(mfn, INVALID_MFN) )
> > -            mfn = mfn_add(mfn, 1U << order);
> > +        for ( ; nr_contig > 0; nr_contig-- )
> > +        {
> > +            rc = xen_pt_update_entry(root, pfn_to_paddr(vfn), mfn, level,
> > +                                     new_flags);
> > +            if ( rc )
> > +                break;
> >
> > -        left -= (1U << order);
> > +            vfn += 1U << order;
> > +            if ( !mfn_eq(mfn, INVALID_MFN) )
> > +                mfn = mfn_add(mfn, 1U << order);
> > +
> > +            left -= (1U << order);
> > +        }
> 
> I forgot to add:
> 
> if ( rc )
>    break;
> 
> Without it, the outer loop will never exit in case of an error.
> 
> Cheers,
> 
> --
> Julien Grall

Yep, I am happy with that.

Reviewed-by: Hongda Deng <Hongda.Deng@xxxxxxx>

Cheers,
---
Hongda


 


Rackspace

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