Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp6029356pxb; Mon, 14 Feb 2022 13:30:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJwWZJx86qgjbnPexrL5PTczn004lm/K4yKpsSVHgIb3osem+JQ9XUAl71eZGVA7CJNz/USW X-Received: by 2002:a17:90b:291:b0:1b9:3cb7:41ad with SMTP id az17-20020a17090b029100b001b93cb741admr805977pjb.16.1644874242205; Mon, 14 Feb 2022 13:30:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644874242; cv=none; d=google.com; s=arc-20160816; b=0wFopIiMU/3yWyEnO88x+eIs3hklKvExTcN95YQEZgHeTKSsGyXxw+VkeRmaZp3mN+ ubS0UMlBG3H6zpyIERK8RE7bpQtnh1LTg0AT/iB3uFSjDCf3Gkqx6xXamr90zkEMUxDF Hy3uzdbboxOQ90zNxRLliJkNevgBl/qkJHDQpVUnDuNHbCg89y2+DoVCCrxummSUqo98 8f+Bbv0STbykzUv8WlX622vdXpAIjgtMdCAHNol10/L41XPszGCScQRiTOhhrNtVv3Ta rpVcK03NOx/PFKUuMPhUtePnffBNWDoab8GooxjqiVKtj0LLDIhmd0n9IEgaz8BQz0ve 1mZg== 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=HDLiuYUP5DHdmjW4f062r2zlI41NFhxRv09UtgBUw+M=; b=infDWQyddmc3clpqy8tqH2J98LVqFg3ErLYv7PyPAg4CX6K4o++XcV8NwvhgFb4Gfx /H/WsfdeUym4d/QDaMGTE8nilPNZdCRNKzC0rgtmc2Y7y8a/37VxaGKtxRqDB0RoLbe5 5JTfW0wHvjjslGoTaC3yymyAkNLmLxGp6FRjiP2JWMacX6BBkDFxoSbyk8sxkvkF1jx0 7r82HvY/5d/1XIx6lervU2jgGcNR3N/rTh8lyRrhFDppLOm9R272MBhtMIeVLLOKujai KwdWbeQtpd98okdG3h+TLzcgSAtFEdf7yxyjYXd0TG5oqRU8BgqJK9GgEIrUVHf7ovhd FcXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=QnBu1cdZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id b1si11756172pje.2.2022.02.14.13.30.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 13:30:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=QnBu1cdZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 018B816BCD2; Mon, 14 Feb 2022 12:50:37 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229773AbiBNUtr (ORCPT + 99 others); Mon, 14 Feb 2022 15:49:47 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:35424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229614AbiBNUtp (ORCPT ); Mon, 14 Feb 2022 15:49:45 -0500 Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com [IPv6:2607:f8b0:4864:20::82f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59E7215FC87 for ; Mon, 14 Feb 2022 12:49:29 -0800 (PST) Received: by mail-qt1-x82f.google.com with SMTP id o3so16589538qtm.12 for ; Mon, 14 Feb 2022 12:49:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=HDLiuYUP5DHdmjW4f062r2zlI41NFhxRv09UtgBUw+M=; b=QnBu1cdZSNMZMwTUOhTAgwrDV0UDotuXjd+L9tGoRib5LiAOViseQ3Shth3I3/9cUX F9FE9WP/n9IXs5G/YdanGCNFX3mwzenNKyGas7OHzij+neOt+7N0L8gulZksssphH0JK ZdAH701JpydqzO4zSQ63RxEFI/i6gMAqnIMJnBkw252CYXQsB0CmiD9JEAKRqabXkDss C24cvW5+nsV74dkDMeh0PKiv6q73XtCwF3kNhQmHGY7iVbEX5fIf1tLZZzQ/qHEwjapy YPS22mz/ReXGyT+0yl9O+kILA0cSXtpXCAn5q4MdtEBUg/J2KAwutMzm1ZQ8iCW+2Fdu 29yQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HDLiuYUP5DHdmjW4f062r2zlI41NFhxRv09UtgBUw+M=; b=xUQ0smfRzCFJjqbxTxCsyblRW+6aoNqzyEUsCm/j6LRfcE5qqnp3TxHyL62Kn0JHqr ee+ZFz3SzDs3/ubM9KEDk3L1zmja0WJVceYMIPjdLO43jY8yoOuU87NMNVyjxrBtuj3i StqlateR6rf4zSeSGwYfChac5MEPc/iirnTI9dRrBwiitOlX8U7vtCsltLMPBrj40RmT nNwnLQj+a+ydehV/QqWndsGJzOFgJrU9W6fhQUQ6kkP5kKfD8NEsdpEB6M0i4InlKe+A kPbdW+KceWWVJJExfrYTBN52qgnq1dy4UA2LwwX3X1CyGWmc3/MnW7re/shicSXbhpTg KEAw== X-Gm-Message-State: AOAM532P/Aqab6ZDNslkH3dDQUZrVecgyWfGd8A2g2VYjmD+6S08Xs9b ANhTnmkS+f5aTq/6mJSMXCx3XQC6v39IYKktVJtdPYzvv7zS2w== X-Received: by 2002:a05:620a:470a:: with SMTP id bs10mr392145qkb.583.1644871152704; Mon, 14 Feb 2022 12:39:12 -0800 (PST) MIME-Version: 1.0 References: <20220201205534.1962784-1-haoluo@google.com> <20220201205534.1962784-6-haoluo@google.com> <20220203180414.blk6ou3ccmod2qck@ast-mbp.dhcp.thefacebook.com> In-Reply-To: From: Hao Luo Date: Mon, 14 Feb 2022 12:39:01 -0800 Message-ID: Subject: Re: [PATCH RFC bpf-next v2 5/5] selftests/bpf: test for pinning for cgroup_view link To: Alexei Starovoitov Cc: Alexei Starovoitov , Andrii Nakryiko , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , Shakeel Butt , Joe Burton , Stanislav Fomichev , bpf , LKML Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no 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, Feb 14, 2022 at 12:28 PM Alexei Starovoitov wrote: > > On Mon, Feb 14, 2022 at 12:23 PM Hao Luo wrote: > > > > On Mon, Feb 14, 2022 at 11:25 AM Alexei Starovoitov > > wrote: > > > > > > On Mon, Feb 14, 2022 at 10:29 AM Hao Luo wrote: > > > > Hi Alexei, > > > > > > > > Actually, I found this almost worked, except that the tracepoints > > > > cgroup_mkdir and cgroup_rmdir are not sleepable. They are inside a > > > > spinlock's critical section with irq off. I guess one solution is to > > > > offload the sleepable part of the bpf prog into a thread context. We > > > > may create a dedicated kernel thread or use workqueue for this. Do you > > > > have any advice? > > > > > > Are you referring to spin_lock in TRACE_CGROUP_PATH > > > that protects global trace_cgroup_path[] buffer? > > > > Yes, that's the spin_lock I am talking about. > > > > > That is fixable. > > > Do you actually need the string path returned by cgroup_path() in bpf prog? > > > Maybe prog can call cgroup_path() by itself when necessary. > > > Parsing strings isn't great anyway. The bpf prog probably needs the last > > > part of the dir only. So cgrp->kn->name would do it? > > > The TRACE_CGROUP_PATH wasn't designed to be turned on 24/7. > > > That global spin_lock is not great for production use. > > > No need to delegate sleepable bpf to thread context. > > > Let's refactor that tracepoint a bit. > > > > No, we don't need cgroup_path(). We are going to name the directories > > by cgrp->kn->id. I can add a fast version for cgroup_xxx tracepoints, > > which don't require the full path and can be turned on 24/7. > > Sounds good. We need a flag for tracepoints anyway to indicate > which ones are sleepable. > Probably similar to what we did for DEFINE_EVENT_WRITABLE. No problem. I'll take a look at it. Thanks!