public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: "Sven Krauss" <sven.krauss@web.de>
To: linux-mtd@lists.infradead.org
Subject: DMA misaligned error with device 4
Date: Mon, 11 Apr 2011 17:18:27 +0200 (CEST)	[thread overview]
Message-ID: <1631427694.1700754.1302535107434.JavaMail.fmail@mwmweb014> (raw)

Hello!

I am working on a TI-OMAP (OMAP3530 Kernel 2.6.33.7) board and with heavy load i got the following error. 

DMA misaligned error with device 4

BUG: soft lockup - CPU#0 stuck for 61s! [jffs2_gcd_mtd4:419]
Modules linked in:
 
Pid: 419, comm:       jffs2_gcd_mtd4
CPU: 0    Not tainted  (2.6.33.7 #1)
PC is at omap_write_buf_dma_pref+0x184/0x230
LR is at omap_write_buf_dma_pref+0x178/0x230
pc : [<c01fe170>]    lr : [<c01fe164>]    psr: 20000013
sp : cfafdc30  ip : cfafdb80  fp : cf8d2010
r10: 00000800  r9 : 00000100  r8 : c711b5be
r7 : 00000800  r6 : cf8d2000  r5 : 00000001  r4 : 00000000
r3 : fe000000  r2 : 00000001  r1 : cf8cb1c0  r0 : 00000800
Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
Control: 10c5387d  Table: 8fb40019  DAC: 00000017

>From this moment the cpu is dead.

I went down to the kernel and found the following problem. I will start in jffs2_flash_writev() from fs/jffs2/wbuf.c. There is a for loop running through a vector invec. Inside the loop data is written to the write buffer (wbuf). If the buffer is full __jffs2_flush_wbuf will be called. If now an unaligned amount of data was written the next call c->mtd->write() inside the next condition will fail, because the pointer (v) is not aligned. This pointer is directly written to the dma. This results in the crash above.

I suggest the following patch. For me this works fine.

--- linux-2.6.33.7.orig/drivers/mtd/nand/omap2.c 2010-08-02 19:27:18.000000000 +0200
+++ linux-2.6.33.7/drivers/mtd/nand/omap2.c 2011-04-11 17:11:53.000000000 +0200
@@ -503,9 +506,11 @@
 {
  if (len <= mtd->oobsize)
  omap_write_buf_pref(mtd, buf, len);
+ else if (!IS_ALIGNED((unsigned long)buf, 4))
+ omap_write_buf_pref(mtd, buf, len);
  else
  /* start transfer in DMA mode */
- omap_nand_dma_transfer(mtd, buf, len, 0x1);
+ omap_nand_dma_transfer(mtd, (void*)buf, len, 0x1);
 }
 
 /**
Thanks very much!


 
___________________________________________________________
Empfehlen Sie WEB.DE DSL Ihren Freunden und Bekannten und wir   
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.web.de

                 reply	other threads:[~2011-04-11 15:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1631427694.1700754.1302535107434.JavaMail.fmail@mwmweb014 \
    --to=sven.krauss@web.de \
    --cc=linux-mtd@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