Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp29590rdb; Thu, 25 Jan 2024 07:23:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IHl7dFRdy8+q3d3ZQ4pz1qinQlqgOy8q4IS2RdrCp1ssMaXdMAUEYN964/OatYaOnsdtJPv X-Received: by 2002:a17:90a:f601:b0:290:cc3:1a7e with SMTP id bw1-20020a17090af60100b002900cc31a7emr883349pjb.82.1706196238015; Thu, 25 Jan 2024 07:23:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706196238; cv=pass; d=google.com; s=arc-20160816; b=lVGD6woImNtzU5iltJbQPOoGBDlbNJ7igbNY3eDUqN3DVBCmas2bA/12FaA8BwoNUq IMY5ue1jJvsBRlihbotHGD1+nmuKbVEPRMmxV/M0OHxT1CpuYy1FUnK2m6KrTCrivLnm LydjOH+q9+WeKv4haqDEgYFaYddSpFz+PnPTXsKVy6DFUb17gQWvIDauQg9nY7rBamLl 1xI6vwUoy3+VW/NDGqj71V4o5BNszqVxT1ww1ghd6vFZZ2bvPMyu55a3XMvPl6oCQUJ+ n5ckUXnIQsfB7YOQ2tHD6gTs0iZA6NVfFJa96Z4k9LkPuyoWfDJO3+3sx7dpB32bOonb WVzQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:date:from:dkim-signature; bh=GUvl1REbEUd6BLP3pDMwPlzTx9j7ZW9jZ3MWQ9/tcz0=; fh=HQRt3482IbkaQ1sytQK2HaqA7bh9pX/5Nqgyt3+2xdU=; b=GR+cSm6d2e263dLT8QA8l5TaSdh7L/WFTsP4dMOrDElwlCd3B0tI3Vl3EfYqyg0Fam Fksx2LUh31VfBNSMTVYRAwlCsMHiRDpiZWWkt9iLxQ1pmjj7O3hdDoE8Y1IvAMFQROrN EKMLOI/TPlXJrH4e1SQ3QA2IIQItg+vGd7Uu6ykIO9FFjMa+o/epOHYsp6Vjc3ObJvJT XfrVkHIQAHYI1nPbqqQbnFEp1QHVVqvN1+eJb+Dtajv0P0+lvySsgsy/UH/FfQ27BCjA 1katJ8j8/vOYufxFVv1OTInwOk+oa5dpZ5KsWiMkP8xngDy3pQWpxllqcqb6vPk5Wl3w HYtQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VX3axazP; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-38802-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38802-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id bt7-20020a056a00438700b006dd7b35eb4bsi404548pfb.114.2024.01.25.07.23.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 07:23:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-38802-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VX3axazP; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-38802-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38802-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 60571B24F7F for ; Thu, 25 Jan 2024 15:12:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A91217316C; Thu, 25 Jan 2024 15:11:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VX3axazP" Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46B976E2C9; Thu, 25 Jan 2024 15:11:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706195517; cv=none; b=HBhaIxKFvaZGLigIF8sb/wyBa6zwECbSDMGhCzWHMVKqDnqg9Vj+IgcZ6FbbiHf4wcqaa/oHDed3kMX9z+N7Zd1Gz7cflQMUvbaOBHouTaeoD3SHEAyAYxNOH51E42dr+nH9TfNpiLBqxb0W1VP4E1S9aMcnqoUBb5xAlnv5a2E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706195517; c=relaxed/simple; bh=mzMOuqXTq4zCUMMK/K2C/+HNWBvw8RALwJlnW72830A=; h=From:Date:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ShZal1LwVHp5r67a0WRZRLd2b3Milmq6YDlNAAOUViAN35H6n24oNSDZGPmtw6pzoUH+ahsmHmWU2Wi2t6G2jFiIIfj3D6uouPFDPqYb4IfIWawEf/roUq9p2QooFuxF3A4OFVKFH5acOLh4nRiDlVwgFVIf7agdO2c1lrfzuEs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VX3axazP; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-40e7065b692so73641005e9.3; Thu, 25 Jan 2024 07:11:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706195514; x=1706800314; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc:subject:date:message-id:reply-to; bh=GUvl1REbEUd6BLP3pDMwPlzTx9j7ZW9jZ3MWQ9/tcz0=; b=VX3axazPlyFUmYuDEEkw+xtrxFIkiqdSPAYHeVXGUhBz48ECULgjDf40aSif9EIixL ISgJ3kl3JCnH2jgZ8oOpfBSWpkujV2VTF0TwecOtgX++3rS901YnV/FACx60xRgnu23T 7F3RL1/j3lwDrY5mTx+UbvtK3RJeO3eN6+23uhgWyc1HIUG7+hKv7Vcip7+0ySVhdRQH qHhPM8lboD8wzdTLY8+WGwkbJoZE77sqyDTCu5suXezPTX44ZaZ2XapcxbNXMa1oz1l4 ShMawQQZWeQmyJGIakegnftMWHK/zlMiLIcnHfpQciSIypHgToMNPP/neXkWVg5jq6cx VHtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706195514; x=1706800314; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=GUvl1REbEUd6BLP3pDMwPlzTx9j7ZW9jZ3MWQ9/tcz0=; b=d7J4jq+1aj3N8gO8h8ZXvyCYE9EsB1YBQ1UkmeKTLCx29ZclSamsfA3/fwHAkUBZs+ cv9Hwz4I0fa/7aSD8wLlb6T4GoHOIjDKfnyfXSA5Ea7k60E6i4f5Mdk883yRSyJ0ta9a u/cNpsvM+G4D/1Vh7DTre1jLytEjaWFH7PQHfDNb6NVfIDEPMHxLWinXvNh6HC4fN9V9 zzH3FcoDZwp9btetdlPNKUxu7aS/svetbLgkrpIhKHtj+7G4/Ug3FCMJgeos8YYjaAhZ 4oi1A1OIaZpwOFiVVWNJubV/tumkTQIc4IHPTzkPge7gWRgq4cT++ivWYYtzOm/W/edV xRqQ== X-Gm-Message-State: AOJu0YwUhNsXf+Wxa364hiUDMYgSW7JsLk9FA3q6xI8Fl9nrKvEs0dMh 7dDXJlqtPHXM9LuRdVQtxqO3MTCdRNdgYzWInoezEnVYbE6YRmlE X-Received: by 2002:a05:600c:1396:b0:40e:7e28:e5c8 with SMTP id u22-20020a05600c139600b0040e7e28e5c8mr605036wmf.6.1706195514252; Thu, 25 Jan 2024 07:11:54 -0800 (PST) Received: from krava (2001-1ae9-1c2-4c00-726e-c10f-8833-ff22.ip6.tmcz.cz. [2001:1ae9:1c2:4c00:726e:c10f:8833:ff22]) by smtp.gmail.com with ESMTPSA id a17-20020a5d5091000000b003392d3dcf6dsm12011392wrt.0.2024.01.25.07.11.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 07:11:53 -0800 (PST) From: Jiri Olsa X-Google-Original-From: Jiri Olsa Date: Thu, 25 Jan 2024 16:11:51 +0100 To: "Masami Hiramatsu (Google)" Cc: Alexei Starovoitov , Steven Rostedt , Florent Revest , linux-trace-kernel@vger.kernel.org, LKML , Martin KaFai Lau , bpf , Sven Schnelle , Alexei Starovoitov , Arnaldo Carvalho de Melo , Daniel Borkmann , Alan Maguire , Mark Rutland , Peter Zijlstra , Thomas Gleixner , Guo Ren Subject: Re: [PATCH v6 32/36] fprobe: Rewrite fprobe on function-graph tracer Message-ID: References: <170505424954.459169.10630626365737237288.stgit@devnote2> <170505462606.459169.1375700979988728260.stgit@devnote2> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <170505462606.459169.1375700979988728260.stgit@devnote2> On Fri, Jan 12, 2024 at 07:17:06PM +0900, Masami Hiramatsu (Google) wrote: SNIP > * Register @fp to ftrace for enabling the probe on the address given by @addrs. > @@ -298,23 +547,27 @@ EXPORT_SYMBOL_GPL(register_fprobe); > */ > int register_fprobe_ips(struct fprobe *fp, unsigned long *addrs, int num) > { > - int ret; > - > - if (!fp || !addrs || num <= 0) > - return -EINVAL; > - > - fprobe_init(fp); > + struct fprobe_hlist *hlist_array; > + int ret, i; > > - ret = ftrace_set_filter_ips(&fp->ops, addrs, num, 0, 0); > + ret = fprobe_init(fp, addrs, num); > if (ret) > return ret; > > - ret = fprobe_init_rethook(fp, num); > - if (!ret) > - ret = register_ftrace_function(&fp->ops); > + mutex_lock(&fprobe_mutex); > + > + hlist_array = fp->hlist_array; > + ret = fprobe_graph_add_ips(addrs, num); so fprobe_graph_add_ips registers the ftrace_ops and actually starts the tracing.. and in the code below we prepare fprobe data that is checked in the ftrace_ops callback.. should we do this this earlier before calling fprobe_graph_add_ips/register_ftrace_graph? jirka > + if (!ret) { > + add_fprobe_hash(fp); > + for (i = 0; i < hlist_array->size; i++) > + insert_fprobe_node(&hlist_array->array[i]); > + } > + mutex_unlock(&fprobe_mutex); > > if (ret) > fprobe_fail_cleanup(fp); > + > return ret; > } > EXPORT_SYMBOL_GPL(register_fprobe_ips); > @@ -352,14 +605,13 @@ EXPORT_SYMBOL_GPL(register_fprobe_syms); SNIP