From: Jonathan Cameron <jic23@cam.ac.uk>
To: Alexander Stein <alexander.stein@systec-electronic.com>
Cc: Michael Hennerich <Michael.Hennerich@analog.com>,
"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Anatolij Gustschin <agust@denx.de>
Subject: Re: [PATCH 1/2] ads7846: Make buffers in ads7846_read12_ser and ads7845_read12_ser DMA save
Date: Wed, 04 May 2011 17:07:01 +0100 [thread overview]
Message-ID: <4DC179A5.2080109@cam.ac.uk> (raw)
In-Reply-To: <201105041755.24184.alexander.stein@systec-electronic.com>
On 05/04/11 16:55, Alexander Stein wrote:
> Hello,
>
> Am Mittwoch, 4. Mai 2011, 17:49:56 schrieb Jonathan Cameron:
>> On 05/04/11 16:22, Alexander Stein wrote:
>>> req.sample needs its own cacheline otherwise accessing req.msg fetches
>>> it in again.
>>> Put req onto stack as it doesn't need to be DMA save.
>>> req.sample is kzalloced itself for DMA access.
>>> req.command doesn't need own cache line because it will only be written
>>> to memory on dma_map_single. req.scratch is unsed at all.
>>>
>>> Note: This effect doesn't occur if the underlying SPI driver doesn't use
>>> DMA at all.
>>
>> How about using ____cacheline_aligned having moved 'sample' to the end of
>> the structure?
>>
>> e.g.
>>
>> ...
>> struct spi_transfer xfer[6];
>> __be16 sample ____cacheline_aligned;
>> }
>>
>> Rather smaller patch when you get down to it.
>
> Mh, I didn't know I had to reorder the struct elements to use
> ____cacheline_aligned. I originally had a solution in mind with a smaller
> memory footprint in mind, but rethinking about it, this might be negligible if
> there is one at all.
> So, if ____cacheline_aligned is the more sane approach I'll resend a patch
> using it.
It simply enforces that element being aligned. Thus if there is anything after it
you may well have things in the same cacheline. Obviously you could use
align the following element to ensure its on the next cache line, but thats
silly when you can just reorder to make sure nothing is there. All mallocs
are guaranteed to get a whole number of cachelines. (would be really fiddly
otherwise!) Footprint wise, it should be pretty trivial.
next prev parent reply other threads:[~2011-05-04 16:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-04 14:02 ads7846: ads7846_read12_ser is not DMA save Alexander Stein
2011-05-04 14:17 ` Hennerich, Michael
2011-05-04 15:22 ` [PATCH 1/2] ads7846: Make buffers in ads7846_read12_ser and ads7845_read12_ser " Alexander Stein
2011-05-04 15:49 ` Jonathan Cameron
2011-05-04 15:55 ` Jonathan Cameron
2011-05-04 15:55 ` Alexander Stein
2011-05-04 16:07 ` Jonathan Cameron [this message]
2011-05-05 1:31 ` Dmitry Torokhov
2011-05-04 15:22 ` [PATCH 2/2] ads7846: Remove unused variable from struct ads7845_ser_req Alexander Stein
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=4DC179A5.2080109@cam.ac.uk \
--to=jic23@cam.ac.uk \
--cc=Michael.Hennerich@analog.com \
--cc=agust@denx.de \
--cc=alexander.stein@systec-electronic.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).