Bug 12539

Summary: [PATCH] Fix a panic with 1M of shared memory, no GTT entries
Product: Drivers Reporter: Lubomir Rintel (lkundrak)
Component: Video(AGP)Assignee: Dave Airlie (airlied)
Status: CLOSED CODE_FIX    
Severity: normal CC: abittner, akpm
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.18 Subsystem:
Regression: --- Bisected commit-id:
Attachments: Fix that applies against current linux-2.6 head
Fix that applies against RHEL-5 kernel

Description Lubomir Rintel 2009-01-25 13:04:10 UTC
Latest working kernel version: not known
Earliest failing kernel version: 2.6.18
Distribution: Fedora
Hardware Environment: 82G33/G31 Graphics adapter, integrated on MS-7383 board
Software Environment: RHEL 5
Problem Description: Page fault, panic

Steps to reproduce:

Set shared video memory size to 1M in BIOS Setup, boot stock el5 kernel (which has agp-intel compiled in).

See original bug report for more details: https://bugzilla.redhat.com/show_bug.cgi?id=445592
Comment 1 Lubomir Rintel 2009-01-25 13:05:17 UTC
Created attachment 19983 [details]
Fix that applies against current linux-2.6 head
Comment 2 Lubomir Rintel 2009-01-25 13:07:03 UTC
Created attachment 19984 [details]
Fix that applies against RHEL-5 kernel

I did not test the fix with HEAD, but applying this one to el5 kernel worked fine for me (no crash).
Comment 3 Andrew Morton 2009-01-25 13:18:49 UTC
Please prefer to send patches by email rather than through bugzilla?

Suitable recipients for this one are:

Dave Airlie <airlied@linux.ie>
Andrew Morton <akpm@linux-foundation.org>
linux-kernel@vger.kernel.org
stable@kernel.org

Thanks.
Comment 4 Lubomir Rintel 2009-01-25 13:33:32 UTC
What happens with my hardware configuration is this:

469 static void intel_i830_init_gtt_entries(void)
...

size is set to 1024K

516                 case G33_PGETBL_SIZE_1M:
517                         size = 1024;
518                         break;
...

and incremented by 4K

528                 size += 4;
...

Size of shared memory is 1M, thus gtt_entries becomes -4K here

566                 case I855_GMCH_GMS_STOLEN_1M:
567                         gtt_entries = MB(1) - KB(size);
568                         break;
...

And subsequently -1 here

642         gtt_entries /= KB(4);
...
974 static int intel_i915_configure(void)
...

Which causes this cycle to iterate once, until it reaches zero, which shouldn't happen

995                 for (i = intel_private.gtt_entries; i < current_size->num_entries; i++) {
996                         writel(agp_bridge->scratch_page, intel_private.gtt+i);
997                 }
Comment 5 Lubomir Rintel 2009-01-25 13:39:31 UTC
(In reply to comment #3)
> Please prefer to send patches by email rather than through bugzilla?

Sorry, I'm new at this. I'll try to post future patches by mail. Should I also resend this one?

> Suitable recipients for this one are:
> 
> Dave Airlie <airlied@linux.ie>
> Andrew Morton <akpm@linux-foundation.org>
> linux-kernel@vger.kernel.org
> stable@kernel.org

How could I have guessed these? I guess I'd find Dave in MAINTAINERS file in kernel tree. Is my guess that stable@ is for patches against linux-2.6 tree and all patches should go to linux-kernel@ right? Thanks!
Comment 6 Andrew Morton 2009-01-27 17:38:05 UTC
(In reply to comment #5)

> Sorry, I'm new at this. I'll try to post future patches by mail. Should I
> also
> resend this one?

yes please.

> > Suitable recipients for this one are:
> > 
> > Dave Airlie <airlied@linux.ie>
> > Andrew Morton <akpm@linux-foundation.org>
> > linux-kernel@vger.kernel.org
> > stable@kernel.org
> 
> How could I have guessed these?

erm, good question.  Ask me :)

> I guess I'd find Dave in MAINTAINERS file in
> kernel tree. Is my guess that stable@ is for patches against linux-2.6 tree
> and
> all patches should go to linux-kernel@ right? Thanks!
> 

Yep, close enough
Comment 7 Chris Wilson 2010-07-24 09:32:52 UTC
*** Bug 11868 has been marked as a duplicate of this bug. ***