Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752990AbdF0PYr (ORCPT ); Tue, 27 Jun 2017 11:24:47 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:56478 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752453AbdF0PY3 (ORCPT ); Tue, 27 Jun 2017 11:24:29 -0400 Subject: Re: [RFC v4 09/17] powerpc: call the hash functions with the correct pkey value To: Ram Pai , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au, khandual@linux.vnet.ibm.com, bsingharora@gmail.com, dave.hansen@intel.com, hbabu@us.ibm.com, arnd@arndb.de, akpm@linux-foundation.org, corbet@lwn.net, mingo@redhat.com References: <1498558319-32466-1-git-send-email-linuxram@us.ibm.com> <1498558319-32466-10-git-send-email-linuxram@us.ibm.com> From: "Aneesh Kumar K.V" Date: Tue, 27 Jun 2017 20:54:07 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <1498558319-32466-10-git-send-email-linuxram@us.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 17062715-0052-0000-0000-0000022F73AF X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007286; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000214; SDB=6.00879476; UDB=6.00438334; IPR=6.00659631; BA=6.00005445; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00015976; XFM=3.00000015; UTC=2017-06-27 15:24:25 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17062715-0053-0000-0000-0000511E91C4 Message-Id: <5e4fa932-4313-5376-2147-a6431bbec16b@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-06-27_09:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1706270249 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1110 Lines: 38 On Tuesday 27 June 2017 03:41 PM, Ram Pai wrote: > Pass the correct protection key value to the hash functions on > page fault. > > Signed-off-by: Ram Pai > --- > arch/powerpc/include/asm/pkeys.h | 11 +++++++++++ > arch/powerpc/mm/hash_utils_64.c | 4 ++++ > arch/powerpc/mm/mem.c | 6 ++++++ > 3 files changed, 21 insertions(+) > > diff --git a/arch/powerpc/include/asm/pkeys.h b/arch/powerpc/include/asm/pkeys.h > index ef1c601..1370b3f 100644 > --- a/arch/powerpc/include/asm/pkeys.h > +++ b/arch/powerpc/include/asm/pkeys.h > @@ -74,6 +74,17 @@ static inline bool mm_pkey_is_allocated(struct mm_struct *mm, int pkey) > } > > /* > + * return the protection key of the vma corresponding to the > + * given effective address @ea. > + */ > +static inline int mm_pkey(struct mm_struct *mm, unsigned long ea) > +{ > + struct vm_area_struct *vma = find_vma(mm, ea); > + int pkey = vma ? vma_pkey(vma) : 0; > + return pkey; > +} > + > +/* > That is not going to work in hash fault path right ? We can't do a find_vma there without holding the mmap_sem -aneesh