From mboxrd@z Thu Jan 1 00:00:00 1970 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 AD2CDEE57C7 for ; Thu, 12 Sep 2024 06:06:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2205D6B0082; Thu, 12 Sep 2024 02:06:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1A8466B0083; Thu, 12 Sep 2024 02:06:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F3D0A6B0085; Thu, 12 Sep 2024 02:06:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id D35476B0082 for ; Thu, 12 Sep 2024 02:06:56 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 4CDC8121C6B for ; Thu, 12 Sep 2024 06:06:56 +0000 (UTC) X-FDA: 82555052832.07.ACA62C5 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by imf08.hostedemail.com (Postfix) with ESMTP id 47A11160013 for ; Thu, 12 Sep 2024 06:06:54 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=XB8lXFZl; dmarc=none; spf=pass (imf08.hostedemail.com: domain of charlie@rivosinc.com designates 209.85.214.180 as permitted sender) smtp.mailfrom=charlie@rivosinc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1726121129; a=rsa-sha256; cv=none; b=2G+OOouDXdB6Bq8dMMW6H9HV83BFJDDAhJqwTza7RRBcvwesYMuelKl3nC2RgomBFuKmMP Il4nAaJPBgdxlGhBmCtEuJnmv2cTqxWVmSEfLkpJWC+f15DI9hWoP5nVq2/AlivF34xWD6 dk4PP8f3hOQ3hci8tlAeq8DizYSF4vQ= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=XB8lXFZl; dmarc=none; spf=pass (imf08.hostedemail.com: domain of charlie@rivosinc.com designates 209.85.214.180 as permitted sender) smtp.mailfrom=charlie@rivosinc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1726121129; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=UDJaA5Y9npfkWPEOnJeHdGlQ/o0X1HQ/Q2gtdhbnZuk=; b=SrqNFUwFYDN9a6c+Z6+w+aIr6VHutUXHEoxlerBfZGoJ0XmLVYLBVo3H0bDRDsA5GWUmOI GtNXpXXyYu/UNzHxnRChKFQ93MoqOtQ3SrF/MDoBG9t2p4nC2nC+99gurrCbQJ8CyqvEp0 9J91yZGgYOoIYJQATeMnUWeSbCcTxsI= Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-206aee4073cso6674865ad.1 for ; Wed, 11 Sep 2024 23:06:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1726121213; x=1726726013; darn=kvack.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=UDJaA5Y9npfkWPEOnJeHdGlQ/o0X1HQ/Q2gtdhbnZuk=; b=XB8lXFZlyk5UxgM/MAvQi1kRd3e+DU7+5X2dHoCwJPYLoRaEXE0HXsisbEK3JEaKzf +DJUIHrfJdeVnIi+0kn14eW0OxbTpzE4IC8dcA5zZfDsEgotB42mNlWkEvgELzKc0qfI 7GQYyW8YOyZoHk8ejXtebBkOq8q52eVYzf54ZxrGqE5S29IwodkTLjH+WdRKT4smgUVi gmI9SwesR7c0q3iloQqkdkfece9oUrkVR1gxmOOPvnLYl8kvvFCRv1gHlUy4LJYuhnUc o//+7ncrsevdkPtZP3ryXqDg3rp8/sHTAUUR7uDPIHY6NPfZefV7lRpdz3O5KLwvTXp8 UDsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726121213; x=1726726013; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=UDJaA5Y9npfkWPEOnJeHdGlQ/o0X1HQ/Q2gtdhbnZuk=; b=sHnnJQDrV9heAbOvMVXtaABzi0WwWsIlGgDeCtZ+qd5a7pl9SIPKwBxdm0WD2lWu8x kXaVHV2S80niDfVkDsWg/DiDMoL3M2QmAvna72UC+8go1IyUHlzbyPG8zbpirRSMa3RJ S18FWEiUbvOiHizZQQbN5V33+5X1paVWhpOYFX9PfJZCMg3fuqKLaZC+nMZwoMS8bCgF QYd0LEdj2ogqJSQDY81OEooGquWTNpOWFSBMwW9RQ9nv+lteW7wCgP+R7eUpnUzEkmhP ltsXx0oSlZrsbbTVlJZryQudHTESJoE/1HrWU++pEPKN5RYWgQdq7OqdPMclQGArb+o1 /x0g== X-Forwarded-Encrypted: i=1; AJvYcCVHpszBZmMgOIR3boLp4poMw1zF+svo6UcueMeFTl4X0q8TYT4zJe4nJB1xig05RUQypGsmNDJcaw==@kvack.org X-Gm-Message-State: AOJu0Yx6I0zJr17DgsgHP5xitebHhXFUetB6hCAQ7MQaLbE8kkX2WwtR aYSTf/mGSPq0zJ6mev+kAJM+rvGV2jQ5pa3DZponhAu1iL25k1set0q2JOa/PYw= X-Google-Smtp-Source: AGHT+IGKXy/6JapHeAVjChHUI6qH3tbjA0GPIxSDVxSa+LImRNXpcKvZ6AKB4gkH/Tg4GRKQ5PFIHQ== X-Received: by 2002:a17:902:d2ca:b0:206:c2f4:afb7 with SMTP id d9443c01a7336-2076e36db8cmr23914475ad.26.1726121212752; Wed, 11 Sep 2024 23:06:52 -0700 (PDT) Received: from ghost ([2601:647:6700:64d0:7acc:9910:2c1d:4e65]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2076b01a39esm8052185ad.287.2024.09.11.23.06.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 23:06:52 -0700 (PDT) Date: Wed, 11 Sep 2024 23:06:46 -0700 From: Charlie Jenkins To: Arnd Bergmann Cc: "Liam R. Howlett" , Catalin Marinas , guoren , Richard Henderson , Ivan Kokshaysky , Matt Turner , Vineet Gupta , Russell King , Huacai Chen , WANG Xuerui , Thomas Bogendoerfer , "James E . J . Bottomley" , Helge Deller , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Alexander Gordeev , Gerald Schaefer , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Sven Schnelle , Yoshinori Sato , Rich Felker , John Paul Adrian Glaubitz , "David S . Miller" , Andreas Larsson , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Andy Lutomirski , Peter Zijlstra , Muchun Song , Andrew Morton , Vlastimil Babka , Lorenzo Stoakes , shuah , Christoph Hellwig , Michal Hocko , "Kirill A. Shutemov" , Chris Torek , Linux-Arch , linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, "linux-csky@vger.kernel.org" , loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-abi-devel@lists.sourceforge.net Subject: Re: [PATCH RFC v3 1/2] mm: Add personality flag to limit address to 47 bits Message-ID: References: <20240905-patches-below_hint_mmap-v3-0-3cd5564efbbb@rivosinc.com> <20240905-patches-below_hint_mmap-v3-1-3cd5564efbbb@rivosinc.com> <9fc4746b-8e9d-4a75-b966-e0906187e6b7@app.fastmail.com> <8130e50c-01e2-45c3-a516-45f5499311f2@app.fastmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8130e50c-01e2-45c3-a516-45f5499311f2@app.fastmail.com> X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 47A11160013 X-Stat-Signature: 9a4hi1mpi4snw1kzdk3wttbxqjthigyi X-Rspam-User: X-HE-Tag: 1726121214-694001 X-HE-Meta: U2FsdGVkX18it0vCXCfFkRsAmNc3qBgIo5TKVfUnA28b7ERwod6LVduz9NyQgyNrU7x7bfhkjIQJJC2jf9m1dknVF6DSHM3hS7fBwUI9F2gvQitBHRq7UdSOUV9RXQ1n2IZMWbo1K5nCvAEygy6hFiWTtUurLR8DGQMZK1sw2kcyUppP269FInu2aD2Gu9iBvMd4ai+qIFHlvmdYWnzIUsUe0ZNsjb/vTH/xC3c+c9OVzHKsKQeJJ6XuLthDzzYjiydpfU59DUps2vT70nyUGTq1tIW4BsrV/gMDT2u+XiyfVihqK1lX0Sq1LM8DZ+37kNIx1viFYKH87Sf7Lu0PQEC7r8LwMGj/FGpL/uo9D0UdFkpmZFhWQXWY259NeJXZN+zXmAMYs5fle4Bay76Y7d/89Obid69E9KGwBXcadflJTjgKu+NERCMmj0SNvmVEnxE30Z01iPk7+02cffOcYwEgloMME2E0YyDA8aCf57LF4AyXjD7jsHgFB36E2SrnJUuaFY4ZZLLJw4mDySUmivHlacTpJ/txS4vJotC/JY4KODC9FANJCQjb7NE0kc+BvbJ0y2xBeV1Bgb8Uv8N8MYajt9N2qtFhhxUHQd0gYTK7+Wz57hWaR0Q6VUrwSxprAgW9Jm3whdsz45m2DTbUXLL9SNdQH/qjqLlvMuUjp1KlE5hNeG2K8QKNRfA2re9VVRZQteQT/JnXyZz6MizltTKxQulGB7yj/bCiWSPSY/+tWrgRPPJykt1hTen1FMpwA2mD98Ao4jy4tcGuWta0eoR7HvxuXbZjS5skdxlyoXZXKzddp2XFzLrjiMF5yrCCatpFxWORreYnZLNWzveV+yWptG8gdziyLmMPs1k9TuT5emNGspLQw3CbUMevm+b9hwnOJIDOAnHPbqT8zBiBK0MYupwDDh/IWtEuerQsO98EIPh2AOie90UdsO43fI/+bph9BiDlFOsQ0DQ15bY dBEZPuFz ioFEUotINF7gexMp8BWU5n32K/d0sEBFNQUF+JZL+YJYbvDzIV/gFNsImxyZcBh8vuCVhrU1urDI2ZmNIIrkREV/svL0vy0XafxVIE7X0HbvObwqcreqWhPIYg6UikcXshN7ID9In9pXMHLPcTPY/U8UIIFZVYhf9Lx/Ynbs0K4My4O8YviZHisuC3YFzRBQFNyzMJgbfMA4NSEm41XwtcuQyNj9fuRpfM7w6A6tK5yDwkcZOB67ImrBXLD7ZjxCIDX1O8QF+Lk26OVOMfWuhtBrCWhHVBM+xrYzLbttLvpGIVGGzTnzyLL8JfdLeMn6xyDolXVZVmSJtScsPYquiffooJpapAFeyKtGZia65ZCw0lWfGMmN/AK90pakixrvQr/Q0Xr/qkl2FAE8dvg9JRFSOe2tUZ0+HNNOdx4Q2QEG1LeZcFIUuJkeQsVrvotR2zEmUqXiO6Z3BBYnyB2yIa2MXd17nZEFJxvbi8ioH9PTAldENLGDc5AQl0Oln/tBtVVsU2+g93C/NUptE93zkAAjl+MqcKl0DumUIuyuLVX69ACg= 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: On Wed, Sep 11, 2024 at 07:25:08AM +0000, Arnd Bergmann wrote: > On Wed, Sep 11, 2024, at 00:45, Charlie Jenkins wrote: > > On Tue, Sep 10, 2024 at 03:08:14PM -0400, Liam R. Howlett wrote: > > > > I responded to Arnd in the other thread, but I am still not convinced > > that the solution that x86 and arm64 have selected is the best solution. > > The solution of defaulting to 47 bits does allow applications the > > ability to get addresses that are below 47 bits. However, due to > > differences across architectures it doesn't seem possible to have all > > architectures default to the same value. Additionally, this flag will be > > able to help users avoid potential bugs where a hint address is passed > > that causes upper bits of a VA to be used. > > > > The other issue I have with this is that if there is not a hint address > > specified to be greater than 47 bits on x86, then mmap() may return an > > address that is greater than 47-bits. The documentation in > > Documentation/arch/x86/x86_64/5level-paging.rst says: > > > > "If hint address set above 47-bit, but MAP_FIXED is not specified, we try > > to look for unmapped area by specified address. If it's already > > occupied, we look for unmapped area in *full* address space, rather than > > from 47-bit window." > > This is also in the commit message of b569bab78d8d ("x86/mm: Prepare > to expose larger address space to userspace"), which introduced it. > However, I don't actually see the fallback to the full address space, > instead the actual behavior seems to be the same as arm64. > > Am I missing something in the x86 implementation, or do we just > need to update the documentation? > > Arnd Yeah I guess it is incorrect documentation then? It seems more reasonable to me to have a hint address fall back onto the larger address space because otherwise the "hint" address can cause allocations to fail even if there is space above the 47-bit limit. This is another reason I wanted to avoid having this default behavior on riscv, to not have this abuse of the hint address. - Charlie