Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5215359rwd; Tue, 23 May 2023 21:00:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5FXwH+VHcBrqLKRpJnHjQCHtTy2i/+yYskjDxmH4JoB4nHyf2B0TE+qsJrMq5Aeyf5Y1Zh X-Received: by 2002:a05:6a21:329f:b0:10b:5abf:6f0d with SMTP id yt31-20020a056a21329f00b0010b5abf6f0dmr10717035pzb.40.1684900840827; Tue, 23 May 2023 21:00:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684900840; cv=none; d=google.com; s=arc-20160816; b=mwhnr5ijNdincKZXGun72WVLkT74nGaUJoT57MYjqmia8PpBFIEX4KD5RS5tmJU135 /jZDsXVSUFOzh+UOv6iKf8xOaSzxnRBlFui16QzFqU+y+BP1WDfyNUmsg1AbJtfRCpVh mXGB8SVsZ7/oP02anREiodRyfQk4K9hOVv2ooEo59Uw2P1lHIm6j/Rw7RCBLKnyUDH7m y8la89AWJ7Be5UFf6J6UUK5N3oUMbSs/3RzIsQzkON6GXnku1x3bGECPYtP9piSozmHq NemyOJWj/4dl42cPu/uh5S6nNc2+E69G0H+QsvX2+WFydXfSWml9kd1oU5V7WR/Lu5SI 0xeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=PIplVH84mQzYA92Hw7xyqoi7EjdVHd4BsS3gkqLQQZk=; b=oVOb4AWEE6jzBqbvwFwb0Fq+MzEoojLi97Hwuz348USxdqMBY7u0xpWdmNCF00r3z5 ciVnJYQyNvV0peCsFgr8AEiyOLKhkQTRPc3cQ5eSMJenkRWDmFv3b9szrbRxzu+qVYaJ IKgrU2+Ff3xouglmR1dfjcdrxUcsmC4NnE7gLIe80n7MN1y1JlLEs94cIlWYzG/wP9gL ryV1cz1dmGeyhmPvwx2LvkjEkIDFMAzrhX3pPy7IM/t/uIHyL34zngUWJ5WAkcvvHq7t TwmsaYsHFRM4oWc9ZDFho4jrsT9ET72DBG+btPrCW8uJvA7SvtZ3aZ3AyVfdQAJxTDDU wqjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=TBfSbXLJ; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j8-20020a633c08000000b0053f01212571si1311689pga.257.2023.05.23.21.00.26; Tue, 23 May 2023 21:00:40 -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=@gmail.com header.s=20221208 header.b=TBfSbXLJ; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239354AbjEXDwP (ORCPT + 99 others); Tue, 23 May 2023 23:52:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229595AbjEXDwN (ORCPT ); Tue, 23 May 2023 23:52:13 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FC13C1; Tue, 23 May 2023 20:52:12 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-510ea8d0bb5so948158a12.0; Tue, 23 May 2023 20:52:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684900330; x=1687492330; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=PIplVH84mQzYA92Hw7xyqoi7EjdVHd4BsS3gkqLQQZk=; b=TBfSbXLJmCCNrWLz0DQ3lWQZTgzmLHDVqbff5CzHHTeayTSAofA0cIRgRSTzP5t8xM r0mDziKrlLeyb0G0ILOj6BmWCzNUImSkR3LPI6ylI7Y36SaHhr5VQnOZzgyqZrqaxq6d i/StgdEy4BNKyaHWQL89/YIhZuyK8DtwHnfoKVoj8FEGbGTn67ffjUA/BIiUge9xiduJ ZgKUub24uTk3bO5IyWCooJjv3tthXMZv2cfo20ZOZtxFXX+dYvS1nX8mierZNLuNlf5x 3lv2spmlOoDVkvnUbVXlevqhK4vmJPSRODPGmByXtwDykUx33aRuIcUj8kp5et6mN8Gj hPEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684900330; x=1687492330; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PIplVH84mQzYA92Hw7xyqoi7EjdVHd4BsS3gkqLQQZk=; b=IkucrMOgfXfuvQAJARTtZzsIw/1q2B8WzwekuqIS5iSzye9Gb3+4HWNpxOZ4y6zQX/ ttldwsjtccqBi8XFPOrhLITY9ySoulzgMmbji2dfQWPRazp90uY5TFYjVug2zajrp55w Tq7q8LHl+XJVT2Zw3yYrSzyX3ZhCmjKdiaEKV9Dvfapn7mXR8USvIyMSXpkd8ugGXfha 42GkXgVHMBE0h+FSkkF3Wu2BNIA+0smJ/0jd/kqNrs/FkP9HYiySiv3hv/Zzle1AjbqH kgUIlJIWLGZ0EAKrhsHlE7mNk4MJcbdR0mosbsWwGlB1F99bbhvf8NAgGJfaC9F6HbBS EHLw== X-Gm-Message-State: AC+VfDyeW43fZjgMi8g9pVfjw0RbWD0lbHjpfgBNtcIejJE5dsRpY1Ql xCl1WAP0TnsdXJGkMJMnmABzzN2qJCo/FSMiH0M= X-Received: by 2002:aa7:dd10:0:b0:510:a5a1:b36d with SMTP id i16-20020aa7dd10000000b00510a5a1b36dmr901501edv.33.1684900330454; Tue, 23 May 2023 20:52:10 -0700 (PDT) MIME-Version: 1.0 References: <20220515203653.4039075-1-jolsa@kernel.org> <20230520094722.5393-1-zegao@tencent.com> <20230523101041.23ca7cc8@rorschach.local.home> In-Reply-To: <20230523101041.23ca7cc8@rorschach.local.home> From: Ze Gao Date: Wed, 24 May 2023 11:51:58 +0800 Message-ID: Subject: Re: kprobes and rcu_is_watching() To: Steven Rostedt Cc: Jiri Olsa , Yonghong Song , Alexei Starovoitov , Andrii Nakryiko , Daniel Borkmann , Hao Luo , John Fastabend , KP Singh , Martin KaFai Lau , Masami Hiramatsu , Song Liu , Stanislav Fomichev , Yonghong Song , bpf@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, kafai@fb.com, kpsingh@chromium.org, netdev@vger.kernel.org, paulmck@kernel.org, songliubraving@fb.com, Ze Gao Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 Thanks Steven, I think we've come to a consensus on this. The question here is whether bpf tracing fentry i.e., __bpf_prog_enter{_sleepable} needs to check rcu_is_watching as well before using rcu related calls. And Yonghong suggested making a change when there is indeed some bad case occurring since it's rare the tracee is in the idle pa= th. Regards, Ze On Tue, May 23, 2023 at 10:10=E2=80=AFPM Steven Rostedt wrote: > > [ Added a subject, as I always want to delete these emails as spam! ] > > On Mon, 22 May 2023 10:07:42 +0800 > Ze Gao wrote: > > > Oops, I missed that. Thanks for pointing that out, which I thought is > > conditional use of rcu_is_watching before. > > > > One last point, I think we should double check on this > > "fentry does not filter with !rcu_is_watching" > > as quoted from Yonghong and argue whether it needs > > the same check for fentry as well. > > > > Note that trace_test_and_set_recursion() (which is used by > ftrace_test_recursion_trylock()) checks for rcu_is_watching() and > returns false if it isn't (and the trylock will fail). > > -- Steve