Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1190968pxb; Thu, 23 Sep 2021 21:38:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKgYnBJj08y1rUrdNdC5jmJXMDElyWY+OPoqTupSNMPgmh1YfSafdqYxiRWWYoy4xQrHkt X-Received: by 2002:a5d:959a:: with SMTP id a26mr7015242ioo.154.1632458318789; Thu, 23 Sep 2021 21:38:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632458318; cv=none; d=google.com; s=arc-20160816; b=EWQOvXX6HWrm969Z3XqT14qnFRip5InkEqQxW/4xzZtH8ecWkxmvarPTm1iR2ALUNY 1DyX7fpMYhQkPvMtOeIjXSWwnrU8ahY46jaPiveLhzLPBWTeKtvIZM2a6WBEKmwHPJlp vVgeCjaI/+M6zgy2kEIPiXY9oI67AORhImoBixrBTDzYNjmP5K3tXslbEh4HTrsZYC/2 YYzzxEv3kzd/EHJF0hr4O7qftvJa2Gr/qrMAABA9X2D/9aULJbQelnkEF2qghoLTLsEu 1kisNLaHGP4PXYhJIntuxVlgSlNKZ0u2u1Xy4ropskeGx6gwxi0V+cVr8b2eVjZ8yuYX q+iw== 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=xcH9wYSR91fpt+5IhR8QHq5X+wHLKfuvWgni3VmGpiU=; b=cqGOg/IJERpEfWETAel9BoLnupdsvSfE/1bPhWfmwUt4AzUZB/4hxPU6DcVCORQZ/e JtyiPmZaghaYyHYPEgo4lUE/bJ3VE6YkJKElevfR6X7RsJyk4Wp5g3gtEnQx+iNSkd7e 07eoGrsEqwkM3e+C8fdY5HJmIJd8rnoEu0a8OoT0OmAusDHFGS45JDV5YKsDr46KdF6c EkMHQCWXKlNCQrc9D/nY0Ylngs+T9mUebLX0cv7dsVL9ZPzmI6OOdzwk/Lo9le4QdBDg rb84h5vSlJpj5gguDM4XENiApDB44sIw77tNJUsLl2uKkxhxJBGdJrCEYxyx5fZxqY+B 7sqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=IwQPPQ10; 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 d4si5078401ilg.173.2021.09.23.21.38.15; Thu, 23 Sep 2021 21:38:38 -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=IwQPPQ10; 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 S244074AbhIXEg4 (ORCPT + 99 others); Fri, 24 Sep 2021 00:36:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237144AbhIXEgz (ORCPT ); Fri, 24 Sep 2021 00:36:55 -0400 Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD713C061756; Thu, 23 Sep 2021 21:35:22 -0700 (PDT) Received: by mail-io1-xd2a.google.com with SMTP id h129so11064216iof.1; Thu, 23 Sep 2021 21:35:22 -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=xcH9wYSR91fpt+5IhR8QHq5X+wHLKfuvWgni3VmGpiU=; b=IwQPPQ10h/E5e/e7b49Tir8b5B9hgs/Wi9m4wHV/tEVRB3SijM3j5dbrNfI70GEMmU cRwjbjssjw6ODT3JN0RVWcjCh8cD0Y+CxXu3DS242Uo98NLw5U6yKDmaKI7w92iroixP FNFPWVZtRff9VniJ6HRtLlhtjP1A+XGYVlKmmehI+WDSy6N3Vhs8UeQdDjtQZonRdhi8 NccqO+MnV+D0g4F3ZApPzqWM7HOzosTHlI2dmcTR6jmCvjmofQQJgJHaNMaP24vhKiM1 tuejb39zHQw4ELgt9h8JAtObelmIa1RCFZ/C+W07FW94J8bAun/3aAZVQ5CkoS+Bfp+h hSGQ== 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=xcH9wYSR91fpt+5IhR8QHq5X+wHLKfuvWgni3VmGpiU=; b=KjlNPy0yesaK44qSP1YnU2cmfJfcsHWJd86BKd69e+M2whkZN1x8r6cMNSCeVnOLlW VM4Fmn8CmljUb9fIUO0Heeoy9qNBRLPArARCk7nXkrXm6GNcxm07VJYOLUGdhE6TuwAT x8G0e29eTZcbRQoIS17B9PKeKEC8bJhlCTSMd1m9SXkFiUoT7QPINwAcvxZc3f/W5mfc C+svIHS3/o50Z8Xwmt/aQt7yvK8EjRnuLpT1TIaOyibTKlffyAKozpYTh/scPqMpRron JY6onrWhXuZvYSxa6p7SNGd01gLc4FXGKd7FPC0MF+2WqhZ4VJa2qtmYoE4/6GoAZuwt 7tig== X-Gm-Message-State: AOAM5325IbH5CCw/+9yfTRGaaRyF0UNjpiEpD+oJUW8TATyUgBfzK76i ALdFQ1lsCgAHMewhVdSVWLGrWdsPM6paj4jVKB0= X-Received: by 2002:a02:2124:: with SMTP id e36mr7336788jaa.35.1632458122367; Thu, 23 Sep 2021 21:35:22 -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: From: Alistair Francis Date: Fri, 24 Sep 2021 14:34:56 +1000 Message-ID: Subject: Re: [PATCH v3 2/2] perf bench: Add support for 32-bit systems with 64-bit time_t To: Arnd Bergmann Cc: =?UTF-8?Q?Andr=C3=A9_Almeida?= , 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 , 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 6:08 PM Arnd Bergmann wrote: > > On Tue, Sep 21, 2021 at 12:47 AM Andr=C3=A9 Almeida > wrote: > > > > #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 a= t > > __NR_futex for 64bit arch. > > This is still broken when you disable CONFIG_COMPAT_32BIT_TIME, > which disables all system calls that take time32 arguments. > > > 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. > > I would love to see the wrapper that Alistair wrote as part of some kerne= l > uapi header provided to user space. futex is used by tons of applications= , > and we never had a library abstraction for it, so everyone has to do thes= e > by hand, and they all get them slightly wrong in different ways. > > We normally don't do this in kernel headers, but I think the benefits > would be far greater compared to today's situation. I'm happy to prepare a patch, if others are on board with it being accepted= . Alistair > > Arnd