[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4D094F1A.3020906@zytor.com>
Date: Wed, 15 Dec 2010 15:28:26 -0800
From: "H. Peter Anvin" <hpa@...or.com>
To: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
CC: linux-kernel@...r.kernel.org, sodaville@...utronix.de,
x86@...nel.org, Dirk Brandewie <dirk.brandewie@...il.com>
Subject: Re: [PATCH 01/11] x86/kernel: remove conditional early remap in parse_e820_ext
On 11/25/2010 09:39 AM, Sebastian Andrzej Siewior wrote:
> parse_setup_data() uses early_memremap() for a PAGE_SIZE mapping in
> order to figure out the type & size. If this mapping is not large enough
> then parse_e820_ext() will remap this area again via early_ioremap()
> since the first mapping is still in use.
>
> This patch attempts to simplify the handling and parse_e820_ext() does
> not need to worry about the mapping anymore.
I like the fact that this puts all the mapping in the same layer, but I
also think it's unfortunate to discard the optimization of always
mapping the minimum of <header length, rest of page>; your code will
*always* map-unmap-map the code, even in the (presumably very common)
case of the data fitting on a single page.
Furthermore, your code retains a minor bug from the original code, which
is that if the header is not page-aligned, it may be needlessly map more
than one page with unknown content.
The proper way to do it is probably (this is pseudocode):
maplen = max(PAGE_SIZE - (pa_data & ~PAGE_MASK),
sizeof(struct setup_data));
data = early_memremap(pa_data, maplen);
len = data->len + sizeof(struct setup_data);
if (len > maplen) {
early_iounmap(pa_data, maplen);
data = early_memremap(pa_data, maplen);
}
/* ... */
early_iounmap(pa_data, maplen);
I also found your patch description to be needlessly hard to follow.
The key point is that it puts all the map manipulation into
parse_setup_data() where it belongs. Since you're changing an
interface, however, also do note that you have checked that there are no
other callers to parse_e820_ext().
-hpa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists