qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 0/1] Add missing function names to symbol list


From: Alex Bennée
Subject: Re: [PATCH 0/1] Add missing function names to symbol list
Date: Mon, 18 Oct 2021 12:18:11 +0100
User-agent: mu4e 1.7.0; emacs 28.0.60

Lukas Jünger <lukas.junger@greensocs.com> writes:

> On 9/7/21 13:43, Alex Bennée wrote:
>> Lukas Jünger <lukas.junger@greensocs.com> writes:
>>
>>> Hi all,
>>>
>>> I have been trying to use the hwprofile and cache plugin on
>>> qemu-system-riscv64. They failed to load with an undefined
>>> symbol error. It looks like some of the plugin API functions
>>> are missing from the symbol list, so I added them.
>> Heh I had a similar patch in plugins/next but yours includes more
>> symbols so queued to plugins/next, thanks. Not sure how I missed it
>> before - I think we might not have been honouring the symbol list
>> before.
>>
>>> Afterwards
>>> the plugins worked (eventhough the cache plugin is segfaulting
>>> on shutdown, but that is a separate, unrelated issue).
>> Has this been tracked down yet? There is a fix f7e68c9c99 (tcg/plugins:
>> implement a qemu_plugin_user_exit helper) which was for user mode. At
>> the time I didn't think system mode would be affected due to the atexit
>> callback only being called once vCPUs had shutdown.
>
> It seems like there is a race condition with the tcg threads.
> The plugin exit handler is run with atexit(). While the exit callback
> is freeing memory, tcg is still running and memory callbacks write
> to the already freed data structures in the plugin causing the segfault.
> I tested this with the current master branch and this cmdline:

We fixed a bug in linux-user that was leading to the exit callbacks
being called (see qemu_plugin_user_exit).

> bin/qemu-system-riscv64 -machine virt -nographic -bios fw_jump.elf
>     -kernel Image -plugin path/to/libcache.so -d plugin -D log.txt
>
> I wonder if we could somehow wait for the tcg to exit before executing
> plugin exit cb. Do you have an idea?

It should be because I don't see how TCG would still be running when we
run the atexit handler. It literally shouldn't be called until QEMU
itself calls exit which should be well after the TCG has stopped running
(see pause_all_vcpus).

Any chance you could replicate and generate a backtrace that shows this
happening?

-- 
Alex Bennée



reply via email to

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