[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <504A3FA9.1050502@zytor.com>
Date: Fri, 07 Sep 2012 11:40:41 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: Peter Hurley <peter@...leysoftware.com>
CC: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"x86@...nel.org" <x86@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Zhenzhong Duan <zhenzhong.duan@...cle.com>
Subject: Re: [RFC] x86: mtrr: Constrain WB MTRR to max phys mem prior to cleanup
On 09/07/2012 10:44 AM, Peter Hurley wrote:
\>
> diff --git a/arch/x86/kernel/cpu/mtrr/cleanup.c b/arch/x86/kernel/cpu/mtrr/cleanup.c
> index bdda2e6..ee399c3 100644
> --- a/arch/x86/kernel/cpu/mtrr/cleanup.c
> +++ b/arch/x86/kernel/cpu/mtrr/cleanup.c
> @@ -714,6 +714,16 @@ int __init mtrr_cleanup(unsigned address_bits)
> if (mtrr_tom2)
> x_remove_size = (mtrr_tom2 >> PAGE_SHIFT) - x_remove_base;
>
> + /* Constrain a WB entry that maps entire phys addr space to max mem */
> + for (i = 0; i < num_var_ranges; i++) {
> + if (range_state[i].type == MTRR_TYPE_WRBACK &&
> + range_state[i].base_pfn == 0 &&
> + range_state[i].size_pfn > max_pfn) {
> + range_state[i].size_pfn = roundup_pow_of_two(max_pfn);
> + break;
> + }
> + }
> +
I really don't like it as it introduces yet another user of max_pfn,
which should be going away. Furthermore, the better question is what
remaining needs there are for MTRR cleanup; historically the reason was
that it prevented the display from being mapped WC via MTRR due to the
MTRR conflict resolution rules favoring UC.
However, the right way to fix that is to use the PAT interfaces, which
doesn't have this drawback -- then MTRR cleanup becomes entirely
superfluous and the problem goes away.
-hpa
--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.
--
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