From patchwork Thu Jun 17 11:50:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 1493415 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=Pn5YtfVP; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 ozlabs.org (Postfix) with ESMTPS id 4G5LFc4rVTz9sT6 for ; Thu, 17 Jun 2021 21:59:32 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5126C3896C27 for ; Thu, 17 Jun 2021 11:59:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5126C3896C27 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1623931170; bh=BGZssOnqtu5bxMEvBvvx9K90V5JiPUnj2shcjQTDbQo=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=Pn5YtfVP9Kti4T3itsOKK3SEBZ8ElICdh1vUurNYwv+R9dXB1/zsDEl5sdcQKGy6v ojSzz9minRTc5gmRLzYijphDxG3rjR7891UE0oETsTMCaIoRxqjjynm07v08zmKuRu afSrP+dOoNv2n49gL6FKU4VYhf5Q7j0LFRTO8+L0= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x736.google.com (mail-qk1-x736.google.com [IPv6:2607:f8b0:4864:20::736]) by sourceware.org (Postfix) with ESMTPS id 0ACF63894409 for ; Thu, 17 Jun 2021 11:51:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0ACF63894409 Received: by mail-qk1-x736.google.com with SMTP id q16so2744262qkm.9 for ; Thu, 17 Jun 2021 04:51:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BGZssOnqtu5bxMEvBvvx9K90V5JiPUnj2shcjQTDbQo=; b=BCTnqK25+JmvRkeEGCQhn1Qk2PU/hioaKbuV5+uidLOocc/ar3AFbjYLkCGMUBqTlN Ut7v0Ox3ZYuEoFx6j90mfUu3OJ5jY3/xGJk/y6CXWnj2/s7GV2ai5wfgYCLx9mMWcYJy nUuKXzQDK2ipkRZGeskrCwr7a+uma7op6fx2EvAvdweSrAScZn3LQ9lHTzJlGmIyF+8z lRj1ijpC2arfgeS2d0NvO98R5djkSzylKEQfiDfK8uxwJ7E6rOQD0J6yrMdjNB3FPRBe 6sFR0Xl/8Ffn2FHCmbGSC6Jc2pJW/yuK/WVeJBXpkfk/wngFz3ta5xqxzyOHx0EYveGK +gTw== X-Gm-Message-State: AOAM531DnMEKvoGgl2gtliNypq9oZdNYnqQeUM+JdwcZwRy8KKGT18jN 875f3oaP58cH+wKvGGA58ia+B9sLoSdCew== X-Google-Smtp-Source: ABdhPJz18FznCdzCLHGOPWjJL60UdLSwul+nUcY0660JVoit/m4IlCDg4ccLJt+ZzGcp6We+1EMSww== X-Received: by 2002:a05:620a:12e5:: with SMTP id f5mr3298489qkl.406.1623930684485; Thu, 17 Jun 2021 04:51:24 -0700 (PDT) Received: from birita.. ([177.194.59.218]) by smtp.googlemail.com with ESMTPSA id p12sm3016435qtw.61.2021.06.17.04.51.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Jun 2021 04:51:24 -0700 (PDT) To: libc-alpha@sourceware.org, Lukasz Majewski , Carlos O'Donell Subject: [PATCH 09/18] linux: Remove time64-support Date: Thu, 17 Jun 2021 08:50:55 -0300 Message-Id: <20210617115104.1359598-10-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210617115104.1359598-1-adhemerval.zanella@linaro.org> References: <20210617115104.1359598-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" It breaks the usage case of live migration like CRIU or similar and most usages can be optimized away by either building glibc with a minimum 5.1 kernel or by using the 32-bit syscall for the common case. Checked on i686-linux-gnu on a 4.15 kernel and on a 5.11 kernel (with and without --enable-kernel=5.1) and on x86_64-linux-gnu. Reviewed-by: Lukasz Majewski --- sysdeps/unix/sysv/linux/Makefile | 2 +- sysdeps/unix/sysv/linux/time64-support.c | 23 -------- sysdeps/unix/sysv/linux/time64-support.h | 70 ------------------------ 3 files changed, 1 insertion(+), 94 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/time64-support.c delete mode 100644 sysdeps/unix/sysv/linux/time64-support.h diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 710169a454..982755f980 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -61,7 +61,7 @@ sysdep_routines += adjtimex clone umount umount2 readahead sysctl \ open_by_handle_at mlock2 pkey_mprotect pkey_set pkey_get \ timerfd_gettime timerfd_settime prctl \ process_vm_readv process_vm_writev clock_adjtime \ - time64-support pselect32 select32 \ + pselect32 select32 \ xstat fxstat lxstat xstat64 fxstat64 lxstat64 \ fxstatat fxstatat64 \ xmknod xmknodat convert_scm_timestamps diff --git a/sysdeps/unix/sysv/linux/time64-support.c b/sysdeps/unix/sysv/linux/time64-support.c deleted file mode 100644 index 0718e7421b..0000000000 --- a/sysdeps/unix/sysv/linux/time64-support.c +++ /dev/null @@ -1,23 +0,0 @@ -/* Auxiliary definitions for 64-bit time_t support. - Copyright (C) 2020-2021 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 - . */ - -#include - -#ifndef __ASSUME_TIME64_SYSCALLS -int __time64_support = 1; -#endif diff --git a/sysdeps/unix/sysv/linux/time64-support.h b/sysdeps/unix/sysv/linux/time64-support.h deleted file mode 100644 index 8466d37f8f..0000000000 --- a/sysdeps/unix/sysv/linux/time64-support.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Auxiliary definitions for 64-bit time_t support. - Copyright (C) 2020-2021 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 - . */ - -#include -#include - -/* These helper functions are used to optimize the 64-bit time_t support on - configurations that requires support for 32-bit time_t fallback - (!__ASSUME_TIME64_SYSCALLS). The idea is once the kernel advertises that - it does not have 64-bit time_t support, glibc will stop to try issue the - 64-bit time_t syscall altogether. - - For instance: - - #ifndef __NR_symbol_time64 - # define __NR_symbol_time64 __NR_symbol - #endif - int r; - if (supports_time64 ()) - { - r = INLINE_SYSCALL_CALL (symbol, ...); - if (r == 0 || errno != ENOSYS) - return r; - - mark_time64_unsupported (); - } - #ifndef __ASSUME_TIME64_SYSCALLS - <32-bit fallback syscall> - #endif - return r; - - On configuration with default 64-bit time_t this optimization should be - optimized away by the compiler resulting in no overhead. */ - -#ifndef __ASSUME_TIME64_SYSCALLS -extern int __time64_support attribute_hidden; -#endif - -static inline bool -supports_time64 (void) -{ -#ifdef __ASSUME_TIME64_SYSCALLS - return true; -#else - return atomic_load_relaxed (&__time64_support) != 0; -#endif -} - -static inline void -mark_time64_unsupported (void) -{ -#ifndef __ASSUME_TIME64_SYSCALLS - atomic_store_relaxed (&__time64_support, 0); -#endif -}