Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4893317rwb; Tue, 6 Sep 2022 14:42:10 -0700 (PDT) X-Google-Smtp-Source: AA6agR7L9G7vl09CEbCthPqefFnF7QDLPFB8A4P9TZBF0qXABT0CmYxu79LJhBrvNxPA/j6vMlGU X-Received: by 2002:a17:907:c0d:b0:730:a85d:8300 with SMTP id ga13-20020a1709070c0d00b00730a85d8300mr321171ejc.558.1662500530060; Tue, 06 Sep 2022 14:42:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662500530; cv=none; d=google.com; s=arc-20160816; b=bv+Bgx/JnMP7+wVqxoHVo3oB7W4ZH/rSYdlrgHCIhdB91KYxpzOpc+s1roVSh4Ty9q TBb02S2C9/20wVtFX/DOJ/bsF6k6EOLwy7Qajr075NEF6WMyRVbucAlBgtr0SrNBoFnp y3FCtlJRIDpC5WGdlEpkKDT/CPmbsZWqclAdKn9RPlMqnWEUc/F82caHWyxyAGkjmo3q 7l0bBN4oWw0WTgRSOjIoSz0zuHkdANBCcDqd58lLkvbvgBMEG/wmFQ0zvmD/ZaDu0Oq9 EpxhAjvwdof+l2+JHR60iUaMgrpSn6WEY3rr5dbKzgBwXnWwkfs3bvWPTy6kTsVqs30y QY2w== 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=sR4MT10eKHhIVG2U6bD+uIMSzEVSnVDpJcLJ+SBSU/s=; b=MC009XSR3B4mLo7S1CjzxiLYSBVuqKcgHZwZpWv71nn1PCfZcO9MEeWShywnQqZp+G Thm2TdbJRGk30GuusZYQ4fGbOw5IWJS6D6/weY7veMPeNO80sd0NSBLT/AfoPtrG5h0i hRxxCqj72hXgmr5RXajB0/O4+ztTgRkkLZ6AwnRiJHagmtv2/oBwV55oc5MOLp4DTyYQ K8Uz7dC389u5+Qiv1pcx7QT9oMUdaoIBcLpUEuPiG+vf+X8j3C28Oa6DkGVtxopYF8OL Ip4Yu3aTZVy01uA8sqbHLGFdOytzG/bPp++iZCewcVuUpsaL4QYBgd5PUuacZHLK3dsn NVrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=cxvtWAjB; 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 q25-20020a056402033900b0044ee4dbcd3bsi1617589edw.229.2022.09.06.14.41.44; Tue, 06 Sep 2022 14:42:10 -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=cxvtWAjB; 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 S229724AbiIFVf4 (ORCPT + 99 others); Tue, 6 Sep 2022 17:35:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229511AbiIFVfy (ORCPT ); Tue, 6 Sep 2022 17:35:54 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09E949E0FA for ; Tue, 6 Sep 2022 14:35:53 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id h204-20020a1c21d5000000b003a5b467c3abso10439156wmh.5 for ; Tue, 06 Sep 2022 14:35:52 -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=sR4MT10eKHhIVG2U6bD+uIMSzEVSnVDpJcLJ+SBSU/s=; b=cxvtWAjBYoEpUJxSiWS7AfLsCwWfpK9imxeDR5nZIU4ZjuYzLiAFHS0+9TzGEeojwQ mWIG427aEoJvB6gsed1m7r4hK7snMG+QKCME1m2v3wBIncorbHbPcEPVvEtJ/3VRdXP+ QJJy7gT0s7piwIcKO7SGxr8TJJpEwFwDaQLv66iclbQaRsjgT2mkhOKrhjVD0QE9ZSyb YYTRrktm6/WG2mvL3CtFmF+0JzFAwT2GZP0kEeysbF4u90L5GIwES8KzvTEt84EhdoHu gNXtGIGoY0XT4UXgnwNRy1blbH52lZSoBol+rjZJR2r+EXzuOs2LvRQc26To5kkCqeED 9asw== 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=sR4MT10eKHhIVG2U6bD+uIMSzEVSnVDpJcLJ+SBSU/s=; b=wMX1MN1bkDuC3QI3fzjKKCKCpIFk7ea2wGE0jtVG5Tr5KeWbPgyDLSQ+H+9/7LsaK5 KWj1jea+2P2xjqpcMzWnMaFKiBjiXT42IF2UksevmkEOX2gQb6zVf290kwmMUHz5DY/D MULs/OWBOLqx2PET4sGllnwYinJkfkN4DLFaiN11ZCC6G5imXZ8SYBifRnG0vbcxr4R2 GBsPRDneDh44WqlaOvhWzhJ/MyjWJMjB8ivMstzv6VSRkf+MfMqcywxRCoZ1iCBoiy9D eo3gf8eypypuslUdy17ysZiJEhoL9aLdluTJPJRhst8JN2feGk+MMFjiiMtJTEI4ntT1 v7yg== X-Gm-Message-State: ACgBeo3uyLwEgnTpnRrkFXcO2JevS+9haTp5/zxni0PI6sOVWdeLcQYa wQzg5nDovE2FUDL08XysUiO2TFkH7T4QniO4UDzkVw== X-Received: by 2002:a1c:3b04:0:b0:3a5:487c:6240 with SMTP id i4-20020a1c3b04000000b003a5487c6240mr14808609wma.152.1662500151465; Tue, 06 Sep 2022 14:35:51 -0700 (PDT) MIME-Version: 1.0 References: <20220826230639.1249436-1-yosryahmed@google.com> In-Reply-To: From: Yosry Ahmed Date: Tue, 6 Sep 2022 14:35:15 -0700 Message-ID: Subject: Re: [PATCH] selftests/bpf: simplify cgroup_hierarchical_stats selftest To: Hao Luo Cc: 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, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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, 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). > > > > > 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. > > >