From: Paul Mackerras <paulus@samba.org>
To: Bharat Bhushan <r65777@freescale.com>
Cc: agraf@suse.de, scottwood@freescale.com,
stuart.yoder@freescale.com, kvm@vger.kernel.org,
kvm-ppc@vger.kernel.org,
Bharat Bhushan <Bharat.Bhushan@freescale.com>
Subject: Re: [PATCH 3/4] kvm: powerpc: define a linux pte lookup function
Date: Thu, 10 Oct 2013 10:33:02 +0000 [thread overview]
Message-ID: <20131010103302.GC9906@iris.ozlabs.ibm.com> (raw)
In-Reply-To: <1381212212-29641-4-git-send-email-Bharat.Bhushan@freescale.com>
On Tue, Oct 08, 2013 at 11:33:31AM +0530, Bharat Bhushan wrote:
> We need to search linux "pte" to get "pte" attributes for
> setting TLB in KVM.
> This patch defines a linux_pte_lookup() function for same.
>
[snip]
> + /* wait until _PAGE_BUSY is clear */
> + while (1) {
> + pte = pte_val(*ptep);
> + if (unlikely(pte & _PAGE_BUSY)) {
> + cpu_relax();
> + continue;
> + }
> + }
> +
> + /* If pte is not present return None */
> + if (unlikely(!(pte & _PAGE_PRESENT)))
> + return __pte(0);
First, this looks racy to me, since nothing stops the compiler
refetching pte from memory, and it might have become busy again in the
meantime.
However, I don't think you need to do any of this, since the caller in
your next patch checks for pte_present(pte) anyway. On book E systems
we don't use _PAGE_BUSY, so you don't need the loop for your intended
application. I suggest you remove the entire section quoted above.
Paul.
next prev parent reply other threads:[~2013-10-10 10:33 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-08 6:15 [PATCH 0/4] kvm: powerpc: use cache attributes from linux pte Bharat Bhushan
2013-10-08 6:15 ` [PATCH 1/4] kvm: booke: clear host tlb reference flag on guest tlb invalidation Bharat Bhushan
2013-10-08 6:15 ` [PATCH 2/4] kvm: book3s: rename lookup_linux_pte() to lookup_linux_pte_and_update() Bharat Bhushan
2013-10-08 6:15 ` [PATCH 3/4] kvm: powerpc: define a linux pte lookup function Bharat Bhushan
2013-10-08 21:36 ` Scott Wood
2013-10-09 8:48 ` Bhushan Bharat-R65777
2013-10-09 17:47 ` Scott Wood
2013-10-10 10:35 ` Paul Mackerras
2013-10-10 10:44 ` Bhushan Bharat-R65777
2013-10-10 10:52 ` Paul Mackerras
2013-10-15 5:19 ` Aneesh Kumar K.V
2013-10-10 10:33 ` Paul Mackerras [this message]
2013-10-15 5:17 ` Aneesh Kumar K.V
2013-10-08 6:15 ` [PATCH 4/4] kvm: powerpc: use caching attributes as per linux pte Bharat Bhushan
2013-10-28 10:36 ` [PATCH 0/4] kvm: powerpc: use cache attributes from " Bharat Bhushan
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=20131010103302.GC9906@iris.ozlabs.ibm.com \
--to=paulus@samba.org \
--cc=Bharat.Bhushan@freescale.com \
--cc=agraf@suse.de \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=r65777@freescale.com \
--cc=scottwood@freescale.com \
--cc=stuart.yoder@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