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

[PATCH V3 0/6] populate/unpopulate memory when domain on static


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Penny Zheng <Penny.Zheng@xxxxxxx>
  • Date: Wed, 27 Apr 2022 17:27:37 +0800
  • 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] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); 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=ThmgOFurEe0Rf5be44HpvcHVKFyzQoKYs/DLnSQbE24=; b=PaOnLmcxulfs4HP6Ub+TZ1zzrA6UiUnxeVUpJ4gHwZv615G1aWSUSVEcpgdd731HmsDtTuB97c2iTReYP5C1DEWKR6jy/cmg0k3ugS5Tgrd9WvE484Zz+u0VF4AEBm3Wt3ZILh3eDGhvYWJzSSN1iINqenapZ2coxRMwhGXxatxTC03f+K25xDUIyuSMHeEa+b7AZRSj+QRW3kvIB9sYfdCAX4m+RP0IqSg95rFCkd1qeGReEGuWa4eUFRx4P/oQrl48bpRxNpbWEll09nUDNgUvq//fvh7hCe4KKD+pvyHEuZyZP11KBg5R6monwXl9xAUDY3whXzkAmSorCIKWoQ==
  • 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=ThmgOFurEe0Rf5be44HpvcHVKFyzQoKYs/DLnSQbE24=; b=XXdLT8u9o8E14+lzXiEn88cTNvUh8yG2JqGQTS6Z4MM49zl1wtp4AUrcgFMirK1BKON8Ekp+O4agCh3yd3QvtnJofkwC0RJGEZGJkez+d5Kb4Uu4MJSL66dHdmbKW9Sr0S7jTElj/bM2/vBpVXHKKA/0FzpvJQbpGWLePIn0aDCaypfS4Kyj36ruCqAFs3vpSsZ7d+42QBTh4tvhCq3jWqvIHDrWdSbVaFnw6vXQlPVFWWD8P7Q31Uq9kY7sWuh4oCAwQ43KNB6XciHynaq6uocucQ6gkUF4br+wCiC399yE2fqvlg9rQ3AJ+AbzT1KDua6xbnxV3EsUWFJ9fwoUFA==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=K08o6O1AwpferyJhswLpdKBDSM0V/K1ozBzCSwVYV5LMVnMwtnzgzEnvzIhr1Yf8GEjCjIyzA9Af3bZJ67l0u0BnsDhuzmu5SRzSkfO3JzJDpFSNxUP9HUJQ6ALNK68NTadT9hE7NF+rrur0pGk0K4PPuX3vFYZx5jub9bE6ElhgH2vKwBb/lmoRP6PLarwiU1NHsiKNlfrD+GC7K5m88/P3T0Rw0/Yo042fc3y+iisD/bs5Jkn0g4/sXq1Qcj/frQbxlRdi+cuuHBPasBNU51k8f5JYZT8z+2doGuSXlONOCoMS/hOLG1sR4BWhJ13vuKiBGB0L1oL0AWOP9FrsZg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SA66BvvohOxPwB61GD+ZOmlDMjU03Uz8CJdasnve97yQ0yWuvg8O5uciIzzVVQDm8LzOU3yCXi44fuk9S7nT0NR/hAvl9ergHUYlomRxZnkRLdJlxu9Iv4MCP20yrVn5lwAAhFqfIVZF4Cq9VKH3JIB5UJES/1+azyclZ26EqTMjTIcbnFELROMHvBDeo6QOpdeFqt+UlmGtL65H7QalOh2RFncydFoQTUnz9zY2vBUjPUwYO7Y+k4rH+Pie9/p7iYgkSoItSNfdMj31ropYV673bg26xGY8jhPhH0ZVGvYIXu04R+vxm+PnJADcbGMioJLmUTMoEaLE6cbVis8jvA==
  • Cc: <wei.chen@xxxxxxx>, <henry.wang@xxxxxxx>, Penny Zheng <Penny.Zheng@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, "George Dunlap" <george.dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, "Julien Grall" <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Wed, 27 Apr 2022 09:28:48 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true

Today when a domain unpopulates the memory on runtime, they will always
hand the memory over to the heap allocator. And it will be a problem if it
is a static domain.
Pages used as guest RAM for static domain shall always be reserved to this
domain only, and not be used for any other purposes, so they shall never go
back to heap allocator.

This patch serie intends to fix this issue, by adding pages on the new list
resv_page_list after having taken them off the "normal" list, when unpopulating
memory, and retrieving pages from resv page list(resv_page_list) when
populating memory.

---
v3 changes:
- fix possible racy issue in free_staticmem_pages()
- introduce a stub free_staticmem_pages() for the !CONFIG_STATIC_MEMORY case
- move the change to free_heap_pages() to cover other potential call sites
- change fixed width type uint32_t to unsigned int
- change "flags" to a more descriptive name "cdf"
- change name from "is_domain_static()" to "is_domain_using_staticmem"
- have page_list_del() just once out of the if()
- remove resv_pages counter
- make arch_free_heap_page be an expression, not a compound statement.
- move #ifndef is_domain_using_staticmem to the common header file
- remove #ifdef CONFIG_STATIC_MEMORY-ary
- remove meaningless page_to_mfn(page) in error log
---
v2 changes:
- let "flags" live in the struct domain. So other arch can take
advantage of it in the future
- change name from "is_domain_on_static_allocation" to "is_domain_static()"
- put reserved pages on resv_page_list after having taken them off
the "normal" list
- introduce acquire_reserved_page to retrieve reserved pages from
resv_page_list
- forbid non-zero-order requests in populate_physmap
- let is_domain_static return ((void)(d), false) on x86
- fix coding style

Penny Zheng (6):
  xen: do not free reserved memory into heap
  xen: do not merge reserved pages in free_heap_pages()
  xen: add field "flags" to cover all internal CDF_XXX
  xen/arm: introduce CDF_staticmem
  xen: unpopulate memory when domain is static
  xen: retrieve reserved pages on populate_physmap

 xen/arch/arm/domain.c             |  2 --
 xen/arch/arm/domain_build.c       |  5 ++-
 xen/arch/arm/include/asm/domain.h |  5 +--
 xen/arch/arm/include/asm/mm.h     | 12 +++++++
 xen/common/domain.c               |  7 ++++
 xen/common/memory.c               | 23 +++++++++++++
 xen/common/page_alloc.c           | 57 +++++++++++++++++++++++++++++--
 xen/include/xen/domain.h          |  6 ++++
 xen/include/xen/mm.h              |  3 +-
 xen/include/xen/sched.h           |  6 ++++
 10 files changed, 116 insertions(+), 10 deletions(-)

-- 
2.25.1




 


Rackspace

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