From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nadav Amit Subject: Re: [patch 2/5] KVM: MMU: allow pinning spte translations (TDP-only) Date: Wed, 02 Jul 2014 03:58:58 +0300 Message-ID: <53B35952.4070408@gmail.com> References: <20140618231203.846608908@amt.cnet> <20140618231521.569025131@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: pbonzini@redhat.com, xiaoguangrong@linux.vnet.ibm.com, gleb@kernel.org, avi@cloudius-systems.com To: mtosatti@redhat.com, kvm@vger.kernel.org, ak@linux.intel.com Return-path: Received: from mail-wi0-f180.google.com ([209.85.212.180]:33635 "EHLO mail-wi0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753196AbaGBA7D (ORCPT ); Tue, 1 Jul 2014 20:59:03 -0400 Received: by mail-wi0-f180.google.com with SMTP id hi2so8642246wib.1 for ; Tue, 01 Jul 2014 17:59:01 -0700 (PDT) In-Reply-To: <20140618231521.569025131@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: I tried to use the patches (regardless of PEBS). When the host uses huge-pages, I get an a oops. I did not delve into the patch details, but I think there is some mess with the indexes - see below: On 6/19/14, 2:12 AM, mtosatti@redhat.com wrote: > + > +static bool direct_pin_sptes(struct kvm_vcpu *vcpu, gfn_t gfn) > +{ > + u64 *sptes[4]; > + int r, i, level; > + > + r = get_sptep_hierarchy(vcpu, gfn << PAGE_SHIFT, sptes); > + if (!r) > + return false; > + > + level = 5 - r; > + if (!is_last_spte(*sptes[r-1], level)) should be *sptes[level-1] > + return false; > + if (!is_shadow_present_pte(*sptes[r-1])) should be *sptes[level-1] > + return false; > + > + for (i = 0; i < r; i++) { > + u64 *sptep = sptes[i]; should be sptes[3 - i]; > + struct kvm_mmu_page *sp = page_header(__pa(sptep)); > + > + sp->pinned = true; > + set_bit(SPTE_PINNED_BIT, (unsigned long *)sptep); > + } > + > + return true; > +} > Regards, Nadav