From patchwork Thu May 23 15:31:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Capper X-Patchwork-Id: 2607881 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork2.kernel.org (Postfix) with ESMTP id 2958CDFB78 for ; Thu, 23 May 2013 15:33:47 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UfXVZ-00040L-3d; Thu, 23 May 2013 15:32:50 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UfXV2-0000ai-Hn; Thu, 23 May 2013 15:32:16 +0000 Received: from mail-wi0-x233.google.com ([2a00:1450:400c:c05::233]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UfXUf-0000XZ-Pu for linux-arm-kernel@lists.infradead.org; Thu, 23 May 2013 15:31:55 +0000 Received: by mail-wi0-f179.google.com with SMTP id hq7so2159984wib.0 for ; Thu, 23 May 2013 08:31:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=yMRp6DqyadI+R7o8GRoUhwPynV91kcdDpcysP8MKPb4=; b=bwN5hySx/FxbnKtngdKDm6gxxyvd6V/vEImki7i25PpHKPQ/WRqb9QNGNs5B2G5owT sb1Ej2T4uZxjDKOgHmlT0kDm0gAW2RXWe0P9QrznbCXW2ev8sfmBIal1sq12GUf2y1jL em8UowSLODiGP7+rQtNUw7LuxRw09glaFJ2JLitDDwPe/eUusBeQ63WarvdIRALBEsZt xihFN9xhwsKFGUhczjw2KJdGcC5l2scgXE6XRMxbwXR2rNdEXzt2s7DCsrw3wNblYGIA VKgR7DDECvws8/TJQcCmJdUTDsnPlHuZsAszSxCbLsji3g2Fws7cX2qs1i6/IfmEil3K B01w== X-Received: by 10.180.185.207 with SMTP id fe15mr25437163wic.33.1369323092021; Thu, 23 May 2013 08:31:32 -0700 (PDT) Received: from localhost.localdomain (marmot.wormnet.eu. [188.246.204.87]) by mx.google.com with ESMTPSA id b11sm36416484wiv.10.2013.05.23.08.31.31 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 23 May 2013 08:31:31 -0700 (PDT) From: Steve Capper To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 2/4] ARM: mm: Add support for flushing HugeTLB pages. Date: Thu, 23 May 2013 16:31:18 +0100 Message-Id: <1369323080-9673-3-git-send-email-steve.capper@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1369323080-9673-1-git-send-email-steve.capper@linaro.org> References: <1369323080-9673-1-git-send-email-steve.capper@linaro.org> X-Gm-Message-State: ALoCoQk/EjI3hnB0VBMb1ClG+573skPlgOetyjGjWeKfc6cCv3u8NLT51ICNLXJxOw8SlU3RPMVf X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130523_113154_039071_7F1118D9 X-CRM114-Status: GOOD ( 13.95 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Steve Capper , will.deacon@arm.com, patches@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 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 On ARM we use the __flush_dcache_page function to flush the dcache of pages when needed; usually when the PG_dcache_clean bit is unset and we are setting a PTE. A HugeTLB page is represented as a compound page consisting of an array of pages. Thus to flush the dcache of a HugeTLB page, one must flush more than a single page. This patch modifies __flush_dcache_page such that all constituent pages of a HugeTLB page are flushed. Signed-off-by: Steve Capper Reviewed-by: Will Deacon Reviewed-by: Catalin Marinas --- arch/arm/mm/flush.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/arch/arm/mm/flush.c b/arch/arm/mm/flush.c index 0d473cc..3706407 100644 --- a/arch/arm/mm/flush.c +++ b/arch/arm/mm/flush.c @@ -17,6 +17,7 @@ #include #include #include +#include #include "mm.h" @@ -168,19 +169,23 @@ void __flush_dcache_page(struct address_space *mapping, struct page *page) * coherent with the kernels mapping. */ if (!PageHighMem(page)) { - __cpuc_flush_dcache_area(page_address(page), PAGE_SIZE); + size_t page_size = PAGE_SIZE << compound_order(page); + __cpuc_flush_dcache_area(page_address(page), page_size); } else { - void *addr; - + unsigned long i; if (cache_is_vipt_nonaliasing()) { - addr = kmap_atomic(page); - __cpuc_flush_dcache_area(addr, PAGE_SIZE); - kunmap_atomic(addr); - } else { - addr = kmap_high_get(page); - if (addr) { + for (i = 0; i < (1 << compound_order(page)); i++) { + void *addr = kmap_atomic(page); __cpuc_flush_dcache_area(addr, PAGE_SIZE); - kunmap_high(page); + kunmap_atomic(addr); + } + } else { + for (i = 0; i < (1 << compound_order(page)); i++) { + void *addr = kmap_high_get(page); + if (addr) { + __cpuc_flush_dcache_area(addr, PAGE_SIZE); + kunmap_high(page); + } } } }