Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752605AbbETLzR (ORCPT ); Wed, 20 May 2015 07:55:17 -0400 Received: from mail-wg0-f48.google.com ([74.125.82.48]:35806 "EHLO mail-wg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752068AbbETLzO (ORCPT ); Wed, 20 May 2015 07:55:14 -0400 Date: Wed, 20 May 2015 13:55:09 +0200 From: Ingo Molnar To: Borislav Petkov Cc: Toshi Kani , akpm@linux-foundation.org, hpa@zytor.com, tglx@linutronix.de, mingo@redhat.com, linux-mm@kvack.org, x86@kernel.org, linux-kernel@vger.kernel.org, dave.hansen@intel.com, Elliott@hp.com, pebolle@tiscali.nl, mcgrof@suse.com Subject: Re: [PATCH v5 6/6] mtrr, mm, x86: Enhance MTRR checks for KVA huge page mapping Message-ID: <20150520115509.GA3489@gmail.com> References: <20150518133348.GA23618@pd.tnic> <1431969759.19889.5.camel@misato.fc.hp.com> <20150518190150.GC23618@pd.tnic> <1431977519.20569.15.camel@misato.fc.hp.com> <20150518200114.GE23618@pd.tnic> <1431980468.21019.11.camel@misato.fc.hp.com> <20150518205123.GI23618@pd.tnic> <1431985994.21526.12.camel@misato.fc.hp.com> <20150519114437.GF4641@pd.tnic> <20150519132307.GG4641@pd.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150519132307.GG4641@pd.tnic> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1553 Lines: 40 * Borislav Petkov wrote: > --- a/arch/x86/mm/pgtable.c > +++ b/arch/x86/mm/pgtable.c > @@ -566,19 +566,28 @@ void native_set_fixmap(enum fixed_addresses idx, phys_addr_t phys, > /** > * pud_set_huge - setup kernel PUD mapping > * > - * MTRR can override PAT memory types with 4KiB granularity. Therefore, > - * this function does not set up a huge page when the range is covered > - * by a non-WB type of MTRR. MTRR_TYPE_INVALID indicates that MTRR are > - * disabled. > + * MTRRs can override PAT memory types with 4KiB granularity. Therefore, this > + * function sets up a huge page only if any of the following conditions are met: > + * > + * - MTRRs are disabled, or > + * > + * - MTRRs are enabled and the range is completely covered by a single MTRR, or > + * > + * - MTRRs are enabled and the range is not completely covered by a single MTRR > + * but the memory type of the range is WB, even if covered by multiple MTRRs. > + * > + * Callers should try to decrease page size (1GB -> 2MB -> 4K) if the bigger > + * page mapping attempt fails. This comment should explain why it's ok in the WB case. Also, the phrase 'the memory type of the range' is ambiguous: it might mean the partial MTRR's, or the memory type specified via PAT by the huge-pmd entry. Thanks, Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/