Linux CXL
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: alison.schofield@intel.com
Cc: Dan Williams <dan.j.williams@intel.com>,
	Ira Weiny <ira.weiny@intel.com>,
	Vishal Verma <vishal.l.verma@intel.com>,
	Dave Jiang <dave.jiang@intel.com>,
	Ben Widawsky <bwidawsk@kernel.org>,
	Ingo Molnar <mingo@redhat.com>,
	linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/4] trace, cxl: Introduce a TRACE_EVENT for CXL poison records
Date: Wed, 12 Oct 2022 17:46:20 -0400	[thread overview]
Message-ID: <20221012174620.7cd7d062@rorschach.local.home> (raw)
In-Reply-To: <17ee0f309e4287510e4e68f2cbcfc9d111a6e69d.1665606782.git.alison.schofield@intel.com>

On Wed, 12 Oct 2022 14:28:17 -0700
alison.schofield@intel.com wrote:

> +TRACE_EVENT(cxl_poison,
> +
> +	    TP_PROTO(pid_t pid, const char *region, const char *memdev,
> +		     const char *pcidev, u64 hpa, u64 dpa, u32 length,
> +		     u8 source, u8 flags, u64 overflow_t),
> +
> +	    TP_ARGS(pid, region, memdev, pcidev, hpa, dpa,
> +		    length, source, flags, overflow_t),
> +
> +	    TP_STRUCT__entry(
> +		__field(pid_t, pid)
> +		__string(region, region ? region : "")
> +		__string(memdev, memdev)
> +		__string(pcidev, pcidev)
> +		__field(u64, hpa)
> +		__field(u64, dpa)
> +		__field(u32, length)
> +		__field(u8, source)
> +		__field(u8, flags)
> +		__field(u64, overflow_t)

The above looks nice and compact.

> +	    ),
> +
> +	    TP_fast_assign(
> +		__entry->pid = pid;
> +		__assign_str(region, region ? region : "");
> +		__assign_str(memdev, memdev);
> +		__assign_str(pcidev, pcidev);
> +		__entry->hpa = hpa;
> +		__entry->dpa = dpa;
> +		__entry->length = length;
> +		__entry->source = source;
> +		__entry->flags = flags;
> +		__entry->overflow_t = overflow_t;

But I wonder if it would be better to move the computation of patch 2
here?

That is, this:

> +		for (i = 0; i < le16_to_cpu(po->count); i++) {
> +			u32 len = le32_to_cpu(po->record[i].length) *
> +					      CXL_POISON_LEN_MULT;
> +			u64 addr = le64_to_cpu(po->record[i].address);
> +			u8 source = addr & CXL_POISON_SOURCE_MASK;
> +			u64 dpa = addr & CXL_POISON_START_MASK;
> +			u64 hpa = 0;
> +
> +			trace_cxl_poison(current->pid, region_name,
> +					 dev_name(&cxlmd->dev),
> +					 dev_name(cxlds->dev), hpa, dpa, len,
> +					 source, po->flags, overflow_t);
> +		}

As:

// The trace_*_enabled() is a static branch which is true when the
// tracepoint is enabled, and a nop when not (skipping the for block)

		for (i = 0; trace_cxl_poison_enabled() && i < le16_to_cpu(po->count); i++)
			trace_cxl_poison(region_name, cxlmd, cxlds, &po->record[i]);

And then have:

	    TP_fast_assign(
		u32 len = le32_to_cpu(record->length) *
				      CXL_POISON_LEN_MULT;
		u64 addr = le64_to_cpu(record->address);
		u8 source = addr & CXL_POISON_SOURCE_MASK;
		u64 dpa = addr & CXL_POISON_START_MASK;
		u64 hpa = 0;

		__entry->pid = current->pid;

{ the above isn't needed as the trace event will have common_pid = current->pid }

		__assign_str(region, region ? region : "");
		__assign_str(memdev, dev_name(&cxlmd->dev));
		__assign_str(pcidev, dev_name(cxlds->dev));
		__entry->hpa = hpa;
		__entry->dpa = dpa;
		__entry->length = length;
		__entry->source = source;
		__entry->flags = flags;
		__entry->overflow_t = overflow_t;


Or something similar. This will keep the work out of the code path.

-- Steve


> +	    ),
> +
> +	    TP_printk("pid:%d region:%s memdev:%s pcidev:%s hpa:0x%llx dpa:0x%llx length:0x%x source:%s flags:%s overflow_time:%llu",
> +		__entry->pid,
> +		__get_str(region),
> +		__get_str(memdev),
> +		__get_str(pcidev),
> +		__entry->hpa,
> +		__entry->dpa,
> +		__entry->length,
> +		show_poison_source(__entry->source),
> +		show_poison_flags(__entry->flags),
> +		__entry->overflow_t)
> +);
> +#endif /* _CXL_TRACE_H */

  reply	other threads:[~2022-10-12 21:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-12 21:28 [PATCH v2 0/4] CXL Poison List Retrieval & Tracing alison.schofield
2022-10-12 21:28 ` [PATCH v2 1/4] trace, cxl: Introduce a TRACE_EVENT for CXL poison records alison.schofield
2022-10-12 21:46   ` Steven Rostedt [this message]
2022-10-14  4:39     ` Alison Schofield
2022-10-12 21:28 ` [PATCH v2 2/4] cxl/mbox: Add GET_POISON_LIST mailbox command alison.schofield
2022-10-12 21:28 ` [PATCH v2 3/4] cxl/memdev: Add trigger_poison_list sysfs attribute alison.schofield
2022-10-12 21:28 ` [PATCH v2 4/4] cxl/region: " alison.schofield
2022-10-17 13:43   ` Jonathan Cameron
2022-10-17 18:01     ` Alison Schofield

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=20221012174620.7cd7d062@rorschach.local.home \
    --to=rostedt@goodmis.org \
    --cc=alison.schofield@intel.com \
    --cc=bwidawsk@kernel.org \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=ira.weiny@intel.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --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