xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Michael D Labriola <mlabriol@gdeb.com>
Cc: Arvind R <arvino55@gmail.com>,
	Jeremy Fitzhardinge <jeremy@goop.org>,
	xen-devel@lists.xensource.com,
	Joanna Rutkowska <joanna@invisiblethingslab.com>,
	xen-devel-bounces@lists.xensource.com
Subject: Re: Re: [Patch RFC] ttm: nouveau accelerated on Xen pv-ops kernel
Date: Tue, 16 Mar 2010 21:01:31 -0400	[thread overview]
Message-ID: <20100317010131.GA1244@phenom.dumpdata.com> (raw)
In-Reply-To: <20100316194114.GA18832@phenom.dumpdata.com>

[-- Attachment #1: Type: text/plain, Size: 306 bytes --]

> > > Also I would suggest you load drm with the debug variable set to the 255
> > > to get most of what his happening. 
> > 
> > I'll try that.
> > 

You can also use the attached debug patch and re-jigger it to be in the
nouveau functions that cause this failure. It isn't compile tested so
be careful.


[-- Attachment #2: debug-print-pte-ttm-2.patch --]
[-- Type: text/plain, Size: 4393 bytes --]

diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c
index 668dbe8..d62b72e 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_vm.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c
@@ -35,6 +35,10 @@
 #include <linux/rbtree.h>
 #include <linux/module.h>
 #include <linux/uaccess.h>
+#include <asm/page.h>
+#include <asm/pgtable_types.h>
+#include <asm/xen/page.h>
+
 
 #define TTM_BO_VM_NUM_PREFAULT 16
 
@@ -69,6 +73,142 @@ static struct ttm_buffer_object *ttm_bo_vm_lookup_rb(struct ttm_bo_device *bdev,
 	return best_bo;
 }
 
+void print_pte(struct vm_area_struct *vma, char *what, struct page *page, unsigned int pfn, unsigned long address)
+{
+	static const char * const level_name[] =
+	  { "NONE", "4K", "2M", "1G", "NUM" };
+	unsigned long addr = 0;
+	pte_t *pte = NULL;
+	pteval_t val = (pteval_t)0;
+	unsigned int level = 0;
+	unsigned offset;
+	unsigned long phys;
+	pgprotval_t prot;
+	char buf[90];
+	char *str;
+
+	str = buf;
+	// Figure out if the address is pagetable.
+	if (address == 0 && !page && pfn>0) {
+		page = pfn_to_page(pfn);
+	}
+	if (address == 0 && page)
+		addr = (u64)page_address(page);
+
+	if (address && !page)
+		addr = address;
+
+	if (address && page) {
+		addr = (u64)page_address(page);
+		if (address != addr) {
+			if (addr == 0) {
+				str += sprintf(str, "addr(page)==0");
+				addr = address;
+			}
+		}
+	}
+
+	if (pfn != 0 && page) {
+		if (pfn != page_to_pfn(page)) // Gosh!?
+			str += sprintf(str, "pfn!=pfn(page)");
+	}
+	if (pfn != 0 && addr != 0) {
+		if (pfn != virt_to_pfn(addr))
+			str += sprintf(str,"pfn(addr)!=pfn");
+	}
+	pte = lookup_address(addr, &level);
+	if (!pte) {
+		str += sprintf(str,"!pte(addr)");
+		goto print;
+	}
+	offset = addr & ~PAGE_MASK;
+
+	if (xen_domain()) {
+		phys = (pte_mfn(*pte) << PAGE_SHIFT) + offset;		
+		val = pte_val_ma(*pte);
+
+		if (pfn > 0) {
+			if (pte_mfn(*pte) == pfn) {
+				if  (vma->vm_flags && VM_IO)
+					str += sprintf(str,"PHYS");
+				else
+					str += sprintf(str,"BUG: VM_IO not set!");
+			}
+			/* It is a pseudo page ... and the VM_IO flag is set */
+			if (pte_mfn(*pte) != pfn) {
+				if (vma->vm_flags && VM_IO)
+					str += sprintf(str,"BUG: VM_IO flag set!");
+				else
+					str += sprintf(str, "PSEUDO");
+			}
+		} else {
+			str += sprintf(str,"pfn==0");
+		}
+
+	} else {
+		phys = (pte_pfn(*pte) << PAGE_SHIFT) + offset;
+		val = pte_val(*pte);
+	}	
+	prot = pgprot_val(pte_pgprot(*pte));
+
+	if (!prot)
+		str += sprintf(str, "Not present.");
+	else  {
+		if (prot & _PAGE_USER)
+			str += sprintf(str, "USR ");
+		else
+			str += sprintf(str, "    ");
+		if (prot & _PAGE_RW)
+			str += sprintf(str, "RW ");
+		else
+			str += sprintf(str, "ro ");
+		if (prot & _PAGE_PWT)
+			str += sprintf(str, "PWT ");
+		else
+			str += sprintf(str, "    ");
+		if (prot & _PAGE_PCD)
+			str += sprintf(str, "PCD ");
+		else
+			str += sprintf(str, "    ");
+
+		/* Bit 9 has a different meaning on level 3 vs 4 */
+		if (level <= 3) {
+			if (prot & _PAGE_PSE)
+				str += sprintf(str, "PSE ");
+			else
+				str += sprintf(str, "    ");
+		} else {
+			if (prot & _PAGE_PAT)
+				str += sprintf(str, "pat ");
+			else
+				str += sprintf(str, "    ");
+		}
+		if (prot & _PAGE_GLOBAL)
+			str += sprintf(str, "GLB ");
+		else
+			str += sprintf(str, "    ");
+		if (prot & _PAGE_NX)
+			str += sprintf(str, "NX ");
+		else
+			str += sprintf(str, "x  ");
+#ifdef _PAGE_IOMEM
+		if (prot & _PAGE_IOMEM)
+			str += sprintf(str, "IO ");
+		else
+			str += sprintf(str, "   ");
+#endif
+		
+	}
+
+print:
+	printk(KERN_INFO "[%16s]PFN: 0x%lx PTE: 0x%lx (val:%lx): [%s] [%s]\n",
+			what,
+			(unsigned long)pfn,
+			(pte) ? (unsigned long)(pte->pte) : 0,
+			(unsigned long)val,
+			buf,
+			level_name[level]);
+}
 static int ttm_bo_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
 	struct ttm_buffer_object *bo = (struct ttm_buffer_object *)
@@ -183,10 +323,12 @@ static int ttm_bo_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 			} else if (unlikely(!page)) {
 				break;
 			}
-			pfn = page_to_pfn(page);
+			pfn = page_to_pfn(page, pfn, 0);
 		}
-
+		printk(KERN_INFO "iomem?:%d\n", iomem);
+		print_pte(vma, "before", page, pfn, 0);
 		ret = vm_insert_mixed(vma, address, pfn);
+		print_pte(vma, "after", page, pfn, address);
 		/*
 		 * Somebody beat us to this PTE or prefaulting to
 		 * an already populated PTE, or prefaulting error.

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

  reply	other threads:[~2010-03-17  1:01 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-10 13:21 [Patch RFC] nouveau accelerated on Xen pv-ops kernel Arvind R
     [not found] ` <d799c4761003100521h663c82eepda85f3f0309828c2-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-03-11 11:02   ` [Patch RFC] ttm: " Pekka Paalanen
2010-03-12  5:27     ` Arvind R
2010-03-28 10:20       ` Joanna Rutkowska
2010-03-30  5:50         ` Arvind R
2010-03-12 12:45     ` Arvind R
2010-03-12 13:20       ` Michael D Labriola
2010-03-13 22:03       ` Joanna Rutkowska
2010-03-15 14:44         ` Michael D Labriola
2010-03-15 23:13           ` Jeremy Fitzhardinge
2010-03-16  7:18             ` Arvind R
2010-03-16 16:48               ` Michael D Labriola
2010-03-16 16:40             ` Michael D Labriola
2010-03-16 17:21               ` Konrad Rzeszutek Wilk
2010-03-16 19:39                 ` Michael D Labriola
2010-03-16 19:41                   ` Konrad Rzeszutek Wilk
2010-03-17  1:01                     ` Konrad Rzeszutek Wilk [this message]
2010-03-18  6:09                   ` Arvind R
2010-03-19 15:29                     ` Michael D Labriola
2010-03-20  6:01                       ` Arvind R
2010-03-22 21:14                         ` Michael D Labriola
2010-03-23  6:21                           ` Arvind R
2010-03-23 12:45                             ` Michael D Labriola
2010-03-23 13:27                             ` Michael D Labriola
2010-03-25  7:05                               ` Arvind R
2010-03-25  7:18           ` Jeremy Fitzhardinge
2010-03-29 14:42             ` Michael D Labriola
2010-06-09 17:43           ` Konrad Rzeszutek Wilk
2010-06-09 18:39             ` Pasi Kärkkäinen
2010-06-09 19:31               ` Konrad Rzeszutek Wilk
2010-06-17 17:51             ` Konrad Rzeszutek Wilk
2010-06-22 22:32               ` Joanna Rutkowska
2010-06-23 12:54                 ` Konrad Rzeszutek Wilk
2010-06-23 13:21                   ` Joanna Rutkowska
2010-06-23 14:38                     ` Konrad Rzeszutek Wilk
2010-06-23 15:08                       ` Konrad Rzeszutek Wilk
2010-06-24 19:55                   ` Pasi Kärkkäinen
2010-06-24 21:00                     ` Konrad Rzeszutek Wilk
     [not found]       ` <d799c4761003120445h57ab1373m31eb0add242ef74c-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-03-16 13:25         ` Thomas Hellstrom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100317010131.GA1244@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=arvino55@gmail.com \
    --cc=jeremy@goop.org \
    --cc=joanna@invisiblethingslab.com \
    --cc=mlabriol@gdeb.com \
    --cc=xen-devel-bounces@lists.xensource.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).