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

RE: [PATCH V4 08/10] xen/arm: introduce acquire_staticmem_pages and acquire_domstatic_pages


  • 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:33:43 +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=Vfo4ttKatBF8pMiVUpXM0i1hCTmwi72HRhJO+a0gxGc=; b=O76hXoAIme6mCFe76sv98vdPhPNQfcwACN/GvIwEy+939IFYwyNmW2fwmZe+1YqCiXQjDCpUT86S8jn+mr6iYoW664BfbmcChiUKKsjgyVNLHrxs0UDQKPlf/yHN8z2glz0DY5Cbn+dG93/JIiQUure5Tcdi9egitdpIbrpishU+vmPhaQX+3wj72Qb2LQyks4cr9YtWq6wOWUAKhT1QNIJ9sezKx2e/CUYtuzK0EvWrJHWMwwITevMB1Bh63egdzfZmS25xJQ3kmGCqvWUvrTfTUGljpMHfDVFs1cl/I+ZqVRcUTS2cx4VLVmxQwwKwuPKJnC/qHtQlLBgoxVH3fw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MvSg1g8QukRcoJgvjXNwJNfGY1SxZ5K0aqz4uqODQHbXF4AZVf7OCQdrFSESHXPGyh4ZCcrNyX80nUCnfjb2HJ3XDqXx57QAX7mt9Dx7CTtM0on2JEscOEYAVq84MX4xCKPfRGgvTOWIKBXLCTo8eFwEAS2hACXOd9k9eFzP4cmPVk4fXJ3BafRdip2r3DxcPRmN2IfuBSK30W3kPzO+k/3QaDz+wZ+K+dBsYFoojyyCEKeZU3p+aaD2qyq+wSN1h84iOQqH9BwlvcrcftD95NjH5fnHAY6NXZ+ZkiJfcKXrD3i+QMuT1imOz/xArYPF28QIl5cA7XHIYzC8NWzTXw==
  • 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:34:01 +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: AQHXg5tbU50GA1cFbUmCTz4Yb/U8oatxfxqAgARG2HCAAL9iAIAAk6UA
  • Thread-topic: [PATCH V4 08/10] xen/arm: introduce acquire_staticmem_pages and acquire_domstatic_pages


> -----Original Message-----
> From: Julien Grall <julien@xxxxxxx>
> Sent: Tuesday, August 17, 2021 1:44 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 08/10] xen/arm: introduce acquire_staticmem_pages
> and acquire_domstatic_pages
> 
> 
> 
> On 16/08/2021 07:43, Penny Zheng wrote:
> > Hi Julien,
> 
> Hi,
> 
> >>> +{
> >>> +    bool need_tlbflush = false;
> >>> +    uint32_t tlbflush_timestamp = 0;
> >>> +    unsigned long i;
> >>> +    struct page_info *pg;
> >>> +
> >>> +    /* For now, it only supports pre-configured static memory. */
> >>
> >> This comment doesn't seem to match the check below.
> >>
> >>> +    if ( !mfn_valid(smfn) || !nr_mfns )
> >>
> >> This check only guarantees that there will be a page for the first MFN.
> >> Shouldn't we also check for the other MFNs?
> >>
> >
> > Hmm, Do you think that it should be all checked, the whole range, [smfn,
> smfn + nr_mfns).
> > Since it is in linear growth, maybe adding another check of "!mfn_valid(smfn
> + nr_mfns - 1)"
> > is enough?
> 
> The only requirement for Xen is to provide a valid struct page for each RAM
> page. So checking the first and end page may not be sufficient if there is a 
> hole
> in the middle.
> 
> My point here is either:
>    - we trust the callers so we remove the mfn_valid() check
>    - we don't trust the callers so we check the MFN is valid for every page
> 
> My preference is the latter, the more if we plan to us the helper after boot 
> in
> the future. An possible compromise is to add a comment that this function
> needs to be reworked if used outside of boot.
> 

Ok. I'll do the whole range check and add the comments.

> Cheers,
> 
> 
> --
> Julien Grall

 


Rackspace

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