[PATCHv2 3/3] arm64: read VA_BITS from kcore for 52-bits VA kernel

2021-12-16 Thread Pingfan Liu
phys_to_virt() calculates virtual address. As a important factor, page_offset is excepted to be accurate. Since arm64 kernel exposes va_bits through vmcore, using it. Signed-off-by: Pingfan Liu --- kexec/arch/arm64/kexec-arm64.c | 34 ++ util_lib/elf_info.c

[PATCHv2 2/3] arm64/crashdump: unify routine to get page_offset

2021-12-16 Thread Pingfan Liu
There are two funcs to get page_offset: get_kernel_page_offset() get_page_offset() Since get_kernel_page_offset() does not observe the kernel formula, and remove it. Unify them in order to introduce 52-bits VA kernel more easily in the coming patch. Signed-off-by: Pingfan Liu ---

[PATCHv2 1/3] arm64: make phys_offset signed

2021-12-16 Thread Pingfan Liu
After kernel commit 7bc1a0f9e176 ("arm64: mm: use single quantity to represent the PA to VA translation"), phys_offset can be negative if running 52-bits kernel on 48-bits hardware. So changing phys_offset from unsigned to signed. Signed-off-by: Pingfan Liu --- kexec/arch/arm64/kexec-arm64.c |

[PATCHv2 0/3] arm64: make phys_to_virt() correct

2021-12-16 Thread Pingfan Liu
Currently phys_to_virt() does not work well on 52-bits VA arm64 kernel. One issue is contributed by phys_offset not signed. The other is contributed by wrong page_offset. v1 -> v2 Fix broken patch [2/3] in v1 Move arch_scan_vmcoreinfo declaration to util_lib/include/elf_info.h Using UINT64_MAX

Re: [PATCH v17 03/10] x86: kdump: use macro CRASH_ADDR_LOW_MAX in functions reserve_crashkernel()

2021-12-16 Thread Leizhen (ThunderTown)
On 2021/12/16 22:48, Borislav Petkov wrote: > On Thu, Dec 16, 2021 at 08:08:30PM +0800, Leizhen (ThunderTown) wrote: >> If the memory of 'crash_base' is successfully allocated at (1), because the >> last >> parameter CRASH_ADDR_LOW_MAX is the upper bound, so we can sure that >> "crash_base <

Re: [PATCH v17 03/10] x86: kdump: use macro CRASH_ADDR_LOW_MAX in functions reserve_crashkernel()

2021-12-16 Thread Borislav Petkov
On Thu, Dec 16, 2021 at 10:11:15PM +0800, Baoquan He wrote: > As for the code refactoring, it can be done in another patchset. Well, I said "future work" before having seen where this patchset is going. So no, in that case, the usual kernel development process is: cleanups/fixes first - new

Re: [PATCH v17 05/10] x86: kdump: move reserve_crashkernel[_low]() into crash_core.c

2021-12-16 Thread Borislav Petkov
On Thu, Dec 16, 2021 at 09:15:18PM +0800, Leizhen (ThunderTown) wrote: > I agree with you. This makes the code look clear. I will do it, try to > post v18 next Monday. Don't rush it: take your time, do it nice and clean, make sure each patch does one logical thing only so that there are no bugs

Re: [PATCH v17 03/10] x86: kdump: use macro CRASH_ADDR_LOW_MAX in functions reserve_crashkernel()

2021-12-16 Thread Borislav Petkov
On Thu, Dec 16, 2021 at 08:08:30PM +0800, Leizhen (ThunderTown) wrote: > If the memory of 'crash_base' is successfully allocated at (1), because the > last > parameter CRASH_ADDR_LOW_MAX is the upper bound, so we can sure that > "crash_base < CRASH_ADDR_LOW_MAX". So that,

Re: [PATCH v17 03/10] x86: kdump: use macro CRASH_ADDR_LOW_MAX in functions reserve_crashkernel()

