Re: [PATCH v3 3/3] printk: use the lockless ringbuffer

2020-07-02 Thread Petr Mladek
On Thu 2020-07-02 17:43:22, lijiang wrote: > 在 2020年07月02日 17:02, John Ogness 写道: > > On 2020-07-02, lijiang wrote: > >> About the VMCOREINFO part, I made some tests based on the kernel patch > >> v3, the makedumpfile and crash-utility can work as expected with your > >> patch(userspace patch),

Re: [PATCH 04/11] ppc64/kexec_file: avoid stomping memory used by special regions

2020-07-02 Thread Dave Young
On 07/01/20 at 11:48pm, Hari Bathini wrote: > > > On 01/07/20 1:10 pm, Dave Young wrote: > > Hi Hari, > > On 06/27/20 at 12:35am, Hari Bathini wrote: > >> crashkernel region could have an overlap with special memory regions > >> like opal, rtas, tce-table & such. These regions are referred to

Re: buffer allocation: was: [PATCH v3 3/3] printk: use the lockless ringbuffer

2020-07-02 Thread Petr Mladek
On Mon 2020-06-29 23:57:59, John Ogness wrote: > On 2020-06-29, Petr Mladek wrote: > >> @@ @@ void __init setup_log_buf(int early) > >> + prb_init(_rb_dynamic, > >> + new_log_buf, order_base_2(new_log_buf_len), > >> + new_dict_buf, order_base_2(new_log_buf_len), > >> +

Re: [PATCH 04/11] ppc64/kexec_file: avoid stomping memory used by special regions

2020-07-02 Thread Dave Young
> > I'm confused about the "overlap with crashkernel memory", does that mean > > those normal kernel used memory could be put in crashkernel reserved > > memory range? If so why can't just skip those areas while crashkernel > > doing the reservation? > I raised the same question in another mail.

Re: [PATCH 01/11] kexec_file: allow archs to handle special regions while locating memory hole

2020-07-02 Thread Dave Young
On 07/02/20 at 12:01am, Hari Bathini wrote: > > > On 01/07/20 1:16 pm, Dave Young wrote: > > On 06/29/20 at 05:26pm, Hari Bathini wrote: > >> Hi Petr, > >> > >> On 29/06/20 5:09 pm, Petr Tesarik wrote: > >>> Hi Hari, > >>> > >>> is there any good reason to add two more functions with a very

Re: [PATCH v6 1/2] crash_core, vmcoreinfo: Append 'MAX_PHYSMEM_BITS' to vmcoreinfo

2020-07-02 Thread Dave Young
Hi Catalin, On 07/02/20 at 12:00pm, Catalin Marinas wrote: > On Thu, May 14, 2020 at 12:22:36AM +0530, Bhupesh Sharma wrote: > > diff --git a/kernel/crash_core.c b/kernel/crash_core.c > > index 9f1557b98468..18175687133a 100644 > > --- a/kernel/crash_core.c > > +++ b/kernel/crash_core.c > > @@

Re: [PATCH v6 0/2] Append new variables to vmcoreinfo (TCR_EL1.T1SZ for arm64 and MAX_PHYSMEM_BITS for all archs)

2020-07-02 Thread Bhupesh Sharma
On Thu, Jul 2, 2020 at 10:45 PM Catalin Marinas wrote: > > On Thu, 14 May 2020 00:22:35 +0530, Bhupesh Sharma wrote: > > Apologies for the delayed update. Its been quite some time since I > > posted the last version (v5), but I have been really caught up in some > > other critical issues. > > > >

Re: [PATCH v6 0/2] Append new variables to vmcoreinfo (TCR_EL1.T1SZ for arm64 and MAX_PHYSMEM_BITS for all archs)

2020-07-02 Thread Catalin Marinas
On Thu, 14 May 2020 00:22:35 +0530, Bhupesh Sharma wrote: > Apologies for the delayed update. Its been quite some time since I > posted the last version (v5), but I have been really caught up in some > other critical issues. > > Changes since v5: > > - v5 can be viewed here: >

Re: [PATCH 1/2] mm/memcontrol: Fix OOPS inside mem_cgroup_get_nr_swap_pages()

2020-07-02 Thread Bhupesh Sharma
Hi Michal, On Thu, Jul 2, 2020 at 11:30 AM Michal Hocko wrote: > > On Thu 02-07-20 03:44:19, Bhupesh Sharma wrote: > > Prabhakar reported an OOPS inside mem_cgroup_get_nr_swap_pages() > > function in a corner case seen on some arm64 boards when kdump kernel > > runs with "cgroup_disable=memory"

[PATCH v2 02/12] powerpc/kexec_file: mark PPC64 specific code

2020-07-02 Thread Hari Bathini
Some of the kexec_file_load code isn't PPC64 specific. Move PPC64 specific code from kexec/file_load.c to kexec/file_load_64.c. Also, rename purgatory/trampoline.S to purgatory/trampoline_64.S in the same spirit. Signed-off-by: Hari Bathini --- Changes in v2: * No changes.

[PATCH v2 01/12] kexec_file: allow archs to handle special regions while locating memory hole

2020-07-02 Thread Hari Bathini
Some architectures may have special memory regions, within the given memory range, which can't be used for the buffer in a kexec segment. Implement weak arch_kexec_locate_mem_hole() definition which arch code may override, to take care of special regions, while trying to locate a memory hole.

Re: [PATCH 2/2] arm64: Allocate crashkernel always in ZONE_DMA

2020-07-02 Thread Bhupesh Sharma
Hi Will, On Thu, Jul 2, 2020 at 1:20 PM Will Deacon wrote: > > On Thu, Jul 02, 2020 at 03:44:20AM +0530, Bhupesh Sharma wrote: > > commit bff3b04460a8 ("arm64: mm: reserve CMA and crashkernel in > > ZONE_DMA32") allocates crashkernel for arm64 in the ZONE_DMA32. > > > > However as reported by

[PATCH v2 04/12] ppc64/kexec_file: avoid stomping memory used by special regions

2020-07-02 Thread Hari Bathini
crashkernel region could have an overlap with special memory regions like opal, rtas, tce-table & such. These regions are referred to as exclude memory ranges. Setup this ranges during image probe in order to avoid them while finding the buffer for different kdump segments. Override

[PATCH v2 03/12] powerpc/kexec_file: add helper functions for getting memory ranges

2020-07-02 Thread Hari Bathini
In kexec case, the kernel to be loaded uses the same memory layout as the running kernel. So, passing on the DT of the running kernel would be good enough. But in case of kdump, different memory ranges are needed to manage loading the kdump kernel, booting into it and exporting the elfcore of the

[PATCH v2 07/12] ppc64/kexec_file: add support to relocate purgatory

2020-07-02 Thread Hari Bathini
Right now purgatory implementation is only minimal. But if purgatory code is to be enhanced to copy memory to the backup region and verify sha256 digest, relocations may have to be applied to the purgatory. So, add support to relocate purgatory in kexec_file_load system call by setting up TOC

[PATCH v2 08/12] ppc64/kexec_file: setup the stack for purgatory

2020-07-02 Thread Hari Bathini
To avoid any weird errors, the purgatory should run with its own stack. Set one up by adding the stack buffer to .data section of the purgatory. Also, setup opal base & entry values in r8 & r9 registers to help early OPAL debugging. Signed-off-by: Hari Bathini --- Changes in v2: * Setting up

[PATCH v2 05/12] powerpc/drmem: make lmb walk a bit more flexible

2020-07-02 Thread Hari Bathini
Currently, numa & prom are the users of drmem lmb walk code. Loading kdump with kexec_file also needs to walk the drmem LMBs to setup the usable memory ranges for kdump kernel. But there are couple of issues in using the code as is. One, walk_drmem_lmb() code is built into the .init section

[PATCH v2 09/12] ppc64/kexec_file: setup backup region for kdump kernel

2020-07-02 Thread Hari Bathini
Though kdump kernel boots from loaded address, the first 64K bytes of it is copied down to real 0. So, setup a backup region to copy the first 64K bytes of crashed kernel, in purgatory, before booting into kdump kernel. Also, update reserve map with backup region and crashed kernel's memory to

[PATCH v2 06/12] ppc64/kexec_file: restrict memory usage of kdump kernel

2020-07-02 Thread Hari Bathini
Kdump kernel, used for capturing the kernel core image, is supposed to use only specific memory regions to avoid corrupting the image to be captured. The regions are crashkernel range - the memory reserved explicitly for kdump kernel, memory used for the tce-table, the OPAL region and RTAS region

[PATCH v2 00/12] ppc64: enable kdump support for kexec_file_load syscall

2020-07-02 Thread Hari Bathini
This patch series enables kdump support for kexec_file_load system call (kexec -s -p) on PPC64. The changes are inspired from kexec-tools code but heavily modified for kernel consumption. There is scope to expand purgatory to verify sha256 digest along with other improvements in purgatory code.

[PATCH v2 10/12] ppc64/kexec_file: prepare elfcore header for crashing kernel

2020-07-02 Thread Hari Bathini
Prepare elf headers for the crashing kernel's core file using crash_prepare_elf64_headers() and pass on this info to kdump kernel by updating its command line with elfcorehdr parameter. Also, add elfcorehdr location to reserve map to avoid it from being stomped on while booting. Signed-off-by:

[PATCH v2 12/12] ppc64/kexec_file: fix kexec load failure with lack of memory hole

2020-07-02 Thread Hari Bathini
The kexec purgatory has to run in real mode. Only the first memory block maybe accessible in real mode. And, unlike the case with panic kernel, no memory is set aside for regular kexec load. Another thing to note is, the memory for crashkernel is reserved at an offset of 128MB. So, when

[PATCH v2 11/12] ppc64/kexec_file: add appropriate regions for memory reserve map

2020-07-02 Thread Hari Bathini
While initrd, elfcorehdr and backup regions are already added to the reserve map, there are a few missing regions that need to be added to the memory reserve map. Add them here. And now that all the changes to load panic kernel are in place, claim likewise. Signed-off-by: Hari Bathini ---

Re: [PATCH] arm64/defconfig: Enable CONFIG_KEXEC_FILE

2020-07-02 Thread Bhupesh Sharma
Hi Catalin, On Fri, May 15, 2020 at 2:44 PM Bhupesh Sharma wrote: > > Hi Arnd, > > On Thu, Apr 30, 2020 at 10:05 AM Bhupesh Sharma wrote: > > > > On Tue, Apr 28, 2020 at 3:37 PM Catalin Marinas > > wrote: > > > > > > On Tue, Apr 28, 2020 at 01:55:58PM +0530, Bhupesh Sharma wrote: > > > > On

Re: [PATCH v10 5/5] kdump: update Documentation about crashkernel on arm64

2020-07-02 Thread Dave Young
Hi, Thanks for the update, but still some nitpicks :( I'm sorry I did not catch them previously, but maybe it is not worth to repost the whole series if no other changes needed. On 07/03/20 at 11:58am, Chen Zhou wrote: > Now we support crashkernel=X,[low] on arm64, update the Documentation. >

[PATCH v10 5/5] kdump: update Documentation about crashkernel on arm64

2020-07-02 Thread Chen Zhou
Now we support crashkernel=X,[low] on arm64, update the Documentation. We could use parameters "crashkernel=X crashkernel=Y,low" to reserve memory above 4G. Signed-off-by: Chen Zhou Tested-by: John Donnelly Tested-by: Prabhakar Kushwaha --- Documentation/admin-guide/kdump/kdump.rst | 14

Re: [PATCH v10 5/5] kdump: update Documentation about crashkernel on arm64

2020-07-02 Thread Dave Young
On 07/03/20 at 12:46pm, Dave Young wrote: > Hi, > > Thanks for the update, but still some nitpicks :( > > I'm sorry I did not catch them previously, but maybe it is not worth to > repost the whole series if no other changes needed. Feel free to add my acks for the common kdump part: Acked-by:

Re: [PATCH v9 5/5] kdump: update Documentation about crashkernel on arm64

2020-07-02 Thread chenzhou
Hi Dave, On 2020/7/2 10:59, Dave Young wrote: > Hi Chen, > On 06/28/20 at 04:34pm, Chen Zhou wrote: >> Now we support crashkernel=X,[low] on arm64, update the Documentation. >> We could use parameters "crashkernel=X crashkernel=Y,low" to reserve >> memory above 4G. >> >> Signed-off-by: Chen Zhou

[PATCH v10 3/5] arm64: kdump: add memory for devices by DT property linux, usable-memory-range

2020-07-02 Thread Chen Zhou
If we want to reserve crashkernel above 4G, we could use parameters "crashkernel=X crashkernel=Y,low", in this case, specified size low memory is reserved for crash dump kernel devices and never mapped by the first kernel. This memory range is advertised to crash dump kernel via DT property under

[PATCH v10 4/5] arm64: kdump: fix kdump broken with ZONE_DMA reintroduced

2020-07-02 Thread Chen Zhou
commit 1a8e1cef7603 ("arm64: use both ZONE_DMA and ZONE_DMA32") broken the arm64 kdump. If the memory reserved for crash dump kernel falled in ZONE_DMA32, the devices in crash dump kernel need to use ZONE_DMA will alloc fail. This patch addressed the above issue based on "reserving crashkernel

[PATCH v10 2/5] arm64: kdump: reserve crashkenel above 4G for crash dump kernel

2020-07-02 Thread Chen Zhou
Crashkernel=X tries to reserve memory for the crash dump kernel under 4G. If crashkernel=X,low is specified simultaneously, reserve spcified size low memory for crash kdump kernel devices firstly and then reserve memory above 4G. Suggested by James, just introduced crashkernel=X,low to arm64. As

[PATCH v10 0/5] support reserving crashkernel above 4G on arm64 kdump

2020-07-02 Thread Chen Zhou
This patch series enable reserving crashkernel above 4G in arm64. There are following issues in arm64 kdump: 1. We use crashkernel=X to reserve crashkernel below 4G, which will fail when there is no enough low memory. 2. Currently, crashkernel=Y@X can be used to reserve crashkernel above 4G, in

[PATCH v10 1/5] x86: kdump: move reserve_crashkernel_low() into crash_core.c

2020-07-02 Thread Chen Zhou
In preparation for supporting reserve_crashkernel_low in arm64 as x86_64 does, move reserve_crashkernel_low() into kernel/crash_core.c. BTW, move x86_64 CRASH_ALIGN to 2M suggested by Dave. CONFIG_PHYSICAL_ALIGN can be selected from 2M to 16M, move to the same as arm64. Note, in arm64, we

Re: [PATCH 2/2] arm64: Allocate crashkernel always in ZONE_DMA

2020-07-02 Thread chenzhou
Hi Bhupesh, On 2020/7/3 3:22, Bhupesh Sharma wrote: > Hi Will, > > On Thu, Jul 2, 2020 at 1:20 PM Will Deacon wrote: >> On Thu, Jul 02, 2020 at 03:44:20AM +0530, Bhupesh Sharma wrote: >>> commit bff3b04460a8 ("arm64: mm: reserve CMA and crashkernel in >>> ZONE_DMA32") allocates crashkernel for

Re: [PATCH v6 1/2] crash_core, vmcoreinfo: Append 'MAX_PHYSMEM_BITS' to vmcoreinfo

2020-07-02 Thread Catalin Marinas
On Thu, Jul 02, 2020 at 08:08:55PM +0800, Dave Young wrote: > Hi Catalin, > On 07/02/20 at 12:00pm, Catalin Marinas wrote: > > On Thu, May 14, 2020 at 12:22:36AM +0530, Bhupesh Sharma wrote: > > > diff --git a/kernel/crash_core.c b/kernel/crash_core.c > > > index 9f1557b98468..18175687133a 100644

Re: [PATCH v6 1/2] crash_core, vmcoreinfo: Append 'MAX_PHYSMEM_BITS' to vmcoreinfo

2020-07-02 Thread Catalin Marinas
On Thu, May 14, 2020 at 12:22:36AM +0530, Bhupesh Sharma wrote: > diff --git a/kernel/crash_core.c b/kernel/crash_core.c > index 9f1557b98468..18175687133a 100644 > --- a/kernel/crash_core.c > +++ b/kernel/crash_core.c > @@ -413,6 +413,7 @@ static int __init crash_save_vmcoreinfo_init(void) >

Re: [PATCH 2/2] arm64: Allocate crashkernel always in ZONE_DMA

2020-07-02 Thread Will Deacon
On Thu, Jul 02, 2020 at 03:44:20AM +0530, Bhupesh Sharma wrote: > commit bff3b04460a8 ("arm64: mm: reserve CMA and crashkernel in > ZONE_DMA32") allocates crashkernel for arm64 in the ZONE_DMA32. > > However as reported by Prabhakar, this breaks kdump kernel booting in > ThunderX2 like arm64

Re: [PATCH 1/2] mm/memcontrol: Fix OOPS inside mem_cgroup_get_nr_swap_pages()

2020-07-02 Thread Michal Hocko
On Thu 02-07-20 03:44:19, Bhupesh Sharma wrote: > Prabhakar reported an OOPS inside mem_cgroup_get_nr_swap_pages() > function in a corner case seen on some arm64 boards when kdump kernel > runs with "cgroup_disable=memory" passed to the kdump kernel via > bootargs. > > The root-cause behind the

Re: [PATCH v3 3/3] printk: use the lockless ringbuffer

2020-07-02 Thread lijiang
在 2020年07月02日 17:02, John Ogness 写道: > On 2020-07-02, lijiang wrote: >> About the VMCOREINFO part, I made some tests based on the kernel patch >> v3, the makedumpfile and crash-utility can work as expected with your >> patch(userspace patch), but, unfortunately, the vmcore-dmesg(kexec-tools) >>

Re: [PATCH v3 2/3] printk: add lockless ringbuffer

2020-07-02 Thread Petr Mladek
On Thu 2020-06-18 16:55:18, John Ogness wrote: > Introduce a multi-reader multi-writer lockless ringbuffer for storing > the kernel log messages. Readers and writers may use their API from > any context (including scheduler and NMI). This ringbuffer will make > it possible to decouple printk()

Re: [PATCH v3 3/3] printk: use the lockless ringbuffer

2020-07-02 Thread John Ogness
On 2020-07-02, lijiang wrote: > About the VMCOREINFO part, I made some tests based on the kernel patch > v3, the makedumpfile and crash-utility can work as expected with your > patch(userspace patch), but, unfortunately, the vmcore-dmesg(kexec-tools) > can't correctly read the printk ring buffer

Re: [PATCH v3 3/3] printk: use the lockless ringbuffer

2020-07-02 Thread lijiang
Hi, John Ogness About the VMCOREINFO part, I made some tests based on the kernel patch v3, the makedumpfile and crash-utility can work as expected with your patch(userspace patch), but, unfortunately, the vmcore-dmesg(kexec-tools) can't correctly read the printk ring buffer information, and get