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=-16.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 ACAE9C433B4 for ; Tue, 11 May 2021 11:22:02 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 1ED9061625 for ; Tue, 11 May 2021 11:22:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1ED9061625 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:Cc:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=bWAaVSxDA9TUYuxSUhEVtqiFRx4cJoL91ZWAvYpJKJI=; b=em9dPeRSG6uQIKum85VbLMpK1 zhaFXCnKxqhco0NA3bOhGPhVAphOpukoaTZD6KLzVUCL3IN0Lcc9GXPH+J9RD7zOdrd9ktRlo0ywZ S2wBuQtdn3+oR22iBFSMAjePfFX3z7IsKneAvtUHzppvNLTWxODal6ic2Eoakb/U0LMJxKo/Vhn7r QU6W0BKXQE6zI66MUqwyNyDg3VkoIId1n9Z0gsTG0Zy8nDQFSNEoCeCkND7dL3jXbT0VwEDNHDBtO kWaiy2o+ZWKQuFm9McmH2Riea8zqY1jcE+TQn9bh1wWH8TMuTgCivs6xwYXZbt6JBRKqLWAp1j8FH 4c4PbKzEQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lgQQw-00H6c8-QN; Tue, 11 May 2021 11:20:15 +0000 Received: from [2607:7c80:54:e::133] (helo=bombadil.infradead.org) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lgJQX-00GDTj-6A for linux-arm-kernel@desiato.infradead.org; Tue, 11 May 2021 03:51:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To: Subject:Sender:Reply-To:Content-ID:Content-Description; bh=UiPE5DCCx5eZmrcdFXguCXhpFGzhmIdeQC8R5Dur5uE=; b=fAmR/YfZgkCqGz0GghitIZrbHT 4vp0d/7KqeSxzhvG9RsJrgaR1/iqX0RATYg3hfvcdOKK13mMv0TE8iE+Tgp+oIlKQS2Lyv6HjWCwc rghf/HWcLBJ82+C1GCwZlAlBMt7yrT5iq7vfoPq2jzYCSA6XxUP2bFtrDVwT8CABkkf5FmZ6zw+zL 5EbrfU3BIMbpiJSPKxoFuYPq9Tru9hwJzGUDxAjB5jrRvS1CeVbpA6NicstBl3c+9GHxB8f9UAiBS YUNy+9RGC06Y/3Mj9MI6oPjhiqfYkCjSv6WNzIwjJW5mdv2Mg4QWJBo2YGrblnwqBUt+UWkD2yroR /qWZxngA==; Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lgJQP-009Hi8-2D for linux-arm-kernel@lists.infradead.org; Tue, 11 May 2021 03:51:14 +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 75F0A1688; Mon, 10 May 2021 20:51:03 -0700 (PDT) Received: from [192.168.0.130] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CC7BD3F718; Mon, 10 May 2021 20:51:01 -0700 (PDT) Subject: Re: [PATCH] arm64/mm: Remove [PUD|PMD]_TABLE_BIT from [pud|pmd]_bad() To: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org, Catalin Marinas , Will Deacon , linux-kernel@vger.kernel.org References: <1620644871-26280-1-git-send-email-anshuman.khandual@arm.com> <20210510144337.GA92897@C02TD0UTHF1T.local> From: Anshuman Khandual Message-ID: <4a36d7b7-6b27-31cc-d701-ebe3c6e4946e@arm.com> Date: Tue, 11 May 2021 09:21:46 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210510144337.GA92897@C02TD0UTHF1T.local> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210510_205113_232480_5C99303B X-CRM114-Status: GOOD ( 23.68 ) /bin/ln: failed to access 'reaver_cache/texts/20210510_205113_232480_5C99303B': No such file or directory X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210510_205113_232480_5C99303B X-CRM114-Status: GOOD ( 20.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 5/10/21 8:13 PM, Mark Rutland wrote: > On Mon, May 10, 2021 at 04:37:51PM +0530, Anshuman Khandual wrote: >> Semantics wise, [pud|pmd]_bad() have always implied that a given [PUD|PMD] >> entry does not have a pointer to the next level page table. This had been >> made clear in the commit a1c76574f345 ("arm64: mm: use *_sect to check for >> section maps"). Hence explicitly check for a table entry rather than just >> testing a single bit. This basically redefines [pud|pmd]_bad() in terms of >> [pud|pmd]_table() making the semantics clear. >> >> Cc: Catalin Marinas >> Cc: Will Deacon >> Cc: Mark Rutland >> Cc: linux-arm-kernel@lists.infradead.org >> Cc: linux-kernel@vger.kernel.org >> Signed-off-by: Anshuman Khandual > > I have no strong feelings either way, so: > > Acked-by: Mark Rutland > > ... that said, I think that the "bad" naming is unclear and misleading, > and it'd be really nice if we could clean that up treewide with > something clearer than "bad". Agreed, the name is misleading. > > It does seem that would roughly fit p??_leaf() if we had But what if the platform does not support huge page aka leaf mapping at the given level ? Also a non table i.e bad entry might not always mean a leaf/section/huge page mapping, it could simply imply that the entry is not just pointing to next level and might be just in an bad intermediate or invalid state. > p??_clear_leaf() and p??_none_or_clear_leaf() helpers. Could you please elaborate how these new helpers might help define pxx_bad() ? > > Thanks, > Mark. > >> --- >> This applies on v5.13-rc1. >> >> arch/arm64/include/asm/pgtable.h | 5 ++--- >> 1 file changed, 2 insertions(+), 3 deletions(-) >> >> diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h >> index 25f5c04b43ce..69f8183bef29 100644 >> --- a/arch/arm64/include/asm/pgtable.h >> +++ b/arch/arm64/include/asm/pgtable.h >> @@ -509,13 +509,12 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, >> >> #define pmd_none(pmd) (!pmd_val(pmd)) >> >> -#define pmd_bad(pmd) (!(pmd_val(pmd) & PMD_TABLE_BIT)) >> - >> #define pmd_table(pmd) ((pmd_val(pmd) & PMD_TYPE_MASK) == \ >> PMD_TYPE_TABLE) >> #define pmd_sect(pmd) ((pmd_val(pmd) & PMD_TYPE_MASK) == \ >> PMD_TYPE_SECT) >> #define pmd_leaf(pmd) pmd_sect(pmd) >> +#define pmd_bad(pmd) (!pmd_table(pmd)) >> >> #define pmd_leaf_size(pmd) (pmd_cont(pmd) ? CONT_PMD_SIZE : PMD_SIZE) >> #define pte_leaf_size(pte) (pte_cont(pte) ? CONT_PTE_SIZE : PAGE_SIZE) >> @@ -602,7 +601,7 @@ static inline unsigned long pmd_page_vaddr(pmd_t pmd) >> pr_err("%s:%d: bad pmd %016llx.\n", __FILE__, __LINE__, pmd_val(e)) >> >> #define pud_none(pud) (!pud_val(pud)) >> -#define pud_bad(pud) (!(pud_val(pud) & PUD_TABLE_BIT)) >> +#define pud_bad(pud) (!pud_table(pud)) >> #define pud_present(pud) pte_present(pud_pte(pud)) >> #define pud_leaf(pud) pud_sect(pud) >> #define pud_valid(pud) pte_valid(pud_pte(pud)) >> -- >> 2.20.1 >> _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel