Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1245153rwb; Fri, 18 Nov 2022 15:17:13 -0800 (PST) X-Google-Smtp-Source: AA0mqf5PPpXgz+jD5l/1LBImXbeEy23eFhVJ+Za3pzM6ccLepQ3NO8nQPxJ57GuCCWGYngzqyhVV X-Received: by 2002:a17:906:692:b0:7ad:49b8:1687 with SMTP id u18-20020a170906069200b007ad49b81687mr7828833ejb.407.1668813433734; Fri, 18 Nov 2022 15:17:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668813433; cv=none; d=google.com; s=arc-20160816; b=hcVYPy6F7CBhMUHBhAfiUHGZoPCwUeCc2lVOcOkixlRn9Xp9qgpAtJt5ZEzrbOcgbx V5crSxyqpQXCtkiu69Lq1DDOxvlMGR/GxeFpoEjP2mlHsPZlJpdBkt8fKrGY3t4TouZN xx/Yz0rtvQA6VVcJDvqicZ3nYfV9m5d2h8yZduHpe1DzLUDA+3QuvvOW/W+2hKy7NxBk lghn52tLeJeF5XX/OXkwegg1PGFvkIUtSwPrt12dGgL/XO9BQ8ijU0o8Tjq4Jc74k07H DTEpghpDr4b52dPTkXAzW97ELMGY0X7Nl30tpoI1Ifj68u0fZYzb0h8anTWo//ftKAAt +yAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=HFVWdC+T/UIsFgCP3n3/u+LjcvhM8TalRWcVXzf64zI=; b=tU80+Y4kBeyySenrVtMLVrFsxiWoYBkbuxEeS2Kzx3w0sF5vz5X8AqluY2t8K7XgT2 UwOKZ+yXv8Kyz5fbJ3JbAkumIbNyY/LxRjHEkiwgsZ7d8ZogIc3pS7PgfyXmTAtSWxhz hW+tyDciXLsgaaaE64lbMdKOwBWvo0PViaRO8aE9kseIm1b7rlrZclPntEUfLg90o0fI 9Nn4deacegynMz+XDfTGV7ENBzgi7O3PwA80PB6e+hvSmIiwjHbyXyZZ3xtcfoYM7f5Y DH/yHzJ+I+aq1NoT2Y9SXRcnC5Y+RO7NN1c+oapocW6zhbaNsqLQjQ29gim7anAivqSZ /a5w== 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 dn8-20020a17090794c800b0078db6f488c2si4435163ejc.56.2022.11.18.15.16.51; Fri, 18 Nov 2022 15:17:13 -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 S231864AbiKRW3o (ORCPT + 91 others); Fri, 18 Nov 2022 17:29:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231955AbiKRW3f (ORCPT ); Fri, 18 Nov 2022 17:29:35 -0500 Received: from www62.your-server.de (www62.your-server.de [213.133.104.62]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83A779B381; Fri, 18 Nov 2022 14:29:26 -0800 (PST) Received: from sslproxy05.your-server.de ([78.46.172.2]) by www62.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ow9rD-00005O-Bk; Fri, 18 Nov 2022 23:29:11 +0100 Received: from [85.1.206.226] (helo=linux.home) by sslproxy05.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ow9rC-0006lq-R5; Fri, 18 Nov 2022 23:29:10 +0100 Subject: Re: [PATCH] samples/bpf: Fix duplicate struct define in test_lru_dist sample To: Liao Chang , ast@kernel.org, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org References: <20221118004752.97759-1-liaochang1@huawei.com> From: Daniel Borkmann Message-ID: <109e3d8a-26c6-44c8-aabe-04d5c47ec9c8@iogearbox.net> Date: Fri, 18 Nov 2022 23:29:07 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20221118004752.97759-1-liaochang1@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.103.7/26724/Fri Nov 18 09:51:03 2022) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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 On 11/18/22 1:47 AM, Liao Chang wrote: > Build sample/bpf report error as follow: > > CC ./samples/bpf/test_lru_dist > ./samples/bpf/test_lru_dist.c:35:8: error: redefinition of ‘struct list_head’ > 35 | struct list_head { > | ^~~~~~~~~ > In file included from ./samples/bpf/test_lru_dist.c:6: > ./tools/include/linux/types.h:84:8: note: originally defined here > 84 | struct list_head { > > Remove the duplicate definition of struct list_head in test_lru_dist.c > > Signed-off-by: Liao Chang > --- > samples/bpf/test_lru_dist.c | 4 ---- > 1 file changed, 4 deletions(-) > > diff --git a/samples/bpf/test_lru_dist.c b/samples/bpf/test_lru_dist.c > index 5efb91763d65..2e7341044090 100644 > --- a/samples/bpf/test_lru_dist.c > +++ b/samples/bpf/test_lru_dist.c > @@ -32,10 +32,6 @@ static int nr_cpus; > static unsigned long long *dist_keys; > static unsigned int dist_key_counts; > > -struct list_head { > - struct list_head *next, *prev; > -}; > - This will actually break it, see CI: https://github.com/kernel-patches/bpf/actions/runs/3500019006/jobs/5862316961 [...] CLANG-bpf /tmp/work/bpf/bpf/samples/bpf/lathist_kern.o CLANG-bpf /tmp/work/bpf/bpf/samples/bpf/offwaketime_kern.o CLANG-bpf /tmp/work/bpf/bpf/samples/bpf/spintest_kern.o /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:35:42: warning: ‘struct list_head’ declared inside parameter list will not be visible outside of this definition or declaration 35 | static inline void INIT_LIST_HEAD(struct list_head *list) | ^~~~~~~~~ /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c: In function ‘INIT_LIST_HEAD’: /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:37:6: error: dereferencing pointer to incomplete type ‘struct list_head’ 37 | list->next = list; | ^~ /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c: At top level: /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:41:43: warning: ‘struct list_head’ declared inside parameter list will not be visible outside of this definition or declaration 41 | static inline int list_empty(const struct list_head *head) | ^~~~~~~~~ /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c: In function ‘list_empty’: /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:43:13: error: dereferencing pointer to incomplete type ‘const struct list_head’ 43 | return head->next == head; | ^~ /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c: At top level: /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:46:38: warning: ‘struct list_head’ declared inside parameter list will not be visible outside of this definition or declaration 46 | static inline void __list_add(struct list_head *new, | ^~~~~~~~~ /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c: In function ‘__list_add’: /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:50:6: error: dereferencing pointer to incomplete type ‘struct list_head’ 50 | next->prev = new; | ^~ /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c: At top level: /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:56:36: warning: ‘struct list_head’ declared inside parameter list will not be visible outside of this definition or declaration 56 | static inline void list_add(struct list_head *new, struct list_head *head) | ^~~~~~~~~ /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c: In function ‘list_add’: /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:58:28: error: dereferencing pointer to incomplete type ‘struct list_head’ 58 | __list_add(new, head, head->next); CLANG-bpf /tmp/work/bpf/bpf/samples/bpf/map_perf_test_kern.o | ^~ /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:58:13: warning: passing argument 1 of ‘__list_add’ from incompatible pointer type [-Wincompatible-pointer-types] 58 | __list_add(new, head, head->next); | ^~~ | | | struct list_head * /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:46:49: note: expected ‘struct list_head *’ but argument is of type ‘struct list_head *’ 46 | static inline void __list_add(struct list_head *new, | ~~~~~~~~~~~~~~~~~~^~~ /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:58:18: warning: passing argument 2 of ‘__list_add’ from incompatible pointer type [-Wincompatible-pointer-types] 58 | __list_add(new, head, head->next); | ^~~~ | | | struct list_head * /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:47:28: note: expected ‘struct list_head *’ but argument is of type ‘struct list_head *’ 47 | struct list_head *prev, | ~~~~~~~~~~~~~~~~~~^~~~ /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c: At top level: /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:61:38: warning: ‘struct list_head’ declared inside parameter list will not be visible outside of this definition or declaration 61 | static inline void __list_del(struct list_head *prev, struct list_head *next) | ^~~~~~~~~ /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c: In function ‘__list_del’: /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:63:6: error: dereferencing pointer to incomplete type ‘struct list_head’ 63 | next->prev = prev; | ^~ /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c: At top level: /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:67:44: warning: ‘struct list_head’ declared inside parameter list will not be visible outside of this definition or declaration 67 | static inline void __list_del_entry(struct list_head *entry) | ^~~~~~~~~ /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c: In function ‘__list_del_entry’: /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:69:18: error: dereferencing pointer to incomplete type ‘struct list_head’ 69 | __list_del(entry->prev, entry->next); | ^~ /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c: At top level: /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:72:37: warning: ‘struct list_head’ declared inside parameter list will not be visible outside of this definition or declaration 72 | static inline void list_move(struct list_head *list, struct list_head *head) | ^~~~~~~~~ /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c: In function ‘list_move’: /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:74:19: warning: passing argument 1 of ‘__list_del_entry’ from incompatible pointer type [-Wincompatible-pointer-types] 74 | __list_del_entry(list); | ^~~~ | | | struct list_head * /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:67:55: note: expected ‘struct list_head *’ but argument is of type ‘struct list_head *’ 67 | static inline void __list_del_entry(struct list_head *entry) | ~~~~~~~~~~~~~~~~~~^~~~~ /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:75:11: warning: passing argument 1 of ‘list_add’ from incompatible pointer type [-Wincompatible-pointer-types] 75 | list_add(list, head); | ^~~~ | | | struct list_head * /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:56:47: note: expected ‘struct list_head *’ but argument is of type ‘struct list_head *’ 56 | static inline void list_add(struct list_head *new, struct list_head *head) | ~~~~~~~~~~~~~~~~~~^~~ /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:75:17: warning: passing argument 2 of ‘list_add’ from incompatible pointer type [-Wincompatible-pointer-types] 75 | list_add(list, head); | ^~~~ | | | struct list_head * /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:56:70: note: expected ‘struct list_head *’ but argument is of type ‘struct list_head *’ 56 | static inline void list_add(struct list_head *new, struct list_head *head) | ~~~~~~~~~~~~~~~~~~^~~~ /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c: At top level: /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:85:19: error: field ‘list’ has incomplete type 85 | struct list_head list; | ^~~~ /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:90:19: error: field ‘list’ has incomplete type 90 | struct list_head list; | ^~~~ CLANG-bpf /tmp/work/bpf/bpf/samples/bpf/test_overhead_tp_kern.o make[3]: *** [/tmp/work/bpf/bpf/samples/bpf/Makefile.target:58: /tmp/work/bpf/bpf/samples/bpf/test_lru_dist] Error 1 make[3]: *** Waiting for unfinished jobs.... LD /tmp/work/bpf/bpf/samples/bpf/bpftool/bootstrap/libbpf/staticobjs/libbpf-in.o LINK /tmp/work/bpf/bpf/samples/bpf/bpftool/bootstrap/libbpf/libbpf.a CC /tmp/work/bpf/bpf/samples/bpf/bpftool/bootstrap/main.o CC /tmp/work/bpf/bpf/samples/bpf/bpftool/bootstrap/common.o CC /tmp/work/bpf/bpf/samples/bpf/bpftool/bootstrap/json_writer.o CC /tmp/work/bpf/bpf/samples/bpf/bpftool/bootstrap/gen.o CC /tmp/work/bpf/bpf/samples/bpf/bpftool/bootstrap/btf.o CC /tmp/work/bpf/bpf/samples/bpf/bpftool/bootstrap/xlated_dumper.o CC /tmp/work/bpf/bpf/samples/bpf/bpftool/bootstrap/btf_dumper.o CC /tmp/work/bpf/bpf/samples/bpf/bpftool/bootstrap/disasm.o LINK /tmp/work/bpf/bpf/samples/bpf/bpftool/bootstrap/bpftool make[2]: *** [/tmp/work/bpf/bpf/Makefile:1992: /tmp/work/bpf/bpf/samples/bpf] Error 2 make[2]: Leaving directory '/tmp/work/bpf/bpf/kbuild-output' make[1]: *** [Makefile:231: __sub-make] Error 2 make[1]: Leaving directory '/tmp/work/bpf/bpf' make: *** [Makefile:269: all] Error 2 make: Leaving directory '/tmp/work/bpf/bpf/samples/bpf' Error: Process completed with exit code 2.