linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ohad Ben-Cohen <ohad@wizery.com>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: linux-omap@vger.kernel.org, Kanigeri Hari <h-kanigeri2@ti.com>,
	Omar Ramirez Luna <omar.ramirez@ti.com>,
	Guzman Lugo Fernando <x0095840@ti.com>,
	Menon Nishanth <nm@ti.com>, Hiroshi Doyu <Hiroshi.DOYU@nokia.com>
Subject: Re: [RFC/PATCH 0/6] DSPBRIDGE: fix mem+cache API issues
Date: Mon, 17 May 2010 01:57:36 +0300	[thread overview]
Message-ID: <AANLkTikLfEQB0mtbOXIrxTj68LoY9EcSn86su6OJW8ev@mail.gmail.com> (raw)
In-Reply-To: <AANLkTindMySAOe6UG_hRoCvjIuPZdyg2nNe-Gub9pwau@mail.gmail.com>

Hi Felipe,

On Sun, May 16, 2010 at 8:35 PM, Felipe Contreras
<felipe.contreras@gmail.com> wrote:
> On Fri, May 14, 2010 at 10:27 PM, Felipe Contreras
> <felipe.contreras@gmail.com> wrote:
>> I spent some time looking deeper into this patch series, and I have some doubts.
>>
>> On Sun, May 2, 2010 at 8:47 PM, Ohad Ben-Cohen <ohad@wizery.com> wrote:
>>> Basically you're right, but the patches currently silently allow
>>> today's user space
>>> to somehow work (because if you don't use dma bounce buffers and you feel lucky
>>> about speculative prefetching then you might get away with not calling
>>> dma unmap).
>>> I did that on purpose, to ease testing & migration, but didn't
>>> explicitely said it because
>>>  frankly it's just wrong.
>>
>> I looked into the dma code (I guess it's in arch/arm/mm/dma-mapping.c)
>> and I don't understand what dma_unmap_sg is supposed to do. I see that
>> first some "safe buffer" is searched, and if there isn't any... then
>> it depends on the direction whether something is actually done or not.
>>
>> I guess it depends whether our arch has dmabounce or not, which I have
>> no idea, but if we do, wouldn't skiping dma_unmap calls leak some
>> massive amount of "safe buffers"?
>
> Now I understand better; arch/arm/mm/dma-mapping.c will not be used
> unless CONFIG_DMABOUNCE=y, which is not the case for OMAP3.
>
> So, as you can see in arch/arm/include/asm/dma-mapping.h, dma_unmap_sg
> is a noop.

This has changed since 2.6.34, when support was added
to ARM speculative prefetching. dma_unmap_* API is now
responsible to invalidate caches when data was moved in from the device
(regardless of CONFIG_DMABOUNCE).

Dspbridge really must support this, and applications should start
using it.

Whether to deprecate the old API ? Eventually I think we should,
but probably not anytime soon. Let's take the kernel approach of minimizing
user space pain: keep the old API around, mark it as candidate for
deprecation, and rethink in the future.

Thanks,
Ohad.

>
> static inline void dma_unmap_single(struct device *dev, dma_addr_t handle,
>                size_t size, enum dma_data_direction dir)
> {
>        /* nothing to do */
> }
>
> So, in the end, PROC_BEGINDMATODSP and PROC_BEGINDMAFROMDSP would do
> exactly the same as PROC_FLUSHMEMORY and PROC_INVALIDATEMEMORY
> (dmac_op_range/outer_io_range). And
> PROC_ENDDMATODSP/PROC_ENDDMAFROMDSP don't do anything. Therefore even
> if user-space updates to the new API, there's no change.
>
> I don't think it makes sense to push for this new API since there will
> be absolutely no gain.
>
>>> What do you say about the following plan then:
>>> - I'll add a single pair of begin_dma and end_dma commands that will
>>> take the additional
>>> direction parameter as described above. I'll then covert the existing
>>> flush & invalidate commands to use this begin_dma command supplying it
>>> the appropriate direction argument.
>>
>> Sounds perfect, but I wonder if the deprecated flush & invalidate
>> would really work. See previous comments.
>
> Actually it would work. I like this approach because it doesn't break
> ABI, and doesn't change the semantics unless the new ioctls are used.
>
>>> - In a separate patch, I'll deprecate flush & invalidate entirely
>>> (usage of this deprecated
>>> API will fail, resulting in a guiding error message).
>
> I don't think there's any need for deprecation.
>
>>> We get a sane and versatile (and platform-independent) implementation
>>> that always work,
>>> but breaks user space. If anyone would need to work with current user space,
>>> the deprecating patch can always be reverted locally to get back a
>>> flush & invalidate
>>> implementations that (somehow) work.
>
> I still would like the new API for the reason I mentioned before: so
> that user-space can clean/invalidate/flush.
>
> Cheers.
>
> --
> Felipe Contreras
>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2010-05-16 22:57 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-01 20:44 [RFC/PATCH 0/6] DSPBRIDGE: fix mem+cache API issues Ohad Ben-Cohen
2010-05-01 20:44 ` [RFC/PATCH 1/6] DSPBRIDGE: add memory_map_info to PROC Ohad Ben-Cohen
2010-05-01 20:44 ` [RFC/PATCH 2/6] DSPBRIDGE: remember mapping and page info in proc_map Ohad Ben-Cohen
2010-05-15  8:34   ` Felipe Contreras
2010-05-16 23:00     ` Ohad Ben-Cohen
2010-05-01 20:44 ` [RFC/PATCH 3/6] DSPBRIDGE: remove mapping information in proc_unmap Ohad Ben-Cohen
2010-05-15  8:38   ` Felipe Contreras
2010-05-16 23:02     ` Ohad Ben-Cohen
2010-05-01 20:44 ` [RFC/PATCH 4/6] DSPBRIDGE: do not call follow_page Ohad Ben-Cohen
2010-05-01 20:44 ` [RFC/PATCH 5/6] DSPBRIDGE: do not use low level cache manipulation API Ohad Ben-Cohen
2010-05-02 11:56   ` Ohad Ben-Cohen
2010-05-01 20:44 ` [RFC/PATCH 6/6] DSPBRIDGE: add dspbridge API to mark end of DMA Ohad Ben-Cohen
2010-05-02 13:17 ` [RFC/PATCH 0/6] DSPBRIDGE: fix mem+cache API issues Felipe Contreras
2010-05-02 17:47   ` Ohad Ben-Cohen
2010-05-14 19:27     ` Felipe Contreras
2010-05-14 19:49       ` Omar Ramirez Luna
2010-05-15  8:26         ` Felipe Contreras
2010-05-15  9:08           ` Felipe Contreras
2010-05-16 16:08             ` Felipe Contreras
2010-05-16 17:35       ` Felipe Contreras
2010-05-16 22:57         ` Ohad Ben-Cohen [this message]
2010-05-16 23:51           ` Felipe Contreras
2010-05-18  8:05             ` Ohad Ben-Cohen
2010-05-18 11:02               ` Felipe Contreras
2010-05-18 11:14                 ` Ohad Ben-Cohen
2010-05-18 11:43                   ` Felipe Contreras
2010-05-18 11:57                     ` Ohad Ben-Cohen
2010-05-18 12:24                       ` Felipe Contreras
2010-05-18 12:53                         ` Ohad Ben-Cohen
2010-05-19 16:50                           ` Felipe Contreras
2010-05-20 21:22                             ` Ohad Ben-Cohen
2010-05-20 21:23                               ` Ohad Ben-Cohen
2010-05-21  6:14                               ` Felipe Contreras
2010-05-21  8:22                                 ` Ohad Ben-Cohen
2010-05-21  9:42                                   ` Felipe Contreras
2010-05-24 16:19                                     ` Ohad Ben-Cohen
2010-05-24 19:21                                       ` Felipe Contreras
2010-05-24 19:49                                         ` Ohad Ben-Cohen
2010-05-16 22:35       ` Ohad Ben-Cohen
2010-05-16 23:15         ` Felipe Contreras
2010-05-16 23:21           ` Ohad Ben-Cohen
2010-05-16 23:25           ` Ohad Ben-Cohen
2010-05-17  0:05             ` Felipe Contreras
2010-05-18  6:20               ` Ohad Ben-Cohen
2010-05-20 21:18       ` Ohad Ben-Cohen

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=AANLkTikLfEQB0mtbOXIrxTj68LoY9EcSn86su6OJW8ev@mail.gmail.com \
    --to=ohad@wizery.com \
    --cc=Hiroshi.DOYU@nokia.com \
    --cc=felipe.contreras@gmail.com \
    --cc=h-kanigeri2@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=omar.ramirez@ti.com \
    --cc=x0095840@ti.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 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).