From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934657AbeDXNhe (ORCPT ); Tue, 24 Apr 2018 09:37:34 -0400 Received: from mail-qt0-f196.google.com ([209.85.216.196]:41462 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934178AbeDXNha (ORCPT ); Tue, 24 Apr 2018 09:37:30 -0400 X-Google-Smtp-Source: AB8JxZpBIsglH46MUR6gsjNdn1yTrm/MwCHwUvSPFbjCokm+3Yb/MwwPHYRxRmMg5omdohTXNIIkJfuyIHnKqswgnYw= MIME-Version: 1.0 In-Reply-To: <66b26dc6-9139-80cc-0b49-28ff68169b5c@perex.cz> References: <66b26dc6-9139-80cc-0b49-28ff68169b5c@perex.cz> From: Arnd Bergmann Date: Tue, 24 Apr 2018 15:37:28 +0200 X-Google-Sender-Auth: fPBAGge0nKgKHjIA3BMvRaiMi_0 Message-ID: Subject: Re: [PATCH 0/8] Fix year 2038 issue for sound subsystem To: Jaroslav Kysela Cc: Baolin Wang , Takashi Iwai , Liam Girdwood , Mark Brown , Takashi Sakamoto , Ingo Molnar , SF Markus Elfring , Dan Carpenter , jeeja.kp@intel.com, Vinod Koul , Guneshwor Singh , subhransu.s.prusty@intel.com, Bhumika Goyal , gudishax.kranthikumar@intel.com, Naveen M , hardik.t.shah@intel.com, Arvind Yadav , Fabian Frederick , alsa-devel@alsa-project.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 24, 2018 at 3:29 PM, Jaroslav Kysela wrote: > Dne 24.4.2018 v 14:06 Baolin Wang napsal(a): >> Since many structures will use timespec type variables to record time stamp >> in uapi/asound.h, which are not year 2038 safe on 32bit system. This patchset >> tries to introduce new structures removing timespec type to compatible native >> mode and compat mode. >> >> Moreover this patchset also converts the internal structrures to use timespec64 >> type and related APIs. > > Thanks for your patchset. A few comments: > > It might be more nice to reuse the existing structures and put > timespec64 to the reserved field and duplicate information (with the > 32-bit wrapping for the old fields). It means that we do not need new > ioctls and old libraries will be fine. The current approach is intended to make any user space work without source-level changes, i.e. you can still build an old alsa-lib package against a new glibc as long as you have the latest kernel headers (which the glibc requires for using 64-bit time_t). If we try to extend the structures in a different way, that requires user space changes, and existing source code would silently break on a future glibc. IMHO changing the source-level interface should only be done as a last resort for y2038. Note that most of the work is not required to keep working beyond 2038, but actually is required just to keep working with an updated glibc that redefines time_t to 64 bit. The audio timestamps should be in CLOCK_MONOTONIC for new user space anyway, and that doesn't overflow a 32-bit type. > It may make sense to define private snd_timespec32 and snd_timespec64 > with s32/s64 types instead separate sec/usec fields. Right, I have some ideas there as well as I saw one remaining issue in my patch for the status mmap: when building a program with 64-bit time_t, we still see a copy of the old structure but with an\ impossible layout. ARnd From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arnd Bergmann Subject: Re: [PATCH 0/8] Fix year 2038 issue for sound subsystem Date: Tue, 24 Apr 2018 15:37:28 +0200 Message-ID: References: <66b26dc6-9139-80cc-0b49-28ff68169b5c@perex.cz> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-qt0-f194.google.com (mail-qt0-f194.google.com [209.85.216.194]) by alsa0.perex.cz (Postfix) with ESMTP id D74442676A6 for ; Tue, 24 Apr 2018 15:37:30 +0200 (CEST) Received: by mail-qt0-f194.google.com with SMTP id h2-v6so9963263qtp.7 for ; Tue, 24 Apr 2018 06:37:30 -0700 (PDT) In-Reply-To: <66b26dc6-9139-80cc-0b49-28ff68169b5c@perex.cz> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Jaroslav Kysela Cc: Fabian Frederick , Arvind Yadav , Linux Kernel Mailing List , alsa-devel@alsa-project.org, Baolin Wang , Vinod Koul , hardik.t.shah@intel.com, Takashi Iwai , Guneshwor Singh , Liam Girdwood , Takashi Sakamoto , gudishax.kranthikumar@intel.com, Mark Brown , Bhumika Goyal , Naveen M , SF Markus Elfring , jeeja.kp@intel.com, subhransu.s.prusty@intel.com, Ingo Molnar , Dan Carpenter List-Id: alsa-devel@alsa-project.org On Tue, Apr 24, 2018 at 3:29 PM, Jaroslav Kysela wrote: > Dne 24.4.2018 v 14:06 Baolin Wang napsal(a): >> Since many structures will use timespec type variables to record time stamp >> in uapi/asound.h, which are not year 2038 safe on 32bit system. This patchset >> tries to introduce new structures removing timespec type to compatible native >> mode and compat mode. >> >> Moreover this patchset also converts the internal structrures to use timespec64 >> type and related APIs. > > Thanks for your patchset. A few comments: > > It might be more nice to reuse the existing structures and put > timespec64 to the reserved field and duplicate information (with the > 32-bit wrapping for the old fields). It means that we do not need new > ioctls and old libraries will be fine. The current approach is intended to make any user space work without source-level changes, i.e. you can still build an old alsa-lib package against a new glibc as long as you have the latest kernel headers (which the glibc requires for using 64-bit time_t). If we try to extend the structures in a different way, that requires user space changes, and existing source code would silently break on a future glibc. IMHO changing the source-level interface should only be done as a last resort for y2038. Note that most of the work is not required to keep working beyond 2038, but actually is required just to keep working with an updated glibc that redefines time_t to 64 bit. The audio timestamps should be in CLOCK_MONOTONIC for new user space anyway, and that doesn't overflow a 32-bit type. > It may make sense to define private snd_timespec32 and snd_timespec64 > with s32/s64 types instead separate sec/usec fields. Right, I have some ideas there as well as I saw one remaining issue in my patch for the status mmap: when building a program with 64-bit time_t, we still see a copy of the old structure but with an\ impossible layout. ARnd