Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp6006312pxb; Mon, 14 Feb 2022 12:59:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJyVldcG9yE7hclgZGSptf/wxkos5xYEuthPnM/OkyrsW6ZpG+JJ09e+fkvrAu6ucaYd/J93 X-Received: by 2002:a63:b709:: with SMTP id t9mr763929pgf.248.1644872361130; Mon, 14 Feb 2022 12:59:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644872361; cv=none; d=google.com; s=arc-20160816; b=yG1UG91zXsfd+bPj8PVR5iIy+W+qNr4X19NAqspwGutYID1Y2Lc8nPfTkNhk1gOBY3 vPK2ZsTPDs7UwDR7tfkn0+dErGFmSJnyneiXjP2ztAIXA5BGMU3/S3IEmiG8jeVXsIVf xR6xjrQ4GnEfdDfbdgJEEl4P1OeCif7EG5Suobqbps4/S8CcaGEb6VzJPVLdgkyLzGRF xtRh4ZslBAEY9DL9TL5yoEmZJXCqecvNWFYAQwHCU/TyFEuCTHtrcyZBN13nZ99E117H ysJlg3IVYSlG3LutaUBhybWHEX4FhnsNiSpchR/8VJIT++xX1idRd6ls51e0UyQk33Rx uN8Q== 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=ttJu1XMf1+hA+hrMQ5r00OCzrFkN94Y4YW3j0uNrxV8=; b=gyjXOAtWHHbQ/A1+4wNFeMDPFpNc8NqWxQNVSlEyEdmCj92zY8znHMEC4KBSlPggYO OpisnZo3U/+/JNs8QdiV33gn9bNJSO/5cZWXdvfhmPs3ADp3eetRUL4M+dXJS47MTmKA b+zszPiGNLo40U2LjjcMr3ZOrNeCRcW/YS1H6T7ju5rchELmTM7bIqOduMMsRhthO+eS uL7fXLXa6+b8uKnMje0zXkosKCo7HX1XwOxxxPrHS+/mvwD42l6MREepkPCzFNLM+YAF T5MZiyVRC7gp/CBzjPmb6KNOAfHsEiKiOigwwTXIDfHO2UKFYO2GWBYoHwg3r+HaQrXl 1qbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=hr+TWd2Y; 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 n5si1154921plk.9.2022.02.14.12.59.05; Mon, 14 Feb 2022 12:59:21 -0800 (PST) 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=hr+TWd2Y; 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 S229978AbiBNU5z (ORCPT + 99 others); Mon, 14 Feb 2022 15:57:55 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229977AbiBNU5e (ORCPT ); Mon, 14 Feb 2022 15:57:34 -0500 Received: from mail-qt1-x835.google.com (mail-qt1-x835.google.com [IPv6:2607:f8b0:4864:20::835]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5332613911C for ; Mon, 14 Feb 2022 12:56:58 -0800 (PST) Received: by mail-qt1-x835.google.com with SMTP id k25so16635806qtp.4 for ; Mon, 14 Feb 2022 12:56:58 -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=ttJu1XMf1+hA+hrMQ5r00OCzrFkN94Y4YW3j0uNrxV8=; b=hr+TWd2YTvC14HH5KLVZE3+GCtF6eZvPPD6LASFw0DJGN9OgAZCjUR6WUWoVS69jSW clj8d86ROskMUqHEaPm3XQjwNDI3Rr91p0vT6W0xRLCGwXHAY5SxD8AhF0A+UC8ij/FT T4V46FpPWiYlBh/9OAZ9eRf1HztNX/WDBM+3w20JzYCZwoJg4+lKUstn2oxwFrSPl2me r2ey1rlgdh7vjxGQWvXEcfmKQ5Uehd0ZreduPnbsGVgzpRJCfFd3cQGyKLTpBc+ZbeAe Y545Xujo2QmmXI2Vz11AC8b39o3tVQJm4fRyt6gRfbxMzl8itRY34+gs5GuK4KjA7Sg9 SDvg== 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=ttJu1XMf1+hA+hrMQ5r00OCzrFkN94Y4YW3j0uNrxV8=; b=H8xQmxwll9THLuEwoSdanjdG0S5f89WWKhVsMwSwYZTHM85FAghWjWyqsqhmwtga3S fI294tjrN3kJz8gQqCMXWz4+fGOID9WRHpjw3ygHu8kgJe2iAOSJShdt4/cj73CgQdl1 d2Mpi1aDm0mBAG2JjfeA/rBP3yb2GIOyCRQYronQTW2jnyL8Ar3Q7IwV02iRuQjg17Wd lneqQi4aMJHubL0pU5bTsv05B46QRgKdu8qjo0TgBPxeorPzq3bCa0sbibL9U5PflWJ9 ge0PuQNbq7XBTUOYdSSMq7yJT6eUAIqfkp3rEpFKSnfHtk0BqO1/5h5peQI0MgvDtjhD ysrA== X-Gm-Message-State: AOAM530atCOLJFoq566wmYPeMsLBk/3hdfqaYxdhWCWRfvstrSmqChHV A6uosk+YyiK+QkeiiFVthB3KSX9pgDT+OKDPuWAolmUI6Tg= X-Received: by 2002:ae9:ed96:: with SMTP id c144mr370649qkg.221.1644870221334; Mon, 14 Feb 2022 12:23:41 -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:23:29 -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=-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, 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.