linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] kaslr: extend movable_node to movable_node=nn[KMG]@ss[KMG]
@ 2017-11-01 11:31 Chao Fan
  2017-11-01 11:32 ` [PATCH v2 1/4] kaslr: parse the extended movable_node=nn[KMG]@ss[KMG] Chao Fan
                   ` (3 more replies)
  0 siblings, 4 replies; 20+ messages in thread
From: Chao Fan @ 2017-11-01 11:31 UTC (permalink / raw)
  To: linux-kernel, x86, hpa, tglx, mingo, bhe, keescook, yasu.isimatu
  Cc: indou.takao, caoj.fnst, douly.fnst, Chao Fan

Here is a problem:
Here is a machine with several NUMA nodes and some of them are
hot-pluggable. It's not good for kernel to be extracted in the memory
region of movable node. But in current code, I print the address chosen by
kaslr and found it may be placed in movable node sometimes.
To solve this problem, it's better to limit the memory region chosen by
kaslr to immovable node in kaslr.c. But the memory information about if
it's hot-pluggable is stored in ACPI SRAT table, which is parsed after
kernel is extracted. So we can't get the detail memory information
before extracting kernel.

So extend the movable_node to movable_node=nn@ss, in which nn means
the size of memory in *immovable* node, and ss means the start position of
this memory region. Then limit kaslr choose memory in these regions.

There are two policies:
1. Specify the memory region in *movable* node to avoid:
   Then we can use the existing mem_avoid to handle. But if the memory
   on movable node was separated by memory hole or different movable nodes
   are discontinuous, we don't know how many regions need to avoid.
   OTOH, we must avoid all of the movable memory, otherwise, kaslr may
   choose the wrong place.
2. Specify the memory region in *immovable* node to select:
   Only support 4 regions in this parameter. Then user can use two nodes
   at least for kaslr to choose, it's enough for the kernel to extract.
   At the same time, because we need only 4 new mem_vector, the usage
   of memory here is not too big. So I think this way is better, and this 
   patchset is based on this policy.

PATCH 1/4 parse the extended movable_node=nn[KMG]@ss[KMG], then
          store the memory regions.
PATCH 2/4 select the memory region in immovable node when process
          memmap.
PATCH 3/4 add document.
PATCH 4/4 cleans up some little problems.

v1->v2:
Follow Dou's suggestion:
 - Add the parse for movable_node=nn[KMG] without @ss[KMG]
 - Fix the bug for more than one "movable_node=" specified
 - Drop useless variables and use mem_vector region directely
 - Add more comments.

Chao Fan (4):
  kaslr: parse the extended movable_node=nn[KMG]@ss[KMG]
  kaslr: select the memory region in immovable node to process
  document: change the document for the extended movable_node
  kaslr: clean up a useless variable and some usless space

 Documentation/admin-guide/kernel-parameters.txt |   9 ++
 arch/x86/boot/compressed/kaslr.c                | 141 ++++++++++++++++++++++--
 2 files changed, 138 insertions(+), 12 deletions(-)

-- 
2.13.6

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2017-11-13 11:02 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-01 11:31 [PATCH v2 0/4] kaslr: extend movable_node to movable_node=nn[KMG]@ss[KMG] Chao Fan
2017-11-01 11:32 ` [PATCH v2 1/4] kaslr: parse the extended movable_node=nn[KMG]@ss[KMG] Chao Fan
2017-11-13  8:10   ` Baoquan He
2017-11-13  8:42     ` Chao Fan
2017-11-01 11:32 ` [PATCH v2 2/4] kaslr: select the memory region in immovable node to process Chao Fan
2017-11-09  8:21   ` Baoquan He
2017-11-10  1:14     ` Chao Fan
2017-11-10  3:03     ` Chao Fan
2017-11-10  3:14       ` Baoquan He
2017-11-10  4:20         ` Chao Fan
2017-11-10  6:02         ` Chao Fan
2017-11-13  8:31   ` Baoquan He
2017-11-13  9:18     ` Chao Fan
2017-11-13  9:26       ` Baoquan He
2017-11-13  9:50         ` Chao Fan
2017-11-13 11:02           ` Baoquan He
2017-11-01 11:32 ` [PATCH v2 3/4] document: change the document for the extended movable_node Chao Fan
2017-11-01 11:32 ` [PATCH v2 4/4] kaslr: clean up a useless variable and some usless space Chao Fan
2017-11-13  8:32   ` Baoquan He
2017-11-13  9:19     ` Chao Fan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).