From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: Harish Chegondi <harish.chegondi@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH v9 5/8] drm/xe/eustall: Add support to handle dropped EU stall data
Date: Wed, 12 Feb 2025 22:31:15 -0800 [thread overview]
Message-ID: <85tt8y73v0.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <c47e43598403dd36346d3236c9eb880f8ddd549d.1739193510.git.harish.chegondi@intel.com>
On Mon, 10 Feb 2025 05:46:46 -0800, Harish Chegondi wrote:
>
Hi Harish,
> If the user space doesn't read the EU stall data fast enough,
> it is possible that the EU stall data buffer can get filled,
> and if the hardware wants to write more data, it simply drops
> data due to unavailable buffer space. In that case, hardware
> sets a bit in a register. If the driver detects data drop,
> the driver read() returns -EIO error to let the user space
> know that HW has dropped data. The -EIO error is returned
> even if there is EU stall data in the buffer. A subsequent
> read by the user space returns the remaining EU stall data.
>
> v9: Move all data drop handling code to this patch
Good, separating out makes this easier to review. I would actually make
this the last patch, but anyway it's ok as is too.
> Clear all drop data bits before returning -EIO.
>
> Signed-off-by: Harish Chegondi <harish.chegondi@intel.com>
> ---
> drivers/gpu/drm/xe/xe_eu_stall.c | 39 ++++++++++++++++++++++++++++++++
> 1 file changed, 39 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_eu_stall.c b/drivers/gpu/drm/xe/xe_eu_stall.c
> index 53f17aac7d3b..428267010805 100644
> --- a/drivers/gpu/drm/xe/xe_eu_stall.c
> +++ b/drivers/gpu/drm/xe/xe_eu_stall.c
> @@ -53,6 +53,10 @@ struct xe_eu_stall_data_stream {
> struct xe_gt *gt;
> struct xe_bo *bo;
> struct per_xecore_buf *xecore_buf;
> + struct {
> + bool reported_to_user;
> + xe_dss_mask_t mask;
> + } data_drop;
> struct delayed_work buf_poll_work;
> struct workqueue_struct *buf_poll_wq;
> };
> @@ -331,12 +335,24 @@ static bool eu_stall_data_buf_poll(struct xe_eu_stall_data_stream *stream)
> if (num_data_rows(total_data) >= stream->wait_num_reports)
> min_data_present = true;
> }
> + if (write_ptr_reg & XEHPC_EUSTALL_REPORT_OVERFLOW_DROP)
> + set_bit(xecore, stream->data_drop.mask);
> xecore_buf->write = write_ptr;
> mutex_unlock(&xecore_buf->ptr_lock);
> }
> return min_data_present;
> }
>
> +static void clear_dropped_eviction_line_bit(struct xe_gt *gt, u16 group, u16 instance)
> +{
> + u32 write_ptr_reg;
> +
> + /* On PVC, the overflow bit has to be cleared by writing 1 to it. */
> + write_ptr_reg = _MASKED_BIT_ENABLE(XEHPC_EUSTALL_REPORT_OVERFLOW_DROP);
> +
> + xe_gt_mcr_unicast_write(gt, XEHPC_EUSTALL_REPORT, write_ptr_reg, group, instance);
> +}
> +
> static int xe_eu_stall_data_buf_read(struct xe_eu_stall_data_stream *stream,
> char __user *buf, size_t count,
> size_t *total_data_size, struct xe_gt *gt,
> @@ -436,6 +452,22 @@ static ssize_t xe_eu_stall_stream_read_locked(struct xe_eu_stall_data_stream *st
> unsigned int xecore;
> int ret = 0;
>
> + if (bitmap_weight(stream->data_drop.mask, XE_MAX_DSS_FUSE_BITS)) {
> + if (!stream->data_drop.reported_to_user) {
> + for_each_dss_steering(xecore, gt, group, instance) {
> + if (test_bit(xecore, stream->data_drop.mask)) {
> + clear_dropped_eviction_line_bit(gt, group, instance);
> + clear_bit(xecore, stream->data_drop.mask);
> + }
> + }
This is not making any sense. How can we clear_dropped_eviction_line_bit
before reading the data? The HW will set it right back up.
At least the code in the previous version made some sense. So we should at
least go back to that and review that. Though it also had issue with how
many times -EIO is returned etc.
The other issue is the locking. As I suggested in my comments on Patch 4/8,
I don't think we need a per xecore_buf lock, just one ptr_lock for reading
all the DSS's. And then we can use that here too.
But at least let's get something sane for review first.
> + stream->data_drop.reported_to_user = true;
> + xe_gt_dbg(gt, "EU stall data dropped in XeCores: %*pb\n",
> + XE_MAX_DSS_FUSE_BITS, stream->data_drop.mask);
> + return -EIO;
> + }
> + stream->data_drop.reported_to_user = false;
> + }
> +
> for_each_dss_steering(xecore, gt, group, instance) {
> ret = xe_eu_stall_data_buf_read(stream, buf, count, &total_size,
> gt, group, instance, xecore);
> @@ -457,6 +489,7 @@ static ssize_t xe_eu_stall_stream_read_locked(struct xe_eu_stall_data_stream *st
> * before calling read().
> *
> * Returns: The number of bytes copied or a negative error code on failure.
> + * -EIO if HW drops any EU stall data when the buffer is full.
> */
> static ssize_t xe_eu_stall_stream_read(struct file *file, char __user *buf,
> size_t count, loff_t *ppos)
> @@ -543,6 +576,9 @@ static int xe_eu_stall_stream_enable(struct xe_eu_stall_data_stream *stream)
>
> for_each_dss_steering(xecore, gt, group, instance) {
> write_ptr_reg = xe_gt_mcr_unicast_read(gt, XEHPC_EUSTALL_REPORT, group, instance);
> + /* Clear any drop bits set and not cleared in the previous session. */
> + if (write_ptr_reg & XEHPC_EUSTALL_REPORT_OVERFLOW_DROP)
> + clear_dropped_eviction_line_bit(gt, group, instance);
> write_ptr = REG_FIELD_GET(XEHPC_EUSTALL_REPORT_WRITE_PTR_MASK, write_ptr_reg);
> read_ptr_reg = REG_FIELD_PREP(XEHPC_EUSTALL_REPORT1_READ_PTR_MASK, write_ptr);
> read_ptr_reg = _MASKED_FIELD(XEHPC_EUSTALL_REPORT1_READ_PTR_MASK, read_ptr_reg);
> @@ -554,6 +590,9 @@ static int xe_eu_stall_stream_enable(struct xe_eu_stall_data_stream *stream)
> xecore_buf->write = write_ptr;
> xecore_buf->read = write_ptr;
> }
> + stream->data_drop.reported_to_user = false;
> + bitmap_zero(stream->data_drop.mask, XE_MAX_DSS_FUSE_BITS);
> +
> reg_value = _MASKED_FIELD(EUSTALL_MOCS | EUSTALL_SAMPLE_RATE,
> REG_FIELD_PREP(EUSTALL_MOCS, gt->mocs.uc_index << 1) |
> REG_FIELD_PREP(EUSTALL_SAMPLE_RATE,
> --
> 2.48.1
>
next prev parent reply other threads:[~2025-02-13 6:31 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-10 13:46 [PATCH v9 0/8] Add support for EU stall sampling Harish Chegondi
2025-02-10 13:46 ` [PATCH v9 1/8] drm/xe/topology: Add a function to find the index of the last enabled DSS in a mask Harish Chegondi
2025-02-10 17:31 ` Dixit, Ashutosh
2025-02-10 13:46 ` [PATCH v9 2/8] drm/xe/uapi: Introduce API for EU stall sampling Harish Chegondi
2025-02-10 23:07 ` Dixit, Ashutosh
2025-02-10 23:53 ` Dixit, Ashutosh
2025-02-11 19:50 ` Dixit, Ashutosh
2025-02-12 23:54 ` Harish Chegondi
2025-02-13 2:39 ` Dixit, Ashutosh
2025-02-16 1:49 ` Harish Chegondi
2025-02-16 5:49 ` Dixit, Ashutosh
2025-02-18 11:54 ` Jani Nikula
2025-02-10 13:46 ` [PATCH v9 3/8] drm/xe/eustall: Add support to init, enable and disable " Harish Chegondi
2025-02-11 17:33 ` Dixit, Ashutosh
2025-02-11 22:02 ` Harish Chegondi
2025-02-12 2:44 ` Dixit, Ashutosh
2025-02-10 13:46 ` [PATCH v9 4/8] drm/xe/eustall: Add support to read() and poll() EU stall data Harish Chegondi
2025-02-12 19:02 ` Dixit, Ashutosh
2025-02-14 7:51 ` Harish Chegondi
2025-02-14 20:34 ` Dixit, Ashutosh
2025-02-15 0:44 ` Harish Chegondi
2025-02-15 2:22 ` Dixit, Ashutosh
2025-02-18 0:35 ` Harish Chegondi
2025-02-18 4:02 ` Dixit, Ashutosh
2025-02-10 13:46 ` [PATCH v9 5/8] drm/xe/eustall: Add support to handle dropped " Harish Chegondi
2025-02-13 6:31 ` Dixit, Ashutosh [this message]
2025-02-13 21:55 ` Harish Chegondi
2025-02-13 23:45 ` Dixit, Ashutosh
2025-02-14 0:11 ` Dixit, Ashutosh
2025-02-14 2:05 ` Dixit, Ashutosh
2025-02-14 2:23 ` Dixit, Ashutosh
2025-02-10 13:46 ` [PATCH v9 6/8] drm/xe/eustall: Add EU stall sampling support for Xe2 Harish Chegondi
2025-02-12 19:46 ` Dixit, Ashutosh
2025-02-10 13:46 ` [PATCH v9 7/8] drm/xe/uapi: Add a device query to get EU stall sampling information Harish Chegondi
2025-02-12 21:13 ` Dixit, Ashutosh
2025-02-10 13:46 ` [PATCH v9 8/8] drm/xe/eustall: Add workaround 22016596838 which applies to PVC Harish Chegondi
2025-02-12 20:01 ` Dixit, Ashutosh
2025-02-10 14:32 ` ✓ CI.Patch_applied: success for Add support for EU stall sampling Patchwork
2025-02-10 14:33 ` ✗ CI.checkpatch: warning " Patchwork
2025-02-10 14:34 ` ✓ CI.KUnit: success " Patchwork
2025-02-10 14:50 ` ✓ CI.Build: " Patchwork
2025-02-10 14:53 ` ✓ CI.Hooks: " Patchwork
2025-02-10 14:54 ` ✓ CI.checksparse: " Patchwork
2025-02-11 7:24 ` ✓ CI.Patch_applied: success for Add support for EU stall sampling (rev2) Patchwork
2025-02-11 7:24 ` ✗ CI.checkpatch: warning " Patchwork
2025-02-11 7:25 ` ✓ CI.KUnit: success " Patchwork
2025-02-11 7:42 ` ✓ CI.Build: " Patchwork
2025-02-11 7:43 ` ✗ CI.Hooks: failure " Patchwork
2025-02-11 7:44 ` ✗ CI.checksparse: warning " Patchwork
2025-02-11 8:04 ` ✓ Xe.CI.BAT: success " Patchwork
2025-02-11 16:11 ` ✗ Xe.CI.Full: failure " Patchwork
2025-02-11 19:23 ` [PATCH v9 0/8] Add support for EU stall sampling Dixit, Ashutosh
2025-02-12 9:42 ` ✗ Xe.CI.Full: failure for " Patchwork
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=85tt8y73v0.wl-ashutosh.dixit@intel.com \
--to=ashutosh.dixit@intel.com \
--cc=harish.chegondi@intel.com \
--cc=intel-xe@lists.freedesktop.org \
/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