Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp225436lqg; Thu, 11 Apr 2024 00:13:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVXhXFBikIXgEc0GbX3kayHCuaznjf3txBYVL/WN0NH4e4TjWoKbPpgstxx3vPBmqgUJViTkc3swkY+mym2239ohBt1VELE59BGtbolNQ== X-Google-Smtp-Source: AGHT+IG+cH3U78Y6tg8kJ3dH6nicrwagmdlEFH2WwDUohK0uyOtUUYzSCdOM86vfFf4/XSCq6DC/ X-Received: by 2002:a50:c355:0:b0:56e:428d:77c1 with SMTP id q21-20020a50c355000000b0056e428d77c1mr3072211edb.36.1712819592969; Thu, 11 Apr 2024 00:13:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712819592; cv=pass; d=google.com; s=arc-20160816; b=gWLqSX5vVTl5FT8CYoqZAq0vTfEGVHrNpEISEfb1NdVOnpgckPRnPTIP5KAOOgEEuG kvlNnWELAavT5AmCTZVdHgNAe1dVmU6OAc7HSogb76FG3P8nWjOLozIOZ0bccCIDryWl iFbPlh/1I5dHAtlwY0QmW3E0NDQO3YOH8y9uvNO6lasI83CYdNAKoNWbJtEIuijyooVq WS38hwsLHQzI60l2+SRNAR03BslPtvYVsb/HM9E6F0JbRYdHXsCR9y7+1o7V8Gjclp86 URznVsSi8IoECmbAWWfLwqVa1dsmZ7xWxT8yqokz6zGJxHEeohlTWMOAX4Cze+KRMFb6 srVA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=qTHSIMuZ7gmHtraT80hduj6De1QkHuQBkMKb5QVg53s=; fh=XaC3Eh8TSwW+FP0BrerU4nII+SbvpC1GRqeDRmuR6dw=; b=Zgq/OgH+WSUY8RoFa4V8lDrLhe5hlw1Z7npbfz9EOn8yU29cUdOKmKXKPF0pkX7XnJ cb45gVSoV+kFxjDb6kb+J0jef2QwUwWmJgJlbhn4eZPBdv9sMAAPZjwkKp0gcivSHZhB sYxgHkDBdTUE/4FX91CLCoiAd7Hz64SqznxmmTXG7skF7VWIdp+6m/2pyj3n6b8QDvaZ CtUp+jEISYOrR/H8GEdVQPubBg5BtCm+2NiJsZnX0P79RqBt6KuMC75pP511+mXAp70X kKaIYixFjUtDe7x8F20i1HoUpfWmQqoEhxNrUSPlekddzunYNWR/MXLiwM+HQvwucreJ 5CCQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ALAdr+l0; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-139942-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139942-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id h19-20020a05640250d300b0056c19a9e0dfsi479001edb.372.2024.04.11.00.13.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 00:13:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-139942-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ALAdr+l0; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-139942-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139942-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 7BB971F2233A for ; Thu, 11 Apr 2024 07:13:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2FDC113E059; Thu, 11 Apr 2024 07:11:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ALAdr+l0" Received: from mail-yb1-f171.google.com (mail-yb1-f171.google.com [209.85.219.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5AA4613DBA8; Thu, 11 Apr 2024 07:11:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712819516; cv=none; b=EjAboDk9LTxJ6HZ4+TVOy77MdzOyci8JUwqzP//81k7YqxrOn2mQ7AcU/dQRVt+ythjfforv3l5uzyyhzhp0yGVTNXlv3TZS8lsjKqn4QBKrPXcYcA91KkoYnINvlaNAzcWlSfAp37kucRg+oJC6Ksa64yqe8YMfefzQciMVW84= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712819516; c=relaxed/simple; bh=foAx51dmM/Nc1MbYnYMHtZiVXid4Ya2CqTPwNkd5KJc=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=KJPqXFzB95226khYICDx2FXaJcMKqaDBmU4oZtFXmnL7cHFu0YZu5/gG+/itJxP8fIYmsebEbrfgi/eYAdWrVToSjSljp/wm/q9E1JUGhW3NOoL0W1oZ1XINqL2Aa/Gz9VZjEvGIDc9YKeWvZt9KtSzE7KecZoOl/r25SbCurQI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ALAdr+l0; arc=none smtp.client-ip=209.85.219.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-yb1-f171.google.com with SMTP id 3f1490d57ef6-dde0b30ebe2so6418370276.0; Thu, 11 Apr 2024 00:11:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712819513; x=1713424313; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=qTHSIMuZ7gmHtraT80hduj6De1QkHuQBkMKb5QVg53s=; b=ALAdr+l0yZPbysZv0x1C4ckegg8FMJq6WmadwKlmhHW3RSipYga3zCdIOG2OStcdfR 4kniwQKrCsmzd849bdbIA/27C7wbmT6YHPTFqydegA8ae3KmVIfJEVsj/NNbDB5drNtD UTTjuT4FS+l2OY5nEz9mJrlxTB7MDQZhRSc4huFLHBkS6xsibXUhnaATjhMQNXGbbseP 9tBxh66XN8rh2FKoVOfLi6kFiJqTkJb3XsgoI7lEQB15uZGAnjCW6JlTX0ytuFRQhGgm imMHTc/CrbcU7QtGosx004CZQLKZDgOtJpg0+J3tzyajKCcMIsTSm8jQ6hGE9st06CRX SeUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712819513; x=1713424313; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qTHSIMuZ7gmHtraT80hduj6De1QkHuQBkMKb5QVg53s=; b=LC17VC7zCXpiKevNMMOMO9XmLak/2NnX4FjCA9ZFvH0Qif+Jqxqz+lYbtQ2ehpt8+F jNmnRPnPGmr/WqR2JEz6zB70zZaLlKLTRzGVm3g6fwZrVlSR94l352sCB0eVszty1v18 7OBD3oF1SwD+6+VhVj8TNrGDOu7YodvOxc/Oy73Bm6f4LzcOyHbS8NcL0kl9TSmqqE5a 6LUZmKjjDRed7NwC7RaxgGLyusMWQr0q3MnHmC0M0ao+I2v4wAGjYNfFhImRpI+3TgpB UHEN7n1QZob73WYnQpb9d2ynxyeVzhPR6dW/V7/Fxt6NXRLDq0lu33NBDE9W17JMCbWg rr6Q== X-Forwarded-Encrypted: i=1; AJvYcCXG8beQpUR9PMLX81QZ4mJnJoaOzJnLMcBTVFomjo59V+uas2fUIrDncP6nXSjjAe0qmz7CjSHt7arrZMQrZOVJ9iHGc7E2EaNPOK22W+QFOI72HUMjTBunObrMcjbQvnWNl05IR6GJqmSTSQW6JT5PHKT1Y7JjBzYr5mC8Y0SLasM/VtP0o9ZZefvqqF7KwSmmQArOYa3fAYl0hw== X-Gm-Message-State: AOJu0YzGZh5zhJcMcHY96pszbIzTN4YA7by/k4zOLyrHk65Tm5kNntLR gEKJUXphiNMiytBbx83/hTrhcUeDBI20idL60Nz5u5cgKBlz8UUuPtOCwiw3n1CEfah1i5DLYy+ 1BQSTEH0U8AECcC5Z+Bu/iSIx1y4= X-Received: by 2002:a25:814d:0:b0:dcd:1d44:f6c1 with SMTP id j13-20020a25814d000000b00dcd1d44f6c1mr4641650ybm.16.1712819513073; Thu, 11 Apr 2024 00:11:53 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <878r29hjds.ffs@tglx> <87o7asdd65.ffs@tglx> <87il10ce1g.ffs@tglx> <877chfcrx3.ffs@tglx> <871q7md0ak.ffs@tglx> In-Reply-To: From: Sagi Maimon Date: Thu, 11 Apr 2024 10:11:41 +0300 Message-ID: Subject: Re: [PATCH v7] posix-timers: add clock_compare system call To: =?UTF-8?B?TWFoZXNoIEJhbmRld2FyICjgpK7gpLngpYfgpLYg4KSs4KSC4KSh4KWH4KS14KS+4KSwKQ==?= Cc: Thomas Gleixner , richardcochran@gmail.com, luto@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, arnd@arndb.de, geert@linux-m68k.org, peterz@infradead.org, hannes@cmpxchg.org, sohil.mehta@intel.com, rick.p.edgecombe@intel.com, nphamcs@gmail.com, palmer@sifive.com, keescook@chromium.org, legion@kernel.org, mark.rutland@arm.com, mszeredi@redhat.com, casey@schaufler-ca.com, reibax@gmail.com, davem@davemloft.net, brauner@kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, linux-arch@vger.kernel.org, netdev@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Mahesh What is the status of your patch? if your patch is upstreamed , then it will have all I need. But, If not , I will upstream my patch. BR, On Thu, Apr 11, 2024 at 5:56=E2=80=AFAM Mahesh Bandewar (=E0=A4=AE=E0=A4=B9= =E0=A5=87=E0=A4=B6 =E0=A4=AC=E0=A4=82=E0=A4=A1=E0=A5=87=E0=A4=B5=E0=A4=BE= =E0=A4=B0) wrote: > > On Wed, Apr 3, 2024 at 6:48=E2=80=AFAM Thomas Gleixner wrote: > > > > On Tue, Apr 02 2024 at 16:37, Mahesh Bandewar (=E0=A4=AE=E0=A4=B9=E0=A5= =87=E0=A4=B6 =E0=A4=AC=E0=A4=82=E0=A4=A1=E0=A5=87=E0=A4=B5=E0=A4=BE=E0=A4= =B0) wrote: > > > On Tue, Apr 2, 2024 at 3:37=E2=80=AFPM Thomas Gleixner wrote: > > > The modification that you have proposed (in a couple of posts back) > > > would work but it's still not ideal since the pre/post ts are not > > > close enough as they are currently (properly implemented!) > > > gettimex64() would have. The only way to do that would be to have > > > another ioctl as I have proposed which is a superset of current > > > gettimex64 and pre-post collection is the closest possible. > > > > Errm. What I posted as sketch _is_ using gettimex64() with the extra > > twist of the flag vs. a clockid (which is an implementation detail) and > > the difference that I carry the information in ptp_system_timestamp > > instead of needing a new argument clockid to all existing callbacks > > because the modification to ptp_read_prets() and postts() will just be > > sufficient, no? > > > OK, that makes sense. > > > For the case where the driver does not provide gettimex64() then the > > extension of the original offset ioctl is still providing a better > > mechanism than the proposed syscall. > > > > I also clearly said that all drivers should be converted over to > > gettimex64(). > > > I agree. Honestly that should have been mandatory and > ptp_register_clock() should fail otherwise! Probably should have been > part of gettimex64 implementation :( > > I don't think we can do anything other than just hoping all driver > implementations include gettimex64 implementation. > > > > Having said that, the 'flag' modification proposal is a good backup > > > for the drivers that don't have good implementation (close enough but > > > not ideal). Also, you don't need a new ioctl-op. So if we really want > > > precision, I believe, we need a new ioctl op (with supporting > > > implementation similar to the mlx4 code above). but we want to save > > > the new ioctl-op and have less precision then proposed modification > > > would work fine. > > > > I disagree. The existing gettimex64() is good enough if the driver > > implements it correctly today. If not then those drivers need to be > > fixed independent of this. > > > > So assumed that a driver does: > > > > gettimex64() > > ptp_prets(sts); > > read_clock(); > > ptp_postts(sts); > > > > today then having: > > > > static inline void ptp_read_system_prets(struct ptp_system_timestamp *s= ts) > > { > > if (sts) { > > if (sts->flags & PTP_SYS_OFFSET_MONO_RAW) > > ktime_get_raw_ts64(&sts->pre_ts); > > else > > ktime_get_real_ts64(&sts->pre_ts); > > } > > } > > > > static inline void ptp_read_system_postts(struct ptp_system_timestamp *= sts) > > { > > if (sts) { > > if (sts->flags & PTP_SYS_OFFSET_MONO_RAW) > > ktime_get_raw_ts64(&sts->post_ts); > > else > > ktime_get_real_ts64(&sts->post_ts); > > } > > } > > > > or > > > > static inline void ptp_read_system_prets(struct ptp_system_timestamp *s= ts) > > { > > if (sts) { > > switch (sts->clockid) { > > case CLOCK_MONOTONIC_RAW: > > time_get_raw_ts64(&sts->pre_ts); > > break; > > case CLOCK_REALTIME: > > ktime_get_real_ts64(&sts->pre_ts); > > break; > > } > > } > > } > > > > static inline void ptp_read_system_postts(struct ptp_system_timestamp *= sts) > > { > > if (sts) { > > switch (sts->clockid) { > > case CLOCK_MONOTONIC_RAW: > > time_get_raw_ts64(&sts->post_ts); > > break; > > case CLOCK_REALTIME: > > ktime_get_real_ts64(&sts->post_ts); > > break; > > } > > } > > } > > > > is doing the exact same thing as your proposal but without touching any > > driver which implements gettimex64() correctly at all. > > > I see. Yes, this makes sense. > > > While your proposal requires to touch every single driver for no reason= , > > no? > > > > It is just an implementation detail whether you use a flag or a > > clockid. You can carry the clockid for the clocks which actually can be > > read in that context in a reserved field of PTP_SYS_OFFSET_EXTENDED: > > > > struct ptp_sys_offset_extended { > > unsigned int n_samples; /* Desired number of measurements. *= / > > clockid_t clockid; > > unsigned int rsv[2]; /* Reserved for future use. */ > > }; > > > > and in the IOCTL: > > > > if (extoff->clockid !=3D CLOCK_MONOTONIC_RAW) > > return -EINVAL; > > > > sts.clockid =3D extoff->clockid; > > > > and it all just works, no? > > > Yes, this should work. However, I didn't check if struct > ptp_system_timestamp is used in some other context. > > > I have no problem to decide that PTP_SYS_OFFSET will not get this > > treatment and the drivers have to be converted over to > > PTP_SYS_OFFSET_EXTENDED. > > > > But adding yet another callback just to carry a clockid as argument is = a > > more than pointless exercise as I demonstrated. > > > Agreed. As I said, I thought we cannot change the gettimex64() without > breaking the compatibility but the fact that CLOCK_REALTIME is "0" > works well for the backward compatibility case. > > I can spin up an updated patch/series that updates gettimex64 > implementation instead of adding a new ioctl-op If you all agree. > > thanks, > --mahesh.. > > > Thanks, > > > > tglx