diff mbox

[U-Boot,v2,6/8] kconfig: malloc: add option for skip memset at malloc init

Message ID 1424099601-14979-7-git-send-email-p.marczak@samsung.com
State Changes Requested
Delegated to: Minkyu Kang
Headers show

Commit Message

Przemyslaw Marczak Feb. 16, 2015, 3:13 p.m. UTC
Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
---
 Kconfig | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

Comments

Simon Glass Feb. 18, 2015, 4:32 a.m. UTC | #1
Hi Przemyslaw,

On 16 February 2015 at 08:13, Przemyslaw Marczak <p.marczak@samsung.com> wrote:
> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> ---
>  Kconfig | 26 +++++++++++++++++++-------
>  1 file changed, 19 insertions(+), 7 deletions(-)
>
> diff --git a/Kconfig b/Kconfig
> index 4157da3..e08e44a 100644
> --- a/Kconfig
> +++ b/Kconfig
> @@ -57,13 +57,25 @@ config CC_OPTIMIZE_FOR_SIZE
>           This option is enabled by default for U-Boot.

Ah, you have done this. Then I think you can merge this patch with the
dlmalloc patch and drop the README one.

>
>  menuconfig EXPERT
> -        bool "Configure standard U-Boot features (expert users)"
> -        help
> -          This option allows certain base U-Boot options and settings
> -          to be disabled or tweaked. This is for specialized
> -          environments which can tolerate a "non-standard" U-Boot.
> -          Only use this if you really know what you are doing.
> -
> +       bool "Configure standard U-Boot features (expert users)"
> +       help
> +         This option allows certain base U-Boot options and settings
> +         to be disabled or tweaked. This is for specialized
> +         environments which can tolerate a "non-standard" U-Boot.
> +         Only use this if you really know what you are doing.
> +
> +if EXPERT
> +       config SYS_MALLOC_INIT_SKIP_ZEROING
> +       bool "Skip memset at malloc init (reduce boot time)"
> +       help
> +        This avoids zeroing memory reserved for malloc at malloc init.
> +        Significant boot time reduction is visible for configs in which
> +        CONFIG_SYS_MALLOC_LEN value, has more than few MiB.
> +        Useful for bzip2, bmp logo.
> +        Warning:
> +        When enable, make sure that calloc() is used when zeroed
> +        memory is needed.
> +endif
>  endmenu                # General setup
>
>  menu "Boot images"
> --
> 1.9.1
>

Regards,
Simon
Przemyslaw Marczak Feb. 18, 2015, 12:40 p.m. UTC | #2
Hi Simon,

On 02/18/2015 05:32 AM, Simon Glass wrote:
> Hi Przemyslaw,
>
> On 16 February 2015 at 08:13, Przemyslaw Marczak <p.marczak@samsung.com> wrote:
>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>> ---
>>   Kconfig | 26 +++++++++++++++++++-------
>>   1 file changed, 19 insertions(+), 7 deletions(-)
>>
>> diff --git a/Kconfig b/Kconfig
>> index 4157da3..e08e44a 100644
>> --- a/Kconfig
>> +++ b/Kconfig
>> @@ -57,13 +57,25 @@ config CC_OPTIMIZE_FOR_SIZE
>>            This option is enabled by default for U-Boot.
>
> Ah, you have done this. Then I think you can merge this patch with the
> dlmalloc patch and drop the README one.
>

Shouldn't we keep both, README and Kconfig help?
Kconfig is just a configuration tool, README is a documentation.
Sometimes it could be faster to find something in the text instead of 
config.

>>
>>   menuconfig EXPERT
>> -        bool "Configure standard U-Boot features (expert users)"
>> -        help
>> -          This option allows certain base U-Boot options and settings
>> -          to be disabled or tweaked. This is for specialized
>> -          environments which can tolerate a "non-standard" U-Boot.
>> -          Only use this if you really know what you are doing.
>> -
>> +       bool "Configure standard U-Boot features (expert users)"
>> +       help
>> +         This option allows certain base U-Boot options and settings
>> +         to be disabled or tweaked. This is for specialized
>> +         environments which can tolerate a "non-standard" U-Boot.
>> +         Only use this if you really know what you are doing.
>> +
>> +if EXPERT
>> +       config SYS_MALLOC_INIT_SKIP_ZEROING
>> +       bool "Skip memset at malloc init (reduce boot time)"
>> +       help
>> +        This avoids zeroing memory reserved for malloc at malloc init.
>> +        Significant boot time reduction is visible for configs in which
>> +        CONFIG_SYS_MALLOC_LEN value, has more than few MiB.
>> +        Useful for bzip2, bmp logo.
>> +        Warning:
>> +        When enable, make sure that calloc() is used when zeroed
>> +        memory is needed.
>> +endif
>>   endmenu                # General setup
>>
>>   menu "Boot images"
>> --
>> 1.9.1
>>
>
> Regards,
> Simon
>