2021-12-16 Thread Baoquan He
On 12/16/21 at 11:55am, Borislav Petkov wrote: > On Thu, Dec 16, 2021 at 09:10:40AM +0800, Baoquan He wrote: > > reserve_crashkernel_low() always return 0 on x86_32, so the not equivalent > > transformation for x86_32 doesn't matter, I think. > > That is, of course, very obvious... not! > > Why

Re: [PATCH v17 05/10] x86: kdump: move reserve_crashkernel[_low]() into crash_core.c

2021-12-16 Thread Leizhen (ThunderTown)
On 2021/12/16 19:17, Borislav Petkov wrote: > On Fri, Dec 10, 2021 at 02:55:28PM +0800, Zhen Lei wrote: >> + * reserve_crashkernel() - reserves memory for crash kernel >> + * >> + * This function reserves memory area given in "crashkernel=" kernel command >> + * line parameter. The memory

Re: [PATCH v17 03/10] x86: kdump: use macro CRASH_ADDR_LOW_MAX in functions reserve_crashkernel()

2021-12-16 Thread Leizhen (ThunderTown)
On 2021/12/16 20:08, Leizhen (ThunderTown) wrote: > > > On 2021/12/16 19:07, Borislav Petkov wrote: >> On Thu, Dec 16, 2021 at 10:46:12AM +0800, Leizhen (ThunderTown) wrote: >>> The original value (1ULL << 32) is inaccurate >> >> I keep asking *why*? >> >>> and it enlarged the CRASH_ADDR_LOW

[PATCH v3 5/5] s390: add support for --reuse-cmdline

2021-12-16 Thread Sven Schnelle
--reuse-cmdline reads the command line of the currently running kernel from /proc/cmdline and uses that for the kernel that should be kexec'd. Signed-off-by: Sven Schnelle Reviewed-by: Alexander Egorenkov --- kexec/arch/s390/include/arch/options.h | 10 ++ kexec/arch/s390/kexec-image.c

Re: [PATCH v17 03/10] x86: kdump: use macro CRASH_ADDR_LOW_MAX in functions reserve_crashkernel()

2021-12-16 Thread Leizhen (ThunderTown)
On 2021/12/16 19:07, Borislav Petkov wrote: > On Thu, Dec 16, 2021 at 10:46:12AM +0800, Leizhen (ThunderTown) wrote: >> The original value (1ULL << 32) is inaccurate > > I keep asking *why*? > >> and it enlarged the CRASH_ADDR_LOW upper limit. > > $ git grep -E "CRASH_ADDR_LOW\W" > $ > > I

[PATCH v3 2/5] s390: use KEXEC_ALL_OPTIONS

2021-12-16 Thread Sven Schnelle
KEXEC_ALL_OPTIONS could be used instead defining the same array several times. This makes code easier to maintain when new options are added. Suggested-by: Alexander Egorenkov Signed-off-by: Sven Schnelle Reviewed-by: Alexander Egorenkov --- kexec/arch/s390/kexec-image.c | 10 ++ 1

[PATCH v3 4/5] use slurp_proc_file() in get_command_line()

2021-12-16 Thread Sven Schnelle
This way the size of the command line that get_command_line() can handle is no longer fixed. Signed-off-by: Sven Schnelle --- kexec/kexec.c | 26 ++ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/kexec/kexec.c b/kexec/kexec.c index

[PATCH v3 1/5] s390: add variable command line size

2021-12-16 Thread Sven Schnelle
Newer s390 kernels support a command line size longer than 896 bytes. Such kernels contain a new member in the parameter area, which might be utilized by tools like kexec. Older kernels have the location initialized to zero, so we check whether there's a non-zero number present and use that. If

[PATCH v3 3/5] add slurp_proc_file()

2021-12-16 Thread Sven Schnelle
slurp_file() cannot be used to read proc files, as they are returning a size of zero in stat(). Add a function slurp_proc_file() which is similar to slurp_file(), but doesn't require the size of the file to be known. Signed-off-by: Sven Schnelle --- kexec/kexec.c | 51

