* [PATCH] mmc: omap_hsmmc: DMA unmap only once in case of MMC error
@ 2011-08-28 22:08 ` Per Forlin
0 siblings, 0 replies; 7+ messages in thread
From: Per Forlin @ 2011-08-28 22:08 UTC (permalink / raw)
To: linaro-dev, linux-arm-kernel, linux-kernel, linux-mmc,
Venkatraman S, Russell King - ARM Linux, Santosh,
Balaji T Krishnamoorthy, Sourav Poddar
Cc: Chris Ball, Nicolas Pitre, Per Forlin
Reported by Russell King:
------------
mmcblk0: error -84 transferring data, sector 149201, nr 64,
cmd response 0x900, card status 0xb00
mmcblk0: retrying using single block read
WARNING: at /home/rmk/git/linux-2.6-rmk/lib/dma-debug.c:811 check_unmap
omap_hsmmc omap_hsmmc.0: DMA-API: device driver tries to free DMA memory
it has not allocated [device address=0x0000000080933000] [size=20480 bytes]
-------------
In case of an error dma_unmap() is issued in omap_hsmmc_dma_cleanup()
and then again in omap_hsmmc_post_req(). Resolve this by clearing the
host_cookie to indicate there is no DMA mapped memory to unmap.
Signed-off-by: Per Forlin <per.forlin@linaro.org>
---
Bug fix on 3.1-rc3
drivers/mmc/host/omap_hsmmc.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 21e4a79..31d9817 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1011,6 +1011,7 @@ static void omap_hsmmc_dma_cleanup(struct omap_hsmmc_host *host, int errno)
host->data->sg_len,
omap_hsmmc_get_dma_dir(host, host->data));
omap_free_dma(dma_ch);
+ host->data->host_cookie = 0;
}
host->data = NULL;
}
@@ -1576,8 +1577,10 @@ static void omap_hsmmc_post_req(struct mmc_host *mmc, struct mmc_request *mrq,
struct mmc_data *data = mrq->data;
if (host->use_dma) {
- dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len,
- omap_hsmmc_get_dma_dir(host, data));
+ if (data->host_cookie)
+ dma_unmap_sg(mmc_dev(host->mmc), data->sg,
+ data->sg_len,
+ omap_hsmmc_get_dma_dir(host, data));
data->host_cookie = 0;
}
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH] mmc: omap_hsmmc: DMA unmap only once in case of MMC error
@ 2011-08-28 22:08 ` Per Forlin
0 siblings, 0 replies; 7+ messages in thread
From: Per Forlin @ 2011-08-28 22:08 UTC (permalink / raw)
To: linaro-dev, linux-arm-kernel, linux-kernel, linux-mmc, Venkatraman S
Cc: Chris Ball, Nicolas Pitre, Per Forlin
Reported by Russell King:
------------
mmcblk0: error -84 transferring data, sector 149201, nr 64,
cmd response 0x900, card status 0xb00
mmcblk0: retrying using single block read
WARNING: at /home/rmk/git/linux-2.6-rmk/lib/dma-debug.c:811 check_unmap
omap_hsmmc omap_hsmmc.0: DMA-API: device driver tries to free DMA memory
it has not allocated [device address=0x0000000080933000] [size=20480 bytes]
-------------
In case of an error dma_unmap() is issued in omap_hsmmc_dma_cleanup()
and then again in omap_hsmmc_post_req(). Resolve this by clearing the
host_cookie to indicate there is no DMA mapped memory to unmap.
Signed-off-by: Per Forlin <per.forlin@linaro.org>
---
Bug fix on 3.1-rc3
drivers/mmc/host/omap_hsmmc.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 21e4a79..31d9817 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1011,6 +1011,7 @@ static void omap_hsmmc_dma_cleanup(struct omap_hsmmc_host *host, int errno)
host->data->sg_len,
omap_hsmmc_get_dma_dir(host, host->data));
omap_free_dma(dma_ch);
+ host->data->host_cookie = 0;
}
host->data = NULL;
}
@@ -1576,8 +1577,10 @@ static void omap_hsmmc_post_req(struct mmc_host *mmc, struct mmc_request *mrq,
struct mmc_data *data = mrq->data;
if (host->use_dma) {
- dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len,
- omap_hsmmc_get_dma_dir(host, data));
+ if (data->host_cookie)
+ dma_unmap_sg(mmc_dev(host->mmc), data->sg,
+ data->sg_len,
+ omap_hsmmc_get_dma_dir(host, data));
data->host_cookie = 0;
}
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH] mmc: omap_hsmmc: DMA unmap only once in case of MMC error
@ 2011-08-28 22:08 ` Per Forlin
0 siblings, 0 replies; 7+ messages in thread
From: Per Forlin @ 2011-08-28 22:08 UTC (permalink / raw)
To: linux-arm-kernel
Reported by Russell King:
------------
mmcblk0: error -84 transferring data, sector 149201, nr 64,
cmd response 0x900, card status 0xb00
mmcblk0: retrying using single block read
WARNING: at /home/rmk/git/linux-2.6-rmk/lib/dma-debug.c:811 check_unmap
omap_hsmmc omap_hsmmc.0: DMA-API: device driver tries to free DMA memory
it has not allocated [device address=0x0000000080933000] [size=20480 bytes]
-------------
In case of an error dma_unmap() is issued in omap_hsmmc_dma_cleanup()
and then again in omap_hsmmc_post_req(). Resolve this by clearing the
host_cookie to indicate there is no DMA mapped memory to unmap.
Signed-off-by: Per Forlin <per.forlin@linaro.org>
---
Bug fix on 3.1-rc3
drivers/mmc/host/omap_hsmmc.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 21e4a79..31d9817 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1011,6 +1011,7 @@ static void omap_hsmmc_dma_cleanup(struct omap_hsmmc_host *host, int errno)
host->data->sg_len,
omap_hsmmc_get_dma_dir(host, host->data));
omap_free_dma(dma_ch);
+ host->data->host_cookie = 0;
}
host->data = NULL;
}
@@ -1576,8 +1577,10 @@ static void omap_hsmmc_post_req(struct mmc_host *mmc, struct mmc_request *mrq,
struct mmc_data *data = mrq->data;
if (host->use_dma) {
- dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len,
- omap_hsmmc_get_dma_dir(host, data));
+ if (data->host_cookie)
+ dma_unmap_sg(mmc_dev(host->mmc), data->sg,
+ data->sg_len,
+ omap_hsmmc_get_dma_dir(host, data));
data->host_cookie = 0;
}
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] mmc: omap_hsmmc: DMA unmap only once in case of MMC error
2011-08-28 22:08 ` Per Forlin
@ 2011-09-01 19:19 ` S, Venkatraman
-1 siblings, 0 replies; 7+ messages in thread
From: S, Venkatraman @ 2011-09-01 19:19 UTC (permalink / raw)
To: Per Forlin
Cc: linaro-dev, linux-arm-kernel, linux-kernel, linux-mmc,
Russell King - ARM Linux, Santosh, Balaji T Krishnamoorthy,
Sourav Poddar, Chris Ball, Nicolas Pitre
On Mon, Aug 29, 2011 at 3:38 AM, Per Forlin <per.forlin@linaro.org> wrote:
> Reported by Russell King:
> ------------
> mmcblk0: error -84 transferring data, sector 149201, nr 64,
> cmd response 0x900, card status 0xb00
> mmcblk0: retrying using single block read
>
> WARNING: at /home/rmk/git/linux-2.6-rmk/lib/dma-debug.c:811 check_unmap
> omap_hsmmc omap_hsmmc.0: DMA-API: device driver tries to free DMA memory
> it has not allocated [device address=0x0000000080933000] [size=20480 bytes]
> -------------
>
> In case of an error dma_unmap() is issued in omap_hsmmc_dma_cleanup()
> and then again in omap_hsmmc_post_req(). Resolve this by clearing the
> host_cookie to indicate there is no DMA mapped memory to unmap.
>
> Signed-off-by: Per Forlin <per.forlin@linaro.org>
> ---
> Bug fix on 3.1-rc3
>
> drivers/mmc/host/omap_hsmmc.c | 7 +++++--
> 1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> index 21e4a79..31d9817 100644
> --- a/drivers/mmc/host/omap_hsmmc.c
> +++ b/drivers/mmc/host/omap_hsmmc.c
> @@ -1011,6 +1011,7 @@ static void omap_hsmmc_dma_cleanup(struct omap_hsmmc_host *host, int errno)
> host->data->sg_len,
> omap_hsmmc_get_dma_dir(host, host->data));
> omap_free_dma(dma_ch);
> + host->data->host_cookie = 0;
> }
> host->data = NULL;
> }
> @@ -1576,8 +1577,10 @@ static void omap_hsmmc_post_req(struct mmc_host *mmc, struct mmc_request *mrq,
> struct mmc_data *data = mrq->data;
>
> if (host->use_dma) {
> - dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len,
> - omap_hsmmc_get_dma_dir(host, data));
> + if (data->host_cookie)
> + dma_unmap_sg(mmc_dev(host->mmc), data->sg,
> + data->sg_len,
> + omap_hsmmc_get_dma_dir(host, data));
> data->host_cookie = 0;
> }
> }
> --
> 1.7.4.1
>
>
I just posted a patch [1] which just consolidates all unmapping to
just post_req.
This would obviously prevent double unmapping, and keeps all the related
dma operations at a single place. Let me know if that works better.
[1]: http://marc.info/?l=linux-mmc&m=131490406920616&w=2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] mmc: omap_hsmmc: DMA unmap only once in case of MMC error
@ 2011-09-01 19:19 ` S, Venkatraman
0 siblings, 0 replies; 7+ messages in thread
From: S, Venkatraman @ 2011-09-01 19:19 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Aug 29, 2011 at 3:38 AM, Per Forlin <per.forlin@linaro.org> wrote:
> Reported by Russell King:
> ------------
> mmcblk0: error -84 transferring data, sector 149201, nr 64,
> cmd response 0x900, card status 0xb00
> mmcblk0: retrying using single block read
>
> WARNING: at /home/rmk/git/linux-2.6-rmk/lib/dma-debug.c:811 check_unmap
> omap_hsmmc omap_hsmmc.0: DMA-API: device driver tries to free DMA memory
> it has not allocated [device address=0x0000000080933000] [size=20480 bytes]
> -------------
>
> In case of an error dma_unmap() is issued in omap_hsmmc_dma_cleanup()
> and then again in omap_hsmmc_post_req(). Resolve this by clearing the
> host_cookie to indicate there is no DMA mapped memory to unmap.
>
> Signed-off-by: Per Forlin <per.forlin@linaro.org>
> ---
> Bug fix on 3.1-rc3
>
> ?drivers/mmc/host/omap_hsmmc.c | ? ?7 +++++--
> ?1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> index 21e4a79..31d9817 100644
> --- a/drivers/mmc/host/omap_hsmmc.c
> +++ b/drivers/mmc/host/omap_hsmmc.c
> @@ -1011,6 +1011,7 @@ static void omap_hsmmc_dma_cleanup(struct omap_hsmmc_host *host, int errno)
> ? ? ? ? ? ? ? ? ? ? ? ?host->data->sg_len,
> ? ? ? ? ? ? ? ? ? ? ? ?omap_hsmmc_get_dma_dir(host, host->data));
> ? ? ? ? ? ? ? ?omap_free_dma(dma_ch);
> + ? ? ? ? ? ? ? host->data->host_cookie = 0;
> ? ? ? ?}
> ? ? ? ?host->data = NULL;
> ?}
> @@ -1576,8 +1577,10 @@ static void omap_hsmmc_post_req(struct mmc_host *mmc, struct mmc_request *mrq,
> ? ? ? ?struct mmc_data *data = mrq->data;
>
> ? ? ? ?if (host->use_dma) {
> - ? ? ? ? ? ? ? dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len,
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ?omap_hsmmc_get_dma_dir(host, data));
> + ? ? ? ? ? ? ? if (data->host_cookie)
> + ? ? ? ? ? ? ? ? ? ? ? dma_unmap_sg(mmc_dev(host->mmc), data->sg,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?data->sg_len,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?omap_hsmmc_get_dma_dir(host, data));
> ? ? ? ? ? ? ? ?data->host_cookie = 0;
> ? ? ? ?}
> ?}
> --
> 1.7.4.1
>
>
I just posted a patch [1] which just consolidates all unmapping to
just post_req.
This would obviously prevent double unmapping, and keeps all the related
dma operations at a single place. Let me know if that works better.
[1]: http://marc.info/?l=linux-mmc&m=131490406920616&w=2
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mmc: omap_hsmmc: DMA unmap only once in case of MMC error
2011-09-01 19:19 ` S, Venkatraman
@ 2011-09-12 8:34 ` Per Forlin
-1 siblings, 0 replies; 7+ messages in thread
From: Per Forlin @ 2011-09-12 8:34 UTC (permalink / raw)
To: S, Venkatraman
Cc: linaro-dev, linux-arm-kernel, linux-kernel, linux-mmc,
Russell King - ARM Linux, Santosh, Balaji T Krishnamoorthy,
Sourav Poddar, Chris Ball, Nicolas Pitre
On 1 September 2011 21:19, S, Venkatraman <svenkatr@ti.com> wrote:
> On Mon, Aug 29, 2011 at 3:38 AM, Per Forlin <per.forlin@linaro.org> wrote:
>> Reported by Russell King:
>> ------------
>> mmcblk0: error -84 transferring data, sector 149201, nr 64,
>> cmd response 0x900, card status 0xb00
>> mmcblk0: retrying using single block read
>>
>> WARNING: at /home/rmk/git/linux-2.6-rmk/lib/dma-debug.c:811 check_unmap
>> omap_hsmmc omap_hsmmc.0: DMA-API: device driver tries to free DMA memory
>> it has not allocated [device address=0x0000000080933000] [size=20480 bytes]
>> -------------
>>
>> In case of an error dma_unmap() is issued in omap_hsmmc_dma_cleanup()
>> and then again in omap_hsmmc_post_req(). Resolve this by clearing the
>> host_cookie to indicate there is no DMA mapped memory to unmap.
>>
>> Signed-off-by: Per Forlin <per.forlin@linaro.org>
>> ---
>> Bug fix on 3.1-rc3
>>
>> drivers/mmc/host/omap_hsmmc.c | 7 +++++--
>> 1 files changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
>> index 21e4a79..31d9817 100644
>> --- a/drivers/mmc/host/omap_hsmmc.c
>> +++ b/drivers/mmc/host/omap_hsmmc.c
>> @@ -1011,6 +1011,7 @@ static void omap_hsmmc_dma_cleanup(struct omap_hsmmc_host *host, int errno)
>> host->data->sg_len,
>> omap_hsmmc_get_dma_dir(host, host->data));
>> omap_free_dma(dma_ch);
>> + host->data->host_cookie = 0;
>> }
>> host->data = NULL;
>> }
>> @@ -1576,8 +1577,10 @@ static void omap_hsmmc_post_req(struct mmc_host *mmc, struct mmc_request *mrq,
>> struct mmc_data *data = mrq->data;
>>
>> if (host->use_dma) {
>> - dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len,
>> - omap_hsmmc_get_dma_dir(host, data));
>> + if (data->host_cookie)
>> + dma_unmap_sg(mmc_dev(host->mmc), data->sg,
>> + data->sg_len,
>> + omap_hsmmc_get_dma_dir(host, data));
>> data->host_cookie = 0;
>> }
>> }
>> --
>> 1.7.4.1
>>
>>
>
> I just posted a patch [1] which just consolidates all unmapping to
> just post_req.
> This would obviously prevent double unmapping, and keeps all the related
> dma operations at a single place. Let me know if that works better.
>
I'm in favour of such patch. My patch only tries to do the minimal bug fix.
I have been out of office the last 10 days or so. I'll look at your
patch later today.
Thanks,
Per
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] mmc: omap_hsmmc: DMA unmap only once in case of MMC error
@ 2011-09-12 8:34 ` Per Forlin
0 siblings, 0 replies; 7+ messages in thread
From: Per Forlin @ 2011-09-12 8:34 UTC (permalink / raw)
To: linux-arm-kernel
On 1 September 2011 21:19, S, Venkatraman <svenkatr@ti.com> wrote:
> On Mon, Aug 29, 2011 at 3:38 AM, Per Forlin <per.forlin@linaro.org> wrote:
>> Reported by Russell King:
>> ------------
>> mmcblk0: error -84 transferring data, sector 149201, nr 64,
>> cmd response 0x900, card status 0xb00
>> mmcblk0: retrying using single block read
>>
>> WARNING: at /home/rmk/git/linux-2.6-rmk/lib/dma-debug.c:811 check_unmap
>> omap_hsmmc omap_hsmmc.0: DMA-API: device driver tries to free DMA memory
>> it has not allocated [device address=0x0000000080933000] [size=20480 bytes]
>> -------------
>>
>> In case of an error dma_unmap() is issued in omap_hsmmc_dma_cleanup()
>> and then again in omap_hsmmc_post_req(). Resolve this by clearing the
>> host_cookie to indicate there is no DMA mapped memory to unmap.
>>
>> Signed-off-by: Per Forlin <per.forlin@linaro.org>
>> ---
>> Bug fix on 3.1-rc3
>>
>> ?drivers/mmc/host/omap_hsmmc.c | ? ?7 +++++--
>> ?1 files changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
>> index 21e4a79..31d9817 100644
>> --- a/drivers/mmc/host/omap_hsmmc.c
>> +++ b/drivers/mmc/host/omap_hsmmc.c
>> @@ -1011,6 +1011,7 @@ static void omap_hsmmc_dma_cleanup(struct omap_hsmmc_host *host, int errno)
>> ? ? ? ? ? ? ? ? ? ? ? ?host->data->sg_len,
>> ? ? ? ? ? ? ? ? ? ? ? ?omap_hsmmc_get_dma_dir(host, host->data));
>> ? ? ? ? ? ? ? ?omap_free_dma(dma_ch);
>> + ? ? ? ? ? ? ? host->data->host_cookie = 0;
>> ? ? ? ?}
>> ? ? ? ?host->data = NULL;
>> ?}
>> @@ -1576,8 +1577,10 @@ static void omap_hsmmc_post_req(struct mmc_host *mmc, struct mmc_request *mrq,
>> ? ? ? ?struct mmc_data *data = mrq->data;
>>
>> ? ? ? ?if (host->use_dma) {
>> - ? ? ? ? ? ? ? dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len,
>> - ? ? ? ? ? ? ? ? ? ? ? ? ? ?omap_hsmmc_get_dma_dir(host, data));
>> + ? ? ? ? ? ? ? if (data->host_cookie)
>> + ? ? ? ? ? ? ? ? ? ? ? dma_unmap_sg(mmc_dev(host->mmc), data->sg,
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?data->sg_len,
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?omap_hsmmc_get_dma_dir(host, data));
>> ? ? ? ? ? ? ? ?data->host_cookie = 0;
>> ? ? ? ?}
>> ?}
>> --
>> 1.7.4.1
>>
>>
>
> I just posted a patch [1] which just consolidates all unmapping to
> just post_req.
> This would obviously prevent double unmapping, and keeps all the related
> dma operations at a single place. Let me know if that works better.
>
I'm in favour of such patch. My patch only tries to do the minimal bug fix.
I have been out of office the last 10 days or so. I'll look at your
patch later today.
Thanks,
Per
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-09-12 8:34 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-28 22:08 [PATCH] mmc: omap_hsmmc: DMA unmap only once in case of MMC error Per Forlin
2011-08-28 22:08 ` Per Forlin
2011-08-28 22:08 ` Per Forlin
2011-09-01 19:19 ` S, Venkatraman
2011-09-01 19:19 ` S, Venkatraman
2011-09-12 8:34 ` Per Forlin
2011-09-12 8:34 ` Per Forlin
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.