From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40425) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WOQGf-0005cC-DV for qemu-devel@nongnu.org; Fri, 14 Mar 2014 07:27:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WOQGW-0004d3-W9 for qemu-devel@nongnu.org; Fri, 14 Mar 2014 07:27:13 -0400 Sender: Paolo Bonzini Message-ID: <5322E783.5030604@redhat.com> Date: Fri, 14 Mar 2014 12:26:59 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1394148857-19607-1-git-send-email-agraf@suse.de> <1394148857-19607-126-git-send-email-agraf@suse.de> In-Reply-To: <1394148857-19607-126-git-send-email-agraf@suse.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PULL 125/130] target-ppc: Fix page table lookup with kvm enabled List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf , qemu-devel@nongnu.org, "Aneesh Kumar K.V" Cc: Alexey Kardashevskiy , Peter Maydell , qemu-ppc@nongnu.org, Greg Kurz Il 07/03/2014 00:34, Alexander Graf ha scritto: > @@ -105,30 +106,37 @@ static target_ulong h_enter(PowerPCCPU *cpu, sPAPREnvironment *spapr, > if (!valid_pte_index(env, pte_index)) { > return H_PARAMETER; > } > + > + index = 0; > + hpte = pte_index * HASH_PTE_SIZE_64; > if (likely((flags & H_EXACT) == 0)) { > pte_index &= ~7ULL; > - hpte = pte_index * HASH_PTE_SIZE_64; > - for (i = 0; ; ++i) { > - if (i == 8) { > + token = ppc_hash64_start_access(cpu, pte_index); > + do { > + if (index == 8) { > + ppc_hash64_stop_access(token); > return H_PTEG_FULL; > } > - if ((ppc_hash64_load_hpte0(env, hpte) & HPTE64_V_VALID) == 0) { > + if ((ppc_hash64_load_hpte0(env, token, index) & HPTE64_V_VALID) == 0) { > break; > } > - hpte += HASH_PTE_SIZE_64; > - } > + } while (index++); > + ppc_hash64_stop_access(token); I'm afraid you have a bug here, as spotted by Coverity. The do...while loop only loops once. I'm not sure what you meant, could you rewrite it with a "for (index = 0; index < 8; i++)" instead? Paolo