|
From: Dave N. <dc...@us...> - 2006-10-06 22:52:33
|
I tracked down why valgrind 3.2.1 doesn't work at all on my RHEL5 beta 1, PPC970
machine. valgrind is failing in the first call to mmap() and the reason is that
the start address obtained from VG_(am_get_advisory) returns something that is
not page aligned on this machine. I wrote a simple test program using the same
arguments that are used in the failing call to mmap():
------------------------------------------------------------------------------------
#include <stdio.h>
#include <unistd.h>
#include <sys/mman.h>
int main()
{
void *map;
printf("pagesize=%x\n", getpagesize());
map = mmap ((void *)0x402001000, (size_t)0x100000, 0x7, 0x32, 0x0, 0x0);
if (map == MAP_FAILED) {
perror("map failed");
}
}
-----------------------------------------------------------------------------------
pagesize=10000
map failed: Invalid argument
So, it appears that 64K is now a possible page size that valgrind does not handle.
from include/vki-ppc64-linux.h:
//----------------------------------------------------------------------
// From linux-2.6.13/include/asm-ppc64/page.h
//----------------------------------------------------------------------
/* PAGE_SHIFT determines the page size */
#define VKI_PAGE_SHIFT 12
#define VKI_PAGE_SIZE (1UL << VKI_PAGE_SHIFT)
VKI_PAGE_SHIFT is apparently hard coded to be 12, but from
/usr/src/kernels/2.6.17-1.2519.4.21.el5-ppc64/include/asm-powerpc/page.h:
/*
* On PPC32 page size is 4K. For PPC64 we support either 4K or 64K software
* page size. When using 64K pages however, whether we are really supporting
* 64K pages in HW or not is irrelevant to those definitions.
*/
#ifdef CONFIG_PPC_64K_PAGES
#define PAGE_SHIFT 16
#else
#define PAGE_SHIFT 12
#endif
#define PAGE_SIZE (ASM_CONST(1) << PAGE_SHIFT)
===================================================================
I'm guessing this is a job for autoconf but am not really sure how to proceed.
This information seems to be buried in the kernel source that normally isn't
available to autoconf.
Are you aware of any existing configuration mechanism for obtaining the pagesize?
If not then would the correct way to discover this information is to have
configure.in generate a program that calls getpagesize() and uses it to define a
VG_PAGESIZE macro?
|
|
From: Julian S. <js...@ac...> - 2006-10-06 23:38:50
|
> So, it appears that 64K is now a possible page size that valgrind does not
> handle.
Ah, well spotted. Turns out there was a short exchange with Paul
Mackerras on this list on that very topic on Sun Jul 2 23:38:10 2006
but so far nothing came of it ("[Valgrind-developers] 64k pages on PPC")
Paul proposed turning the page size (VKI_PAGE_SIZE) into a variable
and that seems like a good scheme. The launcher would detect the
page size at valgrind-startup time.
As a first sanity check, can you get a working system with current
sources by changing VKI_PAGE_SIZE/SHIFT to be suitable for 64k pages?
It would be a useful quick check to find out if anything is going to
break in the presence of 64k pages.
J
|