From patchwork Tue Dec 28 19:36:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Hostetler X-Patchwork-Id: 12700556 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9AB6C433EF for ; Tue, 28 Dec 2021 19:36:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237173AbhL1Tgq (ORCPT ); Tue, 28 Dec 2021 14:36:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235996AbhL1Tgq (ORCPT ); Tue, 28 Dec 2021 14:36:46 -0500 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C86C7C061574 for ; Tue, 28 Dec 2021 11:36:45 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id w20so31164887wra.9 for ; Tue, 28 Dec 2021 11:36:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=KwlOealDsYSlT3vr/iAxRQ7tZPRCqQeJ/p6VpI0LNjY=; b=DPyCII7CX32P4LvzU+YJotQb0o5D2q2YPpGqLt7rcjOTSKtoXWc6GjaqE5z8fOqJyR ON8iC0MSolVrAKOFQq5c8H07kmzQg2QhYJzF7BneMSfSt9NkRi6bdau9T1ovHTLaLWV3 YRr7GT3ZDQmWYfOgdXz548U8rcfvsbgqz2M6m72bVrT8g43RhfRMGc64b3dobohKFGVA MEcS4H6kYEIq6VXST83AVXzqnlMC1T2ERHhS7onrEO5AqYq89aF9iEeRMxi4KaPdgTKX kd2fQjduDdvim6rIBm2Vii56VvisWuDkU35tzx1qvQ1EJhmUA+l6C8AMV/n40H4NlOuy UTyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=KwlOealDsYSlT3vr/iAxRQ7tZPRCqQeJ/p6VpI0LNjY=; b=ctUCaUawjK8g+vw0/DjUGUaa383Y3dlLsoFLz+mdfC8jlTCzEvEQblJxojnk4gtQ3u HFgRkiifmht/nbnNzdkskDETt50Fe3jllQm8VJvAToil/ymlj5DD1GPZyyDeDASstil9 OPeOE2EOonMQCUVvX2GtEGperj22alcwEOc0QYmVcLBFSVZSF2fzaAYZWhy7Zs9JXoBG UhK89ZvgH0mblamwKlB4S0RUTTCfXyxOiNj381kc7jvk6zgaegbiQaZpVwYh4CYt/HHQ gQYZdPonk/aFrM++iBMnKUqUbCy8e1cPL+pKAIfuxhwcXwcIPDJd7M/VcR37EQG6SBOq V/vQ== X-Gm-Message-State: AOAM5300iJfgjtq/M6XRqMXqNNOSBZkdAusUcNIzKMcEZuN4GhRGtMFw jahRsyMdv/puwLxYil3CPk9h2I7VpNw= X-Google-Smtp-Source: ABdhPJyRpdXG8ZTFIW8c6hvLgA4zQhtnNZIju2gvEBaqUaqx8KLYuQlHXguQm+Me8WeBcOVZHw5rHA== X-Received: by 2002:adf:f70b:: with SMTP id r11mr18231277wrp.496.1640720204252; Tue, 28 Dec 2021 11:36:44 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id m3sm18902719wrv.95.2021.12.28.11.36.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Dec 2021 11:36:44 -0800 (PST) Message-Id: <96f6896a13e68263b96827e0c66f20178fb9dfd1.1640720202.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Tue, 28 Dec 2021 19:36:34 +0000 Subject: [PATCH v2 1/9] trace2: use size_t alloc,nr_open_regions in tr2tls_thread_ctx Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Jeff Hostetler , Derrick Stolee , Matheus Tavares , Johannes Sixt , Jeff Hostetler , Jeff Hostetler Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Jeff Hostetler From: Jeff Hostetler Use "size_t" rather than "int" for the "alloc" and "nr_open_regions" fields in the "tr2tls_thread_ctx". These are used by ALLOC_GROW(). This was discussed in: https://lore.kernel.org/all/YULF3hoaDxA9ENdO@nand.local/ Signed-off-by: Jeff Hostetler --- trace2/tr2_tls.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trace2/tr2_tls.h b/trace2/tr2_tls.h index b1e327a928e..a90bd639d48 100644 --- a/trace2/tr2_tls.h +++ b/trace2/tr2_tls.h @@ -11,8 +11,8 @@ struct tr2tls_thread_ctx { struct strbuf thread_name; uint64_t *array_us_start; - int alloc; - int nr_open_regions; /* plays role of "nr" in ALLOC_GROW */ + size_t alloc; + size_t nr_open_regions; /* plays role of "nr" in ALLOC_GROW */ int thread_id; }; From patchwork Tue Dec 28 19:36:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Hostetler X-Patchwork-Id: 12700557 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04870C433F5 for ; Tue, 28 Dec 2021 19:36:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237179AbhL1Tgr (ORCPT ); Tue, 28 Dec 2021 14:36:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237175AbhL1Tgr (ORCPT ); Tue, 28 Dec 2021 14:36:47 -0500 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 751ABC061574 for ; Tue, 28 Dec 2021 11:36:46 -0800 (PST) Received: by mail-wr1-x431.google.com with SMTP id s1so40171101wra.6 for ; Tue, 28 Dec 2021 11:36:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=GFBd797eHYnH0eNzK9O41oTMilucb0iYBWz2vFrtEVo=; b=NEYDXU57NWPsDqKP4Nr5VNQOYV56+3dXHGlNYLi5QDYuvaAX54x0kQT6aCrIY+JbEO wSAPOovTra8v6omRyimND2hcBeoJu09OhUGDoGPW1lKU+mNOUKlF6KNntiS9U7L+GPoD 7hkjujBSQ2fGUB6H/z4g+1SocfuCTHAWTzbQ+TAWNA5MQOx2ywXdjcFGnfqf9YoUmGiK lmLx3AkXYYWWzLLaWv8arNoxidVAlnEi4OBbnUrjLhWP5ygMba4uidTdZqWkb5/1sFx3 1vY0yMyeNpTTuadW293jT03+/pF6HFEaTC4ImKwgXDwM4aGhLgJPVESnQYmrPJ2TKjha QkYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=GFBd797eHYnH0eNzK9O41oTMilucb0iYBWz2vFrtEVo=; b=7dfgc52IFugQk5R3NxYxNiGa4nFA47n630icpVj5uKq3paDBSovWaHp7u5MRoyi2HA JV1w5MHPKtzV8YZLECcQ+dRuxCPYRShZj9IA4MyeZJJSXWKiInhenSsKXReBtBSdkbtP 2GBxcYYNWONYAXC7GQkCrCzoeoimGteZliKXsh0F6BoRyILMgzlhXq94HECGaN1otOzO n2eWIt1xbf1av1NZ1WW3B7CW8ROTyXg0X5WVbd6/T1z/LhT1DNTLozwCZ5v8rDqvRKhi A1JNNhvL7yVbMyNVDVToa2TZuXG2t3e4RtKEkJNxgr01jxZgz2kGznF+afZrZGoHRvQN 5ymw== X-Gm-Message-State: AOAM533mxc45GkiCTiJuAcMoqH9Vzu9TMs2o0WxoX+QZlWBLPwGdjnub r9vvHJ2PO+TJEge1SIxRfedkh/hf7R8= X-Google-Smtp-Source: ABdhPJzbL+4KOj2HAufKYwOevV3vNbQLXllZELME/GYyOI5fIsqgABIbc4pDltXx/nlN15EphUl66Q== X-Received: by 2002:a5d:6e8c:: with SMTP id k12mr17189356wrz.664.1640720204832; Tue, 28 Dec 2021 11:36:44 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id o38sm17688444wms.11.2021.12.28.11.36.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Dec 2021 11:36:44 -0800 (PST) Message-Id: In-Reply-To: References: Date: Tue, 28 Dec 2021 19:36:35 +0000 Subject: [PATCH v2 2/9] trace2: convert tr2tls_thread_ctx.thread_name from strbuf to flex array Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Jeff Hostetler , Derrick Stolee , Matheus Tavares , Johannes Sixt , Jeff Hostetler , Jeff Hostetler Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Jeff Hostetler From: Jeff Hostetler Move the thread name to a flex array at the bottom of the Trace2 thread local storage data and get rid of the strbuf. Let the flex array have the full computed value of the thread name without truncation. Change the PERF target to truncate the thread name so that the columns still line up. Signed-off-by: Jeff Hostetler --- trace2/tr2_tgt_event.c | 2 +- trace2/tr2_tgt_perf.c | 7 ++++--- trace2/tr2_tls.c | 25 +++++++++++++------------ trace2/tr2_tls.h | 10 +--------- 4 files changed, 19 insertions(+), 25 deletions(-) diff --git a/trace2/tr2_tgt_event.c b/trace2/tr2_tgt_event.c index 3a0014417cc..ca48d00aebc 100644 --- a/trace2/tr2_tgt_event.c +++ b/trace2/tr2_tgt_event.c @@ -88,7 +88,7 @@ static void event_fmt_prepare(const char *event_name, const char *file, jw_object_string(jw, "event", event_name); jw_object_string(jw, "sid", tr2_sid_get()); - jw_object_string(jw, "thread", ctx->thread_name.buf); + jw_object_string(jw, "thread", ctx->thread_name); /* * In brief mode, only emit