Best regards,
Simon Glass Feb. 19, 2015, 6:59 p.m. UTC | #3
+Masahiro

Hi,

On 18 February 2015 at 05:40, Przemyslaw Marczak <p.marczak@samsung.com> wrote:
> Hi Simon,
>
> On 02/18/2015 05:32 AM, Simon Glass wrote:
>>
>> Hi Przemyslaw,
>>
>> On 16 February 2015 at 08:13, Przemyslaw Marczak <p.marczak@samsung.com>
>> wrote:
>>>
>>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>>> ---
>>>   Kconfig | 26 +++++++++++++++++++-------
>>>   1 file changed, 19 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/Kconfig b/Kconfig
>>> index 4157da3..e08e44a 100644
>>> --- a/Kconfig
>>> +++ b/Kconfig
>>> @@ -57,13 +57,25 @@ config CC_OPTIMIZE_FOR_SIZE
>>>            This option is enabled by default for U-Boot.
>>
>>
>> Ah, you have done this. Then I think you can merge this patch with the
>> dlmalloc patch and drop the README one.
>>
>
> Shouldn't we keep both, README and Kconfig help?
> Kconfig is just a configuration tool, README is a documentation.
> Sometimes it could be faster to find something in the text instead of
> config.

Agreed, but isn't it going to be a pain to add it in both places and
keep it in sync? Maybe we could create a script which creates a
README.kconfig containing all the options and help.

>
>
>>>
>>>   menuconfig EXPERT
>>> -        bool "Configure standard U-Boot features (expert users)"
>>> -        help
>>> -          This option allows certain base U-Boot options and settings
>>> -          to be disabled or tweaked. This is for specialized
>>> -          environments which can tolerate a "non-standard" U-Boot.
>>> -          Only use this if you really know what you are doing.
>>> -
>>> +       bool "Configure standard U-Boot features (expert users)"
>>> +       help
>>> +         This option allows certain base U-Boot options and settings
>>> +         to be disabled or tweaked. This is for specialized
>>> +         environments which can tolerate a "non-standard" U-Boot.
>>> +         Only use this if you really know what you are doing.
>>> +
>>> +if EXPERT
>>> +       config SYS_MALLOC_INIT_SKIP_ZEROING
>>> +       bool "Skip memset at malloc init (reduce boot time)"
>>> +       help
>>> +        This avoids zeroing memory reserved for malloc at malloc init.
>>> +        Significant boot time reduction is visible for configs in which
>>> +        CONFIG_SYS_MALLOC_LEN value, has more than few MiB.
>>> +        Useful for bzip2, bmp logo.
>>> +        Warning:
>>> +        When enable, make sure that calloc() is used when zeroed
>>> +        memory is needed.
>>> +endif
>>>   endmenu                # General setup
>>>
>>>   menu "Boot images"

Regards,
Simon
Masahiro Yamada Feb. 20, 2015, 7:32 a.m. UTC | #4
On Thu, 19 Feb 2015 11:59:07 -0700
Simon Glass <sjg@chromium.org> wrote:

> +Masahiro
> 
> Hi,
> 
> On 18 February 2015 at 05:40, Przemyslaw Marczak <p.marczak@samsung.com> wrote:
> > Hi Simon,
> >
> > On 02/18/2015 05:32 AM, Simon Glass wrote:
> >>
> >> Hi Przemyslaw,
> >>
> >> On 16 February 2015 at 08:13, Przemyslaw Marczak <p.marczak@samsung.com>
> >> wrote:
> >>>
> >>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
> >>> ---
> >>>   Kconfig | 26 +++++++++++++++++++-------
> >>>   1 file changed, 19 insertions(+), 7 deletions(-)
> >>>
> >>> diff --git a/Kconfig b/Kconfig
> >>> index 4157da3..e08e44a 100644
> >>> --- a/Kconfig
> >>> +++ b/Kconfig
> >>> @@ -57,13 +57,25 @@ config CC_OPTIMIZE_FOR_SIZE
> >>>            This option is enabled by default for U-Boot.
> >>
> >>
> >> Ah, you have done this. Then I think you can merge this patch with the
> >> dlmalloc patch and drop the README one.
> >>
> >
> > Shouldn't we keep both, README and Kconfig help?
> > Kconfig is just a configuration tool, README is a documentation.
> > Sometimes it could be faster to find something in the text instead of
> > config.
> 
> Agreed, but isn't it going to be a pain to add it in both places and
> keep it in sync? Maybe we could create a script which creates a
> README.kconfig containing all the options and help.
> 

I agree with Simon.

README is useful when we need a wider and more general explanation about a feature,
for ex. doc/driver-model/README.txt

Per-config explanation should be documented in Kconfig only.

