On Mon, 2015-05-18 at 21:01 +0200, Borislav Petkov wrote: > On Mon, May 18, 2015 at 11:22:39AM -0600, Toshi Kani wrote: > > > diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c > > > index c30f9819786b..f1894daa79ee 100644 > > > --- a/arch/x86/mm/pgtable.c > > > +++ b/arch/x86/mm/pgtable.c > > > @@ -566,19 +566,24 @@ 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 all of the following > > > + * conditions are met: > > > > It should be "if any of the following condition is met". Or, does NOT > > setup if all of ... > > > > > + * > > > + * - MTRRs are disabled. > > > + * - The range is mapped uniformly by an MTRR, i.e. the range is > > > + * fully covered by a single MTRR entry or the default type. > > > + * - The MTRR memory type is WB. > > Hmm, ok, so this is kinda like "any" but they also depend on each other. > So it is > > If > - 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. > > Right? Well, #2 and #3 are independent. That is, uniform can be set regardless of a type value, and WB can be returned regardless of a uniform value. #1 is a new condition added per your comment that uniform no longer covers the MTRR disabled case. Yes, #2 and #3 depend on #1 being false. > So tell me this: why do we need to repeat that over those KVA helpers? > It's not like the callers can do anything about it, can they? > > So maybe that comment - expanded into more detail - should be over > mtrr_type_lookup() only. That'll be better, methinks. The caller is responsible for verifying the conditions that are safe to create huge page. So, I think the comments are needed here to state such conditions. Thanks, -Toshi -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>