CPA interfaces WAS x86: Fix CPA memtype reserving in the set_pages_arraycases

From: Thomas Hellström
Date: Mon Aug 03 2009 - 15:31:45 EST


Suresh Siddha skrev:

Also, now that we have set_pages_array interface, do we still need the
set_memory_array_uc interface? Removing that should clean up the cpa
code a bit.

thanks,
suresh

This might be a good time to discuss how graphics drivers will use this interface in the not too distant future. These are my thoughts.

1) A pool of uc / wc pages: Jerome Glisse and Dave Airlie have been working on this. It will hugely speed up the allocation and freeing of transient uc / wc buffers. Pages will be allocated and freed in chunks of a couple of megabytes, and caching attributes are changed using the set_pages_array() interface. The pool will sit in the TTM driver.
1a) Using large pages: With such a pool it would be beneficial to allocate and free large pages to avoid page splitting in the CPA code. There is no code in the pool implementation for that yet, but I think the set_memory_array_xx will be the best interface for that, although I guess set_pages_array_xx would work.

2) Optimize cache flushing:
2a) I think both the TTM code and AGP code flushes the cache before changing from wb, to make sure the device sees the data. Therefore with these callers, I don't think the CPA code needs to flush the cache again, and it might be beneficial with a "cache_already_flushed" bool to some of the function apis.
2b) Use self-snooping where available regardless of the value of the "cache_already_flushed" bool.

3) set_pages_array_np():
This is a bit controversial, but will enable a certain valuable class of graphics optimizations. The idea is to, instead of marking the PTEs as wc or uc, marking them as non-present, np. This means that the TTM code does not need to bother with CPA if it wants to make quick cached reads from graphics buffers. Just use kmap_atomic() and make sure to clflush before unmap.
The caveat is that all np pages must be marked wb before hibernation since the hibernation code will try to read from the linear kernel map. But we have to deal with that today for uc / wc highmem pages today as well since the hibernation code will try to kmap() them with wb page attributes.

It would be nice to have some comments on these general ideas before starting to work on them.

/Thomas



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/