From patchwork Wed Feb 22 15:51:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jon Medhurst (Tixy)" X-Patchwork-Id: 9587057 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5CCF26051E for ; Wed, 22 Feb 2017 15:52:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 504492865A for ; Wed, 22 Feb 2017 15:52:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 449402866E; Wed, 22 Feb 2017 15:52:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D24742865A for ; Wed, 22 Feb 2017 15:52:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Mime-Version:Date:To:From:Subject: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=MISXKhyrvfeHkXV+sknEwDb1xCqAasvAXJV1AeBCu1k=; b=d4RScRxHm6H4bW n89uOW6VNuq4+1kpQ/Krteev9gAp77eaN/t8ZeH4ViZr35axSliEusomHApGvmFEzi0QzHgSFFXDU gchJgHZ5yjxRD3EknwhXaxIrykv5ow9VkHaS1bJbH5gLHuH56YR7mCQSRx5yKJHbojuVe5PNlTAfk 3iwdySRdZAogHFiIPi+A59LcPaOIGektqlOJSI12/FU96yWcREIVtlHSi+G1kPN62Cku2D8eF5Yg+ t60bki2LjNRYmXY/mGp3NyioBqFntkWAMcGR80Kop7y+E8q9gFp1s8wfinm5UKDuW361PUo0/NPvn caYAXem6cmDUO7Ns9h+g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cgZDO-0005dl-Do; Wed, 22 Feb 2017 15:52:26 +0000 Received: from smarthost01b.mail.zen.net.uk ([212.23.1.3]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cgZCi-0005Kx-Ux for linux-arm-kernel@lists.infradead.org; Wed, 22 Feb 2017 15:51:46 +0000 Received: from [82.69.122.217] (helo=linaro1) by smarthost01b.mail.zen.net.uk with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1cgZCI-0002ue-Gx; Wed, 22 Feb 2017 15:51:18 +0000 Message-ID: <1487778678.18810.8.camel@linaro.org> Subject: [RFC PATCH] arm: Fix cache inconsistency when using fixmap From: "Jon Medhurst (Tixy)" To: Russell King , Stefan Agner Date: Wed, 22 Feb 2017 15:51:18 +0000 X-Mailer: Evolution 3.22.4-1 Mime-Version: 1.0 X-Originating-smarthost01b-IP: [82.69.122.217] Feedback-ID: 82.69.122.217 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170222_075145_152184_6215475B X-CRM114-Status: GOOD ( 14.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Herring , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Cacheable memory mappings need to be marked as shareable otherwise the CPU accessing fixmap memory may end up with local cachelines for that memory, resulting in different CPUs in the system seeing different values for the same memory location. This issue was discovered when investigating failures in the ARM kprobe tests. kprobes uses patch_text() to modify the kernel image, which when CONFIG_DEBUG_RODATA is enabled makes use of fixmap to map the page to be modified. As the shareable attribute wasn't being set in the PTE entry for that page, a write to it wasn't being broadcast to other caches in the system, which in the the case being investigated was CPU's in the other cluster of a big.LITTLE system. Fixes: a5f4c561b3b1 ("ARM: 8415/1: early fixmap support for earlycon") Cc: stable@vger.kernel.org # v4.3+ Signed-off-by: Jon Medhurst --- The fixmap changes in the original commit a5f4c561b3b1 look a bit iffy to me, shouldn't it have have made use of PAGE_KERNEL or pgprot_kernel or something like that to get PTE attributes suitable for the system being run, rather than rolling it's own set of values? That's why I'm marking this as an RFC, perhaps the correct fix is to rework the code to use the defines from arch/arm/include/asm/pgtable.h arch/arm/include/asm/fixmap.h | 2 +- arch/arm/probes/kprobes/test-core.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/asm/fixmap.h b/arch/arm/include/asm/fixmap.h index 5c17d2dec777..26d4a4677cd7 100644 --- a/arch/arm/include/asm/fixmap.h +++ b/arch/arm/include/asm/fixmap.h @@ -41,7 +41,7 @@ static const enum fixed_addresses __end_of_fixed_addresses = #define FIXMAP_PAGE_COMMON (L_PTE_YOUNG | L_PTE_PRESENT | L_PTE_XN | L_PTE_DIRTY) -#define FIXMAP_PAGE_NORMAL (FIXMAP_PAGE_COMMON | L_PTE_MT_WRITEBACK) +#define FIXMAP_PAGE_NORMAL (FIXMAP_PAGE_COMMON | L_PTE_SHARED | L_PTE_MT_WRITEBACK) #define FIXMAP_PAGE_RO (FIXMAP_PAGE_NORMAL | L_PTE_RDONLY) /* Used by set_fixmap_(io|nocache), both meant for mapping a device */ diff --git a/arch/arm/probes/kprobes/test-core.h b/arch/arm/probes/kprobes/test-core.h index 94285203e9f7..cde2b4e9358a 100644 --- a/arch/arm/probes/kprobes/test-core.h +++ b/arch/arm/probes/kprobes/test-core.h @@ -8,7 +8,7 @@ * published by the Free Software Foundation. */ -#define VERBOSE 0 /* Set to '1' for more logging of test cases */ +#define VERBOSE 1 /* Set to '1' for more logging of test cases */ #ifdef CONFIG_THUMB2_KERNEL #define NORMAL_ISA "16"