[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CH2PR13MB336810E7C6FE6754558E717D8C770@CH2PR13MB3368.namprd13.prod.outlook.com>
Date: Tue, 12 Nov 2019 06:19:58 +0000
From: Yash Shah <yash.shah@...ive.com>
To: Logan Gunthorpe <logang@...tatee.com>,
"Paul Walmsley ( Sifive)" <paul.walmsley@...ive.com>,
"linux-riscv@...ts.infradead.org" <linux-riscv@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC: "aou@...s.berkeley.edu" <aou@...s.berkeley.edu>,
"Anup.Patel@....com" <Anup.Patel@....com>,
"rppt@...ux.ibm.com" <rppt@...ux.ibm.com>,
Sachin Ghadi <sachin.ghadi@...ive.com>,
"palmer@...belt.com" <palmer@...belt.com>,
"ren_guo@...ky.com" <ren_guo@...ky.com>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"bmeng.cn@...il.com" <bmeng.cn@...il.com>
Subject: RE: [PATCH] RISC-V: Add address map dumper
> On 2019-11-10 10:27 p.m., Yash Shah wrote:
> > Add support for dumping the kernel address space layout to the console.
> > User can enable CONFIG_DEBUG_VM_LAYOUT to dump the virtual
> memory
> > region into dmesg buffer during boot-up.
>
> Cool, I'd find this useful. Though, is there any reason we don't do this more
> generally for all architectures?
>
> > Signed-off-by: Yash Shah <yash.shah@...ive.com>
> > ---
> > This patch is based on Linux 5.4-rc6 and tested on SiFive HiFive
> > Unleashed board.
> > ---
> > arch/riscv/Kconfig.debug | 9 +++++++++
> > arch/riscv/mm/init.c | 30 ++++++++++++++++++++++++++++++
> > 2 files changed, 39 insertions(+)
> >
...
> > diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index
> > 79cfb35..fcb8144 100644
> > --- a/arch/riscv/mm/init.c
> > +++ b/arch/riscv/mm/init.c
> > @@ -55,6 +55,36 @@ void __init mem_init(void)
> > memblock_free_all();
> >
> > mem_init_print_info(NULL);
> > +#ifdef CONFIG_DEBUG_VM_LAYOUT
>
> Generally, it's best to avoid #ifdefs inside functions, it's even counter-
> indicated in the style guide[1].
Yes, I will move out the print logic as a separate function and guard it with #ifdefs
>
> > +#define MLK(b, t) b, t, (((t) - (b)) >> 10) #define MLM(b, t) b, t,
> > +(((t) - (b)) >> 20) #define MLK_ROUNDUP(b, t) b, t, DIV_ROUND_UP(((t)
> > +- (b)), SZ_1K)
>
> I personally find these inline defines rather ugly. Maybe it would be better to
> have a helper function that prints a single line. Also seems like MLK and
> MLK_ROUNDUP could be the same assuming the entries in MLK are
> aligned...
>
Sure, will convert this macros into helper inline functions and will also drop MLK_ROUNDUP.
>
> Thanks,
>
> Logan
>
Thanks for your comments!
- Yash
> [1]
> https://www.kernel.org/doc/html/latest/process/coding-
> style.html#conditional-compilation
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@...ts.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
Powered by blists - more mailing lists