From patchwork Wed Jul 2 10:46:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Capper X-Patchwork-Id: 4464701 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 26B9F9F358 for ; Wed, 2 Jul 2014 10:48:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 48E0120379 for ; Wed, 2 Jul 2014 10:48:53 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6671A202FE for ; Wed, 2 Jul 2014 10:48:52 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X2I45-0007kh-0R; Wed, 02 Jul 2014 10:47:01 +0000 Received: from mail-wi0-f172.google.com ([209.85.212.172]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X2I42-0007hf-Am for linux-arm-kernel@lists.infradead.org; Wed, 02 Jul 2014 10:46:58 +0000 Received: by mail-wi0-f172.google.com with SMTP id hi2so9364781wib.17 for ; Wed, 02 Jul 2014 03:46:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=lwg3yQ/CAxJMgEZ15oDM+pT6wYjRis58xLEYnbUOVbo=; b=dZg8U7qK0F7sL9Zii2EzYe9UIF8EQy+y47EIN8QKA7D6EkzuQHM3EGagqniakET8xn EP05KTH0cOMCadD5Hfd/7RhRBwkU9pdEP+SPdHooOHd/3tnPH+PoYSMLof7hxRBWlG0k zvEjybb4RTzKhF7/s5yakoWvEunAFUb/EbEGVwZO6g9LUsC+H4HlaZpfvwNrfIEfIbeZ vpxA+FHOkXhoubpOM2dxOV3rNqItNxiX1lE07vYPFtUICCJ6rjVtywEytqa8XHs91+qk 7jdFYMLyjhgtGPVx4Bs1KOIJ8voyEAHCf5zES7Qn790wzJsPnbnKVnduwTadtsA2VKxO rCbw== X-Gm-Message-State: ALoCoQnYybYiNnmFep46yLAa0SpaqPilTPkVsZyimFhD+ZHGQL8U2/uOCG+EoyNdKg6elTX7X+Tz X-Received: by 10.194.119.34 with SMTP id kr2mr59953178wjb.34.1404297992637; Wed, 02 Jul 2014 03:46:32 -0700 (PDT) Received: from marmot.wormnet.eu (marmot.wormnet.eu. [188.246.204.87]) by mx.google.com with ESMTPSA id bq7sm53870724wib.7.2014.07.02.03.46.31 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Jul 2014 03:46:32 -0700 (PDT) From: Steve Capper To: catalin.marinas@arm.com Subject: [PATCH] arm64: mm: Make icache synchronisation logic huge page aware Date: Wed, 2 Jul 2014 11:46:23 +0100 Message-Id: <1404297983-30840-1-git-send-email-steve.capper@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140702_034658_515755_F20E7E1B X-CRM114-Status: UNSURE ( 9.98 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) Cc: Steve Capper , will.deacon@arm.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The __sync_icache_dcache routine will only flush the dcache for the first page of a compound page, potentially leading to stale icache data residing further on in a hugetlb page. This patch addresses this issue by taking into consideration the order of the page when flushing the dcache. Reported-by: Mark Brown Tested-by: Mark Brown Signed-off-by: Steve Capper --- arch/arm64/mm/flush.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c index e4193e3..0d64089 100644 --- a/arch/arm64/mm/flush.c +++ b/arch/arm64/mm/flush.c @@ -79,7 +79,8 @@ void __sync_icache_dcache(pte_t pte, unsigned long addr) return; if (!test_and_set_bit(PG_dcache_clean, &page->flags)) { - __flush_dcache_area(page_address(page), PAGE_SIZE); + __flush_dcache_area(page_address(page), + PAGE_SIZE << compound_order(page)); __flush_icache_all(); } else if (icache_is_aivivt()) { __flush_icache_all();