diff mbox series

[v2,04/14] lib: Kconfig: add a config symbol for getting lmb memory map updates

Message ID 20241008181435.1753814-5-sughosh.ganu@linaro.org
State Superseded
Headers show
Series Make EFI memory allocations synchronous with LMB | expand

Commit Message

Sughosh Ganu Oct. 8, 2024, 6:14 p.m. UTC
Add a Kconfig symbol to enable getting updates on any memory map
changes that might be done by the LMB 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>
---
Changes since V1:
* Add a config for SPL stage

 lib/Kconfig | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Comments

Ilias Apalodimas Oct. 11, 2024, 10:26 a.m. UTC | #1
Hi Sughosh

On Tue, 8 Oct 2024 at 21:15, 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 the LMB module. This notification
> mechanism can then be used to have a synchronous view of allocated and
> free memory.
>

Are there size concerns to enable or disable this? I think we should
always sync and get rid of this

Thanks
/Ilias
> Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
> ---
> Changes since V1:
> * Add a config for SPL stage
>
>  lib/Kconfig | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
>
> diff --git a/lib/Kconfig b/lib/Kconfig
> index 1dd4f271595..61452f7ac94 100644
> --- a/lib/Kconfig
> +++ b/lib/Kconfig
> @@ -75,6 +75,23 @@ config LIB_UUID
>         bool
>         select SHA1
>
> +config MEM_MAP_UPDATE_NOTIFY
> +       bool "Get notified of any changes to the LMB memory map"
> +       default y if EFI_LOADER
> +       help
> +         Enable this option to get notification on any changes to the
> +         memory that is allocated or freed by the LMB module. This will
> +         allow different modules that allocate memory or maintain a memory
> +         map to have a synchronous view of available and allocated memory.
> +
> +config SPL_MEM_MAP_UPDATE_NOTIFY
> +       bool "Get notified of any changes to the LMB memory map in SPL"
> +       help
> +         Enable this option to get notification on any changes to the
> +         memory that is allocated or freed by the LMB module. This will
> +         allow different modules that allocate memory or maintain a memory
> +         map 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 Oct. 12, 2024, 7:40 a.m. UTC | #2
On Fri, 11 Oct 2024 at 15:56, Ilias Apalodimas
<ilias.apalodimas@linaro.org> wrote:
>
> Hi Sughosh
>
> On Tue, 8 Oct 2024 at 21:15, 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 the LMB module. This notification
> > mechanism can then be used to have a synchronous view of allocated and
> > free memory.
> >
>
> Are there size concerns to enable or disable this? I think we should
> always sync and get rid of this

This is needed only for platforms that enable EFI_LOADER. I haven't
checked if not having this check would result in any kind of build
failures and/or size impact on platforms that do not enable
EFI_LOADER. I will check this, and keep it if any build/size impact
happens.

-sughosh

