From: Lars-Peter Clausen <lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
To: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
Cc: Christopher Freeman
<cfreeman-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org,
swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org,
vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v1 3/3] dma: tegra: avoid int overflow for transferred count
Date: Wed, 07 May 2014 21:15:39 +0200 [thread overview]
Message-ID: <536A865B.1060007@metafoo.de> (raw)
In-Reply-To: <536A61A3.3050601-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
On 05/07/2014 06:38 PM, Stephen Warren wrote:
> On 05/06/2014 03:22 PM, Christopher Freeman wrote:
>> bytes_transferred will overflow during long audio playbacks. Since
>> the driver only ever consults this value modulo bytes_requested, store the
>> value modulo bytes_requested.
>
> The audio driver may only interpret the value modulo bytes_requested,
> but what about other drivers such as the high-speed UART (and SPI?) drivers?
>
> What is the dmaengine API's design requirement here, and what do other
> dmaengine drivers do. If it's to store the modulo, then I'm fine with
> this change.
Yep, this part of the API. The residue should be between transfer length and
0. While 0 is special and should only be returned if the transfer has
finished. For cyclic transfers this means it should never be zero. So if
transferred_bytes is incremented modulo length and residue is length -
transferred_bytes you get the correct result.
WARNING: multiple messages have this Message-ID (diff)
From: Lars-Peter Clausen <lars@metafoo.de>
To: Stephen Warren <swarren@wwwdotorg.org>
Cc: Christopher Freeman <cfreeman@nvidia.com>,
ldewangan@nvidia.com, swarren@nvidia.com, vinod.koul@intel.com,
dan.j.williams@intel.com, dmaengine@vger.kernel.org,
linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 3/3] dma: tegra: avoid int overflow for transferred count
Date: Wed, 07 May 2014 21:15:39 +0200 [thread overview]
Message-ID: <536A865B.1060007@metafoo.de> (raw)
In-Reply-To: <536A61A3.3050601@wwwdotorg.org>
On 05/07/2014 06:38 PM, Stephen Warren wrote:
> On 05/06/2014 03:22 PM, Christopher Freeman wrote:
>> bytes_transferred will overflow during long audio playbacks. Since
>> the driver only ever consults this value modulo bytes_requested, store the
>> value modulo bytes_requested.
>
> The audio driver may only interpret the value modulo bytes_requested,
> but what about other drivers such as the high-speed UART (and SPI?) drivers?
>
> What is the dmaengine API's design requirement here, and what do other
> dmaengine drivers do. If it's to store the modulo, then I'm fine with
> this change.
Yep, this part of the API. The residue should be between transfer length and
0. While 0 is special and should only be returned if the transfer has
finished. For cyclic transfers this means it should never be zero. So if
transferred_bytes is incremented modulo length and residue is length -
transferred_bytes you get the correct result.
next prev parent reply other threads:[~2014-05-07 19:15 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-06 21:22 [PATCH v1 0/3] Tegra DMA residue improvements Christopher Freeman
2014-05-06 21:22 ` Christopher Freeman
2014-05-06 21:22 ` [PATCH v1 1/3] dma: tegra: finer granularity residual for tx_status Christopher Freeman
2014-05-06 21:22 ` Christopher Freeman
2014-05-07 16:37 ` Stephen Warren
[not found] ` <536A6145.2080106-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2014-05-07 22:37 ` Christopher Freeman
2014-05-07 22:37 ` Christopher Freeman
[not found] ` <20140507223745.GB20137-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2014-05-12 17:27 ` Stephen Warren
2014-05-12 17:27 ` Stephen Warren
2014-05-21 6:00 ` Vinod Koul
2014-05-06 21:22 ` [PATCH v1 2/3] dma: tegra: change interrupt-related log levels Christopher Freeman
2014-05-06 21:22 ` Christopher Freeman
[not found] ` <1399411343-12222-1-git-send-email-cfreeman-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2014-05-06 21:22 ` [PATCH v1 3/3] dma: tegra: avoid int overflow for transferred count Christopher Freeman
2014-05-06 21:22 ` Christopher Freeman
2014-05-07 16:38 ` Stephen Warren
[not found] ` <536A61A3.3050601-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2014-05-07 19:15 ` Lars-Peter Clausen [this message]
2014-05-07 19:15 ` Lars-Peter Clausen
2014-05-07 22:50 ` Christopher Freeman
2014-05-07 6:38 ` [PATCH v1 0/3] Tegra DMA residue improvements Lars-Peter Clausen
[not found] ` <5369D4FF.1070004-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
2014-05-07 21:27 ` Christopher Freeman
2014-05-07 21:27 ` Christopher Freeman
2014-05-21 5:52 ` Vinod Koul
[not found] ` <20140521055213.GK21128-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-05-21 6:58 ` Lars-Peter Clausen
2014-05-21 6:58 ` Lars-Peter Clausen
2014-05-21 11:06 ` Vinod Koul
2014-05-21 16:21 ` Stephen Warren
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=536A865B.1060007@metafoo.de \
--to=lars-qo5elluwu/uelga04laivw@public.gmane.org \
--cc=cfreeman-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
--cc=swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.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 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.