Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp411323pxb; Sat, 18 Sep 2021 06:26:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfY8n7gtCSzX6xwuoBy8r52PHWynpQONuvlgVZP8667yWbSOcchSmteS5NGGcM1C1yFAeX X-Received: by 2002:a17:906:2bc7:: with SMTP id n7mr17632651ejg.238.1631971569987; Sat, 18 Sep 2021 06:26:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631971569; cv=none; d=google.com; s=arc-20160816; b=JalpUZ5cG5fwObfyMOghA5CSz6gTfwq1710XBcukMHZv8XBfpoKerAvU0xmKherHzs McKNgRo14AM46F2Q60pYgFrjlLN00oIZXUn5vx6n3u3zlqseQy19VTIlp/fXrq4K227t 1SHtCiFWiqyWWpciDG5nAQhnoqUOzcB1r3KXCPPZkzrVCA0rl4v1L1amwfsVaUt1rDnx r6U4Bc9c+SebMNDsxCcMqHkhLZhfOdzwtSy3jV9RuYJzjsk8N2L4ibd3us/TgB+StveE OBCggeCdp40TKkzhj2QVdHs/jcmTQM1m5Fyjja26I8D0XAf3t+fMfgnrHq9ePOtAB3I9 xxug== 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=BURkVCRjjFHUHfhVT++eM+u/rf30SF7uc8tSLt0X+Oc=; b=tYyT9OwrCPYdvK0GinHq9dweOhIWi1tdqWILORnTY/wA/+vAwyYYGSFojc5qTpfmPI lyZ8qylMspU1PNr60PjF27QRRXEjOCWGAW8mZr63JT2BIUJBgaUUa8SFIS3Jaf7oYl5q ZaIyVSxMhO8654lRq4rlWSeJhFbnrLHW+4Jch3nrg1DtRBB9LXf8y/lAzQmcHk9g+6qp VeTlXhqbMqbsYO2KRL6Ju6rqDITF6tZJAQfvfa//Vg0UQ1uqPcD+6JHvg93wHdqR5tcw KOhWk9qNIrC99OLNvyFGvCL1oyoNZc/N5ZrlJhkT1ZSwwIwNhmwnPeV9l1Q5AyRPskij EOyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=GgvhCGrS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s2si9668348edy.454.2021.09.18.06.25.45; Sat, 18 Sep 2021 06:26:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=GgvhCGrS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238117AbhIRG4j (ORCPT + 99 others); Sat, 18 Sep 2021 02:56:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235239AbhIRG4i (ORCPT ); Sat, 18 Sep 2021 02:56:38 -0400 Received: from mail-vs1-xe2e.google.com (mail-vs1-xe2e.google.com [IPv6:2607:f8b0:4864:20::e2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E584C061574; Fri, 17 Sep 2021 23:55:15 -0700 (PDT) Received: by mail-vs1-xe2e.google.com with SMTP id l19so10115166vst.7; Fri, 17 Sep 2021 23:55:15 -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=BURkVCRjjFHUHfhVT++eM+u/rf30SF7uc8tSLt0X+Oc=; b=GgvhCGrSxZJXPqSYDZUc8JUXWKFzU7zZyiS5sYWBzx+VrbPJZlTx9QyWtObCAF1Nih 3TNw/8O+uXJERZBBoYcDMA5FsQwc5eFzl8ItbWqrPBTZf+6ogqxanup601TX5xC9Svui X1ODd6JW9Xix72sBhN2hcxXjeTeYUbAcBordW6WGY4yyt7nN/sPty3ci6t+Cfw3IP4U6 Jmk+fWlv04O7Zn1Ry4THweYaTHyIsUnuo5dBdoEgxsfqhppXLtAZCTMww/Y/UDZDOP0Q I4cUVm6tiNrHdEifxXaX1DACev5clHbF3TqUVg+88B53MrVVg2fgDRi4rWwyafx1leZk rOAQ== 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=BURkVCRjjFHUHfhVT++eM+u/rf30SF7uc8tSLt0X+Oc=; b=pGpbijfVUVs+wibdUHYqgFM3T8v/bRoSjkkUI5gjFrn45Gp/HkEumrG6CGVw0Sdgvt H9A69+rYFKHtAOxHxXZG8kImmdSsKCF0jlC6laPIn8clSO3SKCX8odL3QZgAxolWqQSL V2lH+cXx/DMODVLLTtNdgDyUQo7Hpy7GTIeWZEBVpH+bWnC8mFxYaoNrZxYZdqRa8IIf jp0DHzpcgChoLnzewpshr2digzlkP9qMvGFEALjschjOAcF5fBb7n4vogw5Lw15fgNOf Q2hi58oc9kyjGjhxehwh7xQUZgL3RFEoh5iC4L0v4z662/cSFb5xP3wzzwtdzXWOK8cd 1Saw== X-Gm-Message-State: AOAM530ZDDi0KHp6nMT9vhGqxe4+rkmOrmmPCOhu99bRm6zPPeuZbBQ0 bjqQ3c4LljIMPbhbKK5yRvZvclITGm3FF4rEy6E= X-Received: by 2002:a67:441:: with SMTP id 62mr11548405vse.54.1631948114246; Fri, 17 Sep 2021 23:55:14 -0700 (PDT) MIME-Version: 1.0 References: <20210917035736.3934017-1-chenhuacai@loongson.cn> <20210917035736.3934017-14-chenhuacai@loongson.cn> In-Reply-To: From: Huacai Chen Date: Sat, 18 Sep 2021 14:55:02 +0800 Message-ID: Subject: Re: [PATCH V3 13/22] LoongArch: Add system call support To: Arnd Bergmann Cc: Huacai Chen , Andy Lutomirski , Thomas Gleixner , Peter Zijlstra , Andrew Morton , David Airlie , Jonathan Corbet , Linus Torvalds , linux-arch , "open list:DOCUMENTATION" , Linux Kernel Mailing List , Xuefeng Li , Yanteng Si , Jiaxun Yang Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Arnd, On Fri, Sep 17, 2021 at 4:24 PM Arnd Bergmann wrote: > > On Fri, Sep 17, 2021 at 5:57 AM Huacai Chen wrote: > > +#define NR_syscalls (__NR_syscalls) > > diff --git a/arch/loongarch/include/uapi/asm/unistd.h b/arch/loongarch/include/uapi/asm/unistd.h > > new file mode 100644 > > index 000000000000..b344b1f91715 > > --- /dev/null > > +++ b/arch/loongarch/include/uapi/asm/unistd.h > > @@ -0,0 +1,6 @@ > > +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ > > +#define __ARCH_WANT_NEW_STAT > > +#define __ARCH_WANT_SYS_CLONE > > +#define __ARCH_WANT_SYS_CLONE3 > > I still think you need to remove __ARCH_WANT_NEW_STAT and > __ARCH_WANT_SYS_CLONE here. > > I understand that those are needed for the transitional period when you > still need to support your existing glibc library files, but you likely still > have other kernel patches that are not part of this series, so I suggest > you add those two lines as a custom patch there until you are ready to > drop support for old libc. The clone story: When I sent V1 of this series, the upstream glibc (2.33) hadn't merge the clone3 support. Now glibc 2.34 has merged clone3, so __ARCH_WANT_SYS_CLONE seems can be removed. But I think there is someone just download this series and suppose it can work with current userspace. So I want to keep it for a while, until this series can be merged. The statx story: The latest upstream glibc (2.34) is still like this (sysdeps/unix/sysv/linux/fstatat64.c): #if (__WORDSIZE == 32 \ && (!defined __SYSCALL_WORDSIZE || __SYSCALL_WORDSIZE == 32)) \ || defined STAT_HAS_TIME32 # define FSTATAT_USE_STATX 1 #else # define FSTATAT_USE_STATX 0 #endif This means statx is supposed to use in 32bit systems, or 64bit systems with 32bit timestamp (e.g. MIPS64). So I think __ARCH_WANT_NEW_STAT is still needed. > > > + > > +SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len, > > + unsigned long, prot, unsigned long, flags, unsigned long, > > + fd, off_t, offset) > > +{ > > + if (offset & ~PAGE_MASK) > > + return -EINVAL; > > + return ksys_mmap_pgoff(addr, len, prot, flags, fd, > > + offset >> PAGE_SHIFT); > > +} > > + > > +SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len, > > + unsigned long, prot, unsigned long, flags, unsigned long, fd, > > + unsigned long, pgoff) > > +{ > > + if (pgoff & (~PAGE_MASK >> 12)) > > + return -EINVAL; > > + > > + return ksys_mmap_pgoff(addr, len, prot, flags, fd, > > + pgoff >> (PAGE_SHIFT - 12)); > > +} > > sys_mmap2() is only used on 32-bit architectures, you only need > sys_mmap() here. > > Ideally we'd just move those two definitions you have here into > mm/mmap.c and remove all the duplicate definitions. Maybe > you can come up with a patch to do this? > > Note that some architectures use either nonstandard names, > or shift value other than 12, so those need to keep their own > versions. OK, sys_mmap2() will be removed. But can "move sys_mmap() to mm/mmap.c" be done by others? (I think my credit is not enough to do this, at least now). Huacai > > Arnd