Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3512322rdh; Mon, 27 Nov 2023 16:46:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IFw+UFmb/bISwm0Oqt3PwV0/NJ6GxegQ+EIcAP0VXiU7x9W6HzNLhOk8KN61Rf5JbLCn8f3 X-Received: by 2002:a05:6e02:1988:b0:35c:66f8:1b92 with SMTP id g8-20020a056e02198800b0035c66f81b92mr9845545ilf.2.1701132394500; Mon, 27 Nov 2023 16:46:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701132394; cv=none; d=google.com; s=arc-20160816; b=hxAmilSiOhXVBO8CBs1Gu2FKD9VrcsjQurCEh+cWQNaHufqzSAqvVG5VsjiUsHavak Fsk6yDb5AVyAzvEVDCc3mnKzVVgkH8D5PVjHBudKVKxKoW8aD/Dy0NKgcf5nZmYP3yrX jWWm4pTVK66OgA0NfJdCYmoFl5Qgto51wzR4XAuo6dPo9MP3leFX8O7AkHDgp19Nerrh /ZYQTkmMsb1D2gkUJVQsgjOeVtaGvYn2T2bJZhH9wJp/cWwOAcD4U7usovHsjRkjEZCf voza5n2LhHp/YkNegUBTNVT0edLLQ9sUaOyj1Oaq22lAcVjFO7Jik/zJJiM7tAaXREMp 3Y3g== 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=nX5y/+1xsJTb3d79j1A2vz0g1fgyzJ3hfPEMuJD84tQ=; fh=OqvKcWQx02M24F9mRhfAIyFNHspcFzJdHs/Rpu/GeRo=; b=Oc1YoVMXwUIzJ3jnMLA3JKdadp1MJrYjT/0pAF/FpqFdTyogci/G5mCRaAma/ZL5+3 j8gRnqU5Z9S4TQRJnThecPxfg9HNebqiZY9Ai01oy/sXmPgiP89IP43LWFWerP6lsdIL D5X8xyeiW4YdyThgnM5NZqB3obWvkLXSXUuTjRfB1XnArwWg2CV780H3P01k4XS13LM3 1QqukHfsr+YCvZSFCUfXPg3VmHn8irs4ltRl0ldXgZ7h3CNbAFTWQGqH4QjHK+IyZOzI 71wj1pqEddOekac7O1d0NozaCvSFDB1wAZglZPzAupwsiqIQMDySu3Av2EGAMc7/w03R i+JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=IvzUw73L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id j25-20020a63fc19000000b005b8f5718605si11045983pgi.48.2023.11.27.16.46.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 16:46:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=IvzUw73L; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id D7E1A80A7E5F; Mon, 27 Nov 2023 16:46:32 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234329AbjK1AqN (ORCPT + 99 others); Mon, 27 Nov 2023 19:46:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234305AbjK1AqL (ORCPT ); Mon, 27 Nov 2023 19:46:11 -0500 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7FAC1B5 for ; Mon, 27 Nov 2023 16:46:17 -0800 (PST) Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-40b367a0a12so3315e9.1 for ; Mon, 27 Nov 2023 16:46:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701132376; x=1701737176; 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=nX5y/+1xsJTb3d79j1A2vz0g1fgyzJ3hfPEMuJD84tQ=; b=IvzUw73L7c2geiXIEtp9BCl9QFFc8dWOtLEjEsF9vQYoyjfqhHpJdnmBxObwwjtKnv x9JGyplzbszEisFC6iYLkA/qex0Lnx1f552SKz24+HhsreCDPuL0HvZClsOdepKIOk10 mQmHXo5SQtVkjKIQz+Sp5GsoomQQCNmwOV6ncF3Gy7pxRLNVYF1uF5mBjq6MVICxiCY+ ZglnRT8r6NKzFZTwudmZdls+ZIRYcvjCFRqKIuh802uP3fUjGh05CLw/1sUC2M0rsjM+ AX9x0d2iFPbF2BYbj5Ymfwk8abweg/S8XHAT/U9kKpx3Ou63W7lRq2Eztq0PNFVnSA88 cRaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701132376; x=1701737176; 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=nX5y/+1xsJTb3d79j1A2vz0g1fgyzJ3hfPEMuJD84tQ=; b=mp4psZQS3EbKScdFMtLaOd+oD8OTyduqIfT81+uMSxE5urvq2nBnf2IS7hsySk2nix 5kdpRIGh7mjv2wzOI7AAKvQ56ZQH/aELodwg6BWNPToD5+9It+5pXFCpaytGQzjjihDP V1QqITMrtwZX7jMMxiNu6PxWLHS7ZMFEAPVLw0nxJs4GB6gTNwNJ+M6n32FcKJbmrMK2 9kQFSI3RP+PFLr3D2vLZuBaAwi+BVu7+DWLxjeiRNGz7rQdOAL2KaMGI+tM6qJivNs/5 WmfrOIP6mjkTAMHwicBF3ctF9JN51spqgdNcXmIFDvDupv7eJPyQvYOpgEWaAzBVoY38 8KTw== X-Gm-Message-State: AOJu0YyaYuJk2PUHunJfBiTpyo5xQe8tg/PLNm4A+zaB2vs95WuF8Tkd bT8kyNvrKmMHqmoR+qGIS07yKjF1frXTgYHDRu+K X-Received: by 2002:a05:600c:3b13:b0:40a:483f:f828 with SMTP id m19-20020a05600c3b1300b0040a483ff828mr731991wms.4.1701132375913; Mon, 27 Nov 2023 16:46:15 -0800 (PST) MIME-Version: 1.0 References: <20231127153901.6399-1-maimon.sagi@gmail.com> In-Reply-To: From: John Stultz Date: Mon, 27 Nov 2023 16:46:03 -0800 Message-ID: Subject: Re: [PATCH v2] posix-timers: add multi_clock_gettime system call To: Richard Cochran Cc: Sagi Maimon , reibax@gmail.com, davem@davemloft.net, rrameshbabu@nvidia.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, maheshb@google.com, Thomas Gleixner Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 27 Nov 2023 16:46:33 -0800 (PST) On Mon, Nov 27, 2023 at 4:12=E2=80=AFPM Richard Cochran wrote: > > On Mon, Nov 27, 2023 at 05:39:01PM +0200, Sagi Maimon wrote: > > Some user space applications need to read some clocks. > > Each read requires moving from user space to kernel space. > > This asymmetry causes the measured offset to have a significant error. > > Adding time/clock gurus (jstultz, tglx) on CC for visibility... > Thanks for the heads up! (though, "guru" is just the noise I make standing up these days) > > Introduce a new system call multi_clock_gettime, which can be used to = measure > > the offset between multiple clocks, from variety of types: PHC, virtua= l PHC > > and various system clocks (CLOCK_REALTIME, CLOCK_MONOTONIC, etc). > > The offset includes the total time that the driver needs to read the c= lock > > timestamp. This last bit about "offset includes the total time that the driver needs to read the clock" is a bit confusing. It seems to suggest there would be start/stop bookend timestamps so you could bound how long it took to read all the clocks, but I don't see that in the patch. > > New system call allows the reading of a list of clocks - up to PTP_MAX= _CLOCKS. > > Supported clocks IDs: PHC, virtual PHC and various system clocks. > > Up to PTP_MAX_SAMPLES times (per clock) in a single system call read. > > The system call returns n_clocks timestamps for each measurement: > > - clock 0 timestamp > > - ... > > - clock n timestamp > > > > Signed-off-by: Sagi Maimon Overally, while I understand the intent, I'm pretty hesitant on it (and "__ptp_multi_clock_get multi_clk_get" has me squinting to find the actual space amongst all the underscores :). If the overhead of reading clockids individually is too much, it seems like the next thing will be folks wanting to export multiple raw hardware counter values so the counter->ns transformation doesn't get inbetween each hw clock read, which this interface wouldn't solve, so we'd have to add yet another interface. Also, I wonder if trying to get multiple clocks in one read seems similar to something uio_ring might help with? Though I can't say I'm very savvy with uio_ring. Have folks looked into that? thanks -john