[PATCH v3 0/5] s390: add support for extended cmdline length

2021-12-16 Thread Sven Schnelle
Hi, this patchset adds support for extended command line lengths on s390. The former limit of 896 has been too short in a some configurations. The linux kernel now provides an additional field in the parameter area which contains the maximum allowed command line length. In older kernels this

Re: [PATCH v17 05/10] x86: kdump: move reserve_crashkernel[_low]() into crash_core.c

2021-12-16 Thread Borislav Petkov
On Fri, Dec 10, 2021 at 02:55:28PM +0800, Zhen Lei wrote: > + * reserve_crashkernel() - reserves memory for crash kernel > + * > + * This function reserves memory area given in "crashkernel=" kernel command > + * line parameter. The memory reserved is used by dump capture kernel when > + * primary

Re: [PATCH v17 03/10] x86: kdump: use macro CRASH_ADDR_LOW_MAX in functions reserve_crashkernel()

2021-12-16 Thread Borislav Petkov
On Thu, Dec 16, 2021 at 10:46:12AM +0800, Leizhen (ThunderTown) wrote: > The original value (1ULL << 32) is inaccurate I keep asking *why*? > and it enlarged the CRASH_ADDR_LOW upper limit. $ git grep -E "CRASH_ADDR_LOW\W" $ I have no clue what you mean here. > This is because when the memory

Re: [PATCH 3/3] arm64: read VA_BITS from kcore for 52-bits VA kernel

2021-12-16 Thread Simon Horman
On Thu, Dec 16, 2021 at 09:59:42AM +0800, Pingfan Liu wrote: > On Wed, Dec 15, 2021 at 9:06 PM signed-off...@vergenet.net:Simon > Horman wrote: > > > > On Fri, Dec 10, 2021 at 11:07:35AM +0800, Pingfan Liu wrote: > > > phys_to_virt() calculates virtual address. As a important factor, > > >

Re: [PATCH v17 03/10] x86: kdump: use macro CRASH_ADDR_LOW_MAX in functions reserve_crashkernel()

2021-12-16 Thread Borislav Petkov
On Thu, Dec 16, 2021 at 09:10:40AM +0800, Baoquan He wrote: > reserve_crashkernel_low() always return 0 on x86_32, so the not equivalent > transformation for x86_32 doesn't matter, I think. That is, of course, very obvious... not! Why is that function parsing crashkernel=XM, and

Re: [PATCH v3 3/5] mm_zone: add function to check if managed dma zone exists

2021-12-16 Thread David Hildenbrand
On 13.12.21 13:27, Baoquan He wrote: > In some places of the current kernel, it assumes that dma zone must have > managed pages if CONFIG_ZONE_DMA is enabled. While this is not always true. > E.g in kdump kernel of x86_64, only low 1M is presented and locked down > at very early stage of boot, so

Re: [PATCH 1/3] vmcore: Convert copy_oldmem_page() to take an iov_iter

2021-12-16 Thread Heiko Carstens
On Mon, Dec 13, 2021 at 08:57:25AM +0100, Christoph Hellwig wrote: > On Mon, Dec 13, 2021 at 12:06:34AM +, Matthew Wilcox (Oracle) wrote: > > Instead of passing in a 'buf' and 'userbuf' argument, pass in an iov_iter. > > s390 needs more work to pass the iov_iter down further, or refactor, > >

Re: [PATCH v3 0/3] Convert vmcore to use an iov_iter

2021-12-16 Thread Baoquan He
On 12/13/21 at 02:39pm, Matthew Wilcox (Oracle) wrote: > For some reason several people have been sending bad patches to fix > compiler warnings in vmcore recently. Here's how it should be done. > Compile-tested only on x86. As noted in the first patch, s390 should > take this conversion a bit