Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3441282pxb; Thu, 10 Feb 2022 22:50:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJxFL6YobJNyRyvTE83/4M+S9iSVcTu1OIR6bB68LmhdkSv/VQubIrHiQIUT9O3SxjPhR8K8 X-Received: by 2002:a05:6402:26c2:: with SMTP id x2mr381532edd.354.1644562219606; Thu, 10 Feb 2022 22:50:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644562219; cv=none; d=google.com; s=arc-20160816; b=Bm3wrILygV94ZSWyXfQ8gve+dDyzHe2C8LkfEXOMfhC3VoYw4rfxgfvTRf2wb6saSu LJj07yCNwZVs9kapu4a0/YvTeyisXGTEVbCIDD05jFJGxowl1uwcOsBC/r28B2FgbQSs pvKdAWhfWW9iODj8ijYTMDl4r2W2kEzV3zYbK0ci2tlhgxjQnfx5CSgY0zrL3MRMlrxY b0XHuLcZKgjIrnxksrdjAdUj77QCO9lKTkMYIFG8M5q5z4DvsEFlt1tJIxhVMQCwO8w/ WST5lMUoZsZF6KcnqN9uzaHJdvGoB2EzIvu1UOI7Ny+2dKtIFM4y53L5gwQclqDmkD2p nXdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=RpduqcaMhZKLCDjE8PG5uh0tA5u/80+FbxboARzzqGg=; b=05T+76dreMx5KpXWql9We3Wyt5s4JunIQhRoMbOmIJEvAMykpijEWBUI9MuSdi20xc z9N872nL2GR4o/ZexcITfE7w5JIci7+09h+fKtaseu7u1XyhZLF/NQJ6Lh5vC3C0tpiE 2ipGFdMnAYKNm87yvXXIgCzBlt+qJmjf+jzhaabl9xSXed150v6KL8sdIKtCAB8m+3F+ 4DG+ymB8yCVtIHHsSlxg85OBaBC1An4hc+wZ1CDFT5A2ttoAjxdrBF+BG8mXX2OFe4em miprwjX8MAa9xHsiTijNGgv0h4YbG4B+GlduNZ2PH6iVzgelVSCIGL5xCu18UTnMNm/V 9EVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=BDQwdSWa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j30si143039eda.8.2022.02.10.22.49.54; Thu, 10 Feb 2022 22:50:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=BDQwdSWa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S1346905AbiBKBho (ORCPT + 99 others); Thu, 10 Feb 2022 20:37:44 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:45658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346823AbiBKBhn (ORCPT ); Thu, 10 Feb 2022 20:37:43 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0961558E for ; Thu, 10 Feb 2022 17:37:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=RpduqcaMhZKLCDjE8PG5uh0tA5u/80+FbxboARzzqGg=; b=BDQwdSWakCszYDEreP6D31+6f0 uk3LvofeQyFhvpckTO70aiWBzfJxyr/n86wkyg29AlOmUTl9M+/k6RkSgexZ0Jcd67IVY8NLMWznV /asfun8rFhKA19Nu+xhJ9sQoTlvwoV8WkoQhPiTF/FI7mBk3AaTCBGIGZuZMPrLqG10w02VePAxOQ K0Z2ANhDTJnk/Hg7O82klqHOy18Kr1rLmpYdZMS3k3sK6BRDwbFf2E4pWGi8Kg3YdxDJJIX/FYRU4 4BD6wsfqx28GUCsdJFhfzIHx1ceDEKso+2Do4bPUa3GRk4GxFlV4Ta2Jnf/yADf4kDE2r5MGz45+X cTZ1IXwQ==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nIKsB-005Qsi-Jf; Fri, 11 Feb 2022 01:37:19 +0000 Date: Thu, 10 Feb 2022 17:37:19 -0800 From: Luis Chamberlain To: Maninder Singh Cc: Petr Mladek , Vimal Agrawal , "rostedt@goodmis.org" , "senozhatsky@chromium.org" , "andriy.shevchenko@linux.intel.com" , "linux@rasmusvillemoes.dk" , "akpm@linux-foundation.org" , "wangkefeng.wang@huawei.com" , "mbenes@suse.cz" , "swboyd@chromium.org" , "ojeda@kernel.org" , "linux-kernel@vger.kernel.org" , "will@kernel.org" , "catalin.marinas@arm.com" , Vaneet Narang , Aaron Tomlin Subject: Re: [PATCH 1/1] kallsyms: print module name in %ps/S case when KALLSYMS is disabled Message-ID: References: <20220201040044.1528568-1-maninder1.s@samsung.com> <20220209114038.GA8279@pathway.suse.cz> <436367503.2691559.1644482903367@mail-kr5-0> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <436367503.2691559.1644482903367@mail-kr5-0> Sender: Luis Chamberlain X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 10, 2022 at 02:18:23PM +0530, Maninder Singh wrote: > Hi All, > > Thanks for your inputs. > > > On Wed 2022-02-09 15:02:06, Luis Chamberlain wrote: > > > On Wed, Feb 09, 2022 at 12:40:38PM +0100, Petr Mladek wrote: > > > > > --- a/include/linux/kallsyms.h > > > > > +++ b/include/linux/kallsyms.h > > > > > @@ -163,6 +163,33 @@ static inline bool kallsyms_show_value(const struct cred *cred) > > > > > return false; > > > > > } > > > > > > > > > > +#ifdef CONFIG_MODULES > > > > > +static inline int fill_minimal_module_info(char *sym, int size, unsigned long value) > > > > > +{ > > > > > + struct module *mod; > > > > > + unsigned long offset; > > > > > + int ret = 0; > > > > > + > > > > > + preempt_disable(); > > > > > + mod = __module_address(value); > > > > > + if (mod) { > > > > > + offset = value - (unsigned long)mod->core_layout.base; > > > > > + snprintf(sym, size - 1, "0x%lx+0x%lx [%s]", > > > > > + (unsigned long)mod->core_layout.base, offset, mod->name); > > > > > + > > > > > + sym[size - 1] = '\0'; > > > > > + ret = 1; > > > > > + } > > > > > + > > > > > + preempt_enable(); > > > > > + return ret; > > > > > +} > > > > > > > > It looks too big for an inlined function. Anyway, we will need > > > > something even more complex, see below. > > > > > > Interesting, these observations might apply to Vimal's work as well [0]. > > > > > > [0] https://lkml.kernel.org/r/YgKyC4ZRud0JW1PF@bombadil.infradead.org > > > > Honestly, I am not sure what is the best practice. My understanding is > > that inlined functions are used primary for speed up at runtime. > > > > Main reason of making it inline was: > (1) kallsysm.c was not getting compiled(with disabled config), so could not add defination there. > (2) lib/vsnprintf.c was not correct place to define new function of kallsyms(fill_minimal_module_info) > (3) I thought static int will be part of each .c file which includes kallsyms.h and compiler can make noise for unused functions, > and also increase code size, where as static inline will be added only if some code is calling that function otherwise will be discarded. > > But as peter said better version will be to make a new defination of __sprint_symbol (probably in kernel/module.c) > to handle all cases of %ps/S/B/b when KALLSYSMS is disabled. > > I will try to prepare changes and share V2 patch. If you do please Cc me and Vimal, and Aaron. Luis