Received: from eggs.gnu.org ([2001:4830:134:3::10]:56558) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhZmY-0001LD-FV for qemu-devel@nongnu.org; Wed, 07 Sep 2016 06:08:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bhZmU-0000a7-7t for qemu-devel@nongnu.org; Wed, 07 Sep 2016 06:08:37 -0400 Received: from mail-wm0-x22a.google.com ([2a00:1450:400c:c09::22a]:38473) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhZmU-0000Zp-19 for qemu-devel@nongnu.org; Wed, 07 Sep 2016 06:08:34 -0400 Received: by mail-wm0-x22a.google.com with SMTP id 1so22756004wmz.1 for ; Wed, 07 Sep 2016 03:08:34 -0700 (PDT) Sender: Paolo Bonzini References: <1470929064-4092-1-git-send-email-alex.bennee@linaro.org> <1470929064-4092-26-git-send-email-alex.bennee@linaro.org> From: Paolo Bonzini Message-ID: <3260fe48-0af9-0dc6-57b9-4c579d3ab349@redhat.com> Date: Wed, 7 Sep 2016 12:08:31 +0200 MIME-Version: 1.0 In-Reply-To: <1470929064-4092-26-git-send-email-alex.bennee@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [RFC v4 25/28] cputlb: introduce tlb_flush_* async work. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Alex_Benn=c3=a9e?= , mttcg@listserver.greensocs.com, qemu-devel@nongnu.org, fred.konrad@greensocs.com, a.rigo@virtualopensystems.com, cota@braap.org, bobby.prani@gmail.com, nikunj@linux.vnet.ibm.com Cc: peter.maydell@linaro.org, claudio.fontana@huawei.com, Peter Crosthwaite , jan.kiszka@siemens.com, mark.burton@greensocs.com, serge.fdrv@gmail.com, rth@twiddle.net On 11/08/2016 17:24, Alex Bennée wrote: > + if (cpu->created && !qemu_cpu_is_self(cpu)) { Is the cpu->created necessary? It may introduce some potential races and doesn't really add much. > + if (atomic_bool_cmpxchg(&cpu->pending_tlb_flush, false, true)) { This is slightly cheaper: if (!atomic_xchg(&cpu->pending_tlb_flush, true)) { Paolo > + async_run_on_cpu(cpu, tlb_flush_global_async_work, > + GINT_TO_POINTER(flush_global)); > + } > + } else { > + tlb_flush_nocheck(cpu, flush_global); > + }