Received: by 2002:ac0:8bc7:0:0:0:0:0 with SMTP id o7csp129493ima; Wed, 6 Feb 2019 22:38:58 -0800 (PST) X-Google-Smtp-Source: AHgI3IZeJPx1vMnz7HPD1H8VrgvG2L1j9vINRe+Ltl1lDiRGeAmm24DSXQUq1bXLVr1uLuLPiAAw X-Received: by 2002:a17:902:7c82:: with SMTP id y2mr14699692pll.33.1549521538692; Wed, 06 Feb 2019 22:38:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549521538; cv=none; d=google.com; s=arc-20160816; b=yBnEZnmumhUfvlqJgo9sg3ksEO+wwGNrM+zgxvrerKoufiG+QY54Slm5Z0vEp79Cxp TaeRH4Xwrgc5mQE/dEbQIntccdy148KoZWVRTZVZqGwFEv2eo3CT/r5aQ1YPW4Q+n6qG eIW7Qf9XzwDFSJEe3le/Kz6nnaphRIfLWwf1yZ9fhrAvkFdUp4UhUktWrqs44QdB2hsC fAV8xhfGrrbiUVD0RT4X/+dSRoiSVUu0xwmGwgTZCN6vHhAfyWPdI3QQ7m8up4pqLuE4 4f+SvNCboarpmVcmSJYePCCr7IAIcbr+MGDIR3x0v4DT7WFGBMPEherWHDdzXX7pq5gJ pdfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ff/A2SLuwUiDcDJNXB6Y/JYR4znirC1CDHnoU+YD4pE=; b=qL8nZceNXlca1wLeLwpgMhDJnzuQfg2lpJZF6o7yvQ/hu/wBb4GMkkmtcH/b/EKrw/ gCDWFc1WyhmuZZmd8+SJCzyBomSrfN8rQIuMcXlP1PLufDNcKXrcPgOhFHjYJmJVT54J cf1db/cSAGYX++UwITdgsg7ddIIWpd0ZY7AampYi/0f+35UYyaXVNJaqolTqdt6lKJxT Xbk6yp35tduv0rKUrG0DJkNMVLJGbudCJ4aQRVIjyhjfVaSNZokeTUjsOBHf9mk4K/MP g6yJa36JHX+M9AvdZORKKw3ra5v+H/Ift3BWjKKhqU3mH7MUB0in2Hq1jyMdYy9cPVYu zmcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fAhXqKM+; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g18si147056pgg.522.2019.02.06.22.38.41; Wed, 06 Feb 2019 22:38:58 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=fAhXqKM+; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726655AbfBGGig (ORCPT + 99 others); Thu, 7 Feb 2019 01:38:36 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:40668 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725912AbfBGGig (ORCPT ); Thu, 7 Feb 2019 01:38:36 -0500 Received: by mail-pg1-f196.google.com with SMTP id z10so4083060pgp.7; Wed, 06 Feb 2019 22:38:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ff/A2SLuwUiDcDJNXB6Y/JYR4znirC1CDHnoU+YD4pE=; b=fAhXqKM+W7C6Pt2b0EbDaC1XVfMsNV+ZYxafiRK2r1oIM6tDIdPIoyfRMc7sIdVf5/ Iq2vnlSkXPbFYlSjppreR7ghdtpHhmOxJhzhGAgTQWUqetea+votUVT3brBQA1s0krf7 SRaDk1Z5iBrtx4j8QejOSHxCNjItkFSnUDzua+zy+Xf+UZWJKc3XQzn+7uJPVNgn2JDT Yez704+5UXYZYUUnzwS18xAzm/LcyWH0pgoDv8ff/TxkUqwJoe4LgFS2eAfCUC33aMd9 7rs6rDqAgM96D+rgClsWlrKgXlya+BFMEC5zUu942jWJ87MERvTZV9HCAtnCoXvcpz3q bTxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ff/A2SLuwUiDcDJNXB6Y/JYR4znirC1CDHnoU+YD4pE=; b=H82fxcqPw5gZj+Zs68pOvJ6FKmxncQkjqsN5Yk+uoGi35OPzQs/QooB0Pl8URwehDr pJorYYRFvLrAIKtOef/IXgGp7wrfEYEd8Mh/7Tplo20qN52eKmQTuvq7rzHYTeyUnzsS GmRBl6EkBTsW75STfFOy+IMmiicJ9i+U6FryLjqXwSgJy/xialhdQIt64pY5FjPbowPA yWvLmAqSdt9K2heimtzM8zqFVVLWmInOSnz677p0/9N9Cr49x8C/Ns4bWD3bmslpvXln 0Y6UeGAl81F8BuhJeCH5PGoMrVtu91Th+rpwOzjN/YVnhnw1gzrpFgTVdlRJUiTltZAk gkFQ== X-Gm-Message-State: AHQUAub2bdhsb+OvjBgHTuO0HA3O3O82nte9DSfstaGIGhCLf30ib3Xc mnmxQ5z2GGJKIVfkfYXhgL4= X-Received: by 2002:a65:6294:: with SMTP id f20mr6019170pgv.174.1549521514766; Wed, 06 Feb 2019 22:38:34 -0800 (PST) Received: from gmail.com (c-73-140-212-29.hsd1.wa.comcast.net. [73.140.212.29]) by smtp.gmail.com with ESMTPSA id n74sm27017184pfi.163.2019.02.06.22.38.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Feb 2019 22:38:34 -0800 (PST) Date: Wed, 6 Feb 2019 22:38:31 -0800 From: Andrei Vagin To: Cyrill Gorcunov Cc: Dmitry Safonov , linux-kernel@vger.kernel.org, Adrian Reber , Andrei Vagin , Andy Lutomirski , Andy Tucker , Arnd Bergmann , Christian Brauner , Dmitry Safonov <0x7f454c46@gmail.com>, "Eric W. Biederman" , "H. Peter Anvin" , Ingo Molnar , Jeff Dike , Oleg Nesterov , Pavel Emelyanov , Shuah Khan , Thomas Gleixner , containers@lists.linux-foundation.org, criu@openvz.org, linux-api@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH 05/32] timerfd/timens: Take into account ns clock offsets Message-ID: <20190207063830.GB24912@gmail.com> References: <20190206001107.16488-1-dima@arista.com> <20190206001107.16488-6-dima@arista.com> <20190206085203.GB25251@uranus> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20190206085203.GB25251@uranus> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 06, 2019 at 11:52:03AM +0300, Cyrill Gorcunov wrote: > On Wed, Feb 06, 2019 at 12:10:39AM +0000, Dmitry Safonov wrote: > > From: Andrei Vagin > > > > Make timerfd respect timens offsets. > > Provide two helpers timens_clock_to_host() timens_clock_from_host() that > > are useful to wire up timens to different kernel subsystems. > > Following patches will use timens_clock_from_host(), added here for > > completeness. > > > > Signed-off-by: Andrei Vagin > > Co-developed-by: Dmitry Safonov > > Signed-off-by: Dmitry Safonov > > --- > > fs/timerfd.c | 16 +++++++++++----- > > 1 file changed, 11 insertions(+), 5 deletions(-) > > > > diff --git a/fs/timerfd.c b/fs/timerfd.c > > index 803ca070d42e..c7ae1e371912 100644 > > --- a/fs/timerfd.c > > +++ b/fs/timerfd.c > > @@ -26,6 +26,7 @@ > > #include > > #include > > #include > > +#include > > > > struct timerfd_ctx { > > union { > > @@ -433,22 +434,27 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags) > > } > > > > static int do_timerfd_settime(int ufd, int flags, > > - const struct itimerspec64 *new, > > + struct itimerspec64 *new, > > struct itimerspec64 *old) > > { > > struct fd f; > > struct timerfd_ctx *ctx; > > int ret; > > > > - if ((flags & ~TFD_SETTIME_FLAGS) || > > - !itimerspec64_valid(new)) > > - return -EINVAL; > > Please don't defer this early test of a @flags value. Otherwise > if @flags is invalid you continue fget/put/clock-to-host even > if result will be dropped out then. Cyrill, you are right. I moved this check together with itimerspec64_valid(). The idea was to call itimerspec64_valid() after applying clock offsets but for that, we need to know clockid. Let's wait a bit for other comments to this patch set and then we will fix all things what will be found. Thanks, Andrei