From patchwork Wed Apr 16 11:46:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Capper X-Patchwork-Id: 28463 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f199.google.com (mail-ie0-f199.google.com [209.85.223.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 492672036A for ; Wed, 16 Apr 2014 11:48:50 +0000 (UTC) Received: by mail-ie0-f199.google.com with SMTP id rl12sf59104849iec.10 for ; Wed, 16 Apr 2014 04:48:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=fvv5El8UT2qZomR5tkDySD4W8xU/smeAqBwwrX6erSs=; b=AVfqGESJD7ztL/hNaodD6SyS8DHPRBEmrDKWlssvFk9vGrqIVaUl/e8DlFEaHBy6VG aaxyPM8+HtdE8Lfb7mPmEwz5VxLWeTnaVr0sGjvsoLAmAwidk44dL4uzPyHXDVeBiHrl T5pAUiUCAj95U+LaTss9MXc2tz50r+6oXHqO0sz4QCoea9TyXC7edr+4YpM8Q8hGw57A sySdQ9tUyKnHZnH8YbGbOXPwEc/jBOSS/m8VGrUxPGiC/1Uzxw+yKyBCi8ZhTLvPM5E5 dMe8fwxuvwadQAfjrhmbTmngnJHv5GOV9HjwBmYVMK7MFnbnix76DtqeQjB64sXNLoE+ WVJg== X-Gm-Message-State: ALoCoQlwANacsLsPaW3mC5FN3Gj9uYAOibvcmxJ1I6ILGbHLFmFiXm7BnazXW1u6KKNMwDMkq5Rs X-Received: by 10.182.65.168 with SMTP id y8mr3705592obs.38.1397648929461; Wed, 16 Apr 2014 04:48:49 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.48.70 with SMTP id n64ls567672qga.19.gmail; Wed, 16 Apr 2014 04:48:49 -0700 (PDT) X-Received: by 10.221.55.133 with SMTP id vy5mr1769643vcb.17.1397648929289; Wed, 16 Apr 2014 04:48:49 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id tv3si3828433vdc.36.2014.04.16.04.48.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 16 Apr 2014 04:48:49 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id ik5so10940805vcb.0 for ; Wed, 16 Apr 2014 04:48:49 -0700 (PDT) X-Received: by 10.52.78.231 with SMTP id e7mr1465891vdx.28.1397648929218; Wed, 16 Apr 2014 04:48:49 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp305569vcb; Wed, 16 Apr 2014 04:48:48 -0700 (PDT) X-Received: by 10.66.66.202 with SMTP id h10mr8025806pat.70.1397648928518; Wed, 16 Apr 2014 04:48:48 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qf4si12581807pbb.266.2014.04.16.04.48.47; Wed, 16 Apr 2014 04:48:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756105AbaDPLr2 (ORCPT + 26 others); Wed, 16 Apr 2014 07:47:28 -0400 Received: from mail-wi0-f169.google.com ([209.85.212.169]:56580 "EHLO mail-wi0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756005AbaDPLq4 (ORCPT ); Wed, 16 Apr 2014 07:46:56 -0400 Received: by mail-wi0-f169.google.com with SMTP id hm4so1188315wib.0 for ; Wed, 16 Apr 2014 04:46:54 -0700 (PDT) X-Received: by 10.180.75.45 with SMTP id z13mr7228609wiv.41.1397648814751; Wed, 16 Apr 2014 04:46:54 -0700 (PDT) Received: from marmot.wormnet.eu (marmot.wormnet.eu. [188.246.204.87]) by mx.google.com with ESMTPSA id mw4sm24116996wib.12.2014.04.16.04.46.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Apr 2014 04:46:54 -0700 (PDT) From: Steve Capper To: linux@arm.linux.org.uk, akpm@linux-foundation.org Cc: will.deacon@arm.com, catalin.marinas@arm.com, robherring2@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, gerald.schaefer@de.ibm.com, Steve Capper Subject: [PATCH V2 3/5] arm: mm: Make mmu_gather aware of huge pages Date: Wed, 16 Apr 2014 12:46:41 +0100 Message-Id: <1397648803-15961-4-git-send-email-steve.capper@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1397648803-15961-1-git-send-email-steve.capper@linaro.org> References: <1397648803-15961-1-git-send-email-steve.capper@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: steve.capper@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Huge pages on short descriptors are arranged as pairs of 1MB sections. We need to be careful and ensure that the TLBs for both sections are flushed when we tlb_add_flush on a HugeTLB page. This patch extends the tlb flush range to HPAGE_SIZE rather than PAGE_SIZE when addresses belonging to huge page VMAs are added to the flush range. Signed-off-by: Steve Capper --- arch/arm/include/asm/tlb.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/asm/tlb.h b/arch/arm/include/asm/tlb.h index 0baf7f0..b2498e6 100644 --- a/arch/arm/include/asm/tlb.h +++ b/arch/arm/include/asm/tlb.h @@ -81,10 +81,17 @@ static inline void tlb_flush(struct mmu_gather *tlb) static inline void tlb_add_flush(struct mmu_gather *tlb, unsigned long addr) { if (!tlb->fullmm) { + unsigned long size = PAGE_SIZE; + if (addr < tlb->range_start) tlb->range_start = addr; - if (addr + PAGE_SIZE > tlb->range_end) - tlb->range_end = addr + PAGE_SIZE; + + if (!config_enabled(CONFIG_ARM_LPAE) && tlb->vma + && is_vm_hugetlb_page(tlb->vma)) + size = HPAGE_SIZE; + + if (addr + size > tlb->range_end) + tlb->range_end = addr + size; } }