From: Pasi =?iso-8859-1?Q?K=E4rkk=E4inen?= Subject: Re: xen.git branch reorg / success with 2.6.30-rc3 pv_ops dom0 Date: Fri, 5 Jun 2009 14:23:47 +0300 Message-ID: <20090605112347.GY24960@edu.joroinen.fi> References: <20090507172426.GF24960@edu.joroinen.fi> <1242658627.22654.20.camel@zakaz.uk.xensource.com> <20090518170626.GS24960@edu.joroinen.fi> <20090518171711.GT24960@edu.joroinen.fi> <4A119D4B.8030209@goop.org> <20090518175033.GU24960@edu.joroinen.fi> <1242896915.22654.99.camel@zakaz.uk.xensource.com> <20090522080655.GA24960@edu.joroinen.fi> <20090604202656.GR24960@edu.joroinen.fi> <1244197217.27370.146.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline In-Reply-To: <1244197217.27370.146.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Campbell Cc: Jeremy Fitzhardinge , Xen-devel List-Id: xen-devel@lists.xenproject.org On Fri, Jun 05, 2009 at 11:20:17AM +0100, Ian Campbell wrote: > On Thu, 2009-06-04 at 16:26 -0400, Pasi K=E4rkk=E4inen wrote: > > What do you suggest me to try next?=20 >=20 > I'm at a bit of a loss to be honest... >=20 > It's interesting that it's always kswapd0 even in the case with no swap > configured. Were you running with CONFIG_SWAP=3Dn or just with the swap > device turned off? >=20 I just ran "swapoff -a" before testing.. > Judging from the backtrace the sequence of events seems to be roughly: > kswapd<0> runs and calls balance_pgdat which calls shrink_zone who in > turn calls shrink_active_list if inactive_anon_is_low() (so I think we > are dealing with anon pages). shrink_active_list() then iterates over a > list of pages calling page_referenced() on each one. page_referenced() > eventually calls down to page_referenced_one() (presumably via > page_referenced_anon()) and eventually to page_check_address() which > walks the page table and attempts to map the PTE page. This goes via > pte_offset_map() to kmap_atomic_pte() then xen_kmap_atomic_pte(). Here > we check if the page is pinned and then attempt to map it, since we > _think_ the page is not pinned the mapping is writable. However at this > point Xen reports that the page really is pinned (28000001 =3D> Page Ty= pe > 1 =3D=3D L1 PT) and we are trying to make a writable mapping (e0000000 = =3D> > Page Type 7 =3D=3D Writable) which is disallowed. >=20 > Do you know which line of xen_set_pte() the fault is occurring at? I > assume either "ptep->pte_high =3D" or "ptep->pte_low =3D". >=20 I haven't looked for that.. I guess I should compile debug=3Dy Xen build again. > So the question is -- how come we have a page which is pinned but this > fact is not recorded in the struct page information? It might be > interesting to know if the corresponding L3 PT is pinned. If the mm is > active then this should always be the case and I _think_ it would be a > bug for the L3 to be pinned but not all the which L1s which it contains= . > Can you try this patch which tries to notice this situation and prints > some potentially interesting information, similarly on the fault it > dumps a little more info. Since I can't repro I've only tested that it > doesn't break normal use, I've not actually seen the debug trigger... >=20 OK. I'll try later today..=20 >=20 >=20 > I'd guess that this would at least work around the issue, I doubt it's = a > proper fix and it's going to shaft perf I suspect (not that highpte > won't be doing a pretty good job of that ;-)). >=20 > diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c > index fefdeee..4c694e4 100644 > --- a/arch/x86/xen/mmu.c > +++ b/arch/x86/xen/mmu.c > @@ -1521,7 +1521,7 @@ static void *xen_kmap_atomic_pte(struct page *pag= e, enum km_type type) > { > pgprot_t prot =3D PAGE_KERNEL; > =20 > - if (PagePinned(page)) > + if (1 || PagePinned(page)) > prot =3D PAGE_KERNEL_RO; > =20 > if (0 && PageHighMem(page)) >=20 I'll try just the first debug-patch first.. so I won't apply this one yet= . -- Pasi