RE: nvdimm,pmem: makedumpfile: __vtop4_x86_64: Can't get a valid pte.
lizhij...@fujitsu.com wrote: > Hi folks, > > I'm going to make crash coredump support pmem region. So > I have modified kexec-tools to add pmem region to PT_LOAD of vmcore. > > But it failed at makedumpfile, log are as following: > > In my environment, i found the last 512 pages in pmem region will cause the > error. > > qemu commandline: > -object > memory-backend-file,id=memnvdimm0,prealloc=yes,mem-path=/root/qemu-dax.img,share=yes,size=4267704320,align=2097152 > -device nvdimm,node=0,label-size=4194304,memdev=memnvdimm0,id=nvdimm0,slot=0 > > ndctl info: > [root@rdma-server ~]# ndctl list > [ >{ > "dev":"namespace0.0", > "mode":"devdax", > "map":"dev", > "size":4127195136, > "uuid":"f6fc1e86-ac5b-48d8-9cda-4888a33158f9", > "chardev":"dax0.0", > "align":4096 >} > ] > [root@rdma-server ~]# ndctl list -iRD > { >"dimms":[ > { >"dev":"nmem0", >"id":"8680-56341200", >"handle":1, >"phys_id":0 > } >], >"regions":[ > { >"dev":"region0", >"size":4263510016, >"align":16777216, >"available_size":0, >"max_available_extent":0, >"type":"pmem", >"iset_id":10248187106440278, >"mappings":[ > { >"dimm":"nmem0", >"offset":0, >"length":4263510016, >"position":0 > } >], >"persistence_domain":"unknown" > } >] > } > > iomem info: > [root@rdma-server ~]# cat /proc/iomem | grep Persi > 14000-23e1f : Persistent Memory > > makedumpfile info: > [ 57.229110] kdump.sh[240]: mem_map[ 71] ea0008e0 238000 > 23e200 > > > Firstly, i wonder that > 1) makedumpfile read the whole range of iomem(same with the PT_LOAD of pmem) > 2) 1st kernel side only setup mem_map(vmemmap) for this namespace, which size > is 512 pages smaller than iomem for some reasons. > 3) Since there is an align in nvdimm region(16MiB in above), i also guess the > maximum size of the pmem can used by user should > be ALIGN(iomem, 10MiB), after this alignment, the last 512 pages will be > dropped. then kernel only setups vmemmap for this > range. but i didn't see any code doing such things in kernel side. > > So if you guy know the reasons, please let me know :), any hint/feedback is > very welcome. This is due to the region alignment. 2522afb86a8c libnvdimm/region: Introduce an 'align' attribute If you want to use the full capacity it would be something like this (untested, and may destroy any data currently on the namespace): ndctl destroy-namespace namespace0.0 echo $((2<<20)) > /sys/bus/nd/devices/region0/align ndctl create-namespace -m dax -a 4k -M mem
[PATCH v7 1/2] kexec: Introduce kexec_with_frozen_processes
Drivers running .shutdown() might want to wait for userspace to complete before exiting. If userspace is frozen and we are running kexec they will stall the computer. Add a way for them to figure out if they should just skip waiting for userspace. Cc: sta...@vger.kernel.org Fixes: 83bfc7e793b5 ("ASoC: SOF: core: unregister clients and machine drivers in .shutdown") Signed-off-by: Ricardo Ribalda --- include/linux/kexec.h | 3 +++ kernel/kexec_core.c | 5 + 2 files changed, 8 insertions(+) diff --git a/include/linux/kexec.h b/include/linux/kexec.h index 41a686996aaa..c22711e0f7b5 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -426,6 +426,8 @@ extern int kexec_load_disabled; /* flag to track if kexec reboot is in progress */ extern bool kexec_in_progress; +bool kexec_with_frozen_processes(void); + int crash_shrink_memory(unsigned long new_size); ssize_t crash_get_memory_size(void); @@ -507,6 +509,7 @@ static inline void __crash_kexec(struct pt_regs *regs) { } static inline void crash_kexec(struct pt_regs *regs) { } static inline int kexec_should_crash(struct task_struct *p) { return 0; } static inline int kexec_crash_loaded(void) { return 0; } +static inline bool kexec_with_frozen_processes(void) { return false; } #define kexec_in_progress false #endif /* CONFIG_KEXEC_CORE */ diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c index ca2743f9c634..8bc8257ee7ca 100644 --- a/kernel/kexec_core.c +++ b/kernel/kexec_core.c @@ -54,6 +54,11 @@ note_buf_t __percpu *crash_notes; /* Flag to indicate we are going to kexec a new kernel */ bool kexec_in_progress = false; +bool kexec_with_frozen_processes(void) +{ + return kexec_in_progress && pm_freezing; +} +EXPORT_SYMBOL(kexec_with_frozen_processes); /* Location of the reserved area for the crash kernel */ struct resource crashk_res = { -- 2.38.1.584.g0f3c55d4c2-goog-b4-0.11.0-dev-696ae ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
[PATCH v7 0/2] ASoC: SOF: Fix deadlock when shutdown a frozen userspace
Since: 83bfc7e793b5 ("ASoC: SOF: core: unregister clients and machine drivers in .shutdown") we wait for all the workloads to be completed during shutdown. This was done to avoid a stall once the device is started again. Unfortunately this has the side effect of stalling kexec(), if the userspace is frozen. Let's handle that case. To: Pierre-Louis Bossart To: Liam Girdwood To: Peter Ujfalusi To: Bard Liao To: Ranjani Sridharan To: Kai Vehmanen To: Daniel Baluta To: Mark Brown To: Jaroslav Kysela To: Takashi Iwai To: Eric Biederman To: Chromeos Kdump To: Steven Rostedt Cc: sta...@vger.kernel.org Cc: sound-open-firmw...@alsa-project.org Cc: alsa-de...@alsa-project.org Cc: linux-ker...@vger.kernel.org Cc: kexec@lists.infradead.org Signed-off-by: Ricardo Ribalda --- Changes in v7: - Fix commit message (Thanks Pierre-Louis). - Link to v6: https://lore.kernel.org/r/20221127-snd-freeze-v6-0-3e90553f6...@chromium.org Changes in v6: - Check if we are in kexec with the userspace frozen. - Link to v5: https://lore.kernel.org/r/20221127-snd-freeze-v5-0-4ededeb08...@chromium.org Changes in v5: - Edit subject prefix. - Link to v4: https://lore.kernel.org/r/20221127-snd-freeze-v4-0-51ca64b7f...@chromium.org Changes in v4: - Do not call snd_sof_machine_unregister from shutdown. - Link to v3: https://lore.kernel.org/r/20221127-snd-freeze-v3-0-a2eda731c...@chromium.org Changes in v3: - Wrap pm_freezing in a function. - Link to v2: https://lore.kernel.org/r/20221127-snd-freeze-v2-0-d8a425ea9...@chromium.org Changes in v2: - Only use pm_freezing if CONFIG_FREEZER . - Link to v1: https://lore.kernel.org/r/20221127-snd-freeze-v1-0-57461a366...@chromium.org --- Ricardo Ribalda (2): kexec: Introduce kexec_with_frozen_processes ASoC: SOF: Fix deadlock when shutdown a frozen userspace include/linux/kexec.h | 3 +++ kernel/kexec_core.c | 5 + sound/soc/sof/core.c | 4 +++- 3 files changed, 11 insertions(+), 1 deletion(-) --- base-commit: 4312098baf37ee17a8350725e6e0d0e8590252d4 change-id: 20221127-snd-freeze-1ee143228326 Best regards, -- Ricardo Ribalda ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
[PATCH v7 2/2] ASoC: SOF: Fix deadlock when shutdown a frozen userspace
During kexec(), the userspace might frozen. Therefore we cannot wait for it to complete. During a kexec with frozen processe do not unregister the clients. This fixes: [ 84.943749] Freezing user space processes ... (elapsed 0.111 seconds) done. [ 246.784446] INFO: task kexec-lite:5123 blocked for more than 122 seconds. [ 246.819035] Call Trace: [ 246.821782] [ 246.824186] __schedule+0x5f9/0x1263 [ 246.828231] schedule+0x87/0xc5 [ 246.831779] snd_card_disconnect_sync+0xb5/0x127 ... [ 246.889249] snd_sof_device_shutdown+0xb4/0x150 [ 246.899317] pci_device_shutdown+0x37/0x61 [ 246.903990] device_shutdown+0x14c/0x1d6 [ 246.908391] kernel_kexec+0x45/0xb9 And: [ 246.893222] INFO: task kexec-lite:4891 blocked for more than 122 seconds. [ 246.927709] Call Trace: [ 246.930461] [ 246.932819] __schedule+0x5f9/0x1263 [ 246.936855] ? fsnotify_grab_connector+0x5c/0x70 [ 246.942045] schedule+0x87/0xc5 [ 246.945567] schedule_timeout+0x49/0xf3 [ 246.949877] wait_for_completion+0x86/0xe8 [ 246.954463] snd_card_free+0x68/0x89 ... [ 247.001080] platform_device_unregister+0x12/0x35 Cc: sta...@vger.kernel.org Fixes: 83bfc7e793b5 ("ASoC: SOF: core: unregister clients and machine drivers in .shutdown") Signed-off-by: Ricardo Ribalda --- sound/soc/sof/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c index 3e6141d03770..4301f347bb90 100644 --- a/sound/soc/sof/core.c +++ b/sound/soc/sof/core.c @@ -9,6 +9,7 @@ // #include +#include #include #include #include @@ -484,7 +485,8 @@ int snd_sof_device_shutdown(struct device *dev) * make sure clients and machine driver(s) are unregistered to force * all userspace devices to be closed prior to the DSP shutdown sequence */ - sof_unregister_clients(sdev); + if (!kexec_with_frozen_processes()) + sof_unregister_clients(sdev); snd_sof_machine_unregister(sdev, pdata); -- 2.38.1.584.g0f3c55d4c2-goog-b4-0.11.0-dev-696ae ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH v6 2/2] ASoC: SOF: Fix deadlock when shutdown a frozen userspace
On 11/30/22 09:47, Ricardo Ribalda wrote: > During kexec(), the userspace is frozen. Therefore we cannot wait for it > to complete. > > Avoid running snd_sof_machine_unregister during shutdown. That's not what you are doing below - you only unregister clients conditionally. I don't know if that's a stale commit message and can't reconcile it either with the initial discussions in this thread where we were referring to snd_card_disconnect(), etc? Confused. > @@ -484,7 +485,8 @@ int snd_sof_device_shutdown(struct device *dev) >* make sure clients and machine driver(s) are unregistered to force >* all userspace devices to be closed prior to the DSP shutdown sequence >*/ > - sof_unregister_clients(sdev); > + if (!kexec_with_frozen_processes()) > + sof_unregister_clients(sdev); > > snd_sof_machine_unregister(sdev, pdata); > > ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
[PATCH v6 0/2] ASoC: SOF: Fix deadlock when shutdown a frozen userspace
Since: 83bfc7e793b5 ("ASoC: SOF: core: unregister clients and machine drivers in .shutdown") we wait for all the workloads to be completed during shutdown. This was done to avoid a stall once the device is started again. Unfortunately this has the side effect of stalling kexec(), if the userspace is frozen. Let's handle that case. To: Pierre-Louis Bossart To: Liam Girdwood To: Peter Ujfalusi To: Bard Liao To: Ranjani Sridharan To: Kai Vehmanen To: Daniel Baluta To: Mark Brown To: Jaroslav Kysela To: Takashi Iwai To: Eric Biederman To: Chromeos Kdump To: Steven Rostedt Cc: sta...@vger.kernel.org Cc: sound-open-firmw...@alsa-project.org Cc: alsa-de...@alsa-project.org Cc: linux-ker...@vger.kernel.org Cc: kexec@lists.infradead.org Signed-off-by: Ricardo Ribalda --- Changes in v6: - Check if we are in kexec with the userspace frozen. - Link to v5: https://lore.kernel.org/r/20221127-snd-freeze-v5-0-4ededeb08...@chromium.org Changes in v5: - Edit subject prefix. - Link to v4: https://lore.kernel.org/r/20221127-snd-freeze-v4-0-51ca64b7f...@chromium.org Changes in v4: - Do not call snd_sof_machine_unregister from shutdown. - Link to v3: https://lore.kernel.org/r/20221127-snd-freeze-v3-0-a2eda731c...@chromium.org Changes in v3: - Wrap pm_freezing in a function. - Link to v2: https://lore.kernel.org/r/20221127-snd-freeze-v2-0-d8a425ea9...@chromium.org Changes in v2: - Only use pm_freezing if CONFIG_FREEZER . - Link to v1: https://lore.kernel.org/r/20221127-snd-freeze-v1-0-57461a366...@chromium.org --- Ricardo Ribalda (2): kexec: Introduce kexec_with_frozen_processes ASoC: SOF: Fix deadlock when shutdown a frozen userspace include/linux/kexec.h | 3 +++ kernel/kexec_core.c | 5 + sound/soc/sof/core.c | 4 +++- 3 files changed, 11 insertions(+), 1 deletion(-) --- base-commit: 4312098baf37ee17a8350725e6e0d0e8590252d4 change-id: 20221127-snd-freeze-1ee143228326 Best regards, -- Ricardo Ribalda ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
[PATCH v6 1/2] kexec: Introduce kexec_with_frozen_processes
Drivers running .shutdown() might want to wait for userspace to complete before exiting. If userspace is frozen and we are running kexec they will stall the computer. Add a way for them to figure out if they should just skip waiting for userspace. Signed-off-by: Ricardo Ribalda --- include/linux/kexec.h | 3 +++ kernel/kexec_core.c | 5 + 2 files changed, 8 insertions(+) diff --git a/include/linux/kexec.h b/include/linux/kexec.h index 41a686996aaa..c22711e0f7b5 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -426,6 +426,8 @@ extern int kexec_load_disabled; /* flag to track if kexec reboot is in progress */ extern bool kexec_in_progress; +bool kexec_with_frozen_processes(void); + int crash_shrink_memory(unsigned long new_size); ssize_t crash_get_memory_size(void); @@ -507,6 +509,7 @@ static inline void __crash_kexec(struct pt_regs *regs) { } static inline void crash_kexec(struct pt_regs *regs) { } static inline int kexec_should_crash(struct task_struct *p) { return 0; } static inline int kexec_crash_loaded(void) { return 0; } +static inline bool kexec_with_frozen_processes(void) { return false; } #define kexec_in_progress false #endif /* CONFIG_KEXEC_CORE */ diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c index ca2743f9c634..8bc8257ee7ca 100644 --- a/kernel/kexec_core.c +++ b/kernel/kexec_core.c @@ -54,6 +54,11 @@ note_buf_t __percpu *crash_notes; /* Flag to indicate we are going to kexec a new kernel */ bool kexec_in_progress = false; +bool kexec_with_frozen_processes(void) +{ + return kexec_in_progress && pm_freezing; +} +EXPORT_SYMBOL(kexec_with_frozen_processes); /* Location of the reserved area for the crash kernel */ struct resource crashk_res = { -- 2.38.1.584.g0f3c55d4c2-goog-b4-0.11.0-dev-696ae ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
[PATCH v6 2/2] ASoC: SOF: Fix deadlock when shutdown a frozen userspace
During kexec(), the userspace is frozen. Therefore we cannot wait for it to complete. Avoid running snd_sof_machine_unregister during shutdown. This fixes: [ 84.943749] Freezing user space processes ... (elapsed 0.111 seconds) done. [ 246.784446] INFO: task kexec-lite:5123 blocked for more than 122 seconds. [ 246.819035] Call Trace: [ 246.821782] [ 246.824186] __schedule+0x5f9/0x1263 [ 246.828231] schedule+0x87/0xc5 [ 246.831779] snd_card_disconnect_sync+0xb5/0x127 ... [ 246.889249] snd_sof_device_shutdown+0xb4/0x150 [ 246.899317] pci_device_shutdown+0x37/0x61 [ 246.903990] device_shutdown+0x14c/0x1d6 [ 246.908391] kernel_kexec+0x45/0xb9 And: [ 246.893222] INFO: task kexec-lite:4891 blocked for more than 122 seconds. [ 246.927709] Call Trace: [ 246.930461] [ 246.932819] __schedule+0x5f9/0x1263 [ 246.936855] ? fsnotify_grab_connector+0x5c/0x70 [ 246.942045] schedule+0x87/0xc5 [ 246.945567] schedule_timeout+0x49/0xf3 [ 246.949877] wait_for_completion+0x86/0xe8 [ 246.954463] snd_card_free+0x68/0x89 ... [ 247.001080] platform_device_unregister+0x12/0x35 Cc: sta...@vger.kernel.org Fixes: 83bfc7e793b5 ("ASoC: SOF: core: unregister clients and machine drivers in .shutdown") Signed-off-by: Ricardo Ribalda --- sound/soc/sof/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c index 3e6141d03770..4301f347bb90 100644 --- a/sound/soc/sof/core.c +++ b/sound/soc/sof/core.c @@ -9,6 +9,7 @@ // #include +#include #include #include #include @@ -484,7 +485,8 @@ int snd_sof_device_shutdown(struct device *dev) * make sure clients and machine driver(s) are unregistered to force * all userspace devices to be closed prior to the DSP shutdown sequence */ - sof_unregister_clients(sdev); + if (!kexec_with_frozen_processes()) + sof_unregister_clients(sdev); snd_sof_machine_unregister(sdev, pdata); -- 2.38.1.584.g0f3c55d4c2-goog-b4-0.11.0-dev-696ae ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
[ANNOUNCE] kexec-tools v2.0.26 preparation
Hi all, I am planning to release kexec-tools v2.0.26 in the next two weeks to roughly coincide with the release of the v6.1 kernel. I would like to ask interested parties to send any patches they would like included in v2.0.26 within one week so they can be considered for inclusion in an rc release. For reference the patches queued up since v2.0.25 are as follows. Thanks to everyone who has contributed to kexec-tools! b9de05184816 m68k: pass rng seed via BI_RNG_SEED b0381b817910 workflow: update to checkout@v3 834be38cc044 LoongArch: Remove redundant cmdline parameters when using --reuse-cmdline option 84138f41efd5 LoongArch: Add purgatory framework code 615b6757dcab LoongArch: PE format image loading support 1c8bf2dc0127 LoongArch: Add kexec/kdump support dceb1d8926e6 config: Add LoongArch architecture support in config.guess and config.sub files 6b6187f546f0 ppc64: remove rma_top limit bc38df5e8e24 kexec-tools 2.0.25.git ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec