Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1534996 > unrolled thread
| Started by | James Morse <james.morse@arm.com> |
|---|---|
| First post | 2016-12-02 16:00 +0100 |
| Last post | 2016-12-07 15:40 +0100 |
| Articles | 5 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 0/2] Hibernate fixes for 'Fix memmap to be initialized for the entire section' James Morse <james.morse@arm.com> - 2016-12-02 16:00 +0100
[PATCH 2/2] arm64: hibernate: report nomap regions as being pfn_nosave James Morse <james.morse@arm.com> - 2016-12-02 16:00 +0100
Re: [PATCH 0/2] Hibernate fixes for 'Fix memmap to be initialized for the entire section' Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-12-05 16:50 +0100
Re: [PATCH 0/2] Hibernate fixes for 'Fix memmap to be initialized for the entire section' Will Deacon <will.deacon@arm.com> - 2016-12-06 18:40 +0100
Re: [PATCH 0/2] Hibernate fixes for 'Fix memmap to be initialized for the entire section' Will Deacon <will.deacon@arm.com> - 2016-12-07 15:40 +0100
| From | James Morse <james.morse@arm.com> |
|---|---|
| Date | 2016-12-02 16:00 +0100 |
| Subject | [PATCH 0/2] Hibernate fixes for 'Fix memmap to be initialized for the entire section' |
| Message-ID | <sJXtE-5bN-19@gated-at.bofh.it> |
Patch "arm64: mm: Fix memmap to be initialized for the entire section" changes pfn_valid() in a way that breaks hibernate. These patches fix hibernate, and provided struct page's are allocated for nomap pages, can be applied before [0]. Hibernate core code belives 'valid' to mean "I can access this". It uses pfn_valid() to test the page if the page is 'valid'. pfn_valid() needs to be changed so that all struct pages in a numa node have the same node-id. Currently 'nomap' pages are skipped, and retain their pre-numa node-ids, which leads to a later BUG_ON(). These patches make hibernate's savable_page() take its escape route via 'if (PageReserved(page) && pfn_is_nosave(pfn))'. [0] https://lkml.org/lkml/2016/11/30/566 James Morse (2): arm64: mm: Mark nomap regions with the PG_reserved flag arm64: hibernate: report nomap regions as being pfn_nosave arch/arm64/kernel/hibernate.c | 6 +++++- arch/arm64/mm/init.c | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) -- 2.10.1
[toc] | [next] | [standalone]
| From | James Morse <james.morse@arm.com> |
|---|---|
| Date | 2016-12-02 16:00 +0100 |
| Subject | [PATCH 2/2] arm64: hibernate: report nomap regions as being pfn_nosave |
| Message-ID | <sJXtE-5bN-33@gated-at.bofh.it> |
| In reply to | #1534996 |
pfn_valid() needs to be changed so that all struct pages in a numa node have the same node-id. Currently 'nomap' pages are skipped, and retain their pre-numa node-ids, which leads to a later BUG_ON(). Once this change happens, hibernate's code code will try and save/restore the nomap pages. Add the memblock nomap regions to the ranges reported as being 'pfn_nosave' to the hibernate core code. This only works if all pages in the nomap region are also marked with PG_reserved. Signed-off-by: James Morse <james.morse@arm.com> --- arch/arm64/kernel/hibernate.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/hibernate.c b/arch/arm64/kernel/hibernate.c index d55a7b09959b..9e901658a123 100644 --- a/arch/arm64/kernel/hibernate.c +++ b/arch/arm64/kernel/hibernate.c @@ -17,6 +17,7 @@ #define pr_fmt(x) "hibernate: " x #include <linux/cpu.h> #include <linux/kvm_host.h> +#include <linux/memblock.h> #include <linux/mm.h> #include <linux/pm.h> #include <linux/sched.h> @@ -105,7 +106,10 @@ int pfn_is_nosave(unsigned long pfn) unsigned long nosave_begin_pfn = virt_to_pfn(&__nosave_begin); unsigned long nosave_end_pfn = virt_to_pfn(&__nosave_end - 1); - return (pfn >= nosave_begin_pfn) && (pfn <= nosave_end_pfn); + if ((pfn >= nosave_begin_pfn) && (pfn <= nosave_end_pfn)) + return 1; + + return !memblock_is_map_memory(pfn << PAGE_SHIFT); } void notrace save_processor_state(void) -- 2.10.1
[toc] | [prev] | [next] | [standalone]
| From | Ard Biesheuvel <ard.biesheuvel@linaro.org> |
|---|---|
| Date | 2016-12-05 16:50 +0100 |
| Subject | Re: [PATCH 0/2] Hibernate fixes for 'Fix memmap to be initialized for the entire section' |
| Message-ID | <sL3GG-6lh-33@gated-at.bofh.it> |
| In reply to | #1534996 |
On 2 December 2016 at 14:49, James Morse <james.morse@arm.com> wrote: > Patch "arm64: mm: Fix memmap to be initialized for the entire section" > changes pfn_valid() in a way that breaks hibernate. These patches fix > hibernate, and provided struct page's are allocated for nomap pages, > can be applied before [0]. > > Hibernate core code belives 'valid' to mean "I can access this". It > uses pfn_valid() to test the page if the page is 'valid'. > > pfn_valid() needs to be changed so that all struct pages in a numa > node have the same node-id. Currently 'nomap' pages are skipped, and > retain their pre-numa node-ids, which leads to a later BUG_ON(). > > These patches make hibernate's savable_page() take its escape route > via 'if (PageReserved(page) && pfn_is_nosave(pfn))'. > This makes me feel slightly uneasy. Robert makes a convincing point, but I wonder if we can expect more fallout from the ambiguity of pfn_valid(). Now we are not only forced to assign non-existing (as far as the OS is concerned) pages to the correct NUMA node, we also need to set certain page flags.
[toc] | [prev] | [next] | [standalone]
| From | Will Deacon <will.deacon@arm.com> |
|---|---|
| Date | 2016-12-06 18:40 +0100 |
| Subject | Re: [PATCH 0/2] Hibernate fixes for 'Fix memmap to be initialized for the entire section' |
| Message-ID | <sLrSG-52Q-35@gated-at.bofh.it> |
| In reply to | #1536185 |
On Mon, Dec 05, 2016 at 03:42:14PM +0000, Ard Biesheuvel wrote: > On 2 December 2016 at 14:49, James Morse <james.morse@arm.com> wrote: > > Patch "arm64: mm: Fix memmap to be initialized for the entire section" > > changes pfn_valid() in a way that breaks hibernate. These patches fix > > hibernate, and provided struct page's are allocated for nomap pages, > > can be applied before [0]. > > > > Hibernate core code belives 'valid' to mean "I can access this". It > > uses pfn_valid() to test the page if the page is 'valid'. > > > > pfn_valid() needs to be changed so that all struct pages in a numa > > node have the same node-id. Currently 'nomap' pages are skipped, and > > retain their pre-numa node-ids, which leads to a later BUG_ON(). > > > > These patches make hibernate's savable_page() take its escape route > > via 'if (PageReserved(page) && pfn_is_nosave(pfn))'. > > > > This makes me feel slightly uneasy. Robert makes a convincing point, > but I wonder if we can expect more fallout from the ambiguity of > pfn_valid(). Now we are not only forced to assign non-existing (as far > as the OS is concerned) pages to the correct NUMA node, we also need > to set certain page flags. Yes, I really don't know how to proceed here. Playing whack-a-mole with pfn_valid() users doesn't sounds like an improvement on the current situation to me. Robert -- if we leave pfn_valid() as it is, would a point-hack to memmap_init_zone help, or do you anticipate other problems? Will
[toc] | [prev] | [next] | [standalone]
| From | Will Deacon <will.deacon@arm.com> |
|---|---|
| Date | 2016-12-07 15:40 +0100 |
| Subject | Re: [PATCH 0/2] Hibernate fixes for 'Fix memmap to be initialized for the entire section' |
| Message-ID | <sLLy2-1iJ-1@gated-at.bofh.it> |
| In reply to | #1537160 |
On Wed, Dec 07, 2016 at 10:06:38AM +0100, Robert Richter wrote: > On 06.12.16 17:38:11, Will Deacon wrote: > > On Mon, Dec 05, 2016 at 03:42:14PM +0000, Ard Biesheuvel wrote: > > > On 2 December 2016 at 14:49, James Morse <james.morse@arm.com> wrote: > > > > Patch "arm64: mm: Fix memmap to be initialized for the entire section" > > > > changes pfn_valid() in a way that breaks hibernate. These patches fix > > > > hibernate, and provided struct page's are allocated for nomap pages, > > > > can be applied before [0]. > > > > > > > > Hibernate core code belives 'valid' to mean "I can access this". It > > > > uses pfn_valid() to test the page if the page is 'valid'. > > > > > > > > pfn_valid() needs to be changed so that all struct pages in a numa > > > > node have the same node-id. Currently 'nomap' pages are skipped, and > > > > retain their pre-numa node-ids, which leads to a later BUG_ON(). > > > > > > > > These patches make hibernate's savable_page() take its escape route > > > > via 'if (PageReserved(page) && pfn_is_nosave(pfn))'. > > > > > > > > > > This makes me feel slightly uneasy. Robert makes a convincing point, > > > but I wonder if we can expect more fallout from the ambiguity of > > > pfn_valid(). Now we are not only forced to assign non-existing (as far > > > as the OS is concerned) pages to the correct NUMA node, we also need > > > to set certain page flags. > > > > Yes, I really don't know how to proceed here. Playing whack-a-mole with > > pfn_valid() users doesn't sounds like an improvement on the current > > situation to me. > > > > Robert -- if we leave pfn_valid() as it is, would a point-hack to > > memmap_init_zone help, or do you anticipate other problems? > > I would suggest to fix the hibernation code as I commented on before > to use pfn_is_nosave() that defaults to pfn_valid() but uses memblock_ > is_nomap() for arm64. Let's just fix it and see if no other issues > arise. I am trying to send a patch for this until tomorrow. I'd rather not use mainline as a guinea pig like this, since I'd be very surprised if other places don't break given the scope for different interpretations of pfn_valid. > I am also going to see how early_pfn_valid() could be redirected to > use memblock_is_nomap() on arm64. That would "quick fix" the problem, > though I rather prefer to go further with the current solution. I don't like either of them, but early_pfn_valid is easier to revert so let's go with that. Will
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web