diff mbox series

[v4,1/7] i386/cpu: add IsDefined flag to smp-cache property

Message ID 20241216175414.1953-2-alireza.sanaee@huawei.com (mailing list archive)
State New
Headers show
Series Specifying cache topology on ARM | expand

Commit Message

Alireza Sanaee Dec. 16, 2024, 5:54 p.m. UTC
This commit adds IsDefined flag to the object and this helps in avoiding
extra checks for every single layer of caches in both x86 and ARM.

There is already a discussion on mailing list to have this flag. A
patch that enables this flag will follow later.

Signed-off-by: Alireza Sanaee <alireza.sanaee@huawei.com>
---
 hw/core/machine-smp.c | 2 ++
 include/hw/boards.h   | 1 +
 2 files changed, 3 insertions(+)

Comments

Jonathan Cameron Dec. 23, 2024, 5:48 p.m. UTC | #1
On Mon, 16 Dec 2024 17:54:08 +0000
Alireza Sanaee <alireza.sanaee@huawei.com> wrote:

> This commit adds IsDefined flag to the object and this helps in avoiding
> extra checks for every single layer of caches in both x86 and ARM.
> 
> There is already a discussion on mailing list to have this flag. A
> patch that enables this flag will follow later.
> 
> Signed-off-by: Alireza Sanaee <alireza.sanaee@huawei.com>
Makes sense.  Zhao Liu, is this something you plan to use in the x86
code?

Either way
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

> ---
>  hw/core/machine-smp.c | 2 ++
>  include/hw/boards.h   | 1 +
>  2 files changed, 3 insertions(+)
> 
> diff --git a/hw/core/machine-smp.c b/hw/core/machine-smp.c
> index 9a28194676..5a02bbf584 100644
> --- a/hw/core/machine-smp.c
> +++ b/hw/core/machine-smp.c
> @@ -371,6 +371,8 @@ bool machine_parse_smp_cache(MachineState *ms,
>          return false;
>      }
>  
> +    ms->smp_cache.IsDefined = true;
> +
>      return true;
>  }
>  
> diff --git a/include/hw/boards.h b/include/hw/boards.h
> index db2aa2b706..2883a57084 100644
> --- a/include/hw/boards.h
> +++ b/include/hw/boards.h
> @@ -373,6 +373,7 @@ typedef struct CpuTopology {
>  
>  typedef struct SmpCache {
>      SmpCacheProperties props[CACHE_LEVEL_AND_TYPE__MAX];
> +    bool IsDefined;
>  } SmpCache;
>  
>  /**
Alireza Sanaee Dec. 24, 2024, 8:41 a.m. UTC | #2
On Mon, 23 Dec 2024 17:48:18 +0000
Jonathan Cameron <Jonathan.Cameron@huawei.com> wrote:

> On Mon, 16 Dec 2024 17:54:08 +0000
> Alireza Sanaee <alireza.sanaee@huawei.com> wrote:
> 
> > This commit adds IsDefined flag to the object and this helps in
> > avoiding extra checks for every single layer of caches in both x86
> > and ARM.
> > 
> > There is already a discussion on mailing list to have this flag. A
> > patch that enables this flag will follow later.
> > 
> > Signed-off-by: Alireza Sanaee <alireza.sanaee@huawei.com>  
> Makes sense.  Zhao Liu, is this something you plan to use in the x86
> code?

Hi Jonathan,

Yes this one comes from Zhao Liu's new patch-set, thanks to him. I will
have to send another version given that.
> 
> Either way
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> > ---
> >  hw/core/machine-smp.c | 2 ++
> >  include/hw/boards.h   | 1 +
> >  2 files changed, 3 insertions(+)
> > 
> > diff --git a/hw/core/machine-smp.c b/hw/core/machine-smp.c
> > index 9a28194676..5a02bbf584 100644
> > --- a/hw/core/machine-smp.c
> > +++ b/hw/core/machine-smp.c
> > @@ -371,6 +371,8 @@ bool machine_parse_smp_cache(MachineState *ms,
> >          return false;
> >      }
> >  
> > +    ms->smp_cache.IsDefined = true;
> > +
> >      return true;
> >  }
> >  
> > diff --git a/include/hw/boards.h b/include/hw/boards.h
> > index db2aa2b706..2883a57084 100644
> > --- a/include/hw/boards.h
> > +++ b/include/hw/boards.h
> > @@ -373,6 +373,7 @@ typedef struct CpuTopology {
> >  
> >  typedef struct SmpCache {
> >      SmpCacheProperties props[CACHE_LEVEL_AND_TYPE__MAX];
> > +    bool IsDefined;
> >  } SmpCache;
> >  
> >  /**  
>
Zhao Liu Dec. 24, 2024, 10:24 a.m. UTC | #3
On Tue, Dec 24, 2024 at 08:41:27AM +0000, Alireza Sanaee wrote:
> Date: Tue, 24 Dec 2024 08:41:27 +0000
> From: Alireza Sanaee <alireza.sanaee@huawei.com>
> Subject: Re: [PATCH v4 1/7] i386/cpu: add IsDefined flag to smp-cache
>  property
> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.42; x86_64-w64-mingw32)
> 
> On Mon, 23 Dec 2024 17:48:18 +0000
> Jonathan Cameron <Jonathan.Cameron@huawei.com> wrote:
> 
> > On Mon, 16 Dec 2024 17:54:08 +0000
> > Alireza Sanaee <alireza.sanaee@huawei.com> wrote:
> > 
> > > This commit adds IsDefined flag to the object and this helps in
> > > avoiding extra checks for every single layer of caches in both x86
> > > and ARM.
> > > 
> > > There is already a discussion on mailing list to have this flag. A
> > > patch that enables this flag will follow later.
> > > 
> > > Signed-off-by: Alireza Sanaee <alireza.sanaee@huawei.com>  
> > Makes sense.  Zhao Liu, is this something you plan to use in the x86
> > code?
> 
> Hi Jonathan,
> 
> Yes this one comes from Zhao Liu's new patch-set, thanks to him. I will
> have to send another version given that.

Welcome! You can rebase this series on my v6. This way, there won't be
any conflicts, and once v6 is merged, yours can also be naturally picked
by maintainer. :-)

Regards,
Zhao
diff mbox series

Patch

diff --git a/hw/core/machine-smp.c b/hw/core/machine-smp.c
index 9a28194676..5a02bbf584 100644
--- a/hw/core/machine-smp.c
+++ b/hw/core/machine-smp.c
@@ -371,6 +371,8 @@  bool machine_parse_smp_cache(MachineState *ms,
         return false;
     }
 
+    ms->smp_cache.IsDefined = true;
+
     return true;
 }
 
diff --git a/include/hw/boards.h b/include/hw/boards.h
index db2aa2b706..2883a57084 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -373,6 +373,7 @@  typedef struct CpuTopology {
 
 typedef struct SmpCache {
     SmpCacheProperties props[CACHE_LEVEL_AND_TYPE__MAX];
+    bool IsDefined;
 } SmpCache;
 
 /**