Linux CXL
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Alison Schofield <alison.schofield@intel.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>,
	Jonathan Cameron <jonathan.cameron@huawei.com>,
	Dave Jiang <dave.jiang@intel.com>,
	Vishal Verma <vishal.l.verma@intel.com>,
	Ira Weiny <ira.weiny@intel.com>,
	Dan Williams <dan.j.williams@intel.com>,
	linux-cxl@vger.kernel.org
Subject: Re: [PATCH v2] cxl/trace: Properly initialize cxl_poison region name
Date: Thu, 14 Mar 2024 18:50:10 -0400	[thread overview]
Message-ID: <20240314185010.6162cbfe@gandalf.local.home> (raw)
In-Reply-To: <ZfN8AP/KdbsN32l1@aschofie-mobl2>

On Thu, 14 Mar 2024 15:36:48 -0700
Alison Schofield <alison.schofield@intel.com> wrote:

> > diff --git a/include/trace/stages/stage5_get_offsets.h b/include/trace/stages/stage5_get_offsets.h
> > index e30a13be46ba..dfae18d8f4df 100644
> > --- a/include/trace/stages/stage5_get_offsets.h
> > +++ b/include/trace/stages/stage5_get_offsets.h
> > @@ -9,6 +9,13 @@
> >  #undef __entry
> >  #define __entry entry
> >    
> 
> +#ifndef STAGE5_H_INCLUDED
> +#define STAGE5_H_INCLUDED
> > +static inline const char *__string_src(const char *str)
> > +{
> > +	if (!str)
> > +		return "(null)";
> > +	return str;
> > +}  
> +#endif /* STAGE5_H_INCLUDED */
> 
> Happy to try it out...
> 
> Your diff, with the ifdef above, makes the compiler happy and it functions
> as wanted - no garbage in the fields.

Hmm, I guess the:

 strlen((src ? (const char *)(src) : NULL) ? (src ? (const char *) src : NULL)) ? "(null)")) + 1

was too complex for the compiler, where as:

 strlen(__string_str((str ? (const char *)(src) : NULL))) + 1

is not.

Perhaps I should add this change. I would still submit your change with the
"" as that needs to be backported, but this probably does not.

Thanks for testing it out.

-- Steve

> 
> > +
> >  /*
> >   * Fields should never declare an array: i.e. __field(int, arr[5])
> >   * If they do, it will cause issues in parsing and possibly corrupt the
> > @@ -47,7 +54,7 @@
> >  
> >  #undef __string
> >  #define __string(item, src) __dynamic_array(char, item,			\
> > -		    strlen((src) ? (const char *)(src) : "(null)") + 1)
> > +		    strlen(__string_src(src)) + 1)
> >  
> >  #undef __string_len
> >  #define __string_len(item, src, len) __dynamic_array(char, item, (len) + 1)  


  reply	other threads:[~2024-03-14 22:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-14 20:12 [PATCH v2] cxl/trace: Properly initialize cxl_poison region name alison.schofield
2024-03-14 20:41 ` Steven Rostedt
2024-03-14 21:05   ` Alison Schofield
2024-03-14 21:17     ` Steven Rostedt
2024-03-14 22:36       ` Alison Schofield
2024-03-14 22:50         ` Steven Rostedt [this message]
2024-03-15 10:47         ` Steven Rostedt
2024-03-15 16:18           ` Dan Williams
2024-03-15 16:30             ` Steven Rostedt
2024-03-14 20:51 ` Ira Weiny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240314185010.6162cbfe@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=alison.schofield@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=ira.weiny@intel.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=vishal.l.verma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox