Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp1020544rdb; Fri, 20 Oct 2023 06:28:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE4MQgtdkb/dYlYKMHfXcxLlwaKXnEX7sOY9dNf6slvCW+HscrvW9J6mho2MGEl8tcrrbno X-Received: by 2002:a05:6358:2822:b0:14f:6a41:5d14 with SMTP id k34-20020a056358282200b0014f6a415d14mr1708549rwb.27.1697808489588; Fri, 20 Oct 2023 06:28:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697808489; cv=none; d=google.com; s=arc-20160816; b=sEZvNSqeXCuDxzhQXgn8Todo+GCnnVvJRp4Y6w/kvYDpFKDAarbv7/fBAWPde542Xz zXtAjywU2mk59S/7+i38tdMfbaA270cf9vtzeGviQasiFJ42MfI5dRIoo3sA2KJVGndN y+d62OtivZOscT7apMI0iNYiYhDwzNr/nGCAYlPd96SESgmFBlHfvEG3CIuc18TWet1k 1kASCMdjwd39UpziEL4j/D24gmUF41ng5MhCJ4MOTy0GTjnqI7+9USdoe5HifgtuE6N3 x7EvLLqVhzV2oZOoZoM/ez1DxXt0rF06WTrxb8lN9ZK4xa9XiBkC/fGFn2J7HN72Av2R DkQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=akxSPHYUna72W+Vz7vmDLkBGOaax9YoVg0R318g41ks=; fh=jVcMtiN+AjsysWkMraW7RTv3DOXqP7jMbCQfcj1y39k=; b=uRCotvAcsaWZpajPzMpfp630X7GPoPPfsSM/aqyy53u59KJWzAnbAPEYXsz16XiKua viP+UpaxhtcZ8npgF0wY9PLavHys1ONXv+XY47MoC0S2RHCR/Vr2YsXhjV0qRPzNlXo2 VaSIj/N5XU0e9VaYCFjpTsWyf/BuvsM7YOb5eN2CWYg8gcGGKTTZRugG7zmICGBAcD9C xpa6p2RPmcKFUtCeKjRjABPL96BkrlRM3ALSAj2H1NxHPCf4UwW+Xp4dLSfhtFxsJdrD D3EJwJ90sNEjDLjCuPfZW977+3VCJXkUCNd3vi8nliLs7xamP9v3ydxjVQ0LU3y/7hC2 D/TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=knT9wUf+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id j1-20020a056a00130100b006bc2cf9872fsi1904525pfu.317.2023.10.20.06.28.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 06:28:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=knT9wUf+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 2D17E8112446; Fri, 20 Oct 2023 06:28:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377212AbjJTN2A (ORCPT + 99 others); Fri, 20 Oct 2023 09:28:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377002AbjJTN17 (ORCPT ); Fri, 20 Oct 2023 09:27:59 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8358FE8 for ; Fri, 20 Oct 2023 06:27:57 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F5C0C433C7; Fri, 20 Oct 2023 13:27:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697808477; bh=CUPCLoZKlk4Vm8CIWIXYNCFjVcmILxXwZ8VIwc2nQpA=; h=From:To:Cc:Subject:Date:From; b=knT9wUf+n+I6fPtdBxI/pE5B8NoaxmLwCjW4MFDA4RhXjIClZ2NT83fvwzcj6TNcC 8e7WZKf49jBZz1QBSP6ZAhqUocdJum9HcIS8c+D0rBHSrtAL3h0zhH/ugHUZ6gDUKf NhxsCDzl9CANVzEjoe+Ufz83C2eYrdaD6TygJs/weFS16G52SDIutqpUANWRyJidfV RenAWqNjsKcBcjdYKfFTbZ4xaxWAJWPrSaKq3XZyEHwqnOforRXYWJyyuI5hMyU6FW gr2dtfGY47EWnNdQR0ynUfNLhwFcwgy//OXdEfB3rk3FeOzbziG/SKS+U5U20arFUq r8E7p/nd20UXw== From: Arnd Bergmann To: Yonghong Song , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Chuyi Zhou , Tejun Heo Cc: Arnd Bergmann , Martin KaFai Lau , Song Liu , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Oleg Nesterov , bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] bpf: hide cgroup functions for configs without cgroups Date: Fri, 20 Oct 2023 15:27:35 +0200 Message-Id: <20231020132749.1398012-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 20 Oct 2023 06:28:07 -0700 (PDT) From: Arnd Bergmann When cgroups are disabled, the newly added functions don't build: kernel/bpf/task_iter.c: In function 'bpf_iter_css_task_new': kernel/bpf/task_iter.c:917:14: error: 'CSS_TASK_ITER_PROCS' undeclared (first use in this function) 917 | case CSS_TASK_ITER_PROCS | CSS_TASK_ITER_THREADED: | ^~~~~~~~~~~~~~~~~~~ kernel/bpf/task_iter.c:925:60: error: invalid application of 'sizeof' to incomplete type 'struct css_task_iter' 925 | kit->css_it = bpf_mem_alloc(&bpf_global_ma, sizeof(struct css_task_iter)); | ^~~~~~ Hide them in an #ifdef section. Fixes: 9c66dc94b62ae ("bpf: Introduce css_task open-coded iterator kfuncs") Signed-off-by: Arnd Bergmann --- kernel/bpf/task_iter.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/bpf/task_iter.c b/kernel/bpf/task_iter.c index 654601dd6b493..15a184f4f954d 100644 --- a/kernel/bpf/task_iter.c +++ b/kernel/bpf/task_iter.c @@ -904,6 +904,7 @@ __diag_push(); __diag_ignore_all("-Wmissing-prototypes", "Global functions as their definitions will be in vmlinux BTF"); +#ifdef CONFIG_CGROUPS __bpf_kfunc int bpf_iter_css_task_new(struct bpf_iter_css_task *it, struct cgroup_subsys_state *css, unsigned int flags) { @@ -947,6 +948,7 @@ __bpf_kfunc void bpf_iter_css_task_destroy(struct bpf_iter_css_task *it) css_task_iter_end(kit->css_it); bpf_mem_free(&bpf_global_ma, kit->css_it); } +#endif __diag_pop(); -- 2.39.2