All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Mundt <lethal@linux-sh.org>
To: linux-sh@vger.kernel.org
Subject: Re: Possibly icahe/dcache synchronization problem on sh7785lcr
Date: Tue, 13 Oct 2009 02:16:57 +0000	[thread overview]
Message-ID: <20091013021657.GA28788@linux-sh.org> (raw)
In-Reply-To: <4ACF32C2.9010501@siemens.com>

On Fri, Oct 09, 2009 at 04:55:30PM +0400, Valentin R Sitsikov wrote:
> During execution of user space application form time to time
> invalid instruction or bus error occured or even init dies during sturtup.
> The situation became more stable if i use the following code:
> static void sh4_flush_icache_page(void *arg)
> {
>         flush_dcache_all();
>         flush_icache_all();
> }
> ...
> local_flush_icache_page         = sh4_flush_icache_page;
> This is done because previous experience  with 2.6.20 on sdk7785.
> There was the similar problems (at least it looks like).
> 
flush_icache_page() is a legacy interface, all of which can be handled in
flush_dcache_page()/update_mmu_cache() (well, __update_cache() now) these
days. I think you've hit a case where we need to throw in an I-cache
invalidation in. Can you give the following patch a try and see how that
behaves (while leaving local_flush_icache_page unset)?

---

diff --git a/arch/sh/mm/cache-sh4.c b/arch/sh/mm/cache-sh4.c
index a98c7d8..74b44ab 100644
--- a/arch/sh/mm/cache-sh4.c
+++ b/arch/sh/mm/cache-sh4.c
@@ -115,9 +115,9 @@ static inline void flush_cache_4096(unsigned long start,
 static void sh4_flush_dcache_page(void *arg)
 {
 	struct page *page = arg;
-#ifndef CONFIG_SMP
 	struct address_space *mapping = page_mapping(page);
 
+#ifndef CONFIG_SMP
 	if (mapping && !mapping_mapped(mapping))
 		set_bit(PG_dcache_dirty, &page->flags);
 	else
@@ -131,6 +131,8 @@ static void sh4_flush_dcache_page(void *arg)
 		n = boot_cpu_data.dcache.n_aliases;
 		for (i = 0; i < n; i++, addr += 4096)
 			flush_cache_4096(addr, phys);
+
+		flush_icache_all();
 	}
 
 	wmb();

  reply	other threads:[~2009-10-13  2:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-09 12:55 Possibly icahe/dcache synchronization problem on sh7785lcr Valentin R Sitsikov
2009-10-13  2:16 ` Paul Mundt [this message]
2009-10-13  8:13 ` Valentin R Sitsikov
2009-10-13 10:25 ` Paul Mundt
2009-10-13 12:44 ` Valentin R Sitsikov
2009-10-13 13:08 ` Paul Mundt
2009-10-13 13:58 ` Paul Mundt
2009-10-13 14:05 ` Valentin R Sitsikov

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=20091013021657.GA28788@linux-sh.org \
    --to=lethal@linux-sh.org \
    --cc=linux-sh@vger.kernel.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.