Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1352358 > unrolled thread

[PATCH 4.4 34/74] arm64: vmemmap: use virtual projection of linear region

Started byGreg Kroah-Hartman <gregkh@linuxfoundation.org>
First post2016-03-08 01:20 +0100
Last post2016-03-12 09:20 +0100
Articles 9 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 4.4 34/74] arm64: vmemmap: use virtual projection of linear region Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-08 01:20 +0100
    Re: [PATCH 4.4 34/74] arm64: vmemmap: use virtual projection of  linear region Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-03-08 11:50 +0100
      Re: [PATCH 4.4 34/74] arm64: vmemmap: use virtual projection of  linear region Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-08 14:50 +0100
        Re: [PATCH 4.4 34/74] arm64: vmemmap: use virtual projection of  linear region Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-03-08 14:50 +0100
          Re: [PATCH 4.4 34/74] arm64: vmemmap: use virtual projection of  linear region Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-03-12 03:00 +0100
            Re: [PATCH 4.4 34/74] arm64: vmemmap: use virtual projection of  linear region Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-12 07:00 +0100
              Re: [PATCH 4.4 34/74] arm64: vmemmap: use virtual projection of linear region Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-03-12 07:00 +0100
                Re: [PATCH 4.4 34/74] arm64: vmemmap: use virtual projection of  linear region Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-03-12 07:10 +0100
                  Re: [PATCH 4.4 34/74] arm64: vmemmap: use virtual projection of linear region Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-03-12 09:20 +0100

#1352358 — [PATCH 4.4 34/74] arm64: vmemmap: use virtual projection of linear region

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2016-03-08 01:20 +0100
Subject[PATCH 4.4 34/74] arm64: vmemmap: use virtual projection of linear region
Message-ID<radxv-1Da-5@gated-at.bofh.it>
4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ard Biesheuvel <ard.biesheuvel@linaro.org>

commit dfd55ad85e4a7fbaa82df12467515ac3c81e8a3e upstream.

Commit dd006da21646 ("arm64: mm: increase VA range of identity map") made
some changes to the memory mapping code to allow physical memory to reside
at an offset that exceeds the size of the virtual mapping.

However, since the size of the vmemmap area is proportional to the size of
the VA area, but it is populated relative to the physical space, we may
end up with the struct page array being mapped outside of the vmemmap
region. For instance, on my Seattle A0 box, I can see the following output
in the dmesg log.

   vmemmap : 0xffffffbdc0000000 - 0xffffffbfc0000000   (     8 GB maximum)
             0xffffffbfc0000000 - 0xffffffbfd0000000   (   256 MB actual)

We can fix this by deciding that the vmemmap region is not a projection of
the physical space, but of the virtual space above PAGE_OFFSET, i.e., the
linear region. This way, we are guaranteed that the vmemmap region is of
sufficient size, and we can even reduce the size by half.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/include/asm/pgtable.h |    7 ++++---
 arch/arm64/mm/init.c             |    4 ++--
 2 files changed, 6 insertions(+), 5 deletions(-)

--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -34,13 +34,13 @@
 /*
  * VMALLOC and SPARSEMEM_VMEMMAP ranges.
  *
- * VMEMAP_SIZE: allows the whole VA space to be covered by a struct page array
+ * VMEMAP_SIZE: allows the whole linear region to be covered by a struct page array
  *	(rounded up to PUD_SIZE).
  * VMALLOC_START: beginning of the kernel VA space
  * VMALLOC_END: extends to the available space below vmmemmap, PCI I/O space,
  *	fixed mappings and modules
  */
-#define VMEMMAP_SIZE		ALIGN((1UL << (VA_BITS - PAGE_SHIFT)) * sizeof(struct page), PUD_SIZE)
+#define VMEMMAP_SIZE		ALIGN((1UL << (VA_BITS - PAGE_SHIFT - 1)) * sizeof(struct page), PUD_SIZE)
 
 #ifndef CONFIG_KASAN
 #define VMALLOC_START		(VA_START)
