From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753213AbdGMUhY (ORCPT ); Thu, 13 Jul 2017 16:37:24 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:43125 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753142AbdGMUhV (ORCPT ); Thu, 13 Jul 2017 16:37:21 -0400 Date: Thu, 13 Jul 2017 13:37:04 -0700 From: Ram Pai To: Balbir Singh 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, aneesh.kumar@linux.vnet.ibm.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 v5 14/38] powerpc: initial plumbing for key management Reply-To: Ram Pai References: <1499289735-14220-1-git-send-email-linuxram@us.ibm.com> <1499289735-14220-15-git-send-email-linuxram@us.ibm.com> <20170712132825.2a37e2e9@firefly.ozlabs.ibm.com> <20170713074500.GF5525@ram.oc3035372033.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170713074500.GF5525@ram.oc3035372033.ibm.com> User-Agent: Mutt/1.5.20 (2009-12-10) X-TM-AS-GCONF: 00 x-cbid: 17071320-0016-0000-0000-0000072BCE86 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007362; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000214; SDB=6.00887121; UDB=6.00442891; IPR=6.00667261; BA=6.00005470; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00016216; XFM=3.00000015; UTC=2017-07-13 20:37:19 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17071320-0017-0000-0000-00003A919D79 Message-Id: <20170713203704.GA5538@ram.oc3035372033.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-07-13_10:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1707130317 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 13, 2017 at 12:45:00AM -0700, Ram Pai wrote: > On Wed, Jul 12, 2017 at 01:28:25PM +1000, Balbir Singh wrote: > > On Wed, 5 Jul 2017 14:21:51 -0700 > > Ram Pai wrote: > > > > > Initial plumbing to manage all the keys supported by the > > > hardware. > > > > > > Total 32 keys are supported on powerpc. However pkey 0,1 > > > and 31 are reserved. So effectively we have 29 pkeys. > > > > > > This patch keeps track of reserved keys, allocated keys > > > and keys that are currently free. > > > > It looks like this patch will only work in guest mode? > > Is that an assumption we've made? What happens if I use > > keys when running in hypervisor mode? > > It works in supervisor mode, as a guest aswell as a bare-metal > kernel. Whatever needs to be done in hypervisor mode > is already there in power-kvm. I realize i did not answer your question accurately... "What happens if I use keys when running in hypervisor mode?" Its not clear what happens. As far as I can tell the MMU does not check key violation when in hypervisor mode. So effectively I think, keys are ineffective when in hypervisor mode. RP From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f197.google.com (mail-pf0-f197.google.com [209.85.192.197]) by kanga.kvack.org (Postfix) with ESMTP id 7A858440874 for ; Thu, 13 Jul 2017 16:37:22 -0400 (EDT) Received: by mail-pf0-f197.google.com with SMTP id e199so66324939pfh.7 for ; Thu, 13 Jul 2017 13:37:22 -0700 (PDT) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com. [148.163.156.1]) by mx.google.com with ESMTPS id z6si4784630pgb.140.2017.07.13.13.37.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jul 2017 13:37:21 -0700 (PDT) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v6DKYXsr037440 for ; Thu, 13 Jul 2017 16:37:21 -0400 Received: from e34.co.us.ibm.com (e34.co.us.ibm.com [32.97.110.152]) by mx0a-001b2d01.pphosted.com with ESMTP id 2bpcn97xs4-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 13 Jul 2017 16:37:20 -0400 Received: from localhost by e34.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 13 Jul 2017 14:37:20 -0600 Date: Thu, 13 Jul 2017 13:37:04 -0700 From: Ram Pai Subject: Re: [RFC v5 14/38] powerpc: initial plumbing for key management Reply-To: Ram Pai References: <1499289735-14220-1-git-send-email-linuxram@us.ibm.com> <1499289735-14220-15-git-send-email-linuxram@us.ibm.com> <20170712132825.2a37e2e9@firefly.ozlabs.ibm.com> <20170713074500.GF5525@ram.oc3035372033.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170713074500.GF5525@ram.oc3035372033.ibm.com> Message-Id: <20170713203704.GA5538@ram.oc3035372033.ibm.com> Sender: owner-linux-mm@kvack.org List-ID: To: Balbir Singh 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, aneesh.kumar@linux.vnet.ibm.com, dave.hansen@intel.com, hbabu@us.ibm.com, arnd@arndb.de, akpm@linux-foundation.org, corbet@lwn.net, mingo@redhat.com On Thu, Jul 13, 2017 at 12:45:00AM -0700, Ram Pai wrote: > On Wed, Jul 12, 2017 at 01:28:25PM +1000, Balbir Singh wrote: > > On Wed, 5 Jul 2017 14:21:51 -0700 > > Ram Pai wrote: > > > > > Initial plumbing to manage all the keys supported by the > > > hardware. > > > > > > Total 32 keys are supported on powerpc. However pkey 0,1 > > > and 31 are reserved. So effectively we have 29 pkeys. > > > > > > This patch keeps track of reserved keys, allocated keys > > > and keys that are currently free. > > > > It looks like this patch will only work in guest mode? > > Is that an assumption we've made? What happens if I use > > keys when running in hypervisor mode? > > It works in supervisor mode, as a guest aswell as a bare-metal > kernel. Whatever needs to be done in hypervisor mode > is already there in power-kvm. I realize i did not answer your question accurately... "What happens if I use keys when running in hypervisor mode?" Its not clear what happens. As far as I can tell the MMU does not check key violation when in hypervisor mode. So effectively I think, keys are ineffective when in hypervisor mode. RP -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org