Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1420935pxj; Sat, 29 May 2021 13:03:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXcs7B3oKofgeQd6ZTwF9/HtnTxcH+TzHtUXM+3zY3BGkvkwE9dZOZ1c+LPjC9KSg+nTzw X-Received: by 2002:a05:6638:37a9:: with SMTP id w41mr14338962jal.12.1622318602363; Sat, 29 May 2021 13:03:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622318602; cv=none; d=google.com; s=arc-20160816; b=JZXyT6KNjW0i/ymwipfN7vfqT7ROzbnXuWJkLXUiUIvf7QY5n9IW24tcKUBe4PLgaK GSwOZcfcgoyrEiD/xEI+JHOJ/3Cf9ATrbFrXE73K9Xis4J8yFb7hetYPcCORcjjblWKu LA1s0e+VRkI2PTdUtL++Fn5G9oSRXCJMzqaxtm7crlD//IYocBvvAah71Npn2oMKtXjK erfPB3bdtrbfj2N8q0ZMPVBeGOUZgbW1RlrZPs4oD0fULFhVCFnJBQJH1amsO3AcFaWI 2gfPsoW1QCmuEHhNI2CehA/emTvvqgmQznjmvA80rrdxt6Mi8jAUtgwL1AKreOOJKWMv ZtBg== 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=VyRXJp6htE6KGEVxutq71HmemF0u/5uG6qw2x18RinI=; b=sEXmL2LbeVTTu7R288U5l2ooaf88mJzjDVVPLbUPuz3UbSoYFjaj+hsrxrG+U1q4/y gv9UBOa4ZIvtVTKASqnWvWKtP1/GTIYhvMJUJFN03ohri3YwBvPDjlLA4K3xE4yw4L3a c4KvhejIjRx/8G8wWnMgxqBaDWYKAplmTEa4wwBt4jfo4hE9bp6UFFdekJtq+Si0rXLI 7E4FvjCcDKcbkawGWGustSskugQdhDZ2Rv/YMn3EGxoJQ9U+kpsh4gcrRiSYkMROX9F8 SgmTEAMQiatQnH3L8c9/uwiDa28Y6B8LcPnZHCPqu9ORt/Efr4NfzD21JXxjH6gwEovB emHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=S56wS5tf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r18si1687433ilj.3.2021.05.29.13.03.05; Sat, 29 May 2021 13:03:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=S56wS5tf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229862AbhE2UEA (ORCPT + 99 others); Sat, 29 May 2021 16:04:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229823AbhE2UD4 (ORCPT ); Sat, 29 May 2021 16:03:56 -0400 Received: from mail-ot1-x332.google.com (mail-ot1-x332.google.com [IPv6:2607:f8b0:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 504C5C06174A for ; Sat, 29 May 2021 13:02:19 -0700 (PDT) Received: by mail-ot1-x332.google.com with SMTP id c31-20020a056830349fb02903a5bfa6138bso49159otu.7 for ; Sat, 29 May 2021 13:02:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VyRXJp6htE6KGEVxutq71HmemF0u/5uG6qw2x18RinI=; b=S56wS5tfvRCv74f8oCCpXyRY2Vj3RcS8lB4WWz9hgnTJwErqq+igUPqifqZjZwHiJn moLB9VH+niby5LBHuxEsfXia6Sh3/uaaxyHQq3Raxm9zkmjtAShG8Czk20lVgwYx+0uN YD4Z+Y1VoJ5VCIg4qORAPhEK9Lb+dqIzzTfx2PqDmgx0AHXsE9ogKdbXjcSJbLJrbLpg jDTxaasQO+8ZX/aMh+7zvTWjQzwfQ5McZSKoC6o1uL+m0QC2kJqkuZ/rMkuxPx0Om8/g Q0JqiXwK+MZ8hMfTMYgDVBgRwBaEL9mnOxFelShOZddJcs0tdMhGtyM/hPAO61k9rbQf 5h/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VyRXJp6htE6KGEVxutq71HmemF0u/5uG6qw2x18RinI=; b=TPDpH3PzyWJBIA/oni9yluayBxo/e/SPqq5S4iAIOdcHMKGaVVioCpeqRnfyJEeQyv X8Ap5NghD/YUfqwCqIrWvfyOxQzYn0LqfAWfkNp7i3EyykSh00x8uObxyG8CIeABykU0 36U8SJ19U2hlg/FslSRXOrMWjl268hHz022MgjRYHNet48Zetjaz0CCM4fdS04sIDxO3 fIMDDds3rKLPdurogGd9IX+dsRwzK1FbSnE4CB/EvvNaNsv4yMBB+AofcOVjcItGvQUg x0f+5eFEtCtzgWUBXF2BmlGSMP4mjjJNidrlYSLOLknoLQWJvJ4cRvRyju9maTxWN7LC djUg== X-Gm-Message-State: AOAM532JErnCQtrUU4k6pIUax85i/XmP/lfxpyWbOBRerxov5EL/OwIV Y1xnh3b6sN1z6UFUPd8mdGA= X-Received: by 2002:a9d:4008:: with SMTP id m8mr2731336ote.188.1622318538672; Sat, 29 May 2021 13:02:18 -0700 (PDT) Received: from frodo.. (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id t39sm1868064ooi.42.2021.05.29.13.02.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 May 2021 13:02:18 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: Jim Cromie Subject: [RFC PATCH v6 05/34] dyndbg: __init iterate over __dyndbg & __dyndbg_site in parallel Date: Sat, 29 May 2021 14:00:00 -0600 Message-Id: <20210529200029.205306-6-jim.cromie@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210529200029.205306-1-jim.cromie@gmail.com> References: <20210529200029.205306-1-jim.cromie@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In HEAD~1, a new elf section was added, and dynamic_debug_init() got minimal adjustments; basically s/iter/iter->site/ where needed. Now we rework the for-loop for clarity: . iterate over both sections in parallel (iter & site) . demote iter->site indirection (1st step towards dropping site) . add __(start|stop)___dyndbg_sites decls (init'd in vmlinux.lds.h) . add/rename several iterator/mod_start variables for clarity. . add BUG_ON(iter->site != site) . var rename n to site_ct Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 691e43d58eef..f7ece35bc722 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -41,6 +41,8 @@ extern struct _ddebug __start___dyndbg[]; extern struct _ddebug __stop___dyndbg[]; +extern struct _ddebug_site __start___dyndbg_sites[]; +extern struct _ddebug_site __stop___dyndbg_sites[]; struct ddebug_table { struct list_head link; @@ -118,6 +120,7 @@ do { \ #define vpr_info(fmt, ...) vnpr_info(1, fmt, ##__VA_ARGS__) #define v2pr_info(fmt, ...) vnpr_info(2, fmt, ##__VA_ARGS__) +#define v3pr_info(fmt, ...) vnpr_info(3, fmt, ##__VA_ARGS__) static void vpr_info_dq(const struct ddebug_query *query, const char *msg) { @@ -1086,11 +1089,12 @@ static int __init dynamic_debug_init_control(void) static int __init dynamic_debug_init(void) { - struct _ddebug *iter, *iter_start; + struct _ddebug *iter, *iter_mod_start; + struct _ddebug_site *site, *site_mod_start; const char *modname = NULL; char *cmdline; int ret = 0; - int n = 0, entries = 0, modct = 0; + int site_ct = 0, entries = 0, modct = 0; if (&__start___dyndbg == &__stop___dyndbg) { if (IS_ENABLED(CONFIG_DYNAMIC_DEBUG)) { @@ -1101,23 +1105,29 @@ static int __init dynamic_debug_init(void) ddebug_init_success = 1; return 0; } - iter = __start___dyndbg; - modname = iter->site->modname; - iter_start = iter; - for (; iter < __stop___dyndbg; iter++) { + + iter = iter_mod_start = __start___dyndbg; + site = site_mod_start = __start___dyndbg_sites; + modname = site->modname; + + for (; iter < __stop___dyndbg; iter++, site++) { + + BUG_ON(site != iter->site); entries++; - if (strcmp(modname, iter->site->modname)) { + + if (strcmp(modname, site->modname)) { modct++; - ret = ddebug_add_module(iter_start, n, modname); + ret = ddebug_add_module(iter_mod_start, site_ct, modname); if (ret) goto out_err; - n = 0; - modname = iter->site->modname; - iter_start = iter; + site_ct = 0; + modname = site->modname; + iter_mod_start = iter; + site_mod_start = site; } - n++; + site_ct++; } - ret = ddebug_add_module(iter_start, n, modname); + ret = ddebug_add_module(iter_mod_start, site_ct, modname); if (ret) goto out_err; -- 2.31.1