From patchwork Tue Oct 28 11:44:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 39656 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f69.google.com (mail-ee0-f69.google.com [74.125.83.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5A05124026 for ; Tue, 28 Oct 2014 11:45:55 +0000 (UTC) Received: by mail-ee0-f69.google.com with SMTP id c13sf577036eek.8 for ; Tue, 28 Oct 2014 04:45:54 -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=8nWq9m5XzNsGwMC9wuNjJWzsJYOow8V5B5kK89MnoJE=; b=boTePnbNL57gRVhPgjU/QVQ31IxDeunANi0BMDjxX3a3VNBIJVREnRLYFL1B5YVAxe W14NcujdmBFBILgDLWgXj+tLIuUQFssQPCxjfypV8hUG9Q/mdPOYbR4YSJiRg20CbZZt ESnCg6sdCOh6/HpqEnxI1dVGDcbI7sz/Vqw1UTF9BVwLobUaKe685CRi3UGwmxFhM8g9 u/bIIrrtOh1s4aAe4FDRSQl+YhKmTGiDF2BeAUAO24dTPoxifMrXrIFtTHeeSmHpQq8H bOkcQdKmhLVJfMINHz638rEi/FG/yuum1X4akS6W0kRS3aSlM3DQ7xIbevNHebjpAAdJ QrPA== X-Gm-Message-State: ALoCoQknvF+0K4Fb6hpzTLSlhlVCbp+3Ji5g0VEvs7hXmJqgVt1KhMEgXEUfJ+AQOrWbU71JY5J5 X-Received: by 10.152.27.38 with SMTP id q6mr473072lag.5.1414496754101; Tue, 28 Oct 2014 04:45:54 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.170.227 with SMTP id ap3ls56694lac.31.gmail; Tue, 28 Oct 2014 04:45:53 -0700 (PDT) X-Received: by 10.112.254.162 with SMTP id aj2mr3422865lbd.70.1414496753782; Tue, 28 Oct 2014 04:45:53 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id sd8si2131605lbb.36.2014.10.28.04.45.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 28 Oct 2014 04:45:53 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by mail-la0-f54.google.com with SMTP id gm9so435046lab.13 for ; Tue, 28 Oct 2014 04:45:53 -0700 (PDT) X-Received: by 10.112.97.135 with SMTP id ea7mr3425042lbb.46.1414496753548; Tue, 28 Oct 2014 04:45:53 -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.112.84.229 with SMTP id c5csp462479lbz; Tue, 28 Oct 2014 04:45:52 -0700 (PDT) X-Received: by 10.70.118.1 with SMTP id ki1mr2881923pdb.69.1414496751997; Tue, 28 Oct 2014 04:45:51 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pu3si1078090pdb.150.2014.10.28.04.45.51 for ; Tue, 28 Oct 2014 04:45:51 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752948AbaJ1LpK (ORCPT + 26 others); Tue, 28 Oct 2014 07:45:10 -0400 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]:33023 "EHLO cam-admin0.cambridge.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750900AbaJ1LpI (ORCPT ); Tue, 28 Oct 2014 07:45:08 -0400 Received: from edgewater-inn.cambridge.arm.com (edgewater-inn.cambridge.arm.com [10.1.203.204]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id s9SBiNwo009662; Tue, 28 Oct 2014 11:44:23 GMT Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id B48521AE0281; Tue, 28 Oct 2014 11:44:26 +0000 (GMT) From: Will Deacon To: torvalds@linux-foundation.org, peterz@infradead.org Cc: linux-kernel@vger.kernel.org, linux@arm.linux.org.uk, benh@kernel.crashing.org, Will Deacon Subject: [RFC PATCH 1/2] zap_pte_range: update addr when forcing flush after TLB batching faiure Date: Tue, 28 Oct 2014 11:44:21 +0000 Message-Id: <1414496662-25202-2-git-send-email-will.deacon@arm.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1414496662-25202-1-git-send-email-will.deacon@arm.com> References: <1414496662-25202-1-git-send-email-will.deacon@arm.com> 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: will.deacon@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) 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: , When unmapping a range of pages in zap_pte_range, the page being unmapped is added to an mmu_gather_batch structure for asynchronous freeing. If we run out of space in the batch structure before the range has been completely unmapped, then we break out of the loop, force a TLB flush and free the pages that we have batched so far. If there are further pages to unmap, then we resume the loop where we left off. Unfortunately, we forget to update addr when we break out of the loop, which causes us to truncate the range being invalidated as the end address is exclusive. When we re-enter the loop at the same address, the page has already been freed and the pte_present test will fail, meaning that we do not reconsider the address for invalidation. This patch fixes the problem by incrementing addr by the PAGE_SIZE before breaking out of the loop on batch failure. Signed-off-by: Will Deacon --- mm/memory.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/memory.c b/mm/memory.c index 1cc6bfbd872e..3e503831e042 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1147,6 +1147,7 @@ again: print_bad_pte(vma, addr, ptent, page); if (unlikely(!__tlb_remove_page(tlb, page))) { force_flush = 1; + addr += PAGE_SIZE; break; } continue;