From patchwork Mon Dec 12 18:03:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 32468 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2388001wrr; Mon, 12 Dec 2022 10:08:27 -0800 (PST) X-Google-Smtp-Source: AA0mqf59yYws68TE215YIZiNC+5CDbpYU5k86hMg7RTXl3Dsqez/zjQ++UhbuuXtetOHFyQWkLNN X-Received: by 2002:a05:6a00:2189:b0:56d:59f0:d291 with SMTP id h9-20020a056a00218900b0056d59f0d291mr19612395pfi.18.1670868507253; Mon, 12 Dec 2022 10:08:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670868507; cv=none; d=google.com; s=arc-20160816; b=LQ+EFEUWSsFUHlpW/8G7zdQERbtDSiSYjRC9r1ffU7Amp1sSJc8MZYLJb58m4nBWUe L4O8tw/xHRKF840NvFLkvphEKyEX7GI2IsCf9uQwTs9CYIgb0DIxAwSWTQsC+EmkTP+b xuS9dsOnx8aG2T14+xLjzu6ZE85cjN/JX2om+U3jP1S4NPgtCnyO0SxibQSz52sfp7k0 QGQYNv1n9oOuE9GjtQIO43tkoSP1SpztOB3RCyfuKOZ3XWGNAaHMgGNn0ohGobHdwb+T vzfb+SeqYPZiC/IbLWPou+MaoNXgCq0KQfsqZR3/igcAxmls6oLy9Ulg65bIZig6Jwcj wFzw== 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=lCaMuc5Ptmf2yJHIrlwepEsGIAdp8OMY/v56Zi/xlXg=; b=GSr06Kk8IqKnfyOaBdr6xKSvi/UmfpW2gAMRQRlJWf6CEBGzMVE2SJmvvo+I6JXEQZ iAGlDwcA/LgDTxfQH3ZOV1DXdvI798T9b6rOTDqnMKYhHQJ24wShocS+/9VvhWaSgr7q C5b9N9Pojkqsf90lMO/hnwxwiCmtT+6OcHVui/PlNMKUmWDkIqkJhbW2+CZvVTGXe+ET 6uLwoDoYFld7hBFC1ydj1+i9VzsESIgb26ST9EinUwM02zoYmIijZ3pTpxDdrJAJFlZU m+eXWKB4YugZ9zc8INAewuGK9ArnwDuLYYodfozeAum0gkrTMzenhOMgj4B3bCup9aP1 O+Xw== 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 a6-20020aa794a6000000b0057513273bb7si9843326pfl.132.2022.12.12.10.08.13; Mon, 12 Dec 2022 10:08:27 -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 S232983AbiLLSEC (ORCPT + 99 others); Mon, 12 Dec 2022 13:04:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232969AbiLLSD6 (ORCPT ); Mon, 12 Dec 2022 13:03:58 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B453110F; Mon, 12 Dec 2022 10:03:57 -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 D3401611A0; Mon, 12 Dec 2022 18:03:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91FC8C433EF; Mon, 12 Dec 2022 18:03:55 +0000 (UTC) Date: Mon, 12 Dec 2022 13:03:52 -0500 From: Steven Rostedt To: LKML , Linux Trace Kernel Cc: Masami Hiramatsu , Andrew Morton , Douglas Raillard , Valentin Schneider Subject: [PATCH] tracing: Remove pointer (asterisk) from cpumask_t field Message-ID: <20221212130352.606d7ce2@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?1752032616032725937?= X-GMAIL-MSGID: =?utf-8?q?1752032616032725937?= 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. Instead, create another helper called __dynamic_array_sign() that can be used directly by the __cpumaks() field macro where it passes in an unsigned value to avoid using the is_signed_type() and have the __dynamic_array() macro call it by passing it the is_signed_type() on the type. This now produces: field:__data_loc cpumask_t[] mask; offset:36; size:4; signed:0; Which is the correct type of the field. 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) --- include/trace/stages/stage4_event_fields.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/include/trace/stages/stage4_event_fields.h b/include/trace/stages/stage4_event_fields.h index f2990d22313c..9f0049c309f0 100644 --- a/include/trace/stages/stage4_event_fields.h +++ b/include/trace/stages/stage4_event_fields.h @@ -28,11 +28,15 @@ .size = sizeof(_type[_len]), .align = ALIGN_STRUCTFIELD(_type), \ .is_signed = is_signed_type(_type), .filter_type = FILTER_OTHER }, -#undef __dynamic_array -#define __dynamic_array(_type, _item, _len) { \ +#undef __dynamic_array_sign +#define __dynamic_array_sign(_type, _item, _len, _sign) { \ .type = "__data_loc " #_type "[]", .name = #_item, \ .size = 4, .align = 4, \ - .is_signed = is_signed_type(_type), .filter_type = FILTER_OTHER }, + .is_signed = _sign, .filter_type = FILTER_OTHER }, + +#undef __dynamic_array +#define __dynamic_array(_type, _item, _len) \ + __dynamic_array_sign(_type, item, len, is_signed_type(_type)) #undef __string #define __string(item, src) __dynamic_array(char, item, -1) @@ -47,7 +51,7 @@ #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) __dynamic_array_sign(cpumask_t, item, -1, 0) #undef __sockaddr #define __sockaddr(field, len) __dynamic_array(u8, field, len)