Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3673756rdh; Tue, 28 Nov 2023 00:01:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IFTdauRqSvCvYmqpE5pyzqWGXPTpajOMq4UVFRrv8/6yi1MGipCWQQgaJtHUR3t/AE9zxVx X-Received: by 2002:a05:6a00:478a:b0:6c9:af71:1de7 with SMTP id dh10-20020a056a00478a00b006c9af711de7mr21655686pfb.11.1701158474975; Tue, 28 Nov 2023 00:01:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701158474; cv=none; d=google.com; s=arc-20160816; b=wU19i91Ix4V4K4NM2Cu6tbVvZe88a3dxQiocQI5JzJtNklx2Fn8ARi4A2bjiCf8sf4 rSdAMcWNaDL8IeGZGJix3HaeJPNNvVNF+mDop4Zzn21IQuwL49SC2PsN5pPzy+IzF0Fi Y2sSBwjTIQYAOXxSILfux0jjrdTrocU9IfNLYuBoUiSOKTuA8ZZbdV2AbJbdLIMzf10f KkCL08wSWSi/wHYgHrAQUbDowSuR78vrGKkKBl020dGZz8Tmb/AJHQkha5UPS9dmUBY7 n6YB62Km5MNKAq1/xJ3HL+JNx07E57zajxEYAcXE4+HXeeB4LY+cLC5IhryQvsMJk0bk 0+2Q== 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:date:subject:cc:to:from :dkim-signature; bh=ix4aRk838AcYQmbPKw3siGTbYQUaFkXlULCZyng7Pu0=; fh=4iZcRCmzpaCZKgp7nvxh/m3AX3kfm//yPbGO/jIXleI=; b=nRnaszBb5kxQ2WKyYW/c90HrFDQuQgYcpo0zyL8lfWcUI/ToPd6tKNy9RgebtvBDVh TAdn1izSUfHyfj8kWNksXFCSlAsuGGy8mXsH0/nFb9PBs+EqgHrIFVffwpZvdG9kXwRp 6bhBt0EmkgZtKQ1cZSezQ/LQqJAYbqvVhB5IbQM3weFOwi845weqCB5Bh53mBu7achpU MW9WGt98T4hV1ivwsdX49BbFpzhjT2JVk9kn4U0Ud/orzFo6T68B3XitboV4NqEGAdYt tOOM8aPq0mt+n/RUa0Cv5Erjc36ZYYjLLB4Nfn8BtXIGUyu4rGm3bghJUnriVLMt48pm 54Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BZ6G+63A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id c3-20020a630d03000000b005b8f0ca2e5asi11775431pgl.79.2023.11.28.00.01.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 00:01:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BZ6G+63A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 0670F8165389; Tue, 28 Nov 2023 00:01:06 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343970AbjK1IAi (ORCPT + 99 others); Tue, 28 Nov 2023 03:00:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343953AbjK1IAd (ORCPT ); Tue, 28 Nov 2023 03:00:33 -0500 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B53D3F5; Tue, 28 Nov 2023 00:00:39 -0800 (PST) Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-50943ccbbaeso7172841e87.2; Tue, 28 Nov 2023 00:00:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701158438; x=1701763238; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ix4aRk838AcYQmbPKw3siGTbYQUaFkXlULCZyng7Pu0=; b=BZ6G+63AffuFlXIRRCr1u1Nr8ecbP8MOAYjMuyr7jWsWDAhnJms/9R5Z/nOGPYAqh3 GRjkJU1HLhPadxrMO+H6HKD+X5w/qkP44pmd7wVttowREYHK693jwX84WbVsP0Lyxk7Y RPajvj5eqzLZaYDEVLAbpyKlktLvu7PgSZDCmu5BjtcgzfKNdNGvsUcsVq8gYMP5vHKh MniLZdGMI+/t4HK/TucbPYJrGga1avZOdWLxX5U0foUeooCGUOAG2Hb09JOuKz9YWCqD rUt/42N0PtMSn+dWX63tyDzcvpBYThPExMVrWqRan0qb9cjo3jFk9L4qL8q+Nhhj/tZJ HgKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701158438; x=1701763238; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ix4aRk838AcYQmbPKw3siGTbYQUaFkXlULCZyng7Pu0=; b=hIfEPAcguwqhLq6XC7QiL1Xd1JAmVcYlgRAIEDcQfwvn04NTbzRlvm7xqTUtyuvT1R oml4DBney5QMxgTF9QTYzUm9z4I8AnX+LieVnEjcCh9xp9zLc6/gXGbjdZyrjCQOnN7f ioto1e351/lr9bDrg6FUIWGsu4f70xev6jgt6t3s/ojouXqQOTTkED2xXxqzyxc1he7y knXhyUbXGM8SFDtKEtfRwAmiLAIjqkAqKWlDMDTYAq9t7KcFRgYIE8SxKQsVgMadeAdH OZVXh62norLuvd+lIzOGjruu6pwSFiJKhb3jqiFkt1GYis8n/kizr6rj1XcSTZ29oQsI 0y4Q== X-Gm-Message-State: AOJu0YyiSJEUL/NYP/7VKEjiitucJj2cwVDlQu/LvI2mDHRpvexWJ4Pf u2WGaxzgWhO+oXbZ56u/F9o= X-Received: by 2002:a05:6512:ac3:b0:4ff:7f7f:22e7 with SMTP id n3-20020a0565120ac300b004ff7f7f22e7mr11962877lfu.17.1701158437824; Tue, 28 Nov 2023 00:00:37 -0800 (PST) Received: from pc638.lan ([155.137.26.201]) by smtp.gmail.com with ESMTPSA id o16-20020ac24bd0000000b004fe202a5c7csm1765501lfq.135.2023.11.28.00.00.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 00:00:37 -0800 (PST) From: "Uladzislau Rezki (Sony)" To: "Paul E . McKenney" Cc: RCU , Neeraj upadhyay , Boqun Feng , Hillf Danton , Joel Fernandes , LKML , Uladzislau Rezki , Oleksiy Avramchenko , Frederic Weisbecker Subject: [PATCH v3 2/7] rcu: Add a trace event for synchronize_rcu_normal() Date: Tue, 28 Nov 2023 09:00:28 +0100 Message-Id: <20231128080033.288050-3-urezki@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231128080033.288050-1-urezki@gmail.com> References: <20231128080033.288050-1-urezki@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 28 Nov 2023 00:01:06 -0800 (PST) Add an rcu_sr_normal() trace event. It takes three arguments first one is the name of RCU flavour, second one is a user id which triggeres synchronize_rcu_normal() and last one is an event. There are two traces in the synchronize_rcu_normal(). On entry, when a new request is registered and on exit point when request is completed. Please note, CONFIG_RCU_TRACE=y is required to activate traces. Signed-off-by: Uladzislau Rezki (Sony) --- include/trace/events/rcu.h | 27 +++++++++++++++++++++++++++ kernel/rcu/tree.c | 7 ++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h index 2ef9c719772a..31b3e0d3e65f 100644 --- a/include/trace/events/rcu.h +++ b/include/trace/events/rcu.h @@ -707,6 +707,33 @@ TRACE_EVENT_RCU(rcu_invoke_kfree_bulk_callback, __entry->rcuname, __entry->p, __entry->nr_records) ); +/* + * Tracepoint for a normal synchronize_rcu() states. The first argument + * is the RCU flavor, the second argument is a pointer to rcu_head the + * last one is an event. + */ +TRACE_EVENT_RCU(rcu_sr_normal, + + TP_PROTO(const char *rcuname, struct rcu_head *rhp, const char *srevent), + + TP_ARGS(rcuname, rhp, srevent), + + TP_STRUCT__entry( + __field(const char *, rcuname) + __field(void *, rhp) + __field(const char *, srevent) + ), + + TP_fast_assign( + __entry->rcuname = rcuname; + __entry->rhp = rhp; + __entry->srevent = srevent; + ), + + TP_printk("%s rhp=0x%p event=%s", + __entry->rcuname, __entry->rhp, __entry->srevent) +); + /* * Tracepoint for exiting rcu_do_batch after RCU callbacks have been * invoked. The first argument is the name of the RCU flavor, diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 57cfa467697b..975621ef40e3 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -3597,9 +3597,11 @@ static void synchronize_rcu_normal(void) { struct rcu_synchronize rs; + trace_rcu_sr_normal(rcu_state.name, &rs.head, TPS("request")); + if (!READ_ONCE(rcu_normal_wake_from_gp)) { wait_rcu_gp(call_rcu_hurry); - return; + goto trace_complete_out; } init_rcu_head_on_stack(&rs.head); @@ -3618,6 +3620,9 @@ static void synchronize_rcu_normal(void) /* Now we can wait. */ wait_for_completion(&rs.completion); destroy_rcu_head_on_stack(&rs.head); + +trace_complete_out: + trace_rcu_sr_normal(rcu_state.name, &rs.head, TPS("complete")); } /** -- 2.39.2