From patchwork Tue Dec 13 00:38:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 32588 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2553901wrr; Mon, 12 Dec 2022 16:44:58 -0800 (PST) X-Google-Smtp-Source: AA0mqf7RFTHhT933d7SnZbZ8O+RWuowvz9zUPRpUcME9RlwGUyySe2eRI1bEcaDOQATskiTPsjji X-Received: by 2002:a17:906:b181:b0:7c1:65f7:18d8 with SMTP id w1-20020a170906b18100b007c165f718d8mr7788315ejy.60.1670892298494; Mon, 12 Dec 2022 16:44:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670892298; cv=none; d=google.com; s=arc-20160816; b=LtmNIy5NShM9HonH8lMBbY5xa8ODK0Qbyv8NOCgaLiJgFbSDySUxj9LN1c7GBbY63+ wQ2wlvuOSaZirI6DDV1jx25YzIcEiOlOSQAcTydiZzqtQDZoflF6LZeVz/hLYzFp5CjE yRDdMTa5EEBzwB0H5/3CRhW983JOhicDr2kObHqhwYJhWm7xP7tfZvsy4R1KPuSoi9Ov WD6zBne8/6ayBW7pHL++UqznpSK5R/b9wZKQ288mOv8Vj7XYxSbqud0a1FRoixic7UBx VcvumB720Kl5Rwr4xc77bS1JTWMSAmN4jf56wkdMEgZ8BXUXLrKxcoHvyxpOrlYy/0XJ qvXA== 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 :message-id:subject:cc:to:from:date; bh=zKwANoZXcQZgtBRoH7wGIbGR0ue1ijSpRWB2p/f1F8A=; b=lUBey3GD/ZB/syi7g9hzw1fw7o3OOMUGU+kiHAQXu+HV1KUTHtk5rdMVqQ9M4uO1iR 5Ej9SuvikW8Sj+EIIvhPpf3gDVQnuNXaJm84QrYgvPnpZFY5L8205cba7Q9PLV/Zgvc2 V+BuXzX8BdKRNS1sRBGzznUCZK+mHXnW46C7/9qsnaTlqGcN5e8dd/1HQJT0o8ax4jIn MC/+GkTxn32HPWA3GUSLT4DdKfhKj7u9NcRtRqLRjve7wWqy798lz2U/iriQQYU0i3lG tHa4eGsbALwbfXCi3VFxCBWGHLeoUSHlJKkRFB/fOasXmuvbeHVhTS5zf9jDcF+JIqeI KmZA== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r14-20020a50d68e000000b004697dff9638si7625205edi.87.2022.12.12.16.44.35; Mon, 12 Dec 2022 16:44:58 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233771AbiLMAim (ORCPT + 99 others); Mon, 12 Dec 2022 19:38:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233696AbiLMAiV (ORCPT ); Mon, 12 Dec 2022 19:38:21 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 258BCFD08; Mon, 12 Dec 2022 16:38:20 -0800 (PST) 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 B75B9612D0; Tue, 13 Dec 2022 00:38:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60E75C433D2; Tue, 13 Dec 2022 00:38:18 +0000 (UTC) Date: Mon, 12 Dec 2022 19:38:14 -0500 From: Steven Rostedt To: LKML , Linux Trace Kernel Cc: Masami Hiramatsu , Douglas Raillard , Valentin Schneider , Andrew Morton Subject: [PATCH v3] tracing: Remove pointer (asterisk) and brackets from cpumask_t field Message-ID: <20221212193814.0e3f1e43@gandalf.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752057562680669763?= X-GMAIL-MSGID: =?utf-8?q?1752057562680669763?= From: "Steven Rostedt (Google)" To differentiate between long arrays and cpumasks, the __cpumask() field was created. Part of the TRACE_EVENT() macros test if the type is signed or not by using the is_signed_type() macro. The __cpumask() field used the __dynamic_array() helper but because cpumask_t is a structure, it could not be used in the is_signed_type() macro as that would fail to build, so instead it passed in the pointer to cpumask_t. Unfortunately, that creates in the format file: field:__data_loc cpumask_t *[] mask; offset:36; size:4; signed:0; Which looks like an array of pointers to cpumask_t and not a cpumask_t type, which is misleading to user space parsers. Douglas Raillard pointed out that the "[]" are also misleading, as cpumask_t is not an array. Since cpumask() hasn't been created yet, and the parsers currently fail on it (but will still produce the raw output), make it be: field:__data_loc cpumask_t mask; offset:36; size:4; signed:0; Which is the correct type of the field. Then the parsers can be updated to handle this. Link: https://lore.kernel.org/lkml/6dda5e1d-9416-b55e-88f3-31d148bc925f@arm.com/ Fixes: 8230f27b1ccc ("tracing: Add __cpumask to denote a trace event field that is a cpumask_t") Reported-by: Douglas Raillard Signed-off-by: Steven Rostedt (Google) --- Changes since v2: https://lore.kernel.org/linux-trace-kernel/20221212150453.1df47ddf@gandalf.local.home - Remove the '[]' from the field, as it is not an array, but is dynamically allocated. - also handle the __rel_cpumask() macro, which was missed in the previous patches. include/trace/stages/stage4_event_fields.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/trace/stages/stage4_event_fields.h b/include/trace/stages/stage4_event_fields.h index f2990d22313c..affd541fd25e 100644 --- a/include/trace/stages/stage4_event_fields.h +++ b/include/trace/stages/stage4_event_fields.h @@ -47,7 +47,10 @@ #define __bitmask(item, nr_bits) __dynamic_array(unsigned long, item, -1) #undef __cpumask -#define __cpumask(item) __dynamic_array(cpumask_t *, item, -1) +#define __cpumask(item) { \ + .type = "__data_loc cpumask_t", .name = #item, \ + .size = 4, .align = 4, \ + .is_signed = 0, .filter_type = FILTER_OTHER }, #undef __sockaddr #define __sockaddr(field, len) __dynamic_array(u8, field, len) @@ -68,7 +71,10 @@ #define __rel_bitmask(item, nr_bits) __rel_dynamic_array(unsigned long, item, -1) #undef __rel_cpumask -#define __rel_cpumask(item) __rel_dynamic_array(cpumask_t *, item, -1) +#define __rel_cpumask(item) { \ + .type = "__rel_loc cpumask_t", .name = #item, \ + .size = 4, .align = 4, \ + .is_signed = 0, .filter_type = FILTER_OTHER }, #undef __rel_sockaddr #define __rel_sockaddr(field, len) __rel_dynamic_array(u8, field, len)