Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2718925rwb; Mon, 19 Sep 2022 09:00:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6GOtlS/1CiOmZJ8oc1fd/bg7Ht83S+0ZdmL96EvLqbV6HVjD1GgRnpVpzdk+Zl4yDdKLd1 X-Received: by 2002:a17:90a:4cc7:b0:202:d328:66e0 with SMTP id k65-20020a17090a4cc700b00202d32866e0mr20261284pjh.196.1663603250550; Mon, 19 Sep 2022 09:00:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663603250; cv=none; d=google.com; s=arc-20160816; b=GSsLQ4g+xgK2xZbeEdfmrpIRADJV+2IvZ1cS7ZE9+I/BZoqw7X0yY1EnJc6y1FiX+G Cq+xzY2GM6s0ljDzGxsgVQBb/w2xOnh5W2E449VkTyJylWvTG1S1mT3ndwpqA4qgxA1s KSqky7Cx3mEo//tGeqTsk8kMEf0InmIUJDVECBNQDdMFn2gVYTrY9E9WUCgLi/OansT6 Q4IzNCvgDVMuV3UOIZxMn3kh9hUj3lR2Pw7BW+vYw4+IXqGp182ygGpoIQshfxH4QBjp xF9yNr7WnJzsUDuyi9H0bUYOzEUKjbI2XMlCCV8Lbneuw1PJD9ngz09vXf2Fnk/Cl9RN afmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=n45E9SMZgH+mX1PWjYiZMymKuV6YbCkP9GERockComU=; b=JqLDLiW09Bu4MICV9w4FQ+jfUiiUWgLj0raaTYaa24Rh+UhrlasCIpMk/mwkaKCAHq soZd6y8JHeL7czipuwF+nZfs8KXrLbeSlQo76DeuWrPqkuPDiYBnVJzZp9iUMIXkqSVX kV5Jxgr8bHP10ybh/PEstvtRfpJDI+RS3HSJSq9ZK1IArvGEkxYaTqcvuPFyjmfcxty3 2k8aYpyoBCcqroarkQJkDLfIbuGNX4jKqx45Fp0hE2fcwTE2MIHDCuCP+MjR50uQUhz5 JaCi5PV21QNCjQYEWVfWOoIvbftIt9ImebWsp2wxHc2fZVZO4lvCuxZNXBty9BHg2ASo UI+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=dNQHSDyQ; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d20-20020a63f254000000b00439753fbcf7si59794pgk.362.2022.09.19.09.00.38; Mon, 19 Sep 2022 09:00:50 -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=@google.com header.s=20210112 header.b=dNQHSDyQ; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229709AbiISPZ7 (ORCPT + 99 others); Mon, 19 Sep 2022 11:25:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229663AbiISPZd (ORCPT ); Mon, 19 Sep 2022 11:25:33 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88AE238692 for ; Mon, 19 Sep 2022 08:25:16 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id n10so17496822wrw.12 for ; Mon, 19 Sep 2022 08:25:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=n45E9SMZgH+mX1PWjYiZMymKuV6YbCkP9GERockComU=; b=dNQHSDyQ6K4k42wEqk+38fCzWID6a69lv0oPocPWguYAS6aIJMpef0hvGXvvNYWV4i mQdb48nMtIZvfL025qkNpYsITe82S6tqb3WAFEQSJy5cX3e9b5yb77psLPh8AYySCgoH CFCjoK0Mr7CtakzujfzCNpibES7Y00oOc4hH6KMCeNkomKqsc0pJVWJ/bHy6mgoE8B1L U/y/nnC9ZY3wOLmLFZVkhEtniaDFUKyeJUvJA3mhmmAItupbH83QsXSeGR8oXQqyaK9K ZlJYvBEGrc6gqchld+92Fv9EtuJY4UrKlyF6ZMLMcUb8NlOFwjWVUpPRESekg6kbm7ku LPJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=n45E9SMZgH+mX1PWjYiZMymKuV6YbCkP9GERockComU=; b=FME7SgBN0LixGm370P9JJqF4XkqrTtdkZKnF5myzrx1bBh8wP8fEMWsEIHKTzsnCyb SsmDLcsvjJjKnYhbTYcwMddNpWtVGRj20ZbKHM4cQbZk4yfUuvvKZLKxjTlWsIdyHXPq XkNBxvzHpkJvntte+chzZu1nkFLv8MNFgEqe/fpErX6EebFiukY4Yv3c8bWnfOri1yg/ vqj1mqI1MggNM+7v04n+lRyZzALe5jglSsRWz6Y7RE5ziBT286r3bdbC5gcJIx7sEZ+i TbveCi6dF3NKeFzThVMx88OXRN3LfLWhg9gwafOHG+Fczce0TziGkkObl38Fv1IemC5y i7mQ== X-Gm-Message-State: ACrzQf3hDNJZ2maKoiYcuQy5oPASmEUfMmRpaO2gkojkEmzbvh29pRTq 5MsfyHyV8R7WxRIVBcvCghsXQBOYCu13n/HW9g3scw== X-Received: by 2002:a5d:64e8:0:b0:22a:bbb0:fa with SMTP id g8-20020a5d64e8000000b0022abbb000famr11506842wri.372.1663601114664; Mon, 19 Sep 2022 08:25:14 -0700 (PDT) MIME-Version: 1.0 References: <20220826230639.1249436-1-yosryahmed@google.com> In-Reply-To: From: Yosry Ahmed Date: Mon, 19 Sep 2022 08:24:38 -0700 Message-ID: Subject: Re: [PATCH] selftests/bpf: simplify cgroup_hierarchical_stats selftest To: Andrii Nakryiko Cc: Hao Luo , Andrii Nakryiko , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Mykola Lysenko , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Jiri Olsa , bpf , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 Fri, Sep 9, 2022 at 5:50 PM Andrii Nakryiko wrote: > > On Tue, Sep 6, 2022 at 2:35 PM Yosry Ahmed wrote: > > > > On Mon, Aug 29, 2022 at 6:50 PM Yosry Ahmed wrote: > > > > > > On Mon, Aug 29, 2022 at 6:42 PM Hao Luo wrote: > > > > > > > > On Mon, Aug 29, 2022 at 6:07 PM Yosry Ahmed wrote: > > > > > > > > > > On Mon, Aug 29, 2022 at 3:15 PM Yosry Ahmed wrote: > > > > > > > > > > > > On Mon, Aug 29, 2022 at 1:08 PM Hao Luo wrote: > > > > > > > > > > > > > > On Fri, Aug 26, 2022 at 4:06 PM Yosry Ahmed wrote: > > > > > > > > > > > > [...] > > > > > > > > > > > > > > > > -SEC("tp_btf/mm_vmscan_memcg_reclaim_begin") > > > > > > > > -int BPF_PROG(vmscan_start, int order, gfp_t gfp_flags) > > > > > > > > +SEC("fentry/cgroup_attach_task") > > > > > > > > > > > > > > Can we select an attachpoint that is more stable? It seems > > > > > > > 'cgroup_attach_task' is an internal helper function in cgroup, and its > > > > > > > signature can change. I'd prefer using those commonly used tracepoints > > > > > > > and EXPORT'ed functions. IMHO their interfaces are more stable. > > > > > > > > > > > > > > > > > > > Will try to find a more stable attach point. Thanks! > > > > > > > > > > Hey Hao, > > > > > > > > > > I couldn't find any suitable stable attach points under kernel/cgroup. > > > > > Most tracepoints are created using TRACE_CGROUP_PATH which only > > > > > invokes the tracepoint if the trace event is enabled, which I assume > > > > > is not something we can rely on. Otherwise, there is only > > > > > > > > Can we explicitly enable the cgroup_attach_task event, just for this > > > > test? If it's not easy, I am fine with using fentry. > > > > > > I see a couple of tests that read from /sys/kernel/debug/tracing, but > > > they are mostly reading event ids, I don't see any tests enabling or > > > disabling a tracing event, so I am not sure if that's an accepted > > > pattern. Also I am not sure if we can rely on tracefs being in that > > > path. Andrii, is this considered acceptable? > > > > > > > Anyone with thoughts here? Is it acceptable to explicitly enable a > > trace event in a BPF selftest to attach to a tracepoint that is only > > invoked if the trace event is enabled (e.g. cgroup_attach_task) ? > > Otherwise the test program would attach to the fentry of an internal > > function, which is more vulnerable to being changed and breaking the > > test (until someone updates the test with the new signature). > > > > IMO it's fine to use fentry. If something changes about signature, > we'll detect it soon enough and adjust selftests. > > Messing with global tracefs in selftests is less desirable. It will > also potentially force tests to be sequential. > Undestood. Thanks Andrii. Will send v2 with other comments from KP and Hao. > > > > > > > > > trace_cgroup_setup_root() and trace_cgroup_destroy_root() which are > > > > > irrelevant here. A lot of EXPORT'ed functions are not called in the > > > > > kernel, or cannot be invoked from userspace (the test) in a > > > > > straightforward way. Even if they did, future changes to such code > > > > > paths can also change in the future, so I don't think there is really > > > > > a way to guarantee that future changes don't break the test. > > > > > > > > > > Let me know what you think. > > > > >