From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id 322393858408 for ; Wed, 3 Aug 2022 03:12:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 322393858408 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=loongson.cn Received: from [10.20.4.187] (unknown [10.20.4.187]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9Dx4M6o5+lisIMCAA--.11905S3; Wed, 03 Aug 2022 11:12:40 +0800 (CST) Subject: Re: [PATCH 1/3] LoongArch: Add vdso support for gettimeofday. To: Carlos O'Donell , Adhemerval Zanella Netto , libc-alpha@sourceware.org, i.swmail@xen0n.name Cc: joseph_myers@mentor.com, xuchenghua@loongson.cn References: <20220728073009.2588790-1-caiyinyu@loongson.cn> <20220728073009.2588790-2-caiyinyu@loongson.cn> <397fae36-6577-58d9-17cd-b27ab2dce02b@linaro.org> <0e33d820-f57a-e1be-24d3-4b86940b2f37@redhat.com> From: caiyinyu Message-ID: <118ed104-d76f-f962-b081-f89feb9f8517@loongson.cn> Date: Wed, 3 Aug 2022 11:12:39 +0800 User-Agent: Mozilla/5.0 (X11; Linux mips64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <0e33d820-f57a-e1be-24d3-4b86940b2f37@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-CM-TRANSID: AQAAf9Dx4M6o5+lisIMCAA--.11905S3 X-Coremail-Antispam: 1UD129KBjvJXoW3Jw17WF4DGFWfCr43ur15urg_yoW3WFy3pw 4jgF48GF40vrWkZFWIyr1DCrykC34kGr4UZF1ftFs0yFyxuw47KF98XF98WasxWr4xC39r ZFn5Zay5Jwn5GrUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvv14x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26r4j6ryUM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26F4j 6r4UJwA2z4x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E14v26F 4UJVW0owAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv 7VC0I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r 1j6r4UM4x0Y48IcVAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCYjI0SjxkI62AI1cAE 67vIY487MxkIecxEwVCm-wCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8Jw C20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAF wI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjx v20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6rW3Jr0E3s1lIxAIcVC2 z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVWUJVW8JbIYCTnIWIevJa73Uj IFyTuYvjfUoOJ5UUUUU X-CM-SenderInfo: 5fdl5xhq1xqz5rrqw2lrqou0/ X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_SHORT, NICE_REPLY_A, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2022 03:12:48 -0000 在 2022/7/29 下午11:10, Carlos O'Donell 写道: > On 7/28/22 08:58, Adhemerval Zanella Netto wrote: >> I think we should postpone it to 2.37, it is an optimization and we >> can backport it if required. > Agreed, lets wait until after the release for this. > > vDSO additions can be done at any point in time after the release and backported. The new vdsotest results with this patch are much better on kernel 5.19 rc1 (old results[1]): clock-gettime-monotonic: syscall: 228 nsec/call clock-gettime-monotonic:    libc: 30 nsec/call clock-gettime-monotonic:    vdso: 29 nsec/call clock-getres-monotonic: syscall: 196 nsec/call clock-getres-monotonic:    libc: 9 nsec/call clock-getres-monotonic:    vdso: 5 nsec/call clock-gettime-monotonic-coarse: syscall: 217 nsec/call clock-gettime-monotonic-coarse:    libc: 25 nsec/call clock-gettime-monotonic-coarse:    vdso: 24 nsec/call clock-getres-monotonic-coarse: syscall: 198 nsec/call clock-getres-monotonic-coarse:    libc: 8 nsec/call clock-getres-monotonic-coarse:    vdso: 4 nsec/call clock-gettime-monotonic-raw: syscall: 226 nsec/call clock-gettime-monotonic-raw:    libc: 30 nsec/call clock-gettime-monotonic-raw:    vdso: 29 nsec/call clock-getres-monotonic-raw: syscall: 196 nsec/call clock-getres-monotonic-raw:    libc: 9 nsec/call clock-getres-monotonic-raw:    vdso: 5 nsec/call clock-gettime-tai: syscall: 230 nsec/call clock-gettime-tai:    libc: 30 nsec/call clock-gettime-tai:    vdso: 29 nsec/call clock-getres-tai: syscall: 196 nsec/call clock-getres-tai:    libc: 9 nsec/call clock-getres-tai:    vdso: 5 nsec/call clock-gettime-boottime: syscall: 228 nsec/call clock-gettime-boottime:    libc: 30 nsec/call clock-gettime-boottime:    vdso: 29 nsec/call clock-getres-boottime: syscall: 196 nsec/call clock-getres-boottime:    libc: 9 nsec/call clock-getres-boottime:    vdso: 5 nsec/call clock-gettime-realtime: syscall: 227 nsec/call clock-gettime-realtime:    libc: 30 nsec/call clock-gettime-realtime:    vdso: 29 nsec/call clock-getres-realtime: syscall: 196 nsec/call clock-getres-realtime:    libc: 9 nsec/call clock-getres-realtime:    vdso: 5 nsec/call clock-gettime-realtime-coarse: syscall: 225 nsec/call clock-gettime-realtime-coarse:    libc: 25 nsec/call clock-gettime-realtime-coarse:    vdso: 24 nsec/call clock-getres-realtime-coarse: syscall: 198 nsec/call clock-getres-realtime-coarse:    libc: 8 nsec/call clock-getres-realtime-coarse:    vdso: 4 nsec/call getcpu: syscall: 176 nsec/call getcpu:    libc: 8 nsec/call getcpu:    vdso: 6 nsec/call gettimeofday: syscall: 213 nsec/call gettimeofday:    libc: 29 nsec/call gettimeofday:    vdso: 29 nsec/call [1]: on kernel 5.18 clock-gettime-monotonic: syscall: 228 nsec/call clock-gettime-monotonic: libc: 243 nsec/call clock-gettime-monotonic: vdso: 239 nsec/call clock-getres-monotonic: syscall: 196 nsec/call clock-getres-monotonic: libc: 8 nsec/call clock-getres-monotonic: vdso: 5 nsec/call clock-gettime-monotonic-coarse: syscall: 218 nsec/call clock-gettime-monotonic-coarse: libc: 25 nsec/call clock-gettime-monotonic-coarse: vdso: 24 nsec/call clock-getres-monotonic-coarse: syscall: 198 nsec/call clock-getres-monotonic-coarse: libc: 8 nsec/call clock-getres-monotonic-coarse: vdso: 4 nsec/call clock-gettime-monotonic-raw: syscall: 228 nsec/call clock-gettime-monotonic-raw: libc: 243 nsec/call clock-gettime-monotonic-raw: vdso: 240 nsec/call clock-getres-monotonic-raw: syscall: 197 nsec/call clock-getres-monotonic-raw: libc: 8 nsec/call clock-getres-monotonic-raw: vdso: 4 nsec/call clock-gettime-tai: syscall: 231 nsec/call clock-gettime-tai: libc: 246 nsec/call clock-gettime-tai: vdso: 242 nsec/call clock-getres-tai: syscall: 197 nsec/call clock-getres-tai: libc: 8 nsec/call clock-getres-tai: vdso: 4 nsec/call clock-gettime-boottime: syscall: 229 nsec/call clock-gettime-boottime: libc: 243 nsec/call clock-gettime-boottime: vdso: 240 nsec/call clock-getres-boottime: syscall: 196 nsec/call clock-getres-boottime: libc: 8 nsec/call clock-getres-boottime: vdso: 4 nsec/call clock-gettime-realtime: syscall: 228 nsec/call clock-gettime-realtime: libc: 242 nsec/call clock-gettime-realtime: vdso: 239 nsec/call clock-getres-realtime: syscall: 197 nsec/call clock-getres-realtime: libc: 8 nsec/call clock-getres-realtime: vdso: 5 nsec/call clock-gettime-realtime-coarse: syscall: 227 nsec/call clock-gettime-realtime-coarse: libc: 25 nsec/call clock-gettime-realtime-coarse: vdso: 24 nsec/call clock-getres-realtime-coarse: syscall: 198 nsec/call clock-getres-realtime-coarse: libc: 7 nsec/call clock-getres-realtime-coarse: vdso: 4 nsec/call getcpu: syscall: 178 nsec/call getcpu: libc: 179 nsec/call getcpu: vdso: not tested Note: vDSO version of getcpu not found gettimeofday: syscall: 215 nsec/call gettimeofday: libc: 226 nsec/call gettimeofday: vdso: 226 nsec/call > >> The patch looks ok though. >> >> On 28/07/22 04:30, caiyinyu wrote: >>> --- >>> .../unix/sysv/linux/loongarch/gettimeofday.c | 22 +++++++++++++++++++ >>> sysdeps/unix/sysv/linux/loongarch/sysdep.h | 1 + >>> 2 files changed, 23 insertions(+) >>> create mode 100644 sysdeps/unix/sysv/linux/loongarch/gettimeofday.c >>> >>> diff --git a/sysdeps/unix/sysv/linux/loongarch/gettimeofday.c b/sysdeps/unix/sysv/linux/loongarch/gettimeofday.c >>> new file mode 100644 >>> index 0000000000..ee35a08650 >>> --- /dev/null >>> +++ b/sysdeps/unix/sysv/linux/loongarch/gettimeofday.c >>> @@ -0,0 +1,22 @@ >>> +/* gettimeofday -- Get the current time of day. >>> + Copyright (C) 2022 Free Software Foundation, Inc. >>> + >>> + This file is part of the GNU C Library. >>> + >>> + The GNU C Library is free software; you can redistribute it and/or >>> + modify it under the terms of the GNU Lesser General Public >>> + License as published by the Free Software Foundation; either >>> + version 2.1 of the License, or (at your option) any later version. >>> + >>> + The GNU C Library is distributed in the hope that it will be useful, >>> + but WITHOUT ANY WARRANTY; without even the implied warranty of >>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >>> + Lesser General Public License for more details. >>> + >>> + You should have received a copy of the GNU Lesser General Public >>> + License along with the GNU C Library. If not, see >>> + . */ >>> + >>> + >>> +#define USE_IFUNC_GETTIMEOFDAY >>> +#include >>> diff --git a/sysdeps/unix/sysv/linux/loongarch/sysdep.h b/sysdeps/unix/sysv/linux/loongarch/sysdep.h >>> index c586df819c..306e0af3a3 100644 >>> --- a/sysdeps/unix/sysv/linux/loongarch/sysdep.h >>> +++ b/sysdeps/unix/sysv/linux/loongarch/sysdep.h >>> @@ -116,6 +116,7 @@ >>> /* List of system calls which are supported as vsyscalls. */ >>> #define HAVE_CLOCK_GETRES64_VSYSCALL "__vdso_clock_getres" >>> #define HAVE_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime" >>> +#define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" >>> #define HAVE_GETCPU_VSYSCALL "__vdso_getcpu" >>> >>> #define HAVE_CLONE3_WRAPPER 1 >