>
> Thanks
> /Ilias
> > Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
> > ---
> > Changes since V1:
> > * Add a config for SPL stage
> >
> >  lib/Kconfig | 17 +++++++++++++++++
> >  1 file changed, 17 insertions(+)
> >
> > diff --git a/lib/Kconfig b/lib/Kconfig
> > index 1dd4f271595..61452f7ac94 100644
> > --- a/lib/Kconfig
> > +++ b/lib/Kconfig
> > @@ -75,6 +75,23 @@ config LIB_UUID
> >         bool
> >         select SHA1
> >
> > +config MEM_MAP_UPDATE_NOTIFY
> > +       bool "Get notified of any changes to the LMB memory map"
> > +       default y if EFI_LOADER
> > +       help
> > +         Enable this option to get notification on any changes to the
> > +         memory that is allocated or freed by the LMB module. This will
> > +         allow different modules that allocate memory or maintain a memory
> > +         map to have a synchronous view of available and allocated memory.
> > +
> > +config SPL_MEM_MAP_UPDATE_NOTIFY
> > +       bool "Get notified of any changes to the LMB memory map in SPL"
> > +       help
> > +         Enable this option to get notification on any changes to the
> > +         memory that is allocated or freed by the LMB module. This will
> > +         allow different modules that allocate memory or maintain a memory
> > +         map 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 Oct. 13, 2024, 7:48 a.m. UTC | #3
On Sat, 12 Oct 2024 at 13:10, Sughosh Ganu <sughosh.ganu@linaro.org> wrote:
>
> On Fri, 11 Oct 2024 at 15:56, Ilias Apalodimas
> <ilias.apalodimas@linaro.org> wrote:
> >
> > Hi Sughosh
> >
> > On Tue, 8 Oct 2024 at 21:15, 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 the LMB module. This notification
> > > mechanism can then be used to have a synchronous view of allocated and
> > > free memory.
> > >
> >
> > Are there size concerns to enable or disable this? I think we should
> > always sync and get rid of this
>
> This is needed only for platforms that enable EFI_LOADER. I haven't
> checked if not having this check would result in any kind of build
> failures and/or size impact on platforms that do not enable
> EFI_LOADER. I will check this, and keep it if any build/size impact
> happens.

 Not using the config symbol causes build failure on boards which do
not have EFI_LOADER enabled. So we need some kind of a check to call
the notification function lmb_map_update_notify(). If not this symbol,
there would have to be a check for EFI_LOADER, but I don't think
having checks for EFI_LOADER in lmb.c is a clean solution. Thanks.

-sughosh

>
> -sughosh
>
> >
> > Thanks
> > /Ilias
> > > Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
> > > ---
> > > Changes since V1:
> > > * Add a config for SPL stage
> > >
> > >  lib/Kconfig | 17 +++++++++++++++++
> > >  1 file changed, 17 insertions(+)
> > >
> > > diff --git a/lib/Kconfig b/lib/Kconfig
> > > index 1dd4f271595..61452f7ac94 100644
> > > --- a/lib/Kconfig
> > > +++ b/lib/Kconfig
> > > @@ -75,6 +75,23 @@ config LIB_UUID
> > >         bool
> > >         select SHA1
> > >
> > > +config MEM_MAP_UPDATE_NOTIFY
> > > +       bool "Get notified of any changes to the LMB memory map"
> > > +       default y if EFI_LOADER
> > > +       help
> > > +         Enable this option to get notification on any changes to the
> > > +         memory that is allocated or freed by the LMB module. This will
> > > +         allow different modules that allocate memory or maintain a memory
> > > +         map to have a synchronous view of available and allocated memory.
> > > +
> > > +config SPL_MEM_MAP_UPDATE_NOTIFY
> > > +       bool "Get notified of any changes to the LMB memory map in SPL"
> > > +       help
> > > +         Enable this option to get notification on any changes to the
> > > +         memory that is allocated or freed by the LMB module. This will
> > > +         allow different modules that allocate memory or maintain a memory
> > > +         map 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 1dd4f271595..61452f7ac94 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -75,6 +75,23 @@  config LIB_UUID
 	bool
 	select SHA1
 
+config MEM_MAP_UPDATE_NOTIFY
+	bool "Get notified of any changes to the LMB memory map"
+	default y if EFI_LOADER
+	help
+	  Enable this option to get notification on any changes to the
+	  memory that is allocated or freed by the LMB module. This will
+	  allow different modules that allocate memory or maintain a memory
+	  map to have a synchronous view of available and allocated memory.
+
+config SPL_MEM_MAP_UPDATE_NOTIFY
+	bool "Get notified of any changes to the LMB memory map in SPL"
+	help
+	  Enable this option to get notification on any changes to the
+	  memory that is allocated or freed by the LMB module. This will
+	  allow different modules that allocate memory or maintain a memory
+	  map to have a synchronous view of available and allocated memory.
+
 config RANDOM_UUID
 	bool "GPT Random UUID generation"
 	select LIB_UUID