All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] image: usage of value ~0UL for intrd_high
@ 2021-01-09 18:06 Heinrich Schuchardt
  2021-01-09 18:47 ` Andy Shevchenko
  0 siblings, 1 reply; 14+ messages in thread
From: Heinrich Schuchardt @ 2021-01-09 18:06 UTC (permalink / raw)
  To: u-boot

The comment for initrd_high in the coding and in README were contradicting
and neither fully described what the coding does.

Clarify the usage of the special value ~0UL for the environment variable
initrd_high.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 README         | 3 ++-
 common/image.c | 6 ++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/README b/README
index 7b73a1c973..fe58f1ab98 100644
--- a/README
+++ b/README
@@ -3310,7 +3310,8 @@ List of environment variables (most likely not complete):

 		  setenv initrd_high 00c00000

-		  If you set initrd_high to 0xFFFFFFFF, this is an
+		  If you set initrd_high to 0xFFFFFFFF on a 32-bit systems
+		  or 0xFFFFFFFFFFFFFFFF on a 64-bit systems, this is an
 		  indication to U-Boot that all addresses are legal
 		  for the Linux kernel, including addresses in flash
 		  memory. In this case U-Boot will NOT COPY the
diff --git a/common/image.c b/common/image.c
index 451fc689a8..007e4e987a 100644
--- a/common/image.c
+++ b/common/image.c
@@ -1362,8 +1362,10 @@ int boot_ramdisk_high(struct lmb *lmb, ulong rd_data, ulong rd_len,

 	s = env_get("initrd_high");
 	if (s) {
-		/* a value of "no" or a similar string will act like 0,
-		 * turning the "load high" feature off. This is intentional.
+		/*
+		 * A value of 0xffffffffffffffff on 64-bit or 0xffffffff
+		 * on 32-bit systems will disable the copying of the initial
+		 * RAM disk to high memory.
 		 */
 		initrd_high = simple_strtoul(s, NULL, 16);
 		if (initrd_high == ~0)
--
2.29.2

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

* [PATCH 1/1] image: usage of value ~0UL for intrd_high
  2021-01-09 18:06 [PATCH 1/1] image: usage of value ~0UL for intrd_high Heinrich Schuchardt
@ 2021-01-09 18:47 ` Andy Shevchenko
  2021-01-09 18:58   ` Tom Rini
  0 siblings, 1 reply; 14+ messages in thread
From: Andy Shevchenko @ 2021-01-09 18:47 UTC (permalink / raw)
  To: u-boot

On Sat, Jan 9, 2021 at 8:06 PM Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> The comment for initrd_high in the coding and in README were contradicting
> and neither fully described what the coding does.
>
> Clarify the usage of the special value ~0UL for the environment variable
> initrd_high.

All those F:s are hard to read in the comments and documentation and
typo prone. I would prefer to rephrase like "all 1:s value in 32- or
64-bit format" or alike.

-- 
With Best Regards,
Andy Shevchenko

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

* [PATCH 1/1] image: usage of value ~0UL for intrd_high
  2021-01-09 18:47 ` Andy Shevchenko
@ 2021-01-09 18:58   ` Tom Rini
  2021-01-09 19:33     ` Heinrich Schuchardt
  0 siblings, 1 reply; 14+ messages in thread
From: Tom Rini @ 2021-01-09 18:58 UTC (permalink / raw)
  To: u-boot

On Sat, Jan 09, 2021 at 08:47:07PM +0200, Andy Shevchenko wrote:
> On Sat, Jan 9, 2021 at 8:06 PM Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> >
> > The comment for initrd_high in the coding and in README were contradicting
> > and neither fully described what the coding does.
> >
> > Clarify the usage of the special value ~0UL for the environment variable
> > initrd_high.
> 
> All those F:s are hard to read in the comments and documentation and
> typo prone. I would prefer to rephrase like "all 1:s value in 32- or
> 64-bit format" or alike.

If we're going to improve this we should also note it's discouraged
unless you know for certain there will be no overlap and it's strongly
discouraged in default environments.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210109/bbdd029b/attachment.sig>

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

* [PATCH 1/1] image: usage of value ~0UL for intrd_high
  2021-01-09 18:58   ` Tom Rini
@ 2021-01-09 19:33     ` Heinrich Schuchardt
  2021-01-09 19:40       ` Tom Rini
  0 siblings, 1 reply; 14+ messages in thread
From: Heinrich Schuchardt @ 2021-01-09 19:33 UTC (permalink / raw)
  To: u-boot

On 1/9/21 7:58 PM, Tom Rini wrote:
> On Sat, Jan 09, 2021 at 08:47:07PM +0200, Andy Shevchenko wrote:
>> On Sat, Jan 9, 2021 at 8:06 PM Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>>>
>>> The comment for initrd_high in the coding and in README were contradicting
>>> and neither fully described what the coding does.
>>>
>>> Clarify the usage of the special value ~0UL for the environment variable
>>> initrd_high.
>>
>> All those F:s are hard to read in the comments and documentation and
>> typo prone. I would prefer to rephrase like "all 1:s value in 32- or
>> 64-bit format" or alike.
>
> If we're going to improve this we should also note it's discouraged
> unless you know for certain there will be no overlap and it's strongly
> discouraged in default environments.

What exactly is discouraged?

* setting initrd_high to a value != ~0? Here I would agree.
* setting intird_high to ~0? Why should we copy initrd to a
   different place? Is it for some outdated Linux release?

Best regards

Heinrich

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

* [PATCH 1/1] image: usage of value ~0UL for intrd_high
  2021-01-09 19:33     ` Heinrich Schuchardt
