From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932140AbbFGRl4 (ORCPT ); Sun, 7 Jun 2015 13:41:56 -0400 Received: from terminus.zytor.com ([198.137.202.10]:57354 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752505AbbFGRls (ORCPT ); Sun, 7 Jun 2015 13:41:48 -0400 Date: Sun, 7 Jun 2015 10:41:00 -0700 From: tip-bot for Toshi Kani Message-ID: Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org, bp@suse.de, toshi.kani@hp.com, linux-mm@kvack.org, mingo@kernel.org, torvalds@linux-foundation.org, hpa@zytor.com, peterz@infradead.org, luto@amacapital.net, mcgrof@suse.com, akpm@linux-foundation.org Reply-To: tglx@linutronix.de, linux-mm@kvack.org, linux-kernel@vger.kernel.org, bp@suse.de, toshi.kani@hp.com, peterz@infradead.org, luto@amacapital.net, mingo@kernel.org, torvalds@linux-foundation.org, hpa@zytor.com, akpm@linux-foundation.org, mcgrof@suse.com In-Reply-To: <1433436928-31903-7-git-send-email-bp@alien8.de> References: <1433436928-31903-7-git-send-email-bp@alien8.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/mm] x86/mm: Teach is_new_memtype_allowed() about Write-Through type Git-Commit-ID: ecb2febaaa3945e1578359adc30ca818e78540fb X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: ecb2febaaa3945e1578359adc30ca818e78540fb Gitweb: http://git.kernel.org/tip/ecb2febaaa3945e1578359adc30ca818e78540fb Author: Toshi Kani AuthorDate: Thu, 4 Jun 2015 18:55:14 +0200 Committer: Ingo Molnar CommitDate: Sun, 7 Jun 2015 15:28:55 +0200 x86/mm: Teach is_new_memtype_allowed() about Write-Through type __ioremap_caller() calls reserve_memtype() and the passed down @new_pcm contains the actual page cache type it reserved in the success case. is_new_memtype_allowed() verifies if converting to the new page cache type is allowed when @pcm (the requested type) is different from @new_pcm. When WT is requested, the caller expects that writes are ordered and uncached. Therefore, enhance is_new_memtype_allowed() to disallow the following cases: - If the request is WT, mapping type cannot be WB - If the request is WT, mapping type cannot be WC Signed-off-by: Toshi Kani Signed-off-by: Borislav Petkov Reviewed-by: Thomas Gleixner Cc: Andrew Morton Cc: Andy Lutomirski Cc: Elliott@hp.com Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Luis R. Rodriguez Cc: Peter Zijlstra Cc: arnd@arndb.de Cc: hch@lst.de Cc: hmh@hmh.eng.br Cc: jgross@suse.com Cc: konrad.wilk@oracle.com Cc: linux-mm Cc: linux-nvdimm@lists.01.org Cc: stefan.bader@canonical.com Cc: yigal@plexistor.com Link: http://lkml.kernel.org/r/1433436928-31903-7-git-send-email-bp@alien8.de Signed-off-by: Ingo Molnar --- arch/x86/include/asm/pgtable.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index fe57e7a..2562e30 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -398,11 +398,17 @@ static inline int is_new_memtype_allowed(u64 paddr, unsigned long size, * requested memtype: * - request is uncached, return cannot be write-back * - request is write-combine, return cannot be write-back + * - request is write-through, return cannot be write-back + * - request is write-through, return cannot be write-combine */ if ((pcm == _PAGE_CACHE_MODE_UC_MINUS && new_pcm == _PAGE_CACHE_MODE_WB) || (pcm == _PAGE_CACHE_MODE_WC && - new_pcm == _PAGE_CACHE_MODE_WB)) { + new_pcm == _PAGE_CACHE_MODE_WB) || + (pcm == _PAGE_CACHE_MODE_WT && + new_pcm == _PAGE_CACHE_MODE_WB) || + (pcm == _PAGE_CACHE_MODE_WT && + new_pcm == _PAGE_CACHE_MODE_WC)) { return 0; }