diff mbox series

[05/16] lib: Kconfig: add a config symbol for getting lmb memory map updates

Message ID 20240905082811.1585467-6-sughosh.ganu@linaro.org
State New
Headers show
Series Make EFI memory allocations synchronous with LMB | expand

Commit Message

Sughosh Ganu Sept. 5, 2024, 8:28 a.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>
---
 lib/Kconfig | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Heinrich Schuchardt Sept. 14, 2024, 3:11 p.m. UTC | #1
On 9/5/24 10:28, Sughosh Ganu 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.
>
> Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
> ---
>   lib/Kconfig | 11 +++++++++++
>   1 file changed, 11 insertions(+)
>
> diff --git a/lib/Kconfig b/lib/Kconfig
> index 5f282ecb54..2e73cda580 100644
> --- a/lib/Kconfig
> +++ b/lib/Kconfig
> @@ -74,6 +74,17 @@ config HAVE_PRIVATE_LIBGCC
>   config LIB_UUID
>   	bool
>
> +config MEM_MAP_UPDATE_NOTIFY
> +	bool "Get notified of any changes to the LMB memory map"
> +	depends on LMB && EFI_LOADER
> +	select EVENT
> +	default y
> +	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.

We should have only one store for all LMB allocations. They should not
be duplicated in the EFI sub-system.

The event is only needed to notify EFI_EVENT_GROUP_MEMORY_MAP_CHANGE.

Best regards

Heinrich


> +
>   config RANDOM_UUID
>   	bool "GPT Random UUID generation"
>   	select LIB_UUID
Sughosh Ganu Sept. 17, 2024, 12:36 p.m. UTC | #2
On Sat, 14 Sept 2024 at 20:41, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>
> On 9/5/24 10:28, Sughosh Ganu 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.
> >
> > Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
> > ---
> >   lib/Kconfig | 11 +++++++++++
> >   1 file changed, 11 insertions(+)
> >
> > diff --git a/lib/Kconfig b/lib/Kconfig
> > index 5f282ecb54..2e73cda580 100644
> > --- a/lib/Kconfig
> > +++ b/lib/Kconfig
> > @@ -74,6 +74,17 @@ config HAVE_PRIVATE_LIBGCC
> >   config LIB_UUID
> >       bool
> >
> > +config MEM_MAP_UPDATE_NOTIFY
> > +     bool "Get notified of any changes to the LMB memory map"
> > +     depends on LMB && EFI_LOADER
> > +     select EVENT
> > +     default y
> > +     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.
>
> We should have only one store for all LMB allocations. They should not
> be duplicated in the EFI sub-system.

We do have a single allocator for handling the conventional memory,
which is LMB. The notifications are needed so that the EFI memory map
also has visibility of which memory regions are currently being used,
and which are free. So, for e.g. if a user wants to view the EFI
memory map with the 'efidebug memmap' command, the EFI memory map
should be up-to-date when it comes to conventional memory. And this
also includes memory which is being consumed by other non-EFI modules.

-sughosh

>
> The event is only needed to notify EFI_EVENT_GROUP_MEMORY_MAP_CHANGE.
>
> Best regards
>
> Heinrich
>
>
> > +
> >   config RANDOM_UUID
> >       bool "GPT Random UUID generation"
> >       select LIB_UUID
>
diff mbox series

Patch

diff --git a/lib/Kconfig b/lib/Kconfig
index 5f282ecb54..2e73cda580 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -74,6 +74,17 @@  config HAVE_PRIVATE_LIBGCC
 config LIB_UUID
 	bool
 
+config MEM_MAP_UPDATE_NOTIFY
+	bool "Get notified of any changes to the LMB memory map"
+	depends on LMB && EFI_LOADER
+	select EVENT
+	default y
+	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