linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARC: Use max_high_pfn as a HIGHMEM zone border
@ 2021-04-26 10:10 Vladimir Isaev
  2021-04-26 11:29 ` Mike Rapoport
  0 siblings, 1 reply; 5+ messages in thread
From: Vladimir Isaev @ 2021-04-26 10:10 UTC (permalink / raw)
  To: linux-snps-arc; +Cc: linux-arch, linux-mm, linux-kernel, rppt, Vladimir Isaev

Commit 4af22ded0ecf ("arc: fix memory initialization for systems with two
memory banks") fixed highmem, but not for PAE case when highmem is
actually bigger than lowmem.

Signed-off-by: Vladimir Isaev <isaev@synopsys.com>
Cc: Mike Rapoport <rppt@linux.ibm.com>
---
 arch/arc/mm/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c
index ce07e697916c..59bad6f94105 100644
--- a/arch/arc/mm/init.c
+++ b/arch/arc/mm/init.c
@@ -157,7 +157,7 @@ void __init setup_arch_memory(void)
 	min_high_pfn = PFN_DOWN(high_mem_start);
 	max_high_pfn = PFN_DOWN(high_mem_start + high_mem_sz);
 
-	max_zone_pfn[ZONE_HIGHMEM] = min_low_pfn;
+	max_zone_pfn[ZONE_HIGHMEM] = max_high_pfn;
 
 	high_memory = (void *)(min_high_pfn << PAGE_SHIFT);
 
-- 
2.16.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] ARC: Use max_high_pfn as a HIGHMEM zone border
  2021-04-26 10:10 [PATCH] ARC: Use max_high_pfn as a HIGHMEM zone border Vladimir Isaev
@ 2021-04-26 11:29 ` Mike Rapoport
  2021-04-26 11:55   ` Vladimir Isaev
  0 siblings, 1 reply; 5+ messages in thread
From: Mike Rapoport @ 2021-04-26 11:29 UTC (permalink / raw)
  To: Vladimir Isaev; +Cc: linux-snps-arc, linux-arch, linux-mm, linux-kernel

Hi,

On Mon, Apr 26, 2021 at 01:10:04PM +0300, Vladimir Isaev wrote:
> Commit 4af22ded0ecf ("arc: fix memory initialization for systems with two
> memory banks") fixed highmem, but not for PAE case when highmem is
> actually bigger than lowmem.
> 
> Signed-off-by: Vladimir Isaev <isaev@synopsys.com>
> Cc: Mike Rapoport <rppt@linux.ibm.com>
> ---
>  arch/arc/mm/init.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c
> index ce07e697916c..59bad6f94105 100644
> --- a/arch/arc/mm/init.c
> +++ b/arch/arc/mm/init.c
> @@ -157,7 +157,7 @@ void __init setup_arch_memory(void)
>  	min_high_pfn = PFN_DOWN(high_mem_start);
>  	max_high_pfn = PFN_DOWN(high_mem_start + high_mem_sz);
>  
> -	max_zone_pfn[ZONE_HIGHMEM] = min_low_pfn;
> +	max_zone_pfn[ZONE_HIGHMEM] = max_high_pfn;

This is correct with PAE40, but it will break !PAE40 when "highmem" has
lower addresses than lowmem.

It rather should be something like:

        if (IS_ENABLED(CONFIG_ARC_HAS_PAE40))
                max_zone_pfn[ZONE_HIGHMEM] = max_high_pfn;
        else
            	max_zone_pfn[ZONE_HIGHMEM] = min_low_pfn;


>  
>  	high_memory = (void *)(min_high_pfn << PAGE_SHIFT);
>  
> -- 
> 2.16.2
> 

-- 
Sincerely yours,
Mike.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] ARC: Use max_high_pfn as a HIGHMEM zone border
  2021-04-26 11:29 ` Mike Rapoport
@ 2021-04-26 11:55   ` Vladimir Isaev
  2021-04-26 16:15     ` Mike Rapoport
  0 siblings, 1 reply; 5+ messages in thread
From: Vladimir Isaev @ 2021-04-26 11:55 UTC (permalink / raw)
  To: Mike Rapoport; +Cc: linux-snps-arc, linux-arch, linux-mm, linux-kernel

Hi Mike,

