From: LEROY Christophe <christophe.leroy@c-s.fr>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: aneesh.kumar@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 02/24] powerpc/mm: Pre-filter SRR1 bits before do_page_fault()
Date: Sat, 22 Jul 2017 18:43:14 +0200 [thread overview]
Message-ID: <20170722184314.Horde.gxxJYSiYc2SSqQhjpzVdwQ1@messagerie.c-s.fr> (raw)
In-Reply-To: <20170719044946.22030-2-benh@kernel.crashing.org>
Benjamin Herrenschmidt <benh@kernel.crashing.org> a =C3=A9crit=C2=A0:
> By filtering the relevant SRR1 bits in the assembly rather than
> in do_page_fault() itself, we avoid a conditional branch (since we
> already come from different path for data and instruction faults).
>
> This will allow more simplifications later
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
> arch/powerpc/kernel/head_32.S | 2 +-
> arch/powerpc/kernel/head_8xx.S | 4 ++--
> arch/powerpc/mm/fault.c | 14 ++------------
> 3 files changed, 5 insertions(+), 15 deletions(-)
>
> diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.=
S
> index a5301248b098..f11d1cd6e314 100644
> --- a/arch/powerpc/kernel/head_32.S
> +++ b/arch/powerpc/kernel/head_32.S
> @@ -409,7 +409,7 @@ InstructionAccess:
> mr r4,r12 /* SRR0 is fault address */
> bl hash_page
> 1: mr r4,r12
> - mr r5,r9
> + andis. r5,r9,0x4820 /* Filter relevant SRR1 bits */
> EXC_XFER_LITE(0x400, handle_page_fault)
>
> /* External interrupt */
> diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8x=
x.S
> index c032fe8c2d26..da3afa2c1658 100644
> --- a/arch/powerpc/kernel/head_8xx.S
> +++ b/arch/powerpc/kernel/head_8xx.S
> @@ -569,8 +569,8 @@ _ENTRY(DTLBMiss_jmp)
> InstructionTLBError:
> EXCEPTION_PROLOG
> mr r4,r12
> - mr r5,r9
> - andis. r10,r5,0x4000
> + andis. r5,r9,0x4820 /* Filter relevant SRR1 bits */
> + andis. r10,r9,0x4000
> beq+ 1f
> tlbie r4
> itlbie:
> diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
> index faddc87d0205..f04bc9f6b134 100644
> --- a/arch/powerpc/mm/fault.c
> +++ b/arch/powerpc/mm/fault.c
> @@ -203,23 +203,13 @@ static int __do_page_fault(struct pt_regs=20=20
>=20*regs, unsigned long address,
> unsigned int flags =3D FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
> int code =3D SEGV_MAPERR;
> int is_write =3D 0;
> - int trap =3D TRAP(regs);
> - int is_exec =3D trap =3D=3D 0x400;
> + int is_exec =3D TRAP(regs) =3D=3D 0x400;
Don't we have a tab/space issue here ?
> int is_user =3D user_mode(regs);
> int fault;
> int rc =3D 0, store_update_sp =3D 0;
>
> #if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE))
> - /*
> - * Fortunately the bit assignments in SRR1 for an instruction
> - * fault and DSISR for a data fault are mostly the same for the
> - * bits we are interested in. But there are some bits which
> - * indicate errors in DSISR but can validly be set in SRR1.
> - */
> - if (is_exec)
> - error_code &=3D 0x48200000;
> - else
> - is_write =3D error_code & DSISR_ISSTORE;
> + is_write =3D error_code & DSISR_ISSTORE;
> #else
> is_write =3D error_code & ESR_DST;
> #endif /* CONFIG_4xx || CONFIG_BOOKE */
> --
> 2.13.3
next prev parent reply other threads:[~2017-07-22 16:43 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-19 4:49 [PATCH 01/24] powerpc/mm: Move exception_enter/exit to a do_page_fault wrapper Benjamin Herrenschmidt
2017-07-19 4:49 ` [PATCH 02/24] powerpc/mm: Pre-filter SRR1 bits before do_page_fault() Benjamin Herrenschmidt
2017-07-22 16:43 ` LEROY Christophe [this message]
2017-07-23 1:10 ` Benjamin Herrenschmidt
2017-07-24 13:48 ` Michael Ellerman
2017-07-19 4:49 ` [PATCH 03/24] powerpc/6xx: Handle DABR match before calling do_page_fault Benjamin Herrenschmidt
2017-08-03 0:19 ` Michael Ellerman
2017-08-03 1:00 ` Benjamin Herrenschmidt
2017-07-19 4:49 ` [PATCH 04/24] powerpc/mm: Update definitions of DSISR bits Benjamin Herrenschmidt
2017-07-19 4:49 ` [PATCH 05/24] powerpc/mm: Update bits used to skip hash_page Benjamin Herrenschmidt
2017-07-19 4:49 ` [PATCH 06/24] powerpc/mm: Use symbolic constants for filtering SRR1 bits on ISIs Benjamin Herrenschmidt
2017-07-19 4:49 ` [PATCH 07/24] powerpc/mm: Move out definition of CPU specific is_write bits Benjamin Herrenschmidt
2017-07-22 16:40 ` LEROY Christophe
2017-07-23 1:06 ` Benjamin Herrenschmidt
2017-07-24 11:58 ` Michael Ellerman
2017-07-19 4:49 ` [PATCH 08/24] powerpc/mm: Move error_code checks for bad faults earlier Benjamin Herrenschmidt
2017-07-19 4:49 ` [PATCH 09/24] powerpc/mm: Overhaul handling of bad page faults Benjamin Herrenschmidt
2017-07-19 4:49 ` [PATCH 10/24] powerpc/mm: Move debugger check to notify_page_fault() Benjamin Herrenschmidt
2017-07-19 4:49 ` [PATCH 11/24] powerpc/mm: Simplify returns from __do_page_fault Benjamin Herrenschmidt
2017-07-19 4:49 ` [PATCH 12/24] powerpc/mm: Fix reporting of kernel execute faults Benjamin Herrenschmidt
2018-11-07 8:35 ` Christophe LEROY
2018-11-07 10:39 ` Benjamin Herrenschmidt
[not found] ` <87zhtr5d1v.fsf@linux.ibm.com>
2018-11-30 6:08 ` Christophe LEROY
2017-07-19 4:49 ` [PATCH 13/24] powerpc/mm: Make bad_area* helper functions Benjamin Herrenschmidt
2017-07-19 4:49 ` [PATCH 14/24] powerpc/mm: Rework mm_fault_error() Benjamin Herrenschmidt
2017-07-19 4:49 ` [PATCH 15/24] powerpc/mm: Move CMO accounting out of do_page_fault into a helper Benjamin Herrenschmidt
2017-07-19 4:49 ` [PATCH 16/24] powerpc/mm: Cosmetic fix to page fault accounting Benjamin Herrenschmidt
2017-07-19 4:49 ` [PATCH 17/24] powerpc/mm: Move the DSISR_PROTFAULT sanity check Benjamin Herrenschmidt
2017-07-19 4:49 ` [PATCH 18/24] powerpc/mm: Move/simplify faulthandler_disabled() and !mm check Benjamin Herrenschmidt
2017-07-19 4:49 ` [PATCH 19/24] powerpc/mm: Add a bunch of (un)likely annotations to do_page_fault Benjamin Herrenschmidt
2017-07-19 4:49 ` [PATCH 20/24] powerpc/mm: Set fault flags earlier Benjamin Herrenschmidt
2017-07-19 4:49 ` [PATCH 21/24] powerpc/mm: Move page fault VMA access checks to a helper Benjamin Herrenschmidt
2017-07-19 4:49 ` [PATCH 22/24] powerpc/mm: Don't lose "major" fault indication on retry Benjamin Herrenschmidt
2017-07-19 4:49 ` [PATCH 23/24] powerpc/mm: Cleanup check for stack expansion Benjamin Herrenschmidt
2017-07-21 16:59 ` LEROY Christophe
2017-07-24 10:47 ` Michael Ellerman
2017-07-24 17:34 ` LEROY Christophe
2017-07-25 11:19 ` Michael Ellerman
2017-07-31 11:37 ` Christophe LEROY
2017-07-19 4:49 ` [PATCH 24/24] powerpc: Remove old unused icswx based coprocessor support Benjamin Herrenschmidt
2017-08-07 10:41 ` [01/24] powerpc/mm: Move exception_enter/exit to a do_page_fault wrapper Michael Ellerman
2017-08-07 16:37 ` Christophe LEROY
2017-08-08 2:16 ` Michael Ellerman
2017-08-08 6:45 ` Christophe LEROY
2017-08-08 10:00 ` Michael Ellerman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170722184314.Horde.gxxJYSiYc2SSqQhjpzVdwQ1@messagerie.c-s.fr \
--to=christophe.leroy@c-s.fr \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=benh@kernel.crashing.org \
--cc=linuxppc-dev@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).