[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] tcg: reworking tb_invalidated_flag
From: |
Alex Bennée |
Subject: |
Re: [Qemu-devel] tcg: reworking tb_invalidated_flag |
Date: |
Fri, 01 Apr 2016 12:11:28 +0100 |
User-agent: |
mu4e 0.9.17; emacs 25.0.92.2 |
Sergey Fedorov <address@hidden> writes:
> On 31/03/16 16:37, Alex Bennée wrote:
>> Sergey Fedorov <address@hidden> writes:
>>> Looks like no matter which approach we use, it's ultimately necessary to
>>> ensure all CPUs have exited from translated code before the translation
>>> buffer may be safely flushed.
>> One approach would be to have multiple translation contexts with their
>> own buffers and then you can safely flush TBs if no vCPUs are currently
>> executing in those regions. But I suspect that is a much more complex
>> future optimisation.
>
> Yes, this is much more complex and its performance impact should be
> investigated.
>
>> Having said that is it safe to flush TBs from a given page if we know
>> no vCPUs are currently executing in that page? As the execution loop has
>> to exit the chained TBs as we cross page boundaries we could just keep
>> account of which vCPUs are currently in which page.
>
> It should be safe to invalidate a TB while some other CPU is executing
> its translated code. But it should be guaranteed that no CPU execute any
> old TB after tb_flush() since we're going to start reusing those TBs.
>
> I see how TB cannot be patched if it spans two pages, is there any on
> when TCG goto_tb can be generated?
Do you mean tcg_gen_goto_tb?
AFAIUI all blocks end with goto_tb post-ambles but they should only
directly jump to another TB if they are in the same page.
--
Alex Bennée
- Re: [Qemu-devel] tcg: reworking tb_invalidated_flag,
Alex Bennée <=