On Mon, April 26, 2021 2:29 PM, Mike Rapoport wrote:
> On Mon, Apr 26, 2021 at 01:10:04PM +0300, Vladimir Isaev wrote:
> > -	max_zone_pfn[ZONE_HIGHMEM] = min_low_pfn;
> > +	max_zone_pfn[ZONE_HIGHMEM] = max_high_pfn;
> 
> This is correct with PAE40, but it will break !PAE40 when "highmem" has lower
> addresses than lowmem.
> 
> It rather should be something like:
> 
>         if (IS_ENABLED(CONFIG_ARC_HAS_PAE40))
>                 max_zone_pfn[ZONE_HIGHMEM] = max_high_pfn;
>         else
>             	max_zone_pfn[ZONE_HIGHMEM] = min_low_pfn;
> 

Not sure if I understand why we should have min_low_pfn here. In !PAE40 case max_high_pfn just will be smaller than min_low_pfn.

Thank you,
Vladimir Isaev

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ARC: Use max_high_pfn as a HIGHMEM zone border
  2021-04-26 11:55   ` Vladimir Isaev
@ 2021-04-26 16:15     ` Mike Rapoport
  2021-04-26 16:31       ` Vineet Gupta
  0 siblings, 1 reply; 5+ messages in thread
From: Mike Rapoport @ 2021-04-26 16:15 UTC (permalink / raw)
  To: Vladimir Isaev; +Cc: linux-snps-arc, linux-arch, linux-mm, linux-kernel

On Mon, Apr 26, 2021 at 11:55:00AM +0000, Vladimir Isaev wrote:
> Hi Mike,
> 
> On Mon, April 26, 2021 2:29 PM, Mike Rapoport wrote:
> > On Mon, Apr 26, 2021 at 01:10:04PM +0300, Vladimir Isaev wrote:
> > > -	max_zone_pfn[ZONE_HIGHMEM] = min_low_pfn;
> > > +	max_zone_pfn[ZONE_HIGHMEM] = max_high_pfn;
> > 
> > This is correct with PAE40, but it will break !PAE40 when "highmem" has lower
> > addresses than lowmem.
> > 
> > It rather should be something like:
> > 
> >         if (IS_ENABLED(CONFIG_ARC_HAS_PAE40))
> >                 max_zone_pfn[ZONE_HIGHMEM] = max_high_pfn;
> >         else
> >             	max_zone_pfn[ZONE_HIGHMEM] = min_low_pfn;
> > 
> 
> Not sure if I understand why we should have min_low_pfn here. In !PAE40
> case max_high_pfn just will be smaller than min_low_pfn.

Hmm, actually, you are right. This should be fine.

-- 
Sincerely yours,
Mike.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ARC: Use max_high_pfn as a HIGHMEM zone border
  2021-04-26 16:15     ` Mike Rapoport
@ 2021-04-26 16:31       ` Vineet Gupta
  0 siblings, 0 replies; 5+ messages in thread
From: Vineet Gupta @ 2021-04-26 16:31 UTC (permalink / raw)
  To: Mike Rapoport, Vladimir Isaev
  Cc: linux-snps-arc, linux-arch, linux-mm, linux-kernel

On 4/26/21 9:15 AM, Mike Rapoport wrote:
> On Mon, Apr 26, 2021 at 11:55:00AM +0000, Vladimir Isaev wrote:
>> Hi Mike,
>>
>> On Mon, April 26, 2021 2:29 PM, Mike Rapoport wrote:
>>> On Mon, Apr 26, 2021 at 01:10:04PM +0300, Vladimir Isaev wrote:
>>>> -	max_zone_pfn[ZONE_HIGHMEM] = min_low_pfn;
>>>> +	max_zone_pfn[ZONE_HIGHMEM] = max_high_pfn;
>>> This is correct with PAE40, but it will break !PAE40 when "highmem" has lower
>>> addresses than lowmem.
>>>
>>> It rather should be something like:
>>>
>>>          if (IS_ENABLED(CONFIG_ARC_HAS_PAE40))
>>>                  max_zone_pfn[ZONE_HIGHMEM] = max_high_pfn;
>>>          else
>>>              	max_zone_pfn[ZONE_HIGHMEM] = min_low_pfn;
>>>
>> Not sure if I understand why we should have min_low_pfn here. In !PAE40
>> case max_high_pfn just will be smaller than min_low_pfn.
> Hmm, actually, you are right. This should be fine.

But still worth adding a comment. If this could trip the person who did 
the massive cross-arch rework then I don't know what mere mortals would 
run into ;-)

-Vineet

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-04-26 16:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-26 10:10 [PATCH] ARC: Use max_high_pfn as a HIGHMEM zone border Vladimir Isaev
2021-04-26 11:29 ` Mike Rapoport
2021-04-26 11:55   ` Vladimir Isaev
2021-04-26 16:15     ` Mike Rapoport
2021-04-26 16:31       ` Vineet Gupta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).