[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH-for-8.2?] accel/tcg: Implement tcg_unregister_thread()
From: |
Michal Suchánek |
Subject: |
Re: [RFC PATCH-for-8.2?] accel/tcg: Implement tcg_unregister_thread() |
Date: |
Wed, 6 Dec 2023 16:25:43 +0100 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Wed, Dec 06, 2023 at 01:17:08PM -0100, Miguel Luis wrote:
> Hi!
>
> On 04/12/2023 18:40, Philippe Mathieu-Daudé wrote:
> > Unplugging vCPU triggers the following assertion in
> > tcg_register_thread():
> >
> > 796 void tcg_register_thread(void)
> > 797 {
> > ...
> > 812 /* Claim an entry in tcg_ctxs */
> > 813 n = qatomic_fetch_inc(&tcg_cur_ctxs);
> > 814 g_assert(n < tcg_max_ctxs);
> >
> > Implement and use tcg_unregister_thread() so when a
> > vCPU is unplugged, the tcg_cur_ctxs refcount is
> > decremented.
>
>
> I've had addressed this issue before (posted at [1]) and had exercised
> it with vCPU hotplug/unplug patches for ARM although I was not sure about what
> would be needed to be done regarding plugins on the context of
> tcg_unregister_thread. I guess they would need to be freed also?
Doesn't it have the same problem that it will randomly free some context
which is not necessarily associated with the unplugged CPU?
Consider machine with 4 CPUs, they are likely added in order - cpu0
getting context0, cpu1 context1, etc.
Unplug CPU 1. Given that context 3 is top the would be unallocated by
the decrement, or am I missing something?
Thanks
Michal
>
> Thank you
>
> Miguel
>
> [1]:
> https://lore.kernel.org/qemu-devel/20230926103654.34424-5-salil.mehta@huawei.com/
- [RFC PATCH-for-8.2?] accel/tcg: Implement tcg_unregister_thread(), Philippe Mathieu-Daudé, 2023/12/04
- Re: [RFC PATCH-for-8.2?] accel/tcg: Implement tcg_unregister_thread(), Stefan Hajnoczi, 2023/12/04
- Re: [RFC PATCH-for-8.2?] accel/tcg: Implement tcg_unregister_thread(), Michal Suchánek, 2023/12/04
- Re: [RFC PATCH-for-8.2?] accel/tcg: Implement tcg_unregister_thread(), Richard Henderson, 2023/12/04
- Re: [RFC PATCH-for-8.2?] accel/tcg: Implement tcg_unregister_thread(), Michal Suchánek, 2023/12/05
- Re: [RFC PATCH-for-8.2?] accel/tcg: Implement tcg_unregister_thread(), Michal Suchánek, 2023/12/06
- Re: [RFC PATCH-for-8.2?] accel/tcg: Implement tcg_unregister_thread(), Philippe Mathieu-Daudé, 2023/12/06
- Re: [RFC PATCH-for-8.2?] accel/tcg: Implement tcg_unregister_thread(), Stefan Hajnoczi, 2023/12/06
Re: [RFC PATCH-for-8.2?] accel/tcg: Implement tcg_unregister_thread(), Miguel Luis, 2023/12/06
- Re: [RFC PATCH-for-8.2?] accel/tcg: Implement tcg_unregister_thread(),
Michal Suchánek <=
Re: [RFC PATCH-for-8.2?] accel/tcg: Implement tcg_unregister_thread(), Alex Bennée, 2023/12/06