[PATCH] Change the document about iowait

2016-10-25 Thread Chao Fan
The iowait is not reliable by reading from /proc/stat, so this method to get iowait is not suggested. And we mark it in the document. Signed-off-by: Cao Jin <caoj.f...@cn.fujitsu.com> Signed-off-by: Chao Fan <fanc.f...@cn.fujitsu.com> --- Documentation/filesystems/proc.txt | 11 ++

Re: [PATCH] Change the document about iowait

2016-11-08 Thread Chao Fan
ping Thanks, Chao Fan On Wed, Oct 26, 2016 at 10:41:28AM +0800, Chao Fan wrote: >The iowait is not reliable by reading from /proc/stat, so this >method to get iowait is not suggested. And we mark it in the >document. > >Signed-off-by: Cao Jin <caoj.f...@cn.fujitsu.com> >

Re: [PATCH] Change the document about iowait

2016-11-13 Thread Chao Fan
On Sun, Nov 13, 2016 at 08:47:55AM -0700, Jonathan Corbet wrote: >On Wed, 26 Oct 2016 10:41:28 +0800 >Chao Fan <fanc.f...@cn.fujitsu.com> wrote: > >> The iowait is not reliable by reading from /proc/stat, so this >> method to get iowait is not suggested. And we mark it i

[POC] Get acpi table to limit memory scope chosen by KASLR to home SB when "movable_node" is specified

2017-08-03 Thread Chao Fan
\-systab \-efi tables \-rsdp \-rsdt or xsdt \-acpi root table list \-acpi srat mem affinity I am not sure if it's OK for community. If there are any problems, please let me know. Any comments will be welcome. Thanks, Chao Fan

Re: [POC] Get acpi table to limit memory scope chosen by KASLR to home SB when "movable_node" is specified

2017-08-03 Thread Chao Fan
On Thu, Aug 03, 2017 at 04:59:26PM +0800, Dou Liyang wrote: >Cc ACPI maintainers and mail list So many thanks. > >At 08/03/2017 04:51 PM, Chao Fan wrote: >> Hi all, >> >> Here is an issue about movable_node and KASLR. >> Currently, KASLR works well with "

Re: [PATCH] x86/boot/KASLR: Extend movable_node option for KASLR

2017-08-03 Thread Chao Fan
On Fri, Aug 04, 2017 at 09:37:14AM +0800, Dou Liyang wrote: >Hi Chao,Baoquan > >At 08/04/2017 07:49 AM, Baoquan He wrote: >> On 08/03/17 at 08:24pm, Chao Fan wrote: >> > It's almost another "mem=". >> > >No, it is different. > >See Documen

Re: [PATCH] x86/boot/KASLR: Extend movable_node option for KASLR

2017-08-03 Thread Chao Fan
On Fri, Aug 04, 2017 at 10:52:45AM +0800, Dou Liyang wrote: >Hi chao > >At 08/04/2017 10:01 AM, Chao Fan wrote: >> On Fri, Aug 04, 2017 at 09:37:14AM +0800, Dou Liyang wrote: >> > Hi Chao,Baoquan >> > >> > At 08/04/2017 07:49 AM, Baoquan He wrote: >

Re: [PATCH v8 0/2] x86/boot/KASLR: Restrict kernel to be randomized in mirror regions

2017-08-04 Thread Chao Fan
Chao also is helping >to try on his side. Hi Bao, After testing for 10 times, no problem happened. Maybe you did something wrong in the first time. Thanks, Chao Fan > >> >> On 08/04/17 at 03:26pm, Baoquan He wrote: >> > Patch 1/2 is newly added to add efi_memdesc_pt

Re: [PATCH v8 0/2] x86/boot/KASLR: Restrict kernel to be randomized in mirror regions

2017-08-04 Thread Chao Fan
Chao also is helping Maybe a little later, cause from tommorow, I will be on vacation for 9 days. Thanks, Chao Fan >to try on his side. > >> >> On 08/04/17 at 03:26pm, Baoquan He wrote: >> > Patch 1/2 is newly added to add efi_memdesc_ptr helper to wrap the >&g

Re: [PATCH v4 4/4] x86/boot/KASLR: Restrict kernel to be randomized in mirror regions

2017-07-09 Thread Chao Fan
ld stop) */ > >Well, here it might be not like that. The mirror regions could be multiple, >we need find and process each of them to add slots. Yes, in my test, I found the memory situation is like this: 0-1325M:mirror (this scope contains tens of entries) 1532M-2303M:non-m

Re: [PATCH] x86/boot/KASLR: exclude EFI_BOOT_SERVICES_{CODE|DATA} from KASLR's choice

2017-07-06 Thread Chao Fan
On Thu, Jul 06, 2017 at 09:22:38AM +, Naoya Horiguchi wrote: >On Thu, Jul 06, 2017 at 05:13:32PM +0800, Chao Fan wrote: >> On Thu, Jul 06, 2017 at 08:31:07AM +, Naoya Horiguchi wrote: >> >Hi Baoquan, everyone, >> > >> >I'm also interested in KASLR/EFI r

Re: [PATCH] x86/boot/KASLR: exclude EFI_BOOT_SERVICES_{CODE|DATA} from KASLR's choice

2017-07-06 Thread Chao Fan
is changed to be true, we won't need to walk other entries, so I think: if (md->attribute & EFI_MEMORY_MORE_RELIABLE) { efi_mirror_found = true; break; } will be enough to show that mirror regions exist. And will

Re: [PATCH] x86/boot/KASLR: exclude EFI_BOOT_SERVICES_{CODE|DATA} from KASLR's choice