@ 2021-01-09 19:40       ` Tom Rini
  2021-01-09 19:59         ` Heinrich Schuchardt
  0 siblings, 1 reply; 14+ messages in thread
From: Tom Rini @ 2021-01-09 19:40 UTC (permalink / raw)
  To: u-boot

On Sat, Jan 09, 2021 at 08:33:40PM +0100, Heinrich Schuchardt wrote:
> On 1/9/21 7:58 PM, Tom Rini wrote:
> > On Sat, Jan 09, 2021 at 08:47:07PM +0200, Andy Shevchenko wrote:
> > > On Sat, Jan 9, 2021 at 8:06 PM Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> > > > 
> > > > The comment for initrd_high in the coding and in README were contradicting
> > > > and neither fully described what the coding does.
> > > > 
> > > > Clarify the usage of the special value ~0UL for the environment variable
> > > > initrd_high.
> > > 
> > > All those F:s are hard to read in the comments and documentation and
> > > typo prone. I would prefer to rephrase like "all 1:s value in 32- or
> > > 64-bit format" or alike.
> > 
> > If we're going to improve this we should also note it's discouraged
> > unless you know for certain there will be no overlap and it's strongly
> > discouraged in default environments.
> 
> What exactly is discouraged?
> 
> * setting initrd_high to a value != ~0? Here I would agree.
> * setting intird_high to ~0? Why should we copy initrd to a
>   different place? Is it for some outdated Linux release?

We should always default to allowing the initrd to be relocated because
we can see (in many cases) overlap that will lead to failure to boot but
this forces us to ignore that.  Having good default load values means we
don't have a problem here.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210109/4e501f74/attachment.sig>

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

* [PATCH 1/1] image: usage of value ~0UL for intrd_high
  2021-01-09 19:40       ` Tom Rini
@ 2021-01-09 19:59         ` Heinrich Schuchardt
  2021-01-09 21:23           ` Tom Rini
  0 siblings, 1 reply; 14+ messages in thread
From: Heinrich Schuchardt @ 2021-01-09 19:59 UTC (permalink / raw)
  To: u-boot

Am 9. Januar 2021 20:40:04 MEZ schrieb Tom Rini <trini@konsulko.com>:
>On Sat, Jan 09, 2021 at 08:33:40PM +0100, Heinrich Schuchardt wrote:
>> On 1/9/21 7:58 PM, Tom Rini wrote:
>> > On Sat, Jan 09, 2021 at 08:47:07PM +0200, Andy Shevchenko wrote:
>> > > On Sat, Jan 9, 2021 at 8:06 PM Heinrich Schuchardt
><xypron.glpk@gmx.de> wrote:
>> > > > 
>> > > > The comment for initrd_high in the coding and in README were
>contradicting
>> > > > and neither fully described what the coding does.
>> > > > 
>> > > > Clarify the usage of the special value ~0UL for the environment
>variable
>> > > > initrd_high.
>> > > 
>> > > All those F:s are hard to read in the comments and documentation
>and
>> > > typo prone. I would prefer to rephrase like "all 1:s value in 32-
>or
>> > > 64-bit format" or alike.
>> > 
>> > If we're going to improve this we should also note it's discouraged
>> > unless you know for certain there will be no overlap and it's
>strongly
>> > discouraged in default environments.
>> 
>> What exactly is discouraged?
>> 
>> * setting initrd_high to a value != ~0? Here I would agree.
>> * setting intird_high to ~0? Why should we copy initrd to a
>>   different place? Is it for some outdated Linux release?
>
>We should always default to allowing the initrd to be relocated because
>we can see (in many cases) overlap that will lead to failure to boot
>but
>this forces us to ignore that.  Having good default load values means
>we
>don't have a problem here.

We have an initrd that is already in memory. What could it overlap with that is not already overwritten?

Can you provide the text you want to see here?

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

* [PATCH 1/1] image: usage of value ~0UL for intrd_high
  2021-01-09 19:59         ` Heinrich Schuchardt
