All of lore.kernel.org
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: linux-arm-kernel@lists.infradead.org,
	Will Deacon <will@kernel.org>,
	linux-kernel@vger.kernel.org, Mark Rutland <mark.rutland@arm.com>
Subject: Re: [PATCH V2] arm64/mm: Drop <asm/page-def.h>
Date: Wed, 1 Sep 2021 14:28:14 +0100	[thread overview]
Message-ID: <YS9/7mE+5uieqKh8@arm.com> (raw)
In-Reply-To: <84b647b6-9cee-5aad-78f8-7bc253300534@arm.com>

On Tue, Aug 31, 2021 at 09:15:30AM +0530, Anshuman Khandual wrote:
> On 8/21/21 12:05 AM, Catalin Marinas wrote:
> > On Fri, Aug 20, 2021 at 04:35:16PM +0530, Anshuman Khandual wrote:
> >> PAGE_SHIFT (PAGE_SIZE and PAGE_MASK) which is derived from ARM64_PAGE_SHIFT
> >> should be moved into <asm/page.h> instead like in case for other platforms,
> >> and then subsequently <asm/page-def.h> can be just dropped off completely.
> > 
> > These were moved to page-def.h as part of commit b6531456ba27 ("arm64:
> > factor out PAGE_* and CONT_* definitions") to avoid some circular header
> > dependencies.
> > 
> >> diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
> >> index 824a3655dd93..649d26396f9e 100644
> >> --- a/arch/arm64/include/asm/memory.h
> >> +++ b/arch/arm64/include/asm/memory.h
> >> @@ -12,7 +12,7 @@
> >>  
> >>  #include <linux/const.h>
> >>  #include <linux/sizes.h>
> >> -#include <asm/page-def.h>
> >> +#include <asm/page.h>
> > 
> > In 5.14-rc3, asm/page.h still includes asm/memory.h.
> 
> Dropping <asm/memory.h> from <asm/page.h> does not seem to cause
> any problem, will change that. Afterwards build tested it across
> page sizes and also with some random configs. Is that circular
> dependency still present ? Also wondering why was <asm/memory.h>
> included in <asm/page.h> to begin with ?

asm/memory.h is not included by any of the generic files, however it has
essential definitions like PAGE_OFFSET, THREAD_SIZE. The expectations
from the arch code is to have these defined in asm/page.h (see the
asm-generic/page.h), hence the inclusion. It probably gets included by
other arch headers and that's why you don't get any errors, but I
wouldn't rely on this.

I don't remember how we ended up with a separate memory.h file. On arm64
we inherited it from arch/arm.

-- 
Catalin

WARNING: multiple messages have this Message-ID (diff)
From: Catalin Marinas <catalin.marinas@arm.com>
To: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: linux-arm-kernel@lists.infradead.org,
	Will Deacon <will@kernel.org>,
	linux-kernel@vger.kernel.org, Mark Rutland <mark.rutland@arm.com>
Subject: Re: [PATCH V2] arm64/mm: Drop <asm/page-def.h>
Date: Wed, 1 Sep 2021 14:28:14 +0100	[thread overview]
Message-ID: <YS9/7mE+5uieqKh8@arm.com> (raw)
In-Reply-To: <84b647b6-9cee-5aad-78f8-7bc253300534@arm.com>

On Tue, Aug 31, 2021 at 09:15:30AM +0530, Anshuman Khandual wrote:
> On 8/21/21 12:05 AM, Catalin Marinas wrote:
> > On Fri, Aug 20, 2021 at 04:35:16PM +0530, Anshuman Khandual wrote:
> >> PAGE_SHIFT (PAGE_SIZE and PAGE_MASK) which is derived from ARM64_PAGE_SHIFT
> >> should be moved into <asm/page.h> instead like in case for other platforms,
> >> and then subsequently <asm/page-def.h> can be just dropped off completely.
> > 
> > These were moved to page-def.h as part of commit b6531456ba27 ("arm64:
> > factor out PAGE_* and CONT_* definitions") to avoid some circular header
> > dependencies.
> > 
> >> diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
> >> index 824a3655dd93..649d26396f9e 100644
> >> --- a/arch/arm64/include/asm/memory.h
> >> +++ b/arch/arm64/include/asm/memory.h
> >> @@ -12,7 +12,7 @@
> >>  
> >>  #include <linux/const.h>
> >>  #include <linux/sizes.h>
> >> -#include <asm/page-def.h>
> >> +#include <asm/page.h>
> > 
> > In 5.14-rc3, asm/page.h still includes asm/memory.h.
> 
> Dropping <asm/memory.h> from <asm/page.h> does not seem to cause
> any problem, will change that. Afterwards build tested it across
> page sizes and also with some random configs. Is that circular
> dependency still present ? Also wondering why was <asm/memory.h>
> included in <asm/page.h> to begin with ?

asm/memory.h is not included by any of the generic files, however it has
essential definitions like PAGE_OFFSET, THREAD_SIZE. The expectations
from the arch code is to have these defined in asm/page.h (see the
asm-generic/page.h), hence the inclusion. It probably gets included by
other arch headers and that's why you don't get any errors, but I
wouldn't rely on this.

I don't remember how we ended up with a separate memory.h file. On arm64
we inherited it from arch/arm.

-- 
Catalin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-09-01 13:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-20 11:05 [PATCH V2] arm64/mm: Drop <asm/page-def.h> Anshuman Khandual
2021-08-20 11:05 ` Anshuman Khandual
2021-08-20 18:35 ` Catalin Marinas
2021-08-20 18:35   ` Catalin Marinas
2021-08-31  3:45   ` Anshuman Khandual
2021-08-31  3:45     ` Anshuman Khandual
2021-09-01 13:28     ` Catalin Marinas [this message]
2021-09-01 13:28       ` Catalin Marinas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YS9/7mE+5uieqKh8@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=anshuman.khandual@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.