On 11/20/2017 09:21 AM, Thomas Gleixner wrote:
>> +    pgd = native_get_shadow_pgd(pgd_offset_k(0UL));
>> +    for (i = PTRS_PER_PGD / 2; i < PTRS_PER_PGD; i++) {
>> +            unsigned long addr = PAGE_OFFSET + i * PGDIR_SIZE;
> This looks wrong. The kernel address space gets incremented by PGDIR_SIZE
> and does not make a jump from PAGE_OFFSET to PAGE_OFFSET + 256 * PGDIR_SIZE
> 
>       int i, j;
> 
>       for (i = PTRS_PER_PGD / 2, j = 0; i < PTRS_PER_PGD; i++, j++) {
>               unsigned long addr = PAGE_OFFSET + j * PGDIR_SIZE;
> 
> Not that is has any effect right now. Neither p4d_alloc_one() nor
> pud_alloc_one() are using the 'addr' argument.

Ahh, you're saying that 'i' is effectively starting *at* PAGE_OFFSET
since it's halfway up the address space already doing PTRS_PER_PGD/2.
Adding PAGE_OFFSET to PAGE_OFFSET is nonsense.

Would it just be simpler to do:

>         for (i = PTRS_PER_PGD / 2; i < PTRS_PER_PGD; i++) {
>                 unsigned long addr = i * PGDIR_SIZE;

?

Reply via email to