Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3433796ybt; Tue, 30 Jun 2020 02:39:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxl7DixgwNsdcn/aT2E8XmmubYdTIT1SFLisnpggFry2st+c4mqGF9UZLhHGnvdiVUi1mf2 X-Received: by 2002:aa7:dd05:: with SMTP id i5mr22379004edv.283.1593509986211; Tue, 30 Jun 2020 02:39:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593509986; cv=none; d=google.com; s=arc-20160816; b=dIJcOJxh7rMfvyMUDdr3WFzeaWw2VBd9BWHJzHE4WY7SsulyqSwNlMG8iraxdQqYxT H7S7cNHBt89icIwi5y04IGeggEKR3zdKnEXhcjB2mhc4NA4oV0ty0qre8y40E6rSSUDA /A42MPC09WPlvDECqUQtQIi6jTp7gPSzBC+GEZT7vFPDZCdPqBL6gXXiWR5HRosO6Z9O zgkj9g1OLYBLLg75zl9O7yZCc8BBJd/v8pCcqTxdrpz+JtkT6aCl6NveKvoJTjjvtjBH ALS+iSMBUIGg4BTCbu3pVhWvkHpUD0JxoFf1/ZrTcIsJZF9czl67EKL9A2lv0RZgvwWg Wk7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ttLAVIbJIgcoK3fNhG0peMYcdWw53P+5jVM+gj7nZn0=; b=Vk4+BQ1v+xE6Yjc4vjODLTEAdXRphCWNZ5CCDepOzuyJUAjevHmXSXagP5q5MNEmTI 5TMiVs5vt57gQwTNgDNnZ/n5UgcKPvTM7px0ZNGdOEDIcXLNxYnFUISP5EPUhxtWMJoT zSZWj07aPxksdC5HJ0m43PBayooKdTDQ8onbyUasHYkxxn5hyGWYRyDuGz60HcdsfCIT hI5wp1J3MueDoow1rnak9Hy1Fd2qGR5litOMjrw5DXV/W3SnOz7ZfjcP9WGF6nS6QwJv yDno5OsDN/vmCi+pU0VRlJi9vonoKZLkWoEq5zGajwR4+ozkOTPgnydOoeh35MeVOINx r59w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yq82SEN3; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v19si1635237eda.532.2020.06.30.02.39.22; Tue, 30 Jun 2020 02:39:46 -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=@kernel.org header.s=default header.b=yq82SEN3; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732022AbgF3JiA (ORCPT + 99 others); Tue, 30 Jun 2020 05:38:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:38740 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729193AbgF3Jh7 (ORCPT ); Tue, 30 Jun 2020 05:37:59 -0400 Received: from linux-8ccs.fritz.box (p57a23121.dip0.t-ipconnect.de [87.162.49.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 804C0206A1; Tue, 30 Jun 2020 09:37:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593509878; bh=r6ySbBBH6JX5F+m+piVB8CEQhJDEWaoNh+6yuwgGlZc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=yq82SEN3Xsghbqdpt/wIolcC1yVYA3uH7fTDChhOidiV1Y9x5Q0e2gcokD8iFSH7G KfCS64//Bvb+Kx/nxNdkVz6eul6j7vZjp7qdEKhg4SzWy6hfGQcSnjNUPherjkE0eZ r8DjkxawL3HCfWoWaVIqOdZDbaYUAolP73pAdIX4= Date: Tue, 30 Jun 2020 11:37:54 +0200 From: Jessica Yu To: Jim Cromie Cc: tobyboy0@gmail.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] kernel/module: add name size info to pr_debug() calls Message-ID: <20200630093754.GA13271@linux-8ccs.fritz.box> References: <20200611142009.1098058-1-jim.cromie@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20200611142009.1098058-1-jim.cromie@gmail.com> X-OS: Linux linux-8ccs 4.12.14-lp150.12.61-default x86_64 User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org +++ Jim Cromie [11/06/20 08:20 -0600]: >when booted with arg: module.dyndbg=+p >dmesg gets volumes of info about loaded modules. >This adds module & symbol names, and sizes where pertinent. >Now I can know which module's info Im looking at. Hi, Could you please fix the changelog formatting according to Documentation/process/submitting-patches.rst? More specifically, complete sentences, line wrapped at 75 columns, and a Signed-off-by: line at the end. There are plenty of examples if you look through the lkml mailing list. >--- > kernel/module.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > >diff --git a/kernel/module.c b/kernel/module.c >index e8a198588f26..d871d9cee9eb 100644 >--- a/kernel/module.c >+++ b/kernel/module.c >@@ -2294,8 +2294,8 @@ static int simplify_symbols(struct module *mod, const struct load_info *info) > > case SHN_ABS: > /* Don't need to do anything */ >- pr_debug("Absolute symbol: 0x%08lx\n", >- (long)sym[i].st_value); >+ pr_debug("Absolute symbol: 0x%08lx %s\n", >+ (long)sym[i].st_value, name); I would prefer "Absolute symbol %s:" rather than putting the symbol name at the end. > break; > > case SHN_LIVEPATCH: >@@ -2409,7 +2409,7 @@ static void layout_sections(struct module *mod, struct load_info *info) > for (i = 0; i < info->hdr->e_shnum; i++) > info->sechdrs[i].sh_entsize = ~0UL; > >- pr_debug("Core section allocation order:\n"); >+ pr_debug("Core section allocation order for: %s\n", mod->name); I would slightly prefer "Core section allocation order for %s:", but it's a matter of taste. > for (m = 0; m < ARRAY_SIZE(masks); ++m) { > for (i = 0; i < info->hdr->e_shnum; ++i) { > Elf_Shdr *s = &info->sechdrs[i]; >@@ -2442,7 +2442,7 @@ static void layout_sections(struct module *mod, struct load_info *info) > } > } > >- pr_debug("Init section allocation order:\n"); >+ pr_debug("Init section allocation order for: %s\n", mod->name); Same here. > for (m = 0; m < ARRAY_SIZE(masks); ++m) { > for (i = 0; i < info->hdr->e_shnum; ++i) { > Elf_Shdr *s = &info->sechdrs[i]; >@@ -3276,7 +3276,7 @@ static int move_module(struct module *mod, struct load_info *info) > mod->init_layout.base = NULL; > > /* Transfer each section which specifies SHF_ALLOC */ >- pr_debug("final section addresses:\n"); >+ pr_debug("final section addresses for: %s\n", mod->name); Let's capitalize the "f" in "final section addresses" to be consistent with the other two above. > for (i = 0; i < info->hdr->e_shnum; i++) { > void *dest; > Elf_Shdr *shdr = &info->sechdrs[i]; >@@ -3294,8 +3294,8 @@ static int move_module(struct module *mod, struct load_info *info) > memcpy(dest, (void *)shdr->sh_addr, shdr->sh_size); > /* Update sh_addr to point to copy in image. */ > shdr->sh_addr = (unsigned long)dest; >- pr_debug("\t0x%lx %s\n", >- (long)shdr->sh_addr, info->secstrings + shdr->sh_name); >+ pr_debug("\t0x%lx 0x%.8lx %s\n", (long)shdr->sh_addr, >+ (long)shdr->sh_size, info->secstrings + shdr->sh_name); Any reason why you added sh_size here? Is it really needed? You can usually deduce how much space a section is taking up in a module by looking at the final section address printout. Plus the elf section size is not entirely accurate here as each module section is aligned to page boundaries when the module loader allocates memory for each section. I would prefer to just leave it out. Thanks, Jessica