linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: Avoid overlap the fixmap area on i386
@ 2014-10-23 15:36 Minfei Huang
  2014-10-28 11:06 ` Thomas Gleixner
  2014-10-28 11:24 ` [tip:x86/mm] x86/mm: " tip-bot for Minfei Huang
  0 siblings, 2 replies; 7+ messages in thread
From: Minfei Huang @ 2014-10-23 15:36 UTC (permalink / raw)
  To: tglx, mingo, hpa; +Cc: x86, linux-kernel

From: Minfei Huang <mnfhuang@gmail.com>

It is a problem when configuring high memory off where the vmalloc
reserve area could end up overlapping the early_ioremap fixmap
area on i386.

The ordering of the VMALLOC_RESERVE space is:
FIXADDR_TOP
                       fixed_addresses
FIXADDR_START
                       early_ioremap fixed addresses
FIXADDR_BOOT_START
                       Persistent kmap area
PKMAP_BASE
VMALLOC_END
                       Vmalloc area
VMALLOC_START
high_memory

The available address we can use is lower than FIXADDR_BOOT_START. So
We will set the kmap boundary below the FIXADDR_BOOT_START, if configure
the high memory.

If we configure the high memory, the vmalloc reserve area should end
up to PKMAP_BASE, otherwise should end up to FIXADDR_BOOT_START.

Signed-off-by: Minfei Huang <mnfhuang@gmail.com>
---
arch/x86/include/asm/pgtable_32_types.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/pgtable_32_types.h b/arch/x86/include/asm/pgtable_32_types.h
index ed5903b..2ac5fc8 100644
--- a/arch/x86/include/asm/pgtable_32_types.h
+++ b/arch/x86/include/asm/pgtable_32_types.h
@@ -43,7 +43,7 @@ extern bool __vmalloc_start_set; /* set once high_memory is set */
#ifdef CONFIG_HIGHMEM
# define VMALLOC_END	(PKMAP_BASE - 2 * PAGE_SIZE)
#else
-# define VMALLOC_END	(FIXADDR_START - 2 * PAGE_SIZE)
+# define VMALLOC_END	(FIXADDR_BOOT_START - 2 * PAGE_SIZE)
#endif

#define MODULES_VADDR	VMALLOC_START
-- 
1.8.3.1

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

* Re: [PATCH] mm: Avoid overlap the fixmap area on i386
  2014-10-23 15:36 [PATCH] mm: Avoid overlap the fixmap area on i386 Minfei Huang
@ 2014-10-28 11:06 ` Thomas Gleixner
  2014-10-28 17:24   ` H. Peter Anvin
  2014-10-28 11:24 ` [tip:x86/mm] x86/mm: " tip-bot for Minfei Huang
  1 sibling, 1 reply; 7+ messages in thread
From: Thomas Gleixner @ 2014-10-28 11:06 UTC (permalink / raw)
  To: Minfei Huang; +Cc: mingo, hpa, x86, linux-kernel

On Thu, 23 Oct 2014, Minfei Huang wrote:

> From: Minfei Huang <mnfhuang@gmail.com>
> 
> It is a problem when configuring high memory off where the vmalloc
> reserve area could end up overlapping the early_ioremap fixmap
> area on i386.
> 
> The ordering of the VMALLOC_RESERVE space is:
> FIXADDR_TOP
>                        fixed_addresses
> FIXADDR_START
>                        early_ioremap fixed addresses
> FIXADDR_BOOT_START
>                        Persistent kmap area
> PKMAP_BASE
> VMALLOC_END
>                        Vmalloc area
> VMALLOC_START
> high_memory
> 
> The available address we can use is lower than FIXADDR_BOOT_START. So
> We will set the kmap boundary below the FIXADDR_BOOT_START, if configure
> the high memory.
> 
> If we configure the high memory, the vmalloc reserve area should end
> up to PKMAP_BASE, otherwise should end up to FIXADDR_BOOT_START.

Which is not really a problem, because the FIXADDR_BOOT area is only
used during boot for early_ioremap() and it's unused when ioremap() is
functional. vmalloc becomes available after early boot so the
FIXADDR_BOOT area is available for reuse.

Though in the highmem case the PKMAP area is not overlapping the
FIXADDR_BOOT area. So having the !highmem case use the same layout
(minus the PKMAP area) makes sense.

Acked-by: Thomas Gleixner <tglx@linutronix.de>

> Signed-off-by: Minfei Huang <mnfhuang@gmail.com>
> ---
> arch/x86/include/asm/pgtable_32_types.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/include/asm/pgtable_32_types.h b/arch/x86/include/asm/pgtable_32_types.h
> index ed5903b..2ac5fc8 100644
> --- a/arch/x86/include/asm/pgtable_32_types.h
> +++ b/arch/x86/include/asm/pgtable_32_types.h
> @@ -43,7 +43,7 @@ extern bool __vmalloc_start_set; /* set once high_memory is set */
> #ifdef CONFIG_HIGHMEM
> # define VMALLOC_END	(PKMAP_BASE - 2 * PAGE_SIZE)
> #else
> -# define VMALLOC_END	(FIXADDR_START - 2 * PAGE_SIZE)
> +# define VMALLOC_END	(FIXADDR_BOOT_START - 2 * PAGE_SIZE)
> #endif
> 
> #define MODULES_VADDR	VMALLOC_START
> -- 
> 1.8.3.1

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

* [tip:x86/mm] x86/mm: Avoid overlap the fixmap area on i386
  2014-10-23 15:36 [PATCH] mm: Avoid overlap the fixmap area on i386 Minfei Huang
  2014-10-28 11:06 ` Thomas Gleixner
