Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751554AbdF1HMt (ORCPT ); Wed, 28 Jun 2017 03:12:49 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:60252 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751489AbdF1HMk (ORCPT ); Wed, 28 Jun 2017 03:12:40 -0400 Date: Wed, 28 Jun 2017 00:12:28 -0700 From: Ram Pai To: "Aneesh Kumar K.V" Cc: 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, 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 Subject: Re: [RFC v4 09/17] powerpc: call the hash functions with the correct pkey value Reply-To: Ram Pai References: <1498558319-32466-1-git-send-email-linuxram@us.ibm.com> <1498558319-32466-10-git-send-email-linuxram@us.ibm.com> <5e4fa932-4313-5376-2147-a6431bbec16b@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5e4fa932-4313-5376-2147-a6431bbec16b@linux.vnet.ibm.com> User-Agent: Mutt/1.5.20 (2009-12-10) X-TM-AS-GCONF: 00 x-cbid: 17062807-0004-0000-0000-00001276E483 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007289; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000214; SDB=6.00879792; UDB=6.00438523; IPR=6.00659947; 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.00015986; XFM=3.00000015; UTC=2017-06-28 07:12:39 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17062807-0005-0000-0000-00007FF650E7 Message-Id: <20170628071228.GA5561@ram.oc3035372033.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-06-28_04:,, 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-1706280111 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1497 Lines: 46 On Tue, Jun 27, 2017 at 08:54:07PM +0530, Aneesh Kumar K.V wrote: > > > 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 There is a fundamental problem with this new design. Looks like we can't hold a lock in that path, without badly hurting the performance. I am moving back to the old design. Cant by-pass the pte. The keys will be programmed into the pte which will than be used to program the hpte. RP