@@ -51,7 +51,8 @@
 
 #define VMALLOC_END		(PAGE_OFFSET - PUD_SIZE - VMEMMAP_SIZE - SZ_64K)
 
-#define vmemmap			((struct page *)(VMALLOC_END + SZ_64K))
+#define VMEMMAP_START		(VMALLOC_END + SZ_64K)
+#define vmemmap			((struct page *)VMEMMAP_START - (memstart_addr >> PAGE_SHIFT))
 
 #define FIRST_USER_ADDRESS	0UL
 
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -319,8 +319,8 @@ void __init mem_init(void)
 #endif
 		  MLG(VMALLOC_START, VMALLOC_END),
 #ifdef CONFIG_SPARSEMEM_VMEMMAP
-		  MLG((unsigned long)vmemmap,
-		      (unsigned long)vmemmap + VMEMMAP_SIZE),
+		  MLG(VMEMMAP_START,
+		      VMEMMAP_START + VMEMMAP_SIZE),
 		  MLM((unsigned long)virt_to_page(PAGE_OFFSET),
 		      (unsigned long)virt_to_page(high_memory)),
 #endif

[toc] | [next] | [standalone]


#1352870 — Re: [PATCH 4.4 34/74] arm64: vmemmap: use virtual projection of linear region

FromArd Biesheuvel <ard.biesheuvel@linaro.org>
Date2016-03-08 11:50 +0100
SubjectRe: [PATCH 4.4 34/74] arm64: vmemmap: use virtual projection of linear region
Message-ID<rannc-87S-11@gated-at.bofh.it>
In reply to#1352358
On 8 March 2016 at 07:02, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> 4.4-stable review patch.  If anyone has any objections, please let me know.
>

Please hold off on this one. We are seeing some breakage on 64k pages systems

> ------------------
>
> From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>
> commit dfd55ad85e4a7fbaa82df12467515ac3c81e8a3e upstream.
>
> Commit dd006da21646 ("arm64: mm: increase VA range of identity map") made
> some changes to the memory mapping code to allow physical memory to reside
> at an offset that exceeds the size of the virtual mapping.
>
> However, since the size of the vmemmap area is proportional to the size of
> the VA area, but it is populated relative to the physical space, we may
> end up with the struct page array being mapped outside of the vmemmap
> region. For instance, on my Seattle A0 box, I can see the following output
> in the dmesg log.
>
>    vmemmap : 0xffffffbdc0000000 - 0xffffffbfc0000000   (     8 GB maximum)
>              0xffffffbfc0000000 - 0xffffffbfd0000000   (   256 MB actual)
>
> We can fix this by deciding that the vmemmap region is not a projection of
> the physical space, but of the virtual space above PAGE_OFFSET, i.e., the
> linear region. This way, we are guaranteed that the vmemmap region is of
> sufficient size, and we can even reduce the size by half.
>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Signed-off-by: Will Deacon <will.deacon@arm.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>
> ---
>  arch/arm64/include/asm/pgtable.h |    7 ++++---
>  arch/arm64/mm/init.c             |    4 ++--
>  2 files changed, 6 insertions(+), 5 deletions(-)
>
> --- a/arch/arm64/include/asm/pgtable.h
> +++ b/arch/arm64/include/asm/pgtable.h
> @@ -34,13 +34,13 @@
>  /*
>   * VMALLOC and SPARSEMEM_VMEMMAP ranges.
>   *
> - * VMEMAP_SIZE: allows the whole VA space to be covered by a struct page array
> + * VMEMAP_SIZE: allows the whole linear region to be covered by a struct page array
>   *     (rounded up to PUD_SIZE).
>   * VMALLOC_START: beginning of the kernel VA space
>   * VMALLOC_END: extends to the available space below vmmemmap, PCI I/O space,
>   *     fixed mappings and modules
>   */
> -#define VMEMMAP_SIZE           ALIGN((1UL << (VA_BITS - PAGE_SHIFT)) * sizeof(struct page), PUD_SIZE)
> +#define VMEMMAP_SIZE           ALIGN((1UL << (VA_BITS - PAGE_SHIFT - 1)) * sizeof(struct page), PUD_SIZE)
>
>  #ifndef CONFIG_KASAN
>  #define VMALLOC_START          (VA_START)
> @@ -51,7 +51,8 @@
>
>  #define VMALLOC_END            (PAGE_OFFSET - PUD_SIZE - VMEMMAP_SIZE - SZ_64K)
>
> -#define vmemmap                        ((struct page *)(VMALLOC_END + SZ_64K))
> +#define VMEMMAP_START          (VMALLOC_END + SZ_64K)
> +#define vmemmap                        ((struct page *)VMEMMAP_START - (memstart_addr >> PAGE_SHIFT))
>
>  #define FIRST_USER_ADDRESS     0UL
>
> --- a/arch/arm64/mm/init.c
> +++ b/arch/arm64/mm/init.c
> @@ -319,8 +319,8 @@ void __init mem_init(void)
>  #endif
>                   MLG(VMALLOC_START, VMALLOC_END),
>  #ifdef CONFIG_SPARSEMEM_VMEMMAP
> -                 MLG((unsigned long)vmemmap,
> -                     (unsigned long)vmemmap + VMEMMAP_SIZE),
> +                 MLG(VMEMMAP_START,
> +                     VMEMMAP_START + VMEMMAP_SIZE),
>                   MLM((unsigned long)virt_to_page(PAGE_OFFSET),
>                       (unsigned long)virt_to_page(high_memory)),
>  #endif
>
>

