Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2249840rwd; Fri, 19 May 2023 03:10:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7DwKWzt1yCpT5rU7W12WoHF0iLvY8exdlV0taKbMzN+HEsZ3cyyAVbfVhbBByZ2hIgrMxn X-Received: by 2002:a05:6a00:134c:b0:645:5d3b:ed2f with SMTP id k12-20020a056a00134c00b006455d3bed2fmr2574798pfu.9.1684491029120; Fri, 19 May 2023 03:10:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684491029; cv=none; d=google.com; s=arc-20160816; b=tjz5hQKTTDEhGaFhyCVgdwSaWO2oKN3CwRLo/fJU9Ppa4VQxbbAnPqi2Ffuq2eYy7b izE6FB5B+4HJOhEMTxKgE3XcdCGwr5o4oYqNF3Hk962xZ2Zgf41A9xcwdb0Ehcn7tRWx kkX4SxSV371Cl5CORl8IAuxLiVA+KpudhoU2J+evTTyO+52OL6jp/fLau6H230kKJUWN hLpnUnXMKrhTBJeVSw9R9vCgT/+yAQwlhlj9vEjBarro4GJTd5bZneRZLWL40tFNJ+mY 456A9JyL9D6LmmqEGssX8PDz4xVio67U83F77zRi7ec0FXvKOHVgLTBuJl0MOtHHlrY9 0uTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=EWKz6B1W/Y3tPin6ges3aSNz4bRiZXu/aT+ZfsMHiDY=; b=GeGMy6uFJWv9/TfrkjU+QEF8VF0gKp/g/+thruG9KEO6BOUT7QGoPGNZD9TGGU6ZBU gGh1XXUfsxYYjYCxak465IA+zPgb5UTB5Wo5ILwNG8uvtJlnBD1Q/+6KFCKtvqwwLI+7 vZbX+8VERqN+pcFubQVux4CmbOQRhtTsXTGCQ36MUuVKkCABGlatlCGAaRkp1yaK05bb PoQx816bHJJxR2iVJFnm3LDFOvHKYrFfY1g89oosjeJ1EQH5BAxLbwDzupr1v9GECj0Q zv7yIvStRbUYfZqDkfZPyNAIhe07PFKQfeXdHWaG72De7dYpY02jOIy8L3B0co1yCrtr fUfQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k192-20020a633dc9000000b005143d5f9ff0si3378175pga.357.2023.05.19.03.10.16; Fri, 19 May 2023 03:10: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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230358AbjESJze (ORCPT + 99 others); Fri, 19 May 2023 05:55:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230285AbjESJzc (ORCPT ); Fri, 19 May 2023 05:55:32 -0400 Received: from 1wt.eu (ded1.1wt.eu [163.172.96.212]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BEC9EF0 for ; Fri, 19 May 2023 02:55:30 -0700 (PDT) Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id 34J9eU7k025050; Fri, 19 May 2023 11:40:30 +0200 Date: Fri, 19 May 2023 11:40:30 +0200 From: Willy Tarreau To: Zhangjin Wu Cc: Palmer Dabbelt , Paul Walmsley , Albert Ou , "Paul E . McKenney" , Thomas =?iso-8859-1?Q?Wei=DFschuh?= , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 0/2] tools/nolibc: riscv: Fix up compile error for rv32 Message-ID: <20230519094030.GA24947@1wt.eu> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, 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 Hi Zhangjin, On Fri, May 19, 2023 at 01:00:18AM +0800, Zhangjin Wu wrote: > Hi, Willy > > nolibc for riscv is only tested for rv64 currently (see > tools/testing/selftests/nolibc/Makefile), this patchset tries to let it > compile for rv32, but still not pass the nolibc selftest: > > * The first patch uses lw/sw instead of ld/sd for rv32 and verse-vice for rv64 > * This patch may conflict with the stackprotector patch [1], because > both of them changed the _start assembly in arch-riscv.h That's quite embarrassing, I'm having to trace of that series here. Now I can find it in my LKML archives, but I don't have the direct message and didn't spot the other ones. I'll have to investigate, thanks for notifying me! I'm CCing Thomas, I will check with him how to best merge the two. > * The second patch adds __NR_llseek based sys_lseek implementation for rv32 > * There is no __NR_lseek for rv32, see include/uapi/asm-generic/unistd.h > * This code is based on the version from glibc, sysdeps/unix/sysv/linux/lseek.c > * It passed the two lseek tests in nolibc selftest (write a test case manually) OK. > * To let it compile for rv32, we still need to apply one of such actions: > * Revert the kernel commit d4c08b9776b3 ("riscv: Use latest system call ABI"), > but it is not the right direction, that commit has removed all of the time32 syscalls, > and let C lib (e.g. glibc) provide the same C APIs based on the other time64 syscalls > > * If not really use any of the time32 syscalls, defining __ARCH_WANT_TIME32_SYSCALLS > macro will let it compile, but this is buggy for the current implmentations are based > on time32 syscalls! > > * Really implement the C APIs for rv32, based on the time64 syscalls, just like glibc. > This commit c8ce48f06503 ("asm-generic: Make time32 syscall numbers optional") shows > us which functions should be re-implemented. > > So, the work todo for rv32 is: > > * Rebasing all of the old time32 syscalls based C APIs on the new time64 syscalls, > but they are not simply mapped one by one, glibc is a good reference. > > * Add standalone rv32 test support in tools/testing/selftests/nolibc/ I'm not the right one to judge how to best support rv32 but at least I just don't want to go backwards. I'm just having a probably stupid question, but how relevant is rv32 ? I mean, all the boards I've seen to date were based on rv64 even the smallest embedded ones, so I'm sincerely wondering if there exists at all any rv32 devices capable of running Linux. Because if that's not the case, maybe we should instead declare that we only support rv64 ? If such devices exist however, I'm all for us supporting them well. Thanks, Willy