From patchwork Fri Feb 24 10:36:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tiezhu Yang X-Patchwork-Id: 61248 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp831124wrd; Fri, 24 Feb 2023 02:47:38 -0800 (PST) X-Google-Smtp-Source: AK7set+oUJ5U6q8B2613tyv/rWfuORTD9hd/bCWrqIrDlZWGWes/Jpk3rZcZiIjqkYb3irfGxhVe X-Received: by 2002:a17:902:ebd0:b0:199:1e3b:4f20 with SMTP id p16-20020a170902ebd000b001991e3b4f20mr12422599plg.7.1677235658128; Fri, 24 Feb 2023 02:47:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677235658; cv=none; d=google.com; s=arc-20160816; b=pJZGzdhAsuH5ZGF/Riv8e4XQuPulqVoGCY0Nd32U5GxBHtaf1KQfpNj4aNFHv8LkgR UK36Dddl1mRbuJS+rntwGBTkqTDWLEKwGS8amp0QrmaStH2F2BGyAI3VLTtf5qTdWJCJ 1RwpnaV/UQSB1ZDY8+rMDxzYwN4QjNskjbGPQyse71290apzHDHEPEA/jYBbQaDOM03H a4TWxNWcRG77kia1/bo9OiHkSIIf+Lh1iUoUO+8CnLHjMp1knKfTSNCTiC1cecpYo28G EfV95H7thEdI0y/DUQggt8ov/fahWUHZyD8JIg78v4qNLriEzA19spHzhui8PQuCEnO5 2c1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=aOKznhf/1RzW4SsHDHHfDr5tM2eWJOmkfm10DV4y2wk=; b=mps5dSYU+WO4JOKPf4cb0iCuU2yxd8Erz9uKpEZtw0hKwQvk4pDCDtFfKNEgCrn9Ko JzPLFXmN8ydrttm6eZYG7gZaeaEk9E1iNiLfyphGQZLsBOLQsSMMp7dPvVH/175NNVk+ OETAfQpIEEUC33Uemz4PEs8lzpdssJTMInY12jYfhkTnkh2tPfDJaCJKhiRe7dASTb9P WK0iEilkpZxi3Ks0+q0TTxHGviKuFBJ0hSY1o7oIBwhZvQs6N44I9FZi1Z57gn/tFE4r ykLihHs+j/Zd+pQJCu/ofJpWUYlGSOxZkcCYbYWVNkHtdheeS3W9/+FXsrpzQuMJwbEl hYRQ== 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 c2-20020a170902d90200b001993610cb43si15024594plz.343.2023.02.24.02.47.21; Fri, 24 Feb 2023 02:47:38 -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 S230348AbjBXKio (ORCPT + 99 others); Fri, 24 Feb 2023 05:38:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229641AbjBXKh7 (ORCPT ); Fri, 24 Feb 2023 05:37:59 -0500 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D42A712BE0; Fri, 24 Feb 2023 02:36:58 -0800 (PST) Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8DxUOVJk_hjAqcEAA--.3654S3; Fri, 24 Feb 2023 18:36:57 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8CxQuVHk_hjToM6AA--.5828S3; Fri, 24 Feb 2023 18:36:56 +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 v2 1/3] libbpf: Use struct user_pt_regs to define __PT_REGS_CAST() for LoongArch Date: Fri, 24 Feb 2023 18:36:53 +0800 Message-Id: <1677235015-21717-2-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1677235015-21717-1-git-send-email-yangtiezhu@loongson.cn> References: <1677235015-21717-1-git-send-email-yangtiezhu@loongson.cn> X-CM-TRANSID: AQAAf8CxQuVHk_hjToM6AA--.5828S3 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBjvJXoW7ZF47GFWDKryDWr47tr1UZFb_yoW8Wr17pa 4UC347KayrWw1j9a4kWr4avr4akrZ3Xw4kAFyxWw4ftFWkJ3yrXr129F43Gry3J3yrtw4Y vF93K3W5AF1UWw7anT9S1TB71UUUUUDqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU b7AYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_JrI_Jryl8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVWUCVW8JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwA2z4 x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E14v26r4UJVWxJr1l e2I262IYc4CY6c8Ij28IcVAaY2xG8wAqjxCEc2xF0cIa020Ex4CE44I27wAqx4xG64xvF2 IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_JF0_Jw1lYx0Ex4A2jsIE14v26r4j6F4U McvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCF04k20xvY0x0EwIxGrwCFx2 IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v2 6r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67 AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IY s7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Jr 0_GrUvcSsGvfC2KfnxnUUI43ZEXa7IU8vD73UUUUU== X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758709057409384826?= X-GMAIL-MSGID: =?utf-8?q?1758709057409384826?= LoongArch provides struct user_pt_regs instead of struct pt_regs to userspace, use struct user_pt_regs to define __PT_REGS_CAST() to fix the following build error: CLNG-BPF [test_maps] loop1.bpf.o progs/loop1.c:22:9: error: incomplete definition of type 'struct pt_regs' m = PT_REGS_RC(ctx); ^~~~~~~~~~~~~~~ tools/testing/selftests/bpf/tools/include/bpf/bpf_tracing.h:493:41: note: expanded from macro 'PT_REGS_RC' #define PT_REGS_RC(x) (__PT_REGS_CAST(x)->__PT_RC_REG) ~~~~~~~~~~~~~~~~~^ tools/testing/selftests/bpf/tools/include/bpf/bpf_helper_defs.h:20:8: note: forward declaration of 'struct pt_regs' struct pt_regs; ^ 1 error generated. make: *** [Makefile:572: tools/testing/selftests/bpf/loop1.bpf.o] Error 1 make: Leaving directory 'tools/testing/selftests/bpf' Signed-off-by: Tiezhu Yang --- tools/lib/bpf/bpf_tracing.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/lib/bpf/bpf_tracing.h b/tools/lib/bpf/bpf_tracing.h index 6db88f4..137b13d 100644 --- a/tools/lib/bpf/bpf_tracing.h +++ b/tools/lib/bpf/bpf_tracing.h @@ -415,6 +415,8 @@ struct pt_regs___arm64 { * https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html */ +/* loongarch provides struct user_pt_regs instead of struct pt_regs to userspace */ +#define __PT_REGS_CAST(x) ((const struct user_pt_regs *)(x)) #define __PT_PARM1_REG regs[4] #define __PT_PARM2_REG regs[5] #define __PT_PARM3_REG regs[6] From patchwork Fri Feb 24 10:36:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tiezhu Yang X-Patchwork-Id: 61249 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp831174wrd; Fri, 24 Feb 2023 02:47:46 -0800 (PST) X-Google-Smtp-Source: AK7set8LxlJCh3HlrJ+gffYob2Ow/Z5aFc8h04kk9RzhG4yIEB7bsCmQNqYnFGihfHhWQZV45iqg X-Received: by 2002:a17:907:980e:b0:8ae:ea17:bae4 with SMTP id ji14-20020a170907980e00b008aeea17bae4mr23219111ejc.30.1677235666052; Fri, 24 Feb 2023 02:47:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677235666; cv=none; d=google.com; s=arc-20160816; b=Nd4eOABZgpzwj1Uu5RFPwTWAjQ+rwSmFnVfMsL6HogHLLkdPjqrpIfBu1pljWwdDdw kR8GaocZR0k2mR1fTO3Xmlt2Q4/xfnIeWZboNVdQ+cYzcowJTQzPQ1DF0T03Qj1BTp0J 5oycNHG2NT80lKdOdPatbruINMNGN5yHL2VYbXRvYwh+9Xed4DqDNX5IyUfa/dZmJF/k j3dXistlGBTb1dRvCsMadhbVcxsadyCazlEijuFsp8XAOhpoQgndYGzN7xBR8qslCZRO 8OrNH0tdr0c8iGKwnJ+doZfhDGImK+pfj625nVJNW8IsnY0hAB5WTtn/XDvUcIvJZLsW uqTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=klopg2KIQp/KU52YrAS6NQSkXSwSdHtIvBny5HOaaeI=; b=BwupO6sayQmUUMR6jagdv3N7o60RNONHHMxFE7kgwLTwGtt784+h70+2db2AKQJSn2 iayXEMNWgtFG29HK7kh3n4u5Tr3xGbv6Sz4NMsAxi2CYF5a8tS+VExVg433/U735lH2u jOrlJcUj3zgX3ZRng2Dfj7URosH+4ozcrfE2ATgTiZL5tYF52s8RR+CqcVBFH7WN02RO OoTkYuVsV5+lrOXhq5jhwKsybSaF9kFQ89w5AHzWWLiUXaH3Zxy5TZWEhjmz7FnBRl61 ySuMYP2mvw8WLdVBIi+3svDBLjiKW2uC5cTaDOkFKcSwXC7GHLn/6t9TBcmFMd4FD2IP T1jg== 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 m11-20020a170906598b00b008cfad03e95asi18472714ejs.752.2023.02.24.02.47.22; Fri, 24 Feb 2023 02:47:46 -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 S229977AbjBXKiq (ORCPT + 99 others); Fri, 24 Feb 2023 05:38:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229765AbjBXKiA (ORCPT ); Fri, 24 Feb 2023 05:38:00 -0500 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0EBEC17146; Fri, 24 Feb 2023 02:36:58 -0800 (PST) Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8AxYcxKk_hjBacEAA--.3713S3; Fri, 24 Feb 2023 18:36:58 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8CxQuVHk_hjToM6AA--.5828S4; Fri, 24 Feb 2023 18:36:57 +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 v2 2/3] selftests/bpf: Check __TARGET_ARCH_loongarch if target is bpf for LoongArch Date: Fri, 24 Feb 2023 18:36:54 +0800 Message-Id: <1677235015-21717-3-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1677235015-21717-1-git-send-email-yangtiezhu@loongson.cn> References: <1677235015-21717-1-git-send-email-yangtiezhu@loongson.cn> X-CM-TRANSID: AQAAf8CxQuVHk_hjToM6AA--.5828S4 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBjvJXoW7Aw1UGr45uw45Cw1DCFWfXwb_yoW8Cw4fpF WkCr9FyFWUurWFk3s5JFy09Fy7J3s7tr4UtFWFg34kWFWrJ3W8Gws2krZrCasaga97tFna 9ry7K3y5Wa18Aw7anT9S1TB71UUUUUDqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU b7AYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_JrI_Jryl8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVWUCVW8JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwA2z4 x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E14v26F4UJVW0owAS 0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07AIYIkI8VC2zVCFFI0UMc02F40EFcxC0V AKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUtVWrXwAv7VC2z280aVAFwI0_Gr0_Cr1l Ox8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JMxAIw28IcxkI7VAKI48JMxC20s 026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_ JrI_JrWlx4CE17CEb7AF67AKxVWUAVWUtwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14 v26r1I6r4UMIIF0xvE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4v20xva j40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVW8JV W8JrUvcSsGvfC2KfnxnUUI43ZEXa7IU8QJ57UUUUU== X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758709065682382296?= X-GMAIL-MSGID: =?utf-8?q?1758709065682382296?= 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 Check __TARGET_ARCH_loongarch to include arch specified bitsperlong.h, then __BITS_PER_LONG is 64, __NR_nanosleep can also be defined to fix the following build errors: clang -g -Werror -D__TARGET_ARCH_loongarch ... -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. make: *** [Makefile:572: tools/testing/selftests/bpf/test_vmlinux.bpf.o] Error 1 make: Leaving directory 'tools/testing/selftests/bpf' Signed-off-by: Tiezhu Yang --- tools/include/uapi/asm/bitsperlong.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/include/uapi/asm/bitsperlong.h b/tools/include/uapi/asm/bitsperlong.h index da52065..10b4023 100644 --- a/tools/include/uapi/asm/bitsperlong.h +++ b/tools/include/uapi/asm/bitsperlong.h @@ -17,7 +17,7 @@ #include "../../../arch/riscv/include/uapi/asm/bitsperlong.h" #elif defined(__alpha__) #include "../../../arch/alpha/include/uapi/asm/bitsperlong.h" -#elif defined(__loongarch__) +#elif defined(__loongarch__) || defined(__TARGET_ARCH_loongarch) #include "../../../arch/loongarch/include/uapi/asm/bitsperlong.h" #else #include From patchwork Fri Feb 24 10:36:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tiezhu Yang X-Patchwork-Id: 61250 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp831313wrd; Fri, 24 Feb 2023 02:48:09 -0800 (PST) X-Google-Smtp-Source: AK7set8BOLmGUHI+xXzq9gvgC/v9p3clOl7ULwxPMhx5kXzVlnNv7jFdJa/RJ9ZYS847mcXpudvb X-Received: by 2002:a62:17ce:0:b0:5a8:abd2:2beb with SMTP id 197-20020a6217ce000000b005a8abd22bebmr13128354pfx.30.1677235688707; Fri, 24 Feb 2023 02:48:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677235688; cv=none; d=google.com; s=arc-20160816; b=Re8uB7Hdx7jzjnrWMob2Pv8G2i2olSzvVkHnFyETPUbk65JR3c2sj0gL1N4xKjdKEb oEVEEoen/8QKdMhbfRYGB25UCD8l9AOQNU6TpV7ovTw8PhK/vgFgkjFuYmNBr8jOfZv+ 7ehIqdiMHA5DBG6Be/+5IQ7nQ7XaAg4IrH/dLRGIuaGirVJmyjD6Jjx0VjuIGPpOiHA0 r8tljM39+X225pjRH2Y5AUFAsmFHi2p5vQLJphi8Av6lIi6Mc5GUQf1P6EPmVc6+mk6t 3sHBOE/SxwM8P6XRPH9h1nN2f1ATjZn3wsj5bcNqqXgAdQTIalc/ysw85fSntFP6jsza +Xsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=W+PNTb1nevp2u+b7W8JX+fMB/ozAS/04hPDw+j+XrIU=; b=TTQMOL0bumFdTY2LsbA7Z0LcwJaTixhYzaTWjCQMi/+M/GO/DCm/PZrl6u6dXsawrg l1gHoH6fsYuzc3Jc3de3PeLCoqbIWqfbtkjU7YaAR5Je2f+9uNUwagaYeJdnC6CT2Qwa TJ+PsnRYu85Bdx3HXewGt5mXcfUWlfw0yKKgDTgSzlIGD1qWfduFRtMfYTGFt5ax6q3Y e8tUOXoNiLsrjTzVaMO8uiSrciw86R18bGvDf3/YjylV6Radoxj2g+Z/A0mAROeXvxpW LM1pPGvqWDlr2PR4mOngEXgaCWDBjWHoTQ6QpJsqxVwi61FV4m0cIn722Ww7KFyBcAa2 H5/g== 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 m3-20020a632603000000b00502ed95c56csi7210470pgm.60.2023.02.24.02.47.56; Fri, 24 Feb 2023 02:48:08 -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 S229636AbjBXKiu (ORCPT + 99 others); Fri, 24 Feb 2023 05:38:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230036AbjBXKiC (ORCPT ); Fri, 24 Feb 2023 05:38:02 -0500 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7A0DA2A157; Fri, 24 Feb 2023 02:36:59 -0800 (PST) Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8CxQMxKk_hjCKcEAA--.3585S3; Fri, 24 Feb 2023 18:36:58 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8CxQuVHk_hjToM6AA--.5828S5; Fri, 24 Feb 2023 18:36:58 +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 v2 3/3] selftests/bpf: Use __NR_prlimit64 instead of __NR_getrlimit in user_ringbuf test Date: Fri, 24 Feb 2023 18:36:55 +0800 Message-Id: <1677235015-21717-4-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1677235015-21717-1-git-send-email-yangtiezhu@loongson.cn> References: <1677235015-21717-1-git-send-email-yangtiezhu@loongson.cn> X-CM-TRANSID: AQAAf8CxQuVHk_hjToM6AA--.5828S5 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBjvJXoWxZF4DGry8Jw1kCF18tF1kZrb_yoW5JFWDpa y8G343tF1SyF43Jw18CrWxZFyfJrsrZF4FkF4ktr95Zr1UXas7Xr1xKF4YgrnIgrZaqrsY va4IgF9ruw48AwUanT9S1TB71UUUUUDqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU b7AYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVW8JVW5JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwA2z4 x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E14v26F4UJVW0owAS 0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07AIYIkI8VC2zVCFFI0UMc02F40EFcxC0V AKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUtVWrXwAv7VC2z280aVAFwI0_Gr0_Cr1l Ox8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JMxAIw28IcxkI7VAKI48JMxC20s 026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_ JrI_JrWlx4CE17CEb7AF67AKxVWUAVWUtwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14 v26r1I6r4UMIIF0xvE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4v20xva j40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVW8JV W8JrUvcSsGvfC2KfnxnUUI43ZEXa7IU84xRDUUUUU== X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758709089283939286?= X-GMAIL-MSGID: =?utf-8?q?1758709089283939286?= After commit 80d7da1cac62 ("asm-generic: Drop getrlimit and setrlimit syscalls from default list"), new architectures won't need to include getrlimit and setrlimit, they are superseded with prlimit64. In order to maintain compatibility for the new architectures, such as LoongArch which does not define __NR_getrlimit, it is better to use __NR_prlimit64 instead of __NR_getrlimit in user_ringbuf test to fix the following build error: TEST-OBJ [test_progs] user_ringbuf.test.o tools/testing/selftests/bpf/prog_tests/user_ringbuf.c: In function 'kick_kernel_cb': tools/testing/selftests/bpf/prog_tests/user_ringbuf.c:593:17: error: '__NR_getrlimit' undeclared (first use in this function) 593 | syscall(__NR_getrlimit); | ^~~~~~~~~~~~~~ tools/testing/selftests/bpf/prog_tests/user_ringbuf.c:593:17: note: each undeclared identifier is reported only once for each function it appears in make: *** [Makefile:573: tools/testing/selftests/bpf/user_ringbuf.test.o] Error 1 make: Leaving directory 'tools/testing/selftests/bpf' Signed-off-by: Tiezhu Yang --- tools/testing/selftests/bpf/prog_tests/user_ringbuf.c | 2 +- tools/testing/selftests/bpf/progs/user_ringbuf_success.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c b/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c index 3a13e10..e51721d 100644 --- a/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c +++ b/tools/testing/selftests/bpf/prog_tests/user_ringbuf.c @@ -590,7 +590,7 @@ static void *kick_kernel_cb(void *arg) /* Kick the kernel, causing it to drain the ring buffer and then wake * up the test thread waiting on epoll. */ - syscall(__NR_getrlimit); + syscall(__NR_prlimit64); return NULL; } diff --git a/tools/testing/selftests/bpf/progs/user_ringbuf_success.c b/tools/testing/selftests/bpf/progs/user_ringbuf_success.c index b39093d..0ade111 100644 --- a/tools/testing/selftests/bpf/progs/user_ringbuf_success.c +++ b/tools/testing/selftests/bpf/progs/user_ringbuf_success.c @@ -202,7 +202,7 @@ do_nothing_cb(struct bpf_dynptr *dynptr, void *context) return 0; } -SEC("fentry/" SYS_PREFIX "sys_getrlimit") +SEC("fentry/" SYS_PREFIX "sys_prlimit64") int test_user_ringbuf_epoll(void *ctx) { long num_samples;