linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: dsterba@suse.cz (David Sterba)
To: linux-arm-kernel@lists.infradead.org
Subject: btrfs_get_token_64() alignment problem on ARM (was: Re: DWord alignment on ARMv7)
Date: Fri, 4 Mar 2016 10:16:02 +0100	[thread overview]
Message-ID: <20160304091602.GH29310@suse.cz> (raw)
In-Reply-To: <56D940E8.2030202@pengutronix.de>

On Fri, Mar 04, 2016 at 09:01:44AM +0100, Marc Kleine-Budde wrote:
> Hello,
> 
> On 03/04/2016 12:54 AM, Will Deacon wrote:
> > Hi Marc,
> > 
> > On Thu, Mar 03, 2016 at 11:27:11PM +0100, Marc Kleine-Budde wrote:
> >> I'm using btrfs on am ARMv7 and it turns out, that the kernel has to
> >> fixup a lot of kernel originated alignment issues.
> >>
> >> See /proc/cpu/alignment (~4h of uptime):
> >>> System: 22304815 (btrfs_get_token_64+0x13c/0x148 [btrfs])
> >>
> >> For example, when compiling the kernel on a btrfs volume the counter
> >> increases by 100...1000 per second.
> >>
> >> The function shown "btrfs_get_token_64()" is defined here:
> >>> http://lxr.free-electrons.com/source/fs/btrfs/struct-funcs.c#L53
> >> ...it already uses get_unaligned_leXX accessors.
> >>
> >> Quoting a comment in arch/arm/mm/alignment.c:
> >>
> >>          * ARMv6 and later CPUs can perform unaligned accesses for
> >>          * most single load and store instructions up to word size.
> >>          * LDM, STM, LDRD and STRD still need to be handled.
> >>
> >> But on a 32bit ARMv7 64bits are not word-sized.
> >>
> >> Is the exception and fixup overhead neglectable? Do we have to introduce
> >> something like HAVE_EFFICIENT_UNALIGNED_64BIT_ACCESS?
> > 
> > Ouch, that trap/emulate is certainly going to have an effect on your
> > performance. I doubt that HAVE_EFFICIENT_UNALIGNED_ACCESS applies to
> > types bigger than the native word size on many architectures, so my
> > hunch is that the btrfs code should be checking BITS_PER_LONG or similar
> > to establish whether or not to break the access up into word accesses.
> 
> I've added the btrfs maintainers on Cc.

Can this be done transparently via the the get_unaligned_le* helpers?
This seems to be too arch-specific to fix it in btrfs.

  reply	other threads:[~2016-03-04  9:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-03 22:27 DWord alignment on ARMv7 Marc Kleine-Budde
2016-03-03 23:54 ` Will Deacon
2016-03-04  8:01   ` btrfs_get_token_64() alignment problem on ARM (was: Re: DWord alignment on ARMv7) Marc Kleine-Budde
2016-03-04  9:16     ` David Sterba [this message]
2016-03-04 10:48   ` DWord alignment on ARMv7 Ard Biesheuvel
2016-03-04 11:02     ` Russell King - ARM Linux
2016-03-04 11:14       ` Ard Biesheuvel
2016-03-04 11:19         ` Marc Kleine-Budde
2016-03-04 11:26           ` Ard Biesheuvel
2016-03-04 11:38         ` Arnd Bergmann
2016-03-04 11:44           ` Ard Biesheuvel
2016-03-04 13:30             ` Arnd Bergmann
2016-03-04 13:33               ` Ard Biesheuvel
2016-03-04 13:46               ` Russell King - ARM Linux
2016-03-04 14:41                 ` Arnd Bergmann
2016-03-04 14:56                   ` Russell King - ARM Linux
2016-03-04 15:49                     ` Arnd Bergmann

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=20160304091602.GH29310@suse.cz \
    --to=dsterba@suse.cz \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).