Re: How to solve the coupling between libtraceevent and kernel trace?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 4 Aug 2023 17:52:48 +0800
Lv Ying <lvying6@xxxxxxxxxx> wrote:

> Hi, all:
> 
> I am a rasdaemon developer which depeneds on libtraceevent to parse 
> kernel trace events. There is coupling between libtraceevnt and kernel 
> trace, if something in libtraceevent and kernel does not match, which 
> will cause libtraceevent parse wrong thing. e.g 
> https://github.com/mchehab/rasdaemon/pull/98
> 
> We also encounter similar problem:
> * libtrace(old) KBUFFER_TYPE_TIME_STAMP size = 12
> * kernel(new) KBUFFER_TYPE_TIME_STAMP size = 8
> Such mismatch will cause strange behavior when parsing trace events.

So what happened was the old 12 byte version of TIME_STAMP was never
actually implemented in the kernel. When we finally got around to
implementing it, we only needed 8 bytes for it, so it became 8 bytes.

I made the mistake of adding that code in kbuffer.c before it was ever
implemented in the kernel and said it would be 12 bytes.

> 
> So if libtraceevent is released out of(independent) kernel, how does 
> libtraceevnt to keep compatible with the running kernel(maybe not the 
> newest)?
> 

Now that it has been implemented, it's not going to change. 8 bytes is now
an API. Any more updates should not cause a problem with libtraceevent as
there's many more tools that depend on it working. And the fact that it is
no longer in the kernel, guarantees more that the interface will remain
stable.

rasdaemon should be using the external libtraceevent library because it
will be able to get more information out of any new data. Newer kernels
should not break existing libtracevent, but it may just skip over new
features.

-- Steve



[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux