From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: Frame buffer mmap not working in pvops dom0 Date: Wed, 21 Jul 2010 10:42:09 -0400 Message-ID: <20100721144209.GA5031@phenom.dumpdata.com> References: <4C46FA8D.6040809@tycho.nsa.gov> <20100721141613.GG17817@reaktio.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="a8Wt8u1KmwUX3Y2C" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20100721141613.GG17817@reaktio.net> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Pasi =?iso-8859-1?Q?K=E4rkk=E4inen?= Cc: Eamon Walsh , Daniel De Graaf , xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --a8Wt8u1KmwUX3Y2C Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 21, 2010 at 05:16:13PM +0300, Pasi K=E4rkk=E4inen wrote: > On Wed, Jul 21, 2010 at 09:47:57AM -0400, Daniel De Graaf wrote: > > I'm trying to confirm the fix to the VESA fbdev mmap issue that was > > brought up a few months ago > > (http://marc.info/?l=3Dxen-devel&m=3D126842551306571&w=3D2). The wiki= page at Weird. I don't remember seeing that e-mail.. > > http://wiki.xensource.com/xenwiki/XenPVOPSDRM says that this bug shou= ld > > be fixed, but doesn't point to a patch for the fix. I am still able t= o > > reproduce the issue both on real hardware and by running Xen under qe= mu > > (using cirrusfb on the dom0). Eamon (the original reporter) has also = not > > been able to confirm a fix. > >=20 > > I'm currently testing using Xen 4.1 built from hg 21831:6bebaf40e925 = and > > a pvops dom0 from xen/stable-2.6.32.x revid c0a00fbe. > >=20 > > So far, I've been able to determine that an mmap requesting multiple > > pages from /dev/fb0 will result in page table entries all pointing to > > the same physical page, which is not in the framebuffer address space= . > > Writing to the mapped page ends up corrupting parts of kernel memory. > > I'd be happy to run further tests, try patches, or provide more > > information if needed. Goodies. Let me fix up a tree that cleanly merges with Jeremy's xen/next (or xen/stable-2.6.32.x) and give you a go with that. And then from there we can come up with a fix. Can you tell me how you came up with the analysis? (that should speed up finding the culprit). Any serial/dmesg outputs would be appreciated. > >=20 >=20 > I guess many (most?) graphics related fixes are in Konrad's git tree.. Daniel, I honestly don't remember which patch I thought fixed it. But I do know that when the /dev/fb0 was backed by DRM (nvidia) it worked (I used the=20 below program). Granted now that I tested it with fbxine and it hangs with a Xen error. Let me start using Eamon's program. --a8Wt8u1KmwUX3Y2C Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="fb_test.c" #include #include #include #include #include #include #include #include #include static char filename[] = "/dev/fb0"; int main(int argc, char *argv[]) { struct fb_var_screeninfo screeninfo; int fd = -1; int rc; unsigned char *fbuf; struct stat buf; int row, column; int i; int len; printf("Starting..[%s]\n", filename); fd = open(filename, O_RDWR); if (fd <= 0) { printf("Could not open; err: %d\n", errno); return errno; } if (stat(filename, &buf) != 0) { printf("Could not open; err: %d\n", errno); return errno; } printf("%s: len:%d\n", filename, buf.st_size); rc = ioctl(fd, FBIOGET_VSCREENINFO, &screeninfo); if (rc) { printf("Could not do ioctl. err: %d\n", errno); return errno; } printf("%s: bits/pixel%d\n", filename, screeninfo.bits_per_pixel); len = screeninfo.xres * screeninfo.yres; fbuf = mmap(0, len, PROT_WRITE|PROT_READ, MAP_SHARED, fd, 0); if (fbuf == MAP_FAILED) { printf("Could not map: error: %d\n", errno); return errno; } if (argc > 1) { int outfd; outfd = open(argv[1], O_RDWR|O_CREAT, 0644); if (outfd != -1) { write(outfd, fbuf, len); close(outfd); } } printf("(%lx): Writting .. [%d:%d]\n", fbuf, screeninfo.xres,screeninfo.yres); i = 0; for (i = 0; i < len; i++) { fbuf[i] = (i % 255); } printf("Done!\n"); if (munmap(fbuf, len)) { printf("Could not unmap: %d\n", errno); return errno; } close(fd); return 0; } --a8Wt8u1KmwUX3Y2C Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --a8Wt8u1KmwUX3Y2C--