2017-07-06 Thread Chao Fan
egion.size = md->num_pages << EFI_PAGE_SHIFT; >- process_mem_region(, minimum, image_size); >+ if (md->attribute & EFI_MEMORY_MORE_RELIABLE) > efi_mirror_found = true; >+ } Hi Horiguchi-san, Sorry for one more su

Re: [PATCH] x86/boot/KASLR: exclude EFI_BOOT_SERVICES_{CODE|DATA} from KASLR's choice

2017-07-06 Thread Chao Fan
On Thu, Jul 06, 2017 at 06:04:46PM +0800, Chao Fan wrote: >On Thu, Jul 06, 2017 at 08:31:07AM +, Naoya Horiguchi wrote: >>Hi Baoquan, everyone, >> >>I'm also interested in KASLR/EFI related issue (but not the same issue >>with yours, so I separated the thread

Re: [PATCH] x86/boot/KASLR: Extend movable_node option for KASLR

2017-08-03 Thread Chao Fan
It's almost another "mem=". Thanks, Chao Fan On Thu, Aug 03, 2017 at 08:17:21PM +0800, Dou Liyang wrote: >movable_node is a boot-time switch to make hot-pluggable memory >NUMA nodes to be movable. This option is based on an assumption >that any node which the kernel resides i

Re: [PATCH] actbl1.h: use tab instead of seven spaces as the indentation

2017-08-22 Thread Chao Fan
On Wed, Aug 23, 2017 at 03:43:33AM +, Zheng, Lv wrote: >Hi, > >> From: linux-acpi-ow...@vger.kernel.org >> [mailto:linux-acpi-ow...@vger.kernel.org] On Behalf Of Chao Fan >> Subject: [PATCH] actbl1.h: use tab instead of seven spaces as the indentation >> >>

[RFC PATCH] kaslr: get ACPI SRAT table to avoid movable memory

2017-08-18 Thread Chao Fan
KASLR should choose the memory region of immovable node to extract kernel. So get ACPI SRAT table and store the memory region of movable node which kaslr shold avoid. Signed-off-by: Chao Fan <fanc.f...@cn.fujitsu.com> --- arch/x86/boot/compressed/kaslr.c

Re: [RFC PATCH] kaslr: get ACPI SRAT table to avoid movable memory

2017-08-18 Thread Chao Fan
a better method to handle the movable memory, please tell me. Thanks, Chao Fan On Fri, Aug 18, 2017 at 04:58:20PM +0800, Chao Fan wrote: >KASLR should choose the memory region of immovable node to extract kernel. >So get ACPI SRAT table and store the memory region of movable node which

Re: [PATCH 1/2] x86/boot/KASLR: Adapt process_e820_entry for all kinds of memory map

2017-06-20 Thread Chao Fan
ddress. */ random_addr = find_random_phys_addr(min_addr, output_size); Cause you will walk efi map firstly, and then e820 map(or not). Thanks, Chao Fan >--- > arch/x86/boot/compressed/kaslr.c | 60 ++-- > 1 file changed, 33 insertions(+), 27 deletions(-) > >

Re: [RFC][PATCH 0/2] x86/boot/KASLR: Restrict kernel to be randomized in mirror regions if existed

2017-06-21 Thread Chao Fan
kernel is in mirror region. If there are any problems, please let me know. Thanks, Chao Fan On Thu, Jun 15, 2017 at 03:52:47PM +0800, Baoquan He wrote: >Our customer reported that Kernel text may be located on non-mirror >region (movable zone) when both address range mirroring feature and

Re: [RFC][PATCH 0/2] x86/boot/KASLR: Restrict kernel to be randomized in mirror regions if existed

2017-06-21 Thread Chao Fan
On Thu, Jun 22, 2017 at 11:20:32AM +0800, Baoquan He wrote: >On 06/22/17 at 11:10am, Chao Fan wrote: >> Hi all, >> >> After testing this issue for 100 times in total, I think this patchset >> works well. > >Thanks for your effort, Chao! No problem, and many thank

Re: [POC] Extend "movable_node" to "movable_node=nn@ss" and add the interface in /sys to show the value

2017-10-11 Thread Chao Fan
On Wed, Oct 11, 2017 at 04:42:15PM +0800, Baoquan He wrote: >Hi dear Fan San, Hi dear Uncle Bao, > >On 10/11/17 at 04:23pm, Chao Fan wrote: >> On Wed, Oct 11, 2017 at 03:55:13PM +0800, Baoquan He wrote: >> >Hi Fan San, >> >> 1. Get and parse the srat tabl

Re: [POC] Extend "movable_node" to "movable_node=nn@ss" and add the interface in /sys to show the value

2017-10-11 Thread Chao Fan
On Wed, Oct 11, 2017 at 03:55:13PM +0800, Baoquan He wrote: >Hi Fan San, > >On 10/11/17 at 10:28am, Chao Fan wrote: >> Hi all, >> >> Here is a problem: >> Here is a machine with several NUMA nodes and some of them are hot-pluggable, >> It's not good for kern

[PATCH] actbl1.h: use tab instead of seven spaces as the indentation

2017-08-22 Thread Chao Fan
The indentation of these two lines is seven spaces, but not tab. So fix it. Signed-off-by: Chao Fan <fanc.f...@cn.fujitsu.com> --- include/acpi/actbl1.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h index b4ce55

Re: [PATCH v2] kaslr: get ACPI SRAT table to avoid movable memory

2017-09-04 Thread Chao Fan
memory location and length. But I have no idea that if it's elegant leaving it for users to fill the parameter. BTW, it may be like this: "movable_node=xxx@start,xxx@start,..." And I was also wondering if anyone has a better solution. Thanks, Chao Fan > >Thanks >Baoquan &

[PATCH v2] kaslr: get ACPI SRAT table to avoid movable memory

