Hi,
The following APIs are needed for us to support the legacy Tegra
memory manager for devices("NvMap") with *DMA mapping API*.
New API:
->iova_alloc(): To allocate IOVA area.
->iova_alloc_at(): To allocate IOVA area at specific address.
->iova_free(): To free IOVA area.
->map_page_at(): To map page at specific IOVA.
misc:
->iova_get_free_total(): To return how much IOVA is available totally.
->iova_get_free_max(): To return the size of biggest IOVA area.
Although NvMap itself will be replaced soon, there are cases for the
above API where we need to specify IOVA explicitly.
(1) HWAs may require the address for special purpose, like reset vector.
(2) IOVA linear mapping: ex: [RFC 5/5] ARM: dma-mapping: Introduce
dma_map_linear_attrs() for IOVA linear map
(3) To support different heaps. To have allocation and mapping
independently.
Some of them could be supported with creating different mappings, but
currently a device can have a single contiguous mapping, and we cannot
specifiy any address inside of a map since all IOVA alloction is done
implicitly now.
This is the revised version of:
http://lists.linaro.org/pipermail/linaro-mm-sig/2012-May/001947.htmlhttp://lists.linaro.org/pipermail/linaro-mm-sig/2012-May/001948.htmlhttp://lists.linaro.org/pipermail/linaro-mm-sig/2012-May/001949.html
Any comment would be really appreciated.
Hiroshi Doyu (5):
ARM: dma-mapping: New dma_map_ops->iova_get_free_{total,max}
functions
ARM: dma-mapping: New dma_map_ops->iova_{alloc,free}() functions
ARM: dma-mapping: New dma_map_ops->iova_alloc*_at* function
ARM: dma-mapping: New dma_map_ops->map_page*_at* function
ARM: dma-mapping: Introduce dma_map_linear_attrs() for IOVA linear
map
arch/arm/include/asm/dma-mapping.h | 55 +++++++++++++
arch/arm/mm/dma-mapping.c | 124 ++++++++++++++++++++++++++++++
include/asm-generic/dma-mapping-common.h | 20 +++++
include/linux/dma-mapping.h | 14 ++++
4 files changed, 213 insertions(+), 0 deletions(-)
--
1.7.5.4
Hi all,
Today, I finally merged the DMABUF V4L2 patches from Tomasz.
The DMABUF allows replacing the old V4L2 Overlay method by something more
robust and safer.
It was a long road to get them ready for their upstream inclusion, and to
be able to test on both embedded and personal computers.
Along this weekend, I was able to test it using 4 different test scenarios:
- vivi + s5p-tv;
- uvcvideo + fimc (m2m) + s5p-tv;
- s5k4ecgx + fimc (m2m) + s5p-tv;
- uvcvideo + i915.
The first 3 tests ran on a Samsung Origen Rev. A board; the 4th one on a
notebook, with a Sandy Bridge i5core processor with GPU, and an embedded
UVC camera.
While testing the s5k4ecgx sensor driver, I also added support for multiplane
at libv4l, via its plugin interface:
http://git.linuxtv.org/v4l-utils.git/commit/ced1be346fe4f61c864cba9d81f6608…
Such tests wouldn't be possible without the help of Linaro and Samsung,
with donated me some hardware for the tests, and Ideas on Board for making
uvcvideo + i915 driver to work especially for this test.
Thank you all for your support!
In particular, Sylwester helped me a lot to fix several non-related issues with
the Origen board, that was not running with an upstream Kernel.
There are a number of patches required to make the Origen board to work with an
Upstream Kernel. Also, its sensor driver (s5k4ecgx) was not submitted upstream
yet. In order to help others that may need to do similar tests, I added the
needed patches on my experimental tree, at branch origen+dmabuf:
http://git.linuxtv.org/mchehab/experimental.git/shortlog/refs/heads/origen%…
Still missing there are the wireless/bluetooth support. It seems that there are
some patches for it already, but they aren't submitted upstream, nor I didn't
test they.
I expect that Linaro and Samsung will be able to submit real soon the pending
patches needed by Origen in time for its addition on 3.8.
Thank you all!
Mauro
It has been observed that system tends to keep a lot of CMA free pages
even in very high memory pressure use cases. The CMA fallback for movable
pages is used very rarely, only when system is completely pruned from
MOVABLE pages, what usually means that the out-of-memory even will be
triggered very soon. To avoid such situation and make better use of CMA
pages, a heuristics is introduced which turns on CMA fallback for movable
pages when the real number of free pages (excluding CMA free pages)
approaches low water mark.
Signed-off-by: Marek Szyprowski <m.szyprowski(a)samsung.com>
Reviewed-by: Kyungmin Park <kyungmin.park(a)samsung.com>
CC: Michal Nazarewicz <mina86(a)mina86.com>
---
mm/page_alloc.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index fcb9719..90b51f3 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1076,6 +1076,15 @@ static struct page *__rmqueue(struct zone *zone, unsigned int order,
{
struct page *page;
+#ifdef CONFIG_CMA
+ unsigned long nr_free = zone_page_state(zone, NR_FREE_PAGES);
+ unsigned long nr_cma_free = zone_page_state(zone, NR_FREE_CMA_PAGES);
+
+ if (migratetype == MIGRATE_MOVABLE && nr_cma_free &&
+ nr_free - nr_cma_free < 2 * low_wmark_pages(zone))
+ migratetype = MIGRATE_CMA;
+#endif /* CONFIG_CMA */
+
retry_reserve:
page = __rmqueue_smallest(zone, order, migratetype);
--
1.7.9.5
Since commit 2139cbe627b8 ("cma: fix counting of isolated pages") free
pages in isolated pageblocks are not accounted to NR_FREE_PAGES counters,
so watermarks check is not required if one operates on a free page in
isolated pageblock.
Signed-off-by: Marek Szyprowski <m.szyprowski(a)samsung.com>
---
mm/page_alloc.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index fd154fe..43ab09f 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1394,10 +1394,12 @@ int capture_free_page(struct page *page, int alloc_order, int migratetype)
zone = page_zone(page);
order = page_order(page);
- /* Obey watermarks as if the page was being allocated */
- watermark = low_wmark_pages(zone) + (1 << order);
- if (!zone_watermark_ok(zone, 0, watermark, 0, 0))
- return 0;
+ if (get_pageblock_migratetype(page) != MIGRATE_ISOLATE) {
+ /* Obey watermarks as if the page was being allocated */
+ watermark = low_wmark_pages(zone) + (1 << order);
+ if (!zone_watermark_ok(zone, 0, watermark, 0, 0))
+ return 0;
+ }
/* Remove page from free list */
list_del(&page->lru);
--
1.7.9.5
__alloc_contig_migrate_range() should use all possible ways to get all the
pages migrated from the given memory range, so pruning per-cpu lru lists
for all CPUs is required, regadless the cost of such operation. Otherwise
some pages which got stuck at per-cpu lru list might get missed by
migration procedure causing the contiguous allocation to fail.
Reported-by: SeongHwan Yoon <sunghwan.yun(a)samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski(a)samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park(a)samsung.com>
---
mm/page_alloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 1bfe2b0..fcb9719 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5677,7 +5677,7 @@ static int __alloc_contig_migrate_range(struct compact_control *cc,
unsigned int tries = 0;
int ret = 0;
- migrate_prep_local();
+ migrate_prep();
while (pfn < end || !list_empty(&cc->migratepages)) {
if (fatal_signal_pending(current)) {
--
1.7.9.5