[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <51158742.4030803@linux.vnet.ibm.com>
Date: Fri, 08 Feb 2013 15:16:18 -0800
From: Dave Hansen <dave@...ux.vnet.ibm.com>
To: "H. Peter Anvin" <hpa@...or.com>
CC: linux-kernel@...r.kernel.org, linux-mm@...ck.org, bp@...en8.de,
mingo@...nel.org, tglx@...utronix.de
Subject: Re: [PATCH 1/2] add helper for highmem checks
On 02/08/2013 12:50 PM, H. Peter Anvin wrote:
> On 02/08/2013 12:28 PM, Dave Hansen wrote:
>> +static inline phys_addr_t last_lowmem_phys_addr(void)
>> +{
>> + /*
>> + * 'high_memory' is not a pointer that can be dereferenced, so
>> + * avoid calling __pa() on it directly.
>> + */
>> + return __pa(high_memory - 1);
>> +}
>> +static inline bool phys_addr_is_highmem(phys_addr_t addr)
>> +{
>> + return addr > last_lowmem_paddr();
>> +}
>> +
>
> Are we sure that high_memory - 1 is always a valid reference? Consider
> especially the case where there is MMIO beyond end of memory on a system
> which has less RAM than the HIGHMEM boundary...
Yeah, I think it is. "high_memory" should point at either the end of
RAM, or the end of the linear map, whichever is lower. See setup_arch():
max_pfn = e820_end_of_ram_pfn();
...
high_memory = (void *)__va(max_pfn * PAGE_SIZE - 1) + 1;
or in the highmem init code:
high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1;
--
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