Skip to contentSkip to conversation

powerpc/mm: Don't do debug print before we do feature fixup

PATCH In review Aneesh Kumar K.V 3 participants 3 messages Jun 18, 2016 – Jun 20, 2016 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 powerpc/mm: Don't do debug print before we do feature fixup

We use feature fixup in segment and page fault path and hence we should not call any function that can cause either of these before we finish feature fixup.

Calling into early debug routine can result in segment fault as updated
in https://lkml.kernel.org/r/CAOJe8K2L8D1M_yZPmyiZ11JvJ+HAS0aFHOnsqaY=xLOnQTA3AA@mail.gmail.com

Avoid the segment fault by removing the debug print. Also remove the matching closing debug print at the end of the function.

Even though the problem existed for a long time, this became more apparent after commit caca285e5ab4 ("powerpc/mm/radix: Use STD_MMU_64 to properly isolate hash related code"). Before that commit we used to use feature fixup to finalize code path related to 1T and 256MB segment.

---
Changes from V1:
* update commit message
* update Cc: list with correct email address

 arch/powerpc/kernel/setup_64.c | 2 --
 1 file changed, 2 deletions(-)
arch/powerpc/kernel/setup_64.c +0 -2
index 8222950f820f..da98f532d160 100644
@@ -466,7 +466,6 @@ static void __init initialize_cache_info(void)
  */
 void __init setup_system(void)
 {
-	DBG(" -> setup_system()\n");
 
 	/* Apply the CPUs-specific and firmware specific fixups to kernel
 	 * text (nop out sections not relevant to this CPU or this firmware)
@@ -584,7 +583,6 @@ void __init setup_system(void)
 		       (unsigned long long)PHYSICAL_START);
 	pr_info("-----------------------------------------------------\n");
 
-	DBG(" <- setup_system()\n");
 }
 
 /* This returns the limit below which memory accesses to the linear
Signature · 1 line
2.7.4
#1 lore raw
Quoted 9 lines · Aneesh Kumar K.V

We use feature fixup in segment and page fault path and hence we should not call any function that can cause either of these before we finish feature fixup.

Calling into early debug routine can result in segment fault as updated
in https://lkml.kernel.org/r/CAOJe8K2L8D1M_yZPmyiZ11JvJ+HAS0aFHOnsqaY=xLOnQTA3AA@mail.gmail.com

Avoid the segment fault by removing the debug print. Also remove the matching closing debug print at the end of the function.

Please add a comment at the beginning of setup_system() explaining the situation. IE, that until the fixups are done, not even debug printfs can be used.

It used to work though, the fact that we used 256M segment in that case wasn't an issue, in part because btext only really existed on machines that didn't have 1T segments. It was only ever going to be a segment fault, the rest was bolted (early ioremap).

Ben.

#2 lore raw
Quoted 9 lines · Benjamin Herrenschmidt
Quoted 8 lines · Aneesh Kumar K.V

We use feature fixup in segment and page fault path and hence we should not call any function that can cause either of these before we finish feature fixup.

Calling into early debug routine can result in segment fault as updated in
https://lkml.kernel.org/r/CAOJe8K2L8D1M_yZPmyiZ11JvJ+HAS0aFHOnsqaY=xLOnQTA3AA@mail.gmail.com

Quoted 7 lines
Quoted 2 lines

Avoid the segment fault by removing the debug print. Also remove the matching closing debug print at the end of the function.

Please add a comment at the beginning of setup_system() explaining the situation. IE, that until the fixups are done, not even debug printfs can be used.

Right, otherwise we'll hit the same issue in the future.

Quoted 8 lines

It used to work though, the fact that we used 256M segment in that case wasn't an issue, in part because btext only really existed on machines that didn't have 1T segments. It was only ever going to be a segment fault, the rest was bolted (early ioremap).

Ben.