Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp220356rwd; Fri, 19 May 2023 18:45:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6fF4/09Sv1ce0op5aCvhXW5PWhYRlJRrDZQQRUNNMGIQkd8I2FGbWWWOAHpfN9JQ4QQUEm X-Received: by 2002:a05:6a21:3288:b0:10a:ba39:fdc0 with SMTP id yt8-20020a056a21328800b0010aba39fdc0mr507418pzb.39.1684547129928; Fri, 19 May 2023 18:45:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684547129; cv=none; d=google.com; s=arc-20160816; b=NSnzz0h8iZ8n7vCTZ6KITZYp3XjPfFdFSKR6nzCt8qlOwbtMcYjCi1qsUQ5SpkMJRM f5wJxSAra/GkgMYkwd/WQPZumOwROWwaaTtEro7VAJKGuMSWjdJ8OFHCe5ZhRIt1uml5 GEyodqLqe08JxBUBkCADLVNaPBltDeK4sKVQl72sBO91KE3Y6HLC8SAn+iuGsRf5wkRk S4ZVvtptWo409xSv9ZQZkAHQWdtSUfZ2gFDSUWmDLonooSGIeaLnwK/sFLoUtdggVFA5 zOPk1fBS6k6hed9R+htynpJAt5A7LFlVXUhWQo4lWK7WZ8QKpautbLBTP0HTmdKPJCCL c6rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=GPSTTk80q0gcB7nOOpgcIEFkTLGQiEZ7r5Jn2I4Texw=; b=j+llawurpNnnYfX/GGS5ZIUazEV6ydQfqwJq/zBicFxi61ZZqGGD054DjcwrE4AxKK C9wUUELQMtYGKESURN091ne7dDzi/Wb0iDHAQIMtNmyPEXRwoXXCw7LLzlmQyIqgUHA8 ujynmKwZEbRlUS0SEjj2eOyjMiUWS479o/CQgDrJDE6B7+xgfTpzGC936cjuhgDpy4an 2uR3zT77DvVvf1/V7KhJPhjr5mVXa7aOopcVzB/y4nE/GVl9D5MrTSzWBPL5fD1DOPRH EfITFyjZc1zB+PAFtho4+ELKP3oDxEmcFazYYtgk5pnd0H2Q7Pt6cH0m3nDhwUtREHEh 4KoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=h2zoj4WI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d21-20020a63d715000000b00528c2cf454asi545027pgg.666.2023.05.19.18.45.17; Fri, 19 May 2023 18:45:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=h2zoj4WI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229989AbjETBn5 (ORCPT + 99 others); Fri, 19 May 2023 21:43:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229832AbjETBn4 (ORCPT ); Fri, 19 May 2023 21:43:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0ADDE116; Fri, 19 May 2023 18:43:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9550161CAB; Sat, 20 May 2023 01:43:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07925C4339B; Sat, 20 May 2023 01:43:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684547034; bh=/MFAlDt0wtJT6ilnMT0hH/mEXV8rXc92ftjgCpnLA3s=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=h2zoj4WIIqf1y3gDpPN1FD5eTvZAhQ2NxcOcF1MU4+K6WRIwYZbzgs+1AdWY9SMkt wmEihANFP8MzHHECEX5XQbs+m0HfAOKNAJcTjzlf58vC1TLsrwiF8R9Whtv74tKgXo CShtNmh9yiGjbQ50e8vbMGMSuHGvLub5YQj4tIiCJQqg3g7pJ9KAtSg0CBFoXMJnbk 2JY8odcEr+nWrPXZJx8o4WfGqdOWLJ08lxRtiBj6KH+uVOlkggPTR4CR97VX/NWxBX 7kZNkLOY0+ms0YM0a9r1II1vyBiBjN7OK/BxBSDo7ecYiRPp39UOsDf7XZFiCI52Fw YtkjHSYN4Y9FA== Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-96f7bf3cf9eso187584466b.0; Fri, 19 May 2023 18:43:53 -0700 (PDT) X-Gm-Message-State: AC+VfDwgpcOkBHfqDO/SkoAQy6h0KInJZ4uq6plmJVyEEAxOhsnyuDmZ nQldLNPX+4DdAOD7daCetu3MouH5h4A7pN2HKrQ= X-Received: by 2002:a17:906:a143:b0:960:f1a6:6a12 with SMTP id bu3-20020a170906a14300b00960f1a66a12mr3138956ejb.55.1684547032269; Fri, 19 May 2023 18:43:52 -0700 (PDT) MIME-Version: 1.0 References: <556bebad-3150-4fd5-8725-e4973fd6edd1@app.fastmail.com> In-Reply-To: From: Guo Ren Date: Sat, 20 May 2023 09:43:41 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH 00/22] riscv: s64ilp32: Running 32-bit Linux kernel on 64-bit supervisor mode To: Arnd Bergmann Cc: Palmer Dabbelt , Thomas Gleixner , Peter Zijlstra , Andy Lutomirski , "Conor.Dooley" , =?UTF-8?Q?Heiko_St=C3=BCbner?= , Jisheng Zhang , Huacai Chen , Anup Patel , Atish Patra , Mark Rutland , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Paul Walmsley , Catalin Marinas , Will Deacon , Mike Rapoport , Anup Patel , shihua@iscas.ac.cn, jiawei@iscas.ac.cn, liweiwei@iscas.ac.cn, luxufan@iscas.ac.cn, chunyu@iscas.ac.cn, tsu.yubo@gmail.com, wefu@redhat.com, wangjunqiang@iscas.ac.cn, kito.cheng@sifive.com, Andy Chiu , Vincent Chen , Greentime Hu , Jonathan Corbet , wuwei2016@iscas.ac.cn, Jessica Clarke , Linux-Arch , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Guo Ren Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 20, 2023 at 12:54=E2=80=AFAM Arnd Bergmann wrot= e: > > On Fri, May 19, 2023, at 17:31, Guo Ren wrote: > > On Fri, May 19, 2023 at 2:29=E2=80=AFAM Arnd Bergmann w= rote: > >> On Thu, May 18, 2023, at 17:38, Palmer Dabbelt wrote: > >> > On Thu, 18 May 2023 06:09:51 PDT (-0700), guoren@kernel.org wrote: > >> > >> If for some crazy reason you'd still want the 64ilp32 ABI in user > >> space, running the kernel this way is probably still a bad idea, > >> but that one is less clear. There is clearly a small memory > >> penalty of running a 64-bit kernel for larger data structures > >> (page, inode, task_struct, ...) and vmlinux, and there is no > > I don't think it's a small memory penalty, our measurement is about > > 16% with defconfig, see "Why 32-bit Linux?" section. > > > > This patch series doesn't add 64ilp32 userspace abi, but it seems you > > also don't like to run 32-bit Linux kernel on 64-bit hardware, right? > > Ok, I'm sorry for missing the important bit here. So if this can > still use the normal 32-bit user space, the cost of this patch set > is not huge, and it's something that can be beneficial in a few > cases, though I suspect most users are still better off running > 64-bit kernels. > > > The motivation of s64ilp32 (running 32-bit Linux kernel on 64-bit s-mod= e): > > - The target hardware (Canaan Kendryte k230) only supports MXL=3D64, > > SXL=3D64, UXL=3D64/32. > > - The 64-bit Linux + compat 32-bit app can't satisfy the 64/128MB scen= arios. > > > >> huge additional maintenance cost on top of the ABI itself > >> that you'd need either way, but using a 64-bit address space > >> in the kernel has some important advantages even when running > >> 32-bit userland: processes can use the entire 4GB virtual > >> space, while the kernel can address more than 768MB of lowmem, > >> and KASLR has more bits to work with for randomization. On > >> RISCV, some additional features (VMAP_STACK, KASAN, KFENCE, > >> ...) depend on 64-bit kernels even though they don't > >> strictly need that. > > > > I agree that the 64-bit linux kernel has more functionalities, but: > > - What do you think about linux on a 64/128MB SoC? Could it be > > affordable to VMAP_STACK, KASAN, KFENCE? > > I would definitely recommend VMAP_STACK, but that can be implemented > and is used on other 32-bit architectures (ppc32, arm32) without a > huge cost. The larger virtual user address space can help even on > machines with 128MB, though most applications probably don't care at > that point. Good point, I would support VMAP_STACK in ARCH_RV64ILP32. > > > - I think 32-bit Linux & RTOS have monopolized this market (64/128MB > > scenarios), right? > > The minimum amount of RAM that makes a system usable for Linux is > constantly going up, so I think with 64MB, most new projects are > already better off running some RTOS kernel instead of Linux. > The ones that are still usable today probably won't last a lot > of distro upgrades before the bloat catches up with them, but I > can see how your patch set can give them a few extra years of > updates. Linux development costs much cheaper than RTOS, so the vendors would first develop a Linux version. If it succeeds in the market, the vendors will create a cost-down solution. So their first choice is to cut down the memory footprint of the first Linux version instead of moving to RTOS. With the price of 128MB-DDR3 & 64MB-DDR2 being more and more similar, 32bit-Linux has more opportunities to instead of RTOS. > > For the 256MB+ systems, I would expect the sensitive kernel > allocations to be small enough that the series makes little > difference. The 128MB systems are the most interesting ones > here, and I'm curious to see where you spot most of the > memory usage differences, I'll also reply to your initial > mail for that. Thx, I aslo recommand you read about "Why s64ilp32 has better performance?" section :) How do you think running arm32-Linux on coretex-A35/A53/A55? > > Arnd --=20 Best Regards Guo Ren