From: Nicolas Pitre <nico@fluxnic.net> To: Russell King - ARM Linux <linux@arm.linux.org.uk> Cc: linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org Subject: Re: [PATCH 01/14] ARM: bitops: ensure set/clear/change bitops take a word-aligned pointer Date: Tue, 18 Jan 2011 01:00:21 -0500 (EST) [thread overview] Message-ID: <alpine.LFD.2.00.1101180043140.8580@xanadu.home> (raw) In-Reply-To: <E1Peudk-0003SJ-Aj@rmk-PC.arm.linux.org.uk> On Mon, 17 Jan 2011, Russell King - ARM Linux wrote: > Add additional instructions to our assembly bitops functions to ensure > that they only operate on word-aligned pointers. This will be necessary > when we switch these operations to use the word-based exclusive > operations. > > Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> This breaks the Thumb2 kernel build: AS arch/arm/lib/changebit.o arch/arm/lib/changebit.S: Assembler messages: arch/arm/lib/changebit.S:16: Error: Thumb does not support negative register indexing -- `strne r1,[r1,-r1]' I also wonder what happens with a misaligned ldrex/strex... Does the alignment trap get invoked? If so, the assertion could be put there instead if that's not done already, removing this overhead from bitops calls. In the pre-ARMv6 case the alignment trap fixup would be applied as usual since the ldr/str are not special, but the previous code allowed for misaligned pointer so result would be no worse than before in that case. Testing appears to indicate those misaligned bitops are rather nonexistent so far. > --- > arch/arm/lib/bitops.h | 8 ++++++++ > 1 files changed, 8 insertions(+), 0 deletions(-) > > diff --git a/arch/arm/lib/bitops.h b/arch/arm/lib/bitops.h > index d422529..910d599 100644 > --- a/arch/arm/lib/bitops.h > +++ b/arch/arm/lib/bitops.h > @@ -1,6 +1,8 @@ > > #if __LINUX_ARM_ARCH__ >= 6 && defined(CONFIG_CPU_32v6K) > .macro bitop, instr > + tst r1, #3 > + strne r1, [r1, -r1] @ assert word-aligned > mov r2, #1 > and r3, r0, #7 @ Get bit offset > add r1, r1, r0, lsr #3 @ Get byte offset > @@ -14,6 +16,8 @@ > .endm > > .macro testop, instr, store > + tst r1, #3 > + strne r1, [r1, -r1] @ assert word-aligned > and r3, r0, #7 @ Get bit offset > mov r2, #1 > add r1, r1, r0, lsr #3 @ Get byte offset > @@ -32,6 +36,8 @@ > .endm > #else > .macro bitop, instr > + tst r1, #3 > + strne r1, [r1, -r1] @ assert word-aligned > and r2, r0, #7 > mov r3, #1 > mov r3, r3, lsl r2 > @@ -52,6 +58,8 @@ > * to avoid dirtying the data cache. > */ > .macro testop, instr, store > + tst r1, #3 > + strne r1, [r1, -r1] @ assert word-aligned > add r1, r1, r0, lsr #3 > and r3, r0, #7 > mov r0, #1 > -- > 1.6.2.5 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel >
WARNING: multiple messages have this Message-ID (diff)
From: nico@fluxnic.net (Nicolas Pitre) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 01/14] ARM: bitops: ensure set/clear/change bitops take a word-aligned pointer Date: Tue, 18 Jan 2011 01:00:21 -0500 (EST) [thread overview] Message-ID: <alpine.LFD.2.00.1101180043140.8580@xanadu.home> (raw) In-Reply-To: <E1Peudk-0003SJ-Aj@rmk-PC.arm.linux.org.uk> On Mon, 17 Jan 2011, Russell King - ARM Linux wrote: > Add additional instructions to our assembly bitops functions to ensure > that they only operate on word-aligned pointers. This will be necessary > when we switch these operations to use the word-based exclusive > operations. > > Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> This breaks the Thumb2 kernel build: AS arch/arm/lib/changebit.o arch/arm/lib/changebit.S: Assembler messages: arch/arm/lib/changebit.S:16: Error: Thumb does not support negative register indexing -- `strne r1,[r1,-r1]' I also wonder what happens with a misaligned ldrex/strex... Does the alignment trap get invoked? If so, the assertion could be put there instead if that's not done already, removing this overhead from bitops calls. In the pre-ARMv6 case the alignment trap fixup would be applied as usual since the ldr/str are not special, but the previous code allowed for misaligned pointer so result would be no worse than before in that case. Testing appears to indicate those misaligned bitops are rather nonexistent so far. > --- > arch/arm/lib/bitops.h | 8 ++++++++ > 1 files changed, 8 insertions(+), 0 deletions(-) > > diff --git a/arch/arm/lib/bitops.h b/arch/arm/lib/bitops.h > index d422529..910d599 100644 > --- a/arch/arm/lib/bitops.h > +++ b/arch/arm/lib/bitops.h > @@ -1,6 +1,8 @@ > > #if __LINUX_ARM_ARCH__ >= 6 && defined(CONFIG_CPU_32v6K) > .macro bitop, instr > + tst r1, #3 > + strne r1, [r1, -r1] @ assert word-aligned > mov r2, #1 > and r3, r0, #7 @ Get bit offset > add r1, r1, r0, lsr #3 @ Get byte offset > @@ -14,6 +16,8 @@ > .endm > > .macro testop, instr, store > + tst r1, #3 > + strne r1, [r1, -r1] @ assert word-aligned > and r3, r0, #7 @ Get bit offset > mov r2, #1 > add r1, r1, r0, lsr #3 @ Get byte offset > @@ -32,6 +36,8 @@ > .endm > #else > .macro bitop, instr > + tst r1, #3 > + strne r1, [r1, -r1] @ assert word-aligned > and r2, r0, #7 > mov r3, #1 > mov r3, r3, lsl r2 > @@ -52,6 +58,8 @@ > * to avoid dirtying the data cache. > */ > .macro testop, instr, store > + tst r1, #3 > + strne r1, [r1, -r1] @ assert word-aligned > add r1, r1, r0, lsr #3 > and r3, r0, #7 > mov r0, #1 > -- > 1.6.2.5 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel at lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel >
next prev parent reply other threads:[~2011-01-18 6:00 UTC|newest] Thread overview: 254+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-01-17 19:20 [PATCH 00/14] Fix issues with ARMv6+v6k+v7 kernels Russell King - ARM Linux 2011-01-17 19:20 ` Russell King - ARM Linux 2011-01-17 19:21 ` [PATCH 01/14] ARM: bitops: ensure set/clear/change bitops take a word-aligned pointer Russell King - ARM Linux 2011-01-17 19:21 ` Russell King - ARM Linux 2011-01-18 6:00 ` Nicolas Pitre [this message] 2011-01-18 6:00 ` Nicolas Pitre 2011-01-18 14:30 ` Russell King - ARM Linux 2011-01-18 14:30 ` Russell King - ARM Linux 2011-01-18 18:20 ` Nicolas Pitre 2011-01-18 18:20 ` Nicolas Pitre 2011-01-18 15:11 ` Catalin Marinas 2011-01-18 15:11 ` Catalin Marinas 2011-01-25 19:50 ` Tony Lindgren 2011-01-25 19:50 ` Tony Lindgren 2011-01-17 19:21 ` [PATCH 02/14] ARM: bitops: switch set/clear/change bitops to use ldrex/strex Russell King - ARM Linux 2011-01-17 19:21 ` Russell King - ARM Linux 2011-01-18 5:42 ` Nicolas Pitre 2011-01-18 5:42 ` Nicolas Pitre 2011-01-23 0:16 ` Russell King - ARM Linux 2011-01-23 0:16 ` Russell King - ARM Linux 2011-01-23 4:44 ` Nicolas Pitre 2011-01-23 4:44 ` Nicolas Pitre 2011-01-23 9:35 ` Russell King - ARM Linux 2011-01-23 9:35 ` Russell King - ARM Linux 2011-01-24 8:38 ` Poddar, Sourav 2011-01-24 8:38 ` Poddar, Sourav 2011-01-24 8:57 ` Poddar, Sourav 2011-01-24 8:57 ` Poddar, Sourav 2011-01-24 10:28 ` Russell King - ARM Linux 2011-01-24 10:28 ` Russell King - ARM Linux 2011-01-24 13:47 ` Poddar, Sourav 2011-01-24 13:47 ` Poddar, Sourav 2011-01-24 14:11 ` Russell King - ARM Linux 2011-01-24 14:11 ` Russell King - ARM Linux 2011-01-24 14:54 ` Poddar, Sourav 2011-01-24 14:54 ` Poddar, Sourav 2011-01-24 15:00 ` Russell King - ARM Linux 2011-01-24 15:00 ` Russell King - ARM Linux 2011-01-25 13:57 ` Will Deacon 2011-01-25 13:57 ` Will Deacon 2011-01-25 14:11 ` Russell King - ARM Linux 2011-01-25 14:11 ` Russell King - ARM Linux 2011-01-25 14:19 ` Will Deacon 2011-01-25 14:19 ` Will Deacon [not found] ` <000601cbbc97$cc6955d0$653c0170$%deacon@arm.com> 2011-01-25 21:38 ` Nicolas Pitre 2011-01-25 21:38 ` Nicolas Pitre 2011-01-25 19:51 ` Tony Lindgren 2011-01-25 19:51 ` Tony Lindgren 2011-01-17 19:22 ` [PATCH 03/14] ARM: v6k: remove CPU_32v6K dependencies in asm/spinlock.h Russell King - ARM Linux 2011-01-17 19:22 ` Russell King - ARM Linux 2011-01-17 23:13 ` Tony Lindgren 2011-01-17 23:13 ` Tony Lindgren 2011-01-25 16:43 ` Dave Martin 2011-01-25 16:43 ` Dave Martin 2011-01-25 16:59 ` Russell King - ARM Linux 2011-01-25 16:59 ` Russell King - ARM Linux 2011-01-25 17:33 ` Dave Martin 2011-01-25 17:33 ` Dave Martin 2011-01-25 17:46 ` Russell King - ARM Linux 2011-01-25 17:46 ` Russell King - ARM Linux 2011-01-25 21:21 ` Nicolas Pitre 2011-01-25 21:21 ` Nicolas Pitre 2011-01-26 11:11 ` Dave Martin 2011-01-26 11:11 ` Dave Martin 2011-01-26 12:44 ` Russell King - ARM Linux 2011-01-26 12:44 ` Russell King - ARM Linux 2011-01-26 17:25 ` [PATCH] ARM: Avoid discarding sections that might have SMP_ON_UP fixups Dave P. Martin 2011-01-26 17:25 ` Dave P. Martin 2011-01-26 21:31 ` Nicolas Pitre 2011-01-26 21:31 ` Nicolas Pitre 2011-01-27 14:37 ` [PATCH v2] ARM: Avoid discarding sections that might have SMP_ON_UP fixups " Dave Martin 2011-01-27 14:37 ` Dave Martin 2011-01-27 16:46 ` Russell King - ARM Linux 2011-01-27 16:46 ` Russell King - ARM Linux 2011-02-09 14:22 ` [PATCH] ARM: Avoid discarding sections that might have " Russell King - ARM Linux 2011-02-09 14:22 ` Russell King - ARM Linux 2011-02-10 12:56 ` Russell King - ARM Linux 2011-02-10 12:56 ` Russell King - ARM Linux 2011-02-10 14:11 ` Dave Martin 2011-02-10 14:11 ` Dave Martin 2011-02-10 14:13 ` Dave Martin 2011-02-10 14:13 ` Dave Martin 2011-02-10 14:46 ` Russell King - ARM Linux 2011-02-10 14:46 ` Russell King - ARM Linux 2011-02-10 18:29 ` Dave Martin 2011-02-10 18:29 ` Dave Martin 2011-02-10 19:11 ` Russell King - ARM Linux 2011-02-10 19:11 ` Russell King - ARM Linux 2011-02-11 9:33 ` Dave Martin 2011-02-11 9:33 ` Dave Martin 2011-02-11 10:13 ` Russell King - ARM Linux 2011-02-11 10:13 ` Russell King - ARM Linux 2011-02-11 10:52 ` Dave Martin 2011-02-11 10:52 ` Dave Martin 2011-02-11 16:05 ` Russell King - ARM Linux 2011-02-11 16:05 ` Russell King - ARM Linux 2011-02-11 16:17 ` Dave Martin 2011-02-11 16:17 ` Dave Martin 2011-02-11 16:32 ` Russell King - ARM Linux 2011-02-11 16:32 ` Russell King - ARM Linux 2011-02-16 16:35 ` Dave Martin 2011-02-16 16:35 ` Dave Martin 2011-02-18 17:52 ` Dave Martin 2011-02-18 17:52 ` Dave Martin 2011-01-26 15:42 ` [PATCH 03/14] ARM: v6k: remove CPU_32v6K dependencies in asm/spinlock.h Nicolas Pitre 2011-01-26 15:42 ` Nicolas Pitre 2011-01-26 15:52 ` Russell King - ARM Linux 2011-01-26 15:52 ` Russell King - ARM Linux 2011-01-26 16:59 ` Dave Martin 2011-01-26 16:59 ` Dave Martin 2011-01-26 21:06 ` Nicolas Pitre 2011-01-26 21:06 ` Nicolas Pitre 2011-01-27 11:44 ` Dave P. Martin 2011-01-27 11:44 ` Dave P. Martin 2011-01-17 19:22 ` [PATCH 04/14] ARM: v6k: introduce CPU_V6K option Russell King - ARM Linux 2011-01-17 19:22 ` Russell King - ARM Linux 2011-01-17 23:14 ` Tony Lindgren 2011-01-17 23:14 ` Tony Lindgren 2011-01-18 10:36 ` Will Deacon 2011-01-18 10:36 ` Will Deacon 2011-01-18 11:09 ` Russell King - ARM Linux 2011-01-18 11:09 ` Russell King - ARM Linux 2011-01-18 13:35 ` Russell King - ARM Linux 2011-01-18 13:35 ` Russell King - ARM Linux 2011-01-18 15:22 ` Will Deacon 2011-01-18 15:22 ` Will Deacon 2011-01-17 19:22 ` [PATCH 05/14] ARM: v6k: Realview EB 11MPCore and PB11MPCore use V6K architecture CPUs Russell King - ARM Linux 2011-01-17 19:22 ` Russell King - ARM Linux 2011-01-17 19:23 ` [PATCH 06/14] ARM: v6k: Dove platforms " Russell King - ARM Linux 2011-01-17 19:23 ` Russell King - ARM Linux 2011-01-17 23:39 ` Nicolas Pitre 2011-01-17 23:39 ` Nicolas Pitre 2011-01-17 19:23 ` [PATCH 07/14] ARM: v6k: select clear exclusive code seqences according to V6 variants Russell King - ARM Linux 2011-01-17 19:23 ` Russell King - ARM Linux 2011-01-17 23:15 ` Tony Lindgren 2011-01-17 23:15 ` Tony Lindgren 2011-01-17 19:23 ` [PATCH 08/14] ARM: v6k: select cmpxchg code sequences " Russell King - ARM Linux 2011-01-17 19:23 ` Russell King - ARM Linux 2011-01-17 23:18 ` Tony Lindgren 2011-01-17 23:18 ` Tony Lindgren 2011-01-17 19:24 ` [PATCH 09/14] ARM: v6k: select generic atomic64 code " Russell King - ARM Linux 2011-01-17 19:24 ` Russell King - ARM Linux 2011-01-17 23:21 ` Tony Lindgren 2011-01-17 23:21 ` Tony Lindgren 2011-01-18 10:24 ` Will Deacon 2011-01-18 10:24 ` Will Deacon 2011-01-17 19:24 ` [PATCH 10/14] ARM: v6k: select TLS register " Russell King - ARM Linux 2011-01-17 19:24 ` Russell King - ARM Linux 2011-01-17 22:23 ` Nicolas Pitre 2011-01-17 22:23 ` Nicolas Pitre 2011-01-17 22:36 ` Russell King - ARM Linux 2011-01-17 22:36 ` Russell King - ARM Linux 2011-01-17 22:52 ` Russell King - ARM Linux 2011-01-17 22:52 ` Russell King - ARM Linux 2011-01-18 4:27 ` Nicolas Pitre 2011-01-18 4:27 ` Nicolas Pitre 2011-01-18 4:25 ` Nicolas Pitre 2011-01-18 4:25 ` Nicolas Pitre 2011-01-17 23:21 ` Tony Lindgren 2011-01-17 23:21 ` Tony Lindgren 2011-01-17 19:24 ` [PATCH 11/14] ARM: v6k: use CPU domain feature if we include support for arch < ARMv6K Russell King - ARM Linux 2011-01-17 19:24 ` Russell King - ARM Linux 2011-01-17 22:03 ` Nicolas Pitre 2011-01-17 22:03 ` Nicolas Pitre 2011-01-17 23:23 ` Tony Lindgren 2011-01-17 23:23 ` Tony Lindgren 2011-01-27 18:14 ` Catalin Marinas 2011-01-27 18:14 ` Catalin Marinas 2011-01-27 18:59 ` Russell King - ARM Linux 2011-01-27 18:59 ` Russell King - ARM Linux 2011-01-28 9:46 ` Catalin Marinas 2011-01-28 9:46 ` Catalin Marinas 2011-01-28 9:59 ` Russell King - ARM Linux 2011-01-28 9:59 ` Russell King - ARM Linux 2011-01-28 10:46 ` Catalin Marinas 2011-01-28 10:46 ` Catalin Marinas 2011-01-28 11:06 ` Russell King - ARM Linux 2011-01-28 11:06 ` Russell King - ARM Linux 2011-01-28 12:25 ` Catalin Marinas 2011-01-28 12:25 ` Catalin Marinas 2011-01-28 13:05 ` Russell King - ARM Linux 2011-01-28 13:05 ` Russell King - ARM Linux 2011-01-28 13:10 ` Catalin Marinas 2011-01-28 13:10 ` Catalin Marinas 2011-01-28 13:22 ` Russell King - ARM Linux 2011-01-28 13:22 ` Russell King - ARM Linux 2011-01-28 13:21 ` Russell King - ARM Linux 2011-01-28 13:21 ` Russell King - ARM Linux 2011-01-28 15:11 ` Catalin Marinas 2011-01-28 15:11 ` Catalin Marinas 2011-01-28 16:49 ` Tony Lindgren 2011-01-28 16:49 ` Tony Lindgren 2011-01-17 19:25 ` [PATCH 12/14] ARM: v6k: do not disable CPU_32v6K based on platform selection Russell King - ARM Linux 2011-01-17 19:25 ` Russell King - ARM Linux 2011-01-17 23:24 ` Tony Lindgren 2011-01-17 23:24 ` Tony Lindgren 2011-01-17 19:25 ` [PATCH 13/14] ARM: v6k: allow swp emulation again when ARMv7 is enabled Russell King - ARM Linux 2011-01-17 19:25 ` Russell King - ARM Linux 2011-01-17 23:24 ` Tony Lindgren 2011-01-17 23:24 ` Tony Lindgren 2011-01-17 19:25 ` [PATCH 14/14] ARM: v6k: only allow SMP if we have v6k or v7 CPU Russell King - ARM Linux 2011-01-17 19:25 ` Russell King - ARM Linux 2011-01-17 23:25 ` Tony Lindgren 2011-01-17 23:25 ` Tony Lindgren 2011-01-17 22:21 ` [PATCH 00/14] Fix issues with ARMv6+v6k+v7 kernels Tony Lindgren 2011-01-17 22:21 ` Tony Lindgren 2011-01-18 14:30 ` Kirill A. Shutemov 2011-01-18 14:30 ` Kirill A. Shutemov 2011-01-18 14:40 ` Russell King - ARM Linux 2011-01-18 14:40 ` Russell King - ARM Linux 2011-01-18 14:44 ` Kirill A. Shutemov 2011-01-18 14:44 ` Kirill A. Shutemov 2011-01-18 15:01 ` Russell King - ARM Linux 2011-01-18 15:01 ` Russell King - ARM Linux 2011-02-08 16:36 ` Santosh Shilimkar 2011-02-08 16:36 ` Santosh Shilimkar 2011-02-08 16:47 ` Russell King - ARM Linux 2011-02-08 16:47 ` Russell King - ARM Linux 2011-02-08 16:58 ` Santosh Shilimkar 2011-02-08 16:58 ` Santosh Shilimkar 2011-02-08 20:43 ` Nicolas Pitre 2011-02-08 20:43 ` Nicolas Pitre 2011-02-09 0:35 ` Tony Lindgren 2011-02-09 0:35 ` Tony Lindgren 2011-02-09 6:04 ` Santosh Shilimkar 2011-02-09 6:04 ` Santosh Shilimkar 2011-02-09 9:48 ` Dave Martin 2011-02-09 9:48 ` Dave Martin 2011-02-09 10:00 ` Santosh Shilimkar 2011-02-09 10:00 ` Santosh Shilimkar 2011-02-09 16:24 ` Tony Lindgren 2011-02-09 16:24 ` Tony Lindgren 2011-02-09 16:27 ` Santosh Shilimkar 2011-02-09 16:27 ` Santosh Shilimkar 2011-02-09 16:32 ` Russell King - ARM Linux 2011-02-09 16:32 ` Russell King - ARM Linux 2011-02-09 16:44 ` Russell King - ARM Linux 2011-02-09 16:44 ` Russell King - ARM Linux 2011-02-09 16:45 ` Nicolas Pitre 2011-02-09 16:45 ` Nicolas Pitre 2011-02-09 17:48 ` Tony Lindgren 2011-02-09 17:48 ` Tony Lindgren 2011-02-09 10:01 ` Catalin Marinas 2011-02-09 10:01 ` Catalin Marinas 2011-02-10 13:04 ` Russell King - ARM Linux 2011-02-10 13:04 ` Russell King - ARM Linux 2011-02-10 13:12 ` Catalin Marinas 2011-02-10 13:12 ` Catalin Marinas 2011-02-10 13:16 ` Russell King - ARM Linux 2011-02-10 13:16 ` Russell King - ARM Linux 2011-02-11 20:45 ` Nicolas Pitre 2011-02-11 20:45 ` Nicolas Pitre 2011-02-11 21:07 ` Russell King - ARM Linux 2011-02-11 21:07 ` Russell King - ARM Linux
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=alpine.LFD.2.00.1101180043140.8580@xanadu.home \ --to=nico@fluxnic.net \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-omap@vger.kernel.org \ --cc=linux@arm.linux.org.uk \ /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: linkBe 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.