[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZnxtZc140S11gFKL@agluck-desk3.sc.intel.com>
Date: Wed, 26 Jun 2024 12:35:01 -0700
From: Tony Luck <tony.luck@...el.com>
To: Reinette Chatre <reinette.chatre@...el.com>
Cc: Fenghua Yu <fenghua.yu@...el.com>,
Maciej Wieczor-Retman <maciej.wieczor-retman@...el.com>,
Peter Newman <peternewman@...gle.com>,
James Morse <james.morse@....com>, Babu Moger <babu.moger@....com>,
Drew Fustini <dfustini@...libre.com>,
Dave Martin <Dave.Martin@....com>, x86@...nel.org,
linux-kernel@...r.kernel.org, patches@...ts.linux.dev
Subject: Re: [PATCH v21 14/18] x86/resctrl: Fill out rmid_read structure for
smp_call*() to read a counter
> > diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c
> > index ff4e74594a19..877d898e8fd0 100644
> > --- a/arch/x86/kernel/cpu/resctrl/monitor.c
> > +++ b/arch/x86/kernel/cpu/resctrl/monitor.c
> > @@ -785,6 +785,7 @@ static void mbm_update(struct rdt_resource *r, struct rdt_mon_domain *d,
> > rr.first = false;
> > rr.r = r;
> > rr.d = d;
> > + rr.ci = NULL;
>
> This keeps using a struct rmid_read with random data from stack and initialize members based on
> knowledge about how the called functions use this struct. Could you please add initialization to
> all these places that use struct rmid_read with whatever is on the stack? This includes
> mon_add_all_files() introduced in this series.
> Something like below should do (in mon_add_all_files() - done as part of patch 10, mbm_update(),
> and mon_add_all_files():
> struct rmid_read rr = {0};
I'm making that change to the three places that struct rmid_read
is defined as a local variable.
Should I also remove "useless" assignments now that the structure
is zeroed by the compiler. I.e. in the above snip the rr.first = false;
and rr.ci = NULL;
I suspect there are others.
Or do they serve as useful hints to human readers of the code?
-Tony
Powered by blists - more mailing lists