On Mon, Jul 17, 2017 at 19:09:28 -1000, Richard Henderson wrote: > On 07/16/2017 10:04 AM, Emilio G. Cota wrote: > >+#ifdef CONFIG_SOFTMMU > >+/* > >+ * It is likely that some vCPUs will translate more code than others, so we > >+ * first try to set more regions than smp_cpus, with those regions being > >+ * larger than the minimum code_gen_buffer size. If that's not possible we > >+ * make do by evenly dividing the code_gen_buffer among the vCPUs. > >+ */ > >+void softmmu_tcg_region_init(void) > >+{ > >+ size_t i; > >+ > >+ /* Use a single region if all we have is one vCPU thread */ > >+ if (smp_cpus == 1 || !qemu_tcg_mttcg_enabled()) { > >+ tcg_region_init(0); > >+ return; > >+ } > >+ > >+ for (i = 8; i > 0; i--) { > >+ size_t regions_per_thread = i; > >+ size_t region_size; > >+ > >+ region_size = tcg_init_ctx.code_gen_buffer_size; > >+ region_size /= smp_cpus * regions_per_thread; > >+ > >+ if (region_size >= 2 * MIN_CODE_GEN_BUFFER_SIZE) { > >+ tcg_region_init(smp_cpus * regions_per_thread); > >+ return; > >+ } > >+ } > >+ tcg_region_init(smp_cpus); > >+} > >+#endif > > Any reason this code wouldn't just live in tcg_region_init? > It would certainly simplify the interface.
Good point. Will move it there, adding a comment to make sure the function is called once qemu_tcg_mttcg_enabled() has been set up. E.