From patchwork Tue Feb 28 12:03:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tiezhu Yang X-Patchwork-Id: 62468 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2972585wrd; Tue, 28 Feb 2023 04:07:34 -0800 (PST) X-Google-Smtp-Source: AK7set+E3EwQaSGKd3Gj8RbHhjPP+0rW6BAGq/3sU5kv1lYM6uqlRCMIr63ppAKQfXuXmnCKUENd X-Received: by 2002:a05:6a20:b560:b0:c7:34af:65ac with SMTP id ev32-20020a056a20b56000b000c734af65acmr2980782pzb.14.1677586053829; Tue, 28 Feb 2023 04:07:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677586053; cv=none; d=google.com; s=arc-20160816; b=DOM3Hz7ebF9pqWJzlaBvvBcgSGiko23atEyhf7Tp1z0sbDYlyMACTEyg20O70KHWQd S7IrQroDmma/7GxnCroiZUPKpfOfFsre+mFn+GDPKlK3crIl+UyIySLd7J83w9RzZpNF up4XcGJbdrJjm/1WKXhbwtZO2jR+Vglxr1U2C2FPaiohmymLQt4z3POzpS4Jy0cE5WbG TJw6FgQ4tyWqz0zyq9rfpQmzi5rXuMzCzQT1ByRxbehd34eeZOoi7vAyRemJyz4+C5t1 LOfk7wM0OOnTFxvWYmR87tlDVS3GD6aHii3j4EHno6ljCgGOdzGXtEG4Z7FLax9/ipEw K1CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=zFQvW5q65gtPUIq4xeh4mScJ/MOnUQSOFmkHREWJnLY=; b=djwz84b8Z6N8ep9mWYBZRtqLK5Qnie2OUl0Gt4NeeCiYZ5J2FZ2fOeqo91np07q3JG GgHoeq+6MO+6mSZRQmhrgKLPgNwTIbXCcqdAarU+7rlvTCgEOdx6BcZTiLlP6jc9b7XR MUZHfzoG2jt+7atjsRCuo5aPoqAAGd/xFPMakKyswZfzhdZ05teixruXoGCNbVgh9BV5 MlXKNANxHGipfEkrXqjBbwK6yvMRNAQdZ3qdoBnFXPbOyY7dlyk6bFG87+sumEG3YXFR iTU6puzc9JVnfb084V9TOH5ylDCcjsxN+aC3jkWWyHTKwmZ+kSkvEPhYzpxov490gobF ClWA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f20-20020a63dc54000000b004fbffa7d046si8064745pgj.864.2023.02.28.04.07.21; Tue, 28 Feb 2023 04:07:33 -0800 (PST) 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 S231388AbjB1MDI (ORCPT + 99 others); Tue, 28 Feb 2023 07:03:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231197AbjB1MDG (ORCPT ); Tue, 28 Feb 2023 07:03:06 -0500 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0B290B44A; Tue, 28 Feb 2023 04:03:03 -0800 (PST) Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8AxYeV27f1jVXUGAA--.6664S3; Tue, 28 Feb 2023 20:03:02 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Cxnb517f1jiuVAAA--.55379S2; Tue, 28 Feb 2023 20:03:02 +0800 (CST) From: Tiezhu Yang To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH bpf-next v3] selftests/bpf: Set __BITS_PER_LONG if target is bpf for LoongArch Date: Tue, 28 Feb 2023 20:03:01 +0800 Message-Id: <1677585781-21628-1-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 X-CM-TRANSID: AQAAf8Cxnb517f1jiuVAAA--.55379S2 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBjvJXoW7Aw1UGr13KF48ArWrJF47urg_yoW8uFWDpF yrC342kFW0gFW3Kwn7Ar4j9F1ftwn5Kr4UAFsIg34vqFs8J34xJws7GFykXFnIgrWSkFn8 Z3W3Kay3ua18CwUanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU b78YFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_JrI_Jryl8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVWUJVWUCwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwA2z4 x0Y4vEx4A2jsIE14v26F4UJVW0owA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_GcCE3s1le2I2 62IYc4CY6c8Ij28IcVAaY2xG8wAqjxCEc2xF0cIa020Ex4CE44I27wAqx4xG64xvF2IEw4 CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_JrI_JrylYx0Ex4A2jsIE14v26r1j6r4UMcvj eVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCF04k20xvY0x0EwIxGrwCFx2IqxV CFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r10 6r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxV WUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG 6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Jr0_Gr UvcSsGvfC2KfnxnUUI43ZEXa7IU1EksDUUUUU== X-Spam-Status: No, score=1.4 required=5.0 tests=BAYES_00,RCVD_IN_SBL_CSS, SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759076474081293984?= X-GMAIL-MSGID: =?utf-8?q?1759076474081293984?= If target is bpf, there is no __loongarch__ definition, __BITS_PER_LONG defaults to 32, __NR_nanosleep is not defined: #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32 #define __NR_nanosleep 101 __SC_3264(__NR_nanosleep, sys_nanosleep_time32, sys_nanosleep) #endif Work around this problem, by explicitly setting __BITS_PER_LONG to __loongarch_grlen which is defined by compiler as 64 for LA64, then __NR_nanosleep can also be defined to fix the following build errors: clang -g -Werror ... -target bpf -c progs/test_vmlinux.c ... progs/test_vmlinux.c:24:18: error: use of undeclared identifier '__NR_nanosleep' if (args->id != __NR_nanosleep) ^ progs/test_vmlinux.c:42:12: error: use of undeclared identifier '__NR_nanosleep' if (id != __NR_nanosleep) ^ progs/test_vmlinux.c:60:12: error: use of undeclared identifier '__NR_nanosleep' if (id != __NR_nanosleep) ^ 3 errors generated. This is similar with commit 36e70b9b06bf ("selftests, bpf: Fix broken riscv build"). Signed-off-by: Tiezhu Yang --- tools/testing/selftests/bpf/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile index b677dcd..f40606a 100644 --- a/tools/testing/selftests/bpf/Makefile +++ b/tools/testing/selftests/bpf/Makefile @@ -338,7 +338,8 @@ $(RESOLVE_BTFIDS): $(HOST_BPFOBJ) | $(HOST_BUILD_DIR)/resolve_btfids \ define get_sys_includes $(shell $(1) $(2) -v -E - &1 \ | sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }') \ -$(shell $(1) $(2) -dM -E -