All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Eamon Walsh <ewalsh@tycho.nsa.gov>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>,
	Xen-devel <xen-devel@lists.xensource.com>,
	George Coker <gscoker@tycho.nsa.gov>
Subject: Re: Fbdev graphics broken in xen/next dom0
Date: Tue, 16 Mar 2010 18:19:52 -0400	[thread overview]
Message-ID: <20100316221952.GA10912@phenom.dumpdata.com> (raw)
In-Reply-To: <4B9FFD87.6010908@tycho.nsa.gov>

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

> 
> The serial output is attached.
> 
> The patch I used to instrument the fb_mmap function and the output it
> produced for a couple of runs are also attached.
> 
> And I tossed in my kernel .config for good measure.
> 
> What else is needed?

It looks that I confused your email with another person. You don't seem
to run the nvidia fb, but rather the radeon one.

.. snip ..
> Non-volatile memory driver v1.3
> Linux agpgart interface v0.103
> agpgart-intel 0000:00:00.0: Intel Q45/Q43 Chipset
> agpgart-intel 0000:00:00.0: detected 32764K stolen memory
> agpgart-intel 0000:00:00.0: AGP aperture is 256M @ 0xd0000000
> tpm_tis 00:08: 1.2 TPM (device-id 0x4A10, rev-id 78)
> [drm] Initialized drm 1.1.0 20060810
> [drm] radeon defaulting to kernel modesetting.
> [drm] radeon kernel modesetting enabled.
> xen_allocate_pirq: returning irq 16 for gsi 16
> Already setup the GSI :16
> i915 0000:00:02.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
> [drm] set up 31M of stolen space
> [drm] TMDS-8: set mode 1280x1024 17
> Console: switching to colour frame buffer device 160x64
> fb0: inteldrmfb frame buffer device
> registered panic notifier
> [drm] Initialized i915 1.6.0 20080730 for 0000:00:02.0 on minor 0

You look to have a i915 framebuffer on your box.

I *think* that the i915 is not using KMS and the TTM stuff, so the
patch that Arvind posted would probably not help you.
http://www.mail-archive.com/dri-devel@lists.sourceforge.net/msg48668.html

So, lets boot your kernel with these command line parameters to get more
data: debug initcall_debug drm.debug=255

That should spew out some more details.

Next thing I would suggest is to instrument i915_gem_fault. Attached is
a patch that does it (thought it is not compile tested nor actually
booted so it might need some hand crafting - sorry).

And the other thing is to read through the steps that Arvind took in the
e-mail thread titled: "Nouveau on dom0". It covers the gamma of things
to troubleshoot this.

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index fba37e9..cfcaafd 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -33,6 +33,8 @@
 #include "intel_drv.h"
 #include <linux/swap.h>
 #include <linux/pci.h>
+#include <xen/xen.h>
+#include <asm/xen/page.h>
 
 #define I915_GEM_GPU_DOMAINS	(~(I915_GEM_DOMAIN_CPU | I915_GEM_DOMAIN_GTT))
 
@@ -1145,6 +1147,143 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
 	return 0;
 }
 
+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]);
+}
+
 /**
  * i915_gem_fault - fault a page into the GTT
  * vma: VMA in question
@@ -1200,8 +1339,10 @@ int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 	pfn = ((dev->agp->base + obj_priv->gtt_offset) >> PAGE_SHIFT) +
 		page_offset;
 
+	print_pte(vma,"before",  NULL, pfn, 0);
 	/* Finally, remap it using the new GTT offset */
 	ret = vm_insert_pfn(vma, (unsigned long)vmf->virtual_address, pfn);
+	print_pte(vma, "after",  NULL, pfn, (unsigned long) vmf->virtual_address);
 unlock:
 	mutex_unlock(&dev->struct_mutex);
 

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

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index fba37e9..cfcaafd 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -33,6 +33,8 @@
 #include "intel_drv.h"
 #include <linux/swap.h>
 #include <linux/pci.h>
+#include <xen/xen.h>
+#include <asm/xen/page.h>
 
 #define I915_GEM_GPU_DOMAINS	(~(I915_GEM_DOMAIN_CPU | I915_GEM_DOMAIN_GTT))
 
@@ -1145,6 +1147,143 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
 	return 0;
 }
 
+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]);
+}
+
 /**
  * i915_gem_fault - fault a page into the GTT
  * vma: VMA in question
@@ -1200,8 +1339,10 @@ int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 	pfn = ((dev->agp->base + obj_priv->gtt_offset) >> PAGE_SHIFT) +
 		page_offset;
 
+	print_pte(vma,"before",  NULL, pfn, 0);
 	/* Finally, remap it using the new GTT offset */
 	ret = vm_insert_pfn(vma, (unsigned long)vmf->virtual_address, pfn);
+	print_pte(vma, "after",  NULL, pfn, (unsigned long) vmf->virtual_address);
 unlock:
 	mutex_unlock(&dev->struct_mutex);
 

[-- 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-16 22:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-12 20:24 Fbdev graphics broken in xen/next dom0 Eamon Walsh
2010-03-12 21:42 ` Jeremy Fitzhardinge
2010-03-13  0:44   ` Eamon Walsh
2010-03-13  0:51     ` Jeremy Fitzhardinge
2010-03-16  0:46       ` Konrad Rzeszutek Wilk
2010-03-16 21:52         ` Eamon Walsh
2010-03-16 22:19           ` Konrad Rzeszutek Wilk [this message]
2010-03-25 23:55             ` Eamon Walsh
2010-03-27  9:14               ` Arvind R
2010-03-27 21:52                 ` Jeremy Fitzhardinge
2010-03-28  9:33                   ` Arvind R

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=20100316221952.GA10912@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=ewalsh@tycho.nsa.gov \
    --cc=gscoker@tycho.nsa.gov \
    --cc=jeremy@goop.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.