From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755458AbbESLot (ORCPT ); Tue, 19 May 2015 07:44:49 -0400 Received: from mail.skyhub.de ([78.46.96.112]:59908 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752739AbbESLop (ORCPT ); Tue, 19 May 2015 07:44:45 -0400 Date: Tue, 19 May 2015 13:44:37 +0200 From: Borislav Petkov To: Toshi Kani Cc: 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: <20150519114437.GF4641@pd.tnic> References: <1431714237-880-1-git-send-email-toshi.kani@hp.com> <1431714237-880-7-git-send-email-toshi.kani@hp.com> <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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1431985994.21526.12.camel@misato.fc.hp.com> 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 On Mon, May 18, 2015 at 03:53:14PM -0600, Toshi Kani wrote: > On Mon, 2015-05-18 at 22:51 +0200, Borislav Petkov wrote: > > On Mon, May 18, 2015 at 02:21:08PM -0600, Toshi Kani wrote: > > > The caller is the one who makes the condition checks necessary to create > > > a huge page mapping. > > > > How? It would go and change MTRRs configuration and ranges and their > > memory types so that a huge mapping succeeds? > > > > Or go and try a different range? > > Try with a smaller page size. > > The callers, pud_set_huge() and pmd_set_huge(), check if the given range > is safe with MTRRs for creating a huge page mapping. If not, they fail > the request, which leads their callers, ioremap_pud_range() and > ioremap_pmd_range(), to retry with a smaller page size, i.e. 1GB -> 2MB > -> 4KB. 4KB may not have overlap with MTRRs (hence no checking is > necessary), which will succeed as before. Ok, now *this* should be in the form of a comment over the KVA helpers, not the MTRR aspect. Callers of those functions would have to know that - they shouldn't care about MTRR setup. The MTRR aspect with the 3 conditions should be only over mtrr_type_lookup(). I'll integrate it into the patch. -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. --