2017-09-03 Thread Chao Fan
KASLR should choose the memory region of immovable node to extract kernel. So get ACPI SRAT table and store the memory region of movable node which kaslr shold avoid. Signed-off-by: Chao Fan <fanc.f...@cn.fujitsu.com> --- v2: Add the support for bios --- arch/x86/boot/compressed/kaslr.c

Re: [PATCH v2] kaslr: get ACPI SRAT table to avoid movable memory

2017-09-03 Thread Chao Fan
On Mon, Sep 04, 2017 at 12:55:00AM +0200, Rafael J. Wysocki wrote: >On Sunday, September 3, 2017 4:31:23 PM CEST Chao Fan wrote: >> KASLR should choose the memory region of immovable node to extract kernel. >> So get ACPI SRAT table and store the memory region of movable node which

Re: [PATCH v2] kaslr: get ACPI SRAT table to avoid movable memory

2017-09-03 Thread Chao Fan
On Mon, Sep 04, 2017 at 10:26:19AM +0800, Baoquan He wrote: >On 09/04/17 at 12:55am, Rafael J. Wysocki wrote: >> On Sunday, September 3, 2017 4:31:23 PM CEST Chao Fan wrote: >> > KASLR should choose the memory region of immovable node to extract kernel. >> > So ge

[POC] Extend "movable_node" to "movable_node=nn@ss" and add the interface in /sys to show the value

2017-10-10 Thread Chao Fan
in acpi_parse_memory_affinity, fill the value and user can get and use them. If anyone has a better method, please let me know. Any comments will be welcome. Thanks, Chao Fan

[PATCH 3/4] document: change the document for the extended movable_node

2017-10-19 Thread Chao Fan
Add the document for the change of extended movable_node=nn[KMG]@ss[KMG]. Cc: Jonathan Corbet <cor...@lwn.net> Cc: linux-...@vger.kernel.org Signed-off-by: Chao Fan <fanc.f...@cn.fujitsu.com> --- Documentation/admin-guide/kernel-parameters.txt | 9 + 1 file changed, 9 inserti

[PATCH 0/4] kaslr: extend movable_node to movable_node=nn[KMG]@ss[KMG]

2017-10-19 Thread Chao Fan
here is not too big. PATCH 1/4 parse the extended movable_node=nn[KMG]@ss[KMG], then store the memory regions. PATCH 2/4 selects the memory region in immovable node when process memmap. PATCH 3/4 is the change of document. PATCH 4/4 cleans up some little problems. Chao F

[PATCH 4/4] kaslr: clean up a useless variable and some usless space

2017-10-19 Thread Chao Fan
There are two same variable "rc" in this function. One is in the circulation, the other is out of the circulation. The one out will never be used, so drop it. Signed-off-by: Chao Fan <fanc.f...@cn.fujitsu.com> --- arch/x86/boot/compressed/kaslr.c | 5 ++--- 1 file changed, 2

[PATCH 2/4] kaslr: select the memory region in immovable node to process

2017-10-19 Thread Chao Fan
as a region to process_mem_region. It may split one node or one entry to several regions. Signed-off-by: Chao Fan <fanc.f...@cn.fujitsu.com> --- arch/x86/boot/compressed/kaslr.c | 72 1 file changed, 58 insertions(+), 14 deletions(-) diff --git a/ar

[PATCH 1/4] kaslr: parse the extended movable_node=nn[KMG]@ss[KMG]

2017-10-19 Thread Chao Fan
the usage of memory, only support for 4 regions. 4 regions contains 2 nodes at least, and is enough for kernel to extract. Signed-off-by: Chao Fan <fanc.f...@cn.fujitsu.com> --- arch/x86/boot/compressed/kaslr.c | 63 +++- 1 file changed, 62 insertions(+), 1 de

Re: [PATCH v2 1/4] kaslr: parse the extended movable_node=nn[KMG]@ss[KMG]

2017-11-13 Thread Chao Fan
On Mon, Nov 13, 2017 at 04:10:41PM +0800, Baoquan He wrote: >Hi Chao, Hi Baoquan, Thanks for your reply. > >Please think more on your patches, better to discuss with your >colleagues and ask them to help review before your post. > >On 11/01/17 at 07:32pm, Chao Fa

Re: [PATCH v2 2/4] kaslr: select the memory region in immovable node to process

2017-11-13 Thread Chao Fan
On Mon, Nov 13, 2017 at 05:26:24PM +0800, Baoquan He wrote: >On 11/13/17 at 05:18pm, Chao Fan wrote: >> On Mon, Nov 13, 2017 at 04:31:31PM +0800, Baoquan He wrote: >> >On 11/01/17 at 07:32pm, Chao Fan wrote: >> >> Compare the region of memmap entry

Re: [PATCH v2 4/4] kaslr: clean up a useless variable and some usless space

2017-11-13 Thread Chao Fan
On Mon, Nov 13, 2017 at 04:32:33PM +0800, Baoquan He wrote: >On 11/01/17 at 07:32pm, Chao Fan wrote: >> There are two same variable "rc" in this function. One is in the >> circulation, the other is out of the circulation. The one out will never >> be used, so drop it

Re: [PATCH v2 2/4] kaslr: select the memory region in immovable node to process

2017-11-13 Thread Chao Fan
On Mon, Nov 13, 2017 at 04:31:31PM +0800, Baoquan He wrote: >On 11/01/17 at 07:32pm, Chao Fan wrote: >> Compare the region of memmap entry and immovable_mem, then choose the >> intersection to process_mem_region. >> >> Since the interrelationship between e820 or efi e

[PATCH] kaslr: clean up a useless variable and some usless space

2017-11-23 Thread Chao Fan
There are two same variable "rc" in mem_avoid_memmap. One is in the circulation, the other is out of the circulation. The one out will never be used, so drop it. Signed-off-by: Chao Fan <fanc.f...@cn.fujitsu.com> --- arch/x86/boot/compressed/kaslr.c | 5 ++--- 1 file changed, 2

[PATCH v3 0/4] kaslr: add new parameter immovable_mem=nn[KMG]@ss[KMG] to make memory hotplug work well with kaslr

2017-12-05 Thread Chao Fan
. - Disable memory mirror if movable_node specified Chao Fan (4): kaslr: add immovable_mem=nn[KMG]@ss[KMG] to specify extracting memory kaslr: calculate the memory region in immovable node kaslr: disable memory mirror feature when movable_node specified document: change the document for immovable_mem

[PATCH v3 4/4] document: change the document for immovable_mem

2017-12-05 Thread Chao Fan
Add the document for the change of new parameter immovable_mem=nn[KMG]@ss[KMG]. Cc: linux-...@vger.kernel.org Cc: Jonathan Corbet <cor...@lwn.net> Signed-off-by: Chao Fan <fanc.f...@cn.fujitsu.com> --- Documentation/admin-guide/kernel-parameters.txt | 9 + 1 file changed,

[PATCH v3 1/4] kaslr: add immovable_mem=nn[KMG]@ss[KMG] to specify extracting memory

2017-12-05 Thread Chao Fan
rameter now. Signed-off-by: Chao Fan <fanc.f...@cn.fujitsu.com> --- arch/x86/boot/compressed/kaslr.c | 80 ++-- 1 file changed, 77 insertions(+), 3 deletions(-) diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c index a63fbc2

[PATCH v3 2/4] kaslr: calculate the memory region in immovable node

2017-12-05 Thread Chao Fan
If there is no immovable memory region specified, go on the old code. There are several conditons: 1. CONFIG_MEMORY_HOTPLUG is not specified to y. 2. immovable_mem= is not specified. Otherwise, calculate the intersecting between memmap entry and immovable memory. Signed-off-by: Chao Fan <fan

[PATCH v3 3/4] kaslr: disable memory mirror feature when movable_node specified

2017-12-05 Thread Chao Fan
In kernel code, if movable_node specified, it will skip the mirror feature. So we should also skip mirror feature in kaslr. Signed-off-by: Chao Fan <fanc.f...@cn.fujitsu.com> --- arch/x86/boot/compressed/kaslr.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff

[PATCH v4.1 2/4] kaslr: calculate the memory region in immovable node

2017-12-17 Thread Chao Fan
to slots_count to match slots_fetch_random, and rename new function sa process_mem_region. Signed-off-by: Chao Fan <fanc.f...@cn.fujitsu.com> --- v4->v4.1: - Move the define "int i" out of for() loop. --- arch/x86/boot/compressed/kaslr.c | 66 +

[PATCH v2 1/4] kaslr: parse the extended movable_node=nn[KMG]@ss[KMG]

2017-11-01 Thread Chao Fan
the regions in immovable_mem, where should be chosen by kaslr. Multiple regions can be specified, comma delimited. Considering the usage of memory, only support for 4 regions. 4 regions contains 2 nodes at least, enough for kernel to extract. Signed-off-by: Chao Fan <fanc.f...@cn.fujitsu.com> --- ar

[PATCH v2 2/4] kaslr: select the memory region in immovable node to process

2017-11-01 Thread Chao Fan
, and one entry of e820 or efi may contain the memory in different nodes sometimes. It may split one node or one entry to several regions. Signed-off-by: Chao Fan <fanc.f...@cn.fujitsu.com> --- arch/x86/boot/compressed/kaslr.c | 60 ++-- 1 file chang

[PATCH v2 0/4] kaslr: extend movable_node to movable_node=nn[KMG]@ss[KMG]

2017-11-01 Thread Chao Fan
. 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

[PATCH v2 4/4] kaslr: clean up a useless variable and some usless space

2017-11-01 Thread Chao Fan
There are two same variable "rc" in this function. One is in the circulation, the other is out of the circulation. The one out will never be used, so drop it. Signed-off-by: Chao Fan <fanc.f...@cn.fujitsu.com> --- arch/x86/boot/compressed/kaslr.c | 5 ++--- 1 file changed, 2

[PATCH v2 3/4] document: change the document for the extended movable_node

2017-11-01 Thread Chao Fan
Add the document for the change of extended movable_node=nn[KMG]@ss[KMG]. Cc: Jonathan Corbet <cor...@lwn.net> Cc: linux-...@vger.kernel.org Signed-off-by: Chao Fan <fanc.f...@cn.fujitsu.com> --- Documentation/admin-guide/kernel-parameters.txt | 9 + 1 file changed, 9 inserti

Re: [PATCH v2 2/4] kaslr: select the memory region in immovable node to process

2017-11-09 Thread Chao Fan
On Thu, Nov 09, 2017 at 04:21:32PM +0800, Baoquan He wrote: >Hi Chao, > >On 11/01/17 at 07:32pm, Chao Fan wrote: >> Compare the region of memmap entry and immovable_mem, then choose the >> intersection to process_mem_region. >> >> Since the interrelationship betwe

Re: [PATCH v2 2/4] kaslr: select the memory region in immovable node to process

2017-11-09 Thread Chao Fan
On Thu, Nov 09, 2017 at 04:21:32PM +0800, Baoquan He wrote: >Hi Chao, > >On 11/01/17 at 07:32pm, Chao Fan wrote: >> Compare the region of memmap entry and immovable_mem, then choose the >> intersection to process_mem_region. >> >> Since the interrelationship betwe

Re: [PATCH v2 2/4] kaslr: select the memory region in immovable node to process

2017-11-09 Thread Chao Fan
On Fri, Nov 10, 2017 at 11:14:37AM +0800, Baoquan He wrote: >On 11/10/17 at 11:03am, Chao Fan wrote: >> On Thu, Nov 09, 2017 at 04:21:32PM +0800, Baoquan He wrote: >> >Hi Chao, >> > >> >On 11/01/17 at 07:32pm, Chao Fan wrote: >> >> Compare the regio

Re: [PATCH v2 2/4] kaslr: select the memory region in immovable node to process

2017-11-09 Thread Chao Fan
On Fri, Nov 10, 2017 at 11:14:37AM +0800, Baoquan He wrote: >On 11/10/17 at 11:03am, Chao Fan wrote: >> On Thu, Nov 09, 2017 at 04:21:32PM +0800, Baoquan He wrote: >> >Hi Chao, >> > >> >On 11/01/17 at 07:32pm, Chao Fan wrote: >> >> Compare the regio

Re: [PATCH v3 1/4] kaslr: add immovable_mem=nn[KMG]@ss[KMG] to specify extracting memory

2017-12-06 Thread Chao Fan
On Thu, Dec 07, 2017 at 12:58:06PM +0800, Baoquan He wrote: >On 12/07/17 at 12:16pm, Dou Liyang wrote: >> Hi All, >> >> At 12/07/2017 11:56 AM, Chao Fan wrote: >> > On Thu, Dec 07, 2017 at 11:09:24AM +0800, Baoquan He wrote: >> > > On 12/07/17 at 10:53a

Re: [PATCH v3 1/4] kaslr: add immovable_mem=nn[KMG]@ss[KMG] to specify extracting memory

2017-12-06 Thread Chao Fan
On Thu, Dec 07, 2017 at 11:09:24AM +0800, Baoquan He wrote: >On 12/07/17 at 10:53am, Chao Fan wrote: >> On Wed, Dec 06, 2017 at 05:35:57PM +0800, Baoquan He wrote: >> >Hi Chao, >> > >> >Yes, now the code looks much better than the last version. >> &g

Re: [PATCH v3 4/4] document: change the document for immovable_mem

2017-12-05 Thread Chao Fan
On Tue, Dec 05, 2017 at 09:36:24AM -0800, Randy Dunlap wrote: >On 12/05/2017 12:52 AM, Chao Fan wrote: >> Add the document for the change of new parameter >> immovable_mem=nn[KMG]@ss[KMG]. >> >> Cc: linux-...@vger.kernel.org >> Cc: Jonathan Corbet <cor...

Re: [PATCH v3 1/4] kaslr: add immovable_mem=nn[KMG]@ss[KMG] to specify extracting memory

2017-12-05 Thread Chao Fan
On Tue, Dec 05, 2017 at 11:42:42AM -0800, Kees Cook wrote: >On Tue, Dec 5, 2017 at 12:51 AM, Chao Fan <fanc.f...@cn.fujitsu.com> wrote: >> In current code, kaslr may choose the memory region in movable >> nodes to extract kernel, which will make the nodes can't be hot-remove

Re: [PATCH v3 1/4] kaslr: add immovable_mem=nn[KMG]@ss[KMG] to specify extracting memory

2017-12-06 Thread Chao Fan
On Wed, Dec 06, 2017 at 05:35:57PM +0800, Baoquan He wrote: >Hi Chao, > >Yes, now the code looks much better than the last version. > >On 12/05/17 at 04:51pm, Chao Fan wrote: >> In current code, kaslr may choose the memory region in movable >> nodes to extract kernel

Re: [PATCH v3 2/4] kaslr: calculate the memory region in immovable node

2017-12-06 Thread Chao Fan
On Wed, Dec 06, 2017 at 05:28:00PM +0800, Baoquan He wrote: >On 12/05/17 at 11:40am, Kees Cook wrote: >> On Tue, Dec 5, 2017 at 12:51 AM, Chao Fan <fanc.f...@cn.fujitsu.com> wrote: >> > If there is no immovable memory region specified, go on the old code. >> > Th

Re: [PATCH v3 2/4] kaslr: calculate the memory region in immovable node

2017-12-06 Thread Chao Fan
On Wed, Dec 06, 2017 at 04:11:04PM -0800, Kees Cook wrote: >On Wed, Dec 6, 2017 at 2:02 AM, Chao Fan <fanc.f...@cn.fujitsu.com> wrote: >> On Wed, Dec 06, 2017 at 05:28:00PM +0800, Baoquan He wrote: >>>On 12/05/17 at 11:40am, Kees Cook wrote: >>>> On Tue, Dec 5

Re: [PATCH v4 1/4] kaslr: add immovable_mem=nn[KMG]@ss[KMG] to specify extracting memory

2017-12-12 Thread Chao Fan
On Tue, Dec 12, 2017 at 08:07:02PM +0800, Chao Fan wrote: >In current code, kaslr may choose the memory region in movable >nodes to extract kernel, which will make the nodes can't be hot-removed. >To solve it, we can specify the memory region in immovable node. >Create immovable_

[PATCH v4 0/4] aslr: add parameter immovable_mem=nn[KMG]@ss[KMG] to make memory hotplug work well with kaslr

2017-12-12 Thread Chao Fan
;process_immovable_mem" to "process_mem_region" Follow Baoquan's suggestion: - Fail KASLR if "movable_node" specified without "immovable_mem" - Ajust the code place of handling mem_region directely if no immovable_mem specified Follow Randy's suggestion: - Chan

[PATCH v4 1/4] kaslr: add immovable_mem=nn[KMG]@ss[KMG] to specify extracting memory

2017-12-12 Thread Chao Fan
thout "immovable_mem=", disable KASLR. Multiple regions can be specified, comma delimited. Considering the usage of memory, only support for 4 regions. 4 regions contains 2 nodes at least, enough for kernel to extract. Signed-off-by: Chao Fan <fanc.f...@cn.fujitsu.com> --- arch/x86/b

