Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp1797798iof; Tue, 7 Jun 2022 11:31:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2M3ZtPJWaJThI8kg7WRxCtXeom37eUcMFXrIyhgKqCB5K29xb7y3hFLAisa+uHjdiMy7l X-Received: by 2002:a17:907:7f06:b0:6fe:b81f:f885 with SMTP id qf6-20020a1709077f0600b006feb81ff885mr28062167ejc.621.1654626532761; Tue, 07 Jun 2022 11:28:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654626532; cv=none; d=google.com; s=arc-20160816; b=H6D5SvuvQ3hNkz4ny74cSVERyDfzG/Y3H4V3SOFlf46VT1xPgk3JavFBeushcjM+Ad Dx0nAKQ/k7CYpP5qJHH8XITNY7SFRvGeogYeY9O9rfM1rNNkBb9Yb5cCJGnc6ytnOu3p YNtUSSKiKzqICQAt/fGYGKPVpaw5a1ym3N9vFdrer54ZkV8tDRX6inm1SOSfHsuTZaZi QfeIfQbcyVZ/+bZvJX9kHQ3zu8MOrLC5IB7xrZZz0e/zvilw8yLpgnn6DKhUBSXV1JI2 7p28So2MeYsvKOFrTATNedj1FYN2ctMq7u0wTOLoaqR3+cEtLXQRmKAoGwhKjcm0yOfg sYoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=u5DKSdr4Gj2oo6TtyI9YrO3jghnkl94Qx+e8RKCbCpw=; b=hyOwwLstsK2JrQlJkOCmQ6pDnKAMJXdTWWb3PzSfBI6j5o/PGL9S9t4I0UWxm4qDEU DG72k6IZ/iJyf0T3QlFXHyh8OwfD6ZSGrKqOQux4O85t+X6F8RxFvUjg4bJO9GOcKtYn p3VJzKQyQLE/IJ2kXA3ZkcxWv/rDU9Z/y7WAdQUtyVzNbO9ev7G2W9g0nm0ltA3Vp9Ht ZOnpnJv7ZYxPFYSHvWN+AVNBr90qdCUK6PVkK4nv0EIChFrF43uYPIqCdHDV1FTledT8 9YsXTNvo/fKyxbeRpHczM17dxd+Mgqwh2KCTWCpgZU4KSNv4oFw/BrJSrnQioNhAib+G U4ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=GAqhOXDy; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sd33-20020a1709076e2100b006fea11891c6si12768738ejc.748.2022.06.07.11.28.25; Tue, 07 Jun 2022 11:28:52 -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; dkim=pass header.i=@suse.com header.s=susede1 header.b=GAqhOXDy; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243427AbiFGMMo (ORCPT + 99 others); Tue, 7 Jun 2022 08:12:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233558AbiFGMMm (ORCPT ); Tue, 7 Jun 2022 08:12:42 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8DB1377F0; Tue, 7 Jun 2022 05:12:40 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id A4E341F964; Tue, 7 Jun 2022 12:12:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1654603959; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=u5DKSdr4Gj2oo6TtyI9YrO3jghnkl94Qx+e8RKCbCpw=; b=GAqhOXDyliufamObMsP/nMztpzHEfqALmosSEVPYqW/eoQJNEGyE+zheWED8UGnAl7Uji/ ucSOe+6SxcekvCd9cczcsAJ7hrTy7eXKiGcN4paEvai1jJ29vAW5PWpN/QbOjkcyYjCy4O e6KLGgG5uIhGUHFEFRGLl93o+O2ase0= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 324EC13638; Tue, 7 Jun 2022 12:12:39 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 6pdhC7dAn2I/AgAAMHmgww (envelope-from ); Tue, 07 Jun 2022 12:12:39 +0000 Date: Tue, 7 Jun 2022 14:12:37 +0200 From: Michal =?iso-8859-1?Q?Koutn=FD?= To: Yosry Ahmed Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Hao Luo , Tejun Heo , Zefan Li , Johannes Weiner , Shuah Khan , Roman Gushchin , Michal Hocko , Stanislav Fomichev , David Rientjes , Greg Thelen , Shakeel Butt , Linux Kernel Mailing List , Networking , bpf , Cgroups Subject: Re: [PATCH bpf-next v1 5/5] bpf: add a selftest for cgroup hierarchical stats collection Message-ID: <20220607121237.GC31717@blackbody.suse.cz> References: <20220520012133.1217211-1-yosryahmed@google.com> <20220520012133.1217211-6-yosryahmed@google.com> <20220603162339.GA25043@blackbody.suse.cz> <20220606123222.GA4377@blackbody.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Mon, Jun 06, 2022 at 12:41:06PM -0700, Yosry Ahmed wrote: > I don't know if there is a standard way to handle this, but I think > you should know the configs of your kernel when you are loading a bpf > program? Isn't this one of purposes of BTF? (I don't know, I'm genuinely asking.) > If the CONFIG_CGROUPS=1 but CONFIG_MEMCG=0 I think everything will > work normally except that task_memcg() will always return NULL so no > stats will be collected, which makes sense. I was not able to track down what is the include chain to tools/testing/selftests/bpf/progs/cgroup_vmscan.c, i.e. how is the enum value memory_cgrp_id defined. (A custom kernel module build requires target kernel's header files, I could understand that compiling a BPF program requires them likewise and that's how this could work. Although, it goes against my undestanding of the CO-RE principle.) > There will be some overhead to running bpf programs that will always > do nothing, but I would argue that it's the userspace's fault here for > loading bpf programs on a non-compatible kernel. Yeah, running an empty program is non-issue in my eyes, I was rather considering whether the program uses proper offsets. Michal