x86: create array based interface to chagne page attribute
PATCH 1/1 x86: create array based interface to chagne page attribute
In reply to a message not in the archiveFrom: Dave Airlie <[email protected]>
When cpa was refactored to the new set_memory_ interfaces, it removed a special case fast path for AGP systems, which did a lot of page by page attribute changing and held the flushes until they were finished. The DRM memory manager also required this to get useable speeds.
This introduces a new interface, which accepts an array of memory addresses to have attributes changed on and to flush once finished.
Further changes to the AGP stack to actually use this interface will be published later.
--- arch/x86/mm/pageattr-test.c | 11 ++- arch/x86/mm/pageattr.c | 148 ++++++++++++++++++++++++++++++----------- include/asm-x86/cacheflush.h | 4 + 3 files changed, 119 insertions(+), 44 deletions(-)
arch/x86/mm/pageattr-test.c +7 -4
@@ -111,6 +111,7 @@ static int pageattr_test(void)unsigned int level;int i, k;int err; +unsigned long test_addr;if (print)printk (KERN_INFO "CPA self-test:\n" );
@@ -165,8 +166,9 @@ static int pageattr_test(void)continue ; } - err =change_page_attr_clear (addr[i], len[i], -__pgprot (_PAGE_GLOBAL)); + test_addr = addr[i]; + err =change_page_attr_clear (&test_addr, len[i], +__pgprot (_PAGE_GLOBAL),0 );if (err <0 ) {printk (KERN_ERR "CPA %d failed %d\n" , i, err); failed++;
@@ -198,8 +200,9 @@ static int pageattr_test(void) failed++;continue ; } - err =change_page_attr_set (addr[i], len[i], -__pgprot (_PAGE_GLOBAL)); + test_addr = addr[i]; + err =change_page_attr_set (&test_addr, len[i], +__pgprot (_PAGE_GLOBAL),0 );if (err <0 ) {printk (KERN_ERR "CPA reverting failed: %d\n" , err); failed++;
arch/x86/mm/pageattr.c +108 -40
309 lines not on this page · raw message
include/asm-x86/cacheflush.h +4 -0
@@ -66,6 +66,10 @@ int set_memory_rw(unsigned long addr, int numpages);int set_memory_np (unsigned long addr,int numpages);int set_memory_4k (unsigned long addr,int numpages); + +int set_memory_array_uc (unsigned long *addrs,int numaddrs); +int set_memory_array_wb (unsigned long *addrs,int numaddrs); +/* * For legacy compatibility with the old APIs, a few functions * are provided that work on a "struct page".
Signature · 1 line
1.5.3.3
Quoted 7 lines · Dave Airlie
From: Dave Airlie <[email protected]>
When cpa was refactored to the new
set_memory_interfaces, it removed a special case fast path for AGP systems, which did a lot of page by page attribute changing and held the flushes until they were finished. The DRM memory manager also required this to get useable speeds.
Quoted 5 lines
This introduces a new interface, which accepts an array of memory addresses to have attributes changed on and to flush once finished.
Further changes to the AGP stack to actually use this interface will be published later.
thanks Dave, applied.
Ingo
x86.git qa found a boot crash caused by this patch, see:
[ 0.120007] CPU: Processor Core ID: 0 [ 0.124007] ACPI: Core revision 20070126 [ 0.128008] BUG: unable to handle kernel paging request at fffffffb80d6fe30 [ 0.128008] IP: [<ffffffff802200a3>] __change_page_attr_set_clr+0x6c/0xaf7 [ 0.128008] PGD 203067 PUD 0 [ 0.128008] Thread overran stack or stack corrupted
http://redhat.com/~mingo/misc/log-Sat_Apr_26_15_47_59_CEST_2008.bad
http://redhat.com/~mingo/misc/config-Sat_Apr_26_15_47_59_CEST_2008.bad
Ingo
Quoted 9 lines
[ 0.120007] CPU: Processor Core ID: 0 [ 0.124007] ACPI: Core revision 20070126 [ 0.128008] BUG: unable to handle kernel paging request at fffffffb80d6fe30 [ 0.128008] IP: [<ffffffff802200a3>] __change_page_attr_set_clr+0x6c/0xaf7 [ 0.128008] PGD 203067 PUD 0 [ 0.128008] Thread overran stack or stack corrupted
Quoted 4 lines
http://redhat.com/~mingo/misc/log-Sat_Apr_26_15_47_59_CEST_2008.bad
http://redhat.com/~mingo/misc/config-Sat_Apr_26_15_47_59_CEST_2008.badIngo
Doh.... BPB time...
one-liner attached.
Dave.
arch/x86/mm/pageattr.c +1 -1
@@ -730,7 +730,7 @@ static int __change_page_attr_set_clr(struct cpa_data *cpa, int checkalias)if (cpa->array) cpa->curaddr++;else - cpa->vaddr += cpa->numpages *PAGE_SIZE ; + *cpa->vaddr += cpa->numpages *PAGE_SIZE ; }return 0 ; }
Ingo Molnar
AppliedQuoted 1 line · Dave Airlie
one-liner attached.
applied, thanks.
Ingo
Quoted 5 lines · Ingo Molnar
Quoted 1 line · Dave Airlie
one-liner attached.
applied, thanks.
x86.git randconfig boot testing found hard lockups and crashes. Bisected it down to your patch. Config and crashlog at:
http://redhat.com/~mingo/misc/log-Mon_Apr_28_20_00_50_CEST_2008.bad
http://redhat.com/~mingo/misc/config-Mon_Apr_28_20_00_50_CEST_2008.bad
(can send more info if you need it.)
Ingo
Quoted 8 lines · Ingo Molnar
Quoted 5 lines · Ingo Molnar
Quoted 1 line · Dave Airlie
one-liner attached.
applied, thanks.
Quoted 8 lines
x86.git randconfig boot testing found hard lockups and crashes. Bisected it down to your patch. Config and crashlog at:
http://redhat.com/~mingo/misc/log-Mon_Apr_28_20_00_50_CEST_2008.bad
http://redhat.com/~mingo/misc/config-Mon_Apr_28_20_00_50_CEST_2008.bad(can send more info if you need it.)
Well drop the patch for now, I'll commit some more serious time to it when I get back online properly in a 3-4 days time...
I can't see what else I could have messed up since I rebased the patch on top of the latest x86 tree..
Dave.