All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Julien Blanc <julien.blanc@sprinte.eu>,
	"francois.legal@thom.fr.eu.org" <francois.legal@thom.fr.eu.org>,
	"xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: Re: Large gpio interrupt latency
Date: Tue, 22 Jun 2021 12:07:09 +0200	[thread overview]
Message-ID: <87czseyzzm.fsf@xenomai.org> (raw)
In-Reply-To: <47dd2aec-3adf-53eb-bdae-b069d626849a@siemens.com>


Jan Kiszka <jan.kiszka@siemens.com> writes:

> On 22.06.21 11:31, Philippe Gerum wrote:
>> 
>> Jan Kiszka <jan.kiszka@siemens.com> writes:
>> 
>>> On 22.06.21 10:37, Philippe Gerum wrote:
>>>>
>>>> Jan Kiszka <jan.kiszka@siemens.com> writes:
>>>>
>>>>> On 22.06.21 09:49, Julien Blanc via Xenomai wrote:
>>>>>> Le mardi 22 juin 2021 à 09:38 +0200, Philippe Gerum via Xenomai a
>>>>>> écrit :
>>>>>>>
>>>>>>> With this in mind, assuming that we have previously sanitized the
>>>>>>> clock
>>>>>>> identifier, doing this:
>>>>>>>
>>>>>>> #define get_timestamp(__clock) \
>>>>>>> ({ (__clock) == CLOCK_MONOTONIC ? rtdm_clock_read_monotonic() :
>>>>>>> rtdm_clock_read(); })
>>>>>>>
>>>>>>> may end up being faster than:
>>>>>>>
>>>>>>> xnticks_t (*__get_timestamp)(clockid_t clock);
>>>>>>> #define get_timestamp(__clock)	__get_timestamp(__clock)
>>>>>>
>>>>>> Is really a runtime switch necessary ? Since relying on the realtime
>>>>>> clock is inherently broken, my understanding is that it should be kept
>>>>>> as compatibility purpose only.
>>>>>
>>>>> Again: The real-time clock is not a broken clock per se. It is the basis
>>>>> of many services (POSIX...) and - if managed properly - it is as sound
>>>>> clock to build upon. If you need absolute timestamps to calculate
>>>>> absolute timeouts (like users of the existing code do), this is the
>>>>> clock to go, also in future versions.
>>>>
>>>> Definitely correct, for timeout specs.
>>>>
>>>>> Also if you want to use
>>>>> PTP-sync'ed clocks across systems (TSN...), it is THE way to go. At that
>>>>> point, monotonic timestamps will lose relevance in practice.
>>>>>
>>>>
>>>> We are not there yet. So, let's all agree than we need both clock bases,
>>>> and a flexible way to select the current one.
>>>>
>>>
>>> What's still missing with Dovetail and a Linux-operated PTP sync for the
>>> main clocksource? Hardending of software-based sync paths? Where it's
>>> hw-based, that should already be fine (latest Intel SOCs).
>>>
>> 
>> Again, we have two use cases: absolute timeouts based on a common epoch
>> which may change, and delays. We do know PTP with hw-based support is an
>> efficient way to maintain consistency among users of the former,
>> nevertheless we still need to express/measure strict delays in other
>> cases. So, we do need both clocks.
>> 
>
> If you need cross-system event stamping, the unsync'ed monotonic clock
> is the wrong choice as well.
>

As usual, it's a trade-off, a risk assessment between observing
non-coherent SMP readings and warp jumps. This is a call an application
should be allowed to make, I see no reason to impose a solution
arbitrarily without knowing what the app actually wants to do.

> Again: What is missing to use PTP-sync'ed clock-realtime under Dovetail
> today?
>

Nothing when it comes to reading timestamps, via the NMI-safe
ktime_get_real_fast_ns() service (updates will be non-preemptible while
holding the seqlock).

-- 
Philippe.


  reply	other threads:[~2021-06-22 10:07 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-16  7:15 Large gpio interrupt latency François Legal
2021-06-16  8:10 ` Chen, Hongzhan
2021-06-16  8:18   ` François Legal
2021-06-16  9:05     ` Chen, Hongzhan
2021-06-16  9:12       ` François Legal
2021-06-16  9:40         ` Jan Kiszka
2021-06-16 13:29           ` François Legal
2021-06-16 13:38             ` Jan Kiszka
2021-06-16 13:51               ` François Legal
2021-06-16 15:10                 ` Jan Kiszka
2021-06-17  7:15                   ` François Legal
2021-06-18 18:41                   ` François Legal
2021-06-21  6:56                     ` Jan Kiszka
2021-06-21  9:39                       ` Philippe Gerum
2021-06-21 13:38                         ` Jan Kiszka
2021-06-21 13:54                           ` Philippe Gerum
2021-06-21 14:02                             ` Jan Kiszka
2021-06-21 14:28                               ` Philippe Gerum
2021-06-21 14:46                                 ` Jan Kiszka
2021-06-21 14:57                                   ` Philippe Gerum
2021-06-21 15:35                                     ` François Legal
2021-06-21 16:38                                       ` Philippe Gerum
2021-06-21 16:45                                         ` Philippe Gerum
2021-06-21 18:06                                           ` François Legal
2021-06-22  7:38                                             ` Philippe Gerum
2021-06-22  7:49                                               ` Julien Blanc
2021-06-22  8:22                                                 ` Jan Kiszka
2021-06-22  8:37                                                   ` Philippe Gerum
2021-06-22  9:14                                                     ` Jan Kiszka
2021-06-22  9:31                                                       ` Philippe Gerum
2021-06-22  9:39                                                         ` Jan Kiszka
2021-06-22 10:07                                                           ` Philippe Gerum [this message]
2021-07-23  7:02                                                             ` François Legal
2021-07-23  8:04                                                               ` Philippe Gerum
2021-08-02 12:24                                                                 ` Jan Kiszka
2021-08-05 15:11                                                                   ` François Legal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87czseyzzm.fsf@xenomai.org \
    --to=rpm@xenomai.org \
    --cc=francois.legal@thom.fr.eu.org \
    --cc=jan.kiszka@siemens.com \
    --cc=julien.blanc@sprinte.eu \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.