@ 2021-01-09 21:23           ` Tom Rini
  2021-01-09 23:23             ` Heinrich Schuchardt
  2021-01-10 12:05             ` Heinrich Schuchardt
  0 siblings, 2 replies; 14+ messages in thread
From: Tom Rini @ 2021-01-09 21:23 UTC (permalink / raw)
  To: u-boot

On Sat, Jan 09, 2021 at 08:59:01PM +0100, Heinrich Schuchardt wrote:
> Am 9. Januar 2021 20:40:04 MEZ schrieb Tom Rini <trini@konsulko.com>:
> >On Sat, Jan 09, 2021 at 08:33:40PM +0100, Heinrich Schuchardt wrote:
> >> On 1/9/21 7:58 PM, Tom Rini wrote:
> >> > On Sat, Jan 09, 2021 at 08:47:07PM +0200, Andy Shevchenko wrote:
> >> > > On Sat, Jan 9, 2021 at 8:06 PM Heinrich Schuchardt
> ><xypron.glpk@gmx.de> wrote:
> >> > > > 
> >> > > > The comment for initrd_high in the coding and in README were
> >contradicting
> >> > > > and neither fully described what the coding does.
> >> > > > 
> >> > > > Clarify the usage of the special value ~0UL for the environment
> >variable
> >> > > > initrd_high.
> >> > > 
> >> > > All those F:s are hard to read in the comments and documentation
> >and
> >> > > typo prone. I would prefer to rephrase like "all 1:s value in 32-
> >or
> >> > > 64-bit format" or alike.
> >> > 
> >> > If we're going to improve this we should also note it's discouraged
> >> > unless you know for certain there will be no overlap and it's
> >strongly
> >> > discouraged in default environments.
> >> 
> >> What exactly is discouraged?
> >> 
> >> * setting initrd_high to a value != ~0? Here I would agree.
> >> * setting intird_high to ~0? Why should we copy initrd to a
> >>   different place? Is it for some outdated Linux release?
> >
> >We should always default to allowing the initrd to be relocated because
> >we can see (in many cases) overlap that will lead to failure to boot
> >but
> >this forces us to ignore that.  Having good default load values means
> >we
> >don't have a problem here.
> 
> We have an initrd that is already in memory. What could it overlap
> with that is not already overwritten?

Having the kernel and initrd too close in memory has the kernel BSS
overwrite the initrd.  This has happened time and time again before
I went around making some platforms have reasonable (ie kernel early,
ramdisk in lowmem but beyond where a kernel+bss can be, etc) defaults
and pushing others to do the same.

> Can you provide the text you want to see here?

Off-hand, it should look more like the big comment block in
include/configs/ti_armv7_common.h and reference the Linux booting on
arm/arm64 documents while noting that other architectures have the same
fundamental issues and their exact limits may or may not be as well
documented.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210109/2a7c6b31/attachment.sig>

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

* [PATCH 1/1] image: usage of value ~0UL for intrd_high
  2021-01-09 21:23           ` Tom Rini
@ 2021-01-09 23:23             ` Heinrich Schuchardt
  2021-01-10 12:07               ` Adam Ford
  2021-01-10 15:36               ` Andy Shevchenko
  2021-01-10 12:05             ` Heinrich Schuchardt
  1 sibling, 2 replies; 14+ messages in thread
From: Heinrich Schuchardt @ 2021-01-09 23:23 UTC (permalink / raw)
  To: u-boot

Am 9. Januar 2021 22:23:01 MEZ schrieb Tom Rini <trini@konsulko.com>:
>On Sat, Jan 09, 2021 at 08:59:01PM +0100, Heinrich Schuchardt wrote:
>> Am 9. Januar 2021 20:40:04 MEZ schrieb Tom Rini <trini@konsulko.com>:
>> >On Sat, Jan 09, 2021 at 08:33:40PM +0100, Heinrich Schuchardt wrote:
>> >> On 1/9/21 7:58 PM, Tom Rini wrote:
>> >> > On Sat, Jan 09, 2021 at 08:47:07PM +0200, Andy Shevchenko wrote:
>> >> > > On Sat, Jan 9, 2021 at 8:06 PM Heinrich Schuchardt
>> ><xypron.glpk@gmx.de> wrote:
>> >> > > > 
>> >> > > > The comment for initrd_high in the coding and in README were
>> >contradicting
>> >> > > > and neither fully described what the coding does.
>> >> > > > 
>> >> > > > Clarify the usage of the special value ~0UL for the
>environment
>> >variable
>> >> > > > initrd_high.
>> >> > > 
>> >> > > All those F:s are hard to read in the comments and
>documentation
>> >and
>> >> > > typo prone. I would prefer to rephrase like "all 1:s value in
>32-
>> >or
>> >> > > 64-bit format" or alike.


Who would understand that? 

All 1s that is 111111111?

We need something a non-developer will grasp. Copying the exact value from the readme is the easiest thing to do and the least typo prone.

Best regards

Heinrich

>> >> > 
>> >> > If we're going to improve this we should also note it's
>discouraged
>> >> > unless you know for certain there will be no overlap and it's
>> >strongly
>> >> > discouraged in default environments.
>> >> 
>> >> What exactly is discouraged?
>> >> 
>> >> * setting initrd_high to a value != ~0? Here I would agree.
>> >> * setting intird_high to ~0? Why should we copy initrd to a
>> >>   different place? Is it for some outdated Linux release?
>> >
>> >We should always default to allowing the initrd to be relocated
>because
>> >we can see (in many cases) overlap that will lead to failure to boot
>> >but
>> >this forces us to ignore that.  Having good default load values
>means
>> >we
>> >don't have a problem here.
>> 
>> We have an initrd that is already in memory. What could it overlap
>> with that is not already overwritten?
>
>Having the kernel and initrd too close in memory has the kernel BSS
>overwrite the initrd.  This has happened time and time again before
>I went around making some platforms have reasonable (ie kernel early,
>ramdisk in lowmem but beyond where a kernel+bss can be, etc) defaults
>and pushing others to do the same.
>
>> Can you provide the text you want to see here?
>
>Off-hand, it should look more like the big comment block in
>include/configs/ti_armv7_common.h and reference the Linux booting on
>arm/arm64 documents while noting that other architectures have the same
>fundamental issues and their exact limits may or may not be as well
>documented.

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