@ 2014-10-28 11:24 ` tip-bot for Minfei Huang
  1 sibling, 0 replies; 7+ messages in thread
From: tip-bot for Minfei Huang @ 2014-10-28 11:24 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: tglx, mingo, torvalds, mnfhuang, hpa, linux-kernel

Commit-ID:  96e70f83285676d8794f62f3c294d0247bef6b21
Gitweb:     http://git.kernel.org/tip/96e70f83285676d8794f62f3c294d0247bef6b21
Author:     Minfei Huang <mnfhuang@gmail.com>
AuthorDate: Thu, 23 Oct 2014 23:36:17 +0800
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 28 Oct 2014 12:21:48 +0100

x86/mm: Avoid overlap the fixmap area on i386

It is a problem when configuring high memory off where the
vmalloc reserve area could end up overlapping the early_ioremap
fixmap area on i386.

The ordering of the VMALLOC_RESERVE space is:

 FIXADDR_TOP
                       fixed_addresses
 FIXADDR_START
                       early_ioremap fixed addresses
 FIXADDR_BOOT_START
                       Persistent kmap area
 PKMAP_BASE
 VMALLOC_END
                       Vmalloc area
 VMALLOC_START
 high_memory

The available address we can use is lower than
FIXADDR_BOOT_START. So we will set the kmap boundary below the
FIXADDR_BOOT_START, if we configure high memory.

If we configure high memory, the vmalloc reserve area should
end up to PKMAP_BASE, otherwise should end up to
FIXADDR_BOOT_START.

Signed-off-by: Minfei Huang <mnfhuang@gmail.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/6B680A9E-6CE9-4C96-934B-CB01DCB58278@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/include/asm/pgtable_32_types.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/pgtable_32_types.h b/arch/x86/include/asm/pgtable_32_types.h
index ed5903b..2ac5fc8 100644
--- a/arch/x86/include/asm/pgtable_32_types.h
+++ b/arch/x86/include/asm/pgtable_32_types.h
@@ -43,7 +43,7 @@ extern bool __vmalloc_start_set; /* set once high_memory is set */
 #ifdef CONFIG_HIGHMEM
 # define VMALLOC_END	(PKMAP_BASE - 2 * PAGE_SIZE)
 #else
-# define VMALLOC_END	(FIXADDR_START - 2 * PAGE_SIZE)
+# define VMALLOC_END	(FIXADDR_BOOT_START - 2 * PAGE_SIZE)
 #endif
 
 #define MODULES_VADDR	VMALLOC_START

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

* Re: [PATCH] mm: Avoid overlap the fixmap area on i386
  2014-10-28 11:06 ` Thomas Gleixner
@ 2014-10-28 17:24   ` H. Peter Anvin
  2014-10-28 17:29     ` Thomas Gleixner
  0 siblings, 1 reply; 7+ messages in thread
From: H. Peter Anvin @ 2014-10-28 17:24 UTC (permalink / raw)
  To: Thomas Gleixner, Minfei Huang; +Cc: mingo, x86, linux-kernel

On 10/28/2014 04:06 AM, Thomas Gleixner wrote:
>>
>> The available address we can use is lower than FIXADDR_BOOT_START. So
>> We will set the kmap boundary below the FIXADDR_BOOT_START, if configure
>> the high memory.
>>
>> If we configure the high memory, the vmalloc reserve area should end
>> up to PKMAP_BASE, otherwise should end up to FIXADDR_BOOT_START.
> 
> Which is not really a problem, because the FIXADDR_BOOT area is only
> used during boot for early_ioremap() and it's unused when ioremap() is
> functional. vmalloc becomes available after early boot so the
> FIXADDR_BOOT area is available for reuse.
> 

Given the very limited address space available on i386, it would be
extremely undesirable to not reuse address space when possible.

	-hpa


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

