[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PULL 125/130] target-ppc: Fix page table lookup with k
From: |
Aneesh Kumar K.V |
Subject: |
Re: [Qemu-devel] [PULL 125/130] target-ppc: Fix page table lookup with kvm enabled |
Date: |
Fri, 14 Mar 2014 18:43:11 +0530 |
User-agent: |
Notmuch/0.17+7~gc734dd75344e (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu) |
Paolo Bonzini <address@hidden> writes:
> 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?
good find. how about
diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
index e999bbaea062..e079be050fc7 100644
--- a/hw/ppc/spapr_hcall.c
+++ b/hw/ppc/spapr_hcall.c
@@ -118,7 +118,8 @@ static target_ulong h_enter(PowerPCCPU *cpu,
sPAPREnvironment *spapr,
if ((ppc_hash64_load_hpte0(env, token, index) & HPTE64_V_VALID) ==
0) {
break;
}
- } while (index++);
+ index++;
+ } while (1);
ppc_hash64_stop_access(token);
} else {
token = ppc_hash64_start_access(cpu, pte_index);
-aneesh
- [Qemu-devel] [PULL 089/130] target-ppc: Add Load Quadword and Reserve, (continued)
- [Qemu-devel] [PULL 089/130] target-ppc: Add Load Quadword and Reserve, Alexander Graf, 2014/03/06
- [Qemu-devel] [PULL 121/130] PPC: sPAPR: Only use getpagesize() when we run with kvm, Alexander Graf, 2014/03/06
- [Qemu-devel] [PULL 124/130] target-ppc: Fix htab_mask calculation, Alexander Graf, 2014/03/06
- [Qemu-devel] [PULL 123/130] target-ppc: Use Additional Temporary in stqcx Case, Alexander Graf, 2014/03/06
- [Qemu-devel] [PULL 130/130] target-ppc: spapr: e500: fix to use cpu_dt_id, Alexander Graf, 2014/03/06
- [Qemu-devel] [PULL 128/130] target-ppc: Introduce hypervisor call H_GET_TCE, Alexander Graf, 2014/03/06
- [Qemu-devel] [PULL 122/130] target-ppc: Fix Compiler Warnings Due to 64-Bit Constants Declared as UL, Alexander Graf, 2014/03/06
- [Qemu-devel] [PULL 129/130] target-ppc: add PowerPCCPU::cpu_dt_id, Alexander Graf, 2014/03/06
- [Qemu-devel] [PULL 125/130] target-ppc: Fix page table lookup with kvm enabled, Alexander Graf, 2014/03/06
- [Qemu-devel] [PULL 127/130] target-ppc: Update ppc_hash64_store_hpte to support updating in-kernel htab, Alexander Graf, 2014/03/06
- [Qemu-devel] [PULL 126/130] target-ppc: Change the hpte store API, Alexander Graf, 2014/03/06
- Re: [Qemu-devel] [PULL 00/130] ppc patch queue 2014-03-05, Peter Maydell, 2014/03/07