* [PATCH 1/1] image: usage of value ~0UL for intrd_high
  2021-01-09 21:23           ` Tom Rini
  2021-01-09 23:23             ` Heinrich Schuchardt
@ 2021-01-10 12:05             ` Heinrich Schuchardt
  2021-01-10 13:43               ` Tom Rini
  1 sibling, 1 reply; 14+ messages in thread
From: Heinrich Schuchardt @ 2021-01-10 12:05 UTC (permalink / raw)
  To: u-boot

On 1/9/21 10:23 PM, Tom Rini wrote:
> On Sat, Jan 09, 2021 at 08:59:01PM +0100, Heinrich Schuchardt wrote:
>> Am 9. Januar 2021 20:40:04 MEZ schrieb Tom Rini <trini@konsulko.com>:
>>> On Sat, Jan 09, 2021 at 08:33:40PM +0100, Heinrich Schuchardt wrote:
>>>> On 1/9/21 7:58 PM, Tom Rini wrote:
>>>>> On Sat, Jan 09, 2021 at 08:47:07PM +0200, Andy Shevchenko wrote:
>>>>>> On Sat, Jan 9, 2021 at 8:06 PM Heinrich Schuchardt
>>> <xypron.glpk@gmx.de> wrote:
>>>>>>>
>>>>>>> The comment for initrd_high in the coding and in README were
>>> contradicting
>>>>>>> and neither fully described what the coding does.
>>>>>>>
>>>>>>> Clarify the usage of the special value ~0UL for the environment
>>> variable
>>>>>>> initrd_high.
>>>>>>
>>>>>> All those F:s are hard to read in the comments and documentation
>>> and
>>>>>> typo prone. I would prefer to rephrase like "all 1:s value in 32-
>>> or
>>>>>> 64-bit format" or alike.
>>>>>
>>>>> If we're going to improve this we should also note it's discouraged
>>>>> unless you know for certain there will be no overlap and it's
>>> strongly
>>>>> discouraged in default environments.
>>>>
>>>> What exactly is discouraged?
>>>>
>>>> * setting initrd_high to a value != ~0? Here I would agree.
>>>> * setting intird_high to ~0? Why should we copy initrd to a
>>>>    different place? Is it for some outdated Linux release?
>>>
>>> We should always default to allowing the initrd to be relocated because
>>> we can see (in many cases) overlap that will lead to failure to boot
>>> but
>>> this forces us to ignore that.  Having good default load values means
>>> we
>>> don't have a problem here.
>>
>> We have an initrd that is already in memory. What could it overlap
>> with that is not already overwritten?
>
> Having the kernel and initrd too close in memory has the kernel BSS
> overwrite the initrd.  This has happened time and time again before
> I went around making some platforms have reasonable (ie kernel early,
> ramdisk in lowmem but beyond where a kernel+bss can be, etc) defaults
> and pushing others to do the same.
>
>> Can you provide the text you want to see here?
>
> Off-hand, it should look more like the big comment block in
> include/configs/ti_armv7_common.h and reference the Linux booting on
> arm/arm64 documents while noting that other architectures have the same
> fundamental issues and their exact limits may or may not be as well
> documented.
>

There is nothing in the include/configs/ti_armv7_common.h comments
requiring to relocate initrd.

Best regards

Heinrich

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

* [PATCH 1/1] image: usage of value ~0UL for intrd_high
  2021-01-09 23:23             ` Heinrich Schuchardt
@ 2021-01-10 12:07               ` Adam Ford
  2021-01-10 15:36               ` Andy Shevchenko
  1 sibling, 0 replies; 14+ messages in thread
From: Adam Ford @ 2021-01-10 12:07 UTC (permalink / raw)
  To: u-boot

On Sat, Jan 9, 2021 at 5:23 PM Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> Am 9. Januar 2021 22:23:01 MEZ schrieb Tom Rini <trini@konsulko.com>:
> >On Sat, Jan 09, 2021 at 08:59:01PM +0100, Heinrich Schuchardt wrote:
> >> Am 9. Januar 2021 20:40:04 MEZ schrieb Tom Rini <trini@konsulko.com>:
> >> >On Sat, Jan 09, 2021 at 08:33:40PM +0100, Heinrich Schuchardt wrote:
> >> >> On 1/9/21 7:58 PM, Tom Rini wrote:
> >> >> > On Sat, Jan 09, 2021 at 08:47:07PM +0200, Andy Shevchenko wrote:
> >> >> > > On Sat, Jan 9, 2021 at 8:06 PM Heinrich Schuchardt
> >> ><xypron.glpk@gmx.de> wrote:
> >> >> > > >
> >> >> > > > The comment for initrd_high in the coding and in README were
> >> >contradicting
> >> >> > > > and neither fully described what the coding does.
> >> >> > > >
> >> >> > > > Clarify the usage of the special value ~0UL for the
> >environment
> >> >variable
> >> >> > > > initrd_high.
> >> >> > >
> >> >> > > All those F:s are hard to read in the comments and
> >documentation
> >> >and
> >> >> > > typo prone. I would prefer to rephrase like "all 1:s value in
> >32-
> >> >or
> >> >> > > 64-bit format" or alike.
>
>
> Who would understand that?
>
> All 1s that is 111111111?
>
> We need something a non-developer will grasp. Copying the exact value from the readme is the easiest thing to do and the least typo prone.

What about -1?

adam
>
> Best regards
>
> Heinrich
>
> >> >> >
> >> >> > If we're going to improve this we should also note it's
> >discouraged
> >> >> > unless you know for certain there will be no overlap and it's
> >> >strongly
> >> >> > discouraged in default environments.
> >> >>
> >> >> What exactly is discouraged?
> >> >>
> >> >> * setting initrd_high to a value != ~0? Here I would agree.
> >> >> * setting intird_high to ~0? Why should we copy initrd to a
> >> >>   different place? Is it for some outdated Linux release?
> >> >
> >> >We should always default to allowing the initrd to be relocated
> >because
> >> >we can see (in many cases) overlap that will lead to failure to boot
> >> >but
> >> >this forces us to ignore that.  Having good default load values
> >means
> >> >we
> >> >don't have a problem here.
> >>
> >> We have an initrd that is already in memory. What could it overlap
> >> with that is not already overwritten?
> >
> >Having the kernel and initrd too close in memory has the kernel BSS
> >overwrite the initrd.  This has happened time and time again before
> >I went around making some platforms have reasonable (ie kernel early,
> >ramdisk in lowmem but beyond where a kernel+bss can be, etc) defaults
> >and pushing others to do the same.
> >
> >> Can you provide the text you want to see here?
> >
> >Off-hand, it should look more like the big comment block in
> >include/configs/ti_armv7_common.h and reference the Linux booting on
> >arm/arm64 documents while noting that other architectures have the same
> >fundamental issues and their exact limits may or may not be as well
> >documented.
>

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

* [PATCH 1/1] image: usage of value ~0UL for intrd_high
  2021-01-10 12:05             ` Heinrich Schuchardt
@ 2021-01-10 13:43               ` Tom Rini
  2021-01-10 16:20                 ` Heinrich Schuchardt
  0 siblings, 1 reply; 14+ messages in thread
From: Tom Rini @ 2021-01-10 13:43 UTC (permalink / raw)
  To: u-boot

On Sun, Jan 10, 2021 at 01:05:14PM +0100, Heinrich Schuchardt wrote:
> On 1/9/21 10:23 PM, Tom Rini wrote:
> > On Sat, Jan 09, 2021 at 08:59:01PM +0100, Heinrich Schuchardt wrote:
> > > Am 9. Januar 2021 20:40:04 MEZ schrieb Tom Rini <trini@konsulko.com>:
> > > > On Sat, Jan 09, 2021 at 08:33:40PM +0100, Heinrich Schuchardt wrote:
> > > > > On 1/9/21 7:58 PM, Tom Rini wrote:
> > > > > > On Sat, Jan 09, 2021 at 08:47:07PM +0200, Andy Shevchenko wrote:
> > > > > > > On Sat, Jan 9, 2021 at 8:06 PM Heinrich Schuchardt
> > > > <xypron.glpk@gmx.de> wrote:
> > > > > > > > 
> > > > > > > > The comment for initrd_high in the coding and in README were
> > > > contradicting
> > > > > > > > and neither fully described what the coding does.
> > > > > > > > 
> > > > > > > > Clarify the usage of the special value ~0UL for the environment
> > > > variable
> > > > > > > > initrd_high.
> > > > > > > 
> > > > > > > All those F:s are hard to read in the comments and documentation
> > > > and
> > > > > > > typo prone. I would prefer to rephrase like "all 1:s value in 32-
> > > > or
> > > > > > > 64-bit format" or alike.
> > > > > > 
> > > > > > If we're going to improve this we should also note it's discouraged
> > > > > > unless you know for certain there will be no overlap and it's
> > > > strongly
> > > > > > discouraged in default environments.
> > > > > 
> > > > > What exactly is discouraged?
> > > > > 
> > > > > * setting initrd_high to a value != ~0? Here I would agree.
> > > > > * setting intird_high to ~0? Why should we copy initrd to a
> > > > >    different place? Is it for some outdated Linux release?
> > > > 
> > > > We should always default to allowing the initrd to be relocated because
> > > > we can see (in many cases) overlap that will lead to failure to boot
> > > > but
> > > > this forces us to ignore that.  Having good default load values means
> > > > we
> > > > don't have a problem here.
> > > 
> > > We have an initrd that is already in memory. What could it overlap
> > > with that is not already overwritten?
> > 
> > Having the kernel and initrd too close in memory has the kernel BSS
> > overwrite the initrd.  This has happened time and time again before
> > I went around making some platforms have reasonable (ie kernel early,
> > ramdisk in lowmem but beyond where a kernel+bss can be, etc) defaults
> > and pushing others to do the same.
> > 
> > > Can you provide the text you want to see here?
> > 
> > Off-hand, it should look more like the big comment block in
> > include/configs/ti_armv7_common.h and reference the Linux booting on
> > arm/arm64 documents while noting that other architectures have the same
> > fundamental issues and their exact limits may or may not be as well
> > documented.
> > 
> 
> There is nothing in the include/configs/ti_armv7_common.h comments
> requiring to relocate initrd.

