linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: omar.ramirez@ti.com (Omar Ramirez Luna)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC] tidspbridge: use a parameter to allocate shared memory
Date: Fri, 8 Oct 2010 12:20:21 -0500	[thread overview]
Message-ID: <4CAF52D5.9040007@ti.com> (raw)
In-Reply-To: <AANLkTikRWdw8NQinHmco6dp+XtEr5mr_7H8OBU6+FcB0@mail.gmail.com>

On 10/8/2010 3:18 AM, Felipe Contreras wrote:
> On Thu, Oct 7, 2010 at 10:16 PM, Omar Ramirez Luna<omar.ramirez@ti.com>  wrote:
>> On 10/7/2010 1:22 PM, Felipe Contreras wrote:
>> ...
>>>
>>> Note that the "shared memory" described in the document you share has
>>> nothing to do with the SHM pool. AFAIK that memory is used for other
>>> things, like MMU PTEs, and storing the base image and socket-nodes,
>>> thus it needs to be contiguous.
>>
>> hmmm, no. it is the same memory. i.e.: we propagate the current opp through
>> the shared memory so the dsp can read it if it went to sleep, with the
>> proper offset you can read that variable starting from the mempool base
>> address.
>
> The document mentions "shared memory" for buffer passing, normal
> memory is used for that, scattered, even user-space memory, not the
> SHM contiguous area.

"streaming" (meaning dsp stream) buffers are passed through the SHM 
(check page 9). The regular "big" buffers are passed through old DMM 
(page 14) which is exactly as you describe it; but that SHM portion is 
referring to stream buffers.

>
>>> I don't see any problem flushing the SHM area when needed, which
>>> probably has performance implications when mmaping/unmapping buffers,
>>> at which point you need to flush bigger memory areas anyway, so that's
>>> not an issue.
>>
>> well, you would have to flush when loading the base image, or allocating a
>> socket node, but also minor flushes for opp propagation, SHM messages to
>> DSP, chnl params, those are the ones I can quickly think of.
>
> All those happen when you send buffers to the DSP, and when you do
> that you need to flush the buffer memory area, which is a much heavier
> operation. Except maybe the opp propagation, but that would require at
> most one page to be flushed, not a big deal I think, besides, it would
> be better if that specific area is handled differently than the rest
> of the SHM, so that we can allocate it with dma_alloc_coherent().

Yes, on top of the regular buffer flush, you need to flush the specific 
parts of the shared memory that the dsp is going to read, meaning: you 
send a buffer to the dsp, then send the MBX interrupt, to let it know 
there is a SHM message, DSP is going to read that SHM message from the 
SHM memory.

You also need to invalidate if the dsp is going to write, so the next 
time you read there is no mismatch in the data, meaning: DSP sends a SHM 
message to slot 1, but you already read slot 1 from a previous 
transaction so contents might be still in cache, so you need to 
invalidate that memory and read again the new SHM message.

Now to know when to read/write you need to have 2 flags per operation, 
one to know if you have new messages and other to know if you are 
reading/writing any message (all in SHM), which are there right now for 
this specific case; but if flushing the SHM, now you will need flags for 
knowing if the first two have been already flushed... and then 2 for 
these two... and so on. So in the end a better locking mechanism would 
be needed for both ARM and DSP which is not based on memory which may or 
may not have the latest contents (going the cacheable route).

As I have been saying, we can try this changes in the ARM tidspbridge 
because we _freely_ see what is going on, but in the DSP we can't.

Regards,

Omar

  reply	other threads:[~2010-10-08 17:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-07  5:45 [RFC] tidspbridge: use a parameter to allocate shared memory Omar Ramirez Luna
2010-10-07  7:40 ` Laurent Pinchart
2010-10-07  8:32   ` Russell King - ARM Linux
2010-10-07 14:01     ` Laurent Pinchart
2010-10-07 17:13       ` Omar Ramirez Luna
2010-10-07 19:07       ` Russell King - ARM Linux
2010-10-07 17:01   ` Omar Ramirez Luna
2010-10-07 18:22     ` Felipe Contreras
2010-10-07 19:16       ` Omar Ramirez Luna
2010-10-08  8:18         ` Felipe Contreras
2010-10-08 17:20           ` Omar Ramirez Luna [this message]
2010-10-08  8:20         ` Felipe Contreras
2010-10-08 17:31           ` Omar Ramirez Luna

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=4CAF52D5.9040007@ti.com \
    --to=omar.ramirez@ti.com \
    --cc=linux-arm-kernel@lists.infradead.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).