From patchwork Thu Sep 21 08:51:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 143041 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5237799vqi; Thu, 21 Sep 2023 17:46:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFMfv5tp/pzMEigqRJICfjx5Fn/RI1z7BstOPNeZzNMsOx4oAH9r7Adliio+877QsOjKEmh X-Received: by 2002:a17:90a:e512:b0:26b:56fa:87d3 with SMTP id t18-20020a17090ae51200b0026b56fa87d3mr6745376pjy.31.1695343617135; Thu, 21 Sep 2023 17:46:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695343617; cv=none; d=google.com; s=arc-20160816; b=tue/IetuFHkZ9epub3YLuu7qcIH+hTiODtKfoQlIgrPea3qk/J93SODStgAmH7sPNA gqShPN/WqS/e4u7dbFY9V6R01UgP7lw/BI5PFB8d/1PQoHMbdsL9Lzd/i5ciDlwItF32 RHe2C+Mydp09oHixMX+BklhkmWSU717AiTHpjI30cDQWHkySsLGlwVD8r1WIDiHHxJmD 1Cb1E2Zizs8gj5F5vQYOnM4BWw3Gt3fEG7vDdziIlHoCqSZvqXbiVrvnsoABXLyFjQ33 k9XPu4Atga7JCjwMGRbl2nthWV+n/wl/q1TDaHpqvwyYcJWien2Fa6QArhCESN+uMXOE Bzlg== 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=nqDTsSYtIrtsgJfRZxQSmVfUy4UI0fM8vU1yAMBIetU=; fh=JN7tMyF6zC6ERZ5PXsr4V7IKiYp4vRUwR5tQFwkRxbI=; b=P7t+57kK5fwnpo2QlFB8HmSXln7Ajauih4cQutGXMJEHu0xQ/HHnKzEk2h3CCGMlQC fwMlOTvO+Q2tvjQbcZA5XDX1tz9LWrJMYE4ZzBMNI+p7LPskFVP4rnw48fSMw+iKWjRj qmcM/Va25aFHhbPPxi+Keu5SJSFuspUz1X5JIRrdAUq430mANW4EK/15MvC/53f2y6dX ot7rF6OtujEXYsXc6x0wNKSy9zL6qNjbjsbLIftYksEg8L1/vmK+EfOYR+F1sAzUfoXg abDHFM0ux9DuOz9ewwR43822Dx5kODZ+1j4KEPJgQqMMLQFQsCdr9J47FKBP3wh7fkmt OpCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=EXKAgTuP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id h13-20020a17090acf0d00b00263fa42fdcbsi4983893pju.107.2023.09.21.17.46.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 17:46:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=EXKAgTuP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 5E3F080A7CF0; Thu, 21 Sep 2023 15:30:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231752AbjIUWab (ORCPT + 29 others); Thu, 21 Sep 2023 18:30:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232329AbjIUWaY (ORCPT ); Thu, 21 Sep 2023 18:30:24 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:242:246e::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3F4465A5; Thu, 21 Sep 2023 10:09:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=nqDTsSYtIrtsgJfRZxQSmVfUy4UI0fM8vU1yAMBIetU=; t=1695316163; x=1696525763; b=EXKAgTuPVVfy8ylWiMVnePM2S25FQbqLGHAhT1vpoj7XbtN noPgP9Jg0aEsCyUWzDGafbS9LhYXtZGmWlZIHEcZ5/9Hl2KjA4Jez+eevbJN0LyTUwZyaJ2h/dFv5 nUADlD6Z2jmONDwwQ8LGjyibG8/cSVRhcY925jJ0P8uCjkIcSt7GeuD/wen370bqujHA+uGuKFFkj lmki8Q/Vl8R7xDOJxOwFmgGXlbDxpvhyFLAJauCE6D1i/0sf9THBR/UJz4b/qdU1ZHYh6F6Czc2gE OmP0MD0ktlF4pyiL4bhjTWW8EiPtkJVX4+5BsSpAvxGYWkvxkjH0637rQA7vGoxg==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1qjFPo-00D3lb-0V; Thu, 21 Sep 2023 10:52:04 +0200 From: Johannes Berg To: linux-kernel@vger.kernel.org Cc: linux-trace-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, Johannes Berg Subject: [RFC PATCH 4/4] tracing/timer: use __print_sym() Date: Thu, 21 Sep 2023 10:51:34 +0200 Message-ID: <20230921105129.e76b17c18447.I5e112e423a69704fa05db74a05a6ebaad45d4f6e@changeid> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230921085129.261556-5-johannes@sipsolutions.net> References: <20230921085129.261556-5-johannes@sipsolutions.net> MIME-Version: 1.0 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Thu, 21 Sep 2023 15:30:47 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777696628610595045 X-GMAIL-MSGID: 1777696628610595045 From: Johannes Berg Use the new __print_sym() in the timer tracing, just to show how to convert something. This adds ~80 bytes of .text for a saving of ~1.5K of data in my builds. Note the format changes from print fmt: "success=%d dependency=%s", REC->success, __print_symbolic(REC->dependency, { 0, "NONE" }, { (1 << 0), "POSIX_TIMER" }, { (1 << 1), "PERF_EVENTS" }, { (1 << 2), "SCHED" }, { (1 << 3), "CLOCK_UNSTABLE" }, { (1 << 4), "RCU" }, { (1 << 5), "RCU_EXP" }) to print fmt: "success=%d dependency=%s", REC->success, __print_symbolic(REC->dependency, { 0, "NONE" }, { 1, "POSIX_TIMER" }, { 2, "PERF_EVENTS" }, { 4, "SCHED" }, { 8, "CLOCK_UNSTABLE" }, { 16, "RCU" }, { 32, "RCU_EXP" }) Since the values are now just printed in the show function as pure decimal values. Signed-off-by: Johannes Berg --- include/trace/events/timer.h | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/include/trace/events/timer.h b/include/trace/events/timer.h index b4bc2828fa09..cb8294da29d0 100644 --- a/include/trace/events/timer.h +++ b/include/trace/events/timer.h @@ -382,26 +382,18 @@ TRACE_EVENT(itimer_expire, #undef tick_dep_mask_name #undef tick_dep_name_end -/* The MASK will convert to their bits and they need to be processed too */ -#define tick_dep_name(sdep) TRACE_DEFINE_ENUM(TICK_DEP_BIT_##sdep); \ - TRACE_DEFINE_ENUM(TICK_DEP_MASK_##sdep); -#define tick_dep_name_end(sdep) TRACE_DEFINE_ENUM(TICK_DEP_BIT_##sdep); \ - TRACE_DEFINE_ENUM(TICK_DEP_MASK_##sdep); -/* NONE only has a mask defined for it */ -#define tick_dep_mask_name(sdep) TRACE_DEFINE_ENUM(TICK_DEP_MASK_##sdep); - -TICK_DEP_NAMES - -#undef tick_dep_name -#undef tick_dep_mask_name -#undef tick_dep_name_end - #define tick_dep_name(sdep) { TICK_DEP_MASK_##sdep, #sdep }, #define tick_dep_mask_name(sdep) { TICK_DEP_MASK_##sdep, #sdep }, #define tick_dep_name_end(sdep) { TICK_DEP_MASK_##sdep, #sdep } +TRACE_DEFINE_SYM_LIST(tick_dep_names, TICK_DEP_NAMES); + +#undef tick_dep_name +#undef tick_dep_mask_name +#undef tick_dep_name_end + #define show_tick_dep_name(val) \ - __print_symbolic(val, TICK_DEP_NAMES) + __print_sym(val, tick_dep_names) TRACE_EVENT(tick_stop,