seems ttm_bo_handle_move_mem not flush cache, if BO move SYS->VRAM?

Jerome Glisse j.glisse at gmail.com
Thu Dec 2 18:25:39 PST 2010


On Thu, Dec 2, 2010 at 2:35 AM, Thomas Hellstrom <thomas at shipmail.org> wrote:
> On 12/02/2010 03:49 AM, april wrote:
>>
>> thanks Thomas
>>
>> I want to flush CPU cache, before use DMA  from system memory to VRAM.
>>
>> Seems I should do this in driver move function itself.
>>
>
> Yes. That's the right way.
>
>> bty,
>> when BO changes from cached to write-combined, CPU cache will be
>> flushed, and all the pages in this BO will do this.
>> but, may be only a small part of page's cache flush is really
>> needed(CPU just write to a few pages in BO).
>>
>> Is there any ways to solve this?
>>
>
> Unfortunately not at the moment. It would require tracking of dirty pages in
> TTM and that is on my to-do list, but that also requries changes to the
> linux kernel VM system. At the moment I'm not completely sure how costly a
> clflush is for a cache line that's not in the CPU cache.
>
> For BOs that are almost only written to, you should try to keep also system
> pages write-combined. In that case they are allocated write-combined from
> the TTM memory pool and the cache changing doesn't need to occur.
>
> /Thomas
>

Note that clflush is only available on cpu with sse2 iirc.

April also most of today GPU can do cache coherent DMA on PCI/PCIE (ie
no need to flush cache or write-combined page), may i ask what is the
GPU you are working on ?

Cheers,
Jerome


More information about the dri-devel mailing list