From patchwork Mon Sep 2 12:04:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 13787161 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 176C6CD13CF for ; Mon, 2 Sep 2024 12:04:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9CEF58D00C5; Mon, 2 Sep 2024 08:04:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 986238D0065; Mon, 2 Sep 2024 08:04:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7CE5A8D00C5; Mon, 2 Sep 2024 08:04:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 5AD198D0065 for ; Mon, 2 Sep 2024 08:04:56 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 157ACC1BE0 for ; Mon, 2 Sep 2024 12:04:56 +0000 (UTC) X-FDA: 82519666992.22.0134408 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf10.hostedemail.com (Postfix) with ESMTP id BD5F1C002C for ; Mon, 2 Sep 2024 12:04:52 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=none; spf=pass (imf10.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725278599; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tAg61Zyqrflk/oJA5T5Z5RbcySQiS7N9PdlZqAQYPWw=; b=38GZBO1OcKhdbwUqSgwx9TbSch9AtLIaE6yzonrTPOsOEFktKVMcGn4uyO2RxXxFbpL1Wu F+ErauS16aBcNB6yCz3S8w0KNdYPivcCVqf6xj0FbOqDlQGtS4FBxkagJiQeYzXYIUxczN LTk+0TBV4DmZUUV7mte2z4qz2p3kVlg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725278599; a=rsa-sha256; cv=none; b=qYv4fEHFoy4vxVhvYO+76+fHAWsTsc4jiHyb0yMQp9LxvrN7WQK1KwItH/irCGg0N0gDyi /fjSEL91R+j2WANEbsxz2CIXX8gxNw0WbFEK7iJNXjICK8F8na9XpWz705wMluSY/udMSX nk05KFWL1MWFL6wkAZVej4WfrLX6eas= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=none; spf=pass (imf10.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4Wy6rG42qvz9sSS; Mon, 2 Sep 2024 14:04:46 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pr5VjX4xW_4R; Mon, 2 Sep 2024 14:04:46 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4Wy6rG2hzbz9sS7; Mon, 2 Sep 2024 14:04:46 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 47D6D8B763; Mon, 2 Sep 2024 14:04:46 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 2QYRZDFL4LQE; Mon, 2 Sep 2024 14:04:46 +0200 (CEST) Received: from PO20335.idsi0.si.c-s.fr (unknown [192.168.234.167]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 4B7AA8B76C; Mon, 2 Sep 2024 14:04:45 +0200 (CEST) From: Christophe Leroy To: Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Michael Ellerman , Nicholas Piggin , Naveen N Rao , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Shuah Khan , "Jason A . Donenfeld" Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kselftest@vger.kernel.org, llvm@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, Adhemerval Zanella , Xi Ruoyao Subject: [PATCH v4 1/5] mm: Define VM_DROPPABLE for powerpc/32 Date: Mon, 2 Sep 2024 14:04:38 +0200 Message-ID: <2f3d000794fb8ba269ecd99255ce0974ec29b144.1725278148.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1725278679; l=3068; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=D2XQkJzjCFhHvddcGK1wPF6zrU/7AFSP1S12xB5e/Jg=; b=862t58a+UUHiRkFB3MVUl14yhG8isNoHEs0EJ66BJ+LHhxCT4V3V+QaMlGWamNO6JfHeMVozB Dy/b2iEUtK7Ck4sOycw9b9DCn0OGzlgVPGtesvTWdR7Q19bQL61MaT1 X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: BD5F1C002C X-Stat-Signature: osziks7zjerk1fppsmuzy7o9nhbtgsc1 X-HE-Tag: 1725278692-644344 X-HE-Meta: U2FsdGVkX1/evFbFvpuqyuFLCOrlZTe5PzddgNseE6Mk2NTA4QF2rcsue6wV0ZrKcKTcbJ8aqvzhljPly2tVGM+G+onEhHX4UpIoW3lAEeUjsO4uPWH+z1Zvt00ILCmjrvXizbGSv0tHLxG+VRTdYcOjYVWvVtDBa4QDv0HdieBhqnZxprwqwnlLv5G/zFOx1rQQVE0ttig5o6/nzgFTkrRKiEaK+7XsPQDbmut1trlUDCCrjJ0FPYvdt3ogNjqqQohGkUePNsGs9fLmLYH8iztPA4pdOwQmkNz997xPLiierLtRqGB5ld3CckFaJjB0LBEK1iTAR2c5AzixPMFBP5E6hKhwavME7snsrgT8MUlni5MlIGBhzoU4fv4Vn7iTUMYL6YLDasVH75I1M8MHcfbJaoXy0wYZxbpiUAMn1SukDf8bhtbzGJIEJonkvTTVnAH5BphOZr65LdjaKSafLNNPDo4tuw4z8YkWnj5qMSU3l4q8uCLNEbf+RTWHUE6mY4hkZNi31Cmhqv1Kc4mau8S8lfj1Z23LxfxMshGKcDOntf6T8yu7rPPsXjXaYkomd3fazAyl7/2rgosTmEB8d8z5ElNzhhUxpVJNZyT4odk03EkAJ+losKMEE+v8q5e/ds5lbwxYvFcO9EQ14IDnueyJsGZkieezX37bS9PllIaRVjDa4DTFJ6kybh7p6Tr4ZqubuQQn6xg34z0Glsm4tLZM9AVRvoJXs0Ay3x4576cJn2mlQq4CHD5XSg+GtYe+Pp15YHSgGEHNwHwdDlorYGlzw+nYtj9zfXwGpVb+csnTvUWx16jkVEQVtCworOlLun2BRlfKfTrgMM3oW2gFazyaaUEH3LNqLZZEFHMIKc8FaaIHEac2dtbGYXF8qnH03OBBs/KHO7s9d1T/PndUde6EgudWijZPV/6FZks43jt3nh2frq/Rhs4RAErDrlNFxnU4URDQbhVMUACWG6m 5m3RApZH pGhP+a1AcXLx86niGb60IUO5XpL0RHtI3MpT5/IaWPYINCRS4QjqKXO6eqbPuog64n+Y9ei0vAXZg1gXMjdOQ7wc4U/txIcPTCg/LDkYSjtgaRNzzTojmzg4/tggwSmSnC3ojYO/D0JJ5yWQaUpgi6Zvv6jEp3QusMDK/vsniJMM+P/E= 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: List-Subscribe: List-Unsubscribe: Commit 9651fcedf7b9 ("mm: add MAP_DROPPABLE for designating always lazily freeable mappings") only adds VM_DROPPABLE for 64 bits architectures. In order to also use the getrandom vDSO implementation on powerpc/32, use VM_ARCH_1 for VM_DROPPABLE on powerpc/32. This is possible because VM_ARCH_1 is used for VM_SAO on powerpc and VM_SAO is only for powerpc/64. It is used in combination with PROT_SAO in some parts of code that are restricted to CONFIG_PPC64 through #ifdefs, it is therefore possible to define VM_SAO for CONFIG_PPC64 only. Signed-off-by: Christophe Leroy --- v4: Added more details in commit message following comment from Michael. v3: Fixed build failure reported by robots. --- fs/proc/task_mmu.c | 4 +++- include/linux/mm.h | 4 +++- include/trace/events/mmflags.h | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 5f171ad7b436..3a07e13e2f81 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -987,8 +987,10 @@ static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma) #ifdef CONFIG_X86_USER_SHADOW_STACK [ilog2(VM_SHADOW_STACK)] = "ss", #endif -#ifdef CONFIG_64BIT +#if defined(CONFIG_64BIT) || defined(CONFIG_PPC32) [ilog2(VM_DROPPABLE)] = "dp", +#endif +#ifdef CONFIG_64BIT [ilog2(VM_SEALED)] = "sl", #endif }; diff --git a/include/linux/mm.h b/include/linux/mm.h index 6549d0979b28..028847f39442 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -359,7 +359,7 @@ extern unsigned int kobjsize(const void *objp); #if defined(CONFIG_X86) # define VM_PAT VM_ARCH_1 /* PAT reserves whole VMA at once (x86) */ -#elif defined(CONFIG_PPC) +#elif defined(CONFIG_PPC64) # define VM_SAO VM_ARCH_1 /* Strong Access Ordering (powerpc) */ #elif defined(CONFIG_PARISC) # define VM_GROWSUP VM_ARCH_1 @@ -409,6 +409,8 @@ extern unsigned int kobjsize(const void *objp); #ifdef CONFIG_64BIT #define VM_DROPPABLE_BIT 40 #define VM_DROPPABLE BIT(VM_DROPPABLE_BIT) +#elif defined(CONFIG_PPC32) +#define VM_DROPPABLE VM_ARCH_1 #else #define VM_DROPPABLE VM_NONE #endif diff --git a/include/trace/events/mmflags.h b/include/trace/events/mmflags.h index b63d211bd141..37265977d524 100644 --- a/include/trace/events/mmflags.h +++ b/include/trace/events/mmflags.h @@ -143,7 +143,7 @@ IF_HAVE_PG_ARCH_X(arch_3) #if defined(CONFIG_X86) #define __VM_ARCH_SPECIFIC_1 {VM_PAT, "pat" } -#elif defined(CONFIG_PPC) +#elif defined(CONFIG_PPC64) #define __VM_ARCH_SPECIFIC_1 {VM_SAO, "sao" } #elif defined(CONFIG_PARISC) #define __VM_ARCH_SPECIFIC_1 {VM_GROWSUP, "growsup" } @@ -165,7 +165,7 @@ IF_HAVE_PG_ARCH_X(arch_3) # define IF_HAVE_UFFD_MINOR(flag, name) #endif -#ifdef CONFIG_64BIT +#if defined(CONFIG_64BIT) || defined(CONFIG_PPC32) # define IF_HAVE_VM_DROPPABLE(flag, name) {flag, name}, #else # define IF_HAVE_VM_DROPPABLE(flag, name)