From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C2B2C433E0 for ; Fri, 12 Jun 2020 10:25:31 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0C45520792 for ; Fri, 12 Jun 2020 10:25:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="bLqqpeQw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0C45520792 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tUVGruN7u/SZJuNxPB8BZ8xkHcyRnCpeIUD9oG+Uk5M=; b=bLqqpeQw3luC9m lkZ/jBoGiU+cg2xal0RgQx3EP3Os7wUk72uE/s+JpC7BmAtTGfn5ZzkHl5RCOhEHRq/4g3csHdvn9 8jwj6a58MjaCt8j8bcOQxESiQH9PSuF7LSaDvXt3uLer8tSiTNCZhTv7JzMLCyKTgPlOitt32DpVj IDVlDvjqYI/ngxqupzzeL7pT3vqQeDjRSCB/w+XuxptMsB1CNvGf8Y5An4Szh5HsvwZHpoZD7BLoA az6OTTI6rZ3e5UhDWJTcC/fo0g5dR02ezXgeb9RXqk780Yb5hbkQXaOXarwd/BzNn7ik14wHplvS3 a/9F/8WG6z37rCvQ54bQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jjgsH-00005B-Py; Fri, 12 Jun 2020 10:25:25 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jjgsE-0008WL-Mi for linux-arm-kernel@lists.infradead.org; Fri, 12 Jun 2020 10:25:24 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B9A5531B; Fri, 12 Jun 2020 03:25:19 -0700 (PDT) Received: from gaia (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E2EC03F73C; Fri, 12 Jun 2020 03:25:18 -0700 (PDT) Date: Fri, 12 Jun 2020 11:25:16 +0100 From: Catalin Marinas To: Arnd Bergmann Subject: Re: [PATCH v2 4/6] ARM: mm: Aligned pte allocation to one page Message-ID: <20200612102516.GB4180@gaia> References: <20200611134914.765827-1-gregory.clement@bootlin.com> <20200611134914.765827-5-gregory.clement@bootlin.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200612_032522_782674_EAC570AC X-CRM114-Status: GOOD ( 16.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linux ARM , Gregory CLEMENT , Russell King , Thomas Petazzoni Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Jun 12, 2020 at 10:37:15AM +0200, Arnd Bergmann wrote: > On Thu, Jun 11, 2020 at 3:49 PM Gregory CLEMENT > wrote: > > In pte_offset_kernel() the pte_index macro is used. This macro makes > > the assumption that the address is aligned to a page size. > > > > In arm_pte_allocation, the size allocated is the size needed for 512 > > entries. Actually this size was calculated to fit in a 4K page. When > > using larger page, the size of the table allocated is no more > > aligned which end to give a wrong physical address. > > > > The solution is to round up the allocation to a page size instead of > > the exact size of the tables (which is 4KB). It allows to comply with > > the assumption of pte_index() but the drawback is a waste of memory > > for the early allocation if page size is bigger than 4KB. > > Have you considered increasing PTRS_PER_PTE instead to fill up > a logical page instead? If that doesn't work, can you explain here > why not? >From what I remember, increasing the PTRS_PER_PTE also requires changing the pgd_t array to cover them. As a side-effect, {PMD,PGDIR}_SHIFT would need to increase. cpu_v7_set_pte_ext() also needs to take care of the software pte offset (hard-coded at 2048 now). Many years ago I had some patches to get rid of the software pte offset but it wasn't really worth the maintenance hassle (only possible for ARMv6/7). I'm not even sure it's feasible now if we gained more L_PTE_* bits in the meantime. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel