Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp5799893rwb; Wed, 9 Aug 2023 09:14:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHLYCnw3qg+8d+IKH+Xg8OxbnIdDEzJ2cVtgrt038pzt3K+0emEhOHaB0bsHoei/ogEJbUe X-Received: by 2002:a17:90a:1608:b0:268:13c4:b800 with SMTP id n8-20020a17090a160800b0026813c4b800mr2691427pja.21.1691597668250; Wed, 09 Aug 2023 09:14:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691597668; cv=none; d=google.com; s=arc-20160816; b=DDTK4IUUr7xPjFfbniK6R/gPQzGHB+gRflB1uMWWCNihXs27d8iTonCWj+TWdohREN LZJxOl5D2gilxi++6hawUOblzOlyzPiWNp+kQe5oiO1B90qsT/2zAVR8OHC2CRqnU8u6 27atIgdmmTTitv8TyvsWW6F4Kp/C/jIXqFLuA7Ag2FdwZ/7RigNabo2ZQrJE7aK4V12T AfEG/nvWMMZleg35SVJUSwiHB6DqK33clwXN9oN0F7cDS4ortNb3Ggcrfw+2k4ANJv4I MntIAvsJ73Rn26cVLMWM4/foc4OUb2FXL4IB7Wj+oNZcWOUTb3O/XFOwnYiJLnttZdsA R5GA== 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=Or+4Q7ioH1LO85WlhMl+Hf8sfqeAwfesSr6HY/tLZlg=; fh=3JZkHl2ukg7miGavQW0g2JmR/cZkT7HJHfkPx8E7A9s=; b=X5t/+FAQf3g5sFreqpUBcRnr3cUWGivxdJLUWg7TQ0x+oQpdeEx3H8QGaco/m/GvFX QmSXLB9U3wEy3fctJgU6DQIQEfU7MagRbkcDhnDk1JbPjtVck+oBltuJGE8AsZQlQ7kH +3/MF1R7SvBHhGi5taINXVgqaJYF+f6eKK3uEFbNM9c6QBfaO3v/5n0DHjlFzp6uhXKM ke4oUkxjhiDe7yWBydlGQNd9zyy1PsVSa/oi9w5NDvXdJHWsRKsqm7ZHMhdl3+DJHerD F3iY63zboV/Bl8wAtBTnDVRlpVIQ4c4AZR+MBApTWBkDDNR9vbOOc4YdFTAvIwJTS5Bx aEnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=dZcu+9OC; 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=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f3-20020a17090ab94300b00263eb5054fdsi1716091pjw.32.2023.08.09.09.14.15; Wed, 09 Aug 2023 09:14:28 -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=@chromium.org header.s=google header.b=dZcu+9OC; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234546AbjHIPjS (ORCPT + 99 others); Wed, 9 Aug 2023 11:39:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234519AbjHIPjC (ORCPT ); Wed, 9 Aug 2023 11:39:02 -0400 Received: from mail-oi1-x231.google.com (mail-oi1-x231.google.com [IPv6:2607:f8b0:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE6832D6D for ; Wed, 9 Aug 2023 08:38:12 -0700 (PDT) Received: by mail-oi1-x231.google.com with SMTP id 5614622812f47-3a7a180c3faso2217360b6e.2 for ; Wed, 09 Aug 2023 08:38:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1691595491; x=1692200291; 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=Or+4Q7ioH1LO85WlhMl+Hf8sfqeAwfesSr6HY/tLZlg=; b=dZcu+9OCCvDLKeSC8+efZ2t+vflJAufUebNBSxKiPMXcivRTCQnANXkWc+eUMIOfP5 niV3udOO9xEsykqD1etTNR21tWhoh0SdlANcSTLtFgIor0e+TCSi4toemI4fNBG24Tcs mm9be/Lb7kIaAwrSUVBkeEXK+XV7nwreJY1i0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691595491; x=1692200291; 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=Or+4Q7ioH1LO85WlhMl+Hf8sfqeAwfesSr6HY/tLZlg=; b=R/n36r5zyx+m75iD0tbACGg5a9oWnpLPWEw8z/CEmb+ylu+JXeLFiR8dnIMtjzhacz GqlsL/f9KrNEHmJw07C6Tm5TA8xmnKpdHbGn5iamWdFzN8F0H5F7cqoC74CX5Zm7pNHl fDTjVnzjl197RcfgbgeiL/EWZZl73b3hjs8CR0X8qsAMOt3RFBdM9flqB4vHqvq+8Mrj KvAVH7OKO+PdUI+d64Gp78vzAL/jQdNbZpg3fbk3cZzQldinRVS4sTGSW8xvlUkBAtQb /T9K7DO684ShnXxsTYCW2vqzjlz2nf8PBkC1s0uQjX7ztpHEoe5mxFW1q2S2ROnpahNp Xl9g== X-Gm-Message-State: AOJu0YyzOvCcrtV+qnD6kKB9Ywi0tQ16StiPgXZO8GvOI+l2cd0MjzL5 QYv5doL1Xdt2Iw5xF9wu+mEBgltzQYgaTgh0gIFI/A== X-Received: by 2002:a05:6808:23c7:b0:3a7:8e1b:9d65 with SMTP id bq7-20020a05680823c700b003a78e1b9d65mr3596640oib.47.1691595491693; Wed, 09 Aug 2023 08:38:11 -0700 (PDT) MIME-Version: 1.0 References: <169139090386.324433.6412259486776991296.stgit@devnote2> <169139095066.324433.15514499924371317690.stgit@devnote2> <20230809234512.e3c39b8fffcc6297262f8fc8@kernel.org> In-Reply-To: <20230809234512.e3c39b8fffcc6297262f8fc8@kernel.org> From: Florent Revest Date: Wed, 9 Aug 2023 17:38:00 +0200 Message-ID: Subject: Re: [RFC PATCH v2 4/6] tracing/fprobe: Enable fprobe events with CONFIG_DYNAMIC_FTRACE_WITH_ARGS To: Masami Hiramatsu Cc: Alexei Starovoitov , Steven Rostedt , linux-trace-kernel@vger.kernel.org, LKML , Martin KaFai Lau , bpf , Sven Schnelle , Alexei Starovoitov , Jiri Olsa , Arnaldo Carvalho de Melo , Daniel Borkmann , Alan Maguire , Mark Rutland , Peter Zijlstra , Thomas Gleixner Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 Wed, Aug 9, 2023 at 4:45=E2=80=AFPM Masami Hiramatsu wrote: > > > --- a/kernel/trace/trace_fprobe.c > > > +++ b/kernel/trace/trace_fprobe.c > > > @@ -132,25 +132,30 @@ static int > > > process_fetch_insn(struct fetch_insn *code, void *rec, void *dest, > > > void *base) > > > { > > > - struct pt_regs *regs =3D rec; > > > - unsigned long val; > > > + struct ftrace_regs *fregs =3D rec; > > > + unsigned long val, *stackp; > > > int ret; > > > > > > retry: > > > /* 1st stage: get value from context */ > > > switch (code->op) { > > > case FETCH_OP_STACK: > > > - val =3D regs_get_kernel_stack_nth(regs, code->param); > > > + stackp =3D (unsigned long *)ftrace_regs_get_stack_poi= nter(fregs); > > > + if (((unsigned long)(stackp + code->param) & ~(THREAD= _SIZE - 1)) =3D=3D > > > + ((unsigned long)stackp & ~(THREAD_SIZE - 1))) > > > > Maybe it'd be worth extracting a local > > "ftrace_regs_get_kernel_stack_nth_addr" helper function and/or > > "ftrace_regs_within_kernel_stack" ? > > Yeah, maybe we can make it a generic inline function in linux/ftrace.h. Or even just above this function if there are low chances it would get used elsewhere :)