From: Steven Rostedt <rostedt@goodmis.org>
To: Felipe Balbi <balbi@kernel.org>
Cc: linux-trace-devel@vger.kernel.org
Subject: Re: libtraceevent and threads
Date: Thu, 15 Dec 2022 13:52:45 -0500 [thread overview]
Message-ID: <20221215135245.12a879d7@gandalf.local.home> (raw)
In-Reply-To: <871qp0wol3.fsf@balbi.sh>
On Thu, 15 Dec 2022 19:42:32 +0200
Felipe Balbi <balbi@kernel.org> wrote:
> Hi,
>
> I was playing with binding `libtraceevent' to rust today. Generating the
> bindings with rust's `bindgen' is very straight forward. When I moved to
> porting the existing tests to rust, I found out that running a single
> test always worked, while running all tests caused random allocation
> failures and (apparent) corruption of the trace_seq buffer.
>
> Upon further investigating the issue, I noticed that asking `cargo' to
> run tests in a single thread (essentially one test at a time), always
> gave me good results, but as soon as I let `cargo' run 2 threads (or
> more) failures would show.
>
> I appears that this is because `libtraceevent' keeps some global state
> and that prevents different threads to keep their own "context" of the
> library.
>
> I can't say for sure, but it seems that the culprit here is:
>
> static const char *input_buf;
>
> in line 31 of src/event-parse.c. Would there be a way to hide that
> perhaps as part of `struct tep_handle'?
Ah sure. I think we discovered this once before and was meaning to change
it. There may have been issues where we needed to design things
differently. I don't recall.
But if you want to send patches to move that to the tep handle and make it
work, I'm all for it.
-- Steve
prev parent reply other threads:[~2022-12-15 18:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-15 17:42 libtraceevent and threads Felipe Balbi
2022-12-15 18:52 ` Steven Rostedt [this message]
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=20221215135245.12a879d7@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=balbi@kernel.org \
--cc=linux-trace-devel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).