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: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, 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 (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 15FCA1F461 for ; Wed, 17 Jul 2019 07:09:21 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version:content-type; q=dns; s=default; b=kHpFL mGbah7KvotOkiWvHtL+cEr7qZpZORKHVlnyFjhjEBluSPcuelgfKDEgc38xtcfwl t+WLuwJ6npr5RAIvs8kXzIySH6Y+ey952bfhbmJrysUMxy7mlGQTkhZ9PNWn+BF2 DQlB6z+ZbhZzpdW7U2KnJAEGXtKZcFjJS6G83Q= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version:content-type; s=default; bh=fkzmUMs5tpr YpGEFI9lKWj/EkXQ=; b=apUdQa0sorcGhr9iCI/dYcrD6fktY29pi0oDfKrYB7z 8Y+NEwQQNphQe9BQ1L2NrsmAGORRhy4vV9GA3m447NPWYQwvZQWptooLZTxn1FZm ZQANVykiJlepZueFVergnUYE2NuVhVps1ymrmw1vkT6Im1XQ7elrvEiOSTfDspHU = Received: (qmail 108628 invoked by alias); 17 Jul 2019 07:09:19 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 108619 invoked by uid 89); 17 Jul 2019 07:09:18 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: mx1.redhat.com From: Florian Weimer To: Alistair Francis Cc: libc-alpha@sourceware.org, arnd@arndb.de, adhemerval.zanella@linaro.org, palmer@sifive.com, macro@wdc.com, zongbox@gmail.com, alistair23@gmail.com Subject: Re: [RFC v3 02/23] sysdeps/gettimeofday: Use clock_gettime64 if avaliable In-Reply-To: (Alistair Francis's message of "Tue, 16 Jul 2019 17:08:46 -0700") References: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) Date: Wed, 17 Jul 2019 09:09:08 +0200 Message-ID: <87lfwxcf3f.fsf@oldenburg2.str.redhat.com> MIME-Version: 1.0 Content-Type: text/plain * Alistair Francis: > diff --git a/sysdeps/unix/sysv/linux/gettimeofday.c b/sysdeps/unix/sysv/linux/gettimeofday.c > index a74f03825a..151b1e606c 100644 > --- a/sysdeps/unix/sysv/linux/gettimeofday.c > +++ b/sysdeps/unix/sysv/linux/gettimeofday.c > @@ -32,7 +32,35 @@ > int > __gettimeofday (struct timeval *tv, struct timezone *tz) > { > +#ifdef __ASSUME_TIME64_SYSCALLS > + int ret; > + struct __timespec64 now; > + > + ret = INLINE_VSYSCALL (clock_gettime64, 2, CLOCK_REALTIME, > + &now); > + > + /* Convert from timespec to timeval */ > + tv->tv_sec = now.tv_sec; > + tv->tv_usec = now.tv_nsec / 1000; > + > + return ret; > +#else > +# ifdef __NR_clock_gettime64 > + long int ret; > + struct __timespec64 now; > + > + ret = INLINE_VSYSCALL (clock_gettime64, 2, CLOCK_REALTIME, > + &now); > + > + /* Convert from timespec to timeval */ > + tv->tv_sec = now.tv_sec; > + tv->tv_usec = now.tv_nsec / 1000; > + > + if (ret == 0 || errno != ENOSYS) > + return ret; > +# endif > return INLINE_VSYSCALL (gettimeofday, 2, tv, tz); > +#endif > } This loses vDSO acceleration if glibc is compiled with kernel headers which define __NR_clock_gettime64, but the run-time kernel does not have clock_gettime64 in the vDSO. And the kernel folks really want us to call clock_gettime when the user calls the 32-bit function, for tracability of legacy processes. Thanks, Florian