diff mbox

[01/24] powerpc/mm: Move exception_enter/exit to a do_page_fault wrapper

Message ID 20170719044946.22030-1-benh@kernel.crashing.org (mailing list archive)
State Accepted
Commit 7afad422ac61067473d5f3d20bbd5472af533bcd
Headers show

Commit Message

Benjamin Herrenschmidt July 19, 2017, 4:49 a.m. UTC
This will allow simplifying the returns from do_page_fault

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 arch/powerpc/mm/fault.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

Comments

Michael Ellerman Aug. 7, 2017, 10:41 a.m. UTC | #1
On Wed, 2017-07-19 at 04:49:23 UTC, Benjamin Herrenschmidt wrote:
> This will allow simplifying the returns from do_page_fault
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Series applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/7afad422ac61067473d5f3d20bbd54

cheers
Christophe Leroy Aug. 7, 2017, 4:37 p.m. UTC | #2
Le 07/08/2017 à 12:41, Michael Ellerman a écrit :
> On Wed, 2017-07-19 at 04:49:23 UTC, Benjamin Herrenschmidt wrote:
>> This will allow simplifying the returns from do_page_fault
>>
>> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> 
> Series applied to powerpc next, thanks.
> 
> https://git.kernel.org/powerpc/c/7afad422ac61067473d5f3d20bbd54
> 


Boot failure on the 8xx:

[    6.029556] Failed to execute /init (error -14)
[    6.034623] Starting init: /bin/sh exists but couldn't execute it 
(error -14)
[    6.041489] Kernel panic - not syncing: No working init found.  Try 
passing init= option to kernel. See Linux 
Documentation/admin-guide/init.rst for guidance.
[    6.055518] CPU: 0 PID: 1 Comm: init Not tainted 
4.13.0-rc3-s3k-dev-00143-g7aa62e972a56 #56
[    6.063745] Call Trace:
[    6.066224] [c60f1ed0] [c001a624] panic+0x108/0x250 (unreliable)
[    6.072140] [c60f1f30] [c0002640] rootfs_mount+0x0/0x58
[    6.077311] [c60f1f40] [c000cb80] ret_from_kernel_thread+0x5c/0x64
[    6.083405] Rebooting in 180 seconds..