[toc] | [prev] | [next] | [standalone]


#1353048 — Re: [PATCH 4.4 34/74] arm64: vmemmap: use virtual projection of linear region

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2016-03-08 14:50 +0100
SubjectRe: [PATCH 4.4 34/74] arm64: vmemmap: use virtual projection of linear region
Message-ID<raqbo-1xM-13@gated-at.bofh.it>
In reply to#1352870
On Tue, Mar 08, 2016 at 05:40:14PM +0700, Ard Biesheuvel wrote:
> On 8 March 2016 at 07:02, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> > 4.4-stable review patch.  If anyone has any objections, please let me know.
> >
> 
> Please hold off on this one. We are seeing some breakage on 64k pages systems

If this problem is also in Linus's tree, I'd like to keep it in to keep
things "bug compatible".  Please let me know what fix that I should
apply to resolve this.

thanks,

greg k-h

[toc] | [prev] | [next] | [standalone]


#1353060 — Re: [PATCH 4.4 34/74] arm64: vmemmap: use virtual projection of linear region

FromArd Biesheuvel <ard.biesheuvel@linaro.org>
Date2016-03-08 14:50 +0100
SubjectRe: [PATCH 4.4 34/74] arm64: vmemmap: use virtual projection of linear region
Message-ID<raqbp-1xM-45@gated-at.bofh.it>
In reply to#1353048
On 8 March 2016 at 20:44, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> On Tue, Mar 08, 2016 at 05:40:14PM +0700, Ard Biesheuvel wrote:
>> On 8 March 2016 at 07:02, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
>> > 4.4-stable review patch.  If anyone has any objections, please let me know.
>> >
>>
>> Please hold off on this one. We are seeing some breakage on 64k pages systems
>
> If this problem is also in Linus's tree, I'd like to keep it in to keep
> things "bug compatible".  Please let me know what fix that I should
> apply to resolve this.
>

I am about to send out the patch that should fix this, so I will put you on cc.

Thanks,
Ard.

[toc] | [prev] | [next] | [standalone]


#1356324 — Re: [PATCH 4.4 34/74] arm64: vmemmap: use virtual projection of linear region

