From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50899) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bi33W-0006YH-8Q for qemu-devel@nongnu.org; Thu, 08 Sep 2016 13:24:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bi33S-0003xG-Uh for qemu-devel@nongnu.org; Thu, 08 Sep 2016 13:24:06 -0400 Received: from mail-pa0-x230.google.com ([2607:f8b0:400e:c03::230]:33803) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bi33S-0003xA-O0 for qemu-devel@nongnu.org; Thu, 08 Sep 2016 13:24:02 -0400 Received: by mail-pa0-x230.google.com with SMTP id to9so19278509pac.1 for ; Thu, 08 Sep 2016 10:24:02 -0700 (PDT) Sender: Richard Henderson References: <1470929064-4092-1-git-send-email-alex.bennee@linaro.org> <1470929064-4092-26-git-send-email-alex.bennee@linaro.org> From: Richard Henderson Message-ID: Date: Thu, 8 Sep 2016 10:23:51 -0700 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@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, pbonzini@redhat.com On 08/11/2016 08:24 AM, Alex Bennée wrote: > + * Since QEMU doesn't currently implement a global/not-global flag > + * for tlb entries, at the moment tlb_flush() will also flush all > + * tlb entries in the flush_global == false case. This is OK because > + * CPU architectures generally permit an implementation to drop > + * entries from the TLB at any time, so flushing more entries than > + * required is only an efficiency issue, not a correctness issue. > + */ > +void tlb_flush(CPUState *cpu, int flush_global) > +{ > + if (cpu->created && !qemu_cpu_is_self(cpu)) { > + if (atomic_bool_cmpxchg(&cpu->pending_tlb_flush, false, true)) { > + async_run_on_cpu(cpu, tlb_flush_global_async_work, > + GINT_TO_POINTER(flush_global)); Given that we don't actually do anything with flush_global, let's not work so hard to pass it down. Especially with something as ugly as GINT_TO_POINTER. Or indeed, as a cleanup, remove that argument from all callers. If we want to retain the documentation for the targets, we could do #define tlb_flush_local tlb_flush #define tlb_flush_global tlb_flush r~