All of lore.kernel.org
 help / color / mirror / Atom feed
From: WANG Xuerui <kernel@xen0n.name>
To: Huacai Chen <chenhuacai@gmail.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>
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>, Guo Ren <guoren@kernel.org>,
	Xuerui Wang <kernel@xen0n.name>,
	Jiaxun Yang <jiaxun.yang@flygoat.com>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH V11 14/22] LoongArch: Add signal handling support
Date: Thu, 19 May 2022 01:17:19 +0800	[thread overview]
Message-ID: <36f11c19-0cc5-cf56-b41d-6cad4878ddb3@xen0n.name> (raw)
In-Reply-To: <CAAhV-H5Aov1NVsbNWZa9psPhBiNssYWWEzNOyLooeXGKsYxN+w@mail.gmail.com>

On 5/19/22 00:54, Huacai Chen wrote:
> Hi, Eric,
>
> On Thu, May 19, 2022 at 12:40 AM Eric W. Biederman
> <ebiederm@xmission.com> wrote:
>> Huacai Chen <chenhuacai@loongson.cn> writes:
>>
>>> Add ucontext/sigcontext definition and signal handling support for
>>> LoongArch.
>>>
>>> Cc: Eric Biederman <ebiederm@xmission.com>
>>> Cc: Al Viro <viro@zeniv.linux.org.uk>
>>> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
>>> ---
>>>   arch/loongarch/include/uapi/asm/sigcontext.h |  44 ++
>>>   arch/loongarch/include/uapi/asm/signal.h     |  13 +
>>>   arch/loongarch/include/uapi/asm/ucontext.h   |  35 ++
>>>   arch/loongarch/kernel/signal.c               | 566 +++++++++++++++++++
>>>   4 files changed, 658 insertions(+)
>>>   create mode 100644 arch/loongarch/include/uapi/asm/sigcontext.h
>>>   create mode 100644 arch/loongarch/include/uapi/asm/signal.h
>>>   create mode 100644 arch/loongarch/include/uapi/asm/ucontext.h
>>>   create mode 100644 arch/loongarch/kernel/signal.c
>>>
>>> diff --git a/arch/loongarch/include/uapi/asm/sigcontext.h b/arch/loongarch/include/uapi/asm/sigcontext.h
>>> new file mode 100644
>>> index 000000000000..be3d3c6ac83e
>>> --- /dev/null
>>> +++ b/arch/loongarch/include/uapi/asm/sigcontext.h
>>> @@ -0,0 +1,44 @@
>>> +/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
>>> +/*
>>> + * Author: Hanlu Li <lihanlu@loongson.cn>
>>> + *         Huacai Chen <chenhuacai@loongson.cn>
>>> + *
>>> + * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
>>> + */
>>> +#ifndef _UAPI_ASM_SIGCONTEXT_H
>>> +#define _UAPI_ASM_SIGCONTEXT_H
>>> +
>>> +#include <linux/types.h>
>>> +#include <linux/posix_types.h>
>>> +
>>> +/* FP context was used */
>>> +#define SC_USED_FP           (1 << 0)
>>> +/* Address error was due to memory load */
>>> +#define SC_ADDRERR_RD                (1 << 30)
>>> +/* Address error was due to memory store */
>>> +#define SC_ADDRERR_WR                (1 << 31)
>>> +
>>> +struct sigcontext {
>>> +     __u64   sc_pc;
>>> +     __u64   sc_regs[32];
>>> +     __u32   sc_flags;
>>> +     __u64   sc_extcontext[0] __attribute__((__aligned__(16)));
>>> +};
>>> +
>>> +#define CONTEXT_INFO_ALIGN   16
>>> +struct _ctxinfo {
>>> +     __u32   magic;
>>> +     __u32   size;
>>> +     __u64   padding;        /* padding to 16 bytes */
>>> +};
>> This is probably something I a missing but what is struct _ctxinfo and
>> why is it in a uapi header?
>>
>> I don't see anything else in the uapi implementation using it.
> This is used by get_ctx_through_ctxinfo() in signal.c and I think
> similar function is also needed by userspace.
>
> Its name is once before called context_info but conflict with another
> software, then I want to use ctx_info but conflict with another kernel
> struct. :(
>> Symbols that start with an underscore "_" are reserved and should not
>> be used in general, and especially not in uapi header files.
> Then, maybe we can use sctx_info here?

Actually it seems to me that this struct is the header of each 
sc_extcontext; i.e. one struct sigcontext with 0~N trailing 
"sc_extcontext", and each "sc_extcontext" consists of one "struct 
_ctxinfo" header plus the real content. For now there's only the FPU 
context but the LSX/LASX/LBT contexts will come later. The "magic" and 
"size" fields also matches the definitions following.

So I'd suggest something like "struct sc_extcontext_head" while naming 
the individual contexts like "struct sc_extcontext_foo", e.g. "struct 
sc_extcontext_fpu". The "sc_extcontext" part could use some further 
abbreviation but the end result should be something intuitive.

>
> Huacai
>> Eric

  reply	other threads:[~2022-05-18 17:17 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-18  9:25 [PATCH V11 00/22] arch: Add basic LoongArch support Huacai Chen
2022-05-18  9:25 ` [PATCH V11 01/22] Documentation: LoongArch: Add basic documentations Huacai Chen
2022-05-18 15:34   ` WANG Xuerui
2022-05-18  9:25 ` [PATCH V11 02/22] Documentation/zh_CN: Add basic LoongArch documentations Huacai Chen
2022-05-18 15:32   ` WANG Xuerui
2022-05-20  7:37   ` Guo Ren
2022-05-20  7:43     ` WANG Xuerui
2022-05-18  9:26 ` [PATCH V11 03/22] LoongArch: Add ELF-related definitions Huacai Chen
2022-05-18  9:26 ` [PATCH V11 04/22] LoongArch: Add writecombine support for drm Huacai Chen
2022-05-18  9:26   ` Huacai Chen
2022-05-18  9:26 ` [PATCH V11 05/22] LoongArch: Add build infrastructure Huacai Chen
2022-05-18 15:22   ` WANG Xuerui
2022-05-20  7:25   ` Guo Ren
2022-05-18  9:26 ` [PATCH V11 06/22] LoongArch: Add CPU definition headers Huacai Chen
2022-05-18 15:45   ` WANG Xuerui
2022-05-18 16:12     ` Huacai Chen
2022-05-18  9:26 ` [PATCH V11 07/22] LoongArch: Add atomic/locking headers Huacai Chen
2022-05-18 15:54   ` WANG Xuerui
2022-05-20  7:54   ` Guo Ren
2022-05-20  9:50     ` Huacai Chen
2022-05-20 18:14       ` Guo Ren
2022-05-21  1:55         ` Huacai Chen
2022-05-18  9:26 ` [PATCH V11 08/22] LoongArch: Add other common headers Huacai Chen
2022-05-18 16:04   ` WANG Xuerui
2022-05-18  9:26 ` [PATCH V11 09/22] LoongArch: Add boot and setup routines Huacai Chen
2022-05-18 15:17   ` WANG Xuerui
2022-05-18 16:08     ` Huacai Chen
2022-05-20  9:17   ` Ard Biesheuvel
2022-05-20  9:41     ` Javier Martinez Canillas
2022-05-20 14:09       ` Huacai Chen
2022-05-20 14:23         ` Javier Martinez Canillas
2022-05-20 15:19           ` Huacai Chen
2022-05-20 16:32             ` Javier Martinez Canillas
2022-05-21  1:40               ` Huacai Chen
2022-05-21  7:06                 ` Javier Martinez Canillas
2022-05-21  7:37                   ` Huacai Chen
2022-05-21  9:06                     ` Javier Martinez Canillas
2022-05-21  9:13                       ` Huacai Chen
2022-05-21  9:43                         ` Javier Martinez Canillas
2022-05-20 15:53     ` Huacai Chen
2022-05-24  8:27   ` Xi Ruoyao
2022-05-24 10:59     ` Huacai Chen
2022-05-24 12:48       ` 李超
2022-05-18  9:26 ` [PATCH V11 10/22] LoongArch: Add exception/interrupt handling Huacai Chen
2022-05-18  9:26 ` [PATCH V11 11/22] LoongArch: Add process management Huacai Chen
2022-05-18  9:26 ` [PATCH V11 12/22] LoongArch: Add memory management Huacai Chen
2022-05-18  9:26 ` [PATCH V11 13/22] LoongArch: Add system call support Huacai Chen
2022-05-18  9:26 ` [PATCH V11 14/22] LoongArch: Add signal handling support Huacai Chen
2022-05-18 16:13   ` WANG Xuerui
2022-05-18 16:39   ` Eric W. Biederman
2022-05-18 16:54     ` Huacai Chen
2022-05-18 17:17       ` WANG Xuerui [this message]
2022-05-18  9:26 ` [PATCH V11 15/22] LoongArch: Add ELF and module support Huacai Chen
2022-05-18  9:26 ` [PATCH V11 16/22] LoongArch: Add misc common routines Huacai Chen
2022-05-18  9:57 ` [PATCH V11 17/22] LoongArch: Add some library functions Huacai Chen
2022-05-18  9:57   ` [PATCH V11 18/22] LoongArch: Add PCI controller support Huacai Chen
2022-05-18  9:57   ` [PATCH V11 19/22] LoongArch: Add VDSO and VSYSCALL support Huacai Chen
2022-05-18  9:57   ` [PATCH V11 20/22] LoongArch: Add multi-processor (SMP) support Huacai Chen
2022-05-18  9:57   ` [PATCH V11 21/22] LoongArch: Add Non-Uniform Memory Access (NUMA) support Huacai Chen
2022-05-18  9:57   ` [PATCH V11 22/22] LoongArch: Add Loongson-3 default config file Huacai Chen
2022-05-18 13:42 ` [PATCH V11 00/22] arch: Add basic LoongArch support Arnd Bergmann
2022-05-18 17:18   ` Huacai Chen
2022-05-18 22:36   ` Stephen Rothwell
2022-05-22  4:18 ` WANG Xuerui

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=36f11c19-0cc5-cf56-b41d-6cad4878ddb3@xen0n.name \
    --to=kernel@xen0n.name \
    --cc=airlied@linux.ie \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=chenhuacai@gmail.com \
    --cc=chenhuacai@loongson.cn \
    --cc=corbet@lwn.net \
    --cc=ebiederm@xmission.com \
    --cc=guoren@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=peterz@infradead.org \
    --cc=sfr@canb.auug.org.au \
    --cc=siyanteng@loongson.cn \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.