ANDROID: 16K: Align vdso mapping size to a 16kB multiple
The x86 emulated page size is controlled by runtime kernel param page_shift=*, to avoid needing a separate x86 16k kernel build. The vdso is a special VMA inserted in the address space of every process. It is not created by do_mmap(), and therefore needs to be make 16kB compatible separately. Align mapping size by the max page size, since this must be known at build time when converting the vdso shared library to a C array. The target page size is not known at build time so use the larger, more portable, alignment/size. x86 builds will have a extended vdso layout. This is an anonymous mapping so it is not be affected by readahead. The cost on 4kB x86 device is extra VA space (at most 12kB). Bug: 383389337 Bug: 356729201 Change-Id: I0bbc181c3542183df340eaf6cf55de959541603f Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
This commit is contained in:
committed by
Carlos Llamas
parent
37ebd01b5a
commit
4395898bf5
@@ -5,6 +5,16 @@
|
||||
* are built for 32-bit userspace.
|
||||
*/
|
||||
|
||||
/*
|
||||
* For x86_64 16kB page size emulation
|
||||
*
|
||||
* The redefinition is needed here since, vdso2c is a program that runs
|
||||
* on the host.
|
||||
*
|
||||
* It converts the vdso shared lib to a C array.
|
||||
*/
|
||||
#define __MAX_PAGE_SIZE 16384
|
||||
|
||||
static void BITSFUNC(copy)(FILE *outfile, const unsigned char *data, size_t len)
|
||||
{
|
||||
size_t i;
|
||||
@@ -175,7 +185,7 @@ static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
|
||||
return;
|
||||
}
|
||||
|
||||
mapping_size = (stripped_len + 4095) / 4096 * 4096;
|
||||
mapping_size = (stripped_len + __MAX_PAGE_SIZE-1) / __MAX_PAGE_SIZE * __MAX_PAGE_SIZE;
|
||||
|
||||
fprintf(outfile, "/* AUTOMATICALLY GENERATED -- DO NOT EDIT */\n\n");
|
||||
fprintf(outfile, "#include <linux/linkage.h>\n");
|
||||
@@ -184,8 +194,8 @@ static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
|
||||
fprintf(outfile, "#include <asm/vdso.h>\n");
|
||||
fprintf(outfile, "\n");
|
||||
fprintf(outfile,
|
||||
"static unsigned char raw_data[%lu] __ro_after_init __aligned(PAGE_SIZE) = {",
|
||||
mapping_size);
|
||||
"static unsigned char raw_data[%lu] __ro_after_init __aligned(%d) = {",
|
||||
mapping_size, __MAX_PAGE_SIZE);
|
||||
for (i = 0; i < stripped_len; i++) {
|
||||
if (i % 10 == 0)
|
||||
fprintf(outfile, "\n\t");
|
||||
|
||||
Reference in New Issue
Block a user