Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2360650ioo; Sat, 28 May 2022 11:14:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzN4OUe3YVqqUIKRbBh4HUmSbKjPUKeiJ6lg5HuGKqgAJ9Ao6M3Oxm6CRLrA3KS6G0uSwU9 X-Received: by 2002:a05:6a02:11a:b0:3fb:d90c:b3f8 with SMTP id bg26-20020a056a02011a00b003fbd90cb3f8mr3149553pgb.192.1653761686258; Sat, 28 May 2022 11:14:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653761686; cv=none; d=google.com; s=arc-20160816; b=DL7LQe6x6cM0mNZwec4HYL5rlfIjGQrJwCbllV0jJzlP+UpadL+kzCkHhkCypFcI4G lTqg2q6InzdXvsnaA4MN9ZFMXQqiexsnWzoaspLGD3/7gLFsS4es7znRE0O+loW8C1b2 tBdCrjVs8R47+iCDzfMRi/D29bmYeKbM5WE3ESGm4R2PEjKfu2rXvqzH4yCjkfwHLXYG PDBtjm2JZWdq8zEBsyxeyUPg8MynD3xfa2ewLQW4V9CU22fORz+Ifrq5dna46d6jET+z G0SnTU4/YIs6R7jvLG2FEia255FjzZoVme+Joh9tlOZLBLoiEda1qX8FexMcaCYNkXnp MVoQ== 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:date:subject:cc:to:from:dkim-signature :message-id; bh=GsSYc+fe6QdvZyYkZ6XY8VfsUlV3aCJmso5J7Wnq8n8=; b=WeSBsgA5FrnNbHC0iJF9HVB4UpyMxIDCgOdz1YB7XmNCQFrpAzoFe+dauO+9UTJzz/ IKezOMDTrmGzdYcd35JUFRCRXsjSntnm/QrLJBVuCass3DG0fHnVKvf+Qh/h4ekTjwsy FHApxkB9Ofu3b+B3+T8bpNp1u8RFpS6/rVo+A5brDnWoAsXCCpXDjPy4r0GDXpz+PcEg a3j4Zbuf94eSjYDoih/iQyOCjcnEsA06K5ZlY+r0qO5fdlSNQRkr0o2BIx4UB6PiOgX5 HJXthtDGd6ClJvaekifEWXcWbp2v1ysECWOgme00u70bn2sLwaAVb/hHzVUnHRxBMcFn xXIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=cnm9VPEp; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id m12-20020a170902768c00b00158da867027si7838040pll.624.2022.05.28.11.14.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 11:14:46 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=cnm9VPEp; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Message-ID: <62926696.1c69fb81.1e5b9.63b7SMTPIN_ADDED_BROKEN@mx.google.com> X-Google-Original-Message-ID: <20220524210709.3f0ddc3a@gandalf.local.home> (raw) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CCAB713E88; Sat, 28 May 2022 11:14:44 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236161AbiE1Nzc (ORCPT + 99 others); Sat, 28 May 2022 09:55:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235945AbiE1Nzb (ORCPT ); Sat, 28 May 2022 09:55:31 -0400 Received: from m12-16.163.com (m12-16.163.com [220.181.12.16]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B63E7283 for ; Sat, 28 May 2022 06:55:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=GsSYc +fe6QdvZyYkZ6XY8VfsUlV3aCJmso5J7Wnq8n8=; b=cnm9VPEpBN2pmgJOlRk9G zZ1YxCxw+M2ee5r7QXIO2ygxIjVcWMa+6JFW8ZxRdS67xx2BqzFw/FWEp0MWUuTQ mSXFTj2daDiFxEbT9vWvQPOmtdLz3xreg5IRdIAWUVO0iKTUKraAkvD4i8RDrV/u m+iI9LJLqTIbd+BnJKDI4o= Received: from localhost (unknown [113.89.247.110]) by smtp12 (Coremail) with SMTP id EMCowABn+1yTKZJirHDyAA--.14079S2; Sat, 28 May 2022 21:54:28 +0800 (CST) From: Junwen Wu To: rostedt@goodmis.org, Junwen Wu Cc: frederic@kernel.org, linux-kernel@vger.kernel.org, mingo@redhat.com, tannerlove@google.com, tglx@linutronix.de Subject: Re: [PATCH v1] softirq: Add tracepoint for tasklet_entry/exit Date: Sat, 28 May 2022 13:54:11 +0000 X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220508160624.48643-1-wudaemon@163.com> References: <20220524210709.3f0ddc3a@gandalf.local.home> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: EMCowABn+1yTKZJirHDyAA--.14079S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxGrW7Wryxuw4fZF47Wr15urg_yoW5Xw47pa sF9ayYkrZ5Jr42vr13A3WUAr15Zws3GFy7Jrs7W3W3Zw1Uur1kt39rt3WjyFW0yr4F9Fy2 9a1aqry3u34kua7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0pRLvtXUUUUU= X-Originating-IP: [113.89.247.110] X-CM-SenderInfo: 5zxgtvxprqqiywtou0bp/xtbBxxUPbWB0Hw0dbAAAsH X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 From: Steven Rostedt >> + >> + TP_printk("function=%ps", __entry->func) >This needs an acked-by from Thomas, but regardless, the above two trace >events are identical. You need to have a DECLARE_EVENT_CLASS() followed by >two DEFINE_EVENT()s, otherwise you are wasting memory. I have use DECLARE_EVENT_CLASS() define use tracepoint,Steve. Thomas, can you give me acked-by,here is patch v2. From 68d2298372018ec90c8587d5421a0e1a3c9f879f Mon Sep 17 00:00:00 2001 From: Junwen Wu Date: Sun, 8 May 2022 15:29:56 +0000 Subject: [PATCH v2] softirq: Add tracepoint for tasklet_entry/exit Usually softirq handler is pre-defined,only tasklet can be register by driver.We expand tracepoint for tasklet_entry/exit to trace tasklet handler. Signed-off-by: Junwen Wu --- include/trace/events/irq.h | 41 ++++++++++++++++++++++++++++++++++++++ kernel/softirq.c | 4 ++++ 2 files changed, 45 insertions(+) diff --git a/include/trace/events/irq.h b/include/trace/events/irq.h index eeceafaaea4c..62b7e53121da 100644 --- a/include/trace/events/irq.h +++ b/include/trace/events/irq.h @@ -160,6 +160,47 @@ DEFINE_EVENT(softirq, softirq_raise, TP_ARGS(vec_nr) ); +DECLARE_EVENT_CLASS(tasklet, + + TP_PROTO(void *func), + + TP_ARGS(func), + + TP_STRUCT__entry( + __field( void*, func ) + ), + + TP_fast_assign( + __entry->func = func; + ), + + TP_printk("function=%ps", __entry->func) +); + +/** + * tasklet_entry - called immediately when a tasklet exec + * @func: the callback function when a tasklet exec + * + * When used in combination with the tasklet_entry tracepoint + * we can determine the callback function when a tasklet exec. + */ +DEFINE_EVENT(tasklet, tasklet_entry, + + TP_PROTO(void *func), + + TP_ARGS(func) +); + +/** + * tasklet_exit - called immediately after the tasklet handler returns + * @func: the callback function when a tasklet exec + */ +DEFINE_EVENT(tasklet, tasklet_exit, + + TP_PROTO(void *func), + + TP_ARGS(func) +); #endif /* _TRACE_IRQ_H */ /* This part must be outside protection */ diff --git a/kernel/softirq.c b/kernel/softirq.c index 41f470929e99..79b3814ad166 100644 --- a/kernel/softirq.c +++ b/kernel/softirq.c @@ -780,10 +780,14 @@ static void tasklet_action_common(struct softirq_action *a, if (tasklet_trylock(t)) { if (!atomic_read(&t->count)) { if (tasklet_clear_sched(t)) { + trace_tasklet_entry(t->use_callback ? (void *)t->callback + : (void *)t->func); if (t->use_callback) t->callback(t); else t->func(t->data); + trace_tasklet_exit(t->use_callback ? (void *)t->callback + : (void *)t->func); } tasklet_unlock(t); continue; -- 2.25.1