2003-09-07 18:21:47

by Jon Smirl

[permalink] [raw]
Subject: Mapping large framebuffers into kernel space

I just got a new P4 machine with 1GB memory and I'm trying to make radeonfb
work on it. I am compiled with HIGHMEM4G. The motherboard is i875P based which
supports 64b DMA.

When I first loaded radeonfb it would fail because ioremap was failing. I
tracked the problem down to not having any free kernel address space below 1GB.
I created some by adding reserve=FE000000-100000000 to the kernel command line.
This allowed radeonfb to load.

I'm beginning to wonder if framebuffers should be mapped into kernel space.
What's going to happen when I get a 512MB video card? Does the framebuffer have
to be mapped in the first 1GB of kernel address space?

If the framebuffer is mapped, it's a perfect candidate for a large page table
entry because it is a very large piece of linear memory that not's going to be paged.

=====
Jon Smirl
[email protected]

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


2003-09-07 19:13:20

by Alan

[permalink] [raw]
Subject: Re: Mapping large framebuffers into kernel space

On Sul, 2003-09-07 at 19:21, Jon Smirl wrote:
> I'm beginning to wonder if framebuffers should be mapped into kernel space.
> What's going to happen when I get a 512MB video card? Does the framebuffer have
> to be mapped in the first 1GB of kernel address space?

Yes but it shouldnt be mapping all of it blindly like that. Vesafb was
fixed for this, radeonfb needs fixing

> If the framebuffer is mapped, it's a perfect candidate for a large page table
> entry because it is a very large piece of linear memory that not's going to be paged.

By the time we need to really kernel map 512Mb of frame buffer hopefully
32bit will be dead 8)

2003-09-07 19:27:33

by Zwane Mwaikambo

[permalink] [raw]
Subject: Re: Mapping large framebuffers into kernel space

On Sun, 7 Sep 2003, Alan Cox wrote:

> By the time we need to really kernel map 512Mb of frame buffer hopefully
> 32bit will be dead 8)

I hope that's also tongue in cheek ;)

2003-09-07 19:42:48

by Jon Smirl

[permalink] [raw]
Subject: Re: Mapping large framebuffers into kernel space

--- Alan Cox <[email protected]> wrote:
> By the time we need to really kernel map 512Mb of frame buffer hopefully
> 32bit will be dead 8)

I hope 32bits dies real soon. You can buy 256MB cards off the shelf right now.
I bet we have 512MB ones by next Christmas.

=====
Jon Smirl
[email protected]

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

2003-09-07 21:18:53

by Jon Smirl

[permalink] [raw]
Subject: Re: Mapping large framebuffers into kernel space

Is there something preventing kernel framebuffers from being mapped to the high
end of the 4GB kernel address space? Or do they have to be mapped below 1GB?
Framebuffer access isn't that performance sensitive, after all it is on the PCI bus.

=====
Jon Smirl
[email protected]

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

2003-09-07 22:26:30

by Alan

[permalink] [raw]
Subject: Re: Mapping large framebuffers into kernel space

On Sul, 2003-09-07 at 22:18, Jon Smirl wrote:
> Is there something preventing kernel framebuffers from being mapped to the high
> end of the 4GB kernel address space? Or do they have to be mapped below 1GB?
> Framebuffer access isn't that performance sensitive, after all it is on the PCI bus.

The kernel has 4Gb of virtual address space. Because of the way x86
works it really wants to keep the user map, the view of main memory and
io mappings visible at once. For larger objects you have to use kmap and
map them through a window (anyone remember they joys of EMS). On 64bit
this of course all goes away

2003-09-08 00:17:20

by Jon Smirl

[permalink] [raw]
Subject: Re: Mapping large framebuffers into kernel space

--- Alan Cox <[email protected]> wrote:
>
> The kernel has 4Gb of virtual address space. Because of the way x86
> works it really wants to keep the user map, the view of main memory and
> io mappings visible at once. For larger objects you have to use kmap and
> map them through a window (anyone remember they joys of EMS). On
> 64bit this of course all goes away
>

On my system I have 1GB physical and 1GB swap. So there should always be some
open address space in the 1-4GB kernel address space. Would it be better to map
the framebuffer to 1-4GB when HIGHMEM is configured? Is there an ioremap() that
will map to high memory? Seems that this would be better than reserving 256MB
in the 0-1GB range and forcing 256MB of physical RAM into highmem.

The kernel DRM drivers map framebuffers up to 256MB in size into user space.
Could this be mapped as a single 256MB page instead of 64K 4KB ones?

We're working on the radeon drivers right now so I can try a few things out.

=====
Jon Smirl
[email protected]

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

2003-09-08 12:30:41

by Alan

[permalink] [raw]
Subject: Re: Mapping large framebuffers into kernel space

> On my system I have 1GB physical and 1GB swap. So there should always be some
> open address space in the 1-4GB kernel address space. Would it be better to map

The kernel address space is 3Gb-4Gb (ie 1Gb sized) giving a 3Gb user
address space.

> The kernel DRM drivers map framebuffers up to 256MB in size into user space.
> Could this be mapped as a single 256MB page instead of 64K 4KB ones?

Well the CPU only has 4K/4Mb as the basic choices but you could map it
using 4Mb pages in theory - in practice its rather complicated because
of the VM handling. 2.6 has some basic stuff for doing this kind of
thing with fixed unswappable memory.

However if your radeon driver is touching the RAM often enough to matter
you have another problem.