From patchwork Thu Aug 22 07:13:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 13772819 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 A772DC5320E for ; Thu, 22 Aug 2024 07:13:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 68A256B02A9; Thu, 22 Aug 2024 03:13:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5F69C6B02AB; Thu, 22 Aug 2024 03:13:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3EA6F6B02AA; Thu, 22 Aug 2024 03:13:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 125826B02A8 for ; Thu, 22 Aug 2024 03:13:58 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id B8BF61A13C4 for ; Thu, 22 Aug 2024 07:13:57 +0000 (UTC) X-FDA: 82479016914.26.165295D Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf16.hostedemail.com (Postfix) with ESMTP id 7749D180007 for ; Thu, 22 Aug 2024 07:13:55 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=none; spf=pass (imf16.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=1724310819; 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=rLjIhPKDj/Dh4USx6+zotffWYAdCTHoJiXbPZyXF+3g=; b=6tGY4cQvBmwauqeiEIvLk6GsiyOncZaypySszfjeadi9PAC2THQjtMi7g/MRA0ZxADBuBt wajaWgLxXy7LjBM1L/11nQbhWtYryWSO7Iw90IAPljcTYjXMJEG11gnSqh5FGu8rMsyiSl k8j51Yyv04DgyW3DfDKjaVjo+GZkjFM= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=none; spf=pass (imf16.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724310819; a=rsa-sha256; cv=none; b=Io/YJ5C6K8hXU0OZATLPdoX4h7HmSZnASWAGwEjxml9wtOXKUrgqKwYbVLZxsIrSww58uc sM44oXv22HC7dsGxcI2Ciyd2rXIFoWbRdg/dg9O8bPe/F5KddH1PNXyCJIb4pFANAg1xxD ubxQjIHYk+iTRQLn+n0zo4+70NH+C9U= Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4WqDvG1Hfxz9sSX; Thu, 22 Aug 2024 09:13:30 +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 cfcB8-hHUiZb; Thu, 22 Aug 2024 09:13:30 +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 4WqDvG0NQrz9sSH; Thu, 22 Aug 2024 09:13:30 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id ED0E58B77D; Thu, 22 Aug 2024 09:13:29 +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 mLRSvJmx548r; Thu, 22 Aug 2024 09:13:29 +0200 (CEST) Received: from PO20335.idsi0.si.c-s.fr (PO16920.IDSI0.si.c-s.fr [192.168.232.181]) by messagerie.si.c-s.fr (Postfix) with ESMTP id D75308B77E; Thu, 22 Aug 2024 09:13:28 +0200 (CEST) From: Christophe Leroy To: Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "Theodore Ts'o" , "Jason A. Donenfeld" , Arnd Bergmann , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Vincenzo Frascino , Shuah Khan Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v2 07/17] mm: Define VM_DROPPABLE for powerpc/32 Date: Thu, 22 Aug 2024 09:13:15 +0200 Message-ID: <315e3a268b165b6edad7dcb723b0d8a506a56c4e.1724309198.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=1724310794; l=2716; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=OlEqmFYyA/zYCHsi3M5a6YAHLTZymd8rahW36+TnP9o=; b=0KtX+75e5aHacqDKWQzqJJ0c3IpXSB6kgpJ4hqMZLLHdQ8eM9uPGFxsA9pxzj08bhyJT2vwTC Mzj8u0pdGU1Avply/I3zb6bed28Vac+xMEzM29FNgP7xAAaRupkUHDN X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-Rspam-User: X-Stat-Signature: mu9hdzt1ccaqt69pyc69nrsptjhp66f9 X-Rspamd-Queue-Id: 7749D180007 X-Rspamd-Server: rspam11 X-HE-Tag: 1724310835-12709 X-HE-Meta: U2FsdGVkX1+Ab5T7ElSTbQfj3wt6gqdotpMi/FtVgTYhBRE0pVTmCiNYSqKgli8PjdpcYS7EXqe6+60BSDsp3Go2gUSzb+CqRKeqwBysJHNkj+hyvfINPlj4Jmi8xZA+usZMMDwqceroovu1waWLzi9xieZwcmqqHMTz07Dkx061d7CgGyt48F0T8CKGsZGsVkObbL2I/GdpFgoq+tmYZydix9nV4kZS6d0iN42qdLoZV8ixS0sZi2PjKA0t/JqXLMq5/h+N9WrwWb9yn//YUyunbolt6sDByG+xlJDHwN6qp922uyOqvpyGdqLjiCisehAJevQ7GfELwuDh+wVREvfPxpaY2XTK7DbjgoR+sF0dpvttdMmKvPdY7p8f4jTDWs1CSraSAxOpxV96ZCV1TrmspgcEYQ4CUAvDPFxiqGxcdkI1ZN2uMBFQFDfcWhT3v+Tt03n/xWinTvjxhYM7yVJVft4G3sKVQJ+tkEtaQB9iMX18VWphuZkpEiCF+bF2lT3LnmZLv8jwykeVR3P/UHRkhhZPaE1Okscd9CJSwk3GPfoqKeU/DuV6i/YAYjDs4juVJOfys2H1bUBMD4X3Rainud6MZc49PKrZSOue9MMMYGFbHXB2VJJNkH5hZvCTxyey6tGPBfGTkGvTA8cNNMtVBvAfdQ3dNVVR0C5ekgfMCpDen5c1u1UwQySJsoWFoX5WTUNBDaoQc5QiJNk/POhvtZoOyM17TcQxM97AbgLPfqjXr/AXrzFCHa92dVTd5yryUdqIhFmiQymuKVvIv8h0QcNd8jOwgxucGw6iJxiiOpC4Gld50OmNQD0GsuQokDr75+k9Jo0Rvg3SOLIlqRuQbIGl3d6Oq4Ux0Gmnxd4sGcqx5OKY7ZwHUsCHImRrjuEAv9kYIExWc0M61lbRxVaOomEpOhWF4wAjSlFPQDBoop+bFrpJZfah0MyCkDxRMOLgOd1oPFN28/FR5lA 8J6iacAK uOf0Pv/ytbEKqM8FCBM7MXSt05fXmHY5OOioly/1ogVMSPMnvkSW43icgE6jfIsqHUuaTcZL8QA1+zHdCIFsvnFVSenE1FeSJxEcDZ+80R5LtkyZi57jW0JN9+b+hfbe0ArEZi2tgUyGWixw7N87CvNZ4GHh+/8t91sGIw8zGIvBZPnk= 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. Signed-off-by: Christophe Leroy --- 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..4a3fe961cbf6 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 VM_DROPPABLE != VM_NONE [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 c4b238a20b76..865d3e21ee5e 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..9820cbfbcb14 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 VM_DROPPABLE != VM_NONE # define IF_HAVE_VM_DROPPABLE(flag, name) {flag, name}, #else # define IF_HAVE_VM_DROPPABLE(flag, name)