[CRIU] [PATCH 1/6] Replace PAGE_SIZE in vaddr_to_pfn

Pavel Emelyanov xemul at parallels.com
Tue Oct 7 02:06:54 PDT 2014


On 10/06/2014 10:50 PM, Christopher Covington wrote:
> On AArch64, pages may be 4K or 64K depending on kernel configuration.
> Instead of using the build time constant PAGE_SIZE, query the page
> size at run time using sysconf(_SC_PAGESIZE).

AFAIK on x86 the PAGE_SIZE is always 4k (Cyrill?).

If this is true, can we have the vaddr_to_pfn() still operate on
a constant rather than the _sysconf() call for x86?

Thanks,
Pavel

> This fixes the following error for AArch64 kernels with
> CONFIG_ARM64_64K_PAGES=y.
> 
> Error (util.c:660): Can't read pme for pid 107: No such file or directory
> 
> Signed-off-by: Christopher Covington <cov at codeaurora.org>
> ---
>  util.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/util.c b/util.c
> index 8283730..f8d2108 100644
> --- a/util.c
> +++ b/util.c
> @@ -649,7 +649,7 @@ int vaddr_to_pfn(unsigned long vaddr, u64 *pfn)
>  	if (fd < 0)
>  		return -1;
>  
> -	off = (vaddr / PAGE_SIZE) * sizeof(u64);
> +	off = (vaddr / sysconf(_SC_PAGESIZE)) * sizeof(u64);
>  	if (lseek(fd, off, SEEK_SET) != off) {
>  		pr_perror("Failed to seek address %lx", vaddr);
>  		goto out;
> 



More information about the CRIU mailing list