Re: [PATCH v2] x86/boot: Use efi_setup_data for searching RSDP on kexec-ed kernel

2019-04-02 Thread Chao Fan
On Tue, Apr 02, 2019 at 09:53:51AM +, Junichi Nomura wrote: >On Tue, Apr 02, 2019 at 05:41:49PM +0800, Chao Fan wrote: >> [ 77.989030] kexec_core: Starting new kernel >> early console in extract_kernel >> input_data: 0x00017f6033b1 >> input_len: 0

Re: [PATCHv3] x86/boot/KASLR: skip the specified crashkernel region

2019-04-02 Thread Chao Fan
On Tue, Apr 02, 2019 at 02:58:53PM +0800, Pingfan Liu wrote: >On Tue, Apr 2, 2019 at 1:20 PM Chao Fan wrote: >> >> On Tue, Apr 02, 2019 at 12:10:46PM +0800, Pingfan Liu wrote: >> >crashkernel=x@y or or =range1:size1[,range2:size2,...]@offset option may >> or or? &g

Re: [PATCHv3] x86/boot/KASLR: skip the specified crashkernel region

2019-04-01 Thread Chao Fan
d >region. > >Signed-off-by: Pingfan Liu >Cc: Thomas Gleixner >Cc: Ingo Molnar >Cc: Borislav Petkov >Cc: "H. Peter Anvin" >Cc: Baoquan He >Cc: Will Deacon >Cc: Nicolas Pitre >Cc: Pingfan Liu >Cc: Chao Fan >Cc: "Kirill A. Sh

Re: [PATCH v2] x86/boot: Use EFI setup data if provided

2019-03-29 Thread Chao Fan
On Fri, Mar 29, 2019 at 09:37:00AM +, Junichi Nomura wrote: >On 3/29/19 6:16 PM, Borislav Petkov wrote: >> On Fri, Mar 29, 2019 at 05:05:50PM +0800, Chao Fan wrote: >>> But in my code, I am not sure which version will be found firstly, so I >>> write this logic

Re: [PATCH v2 1/4] mm/sparse: Clean up the obsolete code comment

2019-03-26 Thread Chao Fan
On Tue, Mar 26, 2019 at 05:43:48PM +0800, Baoquan He wrote: >On 03/26/19 at 05:36pm, Chao Fan wrote: >> On Tue, Mar 26, 2019 at 05:30:57PM +0800, Baoquan He wrote: >> >On 03/26/19 at 10:23am, Michal Hocko wrote: >> >> On Tue 26-03-19 17:02:24, Baoquan He wrote:

Re: [PATCH v2 1/4] mm/sparse: Clean up the obsolete code comment

2019-03-26 Thread Chao Fan
side, closing with ``*/`` on a line by itself. See Documentation/doc-guide/kernel-doc.rst for more details. Hope that can help you. Thanks, Chao Fan > >> >> Acked-by: Michal Hocko >> > --- >> > v1-v2: >> > Add comments to explain what the returned v

Re: [PATCHv2] x86/boot/KASLR: skip the specified crashkernel reserved region

2019-03-21 Thread Chao Fan
if you post new version, you can add: Tested-by: Chao Fan Thanks, Chao Fan >crashkernel=x@y option may fail to reserve the required memory region if >KASLR puts kernel into the region. To avoid this uncertainty, making KASLR >skip the required region. > >Signed-off-by: Pingfan L

Re: [PATCHv2] x86/boot/KASLR: skip the specified crashkernel reserved region

2019-03-19 Thread Chao Fan
On Wed, Mar 13, 2019 at 12:19:31PM +0800, Pingfan Liu wrote: Hi Pingfan, I wonder your test method and test case. Do you test it in the Qemu guest or real machine. Thanks, Chao Fan >crashkernel=x@y option may fail to reserve the required memory region if >KASLR puts kernel into the

Re: [PATCH v3] x86/boot: Fix incorrect ifdeffery scope

2019-03-03 Thread Chao Fan
On Mon, Mar 04, 2019 at 01:55:46PM +0800, Baoquan He wrote: >The declarations related to immovable memory handling are put out of >the BOOT_COMPRESSED_MISC_H #ifdef scope, wrap them inside. Looks good, thank you for the fix. Thanks, Chao Fan > >Signed-off-by: Baoquan He >---

Re: [PATCH v2] x86/boot: Fix incorrect ifdeffery scope

2019-03-03 Thread Chao Fan
em_regions(void); > #else > static inline int count_immovable_mem_regions(void) { return 0; } > #endif >+ >+#endif If it will look better: +#endif /* BOOT_COMPRESSED_MISC_H */ I am sorry that I should say that in your V1 version, but I really forgot it after noticing that PATCH log. Thanks, Chao Fan >-- >2.17.2 > > >

Re: [PATCH] x86/boot: Fix incorrect ifdeffery scope

2019-03-03 Thread Chao Fan
On Mon, Mar 04, 2019 at 12:18:20PM +0800, Baoquan He wrote: >The declarations related to immovable memory handling are put out of > >Signed-off-by: Baoquan He Are there some problems in your mail tool? I can only see one line in the PATCH log and seems a half sentence. Thanks,

Re: A quesiton about commit 3a63f70bf4c3

2019-03-03 Thread Chao Fan
your effort. Thanks, Chao Fan >3a63f70bf4c3 x86/boot: Early parse RSDP and save it in boot_params > >Findind out those SRAT handling related declarations are out of >BOOT_COMPRESSED_MISC_H ifdeffery. Is this made on purpose? > >Saw "misc.h" is included in several places,

Re: [PATCH] x86/KASLR: always return a value from process_mem_region

2019-03-03 Thread Chao Fan
eturn 1; > } > } >- return 0; > #endif >+ return 0; Make sense, thanks for your PATCH. Thanks, Chao Fan > } > > #ifdef CONFIG_EFI >-- >2.20.1 > > >

Re: [PATCH] x86/boot/KASLR: skip the specified crashkernel reserved region

