LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: Bharat Bhushan <r65777@freescale.com>
Cc: kvm@vger.kernel.org, agraf@suse.de, kvm-ppc@vger.kernel.org,
	Bharat Bhushan <Bharat.Bhushan@freescale.com>,
	paulus@samba.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 6/6 v3] kvm: powerpc: use caching attributes as per linux pte
Date: Fri, 9 Aug 2013 20:04:45 -0500	[thread overview]
Message-ID: <1376096685.15633.109.camel@snotra.buserror.net> (raw)
In-Reply-To: <1375788674-13140-7-git-send-email-Bharat.Bhushan@freescale.com>

On Tue, 2013-08-06 at 17:01 +0530, Bharat Bhushan wrote:
> @@ -449,7 +446,16 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500,
>  		gvaddr &= ~((tsize_pages << PAGE_SHIFT) - 1);
>  	}
>  
> -	kvmppc_e500_ref_setup(ref, gtlbe, pfn);
> +	pgdir = vcpu_e500->vcpu.arch.pgdir;
> +	ptep = lookup_linux_pte(pgdir, hva, &tsize_pages);
> +	if (pte_present(*ptep)) {
> +		wimg = (pte_val(*ptep) >> PTE_WIMGE_SHIFT) & MAS2_WIMGE_MASK;
> +	} else {
> +		printk(KERN_ERR "pte not present: gfn %lx, pfn %lx\n",
> +				(long)gfn, pfn);
> +		return -EINVAL;

Don't let the guest spam the host kernel console by repeatedly accessing
bad mappings (even if it requires host userspace to assist by pointing a
memslot at a bad hva).  This should at most be printk_ratelimited(), and
probably just pr_debug().  It should also have __func__ context.

Also, I don't see the return value getting checked (the immediate
callers check it and propogate the error, but kvmppc_mmu_map() doesn't).
We want to send a machine check to the guest if this happens (or
possibly exit to userspace since it indicates a bad memslot, not just a
guest bug).  We don't want to just silently retry over and over.

Otherwise, this series looks good to me.

-Scott

  reply	other threads:[~2013-08-10  1:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-06 11:31 [PATCH 0/6 v3] kvm: powerpc: use cache attributes from linux pte Bharat Bhushan
2013-08-06 11:31 ` [PATCH 1/6 v3] powerpc: book3e: _PAGE_LENDIAN must be _PAGE_ENDIAN Bharat Bhushan
2013-08-06 11:31 ` [PATCH 2/6 v3] kvm: powerpc: allow guest control "E" attribute in mas2 Bharat Bhushan
2013-08-06 11:31 ` [PATCH 3/6 v3] kvm: powerpc: allow guest control "G" " Bharat Bhushan
2013-08-06 11:31 ` [PATCH 4/6 v3] powerpc: move linux pte/hugepte search to more generic file Bharat Bhushan
2013-08-06 11:31 ` [PATCH 5/6 v3] kvm: powerpc: keep only pte search logic in lookup_linux_pte Bharat Bhushan
2013-08-06 11:31 ` [PATCH 6/6 v3] kvm: powerpc: use caching attributes as per linux pte Bharat Bhushan
2013-08-10  1:04   ` Scott Wood [this message]
2013-08-12 17:14     ` Bhushan Bharat-R65777

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1376096685.15633.109.camel@snotra.buserror.net \
    --to=scottwood@freescale.com \
    --cc=Bharat.Bhushan@freescale.com \
    --cc=agraf@suse.de \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=paulus@samba.org \
    --cc=r65777@freescale.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox