All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Łukasz Czerwiński" <l.czerwinski@samsung.com>
To: Mark Brown <broonie@kernel.org>
Cc: s.nawrocki@samsung.com, linux-samsung-soc@vger.kernel.org,
	linux-spi@vger.kernel.org
Subject: Re: [RFC PATCH 3/6] spi: spi-s3c64xx: Add coherent buffers for DMA transfers
Date: Wed, 11 Sep 2013 09:48:36 +0200	[thread overview]
Message-ID: <52302054.8050600@samsung.com> (raw)
In-Reply-To: <20130910120228.GF29403@sirena.org.uk>



On 09/10/2013 02:02 PM, Mark Brown wrote:
> On Tue, Sep 10, 2013 at 01:23:45PM +0200, Łukasz Czerwiński wrote:
>> On 09/09/2013 04:45 PM, Mark Brown wrote:
>
>>> This seems like a very low limit to have, consider things like firmware
>>> downloads for example.  It seems reasonable to have a preallocated small
>>> buffer but there should be some fallback for larger transfer sizes.
>
>> I have tested my modification with different buffer sizes with
>> S5C73M3 driver (355560 B upload). I obtained following upload times:
>
>> 16kB buffer:
>> 	- 83.972 ms
>> 	- 79.196 ms
>> 	- 79.432 ms
>> 128kB buffer:
>> 	- 74.449 ms
>> 	- 80.719 ms
>> 	- 75.599 ms
>
>> For 256kB I obtained similar results as in 128kB case. Normally
>> non-interrupted SPI transfer should take 56ms (50MHz). Performance
>> loss is approximately about 6% between 16kB and 128KB buffer. I my
>> opinion there are no need to use bigger buffers.
>
> You're missing the point here.  This requires the client driver to know
> the maximum transfer size that the controller supports and split the
> transfer up for it.  This isn't something that the SPI API supports now
> and while it would be useful to add for controllers that are genuinely
> limited in transfer size it doesn't seem sane to just randomly impose a
> limit to make life easier for software.  Not all applications will be
> able to split their transfers up in the first place and it seems like
> the wrong place to put that knowledge.
>
> What I would expect to see the driver doing here is either allocating
> a larger buffer on demand or (probably more reliably given the need for
> contiguous physical memory) transparently splitting larger transfers.
> A super smart implementation would overlap the copy of blocks with the
> transfers of preceeding blocks, and there should be something we can do
> to avoid having to copy data that's already in suitable memory.
>
Thanks for your comments.
I will try implement transparently splitting larger transfer.

> Ideally this would all be factored out into the core based on limit
> information but that's probably not required immediately.  Though now I
> write that I'm wondering how many other devices should be doing this but
> aren't.  The DMA mapping of transfer buffers doesn't seem terribly
> device specific...
>
>> I propose add extra module parameter which allows to change buffer size.
>
> No, module parameters are not sensible for modern code.  If you wanted
> runtime configuration a sysfs tunable would be better though I do think
> that should be tuning optimisation, not a hard limit on the transfer
> size.
>
ok

Thanks
Lukasz

  reply	other threads:[~2013-09-11  7:48 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-09 14:09 [RFC PATCH 0/6] spi/s3c64xx: clean up and optimization Lukasz Czerwinski
2013-09-09 14:09 ` [RFC PATCH 1/6] spi: spi-s3c64xx: Remove platform dependent code Lukasz Czerwinski
2013-09-09 14:38   ` Mark Brown
2013-09-11 16:21     ` Heiko Stübner
2013-09-09 14:09 ` [RFC PATCH 2/6] spi: spi-s3c64xx: Correct functions namespacing Lukasz Czerwinski
2013-09-09 14:09 ` [RFC PATCH 3/6] spi: spi-s3c64xx: Add coherent buffers for DMA transfers Lukasz Czerwinski
2013-09-09 14:45   ` Mark Brown
2013-09-10 11:23     ` Łukasz Czerwiński
2013-09-10 12:02       ` Mark Brown
2013-09-11  7:48         ` Łukasz Czerwiński [this message]
2013-09-09 14:09 ` [RFC PATCH 4/6] spi: spi-s3c64xx: Remove redundant code Lukasz Czerwinski
2013-09-09 14:09 ` [RFC PATCH 5/6] spi: spi-s3c64xx: Use module_platform_driver() Lukasz Czerwinski
2013-09-09 14:47   ` Mark Brown
2013-09-09 14:09 ` [RFC PATCH 6/6] spi: spi-s3c64xx: Move DMA initialization Lukasz Czerwinski
2013-09-09 14:53   ` Mark Brown
2013-09-10 11:24     ` Łukasz Czerwiński
2013-09-10 12:03       ` Mark Brown
2013-09-10 13:16         ` Łukasz Czerwiński
2013-09-10 16:32           ` Mark Brown
2013-09-11  7:45             ` Łukasz Czerwiński
2013-09-11 10:03               ` Mark Brown

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=52302054.8050600@samsung.com \
    --to=l.czerwinski@samsung.com \
    --cc=broonie@kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=s.nawrocki@samsung.com \
    /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.