[PATCH kernel] KVM: PPC: Avoid mapping compound pages to TCEs in real mode
David Gibson
david at gibson.dropbear.id.au
Mon Sep 3 15:17:14 AEST 2018
On Mon, Sep 03, 2018 at 03:15:29PM +1000, Paul Mackerras wrote:
> On Mon, Sep 03, 2018 at 01:28:44PM +1000, David Gibson wrote:
> > On Fri, Aug 31, 2018 at 04:08:50PM +1000, Alexey Kardashevskiy wrote:
> > > At the moment the real mode handler of H_PUT_TCE calls iommu_tce_xchg_rm()
> > > which in turn reads the old TCE and if it was a valid entry - marks
> > > the physical page dirty if it was mapped for writing. Since it is
> > > the real mode, realmode_pfn_to_page() is used instead of pfn_to_page()
> > > to get the page struct. However SetPageDirty() itself reads the compound
> > > page head and returns a virtual address for the head page struct and
> > > setting dirty bit for that kills the system.
> > >
> > > This moves dirty bit setting before updating the hardware table
> >
> > Um.. but now you're setting DIRTY based on the *new* TCE's
> > permissions, instead of the old TCE's permissions, which I don't think
> > is correct.
>
> He's setting dirty on the page which is about to be mapped if the new
> TCE allows the page to be written by the device. Given that the page
> is pinned, I don't see any reason why the dirty setting has to be done
> when the page is unmapped rather than when it is mapped. Do you see a
> reason?
Hrm. Couldn't the page get marked clean by some other path before it
is unmapped in that case?
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20180903/c37a7b39/attachment-0001.sig>
More information about the Linuxppc-dev
mailing list