From: Chris Ruehl <chris.ruehl@gtsys.com.hk>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: mpa@pengutronix.de, s.hauer@pengutronix.de,
linux-mmc@vger.kernel.org, linux-arm@lists.infradead.org
Subject: Re: [PATCH] mxcmmc: Internal error: Oops: 17 [#1] ARM from sg->offset
Date: Tue, 04 Feb 2014 15:03:33 +0800 [thread overview]
Message-ID: <52F090C5.3070300@gtsys.com.hk> (raw)
In-Reply-To: <20140122101137.GX15937@n2100.arm.linux.org.uk>
On Wednesday, January 22, 2014 06:11 PM, Russell King - ARM Linux wrote:
> On Wed, Jan 22, 2014 at 12:32:39PM +0800, Chris Ruehl wrote:
>> diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
>> index f7199c8..8645d6a 100644
>> --- a/drivers/mmc/host/mxcmmc.c
>> +++ b/drivers/mmc/host/mxcmmc.c
>> @@ -347,7 +347,7 @@ static int mxcmci_setup_data(struct mxcmci_host *host, struct mmc_data *data)
>> return 0;
>>
>> for_each_sg(data->sg, sg, data->sg_len, i) {
>> - if (sg->offset & 3 || sg->length & 3 || sg->length < 512) {
>> + if (sg && (sg->offset & 3 || sg->length & 3 || sg->length < 512)) {
> sg should never be NULL here - so this is probably papering over a bug.
>
I'd had some time and look into the meaning of the sg->xx & 0x3 and
understand this
check validate the alignment of the data. If failed the dma handling is
canceled and a fall-back to pio is done.
In a earlier patch for the unexpected dma & interrupts are synchronized
using the spinlock. I pickup this
idea and protect the setup-data using a look. Until now the oops are gone.
PLEASE comment!
diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
index 8645d6a..b11d3c4 100644
--- a/drivers/mmc/host/mxcmmc.c
+++ b/drivers/mmc/host/mxcmmc.c
@@ -347,7 +347,7 @@ static int mxcmci_setup_data(struct mxcmci_host
*host, struct mmc_data *data)
return 0;
for_each_sg(data->sg, sg, data->sg_len, i) {
- if (sg && (sg->offset & 3 || sg->length & 3 ||
sg->length < 512)) {
+ if (sg->offset & 3 || sg->length & 3 || sg->length < 512) {
host->do_dma = 0;
return 0;
}
@@ -800,9 +800,12 @@ static void mxcmci_request(struct mmc_host *mmc,
struct mmc_request *req)
struct mxcmci_host *host = mmc_priv(mmc);
unsigned int cmdat = host->cmdat;
int error;
+ unsigned long flags;
WARN_ON(host->req != NULL);
+ spin_lock_irqsave(&host->lock, flags);
+
host->req = req;
host->cmdat &= ~CMD_DAT_CONT_INIT;
@@ -813,6 +816,7 @@ static void mxcmci_request(struct mmc_host *mmc,
struct mmc_request *req)
error = mxcmci_setup_data(host, req->data);
if (error) {
req->cmd->error = error;
+ spin_unlock_irqrestore(&host->lock, flags);
goto out;
}
@@ -823,6 +827,8 @@ static void mxcmci_request(struct mmc_host *mmc,
struct mmc_request *req)
cmdat |= CMD_DAT_CONT_WRITE;
}
+ spin_unlock_irqrestore(&host->lock, flags);
With kind regards
Chris
prev parent reply other threads:[~2014-02-04 7:02 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-22 4:32 [PATCH] mxcmmc: Internal error: Oops: 17 [#1] ARM from sg->offset Chris Ruehl
2014-01-22 6:42 ` Sascha Hauer
2014-01-22 7:19 ` Chris Ruehl
2014-01-22 7:23 ` Sascha Hauer
2014-01-22 7:47 ` Chris Ruehl
2014-01-22 8:32 ` Chris Ruehl
2014-01-23 9:01 ` Chris Ruehl
2014-01-24 21:52 ` Sascha Hauer
2014-01-22 10:11 ` Russell King - ARM Linux
2014-01-22 10:26 ` Chris Ruehl
2014-02-04 7:03 ` Chris Ruehl [this message]
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=52F090C5.3070300@gtsys.com.hk \
--to=chris.ruehl@gtsys.com.hk \
--cc=linux-arm@lists.infradead.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=mpa@pengutronix.de \
--cc=s.hauer@pengutronix.de \
/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.