[lttng-dev] what will happen during tracing if getcpu() doesn't return correct cpu number occasionally?

zhenyu.ren zhenyu.ren at aliyun.com
Tue Jul 6 22:37:39 EDT 2021

   I know lttng-ust tracepoint process uses per cpu lockless ringbuffer algorithm for high performance so that it relies on getcpu() to return the cpu number on which the app is running.
   Unfortunately, I am working on arm that linux kernel does not support vdso getcpu() implemention and one getcpu() will take 200ns!!!
   My question is :
   1. do you have any advice for that?
   2. If I implement a cache-version for getcpu()(just like getcpu() implemention before kernel 2.6.23 ), what will happen during tracing process?  
      Since use of the cache could speed getcpu() calls, at the cost that there was a very small chance that the returned cpu number would be out of date, I am not sure whether the "wrong" cpu number will result in the tracing app crashing?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.lttng.org/pipermail/lttng-dev/attachments/20210707/b1844996/attachment.htm>

More information about the lttng-dev mailing list