2008-10-04 16:09:53 Precision timestamping using NMI
Javier Herrero (SPAIN)
Message: 63107
Hello,
I need to timestamp with precision an event, and in order to avoid as far as possible interrupt latencies, i'm thinking on using NMI for this purpose. After reading the docs (yes, I know... NMI... better don't do that ;)... but i'm seeking cycles resolution in the timestamping) I've some doubts:
Since the proposed method uses the CYCLES register, cycles timing resolution would be lost. Would be equally possible to use RETE instead (sacrifying JTAG debugging) ?
Would be possible to call getnstimeofday function from inside the NMI service function?
Thanks! Best regards,
Javier
QuoteReplyEditDelete
2008-10-04 17:33:05 Re: Precision timestamping using NMI
Mike Frysinger (UNITED STATES)
Message: 63108
no, it would not be possible. you need one dedicated scratch register per handler: one for exceptions and one for NMI. RETE provides only one of those scratch registers.
any function you call from NMI space needs to be guaranteed to not trigger an exception, nor attempt to grab any kind of lock resource.
QuoteReplyEditDelete
2008-10-05 05:57:48 Re: Precision timestamping using NMI
Javier Herrero (SPAIN)
Message: 63116
I understand.... Really the only functionality I need inside the NMI is very simple: to latch the values of CYCLES and CYCLES2 registers and let this latched value available to a kernel functions to determine event time (the NMI events are not very frequent, in the hundred of milliseconds range, but shoud be timestamped with the higher possible resolution and accuraccy, with the less possible latency variance), so I think that there would be no exceptions triggered. Would be possible to use NMI for this purpose?
Regards,
Javier
QuoteReplyEditDelete
2008-10-05 15:04:57 Re: Precision timestamping using NMI
Mike Frysinger (UNITED STATES)
Message: 63122
if you latched said values into dedicated L1 data, that would prevent any exceptions. but you would still need a dedicated register scratch register for the NMI handler.