Re: svn commit: r252646 - head/sys/amd64/amd64

2013-07-22 Thread Jean-Sébastien Pédron
On 22.07.2013 23:22, Neel Natu wrote:
 Could you revert the debug patch earlier and apply the following patch
 and give it a spin?

I can't reproduce the panic with this patch :) Thank you very much, Neel!

-- 
Jean-Sébastien Pédron



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r252646 - head/sys/amd64/amd64

2013-07-21 Thread Jean-Sébastien Pédron

Le 20/07/2013 20:26, Neel Natu a écrit :

I would start looking by looking at the value of the page table entry
in question (this would be 'tpte' in pmap_remove_pages()).

In particular, it would be useful to identify whether this is pointing
to a superpage mapping and if so what page within the superpage is
triggering the vm_page_dirty: page is invalid panic.


Here's what was logged by your patch:

va = 0x8007da000
tpte = 0x8000d2f834f7
m-phys_addr = 0xd2eaf000
m-valid = 0
m-dirty= 0
m-flags = 4, aflags = 0, oflags = 0
panic: vm_page_dirty: page is invalid!

So it corresponds to page m[175] in the superpage. I don't know if it 
helps but I checked the remaining pages: they all have '-valid = 0', 
except a few ones (265 to 267, 345, 361 to 363, 379 to 387 and 425 to 
431 have '-valid = VM_PAGE_BITS_ALL').


--
Jean-Sébastien Pédron
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r252646 - head/sys/amd64/amd64

2013-07-20 Thread Jean-Sébastien Pédron
Hello Neel!

With commit r252646, I have a vm_page_dirty: page is invalid! panic
almost each time an X11 application or the X.Org server itself exit.
Everything runs fine if I revert this commit.

FreeBSD is built with the experimental radeonkms driver. As I haven't
seen any other report of this problem, I suppose I do something wrong in
TTM or the driver itself.

Here's the core.txt:
http://people.freebsd.org/~dumbbell/radeonkms/r252646-panic-vm_page_dirty-page-is-invalid.core.txt

Do you have any suggestion about what I should look for?

-- 
Jean-Sébastien Pédron



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r252646 - head/sys/amd64/amd64

2013-07-20 Thread Neel Natu
Hi Jean-Sebastien,

On Sat, Jul 20, 2013 at 9:28 AM, Jean-Sébastien Pédron
dumbb...@freebsd.org wrote:
 Hello Neel!

 With commit r252646, I have a vm_page_dirty: page is invalid! panic
 almost each time an X11 application or the X.Org server itself exit.
 Everything runs fine if I revert this commit.

 FreeBSD is built with the experimental radeonkms driver. As I haven't
 seen any other report of this problem, I suppose I do something wrong in
 TTM or the driver itself.

 Here's the core.txt:
 http://people.freebsd.org/~dumbbell/radeonkms/r252646-panic-vm_page_dirty-page-is-invalid.core.txt

 Do you have any suggestion about what I should look for?


I would start looking by looking at the value of the page table entry
in question (this would be 'tpte' in pmap_remove_pages()).

In particular, it would be useful to identify whether this is pointing
to a superpage mapping and if so what page within the superpage is
triggering the vm_page_dirty: page is invalid panic.

The following patch may help to do that (but I haven't actually tested it):

Index: pmap.c
===
--- pmap.c  (revision 253505)
+++ pmap.c  (working copy)
@@ -4379,6 +4379,20 @@
return (rv);
 }

+static void
+pmap_check_valid(vm_page_t m, vm_offset_t va, pt_entry_t tpte)
+{
+   if (m-valid != VM_PAGE_BITS_ALL) {
+   printf(va = %#lx\n, va);
+   printf(tpte = %#lx\n, tpte);
+   printf(m-phys_addr = %#lx\n, m-phys_addr);
+   printf(m-valid = %#x\n, m-valid);
+   printf(m-dirty= %#x\n, m-dirty);
+   printf(m-flags = %x, aflags = %x, oflags = %x\n,
+   m-flags, m-aflags, m-oflags);
+   }
+}
+
 /*
  * Remove all pages from specified address space
  * this aids process exit speeds.  Also, this code
@@ -4469,10 +4483,14 @@
 */
if ((tpte  (PG_M | PG_RW)) == (PG_M | PG_RW)) {
if ((tpte  PG_PS) != 0) {
-   for (mt = m; mt  m[NBPDR / 
PAGE_SIZE]; mt++)
+   for (mt = m; mt  m[NBPDR / 
PAGE_SIZE]; mt++) {
+   pmap_check_valid(mt, 
pv-pv_va, tpte);
vm_page_dirty(mt);
-   } else
+   }
+   } else {
+   pmap_check_valid(m, pv-pv_va, 
tpte);
vm_page_dirty(m);
+   }
}

CHANGE_PV_LIST_LOCK_TO_VM_PAGE(lock, m);

best
Neel

 --
 Jean-Sébastien Pédron

___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r252646 - head/sys/amd64/amd64

2013-07-03 Thread Neel Natu
Author: neel
Date: Wed Jul  3 23:21:25 2013
New Revision: 252646
URL: http://svnweb.freebsd.org/changeset/base/252646

Log:
  If a superpage mapping is being removed then we need to ignore the PG_PDE_PAT
  bit when looking up the vm_page associated with the superpage's physical
  address.
  
  If the caching attribute for the mapping is write combining or write protected
  then the PG_PDE_PAT bit will be set and thus cause an 'off-by-one' error
  when looking up the vm_page.
  
  Fix this by using the PG_PS_FRAME mask to compute the physical address for
  a superpage mapping instead of PG_FRAME.
  
  This is a theoretical issue at this point since non-writeback attributes are
  currently used only for fictitious mappings and fictitious mappings are not
  subject to promotion.
  
  Discussed with:   alc, kib
  MFC after:2 weeks

Modified:
  head/sys/amd64/amd64/pmap.c

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Wed Jul  3 23:19:57 2013(r252645)
+++ head/sys/amd64/amd64/pmap.c Wed Jul  3 23:21:25 2013(r252646)
@@ -4400,6 +4400,7 @@ pmap_remove_pages(pmap_t pmap)
int64_t bit;
uint64_t inuse, bitmask;
int allfree, field, freed, idx;
+   vm_paddr_t pa;
 
if (pmap != PCPU_GET(curpmap)) {
printf(warning: pmap_remove_pages called with non-current 
pmap\n);
@@ -4429,7 +4430,7 @@ pmap_remove_pages(pmap_t pmap)
pte = (pt_entry_t *)PHYS_TO_DMAP(tpte 
PG_FRAME);
pte = pte[pmap_pte_index(pv-pv_va)];
-   tpte = *pte  ~PG_PTE_PAT;
+   tpte = *pte;
}
if ((tpte  PG_V) == 0) {
panic(bad pte va %lx pte %lx,
@@ -,8 +4445,13 @@ pmap_remove_pages(pmap_t pmap)
continue;
}
 
-   m = PHYS_TO_VM_PAGE(tpte  PG_FRAME);
-   KASSERT(m-phys_addr == (tpte  PG_FRAME),
+   if (tpte  PG_PS)
+   pa = tpte  PG_PS_FRAME;
+   else
+   pa = tpte  PG_FRAME;
+
+   m = PHYS_TO_VM_PAGE(pa);
+   KASSERT(m-phys_addr == pa,
(vm_page_t %p phys_addr mismatch %016jx 
%016jx,
m, (uintmax_t)m-phys_addr,
(uintmax_t)tpte));
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org