linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Huacai Chen <chenhuacai@gmail.com>
To: Luis Chamberlain <mcgrof@kernel.org>
Cc: Huacai Chen <chenhuacai@loongson.cn>,
	Arnd Bergmann <arnd@arndb.de>, Andy Lutomirski <luto@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	David Airlie <airlied@linux.ie>, Jonathan Corbet <corbet@lwn.net>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-arch <linux-arch@vger.kernel.org>,
	"open list:DOCUMENTATION" <linux-doc@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Xuefeng Li <lixuefeng@loongson.cn>,
	Yanteng Si <siyanteng@loongson.cn>,
	Jiaxun Yang <jiaxun.yang@flygoat.com>,
	Jessica Yu <jeyu@kernel.org>
Subject: Re: [PATCH V5 15/22] LoongArch: Add elf and module support
Date: Thu, 14 Oct 2021 11:01:08 +0800	[thread overview]
Message-ID: <CAAhV-H5-8yPjZhOkV2+v+XB85+2qs5342hDdTYAV1ctPAdb7+A@mail.gmail.com> (raw)
In-Reply-To: <YWbXdEyonDpXJFK2@bombadil.infradead.org>

Hi, Luis,

On Wed, Oct 13, 2021 at 8:56 PM Luis Chamberlain <mcgrof@kernel.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@loongson.cn>
> > + *         Huacai Chen <chenhuacai@loongson.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@kernel.org>
>
>   Luis

  reply	other threads:[~2021-10-14  3:01 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-13  6:36 [PATCH V5 00/22] arch: Add basic LoongArch support Huacai Chen
2021-10-13  6:36 ` [PATCH V5 01/22] Documentation: LoongArch: Add basic documentations Huacai Chen
2021-10-13  6:36 ` [PATCH V5 02/22] Documentation/zh_CN: Add basic LoongArch documentations Huacai Chen
2021-10-13  6:36 ` [PATCH V5 03/22] LoongArch: Add elf-related definitions Huacai Chen
2021-10-13  6:36 ` [PATCH V5 04/22] LoongArch: Add writecombine support for drm Huacai Chen
2021-10-13  6:36 ` [PATCH V5 05/22] LoongArch: Add build infrastructure Huacai Chen
2021-10-13  6:36 ` [PATCH V5 06/22] LoongArch: Add CPU definition headers Huacai Chen
2021-10-13  6:36 ` [PATCH V5 07/22] LoongArch: Add atomic/locking headers Huacai Chen
2021-10-13  6:36 ` [PATCH V5 08/22] LoongArch: Add other common headers Huacai Chen
2021-10-13  6:36 ` [PATCH V5 09/22] LoongArch: Add boot and setup routines Huacai Chen
2021-10-13  6:36 ` [PATCH V5 10/22] LoongArch: Add exception/interrupt handling Huacai Chen
2021-10-13  6:36 ` [PATCH V5 11/22] LoongArch: Add process management Huacai Chen
2021-10-13  6:36 ` [PATCH V5 12/22] LoongArch: Add memory management Huacai Chen
2021-10-13  6:36 ` [PATCH V5 13/22] LoongArch: Add system call support Huacai Chen
2021-10-13  7:11 ` [PATCH V5 14/22] LoongArch: Add signal handling support Huacai Chen
2021-10-13  7:11   ` [PATCH V5 15/22] LoongArch: Add elf and module support Huacai Chen
2021-10-13 12:56     ` Luis Chamberlain
2021-10-14  3:01       ` Huacai Chen [this message]
2021-10-13  7:11   ` [PATCH V5 16/22] LoongArch: Add misc common routines Huacai Chen
2021-10-13  7:11   ` [PATCH V5 17/22] LoongArch: Add some library functions Huacai Chen
2021-10-13  7:11   ` [PATCH V5 18/22] LoongArch: Add PCI controller support Huacai Chen
2021-10-13  7:11   ` [PATCH V5 19/22] LoongArch: Add VDSO and VSYSCALL support Huacai Chen
2021-10-13  7:11   ` [PATCH V5 20/22] LoongArch: Add multi-processor (SMP) support Huacai Chen
2021-10-13  7:11   ` [PATCH V5 21/22] LoongArch: Add Non-Uniform Memory Access (NUMA) support Huacai Chen
2021-10-13  7:11   ` [PATCH V5 22/22] LoongArch: Add Loongson-3 default config file Huacai Chen
     [not found] ` <722477bcc461238f96c3b038b2e3379ee49efdac.camel@mengyan1223.wang>
2021-12-21  7:53   ` [PATCH V5 00/22] arch: Add basic LoongArch support Huacai Chen
2021-12-28  8:34     ` Xi Ruoyao
2022-01-05  9:40       ` Huacai Chen
2022-01-05 11:51         ` Xi Ruoyao
2022-01-05 17:21           ` Xi Ruoyao

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=CAAhV-H5-8yPjZhOkV2+v+XB85+2qs5342hDdTYAV1ctPAdb7+A@mail.gmail.com \
    --to=chenhuacai@gmail.com \
    --cc=airlied@linux.ie \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=chenhuacai@loongson.cn \
    --cc=corbet@lwn.net \
    --cc=jeyu@kernel.org \
    --cc=jiaxun.yang@flygoat.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lixuefeng@loongson.cn \
    --cc=luto@kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=peterz@infradead.org \
    --cc=siyanteng@loongson.cn \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /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;
as well as URLs for NNTP newsgroup(s).