From patchwork Sat Feb 23 20:04:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Imre Deak X-Patchwork-Id: 15044 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 9E63623E52 for ; Sat, 23 Feb 2013 20:04:26 +0000 (UTC) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by fiordland.canonical.com (Postfix) with ESMTP id 3E6FAA1898F for ; Sat, 23 Feb 2013 20:04:26 +0000 (UTC) Received: by mail-ve0-f169.google.com with SMTP id 15so1415709vea.14 for ; Sat, 23 Feb 2013 12:04:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-extloop1:x-ironport-av:message-id:from:to:date :in-reply-to:references:x-mailer:mime-version:cc:subject:x-beenthere :x-mailman-version:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:content-type :content-transfer-encoding:sender:errors-to:x-gm-message-state; bh=YIeIR8oloJFqfDcvdxq+gYffyQBPfcHAN9M3oKC47hs=; b=NGPHcC2PKQ8qezdRL+fPUas6TYvhWSri72C0S3fu2dn/m30d5DqxHLdQJYE8YYA32B Tn4c9leaghV8VZGHRrcfK4KyRLmA4/xc36Exo8bg/4BwOmkjmMVdN1/UTGX/tJJvkGds s2laeU+gqVMUbP7R+k2CAan95H1W8/Xtrw0yveTqKfSHUrCd4VHPBLnDIEn+HBA5CCfc HjTQlcxVfPO7pnqJ3sonZB4P/UnZqNrtZ/tYdL6HsY7lmBITvVUZpZ2xkem35k/dW9qv luRh7BpjU+nYLRZs9Dn9nTNDQt7xZOzTVbUFaca6a00wkrnHyyzsKr8itY7CJHoM43LW cOZw== X-Received: by 10.220.149.82 with SMTP id s18mr7908291vcv.14.1361649865504; Sat, 23 Feb 2013 12:04:25 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.145.101 with SMTP id st5csp146057veb; Sat, 23 Feb 2013 12:04:24 -0800 (PST) X-Received: by 10.14.3.70 with SMTP id 46mr21274710eeg.2.1361649863926; Sat, 23 Feb 2013 12:04:23 -0800 (PST) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id g8si12796255eem.147.2013.02.23.12.04.22; Sat, 23 Feb 2013 12:04:23 -0800 (PST) Received-SPF: neutral (google.com: 91.189.95.16 is neither permitted nor denied by best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org) client-ip=91.189.95.16; Authentication-Results: mx.google.com; spf=neutral (google.com: 91.189.95.16 is neither permitted nor denied by best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org) smtp.mail=linaro-mm-sig-bounces@lists.linaro.org Received: from localhost ([127.0.0.1] helo=mombin.canonical.com) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1U9LKU-0000Dq-KE; Sat, 23 Feb 2013 20:04:18 +0000 Received: from mga14.intel.com ([143.182.124.37]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1U9LKS-0000Dl-F6 for linaro-mm-sig@lists.linaro.org; Sat, 23 Feb 2013 20:04:16 +0000 Received: from azsmga002.ch.intel.com ([10.2.17.35]) by azsmga102.ch.intel.com with ESMTP; 23 Feb 2013 12:04:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,723,1355126400"; d="scan'208";a="205628707" Received: from unknown (HELO [10.252.120.83]) ([10.252.120.83]) by AZSMGA002.ch.intel.com with ESMTP; 23 Feb 2013 12:04:08 -0800 Message-ID: <1361649846.4025.28.camel@ideak-mobl> From: Imre Deak To: Stephen Warren Date: Sat, 23 Feb 2013 22:04:06 +0200 In-Reply-To: <51284595.5040903@wwwdotorg.org> References: <1360768224-18163-1-git-send-email-imre.deak@intel.com> <1360768224-18163-2-git-send-email-imre.deak@intel.com> <51284595.5040903@wwwdotorg.org> X-Mailer: Evolution 3.6.2-0ubuntu0.1 Mime-Version: 1.0 Cc: Maxim Levitsky , linux-kernel@vger.kernel.org, linaro-mm-sig@lists.linaro.org, "linux-next@vger.kernel.org" , Tejun Heo , Andrew Morton Subject: Re: [Linaro-mm-sig] [PATCH v3 2/2] lib/scatterlist: use page iterator in the mapping iterator X-BeenThere: linaro-mm-sig@lists.linaro.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Unified memory management interest group." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linaro-mm-sig-bounces@lists.linaro.org Errors-To: linaro-mm-sig-bounces@lists.linaro.org X-Gm-Message-State: ALoCoQkYPOHrRCXCFEc4Y+uboCAjOe9I2jgiVAFcFRt6P8/ymdNTblofw3DfmwMHW8AyZpuLd2SE On Fri, 2013-02-22 at 21:29 -0700, Stephen Warren wrote: > On 02/13/2013 08:10 AM, Imre Deak wrote: > > For better code reuse use the newly added page iterator to iterate > > through the pages. The offset, length within the page is still > > calculated by the mapping iterator as well as the actual mapping. > > Idea from Tejun Heo . > > This patch appears in linux-next since next-20130220. It breaks mounting > a root filesystem on an SD card on the Raspberry Pi ARM platform, with > errors such as those shown below. > > next-20130222 with just this patch reverted works fine. Thanks for tracking this down. I noticed now an obvious mistake I've made, not limiting the mapping size to page size :/ I didn't hit it since it only causes a problem when the user of miter modifies miter->consumed and I think nothing does this on my machine. Since the sdhci driver on Raspberry Pi does this the following might fix the problem you saw. Could you give it a try? It applies on top of v4 of the patch [1]: --Imre [1] http://lists.linaro.org/pipermail/linaro-mm-sig/2013-February/003069.html diff --git a/lib/scatterlist.c b/lib/scatterlist.c index 2645acf..b83c144 100644 --- a/lib/scatterlist.c +++ b/lib/scatterlist.c @@ -493,6 +493,8 @@ bool sg_miter_next(struct sg_mapping_iter *miter) miter->__offset = pgoffset ? 0 : sg->offset; miter->__remaining = sg->offset + sg->length - (pgoffset << PAGE_SHIFT) - miter->__offset; + miter->__remaining = min_t(unsigned long, miter->__remaining, + PAGE_SIZE - miter->__offset); } miter->page = miter->piter.page; miter->consumed = miter->length = miter->__remaining;