/*
 * We setup defaults based on constraints from the Linux kernel, which should
 * also be safe elsewhere.  We have the default load at 32MB into DDR (for
 * the kernel), FDT above 128MB (the maximum location for the end of the
 * kernel), and the ramdisk 512KB above that (allowing for hopefully never
 * seen large trees).  We say all of this must be within the first 256MB
 * as that will normally be within the kernel lowmem and thus visible via
 * bootm_size and we only run on platforms with 256MB or more of memory.
 *
 * As a temporary storage for DTBO blobs (which should be applied into DTB
 * blob), we use the location 15.5 MB above the ramdisk. If someone wants to
 * use ramdisk bigger than 15.5 MB, then DTBO can be loaded and applied to DTB
 * blob before loading the ramdisk, as DTBO location is only used as a temporary
 * storage, and can be re-used after 'fdt apply' command is done.
 */

Now, it's I gather not clear that we're NOT setting initrd_high here
(nor fdt_high) because we're setting reasonable defaults for everyone to
use, so long as they have enough memory.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210110/01e8536b/attachment.sig>

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

* [PATCH 1/1] image: usage of value ~0UL for intrd_high
  2021-01-09 23:23             ` Heinrich Schuchardt
  2021-01-10 12:07               ` Adam Ford
@ 2021-01-10 15:36               ` Andy Shevchenko
  1 sibling, 0 replies; 14+ messages in thread
From: Andy Shevchenko @ 2021-01-10 15:36 UTC (permalink / raw)
  To: u-boot

On Sun, Jan 10, 2021 at 1:23 AM Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> Am 9. Januar 2021 22:23:01 MEZ schrieb Tom Rini <trini@konsulko.com>:
> >On Sat, Jan 09, 2021 at 08:59:01PM +0100, Heinrich Schuchardt wrote:
> >> Am 9. Januar 2021 20:40:04 MEZ schrieb Tom Rini <trini@konsulko.com>:
> >> >On Sat, Jan 09, 2021 at 08:33:40PM +0100, Heinrich Schuchardt wrote:
> >> >> On 1/9/21 7:58 PM, Tom Rini wrote:
> >> >> > On Sat, Jan 09, 2021 at 08:47:07PM +0200, Andy Shevchenko wrote:
> >> >> > > On Sat, Jan 9, 2021 at 8:06 PM Heinrich Schuchardt
> >> ><xypron.glpk@gmx.de> wrote:
> >> >> > > >
> >> >> > > > The comment for initrd_high in the coding and in README were
> >> >contradicting
> >> >> > > > and neither fully described what the coding does.
> >> >> > > >
> >> >> > > > Clarify the usage of the special value ~0UL for the
> >environment
> >> >variable
> >> >> > > > initrd_high.
> >> >> > >
> >> >> > > All those F:s are hard to read in the comments and
> >documentation
> >> >and
> >> >> > > typo prone. I would prefer to rephrase like "all 1:s value in
> >32-
> >> >or
> >> >> > > 64-bit format" or alike.
>
>
> Who would understand that?
>
> All 1s that is 111111111?

Oh, com'n. Most of the users understand that. But we could go further
and be more verbose: "All bit set to 1".

> We need something a non-developer will grasp. Copying the exact value from the readme is the easiest thing to do and the least typo prone.
>
> Best regards
>
> Heinrich
>
> >> >> >
> >> >> > If we're going to improve this we should also note it's
> >discouraged
> >> >> > unless you know for certain there will be no overlap and it's
> >> >strongly
> >> >> > discouraged in default environments.
> >> >>
> >> >> What exactly is discouraged?
> >> >>
> >> >> * setting initrd_high to a value != ~0? Here I would agree.
> >> >> * setting intird_high to ~0? Why should we copy initrd to a
> >> >>   different place? Is it for some outdated Linux release?
> >> >
> >> >We should always default to allowing the initrd to be relocated
> >because
> >> >we can see (in many cases) overlap that will lead to failure to boot
> >> >but
> >> >this forces us to ignore that.  Having good default load values
> >means
> >> >we
> >> >don't have a problem here.
> >>
> >> We have an initrd that is already in memory. What could it overlap
> >> with that is not already overwritten?
> >
> >Having the kernel and initrd too close in memory has the kernel BSS
> >overwrite the initrd.  This has happened time and time again before
> >I went around making some platforms have reasonable (ie kernel early,
> >ramdisk in lowmem but beyond where a kernel+bss can be, etc) defaults
> >and pushing others to do the same.
> >
> >> Can you provide the text you want to see here?
> >
> >Off-hand, it should look more like the big comment block in
> >include/configs/ti_armv7_common.h and reference the Linux booting on
> >arm/arm64 documents while noting that other architectures have the same
> >fundamental issues and their exact limits may or may not be as well
> >documented.
>


-- 
With Best Regards,
Andy Shevchenko

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

* [PATCH 1/1] image: usage of value ~0UL for intrd_high
  2021-01-10 13:43               ` Tom Rini
@ 2021-01-10 16:20                 ` Heinrich Schuchardt
  2021-01-15 18:43                   ` Tom Rini
  0 siblings, 1 reply; 14+ messages in thread
From: Heinrich Schuchardt @ 2021-01-10 16:20 UTC (permalink / raw)
  To: u-boot

