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

RE: [PATCH v3 6/6] xen: retrieve reserved pages on populate_physmap


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Penny Zheng <Penny.Zheng@xxxxxxx>
  • Date: Thu, 5 May 2022 13:44:42 +0000
  • Accept-language: 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=30gKdXD5EI40lISPx9UXSUYITHyg6VythMuIYcJ6Qto=; b=dgrnz5I/i/6fWXC/Bk38L1n3rUOFTdv/8f7L+vCd0aCUhYoY9x7Xsyh+ePoXXOezo6PHDhrArfx6MrKEXl/5AX0+Z+lvnAYBjZ1u+59qxR3geHiWokCC/QHsEjZRDWeJeYo9bYqmnRxyb453GFh9PsVKztwRiZbfvdRNbXdXtlEHYj00Tj/+QHfrap9u05Nr1QkBmUMgdm8FJ/hX2tBPZgqigH5nnVn2oq4iFErPR4Tjl6XZdIMo7SgxBeckwBQ3MaFYScPtZFSiXSALBvoVvU4JGWE9kw0oIUJ6ju3yh/YqmImpFjvoyxHL4iMla32TRb6uwxNg5WbgXzYdsg+afg==
  • 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=30gKdXD5EI40lISPx9UXSUYITHyg6VythMuIYcJ6Qto=; b=ogWiE9FzhQy14xZDrE5A0Nv2fLjlLagM7wtJDxeQ2hof5x9sqO4wYYkbJJ7yZ+uayYCzim/xvn6a8dd+ecozY0K1LX/lMioA72VcQizcVTyFWoIKfkr0oY4A2KtoEPxlQPwyD0cJQt9NoS2/Nq2VlieYS5lralWtxIEw1RJDKyI2kYGhtSTBK7N7KVQo3ggUerz9zZBbvgeM523eEgfjSe1kMMLIn2gLx/mnJyQjwvDrTdhPhx/Ad61h+APSHX45/OgwGXycq/lW4RoHE7qwSpFTO6CWMgCzrFuCRzLGPAa85fp9vYSBzTPfFbd28qPYoZF4DVWmLAkZe64ENteXPA==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=RVK/23gRDogmS0UajxkDoWi7Svkjw/bC/5AYyjymKm1zfwx1OLMNGJEO4SZXOg1SaxJoXxqIO+oC9mDiKC7KjAkk+djk5YahBSb11uWYuKcI+9Jwg9hO+rFyVAFER5iKWTjj8QyAZrgV28Q9Kibxg3mqi4mk93gmi+EjLyWDKFezC858NmTMkof7E2xTNjucEQOPxV7ydSOKfVXAXgFuJpeiDYATUkvMwDiRRJlfgZIU/y6QVqopM1iVVCAd1Ux1xtqItbsG4m1BACWOx9YJLxcDSUHun1ze1V1HTh/djWT6+oyEGB0PHnS4Emq7JxOnClHiBqEZX6sGaWnF6T8DkA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qawr8E5m9d5DzFs6D9LKhTYO/ckf8V/W7spP7lifsXhyWy7kU8/UG58xqiS8f0vEl6QtQjZMKDSkrL+hpVZZsAhFz/LyVLAlqhHvEx5OGQ7hq2FhX6VxJO4Z10kOwjhvK2np4emvQkxK90sbMCbx+IWHTRnzZltpQzxiRlZLOiE7tno/I92oZtc8kB9U7NV0Gi3z3Q2gdMFexO/Cl8TC/FP8hAajasmlUZdozpGK0I3TT2L2fjlZlriwylsx6UnyfGmbYyanu9fX+zbUsF+TTubAmVLfuV336R3bLc/2GSV4UVUklTVBpjBvPcJAraw5oGzBWWAWoUWYUqpqv0ZOPA==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Wei Chen <Wei.Chen@xxxxxxx>, Henry Wang <Henry.Wang@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 05 May 2022 13:45: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: AQHYWhlFOdBlNRd7J0aYNs5h64D4UK0OxgEAgAEVjwCAABi4gIAAB8rggAAKIYCAAAcaUIAAL5+AgAAR4BA=
  • Thread-topic: [PATCH v3 6/6] xen: retrieve reserved pages on populate_physmap

Hi Jan

