diff mbox series

[RFC,11/31] lib: Kconfig: add a config symbol for getting memory map updates

Message ID 20240607185240.1892031-12-sughosh.ganu@linaro.org
State Superseded
Headers show
Series Make U-Boot memory reservations coherent | expand

Commit Message

Sughosh Ganu June 7, 2024, 6:52 p.m. UTC
Add a Kconfig symbol to enable getting updates on any memory map
changes that might be done by some other module. This notification
mechanism can then be used to have a synchronous view of allocated and
free memory.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
---
 lib/Kconfig | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Heinrich Schuchardt June 8, 2024, 3:53 a.m. UTC | #1
Am 7. Juni 2024 20:52:20 MESZ schrieb Sughosh Ganu <sughosh.ganu@linaro.org>:
>Add a Kconfig symbol to enable getting updates on any memory map
>changes that might be done by some other module. This notification
>mechanism can then be used to have a synchronous view of allocated and
>free memory.
>
>Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
>---
> lib/Kconfig | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
>diff --git a/lib/Kconfig b/lib/Kconfig
>index 189e6eb31a..9ea02ae006 100644
>--- a/lib/Kconfig
>+++ b/lib/Kconfig
>@@ -74,6 +74,15 @@ config HAVE_PRIVATE_LIBGCC
> config LIB_UUID
> 	bool
> 
>+config MEM_MAP_UPDATE_NOTIFY
>+	bool "Get notified of any changes to the memory map"

To the "LMB memory map"?

>+	default y if EVENT && LMB && EFI_LOADER

I am missing 'depends on EVENT && LMB' here. This should allow to simplify the 'default' statement. But why not use select?

Best regards

Heinrich



>+	help
>+	  Enable this option to get notification on any changes to the
>+	  memory that is allocated or freed. This will allow different
>+	  modules that allocate memory to have a synchronous view of available
>+	  and allocated memory.
>+
> config RANDOM_UUID
> 	bool "GPT Random UUID generation"
> 	select LIB_UUID
Heinrich Schuchardt June 8, 2024, 4:34 a.m. UTC | #2
On 6/8/24 05:53, Heinrich Schuchardt wrote:
>
>
> Am 7. Juni 2024 20:52:20 MESZ schrieb Sughosh Ganu <sughosh.ganu@linaro.org>:
>> Add a Kconfig symbol to enable getting updates on any memory map
>> changes that might be done by some other module. This notification
>> mechanism can then be used to have a synchronous view of allocated and
>> free memory.
>>
>> Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
>> ---
>> lib/Kconfig | 9 +++++++++
>> 1 file changed, 9 insertions(+)
>>
>> diff --git a/lib/Kconfig b/lib/Kconfig
>> index 189e6eb31a..9ea02ae006 100644
>> --- a/lib/Kconfig
>> +++ b/lib/Kconfig
>> @@ -74,6 +74,15 @@ config HAVE_PRIVATE_LIBGCC
>> config LIB_UUID
>> 	bool
>>
>> +config MEM_MAP_UPDATE_NOTIFY
>> +	bool "Get notified of any changes to the memory map"

Looking at later patches it seems you are sending memory map events from
different memory maps: LMB and EFI.

%s/to the memory map/to a memory map/

>
> To the "LMB memory map"?
>
>> +	default y if EVENT && LMB && EFI_LOADER
>
> I am missing 'depends on EVENT && LMB' here. This should allow to simplify the 'default' statement. But why not use select?

Sending messaging makes only sense if two memory management systems are
present. How about:

depends on EVENT && LMB && EFI_LOADER
default y

>
> Best regards
>
> Heinrich
>
>
>
>> +	help
>> +	  Enable this option to get notification on any changes to the
>> +	  memory that is allocated or freed. This will allow different
>> +	  modules that allocate memory to have a synchronous view of available
>> +	  and allocated memory.

Mentioning LMB and EFI here would be helpful:

help
   U-Boot manages memory allocation in multiple modules: LMB and EFI.
   To keep them synchronized memory change messages are used.
   Enable this symbol to ensure synchronization.

Best regards

Heinrich

