Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp8495012ybn; Tue, 1 Oct 2019 08:54:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqw79kJf90UBjh45QWxfrU09s0zHyZWQdLBd3HvEaxmJYw/H6C6YBEj383wHWSStCaKJcpC1 X-Received: by 2002:a50:ea8c:: with SMTP id d12mr26369595edo.87.1569945244686; Tue, 01 Oct 2019 08:54:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569945244; cv=none; d=google.com; s=arc-20160816; b=VroFJyH8HhKr/EfB7Oj3MGokV3AET9FLZK+IIwY8Rewxl9a51xF5qXtxuPFu2aePXT jVVLyxX/KQrR/IijGI2rjLdANCyA1p8qlf6hwImXZJhNcA9we3hJ0jY2uqZbXn29KPy4 PnQu9KZ/vHsTlLvXElJO1PdHEedtnS6lzyENFn4fKoqw/wgfbpolFf9Uwfw8iOugmKnx fGllQ6G5uMhsnutbV/bVwFO1dXksnr8MSmyvgvde5ZFKvzoiRqxY3ZKFHUrLHqIW9s6H zChVbdKH4of5uE2kkXS49qU5GmekSS7LmW7um6t6ryPojJBTN+BszpkThmb+Viad6ufN M3Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=aYzikBcGz30F8nxgz2XYTBSTQs7V2hCd/C6EA7NzpBk=; b=nh7csHG1DwpdsirD60MOk4lr/a4QdAUlP2UQV7UIIlrQIee22/aOme3edhasOAu1PX GkR/ZncXbbe8s9HLNpackTu/QwmfIVRnFZ7MYuYGoklXoFY4IqE5Pr7ILNYf9jt1Y5BB XPTCx0Jb2GgbN5TuiU2fYmpD1wtkSgINnjXHTIzdfnQiPd5Vx3osTo5E+deZWpr28L/F 8rUGk+AYy2iBCpr6Zz4INT4iTwFIkwgy5CHVAcWsHScSUk8Xfd0LQ2FJZzvDrhRx0tEb uF3VwP4NFXubEVrCx6j1JWVB1qzd1kJ1icncivTmbyqz39KG6wqIaCQZP4g0MxTwN+Jg F8mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=a6Su93qU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f13si8865871eda.277.2019.10.01.08.53.39; Tue, 01 Oct 2019 08:54:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=a6Su93qU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727402AbfJAPwb (ORCPT + 99 others); Tue, 1 Oct 2019 11:52:31 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:46734 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389749AbfJAPwb (ORCPT ); Tue, 1 Oct 2019 11:52:31 -0400 Received: by mail-io1-f68.google.com with SMTP id c6so49068935ioo.13 for ; Tue, 01 Oct 2019 08:52:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=aYzikBcGz30F8nxgz2XYTBSTQs7V2hCd/C6EA7NzpBk=; b=a6Su93qUP+aKyezqwC9e8cP4OQnwhhnemV2uK/QN4Ile1m1o0yOByD+BVJWzXTeIKS 4jtRnMyN2qbrCqIAxTfsUCwFdf8K5lmSdlrmTVkRecw7gzRn+RApQZPWRB7yt0xYAVkc rhHSpEiJ4g+XxGJZgWmM8PYbb1ulOU68ftoamqHBQvRMEMvuIr02AfyLIVM8/+ytBVi+ iG1SWMcdsNMRBl4FMysO3n7jDF7xX50TXDrY7VTp0aPJIaVM53eNV3HTO83dVOhWqtRx Z3WmAI7l1pgYHnlm5AxO++P0SJi7gVYXQcBADI50RBZp0PruiuGgrA52vcM46ZEAu7Or jPOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=aYzikBcGz30F8nxgz2XYTBSTQs7V2hCd/C6EA7NzpBk=; b=SMy1aMV1izeX/NmtZroK/94f90ATNn/akXK9gdfeCDH0BDv527iiuO8/4F2zI41z+H e2wTjik2sc2ngDw4Pq+x/GnA2nbH5vVthySZQgG5fThoVbRtHnKhsXSvNGrfQuBR4uhG e2IYij+4EAjDzokVSWvFp6q81UqxBBhcyVYGcB4h/E+NfRT7ylyn+Xj5XZv9qQxbjTul vqpa+xBUuODnt/7XqyiBND8vAtlleyakPLukZzEQ+g6OStnYeW+xe2BB7GEYw1J7xobQ NQd8BLbGE0rPUwoaGRBI12lARjwDeKJEPC8pIU+wyuBvN42Bn7wJ829S7yVcaHV6LEOA /aiA== X-Gm-Message-State: APjAAAWAaGZ1hYaCW7PKo81ZSFrhl2hDFWALmpZnESd1yt9fO9RkEFMv Jc0z4DZIaxCqGFJV5oQ/97vB5fmJSi3HDg== X-Received: by 2002:a02:cc53:: with SMTP id i19mr25466044jaq.10.1569945149751; Tue, 01 Oct 2019 08:52:29 -0700 (PDT) Received: from [192.168.1.50] ([65.144.74.34]) by smtp.gmail.com with ESMTPSA id z10sm6873815iog.41.2019.10.01.08.52.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Oct 2019 08:52:28 -0700 (PDT) Subject: Re: [PATCH] io_uring: use __kernel_timespec in timeout ABI To: Arnd Bergmann Cc: y2038 Mailman List , Linux API , Alexander Viro , =?UTF-8?Q?Stefan_B=c3=bchler?= , Hannes Reinecke , Jackie Liu , Andrew Morton , Hristo Venev , linux-block , Linux FS-devel Mailing List , "linux-kernel@vger.kernel.org" References: <20190930202055.1748710-1-arnd@arndb.de> <8d5d34da-e1f0-1ab5-461e-f3145e52c48a@kernel.dk> <623e1d27-d3b1-3241-bfd4-eb94ce70da14@kernel.dk> From: Jens Axboe Message-ID: Date: Tue, 1 Oct 2019 09:52:27 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/1/19 9:49 AM, Arnd Bergmann wrote: > On Tue, Oct 1, 2019 at 5:38 PM Jens Axboe wrote: >> >> On 10/1/19 8:09 AM, Jens Axboe wrote: >>> On 9/30/19 2:20 PM, Arnd Bergmann wrote: >>>> All system calls use struct __kernel_timespec instead of the old struct >>>> timespec, but this one was just added with the old-style ABI. Change it >>>> now to enforce the use of __kernel_timespec, avoiding ABI confusion and >>>> the need for compat handlers on 32-bit architectures. >>>> >>>> Any user space caller will have to use __kernel_timespec now, but this >>>> is unambiguous and works for any C library regardless of the time_t >>>> definition. A nicer way to specify the timeout would have been a less >>>> ambiguous 64-bit nanosecond value, but I suppose it's too late now to >>>> change that as this would impact both 32-bit and 64-bit users. >>> >>> Thanks for catching that, Arnd. Applied. >> >> On second thought - since there appears to be no good 64-bit timespec >> available to userspace, the alternative here is including on in liburing. > > What's wrong with using __kernel_timespec? Just the name? > I suppose liburing could add a macro to give it a different name > for its users. Just that it seems I need to make it available through liburing on systems that don't have it yet. Not a big deal, though. >> That seems kinda crappy in terms of API, so why not just use a 64-bit nsec >> value as you suggest? There's on released kernel with this feature yet, so >> there's nothing stopping us from just changing the API to be based on >> a single 64-bit nanosecond timeout. > > Certainly fine with me. > >> + timeout = READ_ONCE(sqe->addr); >> hrtimer_init(&req->timeout.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); >> req->timeout.timer.function = io_timeout_fn; >> - hrtimer_start(&req->timeout.timer, timespec_to_ktime(ts), >> + hrtimer_start(&req->timeout.timer, ns_to_ktime(timeout), > > It seems a little odd to use the 'addr' field as something that's not > an address, > and I'm not sure I understand the logic behind when you use a READ_ONCE() > as opposed to simply accessing the sqe the way it is done a few lines > earlier. > > The time handling definitely looks good to me. One thing that struck me about this approach - we then lose the ability to differentiate between "don't want a timed timeout" with ts == NULL, vs tv_sec and tv_nsec both being 0. I think I'll stuck with that you had and just use __kernel_timespec in liburing. -- Jens Axboe