[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <284936908.600.1527490819532.JavaMail.zimbra@efficios.com>
Date: Mon, 28 May 2018 03:00:19 -0400 (EDT)
From: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To: Michael Ellerman <mpe@...erman.id.au>,
Boqun Feng <boqun.feng@...il.com>
Cc: Will Deacon <will.deacon@....com>,
Peter Zijlstra <peterz@...radead.org>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Andy Lutomirski <luto@...capital.net>,
Dave Watson <davejwatson@...com>,
linux-kernel <linux-kernel@...r.kernel.org>,
linux-api <linux-api@...r.kernel.org>,
Paul Turner <pjt@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Russell King <linux@....linux.org.uk>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>, Andrew Hunter <ahh@...gle.com>,
Andi Kleen <andi@...stfloor.org>, Chris Lameter <cl@...ux.com>,
Ben Maurer <bmaurer@...com>, rostedt <rostedt@...dmis.org>,
Josh Triplett <josh@...htriplett.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Catalin Marinas <catalin.marinas@....com>,
Michael Kerrisk <mtk.manpages@...il.com>,
Joel Fernandes <joelaf@...gle.com>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
linuxppc-dev <linuxppc-dev@...ts.ozlabs.org>
Subject: Re: [PATCH 07/14] powerpc: Add support for restartable sequences
----- On May 24, 2018, at 3:03 AM, Michael Ellerman mpe@...erman.id.au wrote:
> Mathieu Desnoyers <mathieu.desnoyers@...icios.com> writes:
>> ----- On May 23, 2018, at 4:14 PM, Mathieu Desnoyers
>> mathieu.desnoyers@...icios.com wrote:
> ...
>>>
>>> Hi Boqun,
>>>
>>> I tried your patch in a ppc64 le environment, and it does not survive boot
>>> with CONFIG_DEBUG_RSEQ=y. init gets killed right away.
>
>
> Sorry this code is super gross and hard to deal with.
>
>> The following fixup gets ppc64 to work:
>>
>> --- a/arch/powerpc/kernel/entry_64.S
>> +++ b/arch/powerpc/kernel/entry_64.S
>> @@ -208,6 +208,7 @@ system_call_exit:
>> /* Check whether the syscall is issued inside a restartable sequence */
>> addi r3,r1,STACK_FRAME_OVERHEAD
>> bl rseq_syscall
>> + ld r3,RESULT(r1)
>> #endif
>> /*
>> * Disable interrupts so current_thread_info()->flags can't change,
>
> I don't think that's safe.
>
> If you look above that, we have r3, r8 and r12 all live:
>
> .Lsyscall_exit:
> std r3,RESULT(r1)
> CURRENT_THREAD_INFO(r12, r1)
>
> ld r8,_MSR(r1)
> #ifdef CONFIG_PPC_BOOK3S
> /* No MSR:RI on BookE */
> andi. r10,r8,MSR_RI
> beq- .Lunrecov_restore
> #endif
>
>
> They're all volatile across function calls:
>
> http://openpowerfoundation.org/wp-content/uploads/resources/leabi/content/dbdoclet.50655240_68174.html
>
>
> The system_call_exit symbol is actually there for kprobes and cosmetic
> purposes. The actual syscall return flow starts at .Lsyscall_exit.
>
> So I think this would work:
>
> diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
> index db4df061c33a..e19f377a25e0 100644
> --- a/arch/powerpc/kernel/entry_64.S
> +++ b/arch/powerpc/kernel/entry_64.S
> @@ -184,6 +184,14 @@ system_call: /* label this so stack traces look sane */
>
> .Lsyscall_exit:
> std r3,RESULT(r1)
> +
> +#ifdef CONFIG_DEBUG_RSEQ
> + /* Check whether the syscall is issued inside a restartable sequence */
> + addi r3,r1,STACK_FRAME_OVERHEAD
> + bl rseq_syscall
> + ld r3,RESULT(r1)
> +#endif
> +
> CURRENT_THREAD_INFO(r12, r1)
>
> ld r8,_MSR(r1)
>
>
> I'll try and get this series into my test setup at some point, been a
> bit busy lately :)
Yes, this was needed. I had this in my tree already, but there is still
a kernel OOPS when running the rseq selftests on ppc64 with CONFIG_DEBUG_RSEQ=y.
My current dev tree is at: https://github.com/compudj/linux-percpu-dev/tree/rseq/dev-local
So considering we are at rc7 now, should I plan to removing the powerpc bits
for merge window submission, or is there someone planning to spend time on
fixing and testing ppc integration before the merge window opens ?
Thanks,
Mathieu
>
> cheers
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
Powered by blists - more mailing lists