qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC/PATCH] i386: Atomically update PTEs with mttcg


From: Benjamin Herrenschmidt
Subject: Re: [Qemu-devel] [RFC/PATCH] i386: Atomically update PTEs with mttcg
Date: Fri, 30 Nov 2018 13:18:51 +1100
User-agent: Evolution 3.30.2 (3.30.2-2.fc29)

On Thu, 2018-11-29 at 16:12 -0800, Richard Henderson wrote:
> On 11/29/18 2:54 PM, Benjamin Herrenschmidt wrote:
> > >      pdpe_addr = (pml4e & PG_ADDRESS_MASK) +
> > >                  (((gphys >> 30) & 0x1ff) << 3);
> > >      pdpe = x86_ldq_phys(cs, pdpe_addr);
> > >      do {
> > >          if (!(pdpe & PG_PRESENT_MASK)) {
> > >              goto do_fault;
> > >          }
> > >          if (pdpe & rsvd_mask) {
> > >              goto do_fault_rsvd;
> > >          }
> > >          if (pdpe & PG_ACCESSED_MASK) {
> > >              break;
> > >          }
> > >      } while (!update_entry(cs, pdpe_addr, &pdpe, PG_ACCESSED_MASK));
> > >      ptep &= pdpe ^ PG_NX_MASK;
> > > 
> > > ....
> > 
> > Hrm.. I see. So not re-do the full walk. Not sure it's really worth it
> > though, how often do we expect to hit the failing case ?
> 
> It is probably rare-ish, I admit.
> 
> I suppose we could also signal "success" from update_entry if the cmpxchg
> fails, but the value that was reloaded only differs in setting 
> PG_ACCESSED_MASK

The latter optimization is trivial. As for the former, replacing my
"goto restart" with those loops, it will make the patch significantly
bigger, though not adding another goto has its perks and the end result
might be slightly nicer ...

What way do you prefer ?

Cheers,
Ben.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]