Re: [Qemu-devel] [PATCH v2 45/45] tcg: enable multiple TCG contexts in softmmu

2017-07-18 Thread Richard Henderson
On 07/18/2017 07:52 AM, Emilio G. Cota wrote: On Mon, Jul 17, 2017 at 19:25:14 -1000, Richard Henderson wrote: On 07/16/2017 10:04 AM, Emilio G. Cota wrote: + +/* claim the first free pointer in tcg_ctxs and increment n_tcg_ctxs */ +for (i = 0; i < smp_cpus; i++) { +if (atomic_c

Re: [Qemu-devel] [PATCH v2 45/45] tcg: enable multiple TCG contexts in softmmu

2017-07-18 Thread Emilio G. Cota
On Mon, Jul 17, 2017 at 19:25:14 -1000, Richard Henderson wrote: > On 07/16/2017 10:04 AM, Emilio G. Cota wrote: > >+ > >+/* claim the first free pointer in tcg_ctxs and increment n_tcg_ctxs */ > >+for (i = 0; i < smp_cpus; i++) { > >+if (atomic_cmpxchg(&tcg_ctxs[i], NULL, s) == NUL

Re: [Qemu-devel] [PATCH v2 45/45] tcg: enable multiple TCG contexts in softmmu

2017-07-17 Thread Richard Henderson
On 07/16/2017 10:04 AM, Emilio G. Cota wrote: + +/* claim the first free pointer in tcg_ctxs and increment n_tcg_ctxs */ +for (i = 0; i < smp_cpus; i++) { +if (atomic_cmpxchg(&tcg_ctxs[i], NULL, s) == NULL) { +unsigned int n; + +n = atomic_fetch_inc(&n_tcg_

[Qemu-devel] [PATCH v2 45/45] tcg: enable multiple TCG contexts in softmmu

2017-07-16 Thread Emilio G. Cota
This enables parallel TCG code generation. However, we do not take advantage of it yet since tb_lock is still held during tb_gen_code. In user-mode we use a single TCG context; see the documentation added to tcg_region_init for the rationale. Note that targets do not need any conversion: targets