[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAhV-H5-8yPjZhOkV2+v+XB85+2qs5342hDdTYAV1ctPAdb7+A@mail.gmail.com>
Date: Thu, 14 Oct 2021 11:01:08 +0800
From: Huacai Chen <chenhuacai@...il.com>
To: Luis Chamberlain <mcgrof@...nel.org>
Cc: Huacai Chen <chenhuacai@...ngson.cn>,
Arnd Bergmann <arnd@...db.de>,
Andy Lutomirski <luto@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>,
Andrew Morton <akpm@...ux-foundation.org>,
David Airlie <airlied@...ux.ie>,
Jonathan Corbet <corbet@....net>,
Linus Torvalds <torvalds@...ux-foundation.org>,
linux-arch <linux-arch@...r.kernel.org>,
"open list:DOCUMENTATION" <linux-doc@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
Xuefeng Li <lixuefeng@...ngson.cn>,
Yanteng Si <siyanteng@...ngson.cn>,
Jiaxun Yang <jiaxun.yang@...goat.com>,
Jessica Yu <jeyu@...nel.org>
Subject: Re: [PATCH V5 15/22] LoongArch: Add elf and module support
Hi, Luis,
On Wed, Oct 13, 2021 at 8:56 PM Luis Chamberlain <mcgrof@...nel.org> wrote:
>
> On Wed, Oct 13, 2021 at 03:11:10PM +0800, Huacai Chen wrote:
> > diff --git a/arch/loongarch/include/asm/vermagic.h b/arch/loongarch/include/asm/vermagic.h
> > new file mode 100644
> > index 000000000000..9882dfd4702a
> > --- /dev/null
> > +++ b/arch/loongarch/include/asm/vermagic.h
> > @@ -0,0 +1,19 @@
> > +/* SPDX-License-Identifier: GPL-2.0 */
> > +/*
> > + * Copyright (C) 2020-2021 Loongson Technology Corporation Limited
> > + */
> > +#ifndef _ASM_VERMAGIC_H
> > +#define _ASM_VERMAGIC_H
> > +
> > +#define MODULE_PROC_FAMILY "LOONGARCH "
>
> I take it this not a mips arch? There are other longarchs under
> arch/mips/include/asm/vermagic.h which is why I ask.
Yes, LoongArch is not compatible with MIPS, old Loongson is MIPS and
new Loongson isn't.
>
> > diff --git a/arch/loongarch/kernel/module.c b/arch/loongarch/kernel/module.c
> > new file mode 100644
> > index 000000000000..af7c403b032b
> > --- /dev/null
> > +++ b/arch/loongarch/kernel/module.c
> > @@ -0,0 +1,652 @@
> > +// SPDX-License-Identifier: GPL-2.0+
> > +/*
> > + * Author: Hanlu Li <lihanlu@...ngson.cn>
> > + * Huacai Chen <chenhuacai@...ngson.cn>
> > + *
> > + * Copyright (C) 2020-2021 Loongson Technology Corporation Limited
> > + */
> > +
> > +#undef DEBUG
>
> Please remove this undef DEBUG line.
OK, thanks.
>
> > +
> > +#include <linux/moduleloader.h>
> > +#include <linux/elf.h>
> > +#include <linux/mm.h>
> > +#include <linux/vmalloc.h>
> > +#include <linux/slab.h>
> > +#include <linux/fs.h>
> > +#include <linux/string.h>
> > +#include <linux/kernel.h>
> > +
> > +static int rela_stack_push(s64 stack_value, s64 *rela_stack, size_t *rela_stack_top)
> > +{
> > + if (*rela_stack_top >= RELA_STACK_DEPTH)
> > + return -ENOEXEC;
> > +
> > + rela_stack[(*rela_stack_top)++] = stack_value;
> > + pr_debug("%s stack_value = 0x%llx\n", __func__, stack_value);
>
> If you are going to use pr_debug() so much you may want to add
> a define for #define pr_fmt(fmt) at the very top.
OK, thanks.
>
> > +int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab,
> > + unsigned int symindex, unsigned int relsec,
> > + struct module *me)
> > +{
>
> Nit: Please use struct module *mod, it is much more common in other places.
>
OK, thanks.
> Other than that, this looks fine to me.
>
> Reviewed-by: Luis Chamberlain <mcgrof@...nel.org>
>
> Luis
Powered by blists - more mailing lists