[PATCH v4 2/4] kaslr: calculate the memory region in immovable node

2017-12-12 Thread Chao Fan
and immovable memory. Rename process_mem_region to slots_count to match slots_fetch_random, and rename new function sa process_mem_region. Signed-off-by: Chao Fan <fanc.f...@cn.fujitsu.com> --- arch/x86/boot/compressed/kaslr.c | 65 +--- 1 file chang

[PATCH v4 3/4] kaslr: disable memory mirror feature when movable_node

2017-12-12 Thread Chao Fan
In kernel code, if movable_node specified, it will skip the mirror feature. So we should also skip mirror feature in kaslr. Cc: linux-...@vger.kernel.org Cc: Jonathan Corbet <cor...@lwn.net> Cc: Randy Dunlap <rdun...@infradead.org> Signed-off-by: Chao Fan <fanc.f...@cn.fujitsu.com

[PATCH v4 4/4] document: change the document for immovable_mem

2017-12-12 Thread Chao Fan
Add the document for the change of new parameter immovable_mem=nn[KMG][@ss[KMG]]. Signed-off-by: Chao Fan <fanc.f...@cn.fujitsu.com> --- Documentation/admin-guide/kernel-parameters.txt | 10 ++ 1 file changed, 10 insertions(+) diff --git a/Documentation/admin-guide/kernel-paramete

Re: [PATCH v4 2/4] kaslr: calculate the memory region in immovable node

2017-12-12 Thread Chao Fan
On Tue, Dec 12, 2017 at 08:07:03PM +0800, Chao Fan wrote: >kaslr: calculate the memory region in immovable node > >If there is no immovable memory region specified, use region directely. >There are several conditons: >1. CONFIG_MEMORY_HOTPLUG is not specified to y. &g

Re: [PATCH v4 1/4] kaslr: add immovable_mem=nn[KMG]@ss[KMG] to specify extracting memory

2017-12-12 Thread Chao Fan
On Tue, Dec 12, 2017 at 08:07:02PM +0800, Chao Fan wrote: >In current code, kaslr may choose the memory region in movable >nodes to extract kernel, which will make the nodes can't be hot-removed. >To solve it, we can specify the memory region in immovable node. >Create immovable_

Re: [PATCH 1/2] x86/boot/KASLR: Add two functions for 1GB huge pages handling

2018-05-16 Thread Chao Fan
tmp.start = addr + i*PUD_SIZE; >+ tmp.size = size; >+ store_slot_info(, image_size); >+} I have another question not related to kaslr. Here you try to avoid the memory from addr to (addr + i * PUD_SIZE), but I wonder if after walking all memory regions, 'max_gb_huge_pages' is still more than 0, which means there isn't enough memory slots for huge page, what will happen? Thanks, Chao Fan >+} >+ > static unsigned long slots_fetch_random(void) > { > unsigned long slot; >-- >2.13.6 > > >

Re: [PATCH 1/2] x86/boot/KASLR: Add two functions for 1GB huge pages handling

2018-05-16 Thread Chao Fan
On Thu, May 17, 2018 at 12:03:43PM +0800, Baoquan He wrote: >Hi Chao, > >On 05/17/18 at 11:27am, Chao Fan wrote: >> >+/* Store the number of 1GB huge pages which user specified.*/ >> >+static unsigned long max_gb_huge_pages; >> >+ >> >+static i

[RFC PATCH 3/4] x86/boot/KASLR: Walk srat tables to filter immovable memory

2018-06-12 Thread Chao Fan
If 'CONFIG_MEMORY_HOTREMOVE' specified, walk the acpi srat memory tables, store the immovable memory regions, so that kaslr can get the information abouth where can be selected or not. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/kaslr.c | 55 1 file

[RFC PATCH 0/4] x86/boot/KASLR: Parse ACPI table and limit kaslr in immovable memory.

2018-06-12 Thread Chao Fan
. Chao Fan (4): x86/boot: Add acpitb.h to help parse acpi tables x86/boot: Add acpitb.c to parse acpi tables x86/boot/KASLR: Walk srat tables to filter immovable memory x86/boot/KASLR: Limit kaslr to choosing the immovable memory arch/x86/boot/compressed/Makefile | 1 + arch/x86/boot

[RFC PATCH 2/4] x86/boot: Add acpitb.c to parse acpi tables

2018-06-12 Thread Chao Fan
To get more information about memory, acpi tables should be parsed. But can't use ACPI code directely, so imitate the ACPI code to dig the useful srat tables from ACPI tables. Only dig the useful tables, and don't influence the initialization of ACPI. Signed-off-by: Chao Fan --- arch/x86/boot

[RFC PATCH 1/4] x86/boot: Add acpitb.h to help parse acpi tables

2018-06-12 Thread Chao Fan
tables in 'compressed' directory. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/acpitb.h | 175 ++ 1 file changed, 175 insertions(+) create mode 100644 arch/x86/boot/compressed/acpitb.h diff --git a/arch/x86/boot/compressed/acpitb.h b/arch/x86/boot/compressed

[RFC PATCH 4/4] x86/boot/KASLR: Limit kaslr to choosing the immovable memory

2018-06-12 Thread Chao Fan
as process_mem_region. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/kaslr.c | 65 ++-- 1 file changed, 54 insertions(+), 11 deletions(-) diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c index 4edff0501540..a0a07e549ef8 100644

Re: [RFC PATCH 0/4] x86/boot/KASLR: Parse ACPI table and limit kaslr in immovable memory.

