On 5/17/2018 11:03 PM, Suzuki K Poulose Wrote:
> On 17/05/18 13:46, Jia He wrote:
>> Hi Suzuki
>> On 5/17/2018 4:17 PM, Suzuki K Poulose Wrote:
>>> Hi Jia,
>>> On 17/05/18 07:11, Jia He wrote:
>>>> I ever met a panic under memory pressure tests(start 20 guests and run
>>>> memhog in the host).
>>> Please avoid using "I" in the commit description and preferably stick to
>>> an objective description.
>> Thanks for the pointing
>>>> The root cause might be what I fixed at . But from arm kvm points of
>>>> view, it would be better we caught the exception earlier and clearer.
>>>> If the size is not PAGE_SIZE aligned, unmap_stage2_range might unmap the
>>>> wrong(more or less) page range. Hence it caused the "BUG: Bad page
>>> I don't see why we should ever panic with a "positive" size value. Anyways,
>>> the unmap requests must be in units of pages. So this check might be useful.
>> good question,
>> After further digging, maybe we need to harden the break condition as below?
>> diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c
>> index 7f6a944..dac9b2e 100644
>> --- a/virt/kvm/arm/mmu.c
>> +++ b/virt/kvm/arm/mmu.c
>> @@ -217,7 +217,7 @@ static void unmap_stage2_ptes(struct kvm *kvm, pmd_t
>> - } while (pte++, addr += PAGE_SIZE, addr != end);
>> + } while (pte++, addr += PAGE_SIZE, addr < end);
> I don't think this change is need as stage2_pgd_addr_end(addr, end) must
> the smaller of the next entry or end. Thus we can't miss "addr" == "end".
If it passes addr=202920000,size=fe00 to unmap_stage2_range->
unmap_stage2_ptes will get addr=202920000,end=20292fe00
after first while loop addr=202930000, end=20292fe00, then addr!=end
Thus it will touch another pages by put_pages() in the 2nd loop.
kvmarm mailing list