From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B81B2C433EF for ; Tue, 8 Mar 2022 00:55:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344137AbiCHA4Y (ORCPT ); Mon, 7 Mar 2022 19:56:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245642AbiCHA4W (ORCPT ); Mon, 7 Mar 2022 19:56:22 -0500 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D79581155 for ; Mon, 7 Mar 2022 16:55:26 -0800 (PST) Received: by mail-pl1-x630.google.com with SMTP id n2so6087283plf.4 for ; Mon, 07 Mar 2022 16:55:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=sgOcCj2nGBCQ0/uvaT+BpEDvtMy16F61R5agNStyJ50=; b=iFBHAMSARGX8B8rH/e/+mfCFBEl8eJGKSIMAnHKuneDbBT8slC5uC0BL8UfooWVscd 041MLAX1Qt97tf7sak2duzwhX2piU7I+oRa9soQTrSWBIcZF3PXw6IFwAX2568pJgIRP W0kgYzxERE3ySGwDdyWDIHSaQpX09Ptj8bCvMMtnSPem3XBVt9OkxiU+vfp+31Nvkd+l 5F/sFcx6c0a3/WaOZTAFkNpHqLR92GZ/o0LkmZqM4Oced7ifJ3DpbEShIyX6bypc3r3P spLyfjfbTOHA47h8J+koGHtQgByw+R0cXfNdUlnGvRtx+0gr7+BM5udIe2Hkfz9IpWhU srPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=sgOcCj2nGBCQ0/uvaT+BpEDvtMy16F61R5agNStyJ50=; b=17x3oiefiAWOzo4DVh6bChGiJhiFCsbGsD6iHcugL+PUoBI6jQu5HPzWrLcGajjaKl ya7FsMFT81ML8CdGnIXykGxEBEqlCtU+wEhE3m/5aFyEF9ffwf4Z4X4whFKGAd/uEszw Qzt+LfFcjnEcTqaO//oC4GwfCdmd9FJf0MTZKkptrr5Vndf311tlTE9fQRf8kHbzDRGg IPidYD2OzeC+c+LnP+UdDKY0CBcVCo3YPyTN/y4V2CDZw8RgJFvpH079KuP97IaARVvt l74VvTFDC6yVVbeUWw//UC37lFnF0mrRUrIyESbNweKQwyLvX353E6NEnLtydBKCpNPY S9cw== X-Gm-Message-State: AOAM531MYca3TH/NQhvdBzpIVjs2xvJ0yXLfmWDDuWkQZlcw1/yvzHH4 OaFrJy29Of80ARHWoewXhl4= X-Google-Smtp-Source: ABdhPJxv9/R8GfQ6Pv3C1FLW7MrSgm0XHnA1+DwxGmEsMJIhTB0Fx3MeTafYc47Nlj0Jmg5jhI9Iww== X-Received: by 2002:a17:902:d705:b0:14e:e5a2:1b34 with SMTP id w5-20020a170902d70500b0014ee5a21b34mr14309559ply.88.1646700926393; Mon, 07 Mar 2022 16:55:26 -0800 (PST) Received: from hoboy.vegasvil.org ([2601:640:8200:33:e2d5:5eff:fea5:802f]) by smtp.gmail.com with ESMTPSA id a32-20020a631a20000000b003756899829csm12914130pga.58.2022.03.07.16.55.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 16:55:26 -0800 (PST) Date: Mon, 7 Mar 2022 16:55:23 -0800 From: Richard Cochran To: Gerhard Engleder Cc: yangbo.lu@nxp.com, David Miller , Jakub Kicinski , mlichvar@redhat.com, Vinicius Costa Gomes , netdev Subject: Re: [RFC PATCH net-next 0/6] ptp: Support hardware clocks with additional free running time Message-ID: <20220308005523.GB6994@hoboy.vegasvil.org> References: <20220306085658.1943-1-gerhard@engleder-embedded.com> <20220306170504.GE6290@hoboy.vegasvil.org> <20220306215032.GA10311@hoboy.vegasvil.org> <20220307143440.GC29247@hoboy.vegasvil.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Mon, Mar 07, 2022 at 06:54:19PM +0100, Gerhard Engleder wrote: > ktime_to_cycles uses hwtstamp as key for the cache lookup. As long as > the PHC is monotonic, the key is unique. If the time of the PHC is set, then > the cache would be invalidated. I'm afraid that setting the PHC could lead to > wrong or missing timestamps. Setting the PHC in hardware, timestamp > generation in hardware, and cache invalidation in software would need to > be synchronized somehow. You can avoid errors even with a time jump: Make a variant (union) of skb_shared_hwtstamps to allow driver to provide an address or cookie instead of ktime_t. Set a flag in the skbuff to signal this. Let the Rx path check the flag and fetch the time stamp by callback with the address/cookie. Thanks, Richard