Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1615835pxm; Thu, 3 Mar 2022 23:27:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJykDerb73mng287svPSMvrIu4W9Fl+LMItbeixbSJrzXVmN206Jv5hNZu7Dm8W2w6OD+ECi X-Received: by 2002:a17:907:3a13:b0:6cf:1186:1381 with SMTP id fb19-20020a1709073a1300b006cf11861381mr29400892ejc.539.1646378836538; Thu, 03 Mar 2022 23:27:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646378836; cv=none; d=google.com; s=arc-20160816; b=QLHp9SWXMYw1PgmslSbUUZ+2j5eKkZT74rLt1RjocoUVZdXmtAWfwKuVtmHgNKbQpB bOJpQm6s84G3p8DhGB5k+NyKeiDKlLQyX2HDJaYdGyvviXHYlVDD0BLCwYghIiCrIagY AniwAZLbmxEUhXR3/If8F7Tpy//iSaA9hCI0bPpt0h/OE+SXhRNWg3JxNAIeyC99gX5A Hb+e1Swy59Jm5iTkOmnr/sz5QzF5nFHx1M6+pYpiahwWnPlEFGP/P2eT7z7OcRV1Pfqy 9KIojlQAYEDOXQeHpmBa6MXBL8ZLZcL2RRcWCGGrL8Iy1pMyEuxYTMPAXsQIvDHLbpbr dddA== 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=5k2k3A0LFYi9Jncq52kJ2NzCsXNzhgHinqc0TjcoM9A=; b=1DETASMuEvmaFICAD48oT+uEl7rBZZQQuEvlPzRe3IYcuyqxyOyJPfQFrJV3CAcDDd 0meO9+Gmpwb3x00P+0H0MAeUkpNf6B12GRoFX6/cLeYNKFPUEVdcxx1cMB46nHrCel3N Biux/M9q0Me6X6HR1QCkKtnlZQ/yTzs7XI/5oGzuDgsErGiQUHhx/ykjRNsMlIhN8uPU /M2eR+U+/ukzenFsortCMYXtq/m2qofeCJpjf55jbTmR62YYynHkkCsRX+lXlRYcJbxw HNGFa0DJtnQPUozbIzPFG3cHIk+uzYvfEfeiIxX5jcJ7eGyZPTwNXnHUKtrjQBISp3Ho 4m0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=XoFbx+xF; 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 v3-20020a170906564300b006cfd3c68c61si2593804ejr.662.2022.03.03.23.26.49; Thu, 03 Mar 2022 23:27:16 -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=XoFbx+xF; 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 S236733AbiCCWHH (ORCPT + 99 others); Thu, 3 Mar 2022 17:07:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236728AbiCCWHB (ORCPT ); Thu, 3 Mar 2022 17:07:01 -0500 Received: from mail-qv1-xf31.google.com (mail-qv1-xf31.google.com [IPv6:2607:f8b0:4864:20::f31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E17231680A2 for ; Thu, 3 Mar 2022 14:06:14 -0800 (PST) Received: by mail-qv1-xf31.google.com with SMTP id e22so5247269qvf.9 for ; Thu, 03 Mar 2022 14:06:14 -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=5k2k3A0LFYi9Jncq52kJ2NzCsXNzhgHinqc0TjcoM9A=; b=XoFbx+xFqBZMAy0LhdIpfAc04plEW2Krcu218bvLJZDQk9+Me3gpAYFsU/afdsjmKE mJ3UWBiS6LzY4zTl22WNy3jkXTC+aRUJULXIc8M5JLH9x6zrM7T+asA8NvLrqdsH8JXC tvtOXzBS0KErfSA4fHqAo4UbP0vT+rsKMVLgOtR1E544FdXnryqzbFfQGMcb8QU6s551 S+aLQJTzEphGvhDxZgHkbLTPzB1NStBqRxnu+gSwhMCFSNmGd5gxv00fu1JFpXhOCF0U 4ihN0y3yK5MTnEa6PmcxZh+WVbue6uewFcqBzc3OX16t+3LsLetq1ufTEUuegghZjZbs eCmA== 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=5k2k3A0LFYi9Jncq52kJ2NzCsXNzhgHinqc0TjcoM9A=; b=grKp1tg1Rl6CTqeU8KvUVpdznadp6WnT/KYjxselQaeL/Llb/TQbyWaluAYOq6e1If dFcfPiX2xh8ITOxhDGN3pYHmcOgMuxTCujomz8khGSYvXNTQmaaWNvfTwfsozEiFfVgA sfHbSYFeio4ALYx1ZruJb26JvNoXySHSTybfzJbru+F/zAzBCatSBsZLvybTbc7IkkAF cd2cyy+0dPFmNcm/K1B+bU7NPsbkRTBaJE4uJsHQLXxCfPdYm9RfpkIgpoLGtPHsdMxY uKjyrhxfY9FK+/NCH4PwF8yVJzyUPSCUqF84mA59JKKt+8aN9nO4tMa4K7Vz1E6Z/HY5 Fipw== X-Gm-Message-State: AOAM530zzFjuELlsvFgDr92rg2NPydEZTuRkSiz32ZlqHemQLeyYNuVo X8O7K2GPfixumtQ/v3d2+UKRoUWPz1oTHlpNsY5BCg== X-Received: by 2002:a05:6214:1881:b0:432:5b6c:2add with SMTP id cx1-20020a056214188100b004325b6c2addmr25621693qvb.17.1646345173863; Thu, 03 Mar 2022 14:06:13 -0800 (PST) MIME-Version: 1.0 References: <20220225234339.2386398-1-haoluo@google.com> <20220225234339.2386398-5-haoluo@google.com> <93c3fc30-ad38-96fa-cf8e-20e55b267a3b@fb.com> In-Reply-To: From: Hao Luo Date: Thu, 3 Mar 2022 14:06:02 -0800 Message-ID: Subject: Re: [PATCH bpf-next v1 4/9] bpf: Introduce sleepable tracepoints To: Alexei Starovoitov Cc: Yonghong Song , Alexei Starovoitov , Andrii Nakryiko , Daniel Borkmann , Martin KaFai Lau , Song Liu , KP Singh , Shakeel Butt , Joe Burton , Tejun Heo , Josh Don , Stanislav Fomichev , bpf , LKML Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-18.1 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=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 Thu, Mar 3, 2022 at 12:04 PM Alexei Starovoitov wrote: > > On Thu, Mar 3, 2022 at 12:02 PM Alexei Starovoitov > wrote: > > > > On Thu, Mar 3, 2022 at 11:43 AM Hao Luo wrote: > > > > > > On Wed, Mar 2, 2022 at 6:29 PM Alexei Starovoitov > > > wrote: > > > > > > > > On Wed, Mar 2, 2022 at 5:09 PM Yonghong Song wrote: > > > > > > > > > > > > > > > > > > > > On 3/2/22 1:30 PM, Alexei Starovoitov wrote: > > > > > > On Wed, Mar 2, 2022 at 1:23 PM Yonghong Song wrote: > > > > > >> > > > > > >> > > > > > >> > > > > > >> On 2/25/22 3:43 PM, Hao Luo wrote: > > > > > >>> Add a new type of bpf tracepoints: sleepable tracepoints, which allows > > > > > >>> the handler to make calls that may sleep. With sleepable tracepoints, a > > > > > >>> set of syscall helpers (which may sleep) may also be called from > > > > > >>> sleepable tracepoints. > > > > > >> > > > > > >> There are some old discussions on sleepable tracepoints, maybe > > > > > >> worthwhile to take a look. > > > > > >> > > > > > >> https://lore.kernel.org/bpf/20210218222125.46565-5-mjeanson@efficios.com/T/ > > > > > > > > > > > > Right. It's very much related, but obsolete too. > > > > > > We don't need any of that for sleeptable _raw_ tps. > > > > > > I prefer to stay with "sleepable" name as well to > > > > > > match the rest of the bpf sleepable code. > > > > > > In all cases it's faultable. > > > > > > > > > > sounds good to me. Agree that for the bpf user case, Hao's > > > > > implementation should be enough. > > > > > > > > Just remembered that we can also do trivial noinline __weak > > > > nop function and mark it sleepable on the verifier side. > > > > That's what we were planning to do to trace map update/delete ops > > > > in Joe Burton's series. > > > > Then we don't need to extend tp infra. > > > > I'm fine whichever way. I see pros and cons in both options. > > > > > > Joe is also cc'ed in this patchset, I will sync up with him on the > > > status of trace map work. > > > > > > Alexei, do we have potentially other variants of tp? We can make the > > > current u16 sleepable a flag, so we can reuse this flag later when we > > > have another type of tracepoints. > > > > When we added the ability to attach to kernel functions and mark them > > as allow_error_inject the usefulness of tracepoints and even > > writeable tracepoints was deminissed. > > If we do sleepable tracepoint, I suspect, it may be the last extension > > in that area. > > I guess I'm convincing myself that noinline weak nop func > > is better here. Just like it's better for Joe's map tracing. > > To add to the above... The only downside of sleepable nop func > comparing to tp is the lack of static_branch. > So this nop call will always be there. > For map tracing and for cgroup mkdir/rmdir the few nanosecond > overhead of calling an empty function isn't even measurable. The overhead should be fine, I think. mkdir/rmdir won't be frequent operations. Thanks for the explanation. Let me give it a try and report back how it works.