From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: Stafford Horne <shorne@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Jonas Bonn <jonas@southpole.se>,
Albert Ou <aou@eecs.berkeley.edu>,
linux-riscv@lists.infradead.org,
Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>,
openrisc@lists.librecores.org,
Palmer Dabbelt <palmer@dabbelt.com>,
Greentime Hu <green.hu@gmail.com>,
Paul Walmsley <paul.walmsley@sifive.com>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v3 3/3] openrisc: Fix issue with get_user for 64-bit values
Date: Fri, 11 Sep 2020 22:55:26 +0200 [thread overview]
Message-ID: <20200911205526.65llro2gnh7zlsu4@ltop.local> (raw)
In-Reply-To: <20200910233940.2132107-4-shorne@gmail.com>
On Fri, Sep 11, 2020 at 08:39:40AM +0900, Stafford Horne wrote:
> A build failure was raised by kbuild with the following error.
>
> drivers/android/binder.c: Assembler messages:
> drivers/android/binder.c:3861: Error: unrecognized keyword/register name `l.lwz ?ap,4(r24)'
> drivers/android/binder.c:3866: Error: unrecognized keyword/register name `l.addi ?ap,r0,0'
>
> The issue is with 64-bit get_user() calls on openrisc. I traced this to
> a problem where in the internally in the get_user macros there is a cast
> to long __gu_val this causes GCC to think the get_user call is 32-bit.
> This binder code is really long and GCC allocates register r30, which
> triggers the issue. The 64-bit get_user asm tries to get the 64-bit pair
> register, which for r30 overflows the general register names and returns
> the dummy register ?ap.
>
> The fix here is to move the temporary variables into the asm macros. We
> use a 32-bit __gu_tmp for 32-bit and smaller macro and a 64-bit tmp in
> the 64-bit macro. The cast in the 64-bit macro has a trick of casting
> through __typeof__((x)-(x)) which avoids the below warning. This was
> barrowed from riscv.
>
> arch/openrisc/include/asm/uaccess.h:240:8: warning: cast to pointer from integer of different size
>
> I tested this is a small unit test to check reading between 64-bit and
> 32-bit pointers to 64-bit and 32-bit values in all combinations. Also I
> ran make C=1 to confirm no new sparse warnings came up. It all looks
> clean to me.
It looks correct to me too now at C & assembly level.
Feel free to add my:
Reviewed-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-- Luc
next prev parent reply other threads:[~2020-09-11 20:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-10 23:39 [PATCH v3 0/3] OpenRISC fixes for 5.9-rc4 Stafford Horne
2020-09-10 23:39 ` [PATCH v3 1/3] openrisc: Reserve memblock for initrd Stafford Horne
2020-09-10 23:39 ` [PATCH v3 2/3] openrisc: Fix cache API compile issue when not inlining Stafford Horne
2020-09-10 23:39 ` [PATCH v3 3/3] openrisc: Fix issue with get_user for 64-bit values Stafford Horne
2020-09-11 20:55 ` Luc Van Oostenryck [this message]
2020-09-12 8:40 ` Stafford Horne
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=20200911205526.65llro2gnh7zlsu4@ltop.local \
--to=luc.vanoostenryck@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=aou@eecs.berkeley.edu \
--cc=geert@linux-m68k.org \
--cc=green.hu@gmail.com \
--cc=jonas@southpole.se \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=openrisc@lists.librecores.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=shorne@gmail.com \
--cc=stefan.kristiansson@saunalahti.fi \
/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®