From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: Call for testing/opinions: Optimized memset/memcpy
Date: Sun, 14 Jul 2013 14:09:50 +0100 [thread overview]
Message-ID: <20130714130949.GR24642@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <loom.20130714T124137-382@post.gmane.org>
On Sun, Jul 14, 2013 at 11:00:50AM +0000, Harm Hanemaaijer wrote:
> What is interesting is that
> http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0388f/Caccifbd.html,
> and several other sources (such as other
> optimized memcpy implementations) document the cache line size of the Cortex
> A9 as 32 bytes, which is an anomaly in the armv7 family. However, it looks
> like the kernel is defining L1_CACHE_BYTES as 64 (L1_CACHE_SHIFT == 6) for
> all armv7 platforms, which looks like a serious configuring error for Cortex
> A9.
You're making wrong assumptions about what L1_CACHE_BYTES is.
Firstly, L1_CACHE_BYTES is not dynamic - it's a build time constant.
You have to make a decision what value it is to be set to when you
build the kernel. This is because it gets used to determine the
alignment of structures built into the kernel image, amongst other
things, and we can't dynamically relink the kernel at boot time.
So please, get out of your mind any idea that L1_CACHE_BYTES somehow
relates to the exact CPU you're running on. It doesn't.
What it relates to is the *maximum* cache line size of *any* CPU that
we will run on.
Take a moment to think about why given the above. If you're booting on
a 32 byte cache line CPU, will a structure aligned for a 64 byte cache
line also be aligned for a 32-byte cache line? How about the reverse
case?
Now, there are various ARMv7 Cortex CPUs that have 64 byte cache lines
out there in the wild - Cortex A8 and Cortex A15 are two examples, both
of them are ARMv7 CPUs.
As we can't distinguish at run time between these, and we are working for
a single zImage kernel, we have to assume that ARMv7 means a 64 byte cache
line as far as the L1_CACHE_* constants are concerned. Yes, we used to
set it for OMAP3 and some Samsung SoC too, but then others came along and
single zImage too - and that all makes trying to reduce it down to the
minimum rather pointless.
So, no, this is *not* a "serious configuring error" at all. It is totally
intended to be this way.
next prev parent reply other threads:[~2013-07-14 13:09 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-13 15:51 Call for testing/opinions: Optimized memset/memcpy Harm Hanemaaijer
2013-07-13 16:48 ` Dr. David Alan Gilbert
2013-07-13 21:13 ` Harm Hanemaaijer
2013-07-15 13:15 ` Catalin Marinas
2013-07-14 11:19 ` Harm Hanemaaijer
2013-07-14 11:32 ` Dr. David Alan Gilbert
2013-07-14 11:37 ` Ard Biesheuvel
2013-07-14 13:13 ` Russell King - ARM Linux
2013-07-14 13:33 ` Harm Hanemaaijer
2013-07-14 14:09 ` Ard Biesheuvel
2013-07-14 14:32 ` Russell King - ARM Linux
2013-07-13 17:24 ` Willy Tarreau
2013-07-13 21:51 ` Harm Hanemaaijer
2013-07-14 6:13 ` Willy Tarreau
2013-07-14 11:00 ` Harm Hanemaaijer
2013-07-14 13:09 ` Russell King - ARM Linux [this message]
2013-07-14 13:59 ` Harm Hanemaaijer
2013-07-14 15:21 ` Siarhei Siamashka
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=20130714130949.GR24642@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--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).