From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f69.google.com (mail-lf0-f69.google.com [209.85.215.69]) by kanga.kvack.org (Postfix) with ESMTP id BB87F6B0038 for ; Mon, 17 Oct 2016 03:54:39 -0400 (EDT) Received: by mail-lf0-f69.google.com with SMTP id b75so95201295lfg.3 for ; Mon, 17 Oct 2016 00:54:39 -0700 (PDT) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com. [148.163.158.5]) by mx.google.com with ESMTPS id z83si17696451lfa.228.2016.10.17.00.54.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Oct 2016 00:54:38 -0700 (PDT) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u9H7sIRZ085480 for ; Mon, 17 Oct 2016 03:54:36 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 264nf3w87q-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 17 Oct 2016 03:54:36 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 17 Oct 2016 08:54:35 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 536F41B08023 for ; Mon, 17 Oct 2016 08:56:34 +0100 (BST) Received: from d06av08.portsmouth.uk.ibm.com (d06av08.portsmouth.uk.ibm.com [9.149.37.249]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u9H7sV2Q15991204 for ; Mon, 17 Oct 2016 07:54:31 GMT Received: from d06av08.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u9H7sVsj012890 for ; Mon, 17 Oct 2016 01:54:31 -0600 Date: Mon, 17 Oct 2016 09:54:29 +0200 From: Heiko Carstens Subject: Re: pkeys: Remove easily triggered WARN References: <20161014182624.4yzw36n4hd7x56wi@codemonkey.org.uk> <20161017071648.GA3511@osiris> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161017071648.GA3511@osiris> Message-Id: <20161017075429.GB3511@osiris> Sender: owner-linux-mm@kvack.org List-ID: To: Dave Jones , Dave Hansen , linux-arch@vger.kernel.org, Dave Hansen , mgorman@techsingularity.net, arnd@arndb.de, linux-api@vger.kernel.org, linux-mm@kvack.org, luto@kernel.org, akpm@linux-foundation.org, torvalds@linux-foundation.org On Mon, Oct 17, 2016 at 09:16:48AM +0200, Heiko Carstens wrote: > On Fri, Oct 14, 2016 at 02:26:24PM -0400, Dave Jones wrote: > > This easy-to-trigger warning shows up instantly when running > > Trinity on a kernel with CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS disabled. > > > > At most this should have been a printk, but the -EINVAL alone should be more > > than adequate indicator that something isn't available. > > > > Signed-off-by: Dave Jones > > > > diff --git a/include/linux/pkeys.h b/include/linux/pkeys.h > > index e4c08c1ff0c5..a1bacf1150b2 100644 > > --- a/include/linux/pkeys.h > > +++ b/include/linux/pkeys.h > > @@ -25,7 +25,6 @@ static inline int mm_pkey_alloc(struct mm_struct *mm) > > > > static inline int mm_pkey_free(struct mm_struct *mm, int pkey) > > { > > - WARN_ONCE(1, "free of protection key when disabled"); > > return -EINVAL; > > } > > FWIW, are all architectures supposed to wire these new system calls up? > > I decided to ignore these on s390 since we can't make any sane use of > them. However mips has them already wired up. > > The only difference on s390 (and any other architecture without memory > protection keys with x86 like semantics) would be that pkey_alloc/pkey_free > will return -EINVAL instead of -ENOSYS and that we have a new mprotect > wrapper called pkey_mprotect, if being called with a pkey parameter of -1. What I wrote is of course not correct... There can't be any -ENOSYS if the system call isn't wired up, since the system call number hasn't been allocated at all for an architecture. But the question remains: should these be wired up on all architectures? -- 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