>> +
>> config RANDOM_UUID
>> 	bool "GPT Random UUID generation"
>> 	select LIB_UUID
Ilias Apalodimas June 10, 2024, 11:44 a.m. UTC | #3
On Fri, 7 Jun 2024 at 21:54, Sughosh Ganu <sughosh.ganu@linaro.org> wrote:
>
> Add a Kconfig symbol to enable getting updates on any memory map
> changes that might be done by some other module. This notification
> mechanism can then be used to have a synchronous view of allocated and
> free memory.

Is there any chance we want to build a firmware that allows memory not
to be reserved?
I think we should make the feature mandatory

Cheers
/Ilias
>
> Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
> ---
>  lib/Kconfig | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/lib/Kconfig b/lib/Kconfig
> index 189e6eb31a..9ea02ae006 100644
> --- a/lib/Kconfig
> +++ b/lib/Kconfig
> @@ -74,6 +74,15 @@ config HAVE_PRIVATE_LIBGCC
>  config LIB_UUID
>         bool
>
> +config MEM_MAP_UPDATE_NOTIFY
> +       bool "Get notified of any changes to the memory map"
> +       default y if EVENT && LMB && EFI_LOADER
> +       help
> +         Enable this option to get notification on any changes to the
> +         memory that is allocated or freed. This will allow different
> +         modules that allocate memory to have a synchronous view of available
> +         and allocated memory.
> +
>  config RANDOM_UUID
>         bool "GPT Random UUID generation"
>         select LIB_UUID
> --
> 2.34.1
>
Sughosh Ganu June 10, 2024, 11:47 a.m. UTC | #4
hi Ilias,

On Mon, 10 Jun 2024 at 17:15, Ilias Apalodimas
<ilias.apalodimas@linaro.org> wrote:
>
> On Fri, 7 Jun 2024 at 21:54, Sughosh Ganu <sughosh.ganu@linaro.org> wrote:
> >
> > Add a Kconfig symbol to enable getting updates on any memory map
> > changes that might be done by some other module. This notification
> > mechanism can then be used to have a synchronous view of allocated and
> > free memory.
>
> Is there any chance we want to build a firmware that allows memory not
> to be reserved?
> I think we should make the feature mandatory

LMB is enabled for all architectures, but the EFI code is not. This
config is only for enabling the notification code. Which is why it is
enabled only when LMB and EFI_LOADER configs are enabled.

-sughosh

>
> Cheers
> /Ilias
> >
> > Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
> > ---
> >  lib/Kconfig | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> >
> > diff --git a/lib/Kconfig b/lib/Kconfig
> > index 189e6eb31a..9ea02ae006 100644
> > --- a/lib/Kconfig
> > +++ b/lib/Kconfig
> > @@ -74,6 +74,15 @@ config HAVE_PRIVATE_LIBGCC
> >  config LIB_UUID
> >         bool
> >
> > +config MEM_MAP_UPDATE_NOTIFY
> > +       bool "Get notified of any changes to the memory map"
> > +       default y if EVENT && LMB && EFI_LOADER
> > +       help
> > +         Enable this option to get notification on any changes to the
> > +         memory that is allocated or freed. This will allow different
> > +         modules that allocate memory to have a synchronous view of available
> > +         and allocated memory.
> > +
> >  config RANDOM_UUID
> >         bool "GPT Random UUID generation"
> >         select LIB_UUID
> > --
> > 2.34.1
> >
diff mbox series

Patch

diff --git a/lib/Kconfig b/lib/Kconfig
index 189e6eb31a..9ea02ae006 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -74,6 +74,15 @@  config HAVE_PRIVATE_LIBGCC
 config LIB_UUID
 	bool
 
+config MEM_MAP_UPDATE_NOTIFY
+	bool "Get notified of any changes to the memory map"
+	default y if EVENT && LMB && EFI_LOADER
+	help
+	  Enable this option to get notification on any changes to the
+	  memory that is allocated or freed. This will allow different
+	  modules that allocate memory to have a synchronous view of available
+	  and allocated memory.
+
 config RANDOM_UUID
 	bool "GPT Random UUID generation"
 	select LIB_UUID