2018-07-02 Thread Chao Fan
On Mon, Jul 02, 2018 at 08:18:55PM +0800, Baoquan He wrote: >Hi Chao, > >On 06/12/18 at 04:10pm, Chao Fan wrote: >> *** Issues need be discussed >> There are several issues I am not quite sure, please help review and >> give suggestions: >> >> 1) In PATCH

Re: [RFC PATCH 0/4] x86/boot/KASLR: Parse ACPI table and limit kaslr in immovable memory.

2018-07-02 Thread Chao Fan
On Tue, Jul 03, 2018 at 09:39:02AM +0800, Baoquan He wrote: >On 07/03/18 at 09:32am, Chao Fan wrote: >> On Mon, Jul 02, 2018 at 08:18:55PM +0800, Baoquan He wrote: >> >Hi Chao, >> > >> >On 06/12/18 at 04:10pm, Chao Fan wrote: >> >> *** Issues need

Re: [PATCH 1/4] kaslr: parse the extended movable_node=nn[KMG]@ss[KMG]

2017-10-20 Thread Chao Fan
>"...movable_node=128G@128G movable_node=128G@256G..." > Yes, you are right. I thought users will specify the regions like this: movable_node=1G@2G,1G@4G If users want to use movable_node=1G@2G movable_node=1G@4G Your suggestion is helpful and I will update it. Thanks, Chao Fan >then, you will find the problem of you code. > >Thanks, > dou

Re: [PATCH 0/4] kaslr: extend movable_node to movable_node=nn[KMG]@ss[KMG]

2017-10-19 Thread Chao Fan
On Fri, Oct 20, 2017 at 10:37:52AM +0800, Dou Liyang wrote: >Hi Chao, > Hi Dou-san, >Cheer! I have some concerns below. Thanks for your reply. > >At 10/19/2017 06:02 PM, Chao Fan wrote: >> Here is a problem: >> Here is a machine with several NUMA nodes and som

Re: [PATCH 1/4] kaslr: parse the extended movable_node=nn[KMG]@ss[KMG]

2017-10-19 Thread Chao Fan
On Fri, Oct 20, 2017 at 11:04:42AM +0800, Dou Liyang wrote: >Hi Chao, > Hi Dou-san, >At 10/19/2017 06:02 PM, Chao Fan wrote: >> Extend the movable_node to movable_node=nn[KMG]@ss[KMG]. >> Since in current code, kaslr may choose the memory region in hot-pluggable >>

Re: [PATCH 2/4] kaslr: select the memory region in immovable node to process

2017-10-19 Thread Chao Fan
On Fri, Oct 20, 2017 at 11:17:26AM +0800, Dou Liyang wrote: >Hi Chao > Hi Dou-san, >At 10/19/2017 06:02 PM, Chao Fan wrote: >> Since the interrelationship between e820 or efi entries and memory >> region in immovable_mem is different: >> One memory region in one node

Re: [PATCH 1/4] kaslr: parse the extended movable_node=nn[KMG]@ss[KMG]

2017-10-19 Thread Chao Fan
On Fri, Oct 20, 2017 at 11:41:19AM +0800, Dou Liyang wrote: > > >At 10/20/2017 11:22 AM, Chao Fan wrote: >> On Fri, Oct 20, 2017 at 11:04:42AM +0800, Dou Liyang wrote: >> > Hi Chao, >> > >> Hi Dou-san, >> >> > At 10/19/2017 06:02 PM, Chao Fan

Re: [PATCH 0/4] kaslr: extend movable_node to movable_node=nn[KMG]@ss[KMG]

2017-10-19 Thread Chao Fan
On Fri, Oct 20, 2017 at 11:37:11AM +0800, Dou Liyang wrote: >Hi Chao, > >At 10/20/2017 10:53 AM, Chao Fan wrote: >> On Fri, Oct 20, 2017 at 10:37:52AM +0800, Dou Liyang wrote: >> > Hi Chao, >> > >> Hi Dou-san, >> >> > Cheer! I

Re: [PATCH 4/4] kaslr: clean up a useless variable and some usless space

2017-10-19 Thread Chao Fan
On Fri, Oct 20, 2017 at 11:19:48AM +0800, Dou Liyang wrote: >Hi Chao, > >At 10/19/2017 06:02 PM, Chao Fan wrote: >> There are two same variable "rc" in this function. One is in the >> circulation, the other is out of the circulation. The one out will never >> b

Re: [PATCH v5 1/4] kaslr: add immovable_mem=nn[KMG]@ss[KMG] to specify extracting memory

2018-01-04 Thread Chao Fan
On Thu, Jan 04, 2018 at 06:30:57PM +0800, Baoquan He wrote: >On 01/04/18 at 04:02pm, Chao Fan wrote: >> In current code, kaslr may choose the memory region in movable >> nodes to extract kernel, which will make the nodes can't be hot-removed. >> To solve it, we can spec

Re: [PATCH v5 1/4] kaslr: add immovable_mem=nn[KMG]@ss[KMG] to specify extracting memory

2018-01-08 Thread Chao Fan
On Mon, Jan 08, 2018 at 09:39:54AM -0500, Luiz Capitulino wrote: >On Fri, 5 Jan 2018 10:58:11 +0800 >Chao Fan <fanc.f...@cn.fujitsu.com> wrote: > >> On Thu, Jan 04, 2018 at 06:30:57PM +0800, Baoquan He wrote: >> >On 01/04/18 at 04:02pm, Chao Fan wrote: >>

[PATCH v5 1/4] kaslr: add immovable_mem=nn[KMG]@ss[KMG] to specify extracting memory

2018-01-04 Thread Chao Fan
thout "immovable_mem=", disable KASLR. Multiple regions can be specified, comma delimited. Considering the usage of memory, only support for 4 regions. 4 regions contains 2 nodes at least, enough for kernel to extract. Signed-off-by: Chao Fan <fanc.f...@cn.fujitsu.com> --- arch/x86/b

