From patchwork Fri May 4 21:59:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ram Pai X-Patchwork-Id: 10381741 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A549B60353 for ; Fri, 4 May 2018 22:00:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 91DE529541 for ; Fri, 4 May 2018 22:00:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8372229560; Fri, 4 May 2018 22:00:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D121229569 for ; Fri, 4 May 2018 22:00:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 11D0C6B026A; Fri, 4 May 2018 18:00:12 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 0CD686B026B; Fri, 4 May 2018 18:00:12 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E89F46B026C; Fri, 4 May 2018 18:00:11 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt0-f200.google.com (mail-qt0-f200.google.com [209.85.216.200]) by kanga.kvack.org (Postfix) with ESMTP id BCAC26B026A for ; Fri, 4 May 2018 18:00:11 -0400 (EDT) Received: by mail-qt0-f200.google.com with SMTP id u9-v6so17082859qtg.2 for ; Fri, 04 May 2018 15:00:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:sender:from:to:cc:subject:date :message-id:in-reply-to:references; bh=c3El0u+VYXa+a4nAkubAe4MpFonjhF3mBl+89Q7nMfA=; b=sGc9PGmGJTDu3upQXsrQ+LnNE6sFFtZrFiW68cbcYkcy3kvPu5E2sFRJaQCtdGrXAH bbBFDAj4C4sv0tSylxPoUDntUVlGQJHWoIGXlYpa1b3uxNqINXUG6EtZ4p5rsxapcTe3 cSv+NffiWUkKYZrmss7yLycFQujXXGsYGy6kdHT3Ahj1tS9qd4DlUMm5gpzAitdxlPzs 1rHSBj7b1CIKEmqn6Y48cUtVOSDs/ENV8m7Pi1Gvb+tip4k/bjG4J0ottWWoeV7H/S0L Cr910gDtaEBKLZE0h+4vesPg0a/0r/WizTQ7ma4VW3wephSeJ0G07DkyFAcLGAOB7w56 PmUg== X-Gm-Message-State: ALQs6tBMV/BOIxX+/rJF8wR1II5sUECLfKXz4xw3JVU2YlY8E1XRRdfC bPpr6oHu9e0XUF0QYiJM6BiGfJg0X2PCNQa9szJVZpraZtPQyvWgoofhMVUlTFcrPSkEcJI7871 fP644/LatsE2Yit44wzfWA8Q6sxWx9QXbtdB15KHP3TXJgV6RVNGwq5zhlRoM4jGxlx4u5cZldY dxQ//nM93rngb4Ggp8kG32lMQ1s2dI7o3AF2yI0dRRaSDRAsEA5JWyo37SzXibFE7SEIiCkLHxJ GRQ/8reUBEQ+M9GDn23+I0R7earZ8a2uwThTkfNkgdP6q1vOl7RkovnCXlyeC6HR1qUUWAt5+0R Vj3RYK56bqhEKnOpIRgvFpQcJ6yuTdPRTa8d0qzBO6/4QsRz8LF9KpGkcOyYRIwk6Yp5qZQYVA= = X-Received: by 10.55.33.17 with SMTP id h17mr23641912qkh.427.1525471211507; Fri, 04 May 2018 15:00:11 -0700 (PDT) X-Received: by 10.55.33.17 with SMTP id h17mr23641871qkh.427.1525471210801; Fri, 04 May 2018 15:00:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525471210; cv=none; d=google.com; s=arc-20160816; b=wTZUzVytGtcorLkvs6LhZo3LN9md/PCgEXe33D6iyNqJVxS9hYcah0fXsTId2ROvqI HnkLXUBv8qVM1shMlr26kQYaJ2JRnFsnpHF1I0ha0IbLILFn7DGvUa5hPv9gYj3ajEZR nceYTEjkCIYIMBawnUP2kj2fVjrSIZ6wjYWkQZGOrdlFzF9vwlHBc5BpvO9OUh7r0nI3 xH6HWcTS8gUFAxMiUybXOjiz/yvCDcCLTQsHThXOaQEgI0iLDHVvYXUpPLNBPnYmTc8O 6K5xsU4vjCQuTA4zYA6hkXPex7+M2jZ51wRvRuoKmkbf5os4tP32cN3BP6a8K4fxDRlz YW9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature:arc-authentication-results; bh=c3El0u+VYXa+a4nAkubAe4MpFonjhF3mBl+89Q7nMfA=; b=i2mq2/S1WRkOB6kE0FwvSWmkQ+7vGl+YmW+P5vMZ6OccdMVLkkcDZs4hU3UejGKCOS M7qtfGsl7x+MSBA4S461VKGUMxXdESFo1AFWQQ5/+X+wLSD5CU4O+KmQHbC2YnO6W4mj vZ7LbYEcX/KEzqXi+0huIekqTiJy5+5oNabho2D7hQuJvHiAkCn0deXXNvIPrjdz2cd4 gHErdrJi6oV90VjXO9qoMsK0Kc5rDQD61zaXICtOfO1Au7atH8Z34ZxspXs3OdzmMxP7 sLzOCpJsxnUUuQhGO7CDy518jN3Wla+RGf9PZvSznVpD2A21QnOKofVclsqeB4C4KZw6 OQ4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WvFFVtd0; spf=pass (google.com: domain of ram.n.pai@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=ram.n.pai@gmail.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id z14-v6sor10032491qvi.140.2018.05.04.15.00.10 for (Google Transport Security); Fri, 04 May 2018 15:00:10 -0700 (PDT) Received-SPF: pass (google.com: domain of ram.n.pai@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WvFFVtd0; spf=pass (google.com: domain of ram.n.pai@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=ram.n.pai@gmail.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=c3El0u+VYXa+a4nAkubAe4MpFonjhF3mBl+89Q7nMfA=; b=WvFFVtd09DWIdx7B7B+jXg4EhVf+6yXB/9EmfHyzsl87fgNEr461E45jhrK01zCjJQ sc8N0Vm0whAuDkyaSy9E+RN0w7ActqiMCAYTIDpeqCFzwevqQ9KnAbJLfoAwJblmeJQh MJRqTq1kJzq6N5WGGnlHltqdSQ2cnviPtYFvA66FU5AjJ+JZrGkix5KVylGGd4HmMUYw 0/sZa+vYPuDfSn2ga23OuplnnNA0jHLQQHasPn2ofddDt8oR5xzpi+VtTrpGNgIcnE7S y/HbLIHd18kGwNOOZj7l5bwDcGEXJwhglBYVkEoLleXGRFbAIzBNoAh7anQFU9KRVc3B G/Gw== X-Google-Smtp-Source: AB8JxZr26StQ8wgMQsoAOBSyrlSHo1BmitwtRA65S74+cK5/4xAQMTbPWkbBh5ICifW/e5V4nkjEJg== X-Received: by 2002:a0c:96eb:: with SMTP id b40-v6mr25424166qvd.135.1525471210496; Fri, 04 May 2018 15:00:10 -0700 (PDT) Received: from localhost.localdomain ([170.225.9.142]) by smtp.gmail.com with ESMTPSA id i45-v6sm15488910qta.12.2018.05.04.15.00.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 May 2018 15:00:09 -0700 (PDT) From: Ram Pai To: mpe@ellerman.id.au, mingo@redhat.com, akpm@linux-foundation.org Cc: linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org, x86@kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, dave.hansen@intel.com, benh@kernel.crashing.org, paulus@samba.org, khandual@linux.vnet.ibm.com, aneesh.kumar@linux.vnet.ibm.com, bsingharora@gmail.com, hbabu@us.ibm.com, mhocko@kernel.org, bauerman@linux.vnet.ibm.com, ebiederm@xmission.com, linuxram@us.ibm.com, corbet@lwn.net, arnd@arndb.de Subject: [PATCH v13 3/3] mm, powerpc, x86: introduce an additional vma bit for powerpc pkey Date: Fri, 4 May 2018 14:59:42 -0700 Message-Id: <1525471183-21277-3-git-send-email-linuxram@us.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1525471183-21277-1-git-send-email-linuxram@us.ibm.com> References: <1525471183-21277-1-git-send-email-linuxram@us.ibm.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Only 4bits are allocated in the vma flags to hold 16 keys. This is sufficient on x86. PowerPC supports 32 keys, which needs 5bits. Allocate an additional bit. cc: Dave Hansen cc: Michael Ellermen cc: Benjamin Herrenschmidt cc: Andrew Morton Reviewed-by: Ingo Molnar Acked-by: Balbir Singh Signed-off-by: Ram Pai --- fs/proc/task_mmu.c | 1 + include/linux/mm.h | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletions(-) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 0c9e392..3ddddc7 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -679,6 +679,7 @@ static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma) [ilog2(VM_PKEY_BIT1)] = "", [ilog2(VM_PKEY_BIT2)] = "", [ilog2(VM_PKEY_BIT3)] = "", + [ilog2(VM_PKEY_BIT4)] = "", #endif /* CONFIG_ARCH_HAS_PKEYS */ }; size_t i; diff --git a/include/linux/mm.h b/include/linux/mm.h index c6a6f24..cca67d1 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -230,10 +230,16 @@ extern int overcommit_kbytes_handler(struct ctl_table *, int, void __user *, #ifdef CONFIG_ARCH_HAS_PKEYS # define VM_PKEY_SHIFT VM_HIGH_ARCH_BIT_0 -# define VM_PKEY_BIT0 VM_HIGH_ARCH_0 /* A protection key is a 4-bit value */ +/* Protection key is a 4-bit value on x86 and 5-bit value on ppc64 */ +# define VM_PKEY_BIT0 VM_HIGH_ARCH_0 # define VM_PKEY_BIT1 VM_HIGH_ARCH_1 # define VM_PKEY_BIT2 VM_HIGH_ARCH_2 # define VM_PKEY_BIT3 VM_HIGH_ARCH_3 +#if defined(CONFIG_PPC) +# define VM_PKEY_BIT4 VM_HIGH_ARCH_4 +#else +# define VM_PKEY_BIT4 0 +#endif #endif /* CONFIG_ARCH_HAS_PKEYS */ #if defined(CONFIG_X86)