mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: "Pali Rohár" <pali@kernel.org>,
	"Segher Boessenkool" <segher@kernel.crashing.org>
Cc: "linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: Regression: Linux v5.15+ does not boot on Freescale P2020
Date: Tue, 26 Jul 2022 14:30:49 +0000	[thread overview]
Message-ID: <4933ed23-9d0e-cffc-7bc6-05426414894c@csgroup.eu> (raw)
In-Reply-To: <20220726083406.tcjvny6d2di6q7ar@pali>



Le 26/07/2022 à 10:34, Pali Rohár a écrit :
> On Monday 25 July 2022 16:54:16 Segher Boessenkool wrote:
>> On Mon, Jul 25, 2022 at 10:10:09PM +0200, Pali Rohár wrote:
>>> On Monday 25 July 2022 16:20:49 Christophe Leroy wrote:
>>> Now I did again clean test with same Debian 10 cross compiler.
>>>
>>> $ git clone https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git && cd linux
>>> $ git checkout v5.15
>>> $ make mpc85xx_smp_defconfig ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnuspe-
>>> $ make vmlinux ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnuspe-
>>> $ cp -a vmlinux vmlinux.v5.15
>>> $ git revert 9401f4e46cf6965e23738f70e149172344a01eef
>>> $ make vmlinux ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnuspe-
>>> $ cp -a vmlinux vmlinux.revert
>>> $ powerpc-linux-gnuspe-objdump -d vmlinux.revert > vmlinux.revert.dump
>>> $ powerpc-linux-gnuspe-objdump -d vmlinux.v5.15 > vmlinux.v5.15.dump
>>> $ diff -Naurp vmlinux.v5.15.dump vmlinux.revert.dump
>>>
>>> And there are:
>>>
>>> -c000c304:      7d 20 f8 29     lwarx   r9,0,r31,1
>>> +c000c304:      7d 20 f8 28     lwarx   r9,0,r31
>>>
>>> I guess it must be reproducible this issue as I'm using regular
>>> toolchain from distribution.
>>
>> The kernel had
>>
>> #define PPC_RAW_LWARX(t, a, b, eh)       (0x7c000028 | ___PPC_RT(t) | ___PPC_RA(a) | ___PPC_RB(b) | __PPC_EH(eh))
>>
>> and
>>
>> #define PPC_LWARX(t, a, b, eh) stringify_in_c(.long PPC_RAW_LWARX(t, a, b, eh))
>>
>> and
>>
>> #ifdef CONFIG_PPC64
>> #define __PPC_EH(eh)    (((eh) & 0x1) << 0)
>> #else
>> #define __PPC_EH(eh)    0
>> #endif
>>
>> but Christophe's 9401f4e46cf6 changed
>>
>> -"1:    " PPC_LWARX(%0,0,%2,1) "\n\
>> +"1:    lwarx           %0,0,%2,1\n\
>>
>> no longer checking CONFIG_PPC64.  That appears to be the bug.
> 
> Nice catch!
> 
> Now I have tried to apply following change on master (without reverting
> anything)
> 
> diff --git a/arch/powerpc/include/asm/simple_spinlock.h b/arch/powerpc/include/asm/simple_spinlock.h
> index 7ae6aeef8464..72d3657fd2f7 100644
> --- a/arch/powerpc/include/asm/simple_spinlock.h
> +++ b/arch/powerpc/include/asm/simple_spinlock.h
> @@ -51,7 +51,7 @@ static inline unsigned long __arch_spin_trylock(arch_spinlock_t *lock)
>   
>   	token = LOCK_TOKEN;
>   	__asm__ __volatile__(
> -"1:	lwarx		%0,0,%2,1\n\
> +"1:	lwarx		%0,0,%2,0\n\
>   	cmpwi		0,%0,0\n\
>   	bne-		2f\n\
>   	stwcx.		%1,0,%2\n\
> @@ -158,7 +158,7 @@ static inline long __arch_read_trylock(arch_rwlock_t *rw)
>   	long tmp;
>   
>   	__asm__ __volatile__(
> -"1:	lwarx		%0,0,%1,1\n"
> +"1:	lwarx		%0,0,%1,0\n"
>   	__DO_SIGN_EXTEND
>   "	addic.		%0,%0,1\n\
>   	ble-		2f\n"
> @@ -182,7 +182,7 @@ static inline long __arch_write_trylock(arch_rwlock_t *rw)
>   
>   	token = WRLOCK_TOKEN;
>   	__asm__ __volatile__(
> -"1:	lwarx		%0,0,%2,1\n\
> +"1:	lwarx		%0,0,%2,0\n\
>   	cmpwi		0,%0,0\n\
>   	bne-		2f\n"
>   "	stwcx.		%1,0,%2\n\
> 
> and with this change, objdump showed exactly same result as if I revert
> that problematic commit on top of master branch.
> 
> I guess that simple_spinlock.h should be fixed to pass 1 to lwarx for
> CONFIG_PPC64 and 0 otherwise.
> 
> Christophe, are you going to look at it?
> 

Yes I will, but next week at the earliest.

Christophe

      parent reply	other threads:[~2022-07-26 14:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-22  9:09 Pali Rohár
2022-07-23 14:42 ` Christophe Leroy
2022-07-23 15:07   ` Pali Rohár
2022-07-25  8:20     ` Michael Ellerman
2022-07-25 12:52       ` Pali Rohár
2022-07-25 16:20         ` Christophe Leroy
2022-07-25 20:10           ` Pali Rohár
2022-07-25 21:54             ` Segher Boessenkool
2022-07-26  8:34               ` Pali Rohár
2022-07-26  9:02                 ` Arnd Bergmann
2022-07-26 13:44                   ` Segher Boessenkool
2022-07-26 14:01                     ` Pali Rohár
2022-07-26 14:14                       ` Segher Boessenkool
2022-08-02  6:47                     ` Christophe Leroy
2022-08-02  8:28                       ` Arnd Bergmann
2022-07-26 14:30                 ` Christophe Leroy [this message]

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=4933ed23-9d0e-cffc-7bc6-05426414894c@csgroup.eu \
    --to=christophe.leroy@csgroup.eu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=pali@kernel.org \
    --cc=segher@kernel.crashing.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

all inboxes | Powered by JetHome®