On 1/10/21 2:43 PM, Tom Rini wrote:
> On Sun, Jan 10, 2021 at 01:05:14PM +0100, Heinrich Schuchardt wrote:
>> On 1/9/21 10:23 PM, Tom Rini wrote:
>>> On Sat, Jan 09, 2021 at 08:59:01PM +0100, Heinrich Schuchardt wrote:
>>>> Am 9. Januar 2021 20:40:04 MEZ schrieb Tom Rini <trini@konsulko.com>:
>>>>> On Sat, Jan 09, 2021 at 08:33:40PM +0100, Heinrich Schuchardt wrote:
>>>>>> On 1/9/21 7:58 PM, Tom Rini wrote:
>>>>>>> On Sat, Jan 09, 2021 at 08:47:07PM +0200, Andy Shevchenko wrote:
>>>>>>>> On Sat, Jan 9, 2021 at 8:06 PM Heinrich Schuchardt
>>>>> <xypron.glpk@gmx.de> wrote:
>>>>>>>>>
>>>>>>>>> The comment for initrd_high in the coding and in README were
>>>>> contradicting
>>>>>>>>> and neither fully described what the coding does.
>>>>>>>>>
>>>>>>>>> Clarify the usage of the special value ~0UL for the environment
>>>>> variable
>>>>>>>>> initrd_high.
>>>>>>>>
>>>>>>>> All those F:s are hard to read in the comments and documentation
>>>>> and
>>>>>>>> typo prone. I would prefer to rephrase like "all 1:s value in 32-
>>>>> or
>>>>>>>> 64-bit format" or alike.
>>>>>>>
>>>>>>> If we're going to improve this we should also note it's discouraged
>>>>>>> unless you know for certain there will be no overlap and it's
>>>>> strongly
>>>>>>> discouraged in default environments.
>>>>>>
>>>>>> What exactly is discouraged?
>>>>>>
>>>>>> * setting initrd_high to a value != ~0? Here I would agree.
>>>>>> * setting intird_high to ~0? Why should we copy initrd to a
>>>>>>     different place? Is it for some outdated Linux release?
>>>>>
>>>>> We should always default to allowing the initrd to be relocated because
>>>>> we can see (in many cases) overlap that will lead to failure to boot
>>>>> but
>>>>> this forces us to ignore that.  Having good default load values means
>>>>> we
>>>>> don't have a problem here.
>>>>
>>>> We have an initrd that is already in memory. What could it overlap
>>>> with that is not already overwritten?
>>>
>>> Having the kernel and initrd too close in memory has the kernel BSS
>>> overwrite the initrd.  This has happened time and time again before
>>> I went around making some platforms have reasonable (ie kernel early,
>>> ramdisk in lowmem but beyond where a kernel+bss can be, etc) defaults
>>> and pushing others to do the same.
>>>
>>>> Can you provide the text you want to see here?
>>>
>>> Off-hand, it should look more like the big comment block in
>>> include/configs/ti_armv7_common.h and reference the Linux booting on
>>> arm/arm64 documents while noting that other architectures have the same
>>> fundamental issues and their exact limits may or may not be as well
>>> documented.
>>>
>>
>> There is nothing in the include/configs/ti_armv7_common.h comments
>> requiring to relocate initrd.
>
> /*
>   * We setup defaults based on constraints from the Linux kernel, which should
>   * also be safe elsewhere.  We have the default load at 32MB into DDR (for
>   * the kernel), FDT above 128MB (the maximum location for the end of the
>   * kernel), and the ramdisk 512KB above that (allowing for hopefully never
>   * seen large trees).  We say all of this must be within the first 256MB
>   * as that will normally be within the kernel lowmem and thus visible via
>   * bootm_size and we only run on platforms with 256MB or more of memory.
>   *
>   * As a temporary storage for DTBO blobs (which should be applied into DTB
>   * blob), we use the location 15.5 MB above the ramdisk. If someone wants to
>   * use ramdisk bigger than 15.5 MB, then DTBO can be loaded and applied to DTB
>   * blob before loading the ramdisk, as DTBO location is only used as a temporary
>   * storage, and can be re-used after 'fdt apply' command is done.
>   */

I cannot see how this relates to initrd relocation.

Best regards

Heinrich

>
> Now, it's I gather not clear that we're NOT setting initrd_high here
> (nor fdt_high) because we're setting reasonable defaults for everyone to
> use, so long as they have enough memory.
>

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

* [PATCH 1/1] image: usage of value ~0UL for intrd_high
  2021-01-10 16:20                 ` Heinrich Schuchardt
@ 2021-01-15 18:43                   ` Tom Rini
  0 siblings, 0 replies; 14+ messages in thread
From: Tom Rini @ 2021-01-15 18:43 UTC (permalink / raw)
  To: u-boot