[PATCH v5 2/4] kaslr: calculate the memory region in immovable node

2018-01-04 Thread Chao Fan
to slots_count to match slots_fetch_random, and rename new function sa process_mem_region. Signed-off-by: Chao Fan <fanc.f...@cn.fujitsu.com> --- arch/x86/boot/compressed/kaslr.c | 67 +--- 1 file changed, 56 insertions(+), 11 deletions(-) diff --git a/ar

[PATCH v5 0/4] kaslr: add parameter immovable_mem=nn[KMG]@ss[KMG] to make memory hotplug work well with kaslr

2018-01-04 Thread Chao Fan
: - Change the mistake and add detailed description for the document. v4->v5: - Change the problem reported by LKP Follow Dou's suggestion: - Also return if match "movable_node" when parsing kernel commandline in handle_mem_filter without define CONFIG_MEMORY_HOTPLUG Chao Fan (4): kasl

[PATCH v5 3/4] kaslr: disable memory mirror feature when movable_node

2018-01-04 Thread Chao Fan
In kernel code, if movable_node specified, it will skip the mirror feature. So we should also skip mirror feature in kaslr. Signed-off-by: Chao Fan <fanc.f...@cn.fujitsu.com> --- arch/x86/boot/compressed/kaslr.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/arch/x86/boot/comp

[PATCH v6 0/5] kaslr: add parameter kaslr_mem=nn[KMG][@|!ss[KMG]]

2018-01-15 Thread Chao Fan
d by LKP Follow Dou's suggestion: - Also return if match "movable_node" when parsing kernel commandline in handle_mem_filter without define CONFIG_MEMORY_HOTPLUG v5->v6: - Add the last patch to save the avoid memory regions. Chao Fan (5): kaslr: add kaslr_mem=nn[KMG]@ss[KMG]

Re: [PATCH v6 5/5] kaslr: add kaslr_mem=nn[KMG]!ss[KMG] to avoid memory regions

2018-01-15 Thread Chao Fan
On Tue, Jan 16, 2018 at 08:43:20AM +0800, Baoquan He wrote: >On 01/15/18 at 08:49pm, Chao Fan wrote: >> Hi Luiz, >> >> I don't know if this patch is OK for you. >> Of coure you can only use kaslr_mem=nn@ss to solve the 1G huge page >> issue. Because we know

Re: [PATCH v6 1/5] kaslr: add kaslr_mem=nn[KMG]@ss[KMG] to specify extracting memory

2018-01-15 Thread Chao Fan
On Mon, Jan 15, 2018 at 02:40:35PM -0800, Randy Dunlap wrote: >On 01/15/2018 04:40 AM, Chao Fan wrote: >> In current code, kaslr only has a method to avoid some memory regions, >> but no method to specify the regions for kaslr to extract. So kaslr >> may choose the wrong posi

[PATCH v6 5/5] kaslr: add kaslr_mem=nn[KMG]!ss[KMG] to avoid memory regions

2018-01-15 Thread Chao Fan
in this period. It can help users to avoid more memory regions, not only the 1G huge huge page issue. Signed-off-by: Chao Fan <fanc.f...@cn.fujitsu.com> --- arch/x86/boot/compressed/kaslr.c | 56 +++- 1 file changed, 50 insertions(+), 6 deletions(-) diff --git a/ar

Re: [PATCH v6 1/5] kaslr: add kaslr_mem=nn[KMG]@ss[KMG] to specify extracting memory

2018-01-15 Thread Chao Fan
On Mon, Jan 15, 2018 at 08:40:12PM +0800, Chao Fan wrote: >In current code, kaslr only has a method to avoid some memory regions, >but no method to specify the regions for kaslr to extract. So kaslr >may choose the wrong position sometimes, which will cause some other >features f

[PATCH v6 1/5] kaslr: add kaslr_mem=nn[KMG]@ss[KMG] to specify extracting memory

2018-01-15 Thread Chao Fan
handle_mem_filter", since it will not only handle memmap parameter now. Multiple regions can be specified, comma delimited. Considering the usage of memory, only support for 4 regions. 4 regions contains 2 nodes at least, enough for kernel to extract. Signed-off-by: Chao Fan <fanc.f...@c

[PATCH v6 3/5] kaslr: disable memory mirror feature when movable_node

2018-01-15 Thread Chao Fan
In kernel code, if movable_node specified, it will skip the mirror feature. So we should also skip mirror feature in kaslr. Signed-off-by: Chao Fan <fanc.f...@cn.fujitsu.com> --- arch/x86/boot/compressed/kaslr.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/arch/x86/boot/comp

[PATCH v8 3/5] x86/KASLR: Give a warning if movable_node specified without kaslr_mem=

2018-01-23 Thread Chao Fan
Since only 'movable_node' specified without 'kaslr_mem=' may break memory hotplug, so reconmmend users using 'kaslr_mem=' when 'movable_node' specified. Acked-by: Baoquan He <b...@redhat.com> Signed-off-by: Chao Fan <fanc.f...@cn.fujitsu.com> --- arch/x86/boot/compressed/

[PATCH v8 1/5] x86/KASLR: Add kaslr_mem=nn[KMG]@ss[KMG]

2018-01-23 Thread Chao Fan
regions, this will make memory hotplug fail. With the help of 'kaslr_mem=', limit kernel in those immovable regions specified. Tested-by: Luiz Capitulino <lcapitul...@redhat.com> Acked-by: Baoquan He <b...@redhat.com> Signed-off-by: Chao Fan <fanc.f...@cn.fujitsu.com> --- arch/x

  1   2   3   4   5   6   >