Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp680924rdb; Fri, 22 Dec 2023 01:33:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IE0gGZ+0nnOfq6hcKUpOQu30lIjEyHjjHu0AzCt0VF1Kh1effO9oQjp0jlXM7S/1DG2mqtH X-Received: by 2002:a17:906:2244:b0:a1d:4874:1ab7 with SMTP id 4-20020a170906224400b00a1d48741ab7mr1078129ejr.65.1703237619743; Fri, 22 Dec 2023 01:33:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703237619; cv=none; d=google.com; s=arc-20160816; b=MxyXBcrgzA3lN7CkA6dJUI5BMg0mNAy6ilzuWXyROoaWmNbEOrLCtYkz1c274wFpVl CMRCDvzK0qXGV2zEi4QifdaQ3uiWTHFR61OEZkd503DnI/56ZDESa+DDDKkBiq5bbvNx a5Ac0pWHpgVUiLLerjtEwOHZuot2xXBiz7HMOSRz/nilLkW7wW3i7HQ5RjA5LTpcN4XL mNUai3AiN5T5H9U9j0AfCWlcA8CGRH7yAZfhfPew+qhf6BGjdYTMm1MLa/gdSzzeYMVy rvyW8Z9p5co+hTqNKqw0Npupnm5/zbsQs8VFm9C/Pdc3hoCttEjuJ1Kx0uODOO/2sesQ /SJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=2/LEPTlvMJ2kuIhBYODtGQoY6alWChBxFkI1D3QokL4=; fh=bDopyncA/C4v/w3kRwrEGj67LkIeh1LG8e11S9yYcKM=; b=m0yPkWLl+0BL6txr+ox1/GYOWfbpeNvcWP/kaBpO/aJgBIlfYt7sxiJ/n/tAAEiQ3E llYM/Ls3NNN/0EbqxN+oUTlWjNyWrGBnPHxjlgd29/WOX9se7oogLFVESkCTNv9p59Wb 3He6XZQvP+5uND5QTilpHNzTJ6EIl32BDvnrymEHE9FbkkmUqvvNVEoBo07LcVdNr3rA QIHaqqzMcN94q4fc72d75afc59w1HhEGFvyOx9LpxvOFR+zPXeclXHNnOAlSR6gjLRvL Kcph6IS8VD7PUbIiWpqtth6AsYHpBmNtAZeqNRdtiRUKoCbq8VLBg4J4XiCP3DwJm1ju brEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oWXbw1xB; spf=pass (google.com: domain of linux-kernel+bounces-9546-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9546-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id fy20-20020a170906b7d400b00a26b37b2323si616376ejb.184.2023.12.22.01.33.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 01:33:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9546-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oWXbw1xB; spf=pass (google.com: domain of linux-kernel+bounces-9546-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9546-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 8114C1F22566 for ; Fri, 22 Dec 2023 09:33:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4C6B5F9D2; Fri, 22 Dec 2023 09:33:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="oWXbw1xB" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7CA2111704; Fri, 22 Dec 2023 09:33:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9734C433CB; Fri, 22 Dec 2023 09:33:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703237612; bh=k2rXKI3XPOwdmCyThdzD0BJEHaTvbin4RkfhYTb2Kz8=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=oWXbw1xBlC41KDNUDLAbtUPkJhx4YGrQrbkTqrCv9GwBzZSFND2pZ4y8Opq/XBRIh 6ZD8U9K8my/mYra8d5Rz+XAtkPjw2XjdOHthsDYSJl6Me7gSiTfcorwdud/2BIZGjf wgiEXOVyQCIjdf4h9m1I3RiyyLm2jGfRz+KJamNzNZNYWWfaCjKCJImsyTeeKnTrHQ mt48dWe78QlGYPVy0Jv0h+8szIhYquPW/Fr8bdil3Vrdaby9dYqfiK58jySB8Orwxi kvvpBrb1jqGiC2tHYgNhm22x9w0p4p8F70V+EYQ53Fh5X+wGHRqXE6g2TCn2A/KZd4 L6KnxYOfI3P9g== Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-552d39ac3ccso5011066a12.0; Fri, 22 Dec 2023 01:33:32 -0800 (PST) X-Gm-Message-State: AOJu0YxRgtfsrjN6nUty5wV6Z3e+h8UpsoltCna4YEpWz3azQdO3SqJ5 sJF1hyLG6EMKQPPYNL5Kea4M3tO8dEzrnBB8sss= X-Received: by 2002:a17:906:8404:b0:a23:5ea1:651d with SMTP id n4-20020a170906840400b00a235ea1651dmr2151343ejx.24.1703237611416; Fri, 22 Dec 2023 01:33:31 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231221154702.2267684-1-guoren@kernel.org> <20231221154702.2267684-3-guoren@kernel.org> <367b05acb90d4a6e898dd34e4254b697@AcuMS.aculab.com> In-Reply-To: <367b05acb90d4a6e898dd34e4254b697@AcuMS.aculab.com> From: Guo Ren Date: Fri, 22 Dec 2023 17:33:18 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH V2 2/4] riscv: mm: Fixup compat arch_get_mmap_end To: David Laight Cc: "linux-kernel@vger.kernel.org" , "paul.walmsley@sifive.com" , "palmer@dabbelt.com" , "alexghiti@rivosinc.com" , "charlie@rivosinc.com" , "xiao.w.wang@intel.com" , "david@redhat.com" , "panqinglin2020@iscas.ac.cn" , "rick.p.edgecombe@intel.com" , "willy@infradead.org" , "bjorn@rivosinc.com" , "conor.dooley@microchip.com" , "cleger@rivosinc.com" , "leobras@redhat.com" , "linux-riscv@lists.infradead.org" , Guo Ren , "stable@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Dec 22, 2023 at 5:00=E2=80=AFPM David Laight wrote: > > From: guoren@kernel.org > > Sent: 21 December 2023 15:47 > > > > From: Guo Ren > > > > When the task is in COMPAT mode, the arch_get_mmap_end should be 2GB, > > not TASK_SIZE_64. The TASK_SIZE has contained is_compat_mode() > > detection, so change the definition of STACK_TOP_MAX to TASK_SIZE > > directly. > > Why 2G ? > > IIRC for 32-bit native x86 the limit is 3G, but in compat mode > it is (just under) 4G. > > There is a special mmap option (for programs like wine) to > limit mmap() to 2G. The 2G address space seems enough for a small memory scenario, and I agree the compat mode could support 4G, but it should be another feature. We limited our rv32 applications to under 2GB because we want to leave more address space for the kernel side (Our s64ilp32 kernel needs vmmap stack, kasan ...). > > David > > - > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1= 1PT, UK > Registration No: 1397386 (Wales) > --=20 Best Regards Guo Ren