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

RE: [PATCH] xen/arm: p2m: Populate pages for GICv2 mapping in arch_domain_create()


  • To: Julien Grall <julien@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Henry Wang <Henry.Wang@xxxxxxx>
  • Date: Thu, 13 Oct 2022 09:21:10 +0000
  • Accept-language: zh-CN, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • 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=2; 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=eJV8Jn6ATABpdsHsHCkhHy9K7j3LBcCWjb2s7CdMPQU=; b=PcEhfTzjNanQE5ADbmweU81LGQOikt9FbZDICUtAC7mIM6VHPjKeh1VphEbjedvbxIjBf11vk4tdgzadbiXhNbXjeQ3X8gVU+A3YSSnZ3caa4/xf8ViYdQouw2JMomKW+rf90lL05KTzRx1e8R9nxpd52Yv1lUdO/kXfEICA0mtbqEymsRQ/TimXi2Be+1nKqrpoejy7WdO/6yA+7ZtLpCtCaXOMa6nY7oqHTzZNjmkO9Ue+WPyEJPbzKiHDJPRIfgn8bf0Ur4PKpdAULUkB01IV+NtN5ClP0pMwqy1uybfLPUOND/Qg9ECvLjUZoplrr8q0x1eAINjLaz13O5vYVQ==
  • 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=eJV8Jn6ATABpdsHsHCkhHy9K7j3LBcCWjb2s7CdMPQU=; b=Z4XcCpQ2gGHpDdX1/Sawqokwwva8YOqt1IMJ1yjUqldw7UP6UQD4H441r8xW8hAx1DarxkRmkWIK3WCud3bXD6ZPvO+fAJh/cBFniPrI3I1VYhTv2m0/z1AYrr+CoOeKxD2ltDhvv+SqGjJZFTXh46Sq0CDCR33GQ6I5pgCWEGq76ghd/R24KAEIB6HaLBga++wXwkQuXtIgS/1nLUdskpWyDEwrWDJ8SZR7H/5BKIoHWBm9J3kSWnhLpfAZePYdLITNXMpVsFDxGHp9bsTkqVf+y4go2mcnmH5ez7mAr8oAPlevc3mYyfwT2B0qsp7kbvEA0RC5ByNS+0s2dHHQ3g==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=CXvJzdRDkgi9y3kBea3OYtmw0n0iIy4dBMyHFkyBbrc6GCFh7zueGgsp4wLjOkZxvzK7/7RDWZDVOpIwjKl4odNewVPQ3sWIm+P4gSIa/4ry4Iivx62OIB1h1AzWjP0A2lkXfIv3kk09LjRXNsTLl2epMAPS8BLDUi+qSbWAqaCpGdVboVQ6USEGN8AofRgU/u0hOOmHtSL47CVmmMxlew6KvNzl9AHNzNXaXzJ2P4p9NS7tWCRwUFBSz1GYRHU1j494cty0WJqXhDnMKKZ/wJfTWHPdfeCRoGHINacQmkUYUF+tngFqZw1Hu+SoWd+hImunvjOPC3NjOe2oMXTqWw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CvY0A4oTwTCMqT/Fm00yBFgbD7pnI8JFVuCqRrmTCz5mWAFxJtNSLp1lum/GKnzFLjbTbeivIbskaTOWQBBu+4K8N+GkGxBbTPj2jW1df9VoXJvRArAvVZnRjeEUJlC8iCmZm/eB/NRk0CuH7FkB7ckLzL/ZLjapJOhWhvLNbclGY8jSN7trlzg5J28MV8QgwuohV4vz68u+YZPNZC95k5ijZjmdn9XSrYvyBAYgGz1qoymrdd7Zn7+DuGOwSXerZwRuF+EbvWLOi9Uw6kbVAmYShT2qUeU3uKAC/Pwj9HnwoJrskR4M53C9z8SWcEMrj90fgbL7/rBcuaCiNY68Yg==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Wei Chen <Wei.Chen@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Thu, 13 Oct 2022 09:21:27 +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: AQHY3t81xdeRddBbSEGLoF20gErPe64MCngAgAAAYwA=
  • Thread-topic: [PATCH] xen/arm: p2m: Populate pages for GICv2 mapping in arch_domain_create()

Hi Julien,

> -----Original Message-----
> From: Julien Grall <julien@xxxxxxx>
> Subject: Re: [PATCH] xen/arm: p2m: Populate pages for GICv2 mapping in
> arch_domain_create()
> 
> Hi Henry,
> 
> On 13/10/2022 09:38, Henry Wang wrote:
> > Hardware using GICv2 needs to create a P2M mapping of 8KB GICv2 area
> > when the domain is created. Considering the worst case of page tables
> 
> Can you describe in the commit message what is the worst case scenario?

The two pages will be consecutive but not necessarily in the same L3 page
table so the worst case is 4 + 2, is that correct?

> 
> > and keep a buffer, populate 16 pages as the default value to the P2M
> > pages pool in arch_domain_create() at the domain creation stage to
> > satisfy the GICv2 requirement.
> >
> > Fixes: cbea5a1149ca ("xen/arm: Allocate and free P2M pages from the P2M
> pool")
> > Suggested-by: Julien Grall <jgrall@xxxxxxxxxx>
> > Signed-off-by: Henry Wang <Henry.Wang@xxxxxxx>
> > ---
> > This should also be backported to 4.13, 4.14, 4.15 and 4.16.
> > ---
> >   xen/arch/arm/domain.c | 14 ++++++++++++++
> >   1 file changed, 14 insertions(+)
> >
> > diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
> > index 2c84e6dbbb..e40e2bcba1 100644
> > --- a/xen/arch/arm/domain.c
> > +++ b/xen/arch/arm/domain.c
> > @@ -740,6 +740,20 @@ int arch_domain_create(struct domain *d,
> >           BUG();
> >       }
> >
> > +    spin_lock(&d->arch.paging.lock);
> > +    /*
> > +     * Hardware using GICv2 needs to create a P2M mapping of 8KB GICv2
> area
> 
> The wording suggests that this is only necessary for GICv2. But below
> this is done unconditionally. I am happy with this been done
> unconditionally, but I think this should be clarified here.

Sure, I will add "For GICv3, the above-mentioned P2M mapping is not
necessary, but since the allocated 16 pages here would not be lost, hence
populate these pages unconditionally" if it is ok to you.

> 
> > +     * when the domain is created. Considering the worst case for page
> > +     * tables and keep a buffer, populate 16 pages to the P2M pages pool
> here.
> > +     */
> > +    if ( (rc = p2m_set_allocation(d, 16, NULL)) != 0 )
> > +    {
> > +        p2m_set_allocation(d, 0, NULL);
> 
> Shouldn't this be done in p2m_fiinal_teardown() to cover so the pages
> will be freed anything after this call will fail (include in the caller
> domain_create())?

Hmm, yes, I will remove this p2m_set_allocation(d, 0, NULL); in v2.

Kind regards,
Henry

> 
> > +        spin_unlock(&d->arch.paging.lock);
> > +        goto fail;
> > +    }
> > +    spin_unlock(&d->arch.paging.lock);
> > +
> >       if ( (rc = domain_vgic_register(d, &count)) != 0 )
> >           goto fail;
> >
> 
> Cheers,
> 
> --
> Julien Grall

 


Rackspace

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