qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v1 1/2] accel/tcg: adding integration with linux


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH v1 1/2] accel/tcg: adding integration with linux perf
Date: Thu, 22 Aug 2019 15:44:07 +0100
User-agent: Mutt/1.12.1 (2019-06-15)

On Wed, Aug 21, 2019 at 04:01:48PM -0300, Vanderson Martins do Rosario wrote:
> On Thu, Aug 15, 2019 at 11:40 AM Stefan Hajnoczi <address@hidden> wrote:
> > On Wed, Aug 14, 2019 at 11:37:24PM -0300, vandersonmr wrote:
> > > +void start_jitdump_file(void)
> > > +{
> > > +    GString *dumpfile_name = g_string_new(NULL);;
> > > +    g_string_printf(dumpfile_name, "./jit-%d.dump", getpid());
> >
> > Simpler:
> >
> >   gchar *dumpfile_name = g_strdup_printf("./jit-%d.dump", getpid());
> >   ...
> >   g_free(dumpfile_name);
> >
> > > +    dumpfile = fopen(dumpfile_name->str, "w+");
> >
> > getpid() and the global dumpfile variable make me wonder what happens
> > with multi-threaded TCG?
> >
> 
> I did some tests and it appears to be working fine with multi-threaded TCG.
> tcg_exec_init should execute only once even in multi-threaded TCG, right?
> If so, we are going to create only one jitdump file. Also, both in Windows
> and Linux/POSIX fwrites is thread-safe, thus we would be safely updating
> the jitdump file. Does it make sense?

append_load_in_jitdump_file() calls fwrite() multiple times.  What
guarantees they will not be interleaved when multiple threads call this
function?

Stefan

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]