lkml.org 
[lkml]   [2001]   [Jan]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] VESA framebuffer w/MTRR locks 2.4.0 on init
From
Date
Alan Cox <alan@lxorguk.ukuu.org.uk> writes:
> > loop with no exit, as each size mtrr fails.
> > while (mtrr_add(video_base, temp_size, MTRR_TYPE_WRCOMB,
> > 1)==-EINVAL) {
> > temp_size >>= 1;
> > }
>
> Ok that one is the bug.

Even with the obvious bug fixed, that code is strange. "temp_size >>=
1" does little to improve the chances of the mtrr_add succeeding.
Something like this would be better:

if (mtrr_add(video_base, temp_size, MTRR_TYPE_WRCOMB, 1) == -EINVAL) {
/* Find the largest power-of-two */
while (temp_size & (temp_size - 1))
temp_sze &= (temp_size - 1);

mtrr_add(video_base, temp_size, MTRR_TYPE_WRCOMB, 1);
}


(But this is just a very crude way to work around the inflexibility of
the MTRRs. Rather than cluttering up calls to mtrr_add, it would be
better to fix this properly, either by implementing PAT support
(Zoltán Böszörményi said he was working on that), or by having a
user-space helper program to make more intelligent MTRR allocations,
or both.)


David Wragg
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:52    [W:0.138 / U:0.476 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site