FromArd Biesheuvel <ard.biesheuvel@linaro.org>
Date2016-03-12 03:00 +0100
SubjectRe: [PATCH 4.4 34/74] arm64: vmemmap: use virtual projection of linear region
Message-ID<rbH0u-6ZX-9@gated-at.bofh.it>
In reply to#1353060
On 8 March 2016 at 20:45, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> On 8 March 2016 at 20:44, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
>> On Tue, Mar 08, 2016 at 05:40:14PM +0700, Ard Biesheuvel wrote:
>>> On 8 March 2016 at 07:02, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
>>> > 4.4-stable review patch.  If anyone has any objections, please let me know.
>>> >
>>>
>>> Please hold off on this one. We are seeing some breakage on 64k pages systems
>>
>> If this problem is also in Linus's tree, I'd like to keep it in to keep
>> things "bug compatible".  Please let me know what fix that I should
>> apply to resolve this.
>>
>
> I am about to send out the patch that should fix this, so I will put you on cc.
>

Not sure what happened here, but this patch is in 4.4-stable now, but
the fix is not.

[toc] | [prev] | [next] | [standalone]


#1356352 — Re: [PATCH 4.4 34/74] arm64: vmemmap: use virtual projection of linear region

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2016-03-12 07:00 +0100
SubjectRe: [PATCH 4.4 34/74] arm64: vmemmap: use virtual projection of linear region
Message-ID<rbKKK-1o6-1@gated-at.bofh.it>
In reply to#1356324
On Sat, Mar 12, 2016 at 08:51:26AM +0700, Ard Biesheuvel wrote:
> On 8 March 2016 at 20:45, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> > On 8 March 2016 at 20:44, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> >> On Tue, Mar 08, 2016 at 05:40:14PM +0700, Ard Biesheuvel wrote:
> >>> On 8 March 2016 at 07:02, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> >>> > 4.4-stable review patch.  If anyone has any objections, please let me know.
> >>> >
> >>>
> >>> Please hold off on this one. We are seeing some breakage on 64k pages systems
> >>
> >> If this problem is also in Linus's tree, I'd like to keep it in to keep
> >> things "bug compatible".  Please let me know what fix that I should
> >> apply to resolve this.
> >>
> >
> > I am about to send out the patch that should fix this, so I will put you on cc.
> >
> 
> Not sure what happened here, but this patch is in 4.4-stable now, but
> the fix is not.

Because the fix came out _after_ I released that kernel?  I can't go
back in time...

[toc] | [prev] | [next] | [standalone]


#1356353

FromArd Biesheuvel <ard.biesheuvel@linaro.org>
Date2016-03-12 07:00 +0100
Message-ID<rbKKK-1o6-3@gated-at.bofh.it>
In reply to#1356352

> On 12 mrt. 2016, at 13:50, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> 
>> On Sat, Mar 12, 2016 at 08:51:26AM +0700, Ard Biesheuvel wrote:
>>> On 8 March 2016 at 20:45, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
>>>> On 8 March 2016 at 20:44, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
>>>>> On Tue, Mar 08, 2016 at 05:40:14PM +0700, Ard Biesheuvel wrote:
>>>>>> On 8 March 2016 at 07:02, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
>>>>>> 4.4-stable review patch.  If anyone has any objections, please let me know.
>>>>> 
>>>>> Please hold off on this one. We are seeing some breakage on 64k pages systems
>>>> 
>>>> If this problem is also in Linus's tree, I'd like to keep it in to keep
>>>> things "bug compatible".  Please let me know what fix that I should
>>>> apply to resolve this.
>>> 
>>> I am about to send out the patch that should fix this, so I will put you on cc.
>> 
>> Not sure what happened here, but this patch is in 4.4-stable now, but
>> the fix is not.
> 
> Because the fix came out _after_ I released that kernel?  I can't go
> back in time...
> 

I kind of got the whole chronology thing. I am just surprised you pulled only that patch (and not the fix) anyway, since you knew it would break things, and that a fix was on the way.

[toc] | [prev] | [next] | [standalone]