2019-02-25 Thread Chao Fan
omas Gleixner >Cc: Ingo Molnar >Cc: Borislav Petkov >Cc: "H. Peter Anvin" >Cc: Baoquan He >Cc: Will Deacon >Cc: Nicolas Pitre >Cc: Pingfan Liu >Cc: Chao Fan >Cc: "Kirill A. Shutemov" >Cc: Ard Biesheuvel >Cc: li

Re: [PATCH] x86/boot: Move detecting acpi=off in cmdline to get_rsdp_addr()

2019-02-15 Thread Chao Fan
On Fri, Feb 15, 2019 at 10:28:41AM +0100, Borislav Petkov wrote: >On Fri, Feb 15, 2019 at 05:10:47PM +0800, Chao Fan wrote: >> If "acpi=off" specified in cmdline, the whole functions of acpi.c >> should not work, there is no need to ealy parse RSDP, so detect >> &qu

[PATCH] x86/boot: Move detecting acpi=off in cmdline to get_rsdp_addr()

2019-02-15 Thread Chao Fan
If "acpi=off" specified in cmdline, the whole functions of acpi.c should not work, there is no need to ealy parse RSDP, so detect "acpi=off" in the very first place. Also replace magic number with macro. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/acpi.c | 12

Re: [tip:x86/boot] x86/boot: Early parse RSDP and save it in boot_params

2019-02-13 Thread Chao Fan
On Wed, Feb 13, 2019 at 09:50:10AM +0100, Borislav Petkov wrote: >On Wed, Feb 13, 2019 at 04:12:21PM +0800, Chao Fan wrote: >> Yes, I tried the 32-bit OVMF and rootfs from Guenter. > >Ok, thanks. > >Final version of the fix coming up... Thanks so much for your he

Re: [tip:x86/boot] x86/boot: Early parse RSDP and save it in boot_params

2019-02-13 Thread Chao Fan
On Wed, Feb 13, 2019 at 09:01:27AM +0100, Ard Biesheuvel wrote: >On Wed, 13 Feb 2019 at 08:59, Chao Fan wrote: >> >> On Wed, Feb 13, 2019 at 08:36:12AM +0100, Boris Petkov wrote: >> >On February 13, 2019 2:54:29 AM GMT+01:00, Chao Fan >> > wrote: >> >&

Re: [tip:x86/boot] x86/boot: Early parse RSDP and save it in boot_params

2019-02-12 Thread Chao Fan
On Wed, Feb 13, 2019 at 08:36:12AM +0100, Boris Petkov wrote: >On February 13, 2019 2:54:29 AM GMT+01:00, Chao Fan >wrote: >>Yes, your PATCH really works well. I tried both efi32 OVMF and efi64 >>OVMF, all boot. > >What about the real hardware you are normally testing

Re: [tip:x86/boot] x86/boot: Early parse RSDP and save it in boot_params

2019-02-12 Thread Chao Fan
to work. Chao, please run it too. Yes, your PATCH really works well. I tried both efi32 OVMF and efi64 OVMF, all boot. Thanks, Chao Fan > >Thx. > >--- >diff --git a/arch/x86/boot/compressed/acpi.c b/arch/x86/boot/compressed/acpi.c >index c5a949335d8b..0d97aa8bd01f 100644 >--

Re: [tip:x86/boot] x86/boot: Early parse RSDP and save it in boot_params

2019-02-11 Thread Chao Fan
to work. Chao, please run it too. Ah, I will try and test more then reply to mail list. Thanks, Chao Fan > >Thx. > >--- >diff --git a/arch/x86/boot/compressed/acpi.c b/arch/x86/boot/compressed/acpi.c >index c5a949335d8b..0d97aa8bd01f 100644 >--- a/arch/x86/boot/compressed/acp

Re: [tip:x86/boot] x86/boot: Early parse RSDP and save it in boot_params

2019-02-11 Thread Chao Fan
On Mon, Feb 11, 2019 at 11:08:00AM +0100, Borislav Petkov wrote: >On Mon, Feb 11, 2019 at 05:30:33PM +0800, Chao Fan wrote: >> Yes, I download your ovmf file in linux-build-test/rootfs/firmware/ from >> your link. There are two files, efi32 and efi64. Then I try to run: > >Yo

Re: [tip:x86/boot] x86/boot: Early parse RSDP and save it in boot_params

2019-02-11 Thread Chao Fan
On Mon, Feb 11, 2019 at 09:57:02AM +, Ard Biesheuvel wrote: >On Mon, 11 Feb 2019 at 10:56, Chao Fan wrote: >> >> On Mon, Feb 11, 2019 at 09:46:03AM +, Ard Biesheuvel wrote: >> >On Mon, 11 Feb 2019 at 01:22, Borislav Petkov wrote: >> >> >> &

Re: [tip:x86/boot] x86/boot: Early parse RSDP and save it in boot_params

2019-02-11 Thread Chao Fan
e that you are using the correct stride when >iterating over config_tables. Here I use signature to judge it. If the signature is EFI64_LOADER_SIGNATURE, I will use efi_config_table_64_t, if the signature is EFI32_LOADER_SIGNATURE, I will use efi_config_table_32_t. But the efi32 whose signature is EFI32_LOADER_SIGNATURE points to a address above 4G, I am not sure whether this is normal and works well. Thanks, Chao Fan > >

Re: [tip:x86/boot] x86/boot: Early parse RSDP and save it in boot_params

2019-02-11 Thread Chao Fan
On Fri, Feb 08, 2019 at 11:02:48AM -0800, Guenter Roeck wrote: >Hi, > >On Fri, Feb 01, 2019 at 03:01:11AM -0800, tip-bot for Chao Fan wrote: >> Commit-ID: 3a63f70bf4c3a17f5d9c9bf3bc3288a23bdfefce >> Gitweb: >> https://git.kernel.org/tip/3a63f70bf4c3a17f5d9c9bf

Re: [PATCH v8 0/3] x86/boot/KASLR: Parse ACPI table and limit kaslr in immovable memory

2019-02-10 Thread Chao Fan
t;length; >+ num++; >+ } > } It looks better in another mail where you add a new function. Thanks, Chao Fan > > if (num >= MAX_NUMNODES*2) { >@@ -320,

Re: [tip:x86/boot] x86/boot: Early parse RSDP and save it in boot_params

2019-02-10 Thread Chao Fan
're using a 32-bit EFI BIOS. > >Which begs the question whether EFI system tables can even be mapped at >something above 4G with a 32-bit EFI and whether that could work ok. >Hmm. Thanks for your help. As you said, I am not wure whether 32-bit EFI can map table address above 4G. If the map m

Re: [tip:x86/boot] x86/boot: Early parse RSDP and save it in boot_params

2019-02-10 Thread Chao Fan
On Fri, Feb 08, 2019 at 08:10:24PM +0100, Borislav Petkov wrote: >On Fri, Feb 08, 2019 at 11:02:48AM -0800, Guenter Roeck wrote: >> Hi, >> >> On Fri, Feb 01, 2019 at 03:01:11AM -0800, tip-bot for Chao Fan wrote: >> > Commit-ID: 3a63f70bf4c3a17f5d9c9b

[tip:x86/boot] x86/boot: Parse SRAT table and count immovable memory regions

2019-02-01 Thread tip-bot for Chao Fan
Commit-ID: 02a3e3cdb7f12fb8589e4a2e85d23c9e6544b54a Gitweb: https://git.kernel.org/tip/02a3e3cdb7f12fb8589e4a2e85d23c9e6544b54a Author: Chao Fan AuthorDate: Wed, 23 Jan 2019 19:08:49 +0800 Committer: Borislav Petkov CommitDate: Fri, 1 Feb 2019 11:52:55 +0100 x86/boot: Parse SRAT table

[tip:x86/boot] x86/boot/KASLR: Limit KASLR to extract the kernel in immovable memory only

2019-02-01 Thread tip-bot for Chao Fan
Commit-ID: 690eaa53205769fd5c0c36e3aa737a615135f969 Gitweb: https://git.kernel.org/tip/690eaa53205769fd5c0c36e3aa737a615135f969 Author: Chao Fan AuthorDate: Wed, 23 Jan 2019 19:08:50 +0800 Committer: Borislav Petkov CommitDate: Fri, 1 Feb 2019 11:52:55 +0100 x86/boot/KASLR: Limit

[tip:x86/boot] x86/boot: Early parse RSDP and save it in boot_params

2019-02-01 Thread tip-bot for Chao Fan
Commit-ID: 3a63f70bf4c3a17f5d9c9bf3bc3288a23bdfefce Gitweb: https://git.kernel.org/tip/3a63f70bf4c3a17f5d9c9bf3bc3288a23bdfefce Author: Chao Fan AuthorDate: Wed, 23 Jan 2019 19:08:48 +0800 Committer: Borislav Petkov CommitDate: Fri, 1 Feb 2019 11:52:55 +0100 x86/boot: Early parse RSDP

[tip:x86/boot] x86/boot: Search for RSDP in memory

2019-02-01 Thread tip-bot for Chao Fan
Commit-ID: 93a209d495d7d0bc9b6186a4495934f70402 Gitweb: https://git.kernel.org/tip/93a209d495d7d0bc9b6186a4495934f70402 Author: Chao Fan AuthorDate: Wed, 23 Jan 2019 19:08:47 +0800 Committer: Borislav Petkov CommitDate: Fri, 1 Feb 2019 11:52:55 +0100 x86/boot: Search for RSDP

[tip:x86/boot] x86/boot: Search for RSDP in the EFI tables

2019-02-01 Thread tip-bot for Chao Fan
Commit-ID: 33f0df8d843deb9ec24116dcd79a40ca0ea8e8a9 Gitweb: https://git.kernel.org/tip/33f0df8d843deb9ec24116dcd79a40ca0ea8e8a9 Author: Chao Fan AuthorDate: Wed, 23 Jan 2019 19:08:46 +0800 Committer: Borislav Petkov CommitDate: Fri, 1 Feb 2019 11:52:54 +0100 x86/boot: Search for RSDP

[tip:x86/boot] x86/boot: Add "acpi_rsdp=" early parsing

2019-02-01 Thread tip-bot for Chao Fan
Commit-ID: 3c98e71b42a7d0c14639ccb565ea315f3c887f92 Gitweb: https://git.kernel.org/tip/3c98e71b42a7d0c14639ccb565ea315f3c887f92 Author: Chao Fan AuthorDate: Wed, 23 Jan 2019 19:08:45 +0800 Committer: Borislav Petkov CommitDate: Fri, 1 Feb 2019 11:52:54 +0100 x86/boot: Add "acpi

[tip:x86/boot] x86/boot: Copy kstrtoull() to boot/string.c

2019-02-01 Thread tip-bot for Chao Fan
Commit-ID: de50ce20cd05da4d1a7e5709a12fc23bc0b66be9 Gitweb: https://git.kernel.org/tip/de50ce20cd05da4d1a7e5709a12fc23bc0b66be9 Author: Chao Fan AuthorDate: Wed, 23 Jan 2019 19:08:44 +0800 Committer: Borislav Petkov CommitDate: Fri, 1 Feb 2019 11:52:54 +0100 x86/boot: Copy kstrtoull

Re: [PATCH] x86/boot: Expand __puthex() to print 64-bit value in i386-PAE

2019-01-31 Thread Chao Fan
On Thu, Jan 31, 2019 at 10:20:13PM +0100, Borislav Petkov wrote: >On Thu, Jan 31, 2019 at 04:39:46PM +0800, Chao Fan wrote: >> __puthex() is the only method to print value in compressed boot stage. >> But in i386-PAE, sizeof(unsigned long) is 4, so that the value of >> 64

Re: [PATCH v16 0/7] Parse ACPI table and limit KASLR to choosing immovable memory

2019-01-29 Thread Chao Fan
On Mon, Jan 28, 2019 at 06:51:32PM +0100, Borislav Petkov wrote: >On Wed, Jan 23, 2019 at 07:08:43PM +0800, Chao Fan wrote: >> PATCH 1/7 Copy kstrtoull() to boot/string.c to instead of using >> old simple_strtoull() >> PATCH 2/7 Introduce get_acpi_rsdp() to parse

Re: [PATCH v16 5/7] x86/boot: Early parse RSDP and fill in boot_params

2019-01-23 Thread Chao Fan
On Wed, Jan 23, 2019 at 07:08:48PM +0800, Chao Fan wrote: [...] > #endif /* CONFIG_ACPI */ >diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c >index 8dd1d5ccae58..86fa8bf56d68 100644 >--- a/arch/x86/boot/compressed/misc.c >+++ b/arch/x86/boot/co

[PATCH v16 5/7] x86/boot: Early parse RSDP and fill in boot_params

2019-01-23 Thread Chao Fan
RSDP is needed by both KASLR, so parse it early and fill it in boot_params before KASLR code. RSDP is needed by lots of other code, it would be easier to have it always built-in instead of a long "depends on" line in Kconfig. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/Mak

[PATCH v16 4/7] x86/boot: Introduce bios_get_rsdp_addr() to search RSDP in memory

2019-01-23 Thread Chao Fan
scan memory for the RSDP and verify RSDP by signature and checksum. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/acpi.c | 83 + 1 file changed, 83 insertions(+) diff --git a/arch/x86/boot/compressed/acpi.c b/arch/x86/boot/compressed/acpi.c index 75b3ce4356f4

[PATCH v16 0/7] Parse ACPI table and limit KASLR to choosing immovable memory

2019-01-23 Thread Chao Fan
ore conditions, so remove the 'RFC' tag. - Change some comments. v1->v2: - Simplify some code. Follow Baoquan He's suggestion: - Reuse the head file of acpi code. Any comments will be welcome. Chao Fan (7): x86/boot: Copy kstrtoull() to boot/string.c instead of simple_strtoull() x86/boo

[PATCH v16 7/7] x86/boot/KASLR: Limit KASLR to extracting kernel in immovable memory

2019-01-23 Thread Chao Fan
CONFIG_EARLY_SRAT_PARSE is enabled, walk through SRAT to get the information of immovable memory so that KASLR knows where should be chosen for randomization. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/kaslr.c | 72 +++- arch/x86/boot/compressed/misc.h | 1 + 2

[PATCH v16 3/7] x86/boot: Introduce efi_get_rsdp_addr() to find RSDP from EFI table

2019-01-23 Thread Chao Fan
. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/acpi.c | 82 + 1 file changed, 82 insertions(+) diff --git a/arch/x86/boot/compressed/acpi.c b/arch/x86/boot/compressed/acpi.c index bacfc4ea35ac..75b3ce4356f4 100644 --- a/arch/x86/boot/compressed/acpi.c

[PATCH v16 1/7] x86/boot: Copy kstrtoull() to boot/string.c instead of simple_strtoull()

2019-01-23 Thread Chao Fan
. The solution is to separate the dividend to upper and lower in boot/string.o. So copy the useful div_u64() and div_u64_rem() to boot/string.c also. To avoid redefinition in i386, rename them as __div_u64() and __div_u64_rem(). Signed-off-by: Chao Fan --- arch/x86/boot/string.c | 141

[PATCH v16 6/7] x86/boot: Parse SRAT address from RSDP and store immovable memory

2019-01-23 Thread Chao Fan
SRAT should be parsed by RSDP to fix the conflict between KASLR and memory-hotremove, then filter the immovable memory regions and accoring to the memory information, KASLR can avoid to extract kernel to movable memory regions. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/acpi.c | 122

[PATCH v16 2/7] x86/boot: Introduce get_acpi_rsdp() to parse RSDP in cmdline from KEXEC

2019-01-23 Thread Chao Fan
, 'acpi_rsdp=' may have been added to cmdline, so parse cmdline to find RSDP. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/acpi.c | 32 arch/x86/boot/compressed/misc.h | 3 +++ 2 files changed, 35 insertions(+) create mode 100644 arch/x86/boot/compressed

Re: [PATCH v2 2/2] x86, kexec_file_load: make it work with efi=noruntime or efi=old_map

2019-01-21 Thread Chao Fan
On Mon, Jan 21, 2019 at 09:29:32AM +0100, Borislav Petkov wrote: >On Mon, Jan 21, 2019 at 09:18:30AM +0800, Chao Fan wrote: >> So I have changed as this method and put in my mail thread, you may not >> notice, so I put here for my function if I need to fill the >> boot_para

Re: [PATCH v15 5/6] x86/boot: Parse SRAT address from RSDP and store immovable memory

2019-01-21 Thread Chao Fan
On Mon, Jan 21, 2019 at 10:45:24AM +0100, Borislav Petkov wrote: >On Mon, Jan 21, 2019 at 05:42:14PM +0800, Chao Fan wrote: >> Or I clear this function as: >> static acpi_physical_address get_rsdp_addr(void) >> { >> acpi_physical_address pa; >&g

Re: [PATCH v15 5/6] x86/boot: Parse SRAT address from RSDP and store immovable memory

2019-01-21 Thread Chao Fan
On Mon, Jan 21, 2019 at 05:33:48PM +0800, Chao Fan wrote: >On Wed, Jan 16, 2019 at 12:01:58PM +0100, Borislav Petkov wrote: >>On Mon, Jan 07, 2019 at 11:22:42AM +0800, Chao Fan wrote: >[...] >>> + >>> +/* Determine RSDP, based on acpi_os_get_root_pointer(). */ >

Re: [PATCH v15 5/6] x86/boot: Parse SRAT address from RSDP and store immovable memory

2019-01-21 Thread Chao Fan
On Wed, Jan 16, 2019 at 12:01:58PM +0100, Borislav Petkov wrote: >On Mon, Jan 07, 2019 at 11:22:42AM +0800, Chao Fan wrote: [...] >> + >> +/* Determine RSDP, based on acpi_os_get_root_pointer(). */ >> +static acpi_physical_address get_rsdp_addr(void) >> +{ >&

Re: [PATCH v2 2/2] x86, kexec_file_load: make it work with efi=noruntime or efi=old_map

2019-01-21 Thread Chao Fan
On Mon, Jan 21, 2019 at 09:29:32AM +0100, Borislav Petkov wrote: >On Mon, Jan 21, 2019 at 09:18:30AM +0800, Chao Fan wrote: >> So I have changed as this method and put in my mail thread, you may not >> notice, so I put here for my function if I need to fill the >> boot_para

Re: [PATCH v2 2/2] x86, kexec_file_load: make it work with efi=noruntime or efi=old_map

2019-01-20 Thread Chao Fan
RAT_PARSE bool "EARLY SRAT parsing" def_bool y depends on RANDOMIZE_BASE && MEMORY_HOTREMOVE && ACPI If I miss something, please let me know. Or in my PATCHSET, I don't need to fill boot_parameters, just leave the job another PATCH? Thanks, Chao Fan > >-- >Regards/Gruss, >Boris. > >Good mailing practices for 400: avoid top-posting and trim the reply. > >

Re: [PATCH v15 5/6] x86/boot: Parse SRAT address from RSDP and store immovable memory

2019-01-17 Thread Chao Fan
On Thu, Jan 17, 2019 at 04:27:51PM +0100, Borislav Petkov wrote: >On Thu, Jan 17, 2019 at 11:20:27AM +0800, Chao Fan wrote: >> I have changed as you suggested, looks clear without type cast, and >> we need some variable as long to calculate the address, and at same >> time

Re: [PATCH v15 5/6] x86/boot: Parse SRAT address from RSDP and store immovable memory

2019-01-16 Thread Chao Fan
On Wed, Jan 16, 2019 at 03:28:52PM +0800, Kairui Song wrote: >On Mon, Jan 7, 2019 at 11:24 AM Chao Fan wrote: >> >> + >> +/* Determine RSDP, based on acpi_os_get_root_pointer(). */ >> +static acpi_physical_address get_rsdp_addr(void) >> +{ >> + acpi_

Re: [PATCH v2 2/2] x86, kexec_file_load: make it work with efi=noruntime or efi=old_map

2019-01-16 Thread Chao Fan
the RSDP to boot_params.acpi_rsdp_addr. By the way, I search kernel code, I didn't find other code fill and use it, only you(KEXEC) are trying to fill it. If I miss something, please let me know. Thanks, Chao Fan > >But if early code should parse it and store it should be done in >Chao'

Re: [PATCH v15 5/6] x86/boot: Parse SRAT address from RSDP and store immovable memory

2019-01-16 Thread Chao Fan
On Wed, Jan 16, 2019 at 12:01:58PM +0100, Borislav Petkov wrote: >On Mon, Jan 07, 2019 at 11:22:42AM +0800, Chao Fan wrote: >> +void get_immovable_mem(void) >> +{ >> +struct acpi_table_header *table_header; >> +struct acpi_subtable_header *table; >> +

Re: [PATCH v15 5/6] x86/boot: Parse SRAT address from RSDP and store immovable memory

2019-01-16 Thread Chao Fan
On Wed, Jan 16, 2019 at 03:28:52PM +0800, Kairui Song wrote: >On Mon, Jan 7, 2019 at 11:24 AM Chao Fan wrote: >> >> + >> +/* Determine RSDP, based on acpi_os_get_root_pointer(). */ >> +static acpi_physical_address get_rsdp_addr(void) >> +{ >> + acpi_

Re: [PATCH v15 6/6] x86/boot/KASLR: Limit KASLR to extracting kernel in immovable memory

2019-01-16 Thread Chao Fan
On Wed, Jan 16, 2019 at 12:15:07PM +0100, Borislav Petkov wrote: >On Mon, Jan 07, 2019 at 11:22:43AM +0800, Chao Fan wrote: >> KASLR may randomly choose some positions which are located in movable >> memory regions. It will break memory hotplug feature and make the >>

Re: [PATCH v15 5/6] x86/boot: Parse SRAT address from RSDP and store immovable memory

2019-01-16 Thread Chao Fan
On Wed, Jan 16, 2019 at 12:01:58PM +0100, Borislav Petkov wrote: >On Mon, Jan 07, 2019 at 11:22:42AM +0800, Chao Fan wrote: [...] >> +rsdp = (struct acpi_table_rsdp *)(long)get_rsdp_addr(); >> +if (!rsdp) >> +return NULL; >> + >> +

Re: [PATCH v15 3/6] x86/boot: Introduce efi_get_rsdp_addr() to find RSDP from EFI table

2019-01-15 Thread Chao Fan
On Tue, Jan 15, 2019 at 10:55:02AM +0100, Borislav Petkov wrote: >On Tue, Jan 15, 2019 at 03:21:21PM +0800, Chao Fan wrote: >> In my understanding after looking into the commit message the comments. >> I thinks yes. For 32-bit OS: > >And when does your "32-bit OS" de

Re: [PATCH v15 3/6] x86/boot: Introduce efi_get_rsdp_addr() to find RSDP from EFI table

2019-01-14 Thread Chao Fan
On Mon, Jan 14, 2019 at 10:07:56AM +0100, Borislav Petkov wrote: >On Mon, Jan 14, 2019 at 09:26:42AM +0800, Chao Fan wrote: >> According to the code, I saw: >> #ifdef ACPI_ASL_COMPILER >> #define ACPI_32BIT_PHYSICAL_ADDRESS >> #endif >> >> and then >>

Re: [PATCH v15 3/6] x86/boot: Introduce efi_get_rsdp_addr() to find RSDP from EFI table

2019-01-13 Thread Chao Fan
On Sun, Jan 13, 2019 at 12:05:45PM +0100, Borislav Petkov wrote: >On Sun, Jan 13, 2019 at 05:47:04PM +0800, Chao Fan wrote: >> 'acpi_physical_address' could be define as u64 or u32. > >And when can acpi_physical_address be a u32? > According to the code, I saw: #ifdef ACPI_AS

Re: [PATCH v15 3/6] x86/boot: Introduce efi_get_rsdp_addr() to find RSDP from EFI table

2019-01-13 Thread Chao Fan
On Fri, Jan 11, 2019 at 11:32:25AM +0100, Borislav Petkov wrote: >On Fri, Jan 11, 2019 at 09:23:53AM +0800, Chao Fan wrote: >> Yes, 'table64' looks superfluous here, but after these lines, there is: >> if (!IS_ENABLED(CONFIG_X86_64) && table64 >

Re: [PATCHv2 1/7] x86/mm: concentrate the code to memblock allocator enabled

2019-01-10 Thread Chao Fan
need the kernel parameter 'movable_node'? Since you have got the memory information about hot-remove, so I wonder if it's OK to drop 'movable_node', and if memory-hotremove is enabled, change memblock allocation according to SRAT. If there is something wrong in my understanding,

Re: [PATCHv2 2/7] acpi: change the topo of acpi_table_upgrade()

2019-01-10 Thread Chao Fan
t;Cc: Peter Zijlstra >Cc: "Rafael J. Wysocki" >Cc: Len Brown >Cc: Yinghai Lu >Cc: Tejun Heo >Cc: Chao Fan >Cc: Baoquan He >Cc: Juergen Gross >Cc: Andrew Morton >Cc: Mike Rapoport >Cc: Vlastimil Babka >Cc: Michal Hocko >Cc: x...@kernel.org >C

Re: [PATCH v15 4/6] x86/boot: Introduce bios_get_rsdp_addr() to search RSDP in memory

2019-01-10 Thread Chao Fan
On Thu, Jan 10, 2019 at 10:27:47PM +0100, Borislav Petkov wrote: >On Mon, Jan 07, 2019 at 11:22:41AM +0800, Chao Fan wrote: >> Memory information in SRAT table is necessary to fix the conflict >> between KASLR and memory-hotremove. So RSDP and SRAT should be parsed. >> >&

Re: [PATCH v15 3/6] x86/boot: Introduce efi_get_rsdp_addr() to find RSDP from EFI table

2019-01-10 Thread Chao Fan
On Thu, Jan 10, 2019 at 10:15:23PM +0100, Borislav Petkov wrote: >On Mon, Jan 07, 2019 at 11:22:40AM +0800, Chao Fan wrote: >> Memory information in SRAT is necessary to fix the conflict between >> KASLR and memory-hotremove. So RSDP and SRAT should be parsed. >> >>

Re: [PATCH v15 2/6] x86/boot: Introduce get_acpi_rsdp() to parse RSDP in cmdline from KEXEC

2019-01-10 Thread Chao Fan
On Thu, Jan 10, 2019 at 06:01:03PM +0100, Borislav Petkov wrote: >On Mon, Jan 07, 2019 at 11:22:39AM +0800, Chao Fan wrote: >> KASLR may randomly choose some positions which are located in movable >> memory regions. This will make the movable memory chosen by KASLR >

Re: [PATCH v15 1/6] x86/boot: Copy kstrtoull() to boot/string.c instead of using simple_strtoull()

2019-01-09 Thread Chao Fan
On Wed, Jan 09, 2019 at 01:48:53PM +0100, Borislav Petkov wrote: >On Mon, Jan 07, 2019 at 11:22:38AM +0800, Chao Fan wrote: >> Copy kstrtoull() and necessary functions from lib/kstrtox.c to >> boot/string.c so that code in boot/ can use kstrtoull() and the old >> simple_strto

Re: [RFC PATCH 0/4] x86_64/mm: remove bottom-up allocation style by pushing forward the parsing of mem hotplug info

2019-01-08 Thread Chao Fan
d1955258091e4c92d5a975ebd7fd8a98f5d30f Author: Tang Chen Date: Fri Feb 22 16:33:44 2013 -0800 acpi, memory-hotplug: parse SRAT before memblock is ready Then, Lu Yinghai tried to do the similar job, you can see: https://lwn.net/Articles/554854/ for more information. Hope that can help you.

[PATCH v15 3/6] x86/boot: Introduce efi_get_rsdp_addr() to find RSDP from EFI table

2019-01-06 Thread Chao Fan
. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/acpi.c | 83 + 1 file changed, 83 insertions(+) diff --git a/arch/x86/boot/compressed/acpi.c b/arch/x86/boot/compressed/acpi.c index 7ca5001d7639..f74c5d033d79 100644 --- a/arch/x86/boot/compressed/acpi.c

[PATCH v15 4/6] x86/boot: Introduce bios_get_rsdp_addr() to search RSDP in memory

2019-01-06 Thread Chao Fan
scan memory for the RSDP and verify RSDP by signature and checksum. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/acpi.c | 86 + 1 file changed, 86 insertions(+) diff --git a/arch/x86/boot/compressed/acpi.c b/arch/x86/boot/compressed/acpi.c index f74c5d033d79

[PATCH v15 1/6] x86/boot: Copy kstrtoull() to boot/string.c instead of using simple_strtoull()

2019-01-06 Thread Chao Fan
. The solution is to separate the dividend to upper and lower in boot/string.o. So copy the useful div_u64() and div_u64_rem() to boot/string.c also. To avoid redefinition in i386, rename them as __div_u64() and __div_u64_rem(). Signed-off-by: Chao Fan --- arch/x86/boot/string.c | 137

[PATCH v15 0/6] x86/boot/KASLR: Parse ACPI table and limit KASLR to choosing immovable memory

2019-01-06 Thread Chao Fan
tub. v2->v3: - Test in more conditions, so remove the 'RFC' tag. - Change some comments. v1->v2: - Simplify some code. Follow Baoquan He's suggestion: - Reuse the head file of acpi code. Any comments will be welcome. Chao Fan (6): x86/boot: Copy kstrtoull() to boot/string.c ins

[PATCH v15 6/6] x86/boot/KASLR: Limit KASLR to extracting kernel in immovable memory

2019-01-06 Thread Chao Fan
CONFIG_EARLY_SRAT_PARSE is enabled, walk through SRAT to get the information of immovable memory so that KASLR knows where should be chosen for randomization. Rename process_mem_region() as __process_mem_region() and name new function as process_mem_region(). Signed-off-by: Chao Fan --- arch/x86/boot

[PATCH v15 2/6] x86/boot: Introduce get_acpi_rsdp() to parse RSDP in cmdline from KEXEC

2019-01-06 Thread Chao Fan
, 'acpi_rsdp=' may have been added to cmdline, so parse cmdline to find RSDP. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/acpi.c | 30 ++ 1 file changed, 30 insertions(+) create mode 100644 arch/x86/boot/compressed/acpi.c diff --git a/arch/x86/boot

[PATCH v15 5/6] x86/boot: Parse SRAT address from RSDP and store immovable memory

2019-01-06 Thread Chao Fan
OTREMOVE' is needed, introduce 'CONFIG_EARLY_SRAT_PARSE' to make ifdeffery clear. Signed-off-by: Chao Fan --- arch/x86/Kconfig | 12 +++ arch/x86/boot/compressed/Makefile | 2 + arch/x86/boot/compressed/acpi.c | 138 ++ arch/x86/boot/compressed

[PATCH] ACPI: Change wrong print type to display the real value for i386-PAE

2018-12-25 Thread Chao Fan
. Signed-off-by: Chao Fan --- drivers/acpi/numa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c index 274699463b4f..7bbbf8256a41 100644 --- a/drivers/acpi/numa.c +++ b/drivers/acpi/numa.c @@ -146,9 +146,9

Re: [PATCH v14 2/5] x86/boot: Introduce efi_get_rsdp_addr() to find RSDP from EFI table

2018-12-24 Thread Chao Fan
et up a debian9-32bit with PAE in QEMU and found size of acpi_physical_address is 8. So they are not always sync. Of course, that doesn't influence the conclusion, since return table directly can always work. It will return u32 to u32, u64 to u64, or u32 to u64. So the typecast about acpi_physical

Re: [PATCH v14 1/5] x86/boot: Introduce get_acpi_rsdp() to parse RSDP in cmdline from KEXEC

2018-12-18 Thread Chao Fan
On Tue, Dec 18, 2018 at 12:28:48PM +0100, Borislav Petkov wrote: >On Tue, Dec 18, 2018 at 09:27:04AM +0800, Chao Fan wrote: >> The basic conflict is the kernel avoiding KASLR-randomizing into >> hot-removable memory areas. > >And this should be in a prominent place in your c

Re: [PATCH v13 1/6] x86/boot: Introduce kstrtoull() to boot directory instead of simple_strtoull()

2018-12-17 Thread Chao Fan
On Mon, Dec 17, 2018 at 04:45:51PM +0100, Borislav Petkov wrote: >On Mon, Dec 17, 2018 at 09:27:28AM +0800, Chao Fan wrote: >> Oops, I thought you agree with what Baoquan said, so I send the new version >> and use simple_strtoull() back. > >I could've misunderstood him. Lem

Re: [PATCH v14 4/5] x86/boot: Parse SRAT address from RSDP and store immovable memory

2018-12-17 Thread Chao Fan
On Mon, Dec 17, 2018 at 06:41:49PM +0100, Ingo Molnar wrote: > >* Chao Fan wrote: > >> SRAT should be parsed by RSDP to fix the conflict between KASLR >> and memory-hotremove, then find the immovable memory regions and store >> them in an array called immovable_mem[].

Re: [PATCH v14 5/5] x86/boot/KASLR: Limit KASLR to extracting kernel in immovable memory

2018-12-17 Thread Chao Fan
On Mon, Dec 17, 2018 at 06:43:24PM +0100, Ingo Molnar wrote: > >* Chao Fan wrote: > >> KASLR randomly chooses some positions which may locate in movable >> memory regions. It will break memory hotplug feature and make the >> movable memory chosen by

Re: [PATCH v14 3/5] x86/boot: Introduce bios_get_rsdp_addr() to search RSDP in memory

2018-12-17 Thread Chao Fan
On Mon, Dec 17, 2018 at 06:38:37PM +0100, Ingo Molnar wrote: > >* Chao Fan wrote: > >> +/* Check the standard checksum */ >> +if (compute_checksum((u8 *) rsdp, ACPI_RSDP_CHECKSUM_LENGTH)) >> +continue; > >Could yo

Re: [PATCH v14 2/5] x86/boot: Introduce efi_get_rsdp_addr() to find RSDP from EFI table

2018-12-17 Thread Chao Fan
On Mon, Dec 17, 2018 at 06:30:32PM +0100, Ingo Molnar wrote: > >* Chao Fan wrote: > >> Memory information in SRAT is necessary to fix the conflict between >> KASLR and memory-hotremove. So RSDP and SRAT should be parsed. >> >> When booting form KEXEC/EFI/

Re: [PATCH v14 1/5] x86/boot: Introduce get_acpi_rsdp() to parse RSDP in cmdline from KEXEC

2018-12-17 Thread Chao Fan
On Mon, Dec 17, 2018 at 06:25:10PM +0100, Ingo Molnar wrote: > >* Chao Fan wrote: > >> Memory information in SRAT is necessary to fix the conflict between >> KASLR and memory-hotremove. >> >> ACPI SRAT (System/Static Resource Affinity Table) shows the details

Re: [PATCH v13 1/6] x86/boot: Introduce kstrtoull() to boot directory instead of simple_strtoull()

2018-12-16 Thread Chao Fan
t you agree with what Baoquan said, so I send the new version and use simple_strtoull() back. Thanks, Chao Fan > >-- >Regards/Gruss, >Boris. > >Good mailing practices for 400: avoid top-posting and trim the reply. > >

[PATCH v14 0/5] x86/boot/KASLR: Parse ACPI table and limit KASLR to choosing immovable memory

2018-12-14 Thread Chao Fan
C' tag. - Change some comments. v1->v2: - Simplify some code. Follow Baoquan He's suggestion: - Reuse the head file of acpi code. Any comments will be welcome. Chao Fan (5): x86/boot: Introduce get_acpi_rsdp() to parse RSDP in cmdline from KEXEC x86/boot: Introduce efi_get_rsdp_ad

[PATCH v14 5/5] x86/boot/KASLR: Limit KASLR to extracting kernel in immovable memory

2018-12-14 Thread Chao Fan
CONFIG_EARLY_PARSE_RSDP is enabled, walk through SRAT to get the information of immovable memory so that KASLR knows where should be chosen for randomization. Rename process_mem_region() as __process_mem_region() and name new function as process_mem_region(). Signed-off-by: Chao Fan --- arch/x86/boot

[PATCH v14 3/5] x86/boot: Introduce bios_get_rsdp_addr() to search RSDP in memory

2018-12-14 Thread Chao Fan
, there is no variable who can point to RSDP directly, so scan memory for the RSDP and verify RSDP by signature and checksum. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/acpi.c | 86 + 1 file changed, 86 insertions(+) diff --git a/arch/x86/boot/compressed

[PATCH v14 4/5] x86/boot: Parse SRAT address from RSDP and store immovable memory

2018-12-14 Thread Chao Fan
OTREMOVE' is needed, introduce 'CONFIG_EARLY_PARSE_RSDP' to make ifdeffery clear. Signed-off-by: Chao Fan --- arch/x86/Kconfig | 12 +++ arch/x86/boot/compressed/Makefile | 2 + arch/x86/boot/compressed/acpi.c | 128 ++ arch/x86/boot/compressed

[PATCH v14 2/5] x86/boot: Introduce efi_get_rsdp_addr() to find RSDP from EFI table

2018-12-14 Thread Chao Fan
. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/acpi.c | 79 + 1 file changed, 79 insertions(+) diff --git a/arch/x86/boot/compressed/acpi.c b/arch/x86/boot/compressed/acpi.c index 44f19546c169..4151881d8713 100644 --- a/arch/x86/boot/compressed/acpi.c

[PATCH v14 1/5] x86/boot: Introduce get_acpi_rsdp() to parse RSDP in cmdline from KEXEC

2018-12-14 Thread Chao Fan
Pointer(RSDP), so RSDP should be found firstly. When booting form KEXEC/EFI/BIOS, the methods to find RSDP are different. When booting from KEXEC, 'acpi_rsdp' may have been added to cmdline, so parse cmdline to find RSDP. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/acpi.c | 30

Re: [PATCH v13 1/6] x86/boot: Introduce kstrtoull() to boot directory instead of simple_strtoull()

2018-12-13 Thread Chao Fan
(), we should copy div_u64(). When trying to include lib/kstrtox.c, even if other error in make period are solved, we will also meet this error. We should also copy div_u64 also. And then cover the math64.h in boot/string.c, and hanlde the other error and warining who comes together. So just like Baoquan said,

Re: [PATCH v13 1/6] x86/boot: Introduce kstrtoull() to boot directory instead of simple_strtoull()

2018-12-13 Thread Chao Fan
n use simple_strtoull() for now. Thanks, Chao Fan > >-- >Regards/Gruss, >Boris. > >Good mailing practices for 400: avoid top-posting and trim the reply. > >

Re: [PATCH v13 2/6] x86/boot: Introduce get_acpi_rsdp() to parse RSDP in cmdline from KEXEC

2018-12-13 Thread Chao Fan
On Thu, Dec 13, 2018 at 02:25:30PM -0500, Masayoshi Mizuma wrote: >Hi Chao, > >Great work! Let me say some trivial comments. Thanks for your help, any comments will be welcome. > >On Wed, Dec 12, 2018 at 11:10:49AM +0800, Chao Fan wrote: >> Memory information in SRA

Re: [PATCH v13 2/6] x86/boot: Introduce get_acpi_rsdp() to parse RSDP in cmdline from KEXEC

2018-12-13 Thread Chao Fan
On Thu, Dec 13, 2018 at 08:42:30PM +0100, Borislav Petkov wrote: >On Wed, Dec 12, 2018 at 11:10:49AM +0800, Chao Fan wrote: >> Memory information in SRAT is necessary to fix the conflict between >> KASLR and memory-hotremove. >> >> ACPI SRAT (System/Static Res

Re: [PATCH v13 3/6] x86/boot: Introduce efi_get_rsdp_addr() to find RSDP from EFI table

2018-12-13 Thread Chao Fan
On Thu, Dec 13, 2018 at 09:23:04PM +0100, Borislav Petkov wrote: >On Wed, Dec 12, 2018 at 11:10:50AM +0800, Chao Fan wrote: >> Memory information in SRAT is necessary to fix the conflict between >> KASLR and memory-hotremove. So RSDP and SRAT should be parsed. >> >>

Re: [PATCH v13 1/6] x86/boot: Introduce kstrtoull() to boot directory instead of simple_strtoull()

2018-12-12 Thread Chao Fan
On Wed, Dec 12, 2018 at 03:46:15PM +0800, Baoquan He wrote: >On 12/12/18 at 11:10am, Chao Fan wrote: >> Introduce kstrtoull() from lib/kstrtox.c to boot directory so that code > >It's not introducing kstrtoull(), just copying kstrtoull() from >lib/kstrtox.c to boot. Oops, may

Re: [PATCH v13 1/6] x86/boot: Introduce kstrtoull() to boot directory instead of simple_strtoull()

2018-12-11 Thread Chao Fan
On Wed, Dec 12, 2018 at 11:10:48AM +0800, Chao Fan wrote: >Introduce kstrtoull() from lib/kstrtox.c to boot directory so that code >in boot/ can use kstrtoull() and the old simple_strtoull() can be >replaced. > Hi all, Thanks for Boris, Baoquan and Masa's help, this PATCHSET h

  1   2   3   4   5   6   >