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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2411ECDB46E for ; Thu, 12 Oct 2023 19:47:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 357848D013E; Thu, 12 Oct 2023 15:47:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2B9618D0002; Thu, 12 Oct 2023 15:47:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1807E8D013E; Thu, 12 Oct 2023 15:47:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 024538D0002 for ; Thu, 12 Oct 2023 15:47:26 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id C8D091CB277 for ; Thu, 12 Oct 2023 19:47:25 +0000 (UTC) X-FDA: 81337843650.25.495EA61 Received: from mail-io1-f46.google.com (mail-io1-f46.google.com [209.85.166.46]) by imf02.hostedemail.com (Postfix) with ESMTP id 0AE6680017 for ; Thu, 12 Oct 2023 19:47:23 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=cS6tUqxN; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf02.hostedemail.com: domain of jim.cromie@gmail.com designates 209.85.166.46 as permitted sender) smtp.mailfrom=jim.cromie@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1697140044; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=qUViZFu6qDP+V9dlTKCnuIaJi78i9uWOlvfP3OhngjY=; b=GgE7NfUyLC8nqdkQRx6/Xmgb6+MeM1RITzxc20IVihH/B/9WJACrKeYCb2knmiRdFPi9td tkSmrCNLstFymb0Ca2wublVe04sTuWHoW6I6gOLp8LKPyMyEV4M78UFmU3Iks8CvPLY53e PsfehfFEQUgcaBD8umsbc4eZhbJw9YY= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=cS6tUqxN; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf02.hostedemail.com: domain of jim.cromie@gmail.com designates 209.85.166.46 as permitted sender) smtp.mailfrom=jim.cromie@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1697140044; a=rsa-sha256; cv=none; b=3qv0sSiPz+j2UjYTQJn00f42kOiK3c1T78cBlq8d1FLeKS9vm+tyhSDbRiEv0L2FNoVvKW U0O4IqQRzljOxDtPgPywc3v6UgJX2Z67DTl9GVIhDst3msKpTqi2zQNfHPY7LB1RG0P9bR vy9BcsRGny/8HYBKcpJmq8oEJLvbJWE= Received: by mail-io1-f46.google.com with SMTP id ca18e2360f4ac-79faba5fe12so50359139f.3 for ; Thu, 12 Oct 2023 12:47:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697140043; x=1697744843; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qUViZFu6qDP+V9dlTKCnuIaJi78i9uWOlvfP3OhngjY=; b=cS6tUqxN8mWifd87iTRFYCwjgsaLuytTmLpEGI7Su7ZR8j7fQ0c1t4UN3+sLIBO0MT oAoH+JDel9QDf5eIjw4aRYQaUWUjtvQEjv2Gc7RQpvanKDwlh/hAJF860vIvIwgN7bxb Fud/OhwD37q5tOD4T6lHYfo+P4wiQsNiSaVEDprWOUwr8DBLNoYj2uGwdqpg8J52Omjq BvVxln4vTHYkhqjHx5tKW/3JbAbJIdtklVz0FuDiQsRPc+1rf7jG55mT6TWDRZzQ33GJ a7RNE89LQHuMQTYU2ycDTGQMkJMkU5emRodmrOcQXKA7YEtbDDTPbWr2N5CzunfQ3QmU qwQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697140043; x=1697744843; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qUViZFu6qDP+V9dlTKCnuIaJi78i9uWOlvfP3OhngjY=; b=f73SPytTcho7RusVNVm7Yc4JyQpohNpU18KFEBWzGuSTG3VphbsDbi3xxM9hxuzbAP TCSbjitjyoqj7MGYIf2zk2cGTZQrOA4lhukwewNF2IhoAXiw63Y1aDm3MHzbGa+Q2Q3C cMcGBZAUShH/YtouxqkeA2xDsEpNWAwJBbEABLyuqoB6QrjwJ+OZKEa9lQ8MM+gQhjwy uDM9VgoroIylHLnv+QEQQb+fM6fzmY1esfL7P4Grzo5NJnGXS+IkNUBKJIcwmXbHoXEb Go4MSQ53YXCE4nGabAfCBZbq78I3jztqBElX6n5JDKObgFCATV6a2fWP00a/1pEk9mqi 7uhQ== X-Gm-Message-State: AOJu0YzQ8PE0QJQ8EZwnp+4NE69DXfJhu6a/GQxeh03RaXn5dLlrpuwz 1enkNjGFo2++SV7/1v2ulqABGA8b0E+Wyg== X-Google-Smtp-Source: AGHT+IEy5LUrHNrM8PB7Uq+J/5nUEH5hYYFEbdVHzf05PX1Vsvj59Q/FEZF7mdKvVdrY8dZihBpf9g== X-Received: by 2002:a5d:9943:0:b0:79f:d194:d6e2 with SMTP id v3-20020a5d9943000000b0079fd194d6e2mr28680189ios.10.1697140043212; Thu, 12 Oct 2023 12:47:23 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id z7-20020a5ec907000000b0079fbb834232sm4351002iol.19.2023.10.12.12.47.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 12:47:22 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org Cc: david@redhat.com, Liam.Howlett@Oracle.com, linux-mm@kvack.org, Jim Cromie Subject: [RFC PATCH 02/10] dyndbg: split __dyndbg_sites section out from __dyndbg Date: Thu, 12 Oct 2023 13:47:03 -0600 Message-ID: <20231012194711.3288031-3-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231012194711.3288031-1-jim.cromie@gmail.com> References: <20231012194711.3288031-1-jim.cromie@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 0AE6680017 X-Stat-Signature: uo8kjuw87cp8o953cg4zig3nzr5afp1i X-HE-Tag: 1697140043-472949 X-HE-Meta: U2FsdGVkX1+bQR4aD0/tuPG10FHiu0AspwkcClHF7xByVBw8nLpYsixljkTpn7Cq71dc7KpQQn4rYocP6E7ESeBPXEQk0Wuuad3VzpXz7Kf+72sFJrtaB/6eqZssshqcEd3FtCvhH1J4Cao7+YUIBujvNxUsy1QiyElMZHb1wqalZEYFO3uvD6U8CbPqJs9yV61O5zRA9yXfcEk20YkCjDXgCP6f79TnwQPj/pFRDqZyEeZqw8W+PIbahOrm/JkJ6KvBPEAhP7oww1q3X7QhOCKp6v+ycTRfmLXD50qFpIBsMJysRcLXgVZCBGaCQt1nRUNJS3jI5f+f14rCg3PwrZNmqHY+LgcBz3AhmxJXVkZU5YSPmyvriyje+g1l1nfVZimvZyn4f6oPbM1gRi2ZLusRyAWXnBpPEihZd7zrYW1bj+KYLceuiFPwB7DukLqnjh1br48xKM9oys5dsC8jWaKeSXeRSzzdhCpOUNtqpQolDiP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WBSSEPDx138Tg== 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: split struct _ddebug_site out from struct _ddebug (adding a site ptr), and add new __dyndbg_sites section placement to vmlinux.lds.h This is an implementation detail to isolate the redundant columns into a separate section, so it specifically excludes lineno. This allows (later) to copy and compress the info into a better (more compact) representation thats still fast enough. Then we can just reclaim the whole __dyndbg_sites section. Signed-off-by: Jim Cromie --- include/asm-generic/vmlinux.lds.h | 1 + include/linux/dynamic_debug.h | 40 ++++++++++++++++++------------- kernel/module/main.c | 3 +++ lib/dynamic_debug.c | 6 +++++ 4 files changed, 33 insertions(+), 17 deletions(-) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 5451f926a753..1d128259e373 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -368,6 +368,7 @@ BOUNDED_SECTION_BY(__dyndbg_classes, ___dyndbg_classes) \ BOUNDED_SECTION_BY(__dyndbg_class_users, ___dyndbg_class_users) \ BOUNDED_SECTION_BY(__dyndbg, ___dyndbg) \ + BOUNDED_SECTION_BY(__dyndbg_sites, ___dyndbg_sites) \ LIKELY_PROFILE() \ BRANCH_PROFILE() \ TRACE_PRINTKS() \ diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index aacfafc466c0..5206a2cfdb37 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -9,21 +9,25 @@ #include /* - * An instance of this structure is created in a special - * ELF section at every dynamic debug callsite. At runtime, - * the special section is treated as an array of these. + * A pair of these structs are created into 2 special ELF sections for + * each pr_debug callsite. At runtime, the special sections are + * treated as arrays. */ - -struct _ddebug { +struct _ddebug; +struct _ddebug_site { /* - * These fields are used to drive the user interface - * for selecting and displaying debug callsites. + * These fields are used to: + * - display callsites in the control file + * - query/select callsites by the code's organization + * - prefix/decorate pr_debug messages per user choices */ - struct /* _ddebug_site */ { - const char *_modname; - const char *_function; - const char *_filename; - }; + const char *_modname; + const char *_function; + const char *_filename; +}; + +struct _ddebug { + struct _ddebug_site *site; const char *format; unsigned int lineno:18; #define CLS_BITS 6 @@ -64,10 +68,6 @@ struct _ddebug { #endif } __attribute__((aligned(8))); -#define desc_modname(d) (d)->modname -#define desc_filename(d) (d)->filename -#define desc_function(d) (d)->function - enum ddebug_class_map_type { DD_CLASS_TYPE_DISJOINT_BITS, /** @@ -139,9 +139,11 @@ struct ddebug_class_user { /* encapsulate linker provided built-in (or module) dyndbg data */ struct _ddebug_info { struct _ddebug *descs; + struct _ddebug_site *sites; struct ddebug_class_map *classes; struct ddebug_class_user *class_users; unsigned int num_descs; + unsigned int num_sites; unsigned int num_classes; unsigned int num_class_users; }; @@ -226,9 +228,13 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor, ._filename = __FILE__ #define DEFINE_DYNAMIC_DEBUG_METADATA_CLS(name, cls, fmt) \ + static struct _ddebug_site __aligned(8) \ + __section("__dyndbg_sites") name ##_site = { \ + DYNAMIC_DEBUG_SITE_INIT(), \ + }; \ static struct _ddebug __aligned(8) \ __section("__dyndbg") name = { \ - DYNAMIC_DEBUG_SITE_INIT(), \ + .site = &(name ##_site), \ .format = (fmt), \ .lineno = __LINE__, \ .flags = _DPRINTK_FLAGS_DEFAULT, \ diff --git a/kernel/module/main.c b/kernel/module/main.c index 6b0b0d82b5ab..43458184744d 100644 --- a/kernel/module/main.c +++ b/kernel/module/main.c @@ -2211,6 +2211,9 @@ static int find_module_sections(struct module *mod, struct load_info *info) mod->dyndbg_info.descs = section_objs(info, "__dyndbg", sizeof(*mod->dyndbg_info.descs), &mod->dyndbg_info.num_descs); + mod->dyndbg_info.sites = section_objs(info, "__dyndbg_sites", + sizeof(*mod->dyndbg_info.sites), + &mod->dyndbg_info.num_sites); mod->dyndbg_info.classes = section_objs(info, "__dyndbg_classes", sizeof(*mod->dyndbg_info.classes), &mod->dyndbg_info.num_classes); diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index c0e595483cb9..0ad9f1bc00f0 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[]; extern struct ddebug_class_map __start___dyndbg_classes[]; extern struct ddebug_class_map __stop___dyndbg_classes[]; extern struct ddebug_class_user __start___dyndbg_class_users[]; @@ -191,6 +193,10 @@ static struct ddebug_class_map *ddebug_find_valid_class(struct ddebug_table cons return NULL; } +#define desc_modname(d) (d)->site->_modname +#define desc_filename(d) (d)->site->_filename +#define desc_function(d) (d)->site->_function + /* * Search the tables for _ddebug's which match the given `query' and * apply the `flags' and `mask' to them. Returns number of matching -- 2.41.0