From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS17314 8.43.84.0/22 X-Spam-Status: No, score=-4.2 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id D8A661F8C6 for ; Mon, 12 Jul 2021 14:29:47 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E591D3839829 for ; Mon, 12 Jul 2021 14:29:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E591D3839829 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1626100186; bh=9J1dJhhTfYmWX9DmcNPoQezRq7WQC77lJ9yCb7JG87w=; h=To:Subject:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=ISNIj+acXxb/smGgrf/W2KNIxg9P+pMb/O1l2nVIEx0Gwgxw/nCLkhxeHZ/WpQuxd EKn1dkV4rG8hA33zt8oT4y5sZE1eBGWOSbH2gqcuk30G8h54POV0ogVGNN0/x2IG/D xEX/rc3rHn74egVOKmfoqVvmh1Pl3aaTeWMly6xM= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 121AF3855023 for ; Mon, 12 Jul 2021 14:29:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 121AF3855023 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-575-VzlBFVaiNhSX-2POKtNUlQ-1; Mon, 12 Jul 2021 10:29:25 -0400 X-MC-Unique: VzlBFVaiNhSX-2POKtNUlQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4BACA80006E; Mon, 12 Jul 2021 14:29:24 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-112-103.rdu2.redhat.com [10.10.112.103]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7221A1971B; Mon, 12 Jul 2021 14:29:23 +0000 (UTC) To: Adhemerval Zanella Subject: Re: [PATCH] Linux: Use 32-bit vDSO for clock_gettime, gettimeofday, time (bug 28071) References: <87czrqf5un.fsf@oldenburg.str.redhat.com> <878s2ef19p.fsf@oldenburg.str.redhat.com> <874kd2ey6s.fsf@oldenburg.str.redhat.com> <158cdbcb-5335-9ff4-cf3e-a45d8603d029@linaro.org> <878s2bdddm.fsf@oldenburg.str.redhat.com> <87zgurad11.fsf@oldenburg.str.redhat.com> <03207aa6-6bf3-febe-2b7f-30174faede60@linaro.org> Date: Mon, 12 Jul 2021 16:29:20 +0200 In-Reply-To: <03207aa6-6bf3-febe-2b7f-30174faede60@linaro.org> (Adhemerval Zanella's message of "Mon, 12 Jul 2021 11:20:26 -0300") Message-ID: <87bl77a9mn.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain 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: , From: Florian Weimer via Libc-alpha Reply-To: Florian Weimer Cc: libc-alpha@sourceware.org Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" * Adhemerval Zanella: >> I'm a bit surprised that we still see the extra syscalls with your >> patch, but I suppose that's just the way the INTERNAL_VSYSCALL_CALL >> macro works. > > The INTERNAL_VSYSCALL_CALL issues the syscall if the vDSO is not present > as a fallback mechanism. It should not be really necessary on most > implementation currently, but there are some architectures and kernel > version where the vDSO does not actually does it (I think mips on kernel > 4.x version). But we check the function pointer before that, so we should never hit the fallback path. That's what confuses me. Here's what I see on s390-linux-gnu (7.9.z). System glibc (glibc-2.17-324.el7_9.s390): munmap(0x7d4e3000, 35579) = 0 fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7d4eb000 write(1, "errno = Success (0)\n", 20errno = Success (0) ) = 20 write(1, "errno = Success (0)\n", 20errno = Success (0) ) = 20 exit_group(1) = ? Current development glibc with your patch applied on top: ugetrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM_INFINITY}) = 0 syscall_0x193(0, 0x7f916310, 0x7f91652c, 0x7f9163fc, 0x400638, 0x7f916518) = -1 ENOSYS (Function not implemented) clock_gettime(CLOCK_REALTIME, {tv_sec=1626099916, tv_nsec=791410856}) = 0 statx(1, "", AT_STATX_SYNC_AS_STAT|AT_NO_AUTOMOUNT|AT_EMPTY_PATH, STATX_BASIC_STATS, 0x7f915a90) = -1 ENOSYS (Function not implemented) fstatat64(1, "", {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}, AT_EMPTY_PATH) = 0 getrandom("\x16\x60\xeb\x47", 4, GRND_NONBLOCK) = 4 brk(NULL) = 0x7d9e9000 brk(0x7da0a000) = 0x7da0a000 write(1, "errno = Success (0)\n", 20errno = Success (0) ) = 20 syscall_0x193(0x1, 0x7f916310, 0x14, 0xfd46054a, 0x400638, 0x7f916518) = -1 ENOSYS (Function not implemented) clock_gettime(CLOCK_MONOTONIC, {tv_sec=29888, tv_nsec=604781810}) = 0 write(1, "errno = Success (0)\n", 20errno = Success (0) ) = 20 The vdso has this (according to /lib/modules/3.10.0-1160.31.1.el7.s390x/vdso/vdso32.so, have not checked at run time): 2: 00000300 84 FUNC GLOBAL DEFAULT 7 __kernel_clock_getres@@LINUX_2.6.29 3: 00000230 208 FUNC GLOBAL DEFAULT 7 __kernel_gettimeofday@@LINUX_2.6.29 5: 00000354 410 FUNC GLOBAL DEFAULT 7 __kernel_clock_gettime@@LINUX_2.6.29 >> Regarding the actual patch, there are a few missing spaces before >> parenthesis: >> >> + int (*vdso_time64)(clockid_t clock_id, struct __timespec64 *tp) >> + = GLRO(dl_vdso_clock_gettime64); >> + int (*vdso_time)(clockid_t clock_id, struct timespec *tp) >> + = GLRO(dl_vdso_clock_gettime); > > My understanding is for GLRO the space is not really required because the > macro is not used a function call. I followed the same idea for the > function pointer definition. I think the the ( in the pointer type still qualifies for the space because it is related to function application. We use the space in all prototypes, after all. > Regardless of the missing space, are you ok with my patch then? It gets rid of the ENOSYS error, so it is a step forward. Thanks, Florian