linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: at91sam9g45: MMC: Issues with MMC driver
Date: Tue, 2 Aug 2011 15:03:44 +0100	[thread overview]
Message-ID: <20110802140344.GF19079@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <CAA2DH4v+v2Vvv_2MzD1dGqbc5a4W1h+30FqwwpsqKmYk6nvZxQ@mail.gmail.com>

On Tue, Aug 02, 2011 at 04:35:58PM +0530, Prasant J wrote:
> Hi,
> 
> I'm using Linux 3.0.0 on a custom board design based on AT91SAM9G45-EKES
> 
> I'm getting this kernel dump while booting:
> 
> 
> Waiting 3sec before mounting root device...
> mmc0: host does not support reading read-only switch. assuming write-enable.
> mmc0: new SD card at address 0007
> mmcblk0: mmc0:0007 SU02G 1.83 GiB
>  mmcblk0: p1 p2
> eth0: link up (100/Full)
> EXT3-fs: barriers not enabled
> kjournald starting.  Commit interval 5 seconds
> EXT3-fs (mmcblk0p2): using internal journal
> EXT3-fs (mmcblk0p2): mounted filesystem with writeback data mode
> VFS: Mounted root (ext3 filesystem) on device 179:2.
> Freeing init memory: 116K
> ------------[ cut here ]------------
> WARNING: at kernel/irq/handle.c:130 handle_irq_event_percpu+0x6c/0x18c()
> 
> Can someone tell me what is possibly wrong in the mmc driver's
> interrupt handler?

This is what I said to someone who asked about this a week ago.  It
desperately needs fixing properly.

Subject: at91sam9g45: Issues while working with RAM that is separated
        on physical address space

On Tue, Jul 26, 2011 at 03:37:02PM +0200, Christian Glindkamp wrote:
> The only problem that still exits with highmem for me is the following:
> Even on non-highmem/non-sparsemem systems I get the following warning
> when using an mmc as the rootfs:
> 
> ------------[ cut here ]------------
> WARNING: at kernel/irq/handle.c:130 handle_irq_event_percpu+0x70/0x194()

That'll be because the driver is still using flush_dcache_page(), whereas
it should be using flush_kernel_dcache_page().  flush_dcache_page()
unfortunately results in IRQs being enabled due to the
flush_dcache_mmap_lock().

> The system is still stable, but if switch to highmem, the kernel crashes
> completely when doing this (using and USB drive as rootfs still works
> flawlessly):

That's because the driver is basically broken:

        void                    *buf = sg_virt(sg);
        unsigned int            offset = host->pio_offset;

                        memcpy(buf + offset, &value, remaining);

Highmem pages have a NULL sg_virt(sg) because they're by definition not
mapped.  Drivers really should not be using sg_virt() directly - who
knows how this got through the review process...

There's a well defined API for walking scatterlists in drivers - see
the sg_miter_* API in linux/scatterlist.h.  This takes care of the
highmem issues automatically, as well as using flush_kernel_dcache_page().

In short: the Atmel MCI driver is buggy and needs fixing.

  reply	other threads:[~2011-08-02 14:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-02 11:05 at91sam9g45: MMC: Issues with MMC driver Prasant J
2011-08-02 14:03 ` Russell King - ARM Linux [this message]
2011-08-03  4:52   ` Prasant J

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=20110802140344.GF19079@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).