From: u.kleine-koenig@pengutronix.de (Uwe Kleine-König)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: reinsert ARCH_MULTI_V4 Kconfig option
Date: Wed, 9 Apr 2014 17:13:26 +0200 [thread overview]
Message-ID: <20140409151326.GY29751@pengutronix.de> (raw)
In-Reply-To: <20140409150640.GQ16119@n2100.arm.linux.org.uk>
Hello Russell,
On Wed, Apr 09, 2014 at 04:06:40PM +0100, Russell King - ARM Linux wrote:
> On Wed, Apr 09, 2014 at 04:54:16PM +0200, Jonas Jensen wrote:
> > On 13 December 2013 12:39, Russell King - ARM Linux
> > <linux@arm.linux.org.uk> wrote:
> > > I see what's causing this: the kuser helpers are using "bx lr" to return
> > > which will be undefined on non-Thumb CPUs. We generally cope fine with
> > > non-Thumb CPUs, conditionalising where necessary on HWCAP_THUMB or the
> > > T bit in the PSR being set.
> > >
> > > However, it looks like the kuser helpers got missed. As a check, please
> > > look at arch/arm/kernel/entry-armv.S, find the line with:
> > >
> > > .macro usr_ret, reg
> > >
> > > and ensure that the mov pc, \reg case always gets used. Please report
> > > back.
> >
> > Uwe and Arnd came up with a solution except it doesn't work when I test it.
> >
> > The suggested patch is:
> >
> > diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
> > index 1879e8d..de15bfd 100644
> > --- a/arch/arm/kernel/entry-armv.S
> > +++ b/arch/arm/kernel/entry-armv.S
> > @@ -739,6 +739,18 @@ ENDPROC(__switch_to)
> >
> > .macro usr_ret, reg
> > #ifdef CONFIG_ARM_THUMB
> > + /*
> > + * Having CONFIG_ARM_THUMB isn't a guarantee that the cpu has support
> > + * for Thumb and so the bx instruction. Use a mov if the address to
> > + * jump to is 32 bit aligned. (Note that this code is compiled in ARM
> > + * mode, so this is the right test.)
> > + */
> > +#if defined(CONFIG_CPU_32v4)
> > + tst \reg, #3
> > + moveq pc, \reg
> > + b .
> > +#endif
> > +
> > bx \reg
>
> What's wrong with:
> tst \reg, #3
> moveq pc, \reg
> bx \reg
>
> rather than ending in an infinite loop?
The added b . was a test to check if the machine then hangs instead of
crashing. (And yes, that was the case, so it was tried to return to a
non-aligned address.)
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |
WARNING: multiple messages have this Message-ID (diff)
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Jonas Jensen <jonas.jensen@gmail.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"arm@kernel.org" <arm@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
ulli.kroll@googlemail.com, Arnd Bergmann <arnd@arndb.de>,
Olof Johansson <olof@lixom.net>
Subject: Re: [PATCH] ARM: reinsert ARCH_MULTI_V4 Kconfig option
Date: Wed, 9 Apr 2014 17:13:26 +0200 [thread overview]
Message-ID: <20140409151326.GY29751@pengutronix.de> (raw)
In-Reply-To: <20140409150640.GQ16119@n2100.arm.linux.org.uk>
Hello Russell,
On Wed, Apr 09, 2014 at 04:06:40PM +0100, Russell King - ARM Linux wrote:
> On Wed, Apr 09, 2014 at 04:54:16PM +0200, Jonas Jensen wrote:
> > On 13 December 2013 12:39, Russell King - ARM Linux
> > <linux@arm.linux.org.uk> wrote:
> > > I see what's causing this: the kuser helpers are using "bx lr" to return
> > > which will be undefined on non-Thumb CPUs. We generally cope fine with
> > > non-Thumb CPUs, conditionalising where necessary on HWCAP_THUMB or the
> > > T bit in the PSR being set.
> > >
> > > However, it looks like the kuser helpers got missed. As a check, please
> > > look at arch/arm/kernel/entry-armv.S, find the line with:
> > >
> > > .macro usr_ret, reg
> > >
> > > and ensure that the mov pc, \reg case always gets used. Please report
> > > back.
> >
> > Uwe and Arnd came up with a solution except it doesn't work when I test it.
> >
> > The suggested patch is:
> >
> > diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
> > index 1879e8d..de15bfd 100644
> > --- a/arch/arm/kernel/entry-armv.S
> > +++ b/arch/arm/kernel/entry-armv.S
> > @@ -739,6 +739,18 @@ ENDPROC(__switch_to)
> >
> > .macro usr_ret, reg
> > #ifdef CONFIG_ARM_THUMB
> > + /*
> > + * Having CONFIG_ARM_THUMB isn't a guarantee that the cpu has support
> > + * for Thumb and so the bx instruction. Use a mov if the address to
> > + * jump to is 32 bit aligned. (Note that this code is compiled in ARM
> > + * mode, so this is the right test.)
> > + */
> > +#if defined(CONFIG_CPU_32v4)
> > + tst \reg, #3
> > + moveq pc, \reg
> > + b .
> > +#endif
> > +
> > bx \reg
>
> What's wrong with:
> tst \reg, #3
> moveq pc, \reg
> bx \reg
>
> rather than ending in an infinite loop?
The added b . was a test to check if the machine then hangs instead of
crashing. (And yes, that was the case, so it was tried to return to a
non-aligned address.)
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
next prev parent reply other threads:[~2014-04-09 15:13 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-13 8:09 [PATCH] ARM: reinsert ARCH_MULTI_V4 Kconfig option Jonas Jensen
2013-12-13 8:09 ` Jonas Jensen
2013-12-13 9:56 ` Russell King - ARM Linux
2013-12-13 9:56 ` Russell King - ARM Linux
2013-12-13 10:51 ` Jonas Jensen
2013-12-13 10:51 ` Jonas Jensen
2013-12-13 11:39 ` Russell King - ARM Linux
2013-12-13 11:39 ` Russell King - ARM Linux
2013-12-13 13:33 ` Jonas Jensen
2013-12-13 13:33 ` Jonas Jensen
2014-04-09 14:54 ` Jonas Jensen
2014-04-09 14:54 ` Jonas Jensen
2014-04-09 15:04 ` Uwe Kleine-König
2014-04-09 15:04 ` Uwe Kleine-König
2014-04-09 15:09 ` Russell King - ARM Linux
2014-04-09 15:09 ` Russell King - ARM Linux
2014-04-09 15:06 ` Russell King - ARM Linux
2014-04-09 15:06 ` Russell King - ARM Linux
2014-04-09 15:13 ` Uwe Kleine-König [this message]
2014-04-09 15:13 ` Uwe Kleine-König
2014-04-09 15:27 ` Russell King - ARM Linux
2014-04-09 15:27 ` Russell King - ARM Linux
2014-04-09 15:50 ` Arnd Bergmann
2014-04-09 15:50 ` Arnd Bergmann
2014-04-09 16:01 ` Russell King - ARM Linux
2014-04-09 16:01 ` Russell King - ARM Linux
2014-04-10 8:04 ` Jonas Jensen
2014-04-10 8:04 ` Jonas Jensen
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=20140409151326.GY29751@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.