Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp657013iob; Wed, 18 May 2022 10:00:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUCqS4PoK/yr0fk/NDHf/GeGgtJTBjqedwIMeuQKaCotpdohrtj4eo6Z4A5gfJC61mQSc7 X-Received: by 2002:a63:3409:0:b0:3ab:4d72:1f0a with SMTP id b9-20020a633409000000b003ab4d721f0amr352536pga.420.1652893252986; Wed, 18 May 2022 10:00:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652893252; cv=none; d=google.com; s=arc-20160816; b=Tum8dJMOg/ZQVYi516lLU/05T9BHXSpTKT2FSEyjUDHTyJc7uXK9kdD3ONYqmXH1mp LCHRxZrExwGaxOxJGEbfRGZzI/GLrFooIse8l41qhkp3WXhb+SCtHZ5AKTZLZhfUUHii XM8ibYjrZWrfBRkOeBYsPRaClMEy7ecRpwONH3g5M5kk6kE9H5+V4J/A9eoMmpgaPo3J dFd+aBMFCM8wrVsAqMyiJRc2tM6eA8sqyLG9dv1q1daqb0o7Jb+o21zPCduDD63j0/4R qBl/XrTvxAwVMNO1SnBHxtetp4S+pmhNBbA6Ubjb4yqoPrZdK1TwI4q6PL2HJEJZjCGZ PZPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=olguYhICHMpk2ctYiMxEpCHQEQIGnr/VO6tDtpsZhI4=; b=mXLumXCoo+PZw+RLmAlXNZ/IQvN+aOQv8RF79Zl9nP1/1v3iHSPgSfT0Sh/XV+5sTP TMSJhhLmZQSFgsB25FY3uol62BuTSD1Fk158iAgyZZTisWqpqFU2QfSnxOjw8fcypVqE oIGJIFIwBKmz5buagDpziUEU/3uysTIKXM0DkTFtUX/y0Mr0lDR2gNHUWmdxoQwC111U ps3DEsBEG1gyOWlTIMPwJSC8+ATdnS4iJ6WZBmpny9JjYRqISNTcHTuMLV72RwbH5EKF sQK7iKqphVo2abZLx3/mkPTHis7hmlZ3YQo9ChMrEOcKq6xDEcQWHjVMnsc/65XC+5/C Fg/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=evhgvtGZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id na8-20020a17090b4c0800b001c9e16e3b0dsi3194400pjb.73.2022.05.18.10.00.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 May 2022 10:00:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=evhgvtGZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 76F75D8089; Wed, 18 May 2022 09:56:43 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240615AbiERQ4Y (ORCPT + 99 others); Wed, 18 May 2022 12:56:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240586AbiERQyk (ORCPT ); Wed, 18 May 2022 12:54:40 -0400 Received: from mail-ua1-x92f.google.com (mail-ua1-x92f.google.com [IPv6:2607:f8b0:4864:20::92f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF479201394; Wed, 18 May 2022 09:54:36 -0700 (PDT) Received: by mail-ua1-x92f.google.com with SMTP id 90so1053905uam.8; Wed, 18 May 2022 09:54:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=olguYhICHMpk2ctYiMxEpCHQEQIGnr/VO6tDtpsZhI4=; b=evhgvtGZikjzHZh4O3xNSDiWD6D3AEmA1+RNqZ2K5y0E2agNcv001H7iUC3Zhd8+dF L4xGeCtgjofqz9ru806hEF2EtlPJMeUmYAaDejjxeSZJCUafH4+sg7a6axt5Xc1aSkVN 0AYRnM1mUmxpN1t3BPNGjm7fZA7kvI6pJ0CasVvL/VmhZJUxi602KGVb96aBlAeKSrE2 nPCz2PvfbwOnEQG9Lem5EsX2Wa7e/ugBA29UDPJV+7aqd1ZALnWg50DJJvQ/83dareaC CBLSBAaYaNewA3NqSn+pbBd2vkd1MCvptA67T+4OeyQBXNdrXdhV9QcK8gpbaCD1luUP riXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=olguYhICHMpk2ctYiMxEpCHQEQIGnr/VO6tDtpsZhI4=; b=Ed1fUtRpaIqhP0+KvUeYYMbu7hCxOtn4a4jFSAY+eJfnu0f7d0UcLriTtheUXWWfCn k+hZIseC5TkE/JdEF5YpElkZoSIxCE8UzwLipJP6Fkt8qcECu3xEWov4rXSSCLK/Is9S UNew9iEAZmGlNLHFqdhZQ1JGqP+rLTyoHKB2ogSlmXbCPWOlBEi4/aq0+4DkDBlbb8A0 bHrTDJ75DrgtZBFnT8CGfDcLgoddi/A9ydqf7cYsHqMKtKyRwjBpFs1iAJ0DcpoB8ir8 FUaTFobc2it+EiGFYq2BF3OENL2gPTKRW2Q0SmpWo908dWGjSonAaXMEJc7tWJW77M7n uo4A== X-Gm-Message-State: AOAM532xxouWGlEdrCxGWmFtwjiFxh7tBU0AT3z9PYf0u2+ZXzp3MutY XJB8LOUU5ubX6tEmX7WqywKzlF9/d0pQWeaI1EE= X-Received: by 2002:ab0:72d5:0:b0:368:aad4:5ef8 with SMTP id g21-20020ab072d5000000b00368aad45ef8mr373535uap.27.1652892876048; Wed, 18 May 2022 09:54:36 -0700 (PDT) MIME-Version: 1.0 References: <20220518092619.1269111-1-chenhuacai@loongson.cn> <20220518092619.1269111-15-chenhuacai@loongson.cn> <87ilq294mg.fsf@email.froward.int.ebiederm.org> In-Reply-To: <87ilq294mg.fsf@email.froward.int.ebiederm.org> From: Huacai Chen Date: Thu, 19 May 2022 00:54:24 +0800 Message-ID: Subject: Re: [PATCH V11 14/22] LoongArch: Add signal handling support To: "Eric W. Biederman" Cc: Huacai Chen , Arnd Bergmann , Andy Lutomirski , Thomas Gleixner , Peter Zijlstra , Andrew Morton , David Airlie , Jonathan Corbet , Linus Torvalds , linux-arch , "open list:DOCUMENTATION" , LKML , Xuefeng Li , Yanteng Si , Guo Ren , Xuerui Wang , Jiaxun Yang , Stephen Rothwell , Al Viro Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Eric, On Thu, May 19, 2022 at 12:40 AM Eric W. Biederman wrote: > > Huacai Chen writes: > > > Add ucontext/sigcontext definition and signal handling support for > > LoongArch. > > > > Cc: Eric Biederman > > Cc: Al Viro > > Signed-off-by: Huacai Chen > > --- > > 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 > > + * Huacai Chen > > + * > > + * Copyright (C) 2020-2022 Loongson Technology Corporation Limited > > + */ > > +#ifndef _UAPI_ASM_SIGCONTEXT_H > > +#define _UAPI_ASM_SIGCONTEXT_H > > + > > +#include > > +#include > > + > > +/* 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? Huacai > > Eric