#1356356 — Re: [PATCH 4.4 34/74] arm64: vmemmap: use virtual projection of linear region

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2016-03-12 07:10 +0100
SubjectRe: [PATCH 4.4 34/74] arm64: vmemmap: use virtual projection of linear region
Message-ID<rbKUp-1Jt-3@gated-at.bofh.it>
In reply to#1356353
On Sat, Mar 12, 2016 at 01:55:44PM +0800, Ard Biesheuvel wrote:
> 
> 
> > On 12 mrt. 2016, at 13:50, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> > 
> >> On Sat, Mar 12, 2016 at 08:51:26AM +0700, Ard Biesheuvel wrote:
> >>> On 8 March 2016 at 20:45, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> >>>> On 8 March 2016 at 20:44, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> >>>>> On Tue, Mar 08, 2016 at 05:40:14PM +0700, Ard Biesheuvel wrote:
> >>>>>> On 8 March 2016 at 07:02, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> >>>>>> 4.4-stable review patch.  If anyone has any objections, please let me know.
> >>>>> 
> >>>>> Please hold off on this one. We are seeing some breakage on 64k pages systems
> >>>> 
> >>>> If this problem is also in Linus's tree, I'd like to keep it in to keep
> >>>> things "bug compatible".  Please let me know what fix that I should
> >>>> apply to resolve this.
> >>> 
> >>> I am about to send out the patch that should fix this, so I will put you on cc.
> >> 
> >> Not sure what happened here, but this patch is in 4.4-stable now, but
> >> the fix is not.
> > 
> > Because the fix came out _after_ I released that kernel?  I can't go
> > back in time...
> > 
> 
> I kind of got the whole chronology thing. I am just surprised you
> pulled only that patch (and not the fix) anyway, since you knew it
> would break things, and that a fix was on the way.

That way I knew you all would work quickly to get the fix in :)

We do this all the time, nothing new here, being "bug compatible" is
good...

thanks,

greg k-h

[toc] | [prev] | [next] | [standalone]


#1356372

FromArd Biesheuvel <ard.biesheuvel@linaro.org>
Date2016-03-12 09:20 +0100
Message-ID<rbMWe-35o-7@gated-at.bofh.it>
In reply to#1356356

> On 12 mrt. 2016, at 14:05, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> 
>> On Sat, Mar 12, 2016 at 01:55:44PM +0800, Ard Biesheuvel wrote:
>> 
>> 
>>>> On 12 mrt. 2016, at 13:50, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
>>>> 
>>>>> On Sat, Mar 12, 2016 at 08:51:26AM +0700, Ard Biesheuvel wrote:
>>>>>> On 8 March 2016 at 20:45, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
>>>>>>> On 8 March 2016 at 20:44, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
>>>>>>>> On Tue, Mar 08, 2016 at 05:40:14PM +0700, Ard Biesheuvel wrote:
>>>>>>>> On 8 March 2016 at 07:02, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
>>>>>>>> 4.4-stable review patch.  If anyone has any objections, please let me know.
>>>>>>> 
>>>>>>> Please hold off on this one. We are seeing some breakage on 64k pages systems
>>>>>> 
>>>>>> If this problem is also in Linus's tree, I'd like to keep it in to keep
>>>>>> things "bug compatible".  Please let me know what fix that I should
>>>>>> apply to resolve this.
>>>>> 
>>>>> I am about to send out the patch that should fix this, so I will put you on cc.
>>>> 
>>>> Not sure what happened here, but this patch is in 4.4-stable now, but
>>>> the fix is not.
>>> 
>>> Because the fix came out _after_ I released that kernel?  I can't go
>>> back in time...
>> 
>> I kind of got the whole chronology thing. I am just surprised you
>> pulled only that patch (and not the fix) anyway, since you knew it
>> would break things, and that a fix was on the way.
> 
> That way I knew you all would work quickly to get the fix in :)
> 
> We do this all the time, nothing new here, being "bug compatible" is
> good...
> 

Do you get many requests from stable tree users for this bug compatibility with mainline?

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web