Received: from eggs.gnu.org ([2001:4830:134:3::10]:59664) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bi3XL-0003uR-LI for qemu-devel@nongnu.org; Thu, 08 Sep 2016 13:54:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bi3XG-0002jH-Gh for qemu-devel@nongnu.org; Thu, 08 Sep 2016 13:54:54 -0400 Received: from mail-yw0-x231.google.com ([2607:f8b0:4002:c05::231]:34373) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bi3XG-0002jC-Ca for qemu-devel@nongnu.org; Thu, 08 Sep 2016 13:54:50 -0400 Received: by mail-yw0-x231.google.com with SMTP id g192so33455387ywh.1 for ; Thu, 08 Sep 2016 10:54:50 -0700 (PDT) Sender: Richard Henderson References: <1470929064-4092-1-git-send-email-alex.bennee@linaro.org> <1470929064-4092-29-git-send-email-alex.bennee@linaro.org> From: Richard Henderson Message-ID: Date: Thu, 8 Sep 2016 10:54:44 -0700 MIME-Version: 1.0 In-Reply-To: <1470929064-4092-29-git-send-email-alex.bennee@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [RFC v4 28/28] cputlb: make tlb_flush_by_mmuidx safe for MTTCG 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: > + for (mmu_idx = 0; mmu_idx < NB_MMU_MODES; mmu_idx++) { > > - tlb_debug("%d\n", mmu_idx); > + if (test_bit(mmu_idx, &mmu_idx_bitmask)) { > + tlb_debug("%d\n", mmu_idx); > > - memset(env->tlb_table[mmu_idx], -1, sizeof(env->tlb_table[0])); > - memset(env->tlb_v_table[mmu_idx], -1, sizeof(env->tlb_v_table[0])); > + memset(env->tlb_table[mmu_idx], -1, sizeof(env->tlb_table[0])); > + memset(env->tlb_v_table[mmu_idx], -1, sizeof(env->tlb_v_table[0])); > + } Maybe better with a for (; bitmask; bitmask &= bitmask - 1) { int mmu_idx = ctz32(bitmask); sort of loop? That would certainly help if bitmasks of less than all-modes is at all common. If an all-modes bitmask is common, perhaps we should special case that with a single much larger memset. r~