From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: Harish Chegondi <harish.chegondi@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH v10 3/8] drm/xe/eustall: Add support to init, enable and disable EU stall sampling
Date: Wed, 19 Feb 2025 07:27:24 -0800 [thread overview]
Message-ID: <85v7t6neeb.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <1448af14b3edfb3673eb6992741b7176c9edc1ee.1739906138.git.harish.chegondi@intel.com>
On Tue, 18 Feb 2025 11:53:53 -0800, Harish Chegondi wrote:
>
> +static void xe_eu_stall_stream_free(struct xe_eu_stall_data_stream *stream)
> +{
> + struct xe_gt *gt = stream->gt;
> +
> + gt->eu_stall->stream = NULL;
> + kfree(stream);
> +}
> +
> +static void xe_eu_stall_data_buf_destroy(struct xe_eu_stall_data_stream *stream)
> +{
> + xe_bo_unpin_map_no_vm(stream->bo);
> + kfree(stream->xecore_buf);
> +}
> +
> +static int xe_eu_stall_data_buf_alloc(struct xe_eu_stall_data_stream *stream,
> + u16 last_xecore)
> +{
> + struct xe_tile *tile = stream->gt->tile;
> + struct xe_bo *bo;
> + u32 size;
> +
> + size = stream->per_xecore_buf_size * last_xecore;
> +
> + bo = xe_bo_create_pin_map_at_aligned(tile->xe, tile, NULL,
> + size, ~0ull, ttm_bo_type_kernel,
> + XE_BO_FLAG_SYSTEM | XE_BO_FLAG_GGTT, SZ_64);
> + if (IS_ERR(bo))
> + return PTR_ERR(bo);
> +
> + XE_WARN_ON(!IS_ALIGNED(xe_bo_ggtt_addr(bo), SZ_64));
> + stream->bo = bo;
> +
> + return 0;
> +}
/snip/
> +static int xe_eu_stall_stream_init(struct xe_eu_stall_data_stream *stream,
> + struct eu_stall_open_properties *props)
> +{
> + unsigned int max_wait_num_reports, xecore, last_xecore, num_xecores;
> + struct per_xecore_buf *xecore_buf;
> + struct xe_gt *gt = stream->gt;
> + xe_dss_mask_t all_xecores;
> + u16 group, instance;
> + u32 vaddr_offset;
> + int ret;
> +
> + bitmap_or(all_xecores, gt->fuse_topo.g_dss_mask, gt->fuse_topo.c_dss_mask,
> + XE_MAX_DSS_FUSE_BITS);
> + num_xecores = bitmap_weight(all_xecores, XE_MAX_DSS_FUSE_BITS);
> + last_xecore = xe_gt_topology_mask_last_dss(all_xecores) + 1;
> +
> + max_wait_num_reports = num_data_rows(per_xecore_buf_size * num_xecores);
> + if (props->wait_num_reports == 0 || props->wait_num_reports > max_wait_num_reports) {
> + xe_gt_dbg(gt, "Invalid EU stall event report count %u\n",
> + props->wait_num_reports);
> + xe_gt_dbg(gt, "Minimum event report count is 1, maximum is %u\n",
> + max_wait_num_reports);
> + return -EINVAL;
> + }
> + stream->per_xecore_buf_size = per_xecore_buf_size;
> + stream->sampling_rate_mult = props->sampling_rate_mult;
> + stream->wait_num_reports = props->wait_num_reports;
> + stream->data_record_size = xe_eu_stall_data_record_size(gt_to_xe(gt));
> + stream->xecore_buf = kcalloc(last_xecore, sizeof(*stream->xecore_buf), GFP_KERNEL);
> + if (!stream->xecore_buf)
> + return -ENOMEM;
How about moving this stream->xecore_buf allocation stuff into
xe_eu_stall_data_buf_alloc? Just move it before stream->bo allocation in
xe_eu_stall_data_buf_alloc.
Because in xe_eu_stall_data_buf_destroy() we are freeing both stream->bo
and stream->xecore_buf. So if we move this stream->xecore_buf allocation
into xe_eu_stall_data_buf_alloc, xe_eu_stall_data_buf_alloc and
xe_eu_stall_data_buf_destroy will be completely symmetric.
And by "data_buf" we can understand stream->bo and stream->xecore_buf taken
together. There are other ways of doing this too but I think this is the
simplest change.
After addressing the above comment above, the rest lgtm, so this patch is
also:
Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
next prev parent reply other threads:[~2025-02-19 15:27 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-18 19:53 [PATCH v10 0/8] Add support for EU stall sampling Harish Chegondi
2025-02-18 19:53 ` [PATCH v10 1/8] drm/xe/topology: Add a function to find the index of the last enabled DSS in a mask Harish Chegondi
2025-02-18 19:53 ` [PATCH v10 2/8] drm/xe/uapi: Introduce API for EU stall sampling Harish Chegondi
2025-02-18 23:11 ` Dixit, Ashutosh
2025-02-18 19:53 ` [PATCH v10 3/8] drm/xe/eustall: Add support to init, enable and disable " Harish Chegondi
2025-02-19 15:27 ` Dixit, Ashutosh [this message]
2025-02-18 19:53 ` [PATCH v10 4/8] drm/xe/eustall: Add support to read() and poll() EU stall data Harish Chegondi
2025-02-19 18:15 ` Dixit, Ashutosh
2025-02-19 19:43 ` Harish Chegondi
2025-02-20 7:02 ` Dixit, Ashutosh
2025-02-20 19:52 ` Dixit, Ashutosh
2025-02-20 20:02 ` Dixit, Ashutosh
2025-02-24 18:10 ` Harish Chegondi
2025-02-24 18:16 ` Dixit, Ashutosh
2025-02-24 18:29 ` Dixit, Ashutosh
2025-02-24 18:06 ` Harish Chegondi
2025-02-18 19:53 ` [PATCH v10 5/8] drm/xe/eustall: Add support to handle dropped " Harish Chegondi
2025-02-19 18:47 ` Dixit, Ashutosh
2025-02-18 19:53 ` [PATCH v10 6/8] drm/xe/eustall: Add EU stall sampling support for Xe2 Harish Chegondi
2025-02-18 23:29 ` Dixit, Ashutosh
2025-02-18 19:53 ` [PATCH v10 7/8] drm/xe/uapi: Add a device query to get EU stall sampling information Harish Chegondi
2025-02-18 19:53 ` [PATCH v10 8/8] drm/xe/eustall: Add workaround 22016596838 which applies to PVC Harish Chegondi
2025-02-18 20:03 ` ✓ CI.Patch_applied: success for Add support for EU stall sampling Patchwork
2025-02-18 20:03 ` ✗ CI.checkpatch: warning " Patchwork
2025-02-18 20:05 ` ✓ CI.KUnit: success " Patchwork
2025-02-18 20:21 ` ✓ CI.Build: " Patchwork
2025-02-18 20:23 ` ✓ CI.Hooks: " Patchwork
2025-02-18 20:25 ` ✓ CI.checksparse: " Patchwork
2025-02-18 20:44 ` ✓ Xe.CI.BAT: " Patchwork
2025-02-19 13:14 ` ✗ Xe.CI.Full: failure " Patchwork
2025-02-19 19:27 ` [PATCH v10 0/8] " Dixit, Ashutosh
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=85v7t6neeb.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.