* Re: [PATCH] mm: Avoid overlap the fixmap area on i386
  2014-10-28 17:24   ` H. Peter Anvin
@ 2014-10-28 17:29     ` Thomas Gleixner
  2014-10-29  3:14       ` H. Peter Anvin
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Gleixner @ 2014-10-28 17:29 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Minfei Huang, mingo, x86, linux-kernel

On Tue, 28 Oct 2014, H. Peter Anvin wrote:
> On 10/28/2014 04:06 AM, Thomas Gleixner wrote:
> >>
> >> The available address we can use is lower than FIXADDR_BOOT_START. So
> >> We will set the kmap boundary below the FIXADDR_BOOT_START, if configure
> >> the high memory.
> >>
> >> If we configure the high memory, the vmalloc reserve area should end
> >> up to PKMAP_BASE, otherwise should end up to FIXADDR_BOOT_START.
> > 
> > Which is not really a problem, because the FIXADDR_BOOT area is only
> > used during boot for early_ioremap() and it's unused when ioremap() is
> > functional. vmalloc becomes available after early boot so the
> > FIXADDR_BOOT area is available for reuse.
> > 
> 
> Given the very limited address space available on i386, it would be
> extremely undesirable to not reuse address space when possible.

Fair enough. Then we should do that for the highmem=y case as well.

Thanks,

	tglx

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

* Re: [PATCH] mm: Avoid overlap the fixmap area on i386
  2014-10-28 17:29     ` Thomas Gleixner
@ 2014-10-29  3:14       ` H. Peter Anvin
  2014-10-29  4:30         ` Minfei Huang
  0 siblings, 1 reply; 7+ messages in thread
From: H. Peter Anvin @ 2014-10-29  3:14 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Minfei Huang, mingo, x86, linux-kernel

On 10/28/2014 10:29 AM, Thomas Gleixner wrote:
> On Tue, 28 Oct 2014, H. Peter Anvin wrote:
>> On 10/28/2014 04:06 AM, Thomas Gleixner wrote:
>>>>
>>>> The available address we can use is lower than FIXADDR_BOOT_START. So
>>>> We will set the kmap boundary below the FIXADDR_BOOT_START, if configure
>>>> the high memory.
>>>>
>>>> If we configure the high memory, the vmalloc reserve area should end
>>>> up to PKMAP_BASE, otherwise should end up to FIXADDR_BOOT_START.
>>>
>>> Which is not really a problem, because the FIXADDR_BOOT area is only
>>> used during boot for early_ioremap() and it's unused when ioremap() is
>>> functional. vmalloc becomes available after early boot so the
>>> FIXADDR_BOOT area is available for reuse.
>>>
>>
>> Given the very limited address space available on i386, it would be
>> extremely undesirable to not reuse address space when possible.
> 
> Fair enough. Then we should do that for the highmem=y case as well.
> 

It is probably even more important for highmem=y...

	-hpa



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

* Re: [PATCH] mm: Avoid overlap the fixmap area on i386
  2014-10-29  3:14       ` H. Peter Anvin
@ 2014-10-29  4:30         ` Minfei Huang
  0 siblings, 0 replies; 7+ messages in thread
From: Minfei Huang @ 2014-10-29  4:30 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Thomas Gleixner, mingo, x86, linux-kernel

On 10/28/14 at 08:14pm, H. Peter Anvin wrote:
> On 10/28/2014 10:29 AM, Thomas Gleixner wrote:
> > On Tue, 28 Oct 2014, H. Peter Anvin wrote:
> >> On 10/28/2014 04:06 AM, Thomas Gleixner wrote:
> >>>>
> >>>> The available address we can use is lower than FIXADDR_BOOT_START. So
> >>>> We will set the kmap boundary below the FIXADDR_BOOT_START, if configure
> >>>> the high memory.
> >>>>
> >>>> If we configure the high memory, the vmalloc reserve area should end
> >>>> up to PKMAP_BASE, otherwise should end up to FIXADDR_BOOT_START.
> >>>
> >>> Which is not really a problem, because the FIXADDR_BOOT area is only
> >>> used during boot for early_ioremap() and it's unused when ioremap() is
> >>> functional. vmalloc becomes available after early boot so the
> >>> FIXADDR_BOOT area is available for reuse.
> >>>
> >>
> >> Given the very limited address space available on i386, it would be
> >> extremely undesirable to not reuse address space when possible.
> > 
> > Fair enough. Then we should do that for the highmem=y case as well.
> > 
> 
> It is probably even more important for highmem=y...
> 
> 	-hpa

Agree. Maybe we can overlap the early_ioremap fix address to re-use
it. Virtual address is more precious on i386, especially when turn on the
high memory.

I will post an patch to fix it.

> 
> 

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

end of thread, other threads:[~2014-10-29  4:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-23 15:36 [PATCH] mm: Avoid overlap the fixmap area on i386 Minfei Huang
2014-10-28 11:06 ` Thomas Gleixner
2014-10-28 17:24   ` H. Peter Anvin
2014-10-28 17:29     ` Thomas Gleixner
2014-10-29  3:14       ` H. Peter Anvin
2014-10-29  4:30         ` Minfei Huang
2014-10-28 11:24 ` [tip:x86/mm] x86/mm: " tip-bot for Minfei Huang

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).