[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aG7l0M1axoSDk1xa@agluck-desk3>
Date: Wed, 9 Jul 2025 14:57:36 -0700
From: "Luck, Tony" <tony.luck@...el.com>
To: Reinette Chatre <reinette.chatre@...el.com>
Cc: Fenghua Yu <fenghuay@...dia.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>,
Anil Keshavamurthy <anil.s.keshavamurthy@...el.com>,
Chen Yu <yu.c.chen@...el.com>, x86@...nel.org,
linux-kernel@...r.kernel.org, patches@...ts.linux.dev
Subject: Re: [PATCH v6 22/30] x86/resctrl: Read core telemetry events
On Wed, Jul 09, 2025 at 08:48:47AM -0700, Reinette Chatre wrote:
> Hi Tony,
>
> What does the "core" in the subject refer to?
The events are collected by each core. But since resctrl reports the
aggregated per-package values this is confusing. I'll drop "core" from
the Subject line.
[snip]
> > +/*
> > + * Read counter for an event on a domain (summing all aggregators
> > + * on the domain).
> > + */
> > +int intel_aet_read_event(int domid, int rmid, enum resctrl_event_id eventid,
> > + void *arch_priv, u64 *val)
> > +{
> > + struct pmt_event *pevt = arch_priv;
> > + struct mmio_info *mmi;
> > + struct event_group *e;
> > + u64 evtcount;
> > + void *pevt0;
>
> Should this be a struct pmt_event *?
I thought that too. But container_of() gets confused about types (I
think because the evts[] element is a flex array.
With "struct pmt_event *pevt0;" the compiler complains:
arch/x86/kernel/cpu/resctrl/intel_aet.c: In function ‘intel_aet_read_event’:
./include/linux/build_bug.h:78:41: error: static assertion failed: "pointer type mismatch in container_of()"
78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
| ^~~~~~~~~~~~~~
./include/linux/build_bug.h:77:34: note: in expansion of macro ‘__static_assert’
77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
| ^~~~~~~~~~~~~~~
./include/linux/container_of.h:20:9: note: in expansion of macro ‘static_assert’
20 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \
| ^~~~~~~~~~~~~
arch/x86/kernel/cpu/resctrl/intel_aet.c:311:13: note: in expansion of macro ‘container_of’
311 | e = container_of(pevt0, struct event_group, evts);
| ^~~~~~~~~~~~
Making it void * is the "get of of jail free" case in container_of()
with the test " || __same_type(*(ptr), void)"
If there is a better way to do this, let me know.
-Tony
Powered by blists - more mailing lists