On Sun, Jan 10, 2021 at 05:20:50PM +0100, Heinrich Schuchardt wrote:
> On 1/10/21 2:43 PM, Tom Rini wrote:
> > On Sun, Jan 10, 2021 at 01:05:14PM +0100, Heinrich Schuchardt wrote:
> > > On 1/9/21 10:23 PM, Tom Rini wrote:
> > > > On Sat, Jan 09, 2021 at 08:59:01PM +0100, Heinrich Schuchardt wrote:
> > > > > Am 9. Januar 2021 20:40:04 MEZ schrieb Tom Rini <trini@konsulko.com>:
> > > > > > On Sat, Jan 09, 2021 at 08:33:40PM +0100, Heinrich Schuchardt wrote:
> > > > > > > On 1/9/21 7:58 PM, Tom Rini wrote:
> > > > > > > > On Sat, Jan 09, 2021 at 08:47:07PM +0200, Andy Shevchenko wrote:
> > > > > > > > > On Sat, Jan 9, 2021 at 8:06 PM Heinrich Schuchardt
> > > > > > <xypron.glpk@gmx.de> wrote:
> > > > > > > > > > 
> > > > > > > > > > The comment for initrd_high in the coding and in README were
> > > > > > contradicting
> > > > > > > > > > and neither fully described what the coding does.
> > > > > > > > > > 
> > > > > > > > > > Clarify the usage of the special value ~0UL for the environment
> > > > > > variable
> > > > > > > > > > initrd_high.
> > > > > > > > > 
> > > > > > > > > All those F:s are hard to read in the comments and documentation
> > > > > > and
> > > > > > > > > typo prone. I would prefer to rephrase like "all 1:s value in 32-
> > > > > > or
> > > > > > > > > 64-bit format" or alike.
> > > > > > > > 
> > > > > > > > If we're going to improve this we should also note it's discouraged
> > > > > > > > unless you know for certain there will be no overlap and it's
> > > > > > strongly
> > > > > > > > discouraged in default environments.
> > > > > > > 
> > > > > > > What exactly is discouraged?
> > > > > > > 
> > > > > > > * setting initrd_high to a value != ~0? Here I would agree.
> > > > > > > * setting intird_high to ~0? Why should we copy initrd to a
> > > > > > >     different place? Is it for some outdated Linux release?
> > > > > > 
> > > > > > We should always default to allowing the initrd to be relocated because
> > > > > > we can see (in many cases) overlap that will lead to failure to boot
> > > > > > but
> > > > > > this forces us to ignore that.  Having good default load values means
> > > > > > we
> > > > > > don't have a problem here.
> > > > > 
> > > > > We have an initrd that is already in memory. What could it overlap
> > > > > with that is not already overwritten?
> > > > 
> > > > Having the kernel and initrd too close in memory has the kernel BSS
> > > > overwrite the initrd.  This has happened time and time again before
> > > > I went around making some platforms have reasonable (ie kernel early,
> > > > ramdisk in lowmem but beyond where a kernel+bss can be, etc) defaults
> > > > and pushing others to do the same.
> > > > 
> > > > > Can you provide the text you want to see here?
> > > > 
> > > > Off-hand, it should look more like the big comment block in
> > > > include/configs/ti_armv7_common.h and reference the Linux booting on
> > > > arm/arm64 documents while noting that other architectures have the same
> > > > fundamental issues and their exact limits may or may not be as well
> > > > documented.
> > > > 
> > > 
> > > There is nothing in the include/configs/ti_armv7_common.h comments
> > > requiring to relocate initrd.
> > 
> > /*
> >   * We setup defaults based on constraints from the Linux kernel, which should
> >   * also be safe elsewhere.  We have the default load at 32MB into DDR (for
> >   * the kernel), FDT above 128MB (the maximum location for the end of the
> >   * kernel), and the ramdisk 512KB above that (allowing for hopefully never
> >   * seen large trees).  We say all of this must be within the first 256MB
> >   * as that will normally be within the kernel lowmem and thus visible via
> >   * bootm_size and we only run on platforms with 256MB or more of memory.
> >   *
> >   * As a temporary storage for DTBO blobs (which should be applied into DTB
> >   * blob), we use the location 15.5 MB above the ramdisk. If someone wants to
> >   * use ramdisk bigger than 15.5 MB, then DTBO can be loaded and applied to DTB
> >   * blob before loading the ramdisk, as DTBO location is only used as a temporary
> >   * storage, and can be re-used after 'fdt apply' command is done.
> >   */
> 
> I cannot see how this relates to initrd relocation.

You cannot safely disable initrd relocation without ensuring it won't be
locked in an unsafe location first.  It's also _generally_ going to be
noise in the boot sequence and not an advisable default.  It should be
documented as part of how to tune a system for optimal boot times.  But
given how often defaults are copy/pasted to the next platform without
fully understanding why those values were picked is why what we use as
default in one platform needs to be very carefully done.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210115/4e632d1b/attachment.sig>

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

end of thread, other threads:[~2021-01-15 18:43 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-09 18:06 [PATCH 1/1] image: usage of value ~0UL for intrd_high Heinrich Schuchardt
2021-01-09 18:47 ` Andy Shevchenko
2021-01-09 18:58   ` Tom Rini
2021-01-09 19:33     ` Heinrich Schuchardt
2021-01-09 19:40       ` Tom Rini
2021-01-09 19:59         ` Heinrich Schuchardt
2021-01-09 21:23           ` Tom Rini
2021-01-09 23:23             ` Heinrich Schuchardt
2021-01-10 12:07               ` Adam Ford
2021-01-10 15:36               ` Andy Shevchenko
2021-01-10 12:05             ` Heinrich Schuchardt
2021-01-10 13:43               ` Tom Rini
2021-01-10 16:20                 ` Heinrich Schuchardt
2021-01-15 18:43                   ` Tom Rini

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.