Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1191387pxb; Thu, 23 Sep 2021 21:39:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAoXAS4/Q+vsDhA9WIejRIjozKFJhDoyxuYw7SF9bnPIrBpAsNAV5Y5eN4lydLv6lFWGV2 X-Received: by 2002:a17:906:2c0b:: with SMTP id e11mr9352328ejh.284.1632458365427; Thu, 23 Sep 2021 21:39:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632458365; cv=none; d=google.com; s=arc-20160816; b=XrRH3Q0JwtOeTKizdy1JeJZlg8y0b7fw6z9f8OjJlGtG0Q5OGmJkoTyqKG7HoPek/R wL43nEgiCjmr8XmqlUU/mJM2gQM6wOyG3/UBUSlz98pPq6/I2qOwHgJF9Ys8id0xaNgz lG3yWSUr6QXPyY6vx4gjRT5YOcIiB9DNHIZFm0OK3GZJOVXNVoTO4L6sV4alEQAUSz6C CdLbB6mYFVrplsv/OTlDpWJgimfCHQPkyqZI30aysaN/n/uxWDeuU9vXPdA8a0JQdR4I sZJYs1CUTqY3zsJIRWtxFVxOTHXCr88626LJspHvSweHV8yKdBsPG8tYQuEloWwDAEHv nbVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=2r3uHfiNTEeauI0qfOMLdIlPnnjW+o7oi9itFKgNNmo=; b=BAeQ5dlrnHSBHtg/bQlw5u1m6Shq57LZ3CK4dMqRLxQtHZEnks0BiJLxCrzPVlbQDg 5yAK5vZ3Q2gs4lrcwBK8Q2QiJmXmaQs8lPxjRyMNHo6VpoCGfAC8NELymEisg5y9zZpZ J2UtKMLS3i6/6DNPGX1WQZrOShFRoN6LRMwb5KHq2Ci4YUbFvk2UwW20AUanX2SLVVWB OId4d7gQ8bqH0LGybyRAbOUTwb1Gg8zn1Sqz+9b3jRiBZH+G3Zj5nu6sT1yAjgQZH0zD UlQAhGQXe4d+isgzFr204iMu6+OW4i8TmB60Wt0q/DRlu8mSGy+ocMW1WCpDRI5eEF8C wKQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=fdGPBfTI; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ka8si7684071ejb.83.2021.09.23.21.39.01; Thu, 23 Sep 2021 21:39:25 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=fdGPBfTI; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232553AbhIXEgM (ORCPT + 99 others); Fri, 24 Sep 2021 00:36:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237144AbhIXEgL (ORCPT ); Fri, 24 Sep 2021 00:36:11 -0400 Received: from mail-il1-x130.google.com (mail-il1-x130.google.com [IPv6:2607:f8b0:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A491C061574; Thu, 23 Sep 2021 21:34:39 -0700 (PDT) Received: by mail-il1-x130.google.com with SMTP id v16so9006969ilg.3; Thu, 23 Sep 2021 21:34:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=2r3uHfiNTEeauI0qfOMLdIlPnnjW+o7oi9itFKgNNmo=; b=fdGPBfTIIKmH8Ik+1f3lUEUMb8jFS/BFVFKhiWWulXm5ZJhjP92WmTlype1RVSjDkV l5kt8t3VvnDaMlBZnXLB6iZDpokrW39ZZGfkursRajR8yyS12bOM9QCNSUpP0IQbrFkO qkr33cDNczNmXBKCas0BR0rg39eaNcBRW5/EQT2s0IkHgIU/pLnKlYChY3pSAebeEXvO LmRWvX5DTRNP268BNkKVoXSrxbHxCQ8dvD52hRpocR+dB4po7zOeNCRGqmEob85s5tdj eBiZGcYaD29G5rOCykoi/nO2/5o7Ud5GnS2qMDKI4MHKLb2U0d4FCk0qriKkW57uB/aM KgVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=2r3uHfiNTEeauI0qfOMLdIlPnnjW+o7oi9itFKgNNmo=; b=cTV0saUNLsQWyJdz+uOEoHdHPffCdUsBYUg1MasCSf2tdmOahnN5lmZthLedl6hUTa 1B65SE6o+IMIlJl7jd45YGNAsAo/Ekz1KuXYGaXMQ/wUhdvpY73YuD0/RvvtGNyWlmTn 7UgDfFZBcl430DhFlXeiT82XIWMYiIlyRkFNTdQSLJmda1fph55Gb+2orrRrVKMJzSbO U6hXO7rF0RSWKjlyixBo3pa2Gn8qFaFZxyOAdpfrTO4HhL9iGRTfjg2bF7HhIrPF4SnW 6D3NXdIGRhpB/5G42yz0iIEp6xz+xvwHdwxPp3akmZaiIybMiMXBwBR1g+D0I2Eo2nsQ NrWQ== X-Gm-Message-State: AOAM531pNhI4JbiNOfQS/Cupk38tXczcn0VjoLRohs9wv8tJbgUBxiYb /UTKwPNZ4YbA4adURrc/UzQK57Zw2C+UnYNpVuI= X-Received: by 2002:a05:6e02:1088:: with SMTP id r8mr6568454ilj.46.1632458078345; Thu, 23 Sep 2021 21:34:38 -0700 (PDT) MIME-Version: 1.0 References: <20210917061040.2270822-1-alistair.francis@opensource.wdc.com> <20210917061040.2270822-2-alistair.francis@opensource.wdc.com> <72990864-5ec6-1f73-efd9-61b667a172dd@collabora.com> In-Reply-To: <72990864-5ec6-1f73-efd9-61b667a172dd@collabora.com> From: Alistair Francis Date: Fri, 24 Sep 2021 14:34:12 +1000 Message-ID: Subject: Re: [PATCH v3 2/2] perf bench: Add support for 32-bit systems with 64-bit time_t To: =?UTF-8?Q?Andr=C3=A9_Almeida?= 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 21, 2021 at 8:47 AM Andr=C3=A9 Almeida wrote: > > Hi Alistair, > > =C3=80s 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. > > > 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 =3D=3D 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+ kernel= s. If that's the favoured approach I can convert this series to your idea. 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=C3=A9