Skip to content

Commit 5867a78

Browse files
akpm00Linus Torvalds
authored andcommitted
revert "Hibernation: Use temporary page tables for kernel text mapping on x86_64"
Revert commit efa4d2f ("Hibernation: Use temporary page tables for kernel text mapping on x86_64") because it causes my t61p to reboot right at the end of resume-from-disk. For reasons unknown at this time. Cc: Pavel Machek <pavel@ucw.cz> Cc: Andi Kleen <ak@suse.de> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@elte.hu> Acked-by: "Rafael J. Wysocki" <rjw@sisk.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 7552713 commit 5867a78

1 file changed

Lines changed: 6 additions & 33 deletions

File tree

‎arch/x86/kernel/suspend_64.c‎

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -192,42 +192,25 @@ static int res_phys_pud_init(pud_t *pud, unsigned long address, unsigned long en
192192
return 0;
193193
}
194194

195-
static int res_kernel_text_pud_init(pud_t *pud, unsigned long start)
196-
{
197-
pmd_t *pmd;
198-
unsigned long paddr;
199-
200-
pmd = (pmd_t *)get_safe_page(GFP_ATOMIC);
201-
if (!pmd)
202-
return -ENOMEM;
203-
set_pud(pud + pud_index(start), __pud(__pa(pmd) | _KERNPG_TABLE));
204-
for (paddr = 0; paddr < KERNEL_TEXT_SIZE; pmd++, paddr += PMD_SIZE) {
205-
unsigned long pe;
206-
207-
pe = __PAGE_KERNEL_LARGE_EXEC | _PAGE_GLOBAL | paddr;
208-
pe &= __supported_pte_mask;
209-
set_pmd(pmd, __pmd(pe));
210-
}
211-
212-
return 0;
213-
}
214-
215195
static int set_up_temporary_mappings(void)
216196
{
217197
unsigned long start, end, next;
218-
pud_t *pud;
219198
int error;
220199

221200
temp_level4_pgt = (pgd_t *)get_safe_page(GFP_ATOMIC);
222201
if (!temp_level4_pgt)
223202
return -ENOMEM;
224203

204+
/* It is safe to reuse the original kernel mapping */
205+
set_pgd(temp_level4_pgt + pgd_index(__START_KERNEL_map),
206+
init_level4_pgt[pgd_index(__START_KERNEL_map)]);
207+
225208
/* Set up the direct mapping from scratch */
226209
start = (unsigned long)pfn_to_kaddr(0);
227210
end = (unsigned long)pfn_to_kaddr(end_pfn);
228211

229212
for (; start < end; start = next) {
230-
pud = (pud_t *)get_safe_page(GFP_ATOMIC);
213+
pud_t *pud = (pud_t *)get_safe_page(GFP_ATOMIC);
231214
if (!pud)
232215
return -ENOMEM;
233216
next = start + PGDIR_SIZE;
@@ -238,17 +221,7 @@ static int set_up_temporary_mappings(void)
238221
set_pgd(temp_level4_pgt + pgd_index(start),
239222
mk_kernel_pgd(__pa(pud)));
240223
}
241-
242-
/* Set up the kernel text mapping from scratch */
243-
pud = (pud_t *)get_safe_page(GFP_ATOMIC);
244-
if (!pud)
245-
return -ENOMEM;
246-
error = res_kernel_text_pud_init(pud, __START_KERNEL_map);
247-
if (!error)
248-
set_pgd(temp_level4_pgt + pgd_index(__START_KERNEL_map),
249-
__pgd(__pa(pud) | _PAGE_TABLE));
250-
251-
return error;
224+
return 0;
252225
}
253226

254227
int swsusp_arch_resume(void)

0 commit comments

Comments
 (0)