public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: sshtylyov@mvista.com (Sergei Shtylyov)
To: linux-arm-kernel@lists.infradead.org
Subject: strange segfaults with CompactFlash in "true-ide" mode on PXA270
Date: Fri, 25 Jun 2010 13:45:39 +0400	[thread overview]
Message-ID: <4C247AC3.2050906@ru.mvista.com> (raw)
In-Reply-To: <201006250911.30277.schindele@nentec.de>

Hello.

Juergen Schindele wrote:

>>> we have a strange problem when booting from a Compact Flash card
>>> as root-device. In one of 10 cases while booting an application from
>>> root-filesystem dies with "Segmentation fault" without a visible error.
>>> After booting the same application runs hundred times without error.
>>> (we're talking about standard appl. like chat, pppd, hwclock and so on)
>>>
>>> For debugging purposes we put printk's in kernels IDE driver 
>>> and the problem disappeared. But replacing the printk by a usleep
>>> or so (which is not a solution !) brings the problem back.
>>> It seems that the application received faulty data from CF.
>>> But how and why ?????????????????????????????
>>>
>>> We tested with a custom PXA270 board with a CompactFlash in 
>>> "true ide" on processor bus driven by "generic ide / pata_platform"
>>> driver from linux-2.6.27.x.
>>> (by the way linux-2.6.20.x showed the same problem).
>>>
>>> Any ideas, hints, experiences, patches are very welcome :-)
>>> --------------------------------------------------------------
>> I guess that is the old cache problem that apparently was never really
>> fixed:
>> http://marc.info/?t=108537828400002&r=1&w=2

> Hello
> this hint was very helpful for understanding the problem.
> In the mail from Russell King at 
> <http://marc.info/?l=linux-arm-kernel&m=108611676807909&w=2>
> he said : .... the rule is if the CPU writes to a page cache page,
> it must call flush_dcache_page afterwards to ensure cache coherency with user space".

> so i made the following patch in drivers/ide/ide-taskfile.c
> in the function ide_pio_sector() where blocks from disk are read
> into a cached page to apply the rule from Russell. 
> ===================================================================
> --- ide-taskfile.c
> +++ ide-taskfile.c.new
> @@ -278,6 +278,7 @@
>                 hwif->tp_ops->input_data(drive, rq, buf, SECTOR_SIZE);
> 
>         kunmap_atomic(buf, KM_BIO_SRC_IRQ);
> +       flush_dcache_page(page);
>  #ifdef CONFIG_HIGHMEM
>         local_irq_restore(flags);
>  #endif

> And from there on the problem disappeared :-))
> What are you think about ???

    Flushing is only needed for reads and shouldn't be done for the slab pages 
(judging on libata's code).

> Isn't this missing for years in IDE PIO driver ???

    It's actually missing from the ARM port of IDE. E.g. the MIPS port 
provides for that -- see arch/mips/include/asm/mach-generic/ide.h.

WBR, Sergei

  reply	other threads:[~2010-06-25  9:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-23 15:06 strange segfaults with CompactFlash in "true-ide" mode on PXA270 Juergen Schindele
2010-06-23 15:24 ` Lothar Waßmann
2010-06-25  2:09   ` Rabin Vincent
2010-06-25  7:11   ` Juergen Schindele
2010-06-25  9:45     ` Sergei Shtylyov [this message]
2010-06-25 13:39     ` Catalin Marinas

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=4C247AC3.2050906@ru.mvista.com \
    --to=sshtylyov@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox