From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCC69C43334 for ; Tue, 7 Jun 2022 12:12:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231748AbiFGMMn (ORCPT ); Tue, 7 Jun 2022 08:12:43 -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) Precedence: bulk List-ID: X-Mailing-List: bpf@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