Bisected to c433ec0455f921eaf8dd0262a718ce6f8ad62ea2 ("powerpc/mm: 
Pre-filter SRR1 bits before do_page_fault()")


Will see tomorrow what's wrong with that.

Christophe
Michael Ellerman Aug. 8, 2017, 2:16 a.m. UTC | #3
Christophe LEROY <christophe.leroy@c-s.fr> writes:

> Le 07/08/2017 à 12:41, Michael Ellerman a écrit :
>> On Wed, 2017-07-19 at 04:49:23 UTC, Benjamin Herrenschmidt wrote:
>>> This will allow simplifying the returns from do_page_fault
>>>
>>> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>> 
>> Series applied to powerpc next, thanks.
>> 
>> https://git.kernel.org/powerpc/c/7afad422ac61067473d5f3d20bbd54
>
> Boot failure on the 8xx:
>
> [    6.029556] Failed to execute /init (error -14)
> [    6.034623] Starting init: /bin/sh exists but couldn't execute it 
> (error -14)
> [    6.041489] Kernel panic - not syncing: No working init found.  Try 
> passing init= option to kernel. See Linux 
> Documentation/admin-guide/init.rst for guidance.
> [    6.055518] CPU: 0 PID: 1 Comm: init Not tainted 
> 4.13.0-rc3-s3k-dev-00143-g7aa62e972a56 #56
> [    6.063745] Call Trace:
> [    6.066224] [c60f1ed0] [c001a624] panic+0x108/0x250 (unreliable)
> [    6.072140] [c60f1f30] [c0002640] rootfs_mount+0x0/0x58
> [    6.077311] [c60f1f40] [c000cb80] ret_from_kernel_thread+0x5c/0x64
> [    6.083405] Rebooting in 180 seconds..
>
>
> Bisected to c433ec0455f921eaf8dd0262a718ce6f8ad62ea2 ("powerpc/mm: 
> Pre-filter SRR1 bits before do_page_fault()")

Sorry about that. I don't have a way to test 8xx.

> Will see tomorrow what's wrong with that.

Thanks.

cheers
Christophe Leroy Aug. 8, 2017, 6:45 a.m. UTC | #4
Le 08/08/2017 à 04:16, Michael Ellerman a écrit :
> Christophe LEROY <christophe.leroy@c-s.fr> writes:
> 
>> Le 07/08/2017 à 12:41, Michael Ellerman a écrit :
>>> On Wed, 2017-07-19 at 04:49:23 UTC, Benjamin Herrenschmidt wrote:
>>>> This will allow simplifying the returns from do_page_fault
>>>>
>>>> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>>>
>>> Series applied to powerpc next, thanks.
>>>
>>> https://git.kernel.org/powerpc/c/7afad422ac61067473d5f3d20bbd54
>>
>> Boot failure on the 8xx:
>>
>> [    6.029556] Failed to execute /init (error -14)
>> [    6.034623] Starting init: /bin/sh exists but couldn't execute it
>> (error -14)
>> [    6.041489] Kernel panic - not syncing: No working init found.  Try
>> passing init= option to kernel. See Linux
>> Documentation/admin-guide/init.rst for guidance.
>> [    6.055518] CPU: 0 PID: 1 Comm: init Not tainted
>> 4.13.0-rc3-s3k-dev-00143-g7aa62e972a56 #56
>> [    6.063745] Call Trace:
>> [    6.066224] [c60f1ed0] [c001a624] panic+0x108/0x250 (unreliable)
>> [    6.072140] [c60f1f30] [c0002640] rootfs_mount+0x0/0x58
>> [    6.077311] [c60f1f40] [c000cb80] ret_from_kernel_thread+0x5c/0x64
>> [    6.083405] Rebooting in 180 seconds..
>>
>>
>> Bisected to c433ec0455f921eaf8dd0262a718ce6f8ad62ea2 ("powerpc/mm:
>> Pre-filter SRR1 bits before do_page_fault()")
> 
> Sorry about that. I don't have a way to test 8xx.

Looks like I concluded too quickly yesterday night, indeed the above 
commit is the last good one. The faulty one is 
d300627c6a53693fb01479b59b0cdd293761b1fa("powerpc/6xx: Handle DABR match 
before calling do_page_fault")

> 
>> Will see tomorrow what's wrong with that.
> 
> Thanks.

This is because the 'bl do_page_fault' has been enclosed inside the 
#ifdef CONFIG_6xx

See patch at https://patchwork.ozlabs.org/patch/799039/

Christophe
Michael Ellerman Aug. 8, 2017, 10 a.m. UTC | #5
Christophe LEROY <christophe.leroy@c-s.fr> writes:

> Le 08/08/2017 à 04:16, Michael Ellerman a écrit :
>> Christophe LEROY <christophe.leroy@c-s.fr> writes:
>> 
>>> Le 07/08/2017 à 12:41, Michael Ellerman a écrit :
>>>> On Wed, 2017-07-19 at 04:49:23 UTC, Benjamin Herrenschmidt wrote:
>>>>> This will allow simplifying the returns from do_page_fault
>>>>>
>>>>> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>>>>
>>>> Series applied to powerpc next, thanks.
>>>>
>>>> https://git.kernel.org/powerpc/c/7afad422ac61067473d5f3d20bbd54
>>>
>>> Boot failure on the 8xx:
>>>
>>> [    6.029556] Failed to execute /init (error -14)
>>> [    6.034623] Starting init: /bin/sh exists but couldn't execute it
>>> (error -14)
>>> [    6.041489] Kernel panic - not syncing: No working init found.  Try
>>> passing init= option to kernel. See Linux
>>> Documentation/admin-guide/init.rst for guidance.
>>> [    6.055518] CPU: 0 PID: 1 Comm: init Not tainted
>>> 4.13.0-rc3-s3k-dev-00143-g7aa62e972a56 #56
>>> [    6.063745] Call Trace:
>>> [    6.066224] [c60f1ed0] [c001a624] panic+0x108/0x250 (unreliable)
>>> [    6.072140] [c60f1f30] [c0002640] rootfs_mount+0x0/0x58
>>> [    6.077311] [c60f1f40] [c000cb80] ret_from_kernel_thread+0x5c/0x64
>>> [    6.083405] Rebooting in 180 seconds..
>>>
>>>
>>> Bisected to c433ec0455f921eaf8dd0262a718ce6f8ad62ea2 ("powerpc/mm:
>>> Pre-filter SRR1 bits before do_page_fault()")
>> 
>> Sorry about that. I don't have a way to test 8xx.
>
> Looks like I concluded too quickly yesterday night, indeed the above 
> commit is the last good one. The faulty one is 
> d300627c6a53693fb01479b59b0cdd293761b1fa("powerpc/6xx: Handle DABR match 
> before calling do_page_fault")
>
>> 
>>> Will see tomorrow what's wrong with that.
>> 
>> Thanks.
>
> This is because the 'bl do_page_fault' has been enclosed inside the 
> #ifdef CONFIG_6xx
>
> See patch at https://patchwork.ozlabs.org/patch/799039/

Oops :}

Thanks for the fix.

cheers
diff mbox

Patch

diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index 4c422632047b..faddc87d0205 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -195,10 +195,9 @@  static int mm_fault_error(struct pt_regs *regs, unsigned long addr, int fault)
  * The return value is 0 if the fault was handled, or the signal
  * number if this is a kernel fault that can't be handled here.
  */
-int do_page_fault(struct pt_regs *regs, unsigned long address,
-			    unsigned long error_code)
+static int __do_page_fault(struct pt_regs *regs, unsigned long address,
+			   unsigned long error_code)
 {
-	enum ctx_state prev_state = exception_enter();
 	struct vm_area_struct * vma;
 	struct mm_struct *mm = current->mm;
 	unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
@@ -523,6 +522,15 @@  int do_page_fault(struct pt_regs *regs, unsigned long address,
 	rc = SIGSEGV;
 
 bail:
+	return rc;
+}
+NOKPROBE_SYMBOL(__do_page_fault);
+
+int do_page_fault(struct pt_regs *regs, unsigned long address,
+		  unsigned long error_code)
+{
+	enum ctx_state prev_state = exception_enter();
+	int rc = __do_page_fault(regs, address, error_code);
 	exception_exit(prev_state);
 	return rc;
 }