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=-15.9 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=ham 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 06A68C2B9F4 for ; Mon, 14 Jun 2021 10:40:58 +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 C45A9615FF for ; Mon, 14 Jun 2021 10:40:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C45A9615FF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.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=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:Reply-To: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:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QrbZw8smSbU/0bJU54k0C7MAlmu3bxSlJj/mcU4SsW8=; b=UhF1uRPAL7x2jZ cYPpaeZe0ti2r7AyjKSMHGd3i+5NkYGUtUrouVOaZbrlU1XAOusEuZPdFZhVBEKXEWI+sR2L50Jef x09rzs6BFTmb/Aq1qeUwfX39AGoHJ5ApIGUMs4BAb2fl8+Oi9AHOz7wI8hxp/xixr5nxdJS0Bt4/d FWYkOaWvhnMh9iAuYpYTgWnOUuZrkFauNkTsIntC6E8Dd9vWswi/aWacxo+MYG3C6Kelxvqh0RTGa Mj9BbzYGauCxfkrjGFZSsIObo4ol0DEjEid0Vvdt5PbwT9/6nAFha47O7h/dVAX0Xh8JqGpfVQCx8 ZY6HuS6raDf7UmoF3lNg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lsk01-00DcHP-N5; Mon, 14 Jun 2021 10:39:21 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lsjzy-00DcGr-Po for linux-arm-kernel@lists.infradead.org; Mon, 14 Jun 2021 10:39:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623667157; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p15eO6Q/nsyt5ogtbEhJQwSJtPnYwhYxamg50YDzj14=; b=ZFo4701na6etvv6vaiG2g7J0EORpS6K9blKdmerwuivPesK2DnAOcdACGKjDX3ogIYT8p0 g0Em5L846LD1+t+CtAI9WTEJLGbR2sFBrPteEJ0kInH3ODk4MHTRzFSC+oU4YFmFKXcoen bRdqne+iRr8nykTvKeJqXPAQTObq/GQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-528-oBXtIZYnO3aw-MJrLLE23w-1; Mon, 14 Jun 2021 06:39:16 -0400 X-MC-Unique: oBXtIZYnO3aw-MJrLLE23w-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0AC7D80DDE2; Mon, 14 Jun 2021 10:39:15 +0000 (UTC) Received: from [10.64.54.47] (vpn2-54-47.bne.redhat.com [10.64.54.47]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1420860871; Mon, 14 Jun 2021 10:39:12 +0000 (UTC) Subject: Re: [PATCH] arm64/mm: Drop SECTION_[SHIFT|SIZE|MASK] To: Anshuman Khandual , linux-arm-kernel@lists.infradead.org Cc: Catalin Marinas , Will Deacon , Mark Rutland , linux-kernel@vger.kernel.org References: <1623658706-7182-1-git-send-email-anshuman.khandual@arm.com> From: Gavin Shan Message-ID: Date: Mon, 14 Jun 2021 22:40:17 +1000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 In-Reply-To: <1623658706-7182-1-git-send-email-anshuman.khandual@arm.com> Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210614_033918_942330_C7C08C84 X-CRM114-Status: GOOD ( 21.39 ) 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: , Reply-To: Gavin Shan Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 6/14/21 6:18 PM, Anshuman Khandual wrote: > SECTION_[SHIFT|SIZE|MASK] are essentially PMD_[SHIFT|SIZE|MASK]. But these > create confusion being similar to generic sparsemem memory sections, which > are derived from SECTION_SIZE_BITS. Section references have always implied > PMD level block mapping. Instead just use all PMD level macros which would > make it explicit and also remove confusion with sparsmem memory sections. > > 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 > --- > This applies on v5.13-rc6. > > arch/arm64/include/asm/kernel-pgtable.h | 4 ++-- > arch/arm64/include/asm/pgtable-hwdef.h | 7 ------- > arch/arm64/mm/mmu.c | 2 +- > 3 files changed, 3 insertions(+), 10 deletions(-) > It does introduce confusion to sparsemem section. The changes look good to me: Reviewed-by: Gavin Shan > diff --git a/arch/arm64/include/asm/kernel-pgtable.h b/arch/arm64/include/asm/kernel-pgtable.h > index d44df9d62fc9..88b8d681ad91 100644 > --- a/arch/arm64/include/asm/kernel-pgtable.h > +++ b/arch/arm64/include/asm/kernel-pgtable.h > @@ -91,8 +91,8 @@ > > /* Initial memory map size */ > #if ARM64_SWAPPER_USES_SECTION_MAPS > -#define SWAPPER_BLOCK_SHIFT SECTION_SHIFT > -#define SWAPPER_BLOCK_SIZE SECTION_SIZE > +#define SWAPPER_BLOCK_SHIFT PMD_SHIFT > +#define SWAPPER_BLOCK_SIZE PMD_SIZE > #define SWAPPER_TABLE_SHIFT PUD_SHIFT > #else > #define SWAPPER_BLOCK_SHIFT PAGE_SHIFT > diff --git a/arch/arm64/include/asm/pgtable-hwdef.h b/arch/arm64/include/asm/pgtable-hwdef.h > index b82575a33f8b..40085e53f573 100644 > --- a/arch/arm64/include/asm/pgtable-hwdef.h > +++ b/arch/arm64/include/asm/pgtable-hwdef.h > @@ -71,13 +71,6 @@ > #define PGDIR_MASK (~(PGDIR_SIZE-1)) > #define PTRS_PER_PGD (1 << (VA_BITS - PGDIR_SHIFT)) > > -/* > - * Section address mask and size definitions. > - */ > -#define SECTION_SHIFT PMD_SHIFT > -#define SECTION_SIZE (_AC(1, UL) << SECTION_SHIFT) > -#define SECTION_MASK (~(SECTION_SIZE-1)) > - > /* > * Contiguous page definitions. > */ > diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c > index 89b66ef43a0f..380771610dd2 100644 > --- a/arch/arm64/mm/mmu.c > +++ b/arch/arm64/mm/mmu.c > @@ -228,7 +228,7 @@ static void init_pmd(pud_t *pudp, unsigned long addr, unsigned long end, > next = pmd_addr_end(addr, end); > > /* try section mapping first */ > - if (((addr | next | phys) & ~SECTION_MASK) == 0 && > + if (((addr | next | phys) & ~PMD_MASK) == 0 && > (flags & NO_BLOCK_MAPPINGS) == 0) { > pmd_set_huge(pmdp, phys, prot); > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel