From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49456) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6MuX-0004XL-4p for qemu-devel@nongnu.org; Fri, 27 May 2016 14:55:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b6MuR-0006se-6l for qemu-devel@nongnu.org; Fri, 27 May 2016 14:55:04 -0400 Received: from mail-lf0-x244.google.com ([2a00:1450:4010:c07::244]:35605) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6MuQ-0006sA-Uq for qemu-devel@nongnu.org; Fri, 27 May 2016 14:54:59 -0400 Received: by mail-lf0-x244.google.com with SMTP id p10so9217471lfb.2 for ; Fri, 27 May 2016 11:54:58 -0700 (PDT) References: <1459870344-16773-1-git-send-email-alex.bennee@linaro.org> <1459870344-16773-12-git-send-email-alex.bennee@linaro.org> <57485238.1020406@gmail.com> <9ac0359b-6c90-4933-ccb9-9f4b6aadf5f9@redhat.com> <57486297.6070509@gmail.com> <8c646051-84f1-c97a-f424-a854f45b9362@redhat.com> From: Sergey Fedorov Message-ID: <57489800.4060009@gmail.com> Date: Fri, 27 May 2016 21:54:56 +0300 MIME-Version: 1.0 In-Reply-To: <8c646051-84f1-c97a-f424-a854f45b9362@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC v2 11/11] tcg: enable thread-per-vCPU List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , =?UTF-8?Q?Alex_Benn=c3=a9e?= , mttcg@greensocs.com, fred.konrad@greensocs.com, a.rigo@virtualopensystems.com, cota@braap.org Cc: qemu-devel@nongnu.org, mark.burton@greensocs.com, jan.kiszka@siemens.com, rth@twiddle.net, peter.maydell@linaro.org, claudio.fontana@huawei.com, Peter Crosthwaite On 27/05/16 18:25, Paolo Bonzini wrote: > > On 27/05/2016 17:07, Sergey Fedorov wrote: >>>>>> 1. Make 'cpu->thread_kicked' access atomic >>>>>> 2. Remove global 'exit_request' and use per-CPU 'exit_request' >>>>>> 3. Change how 'current_cpu' is set >>>>>> 4. Reorganize round-robin CPU TCG thread function >>>>>> 5. Enable 'mmap_lock' for system mode emulation (do we really want this?) >>>> No, I don't think so. >>>> >>>>>> 6. Enable 'tb_lock' for system mode emulation >>>>>> 7. Introduce per-CPU TCG thread function >>>> At least 2/3/7 must be done at the same time, but I agree that this >>>> patch could use some splitting. :) >> Hmm, 2/3 do also change single-threaded CPU loop. I think they should >> apply separately from 7. > Reviewed the patch now, and I'm not sure how you can do 2/3 for the > single-threaded CPU loop. They could be moved out of cpu_exec and into > cpus.c (in a separate patch), but you need exit_request and > tcg_current_cpu to properly kick the single-threaded CPU loop out of > qemu_tcg_cpu_thread_fn. Summarizing Paolo and my chat on IRC, we want run_on_cpu() to be served as soon as possible so that it would not block IO thread for too long. Removing global 'exit_request' would mean that a run_on_cpu() request from IO thread wouldn't be served until single-threaded CPU loop schedules the target CPU. This doesn't seem to be acceptable. NB: Calling run_on_cpu() for other CPU from the CPU thread would cause a deadlock in single-threaded round-robin CPU loop. Thanks, Sergey