From: gdavis@mvista.com (gdavis at mvista.com)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC/PATCH v5 0/7] ARM11 MPCore: preemption/task migration cache coherency fixups
Date: Tue, 12 Jun 2012 16:40:11 -0400 [thread overview]
Message-ID: <1339533618-15969-1-git-send-email-gdavis@mvista.com> (raw)
In-Reply-To: <1318945654-548-1-git-send-email-gdavis@mvista.com>
Greetings,
Apologies for the long delay following up on this...
On ARM11 MPCore, the "SCU does not handle coherency consequences of CP15
cache operations" [1]. So cache maintenance functions have to insure
that memory is globally consistent. Although the current Linux kernel
works reasonably well on ARM11 MPCore machines, PREEMPT stress testing,
e.g. parallel module loading, hackbench and LTP stress, results in
crashes which exhibit non-sense oops traces where machine state does
not make sense relative to the code executing at the time of the oops.
Review and analysis of the various ARM11 MPCore cache maintenance
functions reveal that there are a number critical sections in which
ARM11 MPCore caches and/or memory may become inconsistent, i.e. a
cache line on CPU A contains a modified entry but preemption and task
migration occurs after which the same cache line is cleaned/flushed
on CPU B. This can obviously lead to inconsistent memory and/or
cache state as cache ops on ARM11 MPCore are non-coherent.
The following is a series of ARM11 MPCore preemption/task migration
fixes to resolve cache coherency problems on these machines:
George G. Davis (6):
ARM: ARM11 MPCore: Make pte_alloc_one{,_kernel} preempt safe
ARM: ARM11 MPCore: Make {clean,flush}_pmd_entry preempt safe
ARM: Move get_thread_info macro definition to <asm/assembler.h>
ARM: ARM11 MPCore: cpu_v6_dcache_clean_area needs RFO
ARM: ARM11 MPCore: Make DMA_CACHE_RWFO operations preempt safe
ARM: ARM11 MPCore: Make cpu_v6_set_pte_ext preempt safe
Konstantin Baidarov (1):
ARM: ARM11 MPCore: Make pgd_alloc preempt safe
arch/arm/include/asm/assembler.h | 13 +++++++++
arch/arm/include/asm/pgalloc.h | 28 +++++++++++++++++---
arch/arm/include/asm/pgtable-2level.h | 8 ++++++
arch/arm/include/asm/pgtable.h | 1 +
arch/arm/include/asm/smp_plat.h | 2 +
arch/arm/kernel/entry-header.S | 11 --------
arch/arm/mm/cache-v6.S | 45 +++++++++++++++++++++++++++++++++
arch/arm/mm/idmap.c | 4 +++
arch/arm/mm/pgd.c | 7 +++++
arch/arm/mm/proc-macros.S | 3 ++
arch/arm/mm/proc-v6.S | 22 +++++++++++++++-
arch/arm/vfp/entry.S | 5 +++-
arch/arm/vfp/vfphw.S | 5 +++-
13 files changed, 135 insertions(+), 19 deletions(-)
The above changes were tested on:
1. ARM Ltd RealView ARM11 MPCore
2. NEC NE1 TB
3. NEC NEmid TB
Test cases used:
1. Continuous parallel modprobe stress test
2. 24 hour LTP stress test
When these fixes are not applied, both test cases fail often and early where
the failure symptoms are random hard/soft lockups and/or non-sense oopses.
When these fixes are applied, no test case failures are observed.
Note that the following change is an alternative implementation to
fix all callers of clean_dcache_area:
ARM: ARM11 MPCore: cpu_v6_dcache_clean_area needs RFO
If the above change is not an acceptable fix, then preemption/
task migration issues in callers of clean_dcache_area still
need to be fixed in some way. On the other hand, if the above
change is acceptable, then the following changes can be dropped
since they call clean_dcache_area which is fixed by the above
change:
ARM: ARM11 MPCore: Make pgd_alloc preempt safe
ARM: ARM11 MPCore: Make pte_alloc_one{,_kernel} preempt safe
I further believe that Catalin's "ARM: Allow lazy cache flushing on
ARM11MPCore" [2][3] is required for ARM11 MPCore machines and would
like to see that or similar/alternative solution applied. I have
an additional RWFO preempt fix which must be applied on top of
Catalin's patch [2][3] to resolve preeption/task migration issues
when his patch is applied. I'll submit that patch as a follow up
to that thread.
Comments/feedback greatly appreciated.
TIA!
ChangeLog:
V2:
- Substitute {get,put}_cpu() with preempt_{disable,enable}().
- Fixed preempt {dis,en}able assembler code sequences to not
use r11 since it is reserved for frame pointer use. Also
optimised these sequences to use r2, r3; ip scratch registers
in most cases to eliminate stack push/pop. In one case,
cpu_v6_set_pte_ext, there are only two scratch registers
available, r3 and ip. However, both of these are used within
the armv6_set_pte_ext macro. So for this case, r3 is used
as a temporary scratch when disabling preemption and r4 and
r5 are pushed/popped as needed for other uses to avoid
conflict with scratch register usage in armv6_set_pte_ext.
- Remove incorrect use of ALT_SMP macros in cpu_v6_set_pte_ext,
making the preempt {dis,en}able assembler code sequences
compile time dependent upon CONFIG_SMP instead. This code
is safe on UP machines anyway.
V3:
- Fix HIGHMEM breakage.
V4:
- Drop preempt_{disable,enable}() around calls to flush_pmd_entry()
in remap_area_sections() and remap_area_supersections() in
file arch/arm/mm/ioremap.c since these functions are not used
on SMP machines (they're enclosed within #ifndef SMP/#endif)
- Drop preempt_{disable,enable}() around call to flush_pmd_entry()
in alloc_init_section() in file arch/arm/mm/mmu.c since this
function is called during early kernel initialization during
which time preemption and task migration is not possible. Also
removed bogus FIXME comment as part of this change.
- Added calls to preempt_schedule when re-enabling preemption
in various arch/arm/mm/{cache,proc}-v6.S functions which need
preemption disabled due task migration issues.
V5:
- Drop OMAP specific changes in "ARM: ARM11 MPCore: clean_dcache_area
is not preempt safe" based on feed back from Tony Lindgren [4]
indicating that the affected code is not used on ARM11 MPCore
machines.
- Fix bug in implementation of conditional preempt_schedule calls
pointed out by Nicolas Pitre [5].
- Reimplement "ARM: ARM11 MPCore: cpu_v6_set_pte_ext is not preempt safe"
to simply disable/enable interrupts around critical section based on
feedback from Nicolas Pitre [6].
- Improve (ARMv6+ instruction cycle) efficiency of preempt_enable
assembler code sequences as suggested by Nicolas Pitre [7].
- Implement alternative implementation for fixup of clean_dcache_area
callers by implementing RFO and preempt disable in
cpu_v6_dcache_clean_area. If this change is acceptable, the
"ARM: ARM11 MPCore: Make pgd_alloc preempt safe" and "ARM: ARM11
MPCore: Make pte_alloc_one{,_kernel} preempt safe" commits can be
dropped. Else, if unacceptable, some callers of clean_dcache_area
may be missing preempt/migration fixups which are not otherwise
fixed in this series.
--
Regards,
George
References:
[1] http://infocenter.arm.com/help/topic/com.arm.doc.dai0228a/index.html#arm_toc9
[2] http://www.spinics.net/lists/arm-kernel/msg129403.html
[3] http://lists.infradead.org/pipermail/linux-arm-kernel/2010-May/014990.html
[4] http://lists.infradead.org/pipermail/linux-arm-kernel/2011-October/069912.html
[5] http://lists.infradead.org/pipermail/linux-arm-kernel/2011-October/069942.html
[6] http://lists.infradead.org/pipermail/linux-arm-kernel/2011-October/069943.html
[7] http://lists.infradead.org/pipermail/linux-arm-kernel/2011-October/069953.html
next prev parent reply other threads:[~2012-06-12 20:40 UTC|newest]
Thread overview: 93+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-20 13:43 parallel load of modules on an ARM multicore EXTERNAL Waechtler Peter (Fa. TCP, CM-AI/PJ-CF31)
2011-06-21 15:50 ` Catalin Marinas
2011-06-23 14:39 ` AW: " EXTERNAL Waechtler Peter (Fa. TCP, CM-AI/PJ-CF31)
2011-06-23 14:52 ` Catalin Marinas
2011-06-23 15:12 ` Russell King - ARM Linux
2011-06-23 15:34 ` Catalin Marinas
2011-06-23 17:02 ` Catalin Marinas
2011-06-23 15:20 ` AW: " EXTERNAL Waechtler Peter (Fa. TCP, CM-AI/PJ-CF31)
2011-07-07 4:25 ` George G. Davis
2011-10-20 4:04 ` George G. Davis
2011-09-22 7:29 ` George G. Davis
2011-09-22 8:52 ` Catalin Marinas
2011-10-06 4:29 ` George G. Davis
2011-10-06 5:08 ` [RFC/PATCH 0/7] ARM: ARM11 MPCore preemption/task migration cache coherency fixups gdavis at mvista.com
2011-10-06 5:08 ` [RFC/PATCH 1/7] ARM: ARM11 MPCore: pgd_alloc is not preempt safe gdavis at mvista.com
2011-10-06 16:35 ` Russell King - ARM Linux
2011-10-06 19:38 ` George G. Davis
2011-10-06 5:08 ` [RFC/PATCH 2/7] ARM: ARM11 MPCore: pte_alloc_one{, _kernel} are " gdavis at mvista.com
2011-10-06 5:08 ` [RFC/PATCH 3/7] ARM: ARM11 MPCore: {clean, flush}_pmd_entry " gdavis at mvista.com
2011-10-06 5:08 ` [RFC/PATCH 4/7] ARM: ARM11 MPCore: clean_dcache_area is " gdavis at mvista.com
2011-10-06 5:08 ` [RFC/PATCH 5/7] ARM: Move get_thread_info macro definition to <asm/assembler.h> gdavis at mvista.com
2011-10-06 5:08 ` [RFC/PATCH 6/7] ARM: ARM11 MPCore: DMA_CACHE_RWFO operations are not preempt safe gdavis at mvista.com
2011-10-06 16:40 ` Russell King - ARM Linux
2011-10-06 19:41 ` George G. Davis
2011-10-06 5:08 ` [RFC/PATCH 7/7] ARM: ARM11 MPCore: cpu_v6_set_pte_ext is " gdavis at mvista.com
2011-10-06 7:46 ` Russell King - ARM Linux
2011-10-06 12:35 ` George G. Davis
2011-10-07 2:38 ` [RFC/PATCH v2 0/7] ARM11 MPCore: preemption/task migration cache coherency fixups gdavis at mvista.com
2011-10-07 2:38 ` [RFC/PATCH 1/7] ARM: ARM11 MPCore: pgd_alloc is not preempt safe gdavis at mvista.com
2011-10-07 2:38 ` [RFC/PATCH 2/7] ARM: ARM11 MPCore: pte_alloc_one{, _kernel} are " gdavis at mvista.com
2011-10-07 7:47 ` [RFC/PATCH 2/7] ARM: ARM11 MPCore: pte_alloc_one{,_kernel} " Russell King - ARM Linux
2011-10-07 15:31 ` [RFC/PATCH 2/7] ARM: ARM11 MPCore: pte_alloc_one{, _kernel} " George G. Davis
2011-10-07 2:38 ` [RFC/PATCH 3/7] ARM: ARM11 MPCore: {clean, flush}_pmd_entry " gdavis at mvista.com
2011-10-11 9:53 ` [RFC/PATCH 3/7] ARM: ARM11 MPCore: {clean,flush}_pmd_entry " Catalin Marinas
2011-10-12 2:34 ` [RFC/PATCH 3/7] ARM: ARM11 MPCore: {clean, flush}_pmd_entry " George G. Davis
2011-10-13 14:31 ` [RFC/PATCH 3/7] ARM: ARM11 MPCore: {clean,flush}_pmd_entry " Russell King - ARM Linux
2011-10-14 1:34 ` [RFC/PATCH 3/7] ARM: ARM11 MPCore: {clean, flush}_pmd_entry " George G. Davis
2011-10-07 2:38 ` [RFC/PATCH 4/7] ARM: ARM11 MPCore: clean_dcache_area is " gdavis at mvista.com
2011-10-07 2:38 ` [RFC/PATCH 5/7] ARM: Move get_thread_info macro definition to <asm/assembler.h> gdavis at mvista.com
2011-10-11 9:56 ` Catalin Marinas
2011-10-12 6:04 ` gdavis at mvista.com
2011-10-13 14:34 ` Russell King - ARM Linux
2011-10-13 14:49 ` Catalin Marinas
2011-10-13 14:53 ` Russell King - ARM Linux
2011-10-14 1:46 ` George G. Davis
2011-10-14 1:44 ` George G. Davis
2011-10-14 1:42 ` George G. Davis
2011-10-14 2:54 ` Nicolas Pitre
2011-10-14 12:56 ` George G. Davis
2011-10-07 2:38 ` [RFC/PATCH 6/7] ARM: ARM11 MPCore: DMA_CACHE_RWFO operations are not preempt safe gdavis at mvista.com
2011-10-07 2:38 ` [RFC/PATCH 7/7] ARM: ARM11 MPCore: cpu_v6_set_pte_ext is " gdavis at mvista.com
2011-10-07 16:26 ` [RFC/PATCH v3 0/7] ARM11 MPCore: preemption/task migration cache coherency fixups gdavis at mvista.com
2011-10-07 16:26 ` [RFC/PATCH v3 1/7] ARM: ARM11 MPCore: pgd_alloc is not preempt safe gdavis at mvista.com
2011-10-07 16:26 ` [RFC/PATCH v3 2/7] ARM: ARM11 MPCore: pte_alloc_one{, _kernel} are " gdavis at mvista.com
2011-10-07 16:26 ` [RFC/PATCH v3 3/7] ARM: ARM11 MPCore: {clean, flush}_pmd_entry " gdavis at mvista.com
2011-10-07 16:26 ` [RFC/PATCH v3 4/7] ARM: ARM11 MPCore: clean_dcache_area is " gdavis at mvista.com
2011-10-07 16:26 ` [RFC/PATCH v3 5/7] ARM: Move get_thread_info macro definition to <asm/assembler.h> gdavis at mvista.com
2011-10-07 16:26 ` [RFC/PATCH v3 6/7] ARM: ARM11 MPCore: DMA_CACHE_RWFO operations are not preempt safe gdavis at mvista.com
2011-10-07 16:26 ` [RFC/PATCH v3 7/7] ARM: ARM11 MPCore: cpu_v6_set_pte_ext is " gdavis at mvista.com
2011-10-18 13:47 ` [RFC/PATCH v4 0/7] ARM11 MPCore: preemption/task migration cache coherency fixups gdavis at mvista.com
2011-10-18 13:47 ` [RFC/PATCH v4 1/7] ARM: ARM11 MPCore: pgd_alloc is not preempt safe gdavis at mvista.com
2011-10-18 13:47 ` [RFC/PATCH v4 2/7] ARM: ARM11 MPCore: pte_alloc_one{, _kernel} are " gdavis at mvista.com
2011-10-18 13:47 ` [RFC/PATCH v4 3/7] ARM: ARM11 MPCore: {clean, flush}_pmd_entry " gdavis at mvista.com
2011-10-18 13:47 ` [RFC/PATCH v4 4/7] ARM: ARM11 MPCore: clean_dcache_area is " gdavis at mvista.com
2011-10-18 17:08 ` Tony Lindgren
2011-10-18 17:30 ` George G. Davis
2011-10-18 17:43 ` Tony Lindgren
2011-10-18 18:13 ` George G. Davis
2011-10-18 13:47 ` [RFC/PATCH v4 5/7] ARM: Move get_thread_info macro definition to <asm/assembler.h> gdavis at mvista.com
2011-10-18 13:47 ` [RFC/PATCH v4 6/7] ARM: ARM11 MPCore: DMA_CACHE_RWFO operations are not preempt safe gdavis at mvista.com
2011-10-18 21:28 ` Nicolas Pitre
2011-10-18 23:26 ` George G. Davis
2011-10-19 1:09 ` Nicolas Pitre
2011-10-18 13:47 ` [RFC/PATCH v4 7/7] ARM: ARM11 MPCore: cpu_v6_set_pte_ext is " gdavis at mvista.com
2011-10-18 21:52 ` Nicolas Pitre
2011-10-18 23:29 ` George G. Davis
2012-06-12 20:40 ` gdavis at mvista.com [this message]
2012-06-12 20:40 ` [RFC/PATCH v5 1/7] ARM: ARM11 MPCore: Make pgd_alloc " gdavis at mvista.com
2012-06-12 20:40 ` [RFC/PATCH v5 2/7] ARM: ARM11 MPCore: Make pte_alloc_one{, _kernel} " gdavis at mvista.com
2012-06-12 20:40 ` [RFC/PATCH v5 3/7] ARM: ARM11 MPCore: Make {clean, flush}_pmd_entry " gdavis at mvista.com
2012-06-12 20:40 ` [RFC/PATCH v5 4/7] ARM: Move get_thread_info macro definition to <asm/assembler.h> gdavis at mvista.com
2012-06-12 20:40 ` [RFC/PATCH v5 5/7] ARM: ARM11 MPCore: cpu_v6_dcache_clean_area needs RFO gdavis at mvista.com
2012-06-13 9:32 ` Catalin Marinas
2012-06-13 9:36 ` Russell King - ARM Linux
2012-06-13 9:41 ` Catalin Marinas
2012-06-13 9:45 ` Russell King - ARM Linux
2012-06-13 9:54 ` Catalin Marinas
2012-06-13 11:36 ` George G. Davis
2012-06-13 11:21 ` George G. Davis
2012-06-12 20:40 ` [RFC/PATCH v5 6/7] ARM: ARM11 MPCore: Make DMA_CACHE_RWFO operations preempt safe gdavis at mvista.com
2012-06-12 20:40 ` [RFC/PATCH v5 7/7] ARM: ARM11 MPCore: Make cpu_v6_set_pte_ext " gdavis at mvista.com
2012-06-13 9:34 ` Catalin Marinas
2012-06-13 11:35 ` George G. Davis
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=1339533618-15969-1-git-send-email-gdavis@mvista.com \
--to=gdavis@mvista.com \
--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.