Subject: Re: [PATCH V2 19/31] powerpc/mm: Convert 4k hash insert to C

From: Anshuman Khandual <[email-masked]>
Date: Thu, 01 Oct 2015 19:19:26 +0530

On 10/01/2015 01:48 AM, Benjamin Herrenschmidt wrote:
> On Wed, 2015-09-30 at 17:37 +0530, Anshuman Khandual wrote:
>>> +             if (unlikely(old_pte & _PAGE_BUSY))
>>> +                     return 0;
>>> +             /* If PTE permissions don't match, take page fault */
>>
>> We are already in page fault interrupt path,  will it be better
>> if we call it "take Linux page fault" instead as we will go back
>> walking the page table.
> 
> A better wording would be "escalate the page fault"

Right. There is one more thing. hash_page_mm function can have
these following return values after completion.

/* Result code is:
 *  0 - handled
 *  1 - normal page fault---> Escalate into linux page fault
 * -1 - critical hash insertion error 
 * -2 - access not permitted by subpage protection mechanism
 */

-2 is returned after looking into the sub page protection bits.
 0 is returned when hash page insert succeeds
       - ppc_md.hpte_insert returns actual slot number
       - Multiple retries after ppc_md.hpte_insert returns -1
         indicating that HPTEG is full and try secondary hash

 1 is returned when PTE in the page table does not contain PFN
-1 is returned when hash page did not succeed
	- ppc_md.hpte_insert returns -2 when it cannot insert HPTE

The point is, there are multiple combinations of (0, 1, -1, -2)
out there in various paths without much documentation which can be
cleaned up. Not in this series but may be later.