Subject: Re: [PATCH] powerpc/mm: Recompute hash value after a failed update

From: "Aneesh Kumar K.V" <[email-masked]>
Date: Thu, 17 Sep 2015 00:29:03 +0530

Michael Ellerman <[email-masked]> writes:

> On Wed, 2015-09-16 at 11:27 +0530, Aneesh Kumar K.V wrote:
>> Michael Ellerman <[email-masked]> writes:
>> 
>> > On Wed, 2015-09-16 at 08:53 +0530, Aneesh Kumar K.V wrote:
>> >> "Aneesh Kumar K.V" <[email-masked]> writes:
>> >> 
>> >> > If we had secondary hash flag set, we ended up modifying hash value in
>> >> > the updatepp code path. Hence with a failed updatepp we will be using
>> >> > a wrong hash value for the following hash insert. Fix this by
>> >> > recomputing hash before insert.
>> >> 
>> >> Without this patch we can end up with using wrong slot number in linux
>> >> pte. That can result in us missing an hash pte update or invalidate
>> >> which can cause memory corruption or even machine check ?
>> >
>> > Thanks. When did this break? Always? If so this should go to stable?
>> >
>> 
>> IIUC we have this issue with initial support for THP (6d492ecc6489113968ec269be1cf88942d4a5d29)
>> " powerpc/THP: Add code to handle HPTE faults for hugepages". So yes
>> this should got to stable.
>
> Thanks. And that went into 3.11.
>
> You haven't actually seen any crashes that are definitely linked to this though
> am I right? You just found it by code inspection?
>

I am still not sure, why we haven't seen crashes. One of the possibility
is that we removed that slot because we ran out of free space soon
enough and everything went back normal.

Yes I found this by code inspection.

-aneesh