ttm_get_pages() will OOPS with highmem allocation
Subsystems (3)
PATCH 1/1 ttm_get_pages() will OOPS with highmem allocation
Reposting from this kernel bug:
https://bugzilla.kernel.org/show_bug.cgi?id=50241
I've tested the patch and it solves a highly repeatable OOPS with the CedarView driver that I'm porting.
Quoted 1 line
From
3552913d3a1c2d3c4ce158e91dc18cd12b522cb2Mon Sep 17 00:00:00 2001
From: Yakui Zhao <[email protected]>
Date: Tue, 7 Feb 2012 15:33:13 -0500
Subject: [PATCH] Clear the ttm page allocated from high memory zone correctly
The TTM page can be allocated from high memory. In such case it is wrong to use the page_address(page) as the virtual address for the high memory page.
--- drivers/gpu/drm/ttm/ttm_page_alloc.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/gpu/drm/ttm/ttm_page_alloc.c +4 -1
@@ -708,7 +708,10 @@ int ttm_get_pages(struct list_head *pages, int flags,/* clear the pages coming from the pool if requested */ if (flags &TTM_PAGE_FLAG_ZERO_ALLOC ) {list_for_each_entry (p, pages, lru) { -clear_page (page_address (p)); +if (PageHighMem (p)) +clear_highpage (p); +else +clear_page (page_address (p)); } }
Signature · 7 lines
1.7.7.6
--
From: Jonathan Morton
[email protected]Quoted 27 lines · Jonathan Morton
Reposting from this kernel bug:
https://bugzilla.kernel.org/show_bug.cgi?id=50241I've tested the patch and it solves a highly repeatable OOPS with the CedarView driver that I'm porting.
Quoted 1 line
From
3552913d3a1c2d3c4ce158e91dc18cd12b522cb2Mon Sep 17 00:00:00 2001From: Yakui Zhao <[email protected]>
Date: Tue, 7 Feb 2012 15:33:13 -0500
Subject: [PATCH] Clear the ttm page allocated from high memory zone correctlyThe TTM page can be allocated from high memory. In such case it is wrong to use the
page_address(page)as the virtual address for the high memory page.Signed-off-by Zhao Yakui <[email protected]>--- drivers/gpu/drm/ttm/ttm_page_alloc.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)drivers/gpu/drm/ttm/ttm_page_alloc.c +0
-0@@ -708,7 +708,10 @@ int ttm_get_pages(struct list_head *pages, int flags,/* clear the pages coming from the pool if requested */
drivers/gpu/drm/ttm/ttm_page_alloc.c int ttm_get_pages(struct list_head *pages, int flags, · line 717
Quoted 10 lines
drivers/gpu/drm/ttm/ttm_page_alloc.c +4
-1if (flags &TTM_PAGE_FLAG_ZERO_ALLOC ) {list_for_each_entry (p, pages, lru) { -clear_page (page_address (p)); +if (PageHighMem (p)) +clear_highpage (p); +else +clear_page (page_address (p)); } }
This is a pretty bad bug. I think the only reason it hasn't been hit more often is that TTM_PAGE_FLAG_ZERO_ALLOC may not be used that often. Please resend this patch with
Thanks,
Thomas