Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp782572rwo; Wed, 2 Aug 2023 04:15:25 -0700 (PDT) X-Google-Smtp-Source: APBJJlGQE8u0n4B/wfnvmn/lTNIRqd6WmcwdXIMQdQOnHiE4AAvDdd7YQpGNWjq6odez6deolM4O X-Received: by 2002:a17:90a:c205:b0:263:f776:8ba3 with SMTP id e5-20020a17090ac20500b00263f7768ba3mr13784009pjt.9.1690974924819; Wed, 02 Aug 2023 04:15:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690974924; cv=none; d=google.com; s=arc-20160816; b=epHlu7PHg3An0vKeeyqg0w7j96mV8ZB3xlCc84hJTWRj88qGwckiJ9yklU1Xew6GeC Qm6X3IiE2p8MOmA43X/+NcDDC0qd3VdhpdowCa16gr4RbgAn5voIhayEuqRTjE9qTDT7 q6C3qXUodzDCqnOEYxubjAtkyL/PFm+4CJjzJ0sh/1VopvCbSyR4cnttIy3iUqQ2Cu+I bRrUUzRPjBWMUBo18nJfuPFnJTD1lI4Ue5UQ3aJJYyQIAdwigKA7l519yZerQ6TArqec WdjeFpd+qKlM2FLS+UphWCOYLREsKhczAotxD4SzJHjGO2QuPiJAJq7roH6I1OKDV17g RRyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=4tCvqd85l7W/GoDibqAPyHLclUTFQXRD1gjPx8JJqFI=; fh=pi3Um36+fyuzBYjFMS/SX7OfICV7kDLHJHVcPR8n/2g=; b=NA0nI88XsD/iwxFFb4Ao6PrVzSsOnAWN8GyHyDXdbL58pS+j68EFT1zeAStFgXDOkt crxT+Um7Nw4e1qM9hDZdvcKfSiBs/qhiPrahnlrn6ut+8tHqTNm68nShwA283DGetpwJ EhHb8gu8Pfbg23+70qVlfiBoQu4o79IS8Yn9c2XeJP+Lj8SBoDFcLApMKtrzCTkRzvf2 qMJEO/Ci6l3u15TtTe/+pPnB2FutyzlSR/HUgZy1VcZshXUZgjeVOiW8QaVqyQ+YuBTx 9VqVqN/Qbe6kaVzdgclYYg/psxo++zk42TNZ2phFjmJZjU157POeW760mU5yyw8bfUsx y+MQ== 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 i2-20020a170902eb4200b001b87b17cfb4si8355154pli.392.2023.08.02.04.15.11; Wed, 02 Aug 2023 04:15:24 -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 S233940AbjHBKhQ (ORCPT + 99 others); Wed, 2 Aug 2023 06:37:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232708AbjHBKgL (ORCPT ); Wed, 2 Aug 2023 06:36:11 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.65.254]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1012E2D64; Wed, 2 Aug 2023 03:32:30 -0700 (PDT) X-QQ-mid: bizesmtp89t1690972338tkfrlw04 Received: from linux-lab-host.localdomain ( [116.30.131.233]) by bizesmtp.qq.com (ESMTP) with id ; Wed, 02 Aug 2023 18:32:17 +0800 (CST) X-QQ-SSF: 01200000000000E0X000000A0000000 X-QQ-FEAT: eSZ1CZgv+JBSYUJc7PFD3G6N17p6paGv1a8aco23EMsfHnoT1E30MoVGwBr4e QByHSsMbsLfPXEa+zRsmuRLbW2szMS4Hxre6acEx6Mjvio7Iqdq0AEWqfBvw1MZZL6ahf8U GLag5lZNVf1gcmDTa2VzXgpHIUlNXBe9XANo7MkoAYEYBbeXobgukJLqCMTgtLcroRSQ1c7 rx0gP72pNkJ7FVMzKPyRFbDBZOt53RnWROigIiHHiglToR5AQI94rMMusfOc70Q7qpadhCW oEqNp1FVsqPQdEFbXBAkKQ6+PpQCxC/6imYhHr0urWr62Lg0yxvVBQOzBAkSCJBzqJkqYlc RdMArs8snvh5dwDiMDTftzxSKwkgdPTToB18f9li4AZ3s/foevBk9D4rUKY+s7Dt01qhZOx X-QQ-GoodBg: 0 X-BIZMAIL-ID: 6677180004816281553 From: Zhangjin Wu To: w@1wt.eu Cc: arnd@arndb.de, falcon@tinylab.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux@weissschuh.net, thomas@t-8ch.de Subject: Re: [PATCH v4 08/12] selftests/nolibc: add test support for ppc Date: Wed, 2 Aug 2023 18:32:17 +0800 Message-Id: <20230802103217.231036-1-falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no 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, Willy, Hi Thomas Good news for us ;-) > Hi Zhangjin, > > On Wed, Aug 02, 2023 at 01:21:50PM +0800, Zhangjin Wu wrote: > > Hi, Willy, Thomas > > > > Yuan is helping me to test this series and the tinyconfig series with > > the latest compilers. > > > > His first test found this ppc support failed with stackprotector when > > using a newer compiler (I used an older compiler without stackprotector > > for ppc), I'm debugging it, so, please ignore this revision too, of > > course, if time allows, welcome to take a look at the other patches. > > > > His other tests are trying to find out the exact poweroff support > > options for every architecture one by one, let's fill this gap ... > > Thanks for notifying us. I strongly suggest that you leave ppc32 aside > for now, until the rest is completely validated and merged. It turns Thanks very much, but good progress here ;-) I compared some compilers and at last got the root cause of the ppc32 failure with stackprotector. //// gcc 13.1.0 from mirrors.edge.kernel.org $ make run-user XARCH=ppc -j4 CC=/labs/linux-lab/prebuilt/toolchains/ppc64le/gcc-13.1.0-nolibc/powerpc64-linux/bin/powerpc64-linux-gcc ... Segmentation fault (core dumped) 0 test(s): 0 passed, 0 skipped, 0 failed => status: success See all results in /labs/linux-lab/src/linux-stable/tools/testing/selftests/nolibc/run.out //// gcc 10 from ubuntu ppa $ make run-user XARCH=ppc -j4 CC=/usr/bin/powerpc-linux-gnu-gcc-10 ... 165 test(s): 157 passed, 8 skipped, 0 failed => status: warning See all results in /labs/linux-lab/src/linux-stable/tools/testing/selftests/nolibc/run.out $ grep stack run.out 0 -fstackprotector [OK] And then compared the assemblies, found gcc 13.1.0 insert a bad instruction at the beginning of _start() and break our stack eventually. start: stwu 1,-16(1) Further compared the preprocessed files, found the root cause is the new compiler using 'no_stack_protector' instead of '__optimize__("-fno-stack-protector")'. And the attribute 'no_stack_protector' breaks our "omit-frame-pointer" like the failure with '-O0' we fixed before. I checked some of the other architectures, they didn't have the same issue, but test shows the 'no_stack_protector' attribute does have such compability issue here. I learned the commit message of tools/include/nolibc/compiler.h, seems __optimize__("-fno-stack-protector") is enough for all of the nolibc supported architectures? is it ok for us to simply give up 'no_stack_protector' eventully? otherwise, we should manually disable 'no_stack_protector' for ppc32: #define __no_stack_protector __attribute__((__optimize__("-fno-stack-protector"))) Benefit from the __no_stack_protetor macro, we have no need to input __optimize__("-fno-stack-protector") for every new architecture, it may be the time to only use __optimize__("-fno-stack-protector"), am I missing something? > out that your willingness to work around some of the oddities met on > this one have resulted in a lot of drift away from the "keep it simple" > principle and significantly delayed the possibilities to integrate the > rest of your work. It would be much saner to only focus on ppc64/ppc64le > and figure later how to make ppc32 work (or decide not to support it if > it's not worth the effort in the end). Another test shows, the run target of ppc64le with the big endian gcc 13.1.0 toolchain has test startup failure (although we have verified run-user before, run-user ok! and run with local powerpc64le toolchain ok too!), I'm debugging this now, hope it not cost too much. Another good news is, Yuan has found a working defconfig for ppc32 which has poweroff support and he is helping me narrowing down the exact options, this will eventually make us happy ;-) Thanks & Best regards, Zhangjin > > Regards, > willy