From: Maninder Singh <maninder1.s@samsung.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "mcgrof@kernel.org" <mcgrof@kernel.org>,
"pmladek@suse.com" <pmladek@suse.com>,
"rostedt@goodmis.org" <rostedt@goodmis.org>,
"senozhatsky@chromium.org" <senozhatsky@chromium.org>,
"linux@rasmusvillemoes.dk" <linux@rasmusvillemoes.dk>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"wangkefeng.wang@huawei.com" <wangkefeng.wang@huawei.com>,
Vaneet Narang <v.narang@samsung.com>,
"swboyd@chromium.org" <swboyd@chromium.org>,
"ojeda@kernel.org" <ojeda@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-modules@vger.kernel.org" <linux-modules@vger.kernel.org>,
"avimalin@gmail.com" <avimalin@gmail.com>,
"atomlin@redhat.com" <atomlin@redhat.com>
Subject: RE: [PATCH v2] kallsyms: enhance %pS/s/b printing when KALLSYSMS is disabled
Date: Tue, 15 Mar 2022 16:17:40 +0530 [thread overview]
Message-ID: <2032885049.3816543.1647341260934@mail-kr5-2> (raw)
In-Reply-To: <YjBq1jg9cNgEqB8T@smile.fi.intel.com>
[-- Attachment #1: Type: text/plain, Size: 2473 bytes --]
Hi,
> > +int sprint_kallsym_common(char *buffer, unsigned long address, int build_id,
> > + int backtrace, int symbol)
> > +{
> > + if (backtrace)
> > + return __sprint_symbol(buffer, address, -1, 1, build_id);
>
> > + else if (symbol)
> > + return __sprint_symbol(buffer, address, 0, 1, build_id);
> > + else
> > + return __sprint_symbol(buffer, address, 0, 0, 0);
>
> Redundant 'else' in both cases.
>
Ok, will change it
> > +}
>
> ...
>
> > +static int sprint_module_info(char *buf, char *end, unsigned long value,
> > + const char *fmt, int modbuildid, int backtrace, int symbol)
>
> fmt is not used.
Yes, did not notice it.(will remove both end and gmt)
> > +{
> > + struct module *mod;
> > + unsigned long offset = 0;
>
> > + unsigned long base;
>
> Can it be the same type as core_layout.base? Why not?
>
> > + char *modname;
> > + int len;
> > + const unsigned char *buildid = NULL;
> > +
> > + if (is_ksym_addr(value))
> > + return 0;
> > +
> > + if (backtrace || symbol)
> > + offset = 1;
>
> I would expect here to have
>
> else
> offset = 0;
>
> But see below.
>
> > + preempt_disable();
> > + mod = __module_address(value);
> > + if (mod) {
> > + modname = mod->name;
> > +#if IS_ENABLED(CONFIG_STACKTRACE_BUILD_ID)
> > + if (modbuildid)
> > + buildid = mod->build_id;
> > +#endif
>
> > + if (offset) {
>
> This seems quite confusing because semantically you use offset as a boolean
> flag and offset. Why not add a boolean variable with a clear name?
>
Ok, will add 2 separate variables.
> > + base = (unsigned long)mod->core_layout.base;
> > + offset = value - base;
> > + }
> > + }
>
> > +
>
> Probably you can drop this blank line to group entire critical section,
> or add a blank line above.
>
> > + preempt_enable();
> > + if (!mod)
> > + return 0;
> > +
> > + /* address belongs to module */
> > + if (offset)
> > + len = sprintf(buf, "0x%p+0x%lx", (void *)base, offset);
> > + else
>
> > + len = sprintf(buf, "0x%lx", (void *)value);
>
> What this casting is for? Don't you have a compilation warning?
My Bad, earlier I made patch with hashing this value also (%p), but after that
changed it to %lx to have same original behavior in case of %ps, forgot to update final patch
to remove typecast.
>
> > + len += fill_name_build_id(buf, modname, modbuildid, buildid, len);
> > + return len;
>
> return len + ...;
>
> ?
>
> > +}
Will modify patch with all changes.
Thanks,
Maninder Singh
[-- Attachment #2: rcptInfo.txt --]
[-- Type: application/octet-stream, Size: 1664 bytes --]
=================================================================================================================================
Subject : Re: [PATCH v2] kallsyms: enhance %pS/s/b printing when KALLSYSMS is disabled
From : null
Sent Date : 2022-03-15 16:02 GMT+5:30
=================================================================================================================================
Name Type Job Title Dept. Company
=================================================================================================================================
Maninder Singh TO Staff Engineer System S/W Group /SRI-Delhi Samsung Electronics
mcgrof@kernel.org CC
pmladek@suse.com CC
rostedt@goodmis.org CC
senozhatsky@chromium.org CC
linux@rasmusvillemoes.dk CC
akpm@linux-foundation.org CC
wangkefeng.wang@huawei.com CC
Vaneet Narang CC Associate Architect System S/W Group /SRI-Delhi Samsung Electronics
swboyd@chromium.org CC
ojeda@kernel.org CC
linux-kernel@vger.kernel.org CC
linux-modules@vger.kernel... CC
avimalin@gmail.com CC
atomlin@redhat.com CC
=================================================================================================================================
prev parent reply other threads:[~2022-03-15 10:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20220315095129epcas5p230b94ea10517d148c9cae0669229b0fc@epcas5p2.samsung.com>
2022-03-15 9:51 ` [PATCH v2] kallsyms: enhance %pS/s/b printing when KALLSYSMS is disabled Maninder Singh
2022-03-15 10:30 ` Andy Shevchenko
2022-03-15 10:47 ` Maninder Singh [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2032885049.3816543.1647341260934@mail-kr5-2 \
--to=maninder1.s@samsung.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=atomlin@redhat.com \
--cc=avimalin@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=mcgrof@kernel.org \
--cc=ojeda@kernel.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
--cc=swboyd@chromium.org \
--cc=v.narang@samsung.com \
--cc=wangkefeng.wang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox