From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: "Moffett, Kyle D" <Kyle.D.Moffett@boeing.com>
Cc: Timur Tabi <B04825@freescale.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Paul Gortmaker <paul.gortmaker@windriver.com>,
Scott Wood <scottwood@freescale.com>,
"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [RFC PATCH 00/17] powerpc/e500: separate e500 from e500mc
Date: Fri, 11 Nov 2011 15:40:10 +1100 [thread overview]
Message-ID: <1320986410.21206.48.camel@pasglop> (raw)
In-Reply-To: <15AB1C61-181F-4454-AF99-772B73DE0AA5@boeing.com>
On Thu, 2011-11-10 at 18:38 -0600, Moffett, Kyle D wrote:
> Ok, so I've been poking around this code a bunch and as far as I can
> tell, the cacheline stuff has basically always been subtly wrong in
> twelve different ways and it's only largely coincidence that it works
> today.
Yay ! Somebody to clean that shit up ! :-)
That's the biggest missing step to being able to have 440 and 476 in a
single binary :-)
> So PowerPC64 systems have their own "ppc64_caches" structure set up
> before start_kernel() is called by parsing the OpenFirmware "cpu" nodes.
> That structure is then checked in every piece of 64-bit kernel code
> (except xmon) that uses the "dcbXX" and "icbXX" opcodes.
Yup. (And we should really fix xmon btw...)
> There is an entirely separate mechanism built into the "cputable" that
> is used on all PowerPC systems to compute cacheline sizes to pass in via
> ELF headers for userspace to use in memset()/memcpy(), etc.
Yeah well, it actually uses global variables which are set from cputable
on ppc32 and from the ppc64_caches structure on ppc64. Yeah it's not
pretty.
> Furthermore, the VDSO gets cacheline sizes stored into it, but on 64-bit
> they come from the ppc64_caches structure and on 32-bit they come from
> dcache_bsize/icache_bsize copied from the cputable.
Yup.
> Then there's the value in arch/powerpc/include/asm/cache.h which is used
> throughout the kernel to figure out how far apart to space CPU-specific
> datastructures (EG: __cacheline_aligned_on_smp).
Not much we can do about that one since it has to be compile time. Maybe
something like calculating the biggest cache line size supported by all
built-in processor types ?
> Despite the fact that all PPC64 have an "L1_CACHE_SIZE" value of 128,
> the PowerPC A2 and e5500 have {d,i}cache_bsize values of 64 in cputable
> and presumably also get correct values from OpenFirmware, so the bogus
> constant in asm/cache.h does nothing more than waste a bit of memory
> for unnecessary padding.
More or less yes, though we haven't totally given up on the idea of
eventually, one day, produce binaries capable of running both 64-bit S
and E :-)
> Unfortunately, lots of PPC32 assembly pretends that the value found in
> asm/cache.h is a hard truth and uses it for "dcbz", etc, which is why
> there are all of those ugly #ifdefs in asm/cache.h
Yes, well... -some- assembly, mostly the copy routines. It's been the
main reason why this hasn't been fixed yet.
> Based on all of that, my proposal is going to be a patch which does the
> following:
>
> (1) Conditionally set L1_CACHE_SHIFT to the maximum value used by any
> platform being compiled in for alignment purposes.
Yay !
> (2) Make the ppc64_caches struct apply to ppc32 as well, and
> preinitialize it with a minimum value used by any platform being
> compiled in (for "dcbXX"/"icbXX" purposes). This is safe because
> the pagesize is always a multiple of the cache block size and the
> kernel only uses dcbXX/icbXX on whole pages. The only impact is a
> temporary small performance hit from flushing or zeroing the same
> block 8 times if too small.
Are you sure about dcbz ? Getting that wrong can be deadly ... I'd
rather get rid of some fancy optims and use a soft value in some cases.
That or we can compile multiple variants for the common case of some of
the copy routines and use patching (alternate sections) to branch to the
right one at runtime, at least for the common cases (32 and 128 for
example for 440 and 476).
> (3) Try to initialize the ppc_caches struct on ppc32 from the
> OpenFirmware device-tree. If that fails, then use the values we
> find in the cputable. After this is initialized any performance
> hit in copy_page()/zero_page() will obviously disappear.
>
> (4) Fix all of the PPC32 assembly code that is misusing L1_CACHE_SHIFT
> to use the ppc_caches struct instead.
Yes. This could be done while keeping the hand-optimized stuff by
compiling several variants of it.
> Does that sound like a reasonable approach?
It absolutely does ! Thanks for looking at that, it's been on my todo
list for ages and I've been always finding good reasons to do something
else instead :-)
Cheers,
Ben.
> Cheers,
> Kyle Moffett
>
> --
> Curious about my work on the Debian powerpcspe port?
> I'm keeping a blog here: http://pureperl.blogspot.com/
next prev parent reply other threads:[~2011-11-11 4:40 UTC|newest]
Thread overview: 78+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-20 4:56 [RFC PATCH] powerpc: 85xx: Make e500/e500v2 depend on !E500MC Baruch Siach
2011-07-12 4:15 ` Baruch Siach
2011-07-28 19:56 ` Tabi Timur-B04825
2011-07-28 20:02 ` Timur Tabi
2011-08-01 5:02 ` Baruch Siach
2011-07-28 20:20 ` Scott Wood
2011-08-01 4:59 ` Baruch Siach
2011-08-01 5:12 ` [PATCH] powerpc: 85xx: separate e500 from e500mc Baruch Siach
2011-08-08 9:07 ` [PATCH v2] " Baruch Siach
2011-08-08 19:42 ` Scott Wood
2011-08-10 4:43 ` Baruch Siach
2011-08-10 5:21 ` [PATCH v3] " Baruch Siach
2011-08-10 15:39 ` Paul Gortmaker
2011-08-10 16:01 ` Scott Wood
2011-08-10 16:40 ` Paul Gortmaker
2011-11-10 0:03 ` [RFC PATCH 00/17] powerpc/e500: " Kyle Moffett
2011-11-10 13:59 ` Kumar Gala
2011-11-10 16:17 ` Moffett, Kyle D
2011-11-10 16:30 ` Kumar Gala
2011-11-10 16:54 ` Scott Wood
2011-11-11 0:38 ` Moffett, Kyle D
2011-11-11 4:40 ` Benjamin Herrenschmidt [this message]
2011-11-15 2:32 ` [RFC PATCH 0/2] powerpc: CPU cache op cleanup Kyle Moffett
2011-11-15 22:29 ` Benjamin Herrenschmidt
2011-11-15 22:45 ` Moffett, Kyle D
2011-11-15 23:46 ` Benjamin Herrenschmidt
2011-11-16 0:25 ` Moffett, Kyle D
2011-11-16 4:40 ` Paul Mackerras
2011-11-16 20:52 ` Moffett, Kyle D
2011-11-15 2:32 ` [RFC PATCH 1/2] powerpc: Remove duplicate cacheable_memcpy/memzero functions Kyle Moffett
2011-11-15 22:31 ` Benjamin Herrenschmidt
2011-11-15 2:32 ` [RFC PATCH 2/2] WIP: PowerPC cache cleanup Kyle Moffett
2011-11-15 2:36 ` [RFC PATCH 00/17] powerpc/e500: separate e500 from e500mc Moffett, Kyle D
2011-11-15 2:41 ` Tabi Timur-B04825
2011-11-15 3:40 ` Kyle Moffett
2011-11-15 22:41 ` Benjamin Herrenschmidt
2011-11-10 0:06 ` Kyle Moffett
2011-11-10 0:06 ` [RFC PATCH 01/17] powerpc/mpic: Fix bogus CONFIG_BOOKE conditional Kyle Moffett
2011-11-10 13:33 ` Kumar Gala
2011-11-10 0:07 ` [RFC PATCH 02/17] powerpc: Split up PHYS_64BIT config option to fix "select" issues Kyle Moffett
2011-11-10 13:36 ` Kumar Gala
2011-11-10 14:04 ` Timur Tabi
2011-11-10 16:31 ` Moffett, Kyle D
2011-11-10 16:50 ` Timur Tabi
2011-11-11 4:50 ` Benjamin Herrenschmidt
2011-11-11 13:12 ` Tabi Timur-B04825
2011-11-10 0:07 ` [RFC PATCH 03/17] fsl_rio: Remove FreeScale e500 conditionals Kyle Moffett
2011-11-10 0:07 ` [RFC PATCH 04/17] powerpc: Allow multiple machine-check handlers Kyle Moffett
2011-11-10 13:37 ` Kumar Gala
2011-11-10 16:33 ` Moffett, Kyle D
2011-11-10 0:07 ` [RFC PATCH 05/17] powerpc/e500: Remove unused "default e500" from CPU table Kyle Moffett
2011-11-10 0:07 ` [RFC PATCH 06/17] powerpc/e500: Split FreeScale e500v1/v2 and e500mc config options Kyle Moffett
2011-11-10 0:07 ` [RFC PATCH 07/17] powerpc/e200: Rename CONFIG_E200 => CONFIG_FSL_E200 Kyle Moffett
2011-11-10 0:07 ` [RFC PATCH 08/17] powerpc/e500: Remove conditional "lwsync" substitution Kyle Moffett
2011-11-10 13:40 ` Kumar Gala
2011-11-10 16:31 ` Scott Wood
2011-11-10 16:42 ` Kumar Gala
2011-11-10 17:03 ` Scott Wood
2011-11-10 20:27 ` Moffett, Kyle D
2011-11-10 20:34 ` Kumar Gala
2011-11-11 4:45 ` Benjamin Herrenschmidt
2011-11-11 4:43 ` Benjamin Herrenschmidt
2011-11-10 0:07 ` [RFC PATCH 09/17] powerpc/e500: Split idle handlers for e500v1/v2 and e500mc Kyle Moffett
2011-11-10 0:07 ` [RFC PATCH 10/17] powerpc/e500: Fix up the last references to CONFIG_PPC_E500MC Kyle Moffett
2011-11-10 0:07 ` [RFC PATCH 11/17] powerpc/e500: Use the correct assembler flags for e500mc and e5500 Kyle Moffett
2011-11-10 0:07 ` [RFC PATCH 12/17] powerpc/e500: Separate e500mc CPU table entries from e500v1/e500v2 Kyle Moffett
2011-11-10 0:07 ` [RFC PATCH 13/17] powerpc/e500: Add a new CONFIG_FSL_E5500 option for the e5500 Kyle Moffett
2011-11-10 13:46 ` Kumar Gala
2011-11-10 16:49 ` Scott Wood
2011-11-10 0:07 ` [RFC PATCH 14/17] powerpc/e500: Don't make kgdb use e500v1/e500v2 registers on e500mc Kyle Moffett
2011-11-10 16:46 ` Scott Wood
2011-11-10 0:07 ` [RFC PATCH 15/17] powerpc/e500: Fix up all remaining code uses of CONFIG_E500 Kyle Moffett
2011-11-10 0:07 ` [RFC PATCH 16/17] powerpc/e500: Make __setup_cpu_{e200, e500, e500mc, e5500} optional Kyle Moffett
2011-11-10 16:47 ` [RFC PATCH 16/17] powerpc/e500: Make __setup_cpu_{e200,e500,e500mc,e5500} optional Scott Wood
2011-11-10 18:52 ` [RFC PATCH 16/17] powerpc/e500: Make __setup_cpu_{e200, e500, e500mc, e5500} optional Kumar Gala
2011-11-10 0:07 ` [RFC PATCH 17/17] powerpc/e500: Finally remove "CONFIG_E500" Kyle Moffett
2011-10-24 6:00 ` [PATCH v3] powerpc: 85xx: separate e500 from e500mc Baruch Siach
2011-07-29 7:23 ` [RFC PATCH] powerpc: 85xx: Make e500/e500v2 depend on !E500MC Baruch Siach
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=1320986410.21206.48.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=B04825@freescale.com \
--cc=Kyle.D.Moffett@boeing.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=paul.gortmaker@windriver.com \
--cc=scottwood@freescale.com \
/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).