Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751789AbdLSQWk (ORCPT ); Tue, 19 Dec 2017 11:22:40 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:48184 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751136AbdLSQWd (ORCPT ); Tue, 19 Dec 2017 11:22:33 -0500 Date: Tue, 19 Dec 2017 08:22:21 -0800 From: Ram Pai To: Gabriel Paubert Cc: linux-arch@vger.kernel.org, corbet@lwn.net, arnd@arndb.de, linux-doc@vger.kernel.org, aneesh.kumar@linux.vnet.ibm.com, x86@kernel.org, linux-kernel@vger.kernel.org, mhocko@kernel.org, linux-mm@kvack.org, Dave Hansen , mingo@redhat.com, paulus@samba.org, ebiederm@xmission.com, linux-kselftest@vger.kernel.org, bauerman@linux.vnet.ibm.com, akpm@linux-foundation.org, linuxppc-dev@lists.ozlabs.org, khandual@linux.vnet.ibm.com Subject: Re: [PATCH v9 29/51] mm/mprotect, powerpc/mm/pkeys, x86/mm/pkeys: Add sysfs interface Reply-To: Ram Pai References: <1509958663-18737-1-git-send-email-linuxram@us.ibm.com> <1509958663-18737-30-git-send-email-linuxram@us.ibm.com> <20171218221850.GD5461@ram.oc3035372033.ibm.com> <20171218231551.GA5481@ram.oc3035372033.ibm.com> <20171219083122.q7ycxg2dfspgzw7z@lt-gp.iram.es> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171219083122.q7ycxg2dfspgzw7z@lt-gp.iram.es> User-Agent: Mutt/1.5.20 (2009-12-10) X-TM-AS-GCONF: 00 x-cbid: 17121916-0024-0000-0000-000003044471 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008227; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000244; SDB=6.00962552; UDB=6.00486878; IPR=6.00742546; BA=6.00005752; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00018626; XFM=3.00000015; UTC=2017-12-19 16:22:29 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17121916-0025-0000-0000-0000465CC13E Message-Id: <20171219162221.GB5481@ram.oc3035372033.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-12-19_09:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1712190232 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1450 Lines: 39 On Tue, Dec 19, 2017 at 09:31:22AM +0100, Gabriel Paubert wrote: > On Mon, Dec 18, 2017 at 03:15:51PM -0800, Ram Pai wrote: > > On Mon, Dec 18, 2017 at 02:28:14PM -0800, Dave Hansen wrote: > > > On 12/18/2017 02:18 PM, Ram Pai wrote: > > > ....snip... > > > > I think on x86 you look for some hardware registers to determine > > > > which hardware features are enabled by the kernel. > > > > > > No, we use CPUID. It's a part of the ISA that's designed for > > > enumerating CPU and (sometimes) OS support for CPU features. > > > > > > > We do not have generic support for something like that on ppc. The > > > > kernel looks at the device tree to determine what hardware features > > > > are available. But does not have mechanism to tell the hardware to > > > > track which of its features are currently enabled/used by the > > > > kernel; atleast not for the memory-key feature. > > > > > > Bummer. You're missing out. > > > > > > But, you could still do this with a syscall. "Hey, kernel, do you > > > support this feature?" > > > > or do powerpc specific sysfs interface. > > or a debugfs interface. > > getauxval(3) ? > > With AT_HWCAP or HWCAP2 as parameter already gives information about > features supported by the hardware and the kernel. > > Taking one bit to expose the availability of protection keys to > applications does not look impossible. > > Do I miss something obvious? No. I am told this is possible aswell. RP