mm/sparse: reset section's mem_map when fully deactivated
Subsystems (2)
PATCH v2 1/1 mm/sparse: reset section's mem_map when fully deactivated
After commit ba72b4c8cf60 ("mm/sparsemem: support sub-section hotplug"), when a mem section is fully deactivated, section_mem_map still records the section's start pfn, which is not used any more and will be reassigned during re-added.
In analogy with alloc/free pattern, it is better to clear all fields of section_mem_map.
Beside this, it breaks the user space tool "makedumpfile" [1], which makes assumption that a hot-removed section has mem_map as NULL, instead of checking directly against SECTION_MARKED_PRESENT bit. (makedumpfile will be better to change the assumption, and need a patch)
The bug can be reproduced on IBM POWERVM by "drmgr -c mem -r -q 5" , trigger a crash, and save vmcore by makedumpfile
[1]: makedumpfile, commit e73016540293 ("[v1.6.7] Update version")
To: [email protected]
Cc: Andrew Morton <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Dan Williams <[email protected]>
Cc: Oscar Salvador <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Baoquan He <[email protected]>
Cc: Qian Cai <[email protected]>
Cc: [email protected]
Cc: Kazuhito Hagio <[email protected]>
---
v1 -> v2:
make an explicit convertion from NULL to ulong
improve commit log
mm/sparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/sparse.c +1 -1
@@ -789,7 +789,7 @@ static void section_deactivate(unsigned long pfn, unsigned long nr_pages, ms->usage =NULL ; } memmap =sparse_decode_mem_map (ms->section_mem_map, section_nr); - ms->section_mem_map =sparse_encode_mem_map (NULL , section_nr); + ms->section_mem_map = (unsigned long )NULL ; }if (section_is_early && memmap)
Signature · 1 line
2.7.5
Quoted 8 lines · Pingfan Liu
After commit
ba72b4c8cf60("mm/sparsemem: support sub-section hotplug"), when a mem section is fully deactivated,section_mem_mapstill records the section's start pfn, which is not used any more and will be reassigned during re-added.In analogy with alloc/free pattern, it is better to clear all fields of
section_mem_map.
Quoted 7 lines
Beside this, it breaks the user space tool "makedumpfile" [1], which makes assumption that a hot-removed section has
mem_mapas NULL, instead of checking directly againstSECTION_MARKED_PRESENTbit. (makedumpfile will be better to change the assumption, and need a patch)The bug can be reproduced on IBM POWERVM by "drmgr -c mem -r -q 5" , trigger a crash, and save vmcore by makedumpfile
While makedumpfile lives very closely to the kernel and occasional breakage is to be expected I still believe that Fixes: ba72b4c8cf60 is due.
Quoted 13 lines
[1]: makedumpfile, commit
e73016540293("[v1.6.7] Update version")Signed-off-by Pingfan Liu <[email protected]>To: [email protected]
Cc: Andrew Morton <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Dan Williams <[email protected]>
Cc: Oscar Salvador <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Baoquan He <[email protected]>
Cc: Qian Cai <[email protected]>
Cc: [email protected]
Cc: Kazuhito Hagio <[email protected]>
Quoted 23 lines
---
v1 -> v2:
make an explicit convertion from NULL to ulong
improve commit logmm/sparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/sparse.c +1
-1@@ -789,7 +789,7 @@ static void section_deactivate(unsigned long pfn, unsigned long nr_pages, ms->usage =NULL ; } memmap =sparse_decode_mem_map (ms->section_mem_map, section_nr); - ms->section_mem_map =sparse_encode_mem_map (NULL , section_nr); + ms->section_mem_map = (unsigned long )NULL ; }if (section_is_early && memmap)Signature · 1 line
2.7.5
Signature · 2 lines
Michal Hocko SUSE Labs
David Hildenbrand
Acked-byQuoted 14 lines · Michal Hocko
Quoted 13 lines · Pingfan Liu
After commit
ba72b4c8cf60("mm/sparsemem: support sub-section hotplug"), when a mem section is fully deactivated,section_mem_mapstill records the section's start pfn, which is not used any more and will be reassigned during re-added.In analogy with alloc/free pattern, it is better to clear all fields of
section_mem_map.Beside this, it breaks the user space tool "makedumpfile" [1], which makes assumption that a hot-removed section has
mem_mapas NULL, instead of checking directly againstSECTION_MARKED_PRESENTbit. (makedumpfile will be better to change the assumption, and need a patch)
Quoted 6 lines
Quoted 2 lines
The bug can be reproduced on IBM POWERVM by "drmgr -c mem -r -q 5" , trigger a crash, and save vmcore by makedumpfile
While makedumpfile lives very closely to the kernel and occasional breakage is to be expected I still believe that Fixes:
ba72b4c8cf60is due.
+1 as I expressed earlier.
Quoted 15 lines
Quoted 4 lines
[1]: makedumpfile, commit
e73016540293("[v1.6.7] Update version")Signed-off-by Pingfan Liu <[email protected]>Quoted 10 lines
To: [email protected]
Cc: Andrew Morton <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Dan Williams <[email protected]>
Cc: Oscar Salvador <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Baoquan He <[email protected]>
Cc: Qian Cai <[email protected]>
Cc: [email protected]
Cc: Kazuhito Hagio <[email protected]>
I think you dropped my
Signature · 3 lines
Thanks, David / dhildenb
Quoted 1 line · David Hildenbrand
[...]
Quoted 4 lines
I think you dropped my
Sorry to forget it.
Thanks for your kind review.
Regards,
Pingfan
Andrew Morton
maintainerQuoted 14 lines · On Mon, 20 Jan 2020 08:29:39 +0100 Michal Hocko <[email protected]> wrote:
Quoted 13 lines · Pingfan Liu
After commit
ba72b4c8cf60("mm/sparsemem: support sub-section hotplug"), when a mem section is fully deactivated,section_mem_mapstill records the section's start pfn, which is not used any more and will be reassigned during re-added.In analogy with alloc/free pattern, it is better to clear all fields of
section_mem_map.Beside this, it breaks the user space tool "makedumpfile" [1], which makes assumption that a hot-removed section has
mem_mapas NULL, instead of checking directly againstSECTION_MARKED_PRESENTbit. (makedumpfile will be better to change the assumption, and need a patch)
Quoted 6 lines
Quoted 2 lines
The bug can be reproduced on IBM POWERVM by "drmgr -c mem -r -q 5" , trigger a crash, and save vmcore by makedumpfile
While makedumpfile lives very closely to the kernel and occasional breakage is to be expected I still believe that Fixes:
ba72b4c8cf60is due.
But not a cc:stable?
Michal Hocko
reviewerQuoted 16 lines · Andrew Morton
Quoted 14 lines · On Mon, 20 Jan 2020 08:29:39 +0100 Michal Hocko <[email protected]> wrote:
Quoted 13 lines · Pingfan Liu
After commit
ba72b4c8cf60("mm/sparsemem: support sub-section hotplug"), when a mem section is fully deactivated,section_mem_mapstill records the section's start pfn, which is not used any more and will be reassigned during re-added.In analogy with alloc/free pattern, it is better to clear all fields of
section_mem_map.Beside this, it breaks the user space tool "makedumpfile" [1], which makes assumption that a hot-removed section has
mem_mapas NULL, instead of checking directly againstSECTION_MARKED_PRESENTbit. (makedumpfile will be better to change the assumption, and need a patch)
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
The bug can be reproduced on IBM POWERVM by "drmgr -c mem -r -q 5" , trigger a crash, and save vmcore by makedumpfile
While makedumpfile lives very closely to the kernel and occasional breakage is to be expected I still believe that Fixes:
ba72b4c8cf60is due.But not a cc:stable?
Well, I wouldn't say this is really critical. makedumpfile will get its fix... But if people think it would be useful in stable I won't oppose.
Signature · 2 lines
Michal Hocko SUSE Labs
Quoted 21 lines · Michal Hocko
Quoted 19 lines · Andrew Morton
Quoted 17 lines · On Mon, 20 Jan 2020 08:29:39 +0100 Michal Hocko <[email protected]> wrote:
Quoted 15 lines · Pingfan Liu
After commit
ba72b4c8cf60("mm/sparsemem: support sub-section hotplug"), when a mem section is fully deactivated,section_mem_mapstill records the section's start pfn, which is not used any more and will be reassigned during re-added.In analogy with alloc/free pattern, it is better to clear all fields of
section_mem_map.Beside this, it breaks the user space tool "makedumpfile" [1], which makes assumption that a hot-removed section has
mem_mapas NULL, instead of checking directly againstSECTION_MARKED_PRESENTbit. (makedumpfile will be better to change the assumption, and need a patch)The bug can be reproduced on IBM POWERVM by "drmgr -c mem -r -q 5" , trigger a crash, and save vmcore by makedumpfile
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
While makedumpfile lives very closely to the kernel and occasional breakage is to be expected I still believe that Fixes:
ba72b4c8cf60is due.But not a cc:stable?
Well, I wouldn't say this is really critical. makedumpfile will get its fix... But if people think it would be useful in stable I won't oppose.
Yes, I think this patch is no more than a prototype improvement, and makedumpfile has better to get its fix.
And I have sent a patch to kexec-list for it.
(http://lists.infradead.org/pipermail/kexec/2020-January/024406.html)
Thanks,
Pingfan