Another reasone I prefer Kconfig help is:
When we remove a CONFIG from Kconfig, the documentation in a separete README
might be left over.


BTW, I did not know that U-Boot filled all the malloc space with zero.

I guess our consensus is that malloc() returns uninitialized memory.

So, I am happy with this patch.  (Perhaps, could it be enabled by default? )



Best Regards
Masahiro Yamada
Przemyslaw Marczak Feb. 20, 2015, 9:46 a.m. UTC | #5
Hello,

On 02/20/2015 08:32 AM, Masahiro Yamada wrote:
>
> On Thu, 19 Feb 2015 11:59:07 -0700
> Simon Glass <sjg@chromium.org> wrote:
>
>> +Masahiro
>>
>> Hi,
>>
>> On 18 February 2015 at 05:40, Przemyslaw Marczak <p.marczak@samsung.com> wrote:
>>> Hi Simon,
>>>
>>> On 02/18/2015 05:32 AM, Simon Glass wrote:
>>>>
>>>> Hi Przemyslaw,
>>>>
>>>> On 16 February 2015 at 08:13, Przemyslaw Marczak <p.marczak@samsung.com>
>>>> wrote:
>>>>>
>>>>> Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
>>>>> ---
>>>>>    Kconfig | 26 +++++++++++++++++++-------
>>>>>    1 file changed, 19 insertions(+), 7 deletions(-)
>>>>>
>>>>> diff --git a/Kconfig b/Kconfig
>>>>> index 4157da3..e08e44a 100644
>>>>> --- a/Kconfig
>>>>> +++ b/Kconfig
>>>>> @@ -57,13 +57,25 @@ config CC_OPTIMIZE_FOR_SIZE
>>>>>             This option is enabled by default for U-Boot.
>>>>
>>>>
>>>> Ah, you have done this. Then I think you can merge this patch with the
>>>> dlmalloc patch and drop the README one.
>>>>
>>>
>>> Shouldn't we keep both, README and Kconfig help?
>>> Kconfig is just a configuration tool, README is a documentation.
>>> Sometimes it could be faster to find something in the text instead of
>>> config.
>>
>> Agreed, but isn't it going to be a pain to add it in both places and
>> keep it in sync? Maybe we could create a script which creates a
>> README.kconfig containing all the options and help.
>>
>
> I agree with Simon.
>
> README is useful when we need a wider and more general explanation about a feature,
> for ex. doc/driver-model/README.txt
>
> Per-config explanation should be documented in Kconfig only.
>
> Another reasone I prefer Kconfig help is:
> When we remove a CONFIG from Kconfig, the documentation in a separete README
> might be left over.
>

Yes, but this is the maintainer role, to keep it in sync. It's no 
problem for me. I can remove the README entry.
I just think that it may be useful for people who just starting the fun 
with U-Boot.

>
> BTW, I did not know that U-Boot filled all the malloc space with zero.

The same as I, but checking the execution time of some functions, shows 
that something takes too long time.

>
> I guess our consensus is that malloc() returns uninitialized memory.

Yes, as should it do.

>
> So, I am happy with this patch.  (Perhaps, could it be enabled by default? )
>

This could potentially break something. Let's give a free hand to 
maintainers to enable this after test. And this is why I add such config 
option.

>
>
> Best Regards
> Masahiro Yamada
>
>

So as Simon and Masahiro wish, I will remove the README entry for this.

Best regards,
diff mbox

Patch

diff --git a/Kconfig b/Kconfig
index 4157da3..e08e44a 100644
--- a/Kconfig
+++ b/Kconfig
@@ -57,13 +57,25 @@  config CC_OPTIMIZE_FOR_SIZE
 	  This option is enabled by default for U-Boot.
 
 menuconfig EXPERT
-        bool "Configure standard U-Boot features (expert users)"
-        help
-          This option allows certain base U-Boot options and settings
-          to be disabled or tweaked. This is for specialized
-          environments which can tolerate a "non-standard" U-Boot.
-          Only use this if you really know what you are doing.
-
+	bool "Configure standard U-Boot features (expert users)"
+	help
+	  This option allows certain base U-Boot options and settings
+	  to be disabled or tweaked. This is for specialized
+	  environments which can tolerate a "non-standard" U-Boot.
+	  Only use this if you really know what you are doing.
+
+if EXPERT
+	config SYS_MALLOC_INIT_SKIP_ZEROING
+	bool "Skip memset at malloc init (reduce boot time)"
+	help
+	 This avoids zeroing memory reserved for malloc at malloc init.
+	 Significant boot time reduction is visible for configs in which
+	 CONFIG_SYS_MALLOC_LEN value, has more than few MiB.
+	 Useful for bzip2, bmp logo.
+	 Warning:
+	 When enable, make sure that calloc() is used when zeroed
+	 memory is needed.
+endif
 endmenu		# General setup
 
 menu "Boot images"