Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1017481rwb; Fri, 23 Sep 2022 07:14:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM73fxyS8V8TDFkIVHJD4XEa1sl3r7f9bJ5jMshZmNqxCYJ4GgB0QFDuG/gbuhQP31ZylS/r X-Received: by 2002:a17:907:3f04:b0:741:4bf4:fe42 with SMTP id hq4-20020a1709073f0400b007414bf4fe42mr7404533ejc.664.1663942439731; Fri, 23 Sep 2022 07:13:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663942439; cv=none; d=google.com; s=arc-20160816; b=nHNwAXm8Da8BbyEvqkkuL7urIN86OKHs6YuAuqhVZa00nCB7Bwou0fgBXxNLaFOASt tOxy+i2ZrFEABzTuyyAmofpAHiaHIrmA2AHNVFl+9HGTkeN8zE4+gKWtLCxdxc8FjvwI Iy1EiAUgkwG/4gHJjoXXHURvMasxuXeTap1/dg1sElCP2yZCwArb0XMVyVV+oh3/0+BL lFrP4B7kEvD7uA2cO+zhGcjUiTYDt63szQTfYRyN68wqqPjE6mLAyFtRJ+D1l5/X8VSx eWkbskKiXOVaGrUeOTZnM9umxeN8t/UmeSbZmVFItf/zfkYswNMYFlPgnzrqI6jDPDYK VGbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=YAfv181AYmAEBchj4+zdPhjrg18guh0H+HJwvQuFR5o=; b=pfmzYsCwMzDnWSEULoejihyNZnltI7i/CSDJRkpRbmvlRM2dJ+VTPUy6gJSaNe5xfR qcZQ/SIbAqOm5J0lp0ZTmJbhj52Qy7kXgBNPlpyEVzAYOfB/qFRbubhJIJx971xZ0aAa Cf7SO6G0PWMBBngQClp4RYLA2GVdxprDVVrPURtg77XYNmixFG91n/cUzCuv2hEUiL9O glUgEicrQqUpa2FrY2WgWGw4ffw+EHRhZeZW/pyPn45uDKIqMyMxS/+Hefr/snXsiLvS u9DGc9dVZ3Bkqm5b5JzbcovqaYuoKmkqcpE42VEB/Sva101197Qgq96yXrsyaPa50HWi 7a+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GuYPIO0S; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cw13-20020a170906478d00b007807e3f6766si8102862ejc.581.2022.09.23.07.13.34; Fri, 23 Sep 2022 07:13:59 -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=@kernel.org header.s=k20201202 header.b=GuYPIO0S; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230256AbiIWOFg (ORCPT + 99 others); Fri, 23 Sep 2022 10:05:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229963AbiIWOFe (ORCPT ); Fri, 23 Sep 2022 10:05:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4817E9531 for ; Fri, 23 Sep 2022 07:05:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 82B0E614A4 for ; Fri, 23 Sep 2022 14:05:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E24CC433D6; Fri, 23 Sep 2022 14:05:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663941932; bh=gG8kc5EGZ32Hzl5KDr5xjlW/0iQb/qxEQ3HLHfN9NHI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=GuYPIO0SLHM787PKj6eYLF+tylWGekRgu1nNBBX+OS6VbuUr2vRCS4YVOgIzdjTmS uIwWBYRady4gONeZujOxwcGlVYDZTes0wBDlaFOCb49lfZaEyoZ5D5MaXyLuBRHFm/ y1OROyNBEcfd43g2ywN4krS3m+BYQVYjmSjAqTQzQSOMo6gQWRklz7YpYvZQqDM4xF Kv+DIAXioHxqnq61JE1ng1hOay2JfQHCsNHgAsCvyEmn1n4QUdNynd9aN+LmgnP18w acra5QC3daAJbJ1W5GG6mAulQy53ESJoKOhFKTdzVmTfYAZLoR2As1UTgtGvCT0BdI QCLbX26yQ9ihg== Date: Fri, 23 Sep 2022 23:05:27 +0900 From: Masami Hiramatsu (Google) To: Yipeng Zou Cc: , , , , , , , , , Subject: Re: [PATCH 2/2] tracing: kprobe: make gen test module work in arm and riscv Message-Id: <20220923230527.6e3ac417a749ed22302d42ab@kernel.org> In-Reply-To: <20220919125629.238242-3-zouyipeng@huawei.com> References: <20220919125629.238242-1-zouyipeng@huawei.com> <20220919125629.238242-3-zouyipeng@huawei.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS 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 Mon, 19 Sep 2022 20:56:29 +0800 Yipeng Zou wrote: > For now, this selftest module can only work in x86 because of the > kprobe cmd was fixed use of x86 registers. > This patch adapted to register names under arm and riscv, So that > this module can be worked on those platform. This also looks good to me. (good & simple solution :)) Acked-by: Masami Hiramatsu (Google) Thank you, > > Fixes: 64836248dda2 ("tracing: Add kprobe event command generation test module") > Signed-off-by: Yipeng Zou > --- > kernel/trace/kprobe_event_gen_test.c | 47 +++++++++++++++++++++++++--- > 1 file changed, 43 insertions(+), 4 deletions(-) > > diff --git a/kernel/trace/kprobe_event_gen_test.c b/kernel/trace/kprobe_event_gen_test.c > index e023154be0f8..80e04a1e1977 100644 > --- a/kernel/trace/kprobe_event_gen_test.c > +++ b/kernel/trace/kprobe_event_gen_test.c > @@ -35,6 +35,45 @@ > static struct trace_event_file *gen_kprobe_test; > static struct trace_event_file *gen_kretprobe_test; > > +#define KPROBE_GEN_TEST_FUNC "do_sys_open" > + > +/* X86 */ > +#if defined(CONFIG_X86_64) || defined(CONFIG_X86_32) > +#define KPROBE_GEN_TEST_ARG0 "dfd=%ax" > +#define KPROBE_GEN_TEST_ARG1 "filename=%dx" > +#define KPROBE_GEN_TEST_ARG2 "flags=%cx" > +#define KPROBE_GEN_TEST_ARG3 "mode=+4($stack)" > + > +/* ARM64 */ > +#elif defined(CONFIG_ARM64) > +#define KPROBE_GEN_TEST_ARG0 "dfd=%x0" > +#define KPROBE_GEN_TEST_ARG1 "filename=%x1" > +#define KPROBE_GEN_TEST_ARG2 "flags=%x2" > +#define KPROBE_GEN_TEST_ARG3 "mode=%x3" > + > +/* ARM */ > +#elif defined(CONFIG_ARM) > +#define KPROBE_GEN_TEST_ARG0 "dfd=%r0" > +#define KPROBE_GEN_TEST_ARG1 "filename=%r1" > +#define KPROBE_GEN_TEST_ARG2 "flags=%r2" > +#define KPROBE_GEN_TEST_ARG3 "mode=%r3" > + > +/* RISCV */ > +#elif defined(CONFIG_RISCV) > +#define KPROBE_GEN_TEST_ARG0 "dfd=%a0" > +#define KPROBE_GEN_TEST_ARG1 "filename=%a1" > +#define KPROBE_GEN_TEST_ARG2 "flags=%a2" > +#define KPROBE_GEN_TEST_ARG3 "mode=%a3" > + > +/* others */ > +#else > +#define KPROBE_GEN_TEST_ARG0 NULL > +#define KPROBE_GEN_TEST_ARG1 NULL > +#define KPROBE_GEN_TEST_ARG2 NULL > +#define KPROBE_GEN_TEST_ARG3 NULL > +#endif > + > + > /* > * Test to make sure we can create a kprobe event, then add more > * fields. > @@ -58,14 +97,14 @@ static int __init test_gen_kprobe_cmd(void) > * fields. > */ > ret = kprobe_event_gen_cmd_start(&cmd, "gen_kprobe_test", > - "do_sys_open", > - "dfd=%ax", "filename=%dx"); > + KPROBE_GEN_TEST_FUNC, > + KPROBE_GEN_TEST_ARG0, KPROBE_GEN_TEST_ARG1); > if (ret) > goto free; > > /* Use kprobe_event_add_fields to add the rest of the fields */ > > - ret = kprobe_event_add_fields(&cmd, "flags=%cx", "mode=+4($stack)"); > + ret = kprobe_event_add_fields(&cmd, KPROBE_GEN_TEST_ARG2, KPROBE_GEN_TEST_ARG3); > if (ret) > goto free; > > @@ -128,7 +167,7 @@ static int __init test_gen_kretprobe_cmd(void) > * Define the kretprobe event. > */ > ret = kretprobe_event_gen_cmd_start(&cmd, "gen_kretprobe_test", > - "do_sys_open", > + KPROBE_GEN_TEST_FUNC, > "$retval"); > if (ret) > goto free; > -- > 2.17.1 > -- Masami Hiramatsu (Google)