Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp6025904pxb; Mon, 14 Feb 2022 13:24:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJz/2U6Z2J4FHZVXsK0sRH+KEysb5qvd38IJfJwza4WNxfwgrQxS/NTFlwbBDXUDeXk21aFz X-Received: by 2002:a05:6a00:885:: with SMTP id q5mr882226pfj.6.1644873886909; Mon, 14 Feb 2022 13:24:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644873886; cv=none; d=google.com; s=arc-20160816; b=OKaZtUp53cTivzY8rqb+HBH3RlPK/tQHtX5bPtduyooz67MY7zFNUXIn3Z3q9o3MNv sqNCjCW2SQ4cME6F947xwhL+0oVJ/NGXYLoepP5hvAUfC9k1NbU+fzbMXppxFj9Zmv3j KFcu9S6mUbbs8byFwcK8HED2s+97DMVGEPB5W6Hl9kgJYMrhgE9tmLA8GzBjFYTMBBY/ aJWirFEZX2S3G1IxQvIAz9KaGwliNMkZeBOq3MRUvo252ni07fB3GlMDPEJmqrucuTwY aP1XQXP8m/Rag8rEIm2p5fg0oLWTlA8ZxLGxp6RYYHphAMDLEZsbovD/Xn5a2x1qsVn+ g0HA== 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=p+qaLj5PeJFZmiJ725JeU6P2tttdbBuvpV2cQ0sO28w=; b=ZvrlYeHEoDAQHEbVzMBmVE9Nc6FiP3i9AT9R5lG9hshBk2m2TTlpBignTCN0sXjpAT Ey9qrr5VkXwPxNMVM+W0Ubt97ZErBKFdQLQHoAes38ltYiHPWF3bAQYz6rKig4ZUX5tB AnhNXBwZ6Ttvvzfyk049OCKbiRjGuvxiSMkk8vgZ3oeRDHIdNws9RgMUyu+k2s2v9PbZ oLK2k9XoxoKxx476omQ9JqqXJr9QxY+0et+j9vw3ybnUQ7v7jpivtls35JArxXbX21YZ rI3t9B1G6AuPshmguGHYvtGtGDdGwaZfyO5A2lt0W27HlIYyuxEywCo2oCJOL+Noha6k F75w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=HRaK5XDj; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id nn13si1894181pjb.132.2022.02.14.13.24.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 13:24:46 -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=@gmail.com header.s=20210112 header.b=HRaK5XDj; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 57B8D1B8595; Mon, 14 Feb 2022 12:41:37 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229731AbiBNUHd (ORCPT + 99 others); Mon, 14 Feb 2022 15:07:33 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:55130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229770AbiBNUHc (ORCPT ); Mon, 14 Feb 2022 15:07:32 -0500 Received: from mail-oi1-f178.google.com (mail-oi1-f178.google.com [209.85.167.178]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25DB111ACE3; Mon, 14 Feb 2022 12:07:17 -0800 (PST) Received: by mail-oi1-f178.google.com with SMTP id r27so18618073oiw.4; Mon, 14 Feb 2022 12:07:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=p+qaLj5PeJFZmiJ725JeU6P2tttdbBuvpV2cQ0sO28w=; b=HRaK5XDjfwgK07M+uIki6Hy3scx/ZNV3tSk5ugGAPnaWNgB1kcaO4X5LjC3AK3dGSB /2YubVyCCs/QL8epvMOPDGhWDbdMAPZRegrNiwGo1aYBItCy+AbIzPD5+X9y92kTK9xN mwzpDadGRImpO0OTvp64bqEr50T08Ms2LXw9vA1dVxjDVkcPhGh8Aw6y5ehK7cctyz4I C+pEL+ScxlB4v6ZHkr7gMiGNxnppf68osRxiZVX0WMcXJPh6EitaScsXW4N12nYey9E+ /S73g9BaZhk9yZp17a1Q3Halqi4DT4U+dlEaTu/GP6zgv+3mgnFqaKlNBK2IArBSt6hv YpRQ== 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=p+qaLj5PeJFZmiJ725JeU6P2tttdbBuvpV2cQ0sO28w=; b=2WtE20FljNJ7CCJIbycs3S+HKd4WKEmtepg68y3WC5wwhDGevjiePi1a8D2pcNqCAv xQfNCrnmVTeshw93Hi747zzk6yS9Wtv8A0lxyyPiijI6cP8iu1qCe50q3xitJNZ3fzsT JcTl5509nZBXYmvz38hFcfrFVz/SQvVt8HgAFKbolgRbhcX2zsDRz1tbXw/q1VvrhQNI UfCVzuFM4OiNmgheZXYh94WqUWO9WvCZQTg1qSg5FVenqGqqbYbfKshGnLxfPrg6/aZB KNEH6y1qLfvHO/WDA6ms0qyouAtNHaQjq3ne+JFvSdlbSBAm6s9bzEmYdrqETugDSeC2 C4LA== X-Gm-Message-State: AOAM533qFcZ81W6XTMTH3dx5RkHDgSrJ2prLWN1Oe4Vv7g5IiHWzh9sD k7lDWocmkpk6cCMCwhSadsnp+hkwvhVHGI+/Dcb6qL/cHOA= X-Received: by 2002:a17:90b:1d84:b0:1b4:dc8e:2cc2 with SMTP id pf4-20020a17090b1d8400b001b4dc8e2cc2mr192125pjb.122.1644866701752; Mon, 14 Feb 2022 11:25:01 -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: Alexei Starovoitov Date: Mon, 14 Feb 2022 11:24:50 -0800 Message-ID: Subject: Re: [PATCH RFC bpf-next v2 5/5] selftests/bpf: test for pinning for cgroup_view link To: Hao Luo 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=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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 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? 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.