public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Nicholas Piggin <npiggin@gmail•com>
To: Christophe Leroy <christophe.leroy@csgroup•eu>,
	linuxppc-dev@lists•ozlabs.org
Subject: Re: [PATCH 02/18] powerpc: remove arguments from fault handler functions
Date: Wed, 11 Nov 2020 14:45:49 +1000	[thread overview]
Message-ID: <1605069878.ohfaq5qrth.astroid@bobo.none> (raw)
In-Reply-To: <3872d710-97e2-80c3-991c-7f1ffe790a3d@csgroup.eu>

Excerpts from Christophe Leroy's message of November 10, 2020 9:15 pm:
> 
> 
> Le 10/11/2020 à 09:29, Nicholas Piggin a écrit :
>> Excerpts from Christophe Leroy's message of November 6, 2020 5:59 pm:
>>>
>>>
>>> Le 05/11/2020 à 15:34, Nicholas Piggin a écrit :
>>>> Make mm fault handlers all just take the pt_regs * argument and load
>>>> DAR/DSISR from that. Make those that return a value return long.
>>>>
>>>> This is done to make the function signatures match other handlers, which
>>>> will help with a future patch to add wrappers. Explicit arguments could
>>>> be added for performance but that would require more wrapper macro
>>>> variants.
>>>>
>>>> Signed-off-by: Nicholas Piggin <npiggin@gmail•com>
>>>> ---
> 
> [...]
> 
>> 
>>>> diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
>>>> index e65a49f246ef..390a296b16a3 100644
>>>> --- a/arch/powerpc/mm/fault.c
>>>> +++ b/arch/powerpc/mm/fault.c
>>>> @@ -549,11 +549,12 @@ static int __do_page_fault(struct pt_regs *regs, unsigned long address,
>>>>    }
>>>>    NOKPROBE_SYMBOL(__do_page_fault);
>>>>    
>>>> -int do_page_fault(struct pt_regs *regs, unsigned long address,
>>>> -		  unsigned long error_code)
>>>> +long do_page_fault(struct pt_regs *regs)
>>>>    {
>>>>    	enum ctx_state prev_state = exception_enter();
>>>> -	int err;
>>>> +	unsigned long address = regs->dar;
>>>> +	unsigned long error_code = regs->dsisr;
>>>> +	long err;
>>>
>>> By doing something more or less like this (need to be tuned for bookE as well):
>>>
>>> +	int is_exec = TRAP(regs) == 0x400;
>>> +	unsigned long address = is_exec ? regs->ssr0 : regs->dar;
>>> +	unsigned long error_code = is_exec ? (regs->ssr1 & DSISR_SRR1_MATCH_32S) : regs->dsisr;
>> 
>> Ah, I didn't see that you saved these in srr0/1 already. Hmm, not in
>> pt_regs though. thread_struct (VMAP_STACK only)? exception_regs (booke
>> only)? Doesn't seem so easy.
> 
> Oops yes you are right, SRR0/SRR1 are not in pt_regs. And their validity in thread struct is rather 
> short ... So forget my comment.

So, are you happy to go with this for now? I guess things can
later be cleaned up to avoid double saving on cases like VMAP.

Thanks,
Nick

  reply	other threads:[~2020-11-11  4:47 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-05 14:34 [PATCH 00/18] powerpc: interrupt wrappers Nicholas Piggin
2020-11-05 14:34 ` [PATCH 01/18] powerpc/64s: move the last of the page fault handling logic to C Nicholas Piggin
2020-11-05 21:54   ` kernel test robot
2020-11-05 14:34 ` [PATCH 02/18] powerpc: remove arguments from fault handler functions Nicholas Piggin
2020-11-06  7:59   ` Christophe Leroy
2020-11-10  8:29     ` Nicholas Piggin
2020-11-10 11:15       ` Christophe Leroy
2020-11-11  4:45         ` Nicholas Piggin [this message]
2020-11-05 14:34 ` [PATCH 03/18] powerpc: bad_page_fault, do_break get registers from regs Nicholas Piggin
2020-11-05 20:43   ` kernel test robot
2020-11-06  8:14   ` Christophe Leroy
2020-11-10  8:34     ` Nicholas Piggin
2020-11-10 11:19       ` Christophe Leroy
2020-11-11  4:46         ` Nicholas Piggin
2020-11-11  6:39           ` Nicholas Piggin
2020-11-05 14:34 ` [PATCH 04/18] powerpc: interrupt handler wrapper functions Nicholas Piggin
2020-11-05 14:34 ` [PATCH 05/18] powerpc: add interrupt wrapper entry / exit stub functions Nicholas Piggin
2020-11-05 14:34 ` [PATCH 06/18] powerpc: add interrupt_cond_local_irq_enable helper Nicholas Piggin
2020-11-05 14:34 ` [PATCH 07/18] powerpc/64: context tracking remove _TIF_NOHZ Nicholas Piggin
2020-11-05 14:34 ` [PATCH 08/18] powerpc/64: context tracking move to interrupt wrappers Nicholas Piggin
2020-11-05 14:34 ` [PATCH 09/18] powerpc/64: add context tracking to asynchronous interrupts Nicholas Piggin
2020-11-05 14:34 ` [PATCH 10/18] powerpc/64s: move context tracking exit to interrupt exit path Nicholas Piggin
2020-11-05 14:34 ` [PATCH 11/18] powerpc/64s: reconcile interrupts in C Nicholas Piggin
2020-11-05 14:34 ` [PATCH 12/18] powerpc/64: move account_stolen_time into its own function Nicholas Piggin
2020-11-05 14:34 ` [PATCH 13/18] powerpc/64: entry cpu time accounting in C Nicholas Piggin
2020-11-05 14:34 ` [PATCH 14/18] powerpc: move NMI entry/exit code into wrapper Nicholas Piggin
2020-11-05 14:34 ` [PATCH 15/18] powerpc/64s: move NMI soft-mask handling to C Nicholas Piggin
2020-11-05 14:34 ` [PATCH 16/18] powerpc/64s: runlatch interrupt handling in C Nicholas Piggin
2020-11-05 14:34 ` [PATCH 17/18] powerpc/64s: power4 nap fixup " Nicholas Piggin
2020-11-05 14:34 ` [PATCH 18/18] powerpc/64s: move power4 idle entirely to C Nicholas Piggin
2020-11-06  7:34   ` kernel test robot
2020-11-07  9:43   ` Christophe Leroy
2020-11-10  8:43     ` Nicholas Piggin

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=1605069878.ohfaq5qrth.astroid@bobo.none \
    --to=npiggin@gmail$(echo .)com \
    --cc=christophe.leroy@csgroup$(echo .)eu \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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