From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C9D2C433B4 for ; Tue, 11 May 2021 18:51:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A6AD261185 for ; Tue, 11 May 2021 18:51:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A6AD261185 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CEF736B0089; Tue, 11 May 2021 14:51:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CCB386B008A; Tue, 11 May 2021 14:51:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B3CFA8D0001; Tue, 11 May 2021 14:51:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0018.hostedemail.com [216.40.44.18]) by kanga.kvack.org (Postfix) with ESMTP id 983566B0089 for ; Tue, 11 May 2021 14:51:38 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id DF8C28249980 for ; Tue, 11 May 2021 18:51:37 +0000 (UTC) X-FDA: 78129843834.25.E6805A6 Received: from mail-io1-f54.google.com (mail-io1-f54.google.com [209.85.166.54]) by imf25.hostedemail.com (Postfix) with ESMTP id 47CC3600249C for ; Tue, 11 May 2021 18:51:29 +0000 (UTC) Received: by mail-io1-f54.google.com with SMTP id n40so3409704ioz.4 for ; Tue, 11 May 2021 11:51:37 -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=rH6B1Y8q3MjL1HohSGCYSWCX5UPnZylow4i2opQMHbM=; b=NFlJHIjk/PDNRHFQangXdJx77gLySvGEbGxTDWq2llBhEQBjAgXbb95fn8TFFfLWUo 6U3Uaqb9RB/7q0/uHQ65B3loUBI6KKaOEkbEUMqJAZUiXMZAL/RKtMxUgda32/YUwt9L Z/BqBbbBBxzlcpK+7pOgcs9lNwswGZZnonlSCqdjAfgw6vwxDrlIwls/qsx3p4Pl0sqr 8psBZDphKP6BGGVFyTcvF2ReDgNeLCaN3v9vUkFAzw5zdLW0y1LsZxxGv0VQ5kmlzng+ omP5/ubfaS8yrZ293O3EZK7lVQYwJYnYtE+3hqPl0Su5n/Oq2voBrGUMP1QfuxgBqq21 nPjw== 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=rH6B1Y8q3MjL1HohSGCYSWCX5UPnZylow4i2opQMHbM=; b=gCrGtJ60HLjk/sEGyzPwyHOVW1H0WR7FQqeoMxEAGmN8Eap+stk+9oFQjrAX4kAknK 5oF4X7IyohNBNq0OgUVw9nSKrSOSFIZiZZ5KVXsDXI3f7PKmoAi5GtG+hagHIiO8B9fN r4GzIF9tDSIhbSH8g0li4Dd7Z0icSd4Na29buc+LgxLOpTA/e7jjlbZNIjcVpY6bERFp Fz5QL3BblHeRg99zM1W0ymtiYXrKs05I1EMazD94zsPoNxh6pgfaNnr2np7bmgJP7hoI ZY6VimshqHUJHxbE0yXQmps9tl2uHKl2CusPbQNJwsWOQbHHrccIrmhBPH6CQv6bdEGF 72ZQ== X-Gm-Message-State: AOAM530/9BwPeob+e8K7IyV90eKNlgBYpDY0QIXIY1HPB/q1hNQCVQ9z 9QIKuEl4fjaJ0ytZFoH2ENk6A/B63elxKQ== X-Google-Smtp-Source: ABdhPJwvWQ+pbKNdxpmYzkb2pNO0aP/DoUsS/MuIU6IoqmOHDEVTYnK6Jy/D9YAAHACdcEFCXJ0s6A== X-Received: by 2002:a05:6602:24d4:: with SMTP id h20mr23481287ioe.4.1620759096947; Tue, 11 May 2021 11:51:36 -0700 (PDT) Received: from frodo.mearth (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id t10sm405096ils.36.2021.05.11.11.51.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 May 2021 11:51:36 -0700 (PDT) From: Jim Cromie To: Jason Baron , linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, Jim Cromie Subject: [RFC PATCH v5 16/28] dyndbg: add _index to struct _ddebug Date: Tue, 11 May 2021 12:50:45 -0600 Message-Id: <20210511185057.3815777-17-jim.cromie@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210511185057.3815777-1-jim.cromie@gmail.com> References: <20210511185057.3815777-1-jim.cromie@gmail.com> MIME-Version: 1.0 Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=NFlJHIjk; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf25.hostedemail.com: domain of jimcromie@gmail.com designates 209.85.166.54 as permitted sender) smtp.mailfrom=jimcromie@gmail.com X-Stat-Signature: 4n1yikasz75a9gkp8gb65wrxib3f433r X-Rspamd-Queue-Id: 47CC3600249C X-Rspamd-Server: rspam02 Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf25; identity=mailfrom; envelope-from=""; helo=mail-io1-f54.google.com; client-ip=209.85.166.54 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1620759089-491619 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: We currently use dp->site to map: &__dyndbg[N] -> &__dyndbg_sites[N]. We want to drop site; new _ddebug._index provides the N. This just initializes that index. ddebug_add_module()'s new job is to initialize _index. In order to handle builtin modules (sections contain catenated blocks of modules' callsites) it gets a new base arg to monotonically increment _index over multiple modules. Since ddebug_add_module() is used indirectly by module.c, the new arg is hidden in __ddebug_add_module(), and defaults to 0 in the wrapper. Signed-off-by: Jim Cromie --- include/linux/dynamic_debug.h | 2 ++ lib/dynamic_debug.c | 25 ++++++++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.= h index 868e0769b72d..a15e417cbba8 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -29,6 +29,7 @@ struct _ddebug { /* format is always needed, lineno shares word with flags */ const char *format; const unsigned lineno:18; + unsigned _index:14; /* * The flags field controls the behaviour at the callsite. * The bits here are changed dynamically when the user @@ -52,6 +53,7 @@ struct _ddebug { #define _DPRINTK_FLAGS_DEFAULT 0 #endif unsigned int flags:8; + #ifdef CONFIG_JUMP_LABEL union { struct static_key_true dd_key_true; diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 77c5135879c2..c5927b6c1c0c 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -1028,10 +1028,12 @@ static const struct proc_ops proc_fops =3D { * Allocate a new ddebug_table for the given module * and add it to the global list. */ -int ddebug_add_module(struct _ddebug *tab, struct _ddebug_site *sites, - unsigned int numdbgs, const char *modname) +static int __ddebug_add_module(struct _ddebug *tab, struct _ddebug_site = *sites, + unsigned int numdbgs, unsigned int base, + const char *modname) { struct ddebug_table *dt; + int i; =20 v3pr_info("add-module: %s.%d sites\n", modname, numdbgs); if (!numdbgs) { @@ -1055,6 +1057,12 @@ int ddebug_add_module(struct _ddebug *tab, struct = _ddebug_site *sites, dt->ddebugs =3D tab; dt->sites =3D sites; =20 + for (i =3D 0; i < numdbgs; i++, base++) { + tab[i]._index =3D base; + v3pr_info(" %d %d %s.%s.%d\n", i, base, modname, + tab[i].site->function, tab[i].lineno); + } + mutex_lock(&ddebug_lock); list_add(&dt->link, &ddebug_tables); mutex_unlock(&ddebug_lock); @@ -1063,6 +1071,12 @@ int ddebug_add_module(struct _ddebug *tab, struct = _ddebug_site *sites, return 0; } =20 +int ddebug_add_module(struct _ddebug *tab, struct _ddebug_site *sites, + unsigned int numdbgs, const char *modname) +{ + return __ddebug_add_module(tab, sites, numdbgs, 0, modname); +} + /* helper for ddebug_dyndbg_(boot|module)_param_cb */ static int ddebug_dyndbg_param_cb(char *param, char *val, const char *modname, int on_err) @@ -1177,6 +1191,7 @@ static int __init dynamic_debug_init(void) char *cmdline; int ret =3D 0; int site_ct =3D 0, entries =3D 0, modct =3D 0; + int mod_index =3D 0; =20 if (&__start___dyndbg =3D=3D &__stop___dyndbg) { if (IS_ENABLED(CONFIG_DYNAMIC_DEBUG)) { @@ -1200,8 +1215,8 @@ static int __init dynamic_debug_init(void) if (strcmp(modname, site->modname)) { modct++; =20 - ret =3D ddebug_add_module(iter_mod_start, site_mod_start, - site_ct, modname); + ret =3D __ddebug_add_module(iter_mod_start, site_mod_start, + site_ct, mod_index, modname); if (ret) goto out_err; site_ct =3D 0; @@ -1211,7 +1226,7 @@ static int __init dynamic_debug_init(void) } site_ct++; } - ret =3D ddebug_add_module(iter_mod_start, site_mod_start, site_ct, modn= ame); + ret =3D __ddebug_add_module(iter_mod_start, site_mod_start, site_ct, mo= d_index, modname); if (ret) goto out_err; =20 --=20 2.31.1