> -----Original Message-----
> From: Jan Beulich <jbeulich@xxxxxxxx>
> Sent: Thursday, May 5, 2022 8:07 PM
> To: Penny Zheng <Penny.Zheng@xxxxxxx>
> Cc: Wei Chen <Wei.Chen@xxxxxxx>; Henry Wang <Henry.Wang@xxxxxxx>;
> Andrew Cooper <andrew.cooper3@xxxxxxxxxx>; George Dunlap
> <george.dunlap@xxxxxxxxxx>; Julien Grall <julien@xxxxxxx>; Stefano Stabellini
> <sstabellini@xxxxxxxxxx>; Wei Liu <wl@xxxxxxx>; xen-
> devel@xxxxxxxxxxxxxxxxxxxx
> Subject: Re: [PATCH v3 6/6] xen: retrieve reserved pages on populate_physmap
> 
> On 05.05.2022 11:29, Penny Zheng wrote:
> >> -----Original Message-----
> >> From: Jan Beulich <jbeulich@xxxxxxxx>
> >> Sent: Thursday, May 5, 2022 4:51 PM
> >>
> >> On 05.05.2022 10:44, Penny Zheng wrote:
> >>>> -----Original Message-----
> >>>> From: Jan Beulich <jbeulich@xxxxxxxx>
> >>>> Sent: Thursday, May 5, 2022 3:47 PM
> >>>>
> >>>> On 05.05.2022 08:24, Penny Zheng wrote:
> >>>>>> From: Jan Beulich <jbeulich@xxxxxxxx>
> >>>>>> Sent: Wednesday, May 4, 2022 9:45 PM
> >>>>>>
> >>>>>> On 27.04.2022 11:27, Penny Zheng wrote:
> >>>>>>>  #else
> >>>>>>>  void free_staticmem_pages(struct page_info *pg, unsigned long
> >>>> nr_mfns,
> >>>>>>>                            bool need_scrub)  {
> >>>>>>>      ASSERT_UNREACHABLE();
> >>>>>>>  }
> >>>>>>> +
> >>>>>>> +int __init acquire_domstatic_pages(struct domain *d, mfn_t smfn,
> >>>>>>> +                                   unsigned int nr_mfns,
> >>>>>>> +unsigned int
> >>>>>>> +memflags) {
> >>>>>>> +    ASSERT_UNREACHABLE();
> >>>>>>> +}
> >>>>>>
> >>>>>> I can't spot a caller of this one outside of suitable #ifdef.
> >>>>>> Also the __init here looks wrong and you look to have missed
> >>>>>> dropping it from
> >>>> the real function.
> >>>>>>
> >>>>>>> +mfn_t acquire_reserved_page(struct domain *d, unsigned int
> >>>>>>> +memflags) {
> >>>>>>> +    ASSERT_UNREACHABLE();
> >>>>>>> +}
> >>>>>>>  #endif
> >>>>>>
> >>>>>> For this one I'd again expect CSE to leave no callers, just like
> >>>>>> in the earlier patch. Or am I overlooking anything?
> >>>>>>
> >>>>>
> >>>>> In acquire_reserved_page, I've use a few CONFIG_STATIC_MEMORY-
> only
> >>>>> variables, like
> >>>>> d->resv_page_list, so I'd expect to let acquire_reserved_page
> >>>>> d->guarded by CONFIG_STATIC_MEMORY
> >>>>> too and provide the stub function here to avoid compilation error
> >>>> when !CONFIG_STATIC_MEMORY.
> >>>>
> >>>> A compilation error should only result if there's no declaration of
> >>>> the function. I didn't suggest to remove that. A missing definition
> >>>> would only be noticed when linking, but CSE should result in no
> >>>> reference to the function in the first place. Just like was
> >>>> suggested for the earlier patch. And as opposed to the call site
> >>>> optimization the compiler can do, with -ffunction-sections there's
> >>>> no way for the linker
> >> to eliminate the dead stub function.
> >>>>
> >>>
> >>> Sure, plz correct me if I understand wrongly:
> >>> Maybe here I should use #define xxx to do the declaration, and it
> >>> will also avoid bringing dead stub function. Something like:
> >>> #define free_staticmem_pages(pg, nr_mfns, need_scrub) ((void)(pg),
> >>> (void)(nr_mfns), (void)(need_scrub)) And #define
> >>> acquire_reserved_page(d, memflags) (INVALID_MFN)
> >>
> >> No, I don't see why you would need #define-s. You want to have normal
> >> declarations, but no definition unless STATIC_MEMORY. If that doesn't
> >> work, please point out why (i.e. what I am overlooking).
> >>
> >
> > I was trying to avoid dead stub function, and I think #define-s is the wrong
> path...
> > So, I guess If I remove the ASSERT_UNREACHABLE() part and only leave
> > the empty function body there, the CSE could do the optimization and result
> in no reference.
> 
> No, DCE (I'm sorry for the earlier wrong uses of CSE) cannot eliminate a
> function, it can only eliminate call sites. Hence it doesn't matter whether a
> function is empty. And no, if a stub function needs retaining, the
> ASSERT_UNREACHABLE() should also remain there if the function indeed is
> supposed to never be called.
>

Ok. Thanks for explanation.
I misunderstand what you suggested here, I thought you were suggesting a way of 
stub function
which could bring some optimization.
The reason I introduced free_staticmem_pages and acquire_reserved_page here is 
that
we now used them in common code, and if they are not defined(using stub) on 
!CONFIG_STATIC_MEMORY,
we will have " hidden symbol `xxx' isn't defined " compilation error.
 
> Jan


 


Rackspace

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