Re: [PATCH RFC v2 3/3] cxl/memdev: Register for and process CPER events

From: Jonathan Cameron
Date: Wed Nov 01 2023 - 13:36:08 EST


On Tue, 31 Oct 2023 10:13:40 -0700
Ira Weiny <ira.weiny@xxxxxxxxx> wrote:

> Dan Williams wrote:
> > Ira Weiny wrote:
> > > If the firmware has configured CXL event support to be firmware first
> > > the OS can process those events through CPER records. Matching memory
> > > devices to the CPER records can be done via the serial number which is
> > > part of the CPER record header.
> > >
> > > Detect firmware first, register a notifier callback for each memdev, and
> > > trace events when they match a device registered.
> > >
> > > Signed-off-by: Ira Weiny <ira.weiny@xxxxxxxxx>
> > >
> > [..]
> >
> > The changes requested in patch2 cover all of the comments I currently
> > have on this patch, just one more cleanup below:
> >
> > > +#define CXL_EVENT_HDR_FLAGS_REC_SEVERITY GENMASK(1, 0)
> > > +int cxl_cper_event_call(struct notifier_block *nb, unsigned long action, void *data)
> > > +{
> > > + struct cxl_cper_notifier_data *nd = data;
> > > + struct cxl_event_record_raw record = (struct cxl_event_record_raw) {
> > > + .hdr.id = UUID_INIT(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
> > > + };
> >
> > Just do:
> >
> > struct cxl_event_record_raw record = { 0 };

FWIW (I'm in a pedantic mood), unless you care about that specific 0
= {};
equally valid.
c99

"If there are fewer initializers in a brace-enclosed list than there
are elements or members of an aggregate ... the remainder of the
aggregate shall be initiali\ed implicitly the same as objects
that have static storage duration."

i.e. to 0.

Nothing says that fewer != 0 ;)


> >
> > ...and the compiler will take care of the rest as initializing any field
> > automatically initializes everything else to zero.
>
> Not quite sure what I was thinking.
>
> This works better but I think I can avoid needing this initialization all
> together by reworking the structures. For now I have made the change and
> I'll see how it falls out.
>
> Thanks,
> Ira
>