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. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html