Bug 13877 - bogl-term broken with CONFIG_X86_PAT=y, works with =n
Summary: bogl-term broken with CONFIG_X86_PAT=y, works with =n
Status: RESOLVED CODE_FIX
Alias: None
Product: Platform Specific/Hardware
Classification: Unclassified
Component: i386 (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: platform_i386
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-30 14:34 UTC by Max Vozeler
Modified: 2009-08-31 20:53 UTC (History)
5 users (show)

See Also:
Kernel Version: 2.6.30
Subsystem:
Regression: Yes
Bisected commit-id:


Attachments
strace of failing mmap() (50 bytes, text/plain)
2009-07-30 14:34 UTC, Max Vozeler
Details
Test patch (1.49 KB, patch)
2009-08-15 01:08 UTC, Suresh B Siddha
Details | Diff

Description Max Vozeler 2009-07-30 14:34:31 UTC
Created attachment 22539 [details]
strace of failing mmap()

Debian kernels recently changed to have CONFIG_X86_PAT=y.

Since then, we are seeing a problem with bogl-term. Confirmed
with 2.6.30 and 2.6.31-rc3. The problem goes away when PAT is 
disabled (nopat boot option).

We managed to narrow it down to a failing mmap():

   814   mmap2(NULL, 65536, PROT_READ|PROT_WRITE, MAP_SHARED, 4, 0) = -1 EAGAIN (Resource temporarily unavailable)
   814   write(2, "bogl: mmaping /dev/fb0: Resource temporarily unavailable\n", 57) = 57
   814   exit_group(1)                     = ?

The respective code in bogl-term is in bogl-0.1.18/bogl.c:

  bogl_frame_mapped
    = mmap (NULL, bogl_frame_len, PROT_READ | PROT_WRITE, MAP_SHARED, fb, 0);

Further information:
- complete strace output attached
- bogl source: http://ftp.debian.org/debian/pool/main/b/bogl/bogl_0.1.18-3.tar.gz
- http://bugs.debian.org/538159 "CONFIG_X86_PAT=y breaks bogl-bterm, d-i"
Comment 1 Andrew Morton 2009-07-30 21:21:37 UTC
I assume that bogl-term used to work, so I'll mark this as a regression, thanks.
Comment 2 Venkatesh Pallipadi 2009-07-30 21:47:46 UTC
Do you see any errors in 'dmesg' when you see the above failure?
Can you attach the output of
/debug/x86/pat_memtype_list
Comment 3 Max Vozeler 2009-07-30 23:37:53 UTC
There is an error in dmesg:

[  802.000124] bterm:814 map pfn expected mapping type uncached-minus for a0000-b0000, got write-back

I will try to get the output of /debug/x86/pat_memtype_list this weekend (not as easy for me to reproduce as for the original bug reporter).

Systems on which this problem has been verified:
- qemu
- virtualbox
- Compaq DC9600 (user report)
Comment 4 H. Peter Anvin 2009-07-30 23:47:50 UTC
Writeback for the VGA range would definitely be bad.  VGA should technically even be write-combining, although Linux probably can get away with WC.

Either which way, I suspect the legacy-region MTRRs force it to UC anyway.
Comment 5 Venkatesh Pallipadi 2009-07-31 01:11:14 UTC
Ok. As the failure is in ISA range, /debug/x86/pat_memtype_list will not give any new info. So, forget about pat_memtype_list for now.

Looking at the code we know why this is failing. Suresh and I are thinking about best way to make this work, without breaking other users. Will get back.

btw, what fb driver is getting used here?
Comment 6 Julien Cristau 2009-07-31 07:17:00 UTC
(In reply to comment #5)
> btw, what fb driver is getting used here?

vga16fb, according to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=538159#15
Comment 7 Max Vozeler 2009-08-14 11:32:39 UTC
Thanks Venkatesh.

Did you find a non-intrusive way to make it work?

I would be happy to help testing or finding more details, even if the 
problem itself is well above my head. :-)
Comment 8 Suresh B Siddha 2009-08-15 01:08:42 UTC
Created attachment 22720 [details]
Test patch

Max, can you please check if the attached patch fixes the issue? If it works, we will post the patch with changelog etc to lkml on monday. Thanks.
Comment 9 Max Vozeler 2009-08-15 16:10:26 UTC
Venkatesh, your patch fixes the issue. 

Confirmed in vmware and qemu. Thanks a lot!
Comment 10 Max Vozeler 2009-08-31 20:53:46 UTC
The commit fixing this problem is in 2.6.31-rc8:

commit 1adcaafe7414c5731f758b158aa0525057225deb
Author: Suresh Siddha <suresh.b.siddha@intel.com>
Date:   Mon Aug 17 13:23:50 2009 -0700

So I think the bug can be closed. Thanks!

Note You need to log in before you can comment on or make changes to this bug.