Re: [PATCH v4 7/7] mtrr, mm, x86: Enhance MTRR checks for KVA huge page mapping
From: Borislav Petkov
Date: Mon May 11 2015 - 16:18:40 EST
On Mon, May 11, 2015 at 01:25:16PM -0600, Toshi Kani wrote:
> > > @@ -235,13 +240,19 @@ static u8 mtrr_type_lookup_variable(u64 start, u64 end, u64 *partial_end,
> > > * Return Values:
> > > * MTRR_TYPE_(type) - The effective MTRR type for the region
> > > * MTRR_TYPE_INVALID - MTRR is disabled
> > > + *
> > > + * Output Argument:
> > > + * uniform - Set to 1 when MTRR covers the region uniformly, i.e. the region
> > > + * is fully covered by a single MTRR entry or the default type.
> > I'd call this "single_mtrr". "uniform" could also mean that the resulting
> > type is uniform, i.e. of the same type but spanning multiple MTRRs.
> Actually, that is the intend of "uniform" and the same type but spanning
> multiple MTRRs should set "uniform" to 1. The patch does not check such
So why does it say "is fully covered by a single MTRR entry or the
default type." - the stress being on *single*
You need to make up your mind.
> We need to set "uniform" to 1 when MTRRs are disabled since there is no
> type conflict with MTRRs.
No, this is wrong.
When we return an *error*, "uniform" should be *undefined* because MTRRs
are disabled and callers should be checking whether it returned an error
first and only *then* look at uniform.
> The warning was suggested by reviewers in the previous review so that
> driver writers will notice the issue.
No, we don't flood dmesg so that driver writers notice stuff. We better
fix the callers.
> Returning 0 here will lead
> ioremap() to use 4KB mappings, but does not cause ioremap() to fail.
I guess a pr_warn_once() should be better then. Flooding dmesg with
error messages for which the user can't really do anything about doesn't
bring us anything.
ECO tip #101: Trim your mails when you reply.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/