Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp3411494pxb; Sun, 26 Sep 2021 14:34:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwj2YO6kDRu6t+6ZvAlpg/xskkTyx8cg1xquF1A8gZrdpdb2bpVxz+7ygRHp3pJiBWLxPI X-Received: by 2002:a17:906:9bda:: with SMTP id de26mr9928105ejc.378.1632692092415; Sun, 26 Sep 2021 14:34:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632692092; cv=none; d=google.com; s=arc-20160816; b=0pMQK3Xtf4RThoweh2Co62AJdILqX4qLfZrguEd+2Iwu6oCQkNhjz02ZMsA/ZJlFcv mRenOFgr7LGtXy6jk8uRvIa0fz2PjIeE7x6kEUX991QsLfowP8H1XoUhsgvPSqSStsmh gzMDzgg/C6JdYruY9kT15BcOdI1SMovUSkjQNQf5khQMhtuI5TEF4Ni/iJXgDkJP/sQO /y5Tp8YaAhLd39jmxD+ywf7kUz19D9F7f6uQBx5GRd3tE7PTEnGDI4kSWlySlUGtvo1t gyPaNoQK/9KAz4ysFKVNh0lA8iHhPLJbOVZ6q9/6trsNmkBqXEXZUzVwe55be7oU4WjZ qWOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=e0UOu8TQh9NvjoYvd2R57PowLpCbBCfg4LGe+cCUN94=; b=H8CFFjj2DxGXgxgD19CGLHSWT3VynyNuvQVYQkeSqOx1s0N3wRaO2yBYLIFY248WoH FkAEr5tb8Uc6RcKcZfgPbmjfCxi4PwqDnzfVfioaGyMksDudH0fSkkgiY1MbuTPnIWrO Vhl7egCUzQAg5VILgtqeLd7YQ8MrBfcM/IPZXeDs6upMKmV6JN294DTexnKSlqzQ22m+ gyFvImaayhYvZmwa7JQHApH/82LH+QD8u8wSIB+YS2fWnuJvnDTZIGxuORcjCZ6PeGYF AYQ+pxihbrHtZKXOkKIFOS+2ZJNf+yDllDk3p3eWd1jBVD4ndvxH+g94Kr7s6dxBtvWt +5Tg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ds17si19576138ejc.213.2021.09.26.14.34.27; Sun, 26 Sep 2021 14:34:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230183AbhIZVep (ORCPT + 99 others); Sun, 26 Sep 2021 17:34:45 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:46786 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230075AbhIZVeo (ORCPT ); Sun, 26 Sep 2021 17:34:44 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: tonyk) with ESMTPSA id 8B0D01F4239D Message-ID: Date: Sun, 26 Sep 2021 18:32:57 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.1 Subject: Re: [PATCH v3 2/2] perf bench: Add support for 32-bit systems with 64-bit time_t Content-Language: en-US To: Alistair Francis Cc: Alistair Francis , Linux Kernel Mailing List , linux-riscv , Namhyung Kim , Jiri Olsa , linux-perf-users@vger.kernel.org, Alexander Shishkin , Mark Rutland , Arnaldo Carvalho de Melo , Davidlohr Bueso , Darren Hart , Peter Zijlstra , Ingo Molnar , Thomas Gleixner , Atish Patra , Arnd Bergmann , Alistair Francis References: <20210917061040.2270822-1-alistair.francis@opensource.wdc.com> <20210917061040.2270822-2-alistair.francis@opensource.wdc.com> <72990864-5ec6-1f73-efd9-61b667a172dd@collabora.com> From: =?UTF-8?Q?Andr=c3=a9_Almeida?= In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Às 01:34 de 24/09/21, Alistair Francis escreveu: > On Tue, Sep 21, 2021 at 8:47 AM André Almeida wrote: >> >> Hi Alistair, >> >> Às 03:10 de 17/09/21, Alistair Francis escreveu: >>> From: Alistair Francis >>> >>> Some 32-bit architectures (such are 32-bit RISC-V) only have a 64-bit >>> time_t and as such don't have the SYS_futex syscall. This patch will >>> allow us to use the SYS_futex_time64 syscall on those platforms. >>> >> >> Thanks for your patch! However, I don't think that any futex operation >> at perf has timeout. Do you plan to implement a test that use it? Or the >> idea is to get this ready for it in case someone want to do so in the >> future? > > I don't have plans to implement any new tests (although I'm happy to > add one if need be). > > My goal was just to get this to build for RISC-V 32-bit. The timeout > was already exposed by the old futex macro, so I was just following > that. > I see, thanks for working on that. >> >> >> Also, I faced a similar problem with the new futex2 syscalls, that >> supports exclusively 64bit timespec. But I took a different approach: I >> called __NR_clock_gettime64 for 32bit architectures so it wouldn't >> require to convert the struct: >> >> #if defined(__i386__) || __TIMESIZE == 32 >> # define NR_gettime64 __NR_clock_gettime64 >> #else >> # define NR_gettime64 __NR_clock_gettime >> #endif >> >> struct timespec64 { >> long long tv_sec; /* seconds */ >> long long tv_nsec; /* nanoseconds */ >> }; >> >> int gettime64(clock_t clockid, struct timespec64 *tv) >> { >> return syscall(NR_gettime64, clockid, tv); >> } >> >> Then we can just use &timeout at __NR_futex_time64 for 32bit arch and at >> __NR_futex for 64bit arch. > > So the idea is to use 64-bit time_t everywhere and only work on 5.1+ kernels. > > If that's the favoured approach I can convert this series to your idea. > Yes, this is what I think it will be the best approach. I believe the code will be less complex, it's more future proof (it's ready for y2038) and when glibc supports time64, we can make this code even simpler using `-D__USE_TIME_BITS64` to compile it. Thanks again for working on that! > Alistair > >> >> This might be a simpler solution to the problem that you are facing but >> I'm not entirely sure. Also, futex's selftests do use the timeout >> argument and I think that they also won't compile in 32-bit RISC-V, so >> maybe we can start from there so we can actually test the timeout >> argument and check if it's working. >> >> Thanks, >> André