Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Francois Dugast <francois.dugast@intel.com>
To: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
Cc: <igt-dev@lists.freedesktop.org>
Subject: Re: [PATCH i-g-t 01/15] lib/xe_spin: limit width/pitch for mem-copy
Date: Mon, 19 May 2025 09:56:37 +0200	[thread overview]
Message-ID: <aCrkNboCHoRHMLl3@fdugast-desk> (raw)
In-Reply-To: <20250513185811.897232-2-zbigniew.kempczynski@intel.com>

On Tue, May 13, 2025 at 08:57:56PM +0200, Zbigniew Kempczyński wrote:
> Mem-copy for byte copy requires width/pitch to be max 256K
> (higher bits have different meaning and setting them might lead
> to undefined behavior). If witch/pitch are too high limit them to
> the maximum possible for the operation. Asserting might lead to
> test stucking in multithreading scenarios so displaying warning
> was selected instead.
> 
> Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
> Cc: Francois Dugast <francois.dugast@intel.com>

Reviewed-by: Francois Dugast <francois.dugast@intel.com>

> ---
>  lib/xe/xe_spin.c | 35 +++++++++++++++++++++++++++++++----
>  1 file changed, 31 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/xe/xe_spin.c b/lib/xe/xe_spin.c
> index a92903b6bd..6683d1f351 100644
> --- a/lib/xe/xe_spin.c
> +++ b/lib/xe/xe_spin.c
> @@ -126,11 +126,38 @@ void xe_spin_init(struct xe_spin *spin, struct xe_spin_opts *opts)
>  	}
>  
>  	if (opts->mem_copy) {
> +		uint32_t src_width, src_pitch, dst_width, dst_pitch;
> +
> +		src_width = opts->mem_copy->src->width;
> +		src_pitch = opts->mem_copy->src->pitch;
> +		dst_width = opts->mem_copy->dst->width;
> +		dst_pitch = opts->mem_copy->dst->pitch;
> +
> +		if (src_width > dst_width) {
> +			igt_warn("src width must be <= dst width\n");
> +			src_width = dst_width;
> +		}
> +
> +		if (src_width > SZ_256K) {
> +			igt_warn("src width must be less than 256K, limiting it\n");
> +			src_width = SZ_256K;
> +		}
> +
> +		if (src_pitch > SZ_256K) {
> +			igt_warn("src pitch must be less than 256K, limiting it\n");
> +			src_pitch = SZ_256K;
> +		}
> +
> +		if (dst_pitch > SZ_256K) {
> +			igt_warn("dst pitch must be less than 256K, limiting it\n");
> +			dst_pitch = SZ_256K;
> +		}
> +
>  		spin->batch[b++] = MEM_COPY_CMD;
> -		spin->batch[b++] = opts->mem_copy->src->width - 1;
> -		spin->batch[b++] = opts->mem_copy->src->height - 1;
> -		spin->batch[b++] = opts->mem_copy->src->pitch - 1;
> -		spin->batch[b++] = opts->mem_copy->dst->pitch - 1;
> +		spin->batch[b++] = src_width - 1;
> +		spin->batch[b++] = 1;  /* for byte copying this is ignored */
> +		spin->batch[b++] = src_pitch - 1;
> +		spin->batch[b++] = dst_pitch - 1;
>  		spin->batch[b++] = opts->mem_copy->src_offset;
>  		spin->batch[b++] = opts->mem_copy->src_offset << 32;
>  		spin->batch[b++] = opts->mem_copy->dst_offset;
> -- 
> 2.43.0
> 

  reply	other threads:[~2025-05-19  7:57 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-13 18:57 [PATCH i-g-t 00/15] Improve mem-copy/mem-set lib and tests Zbigniew Kempczyński
2025-05-13 18:57 ` [PATCH i-g-t 01/15] lib/xe_spin: limit width/pitch for mem-copy Zbigniew Kempczyński
2025-05-19  7:56   ` Francois Dugast [this message]
2025-05-13 18:57 ` [PATCH i-g-t 02/15] tests/xe_render_copy: change width and pitch to be in valid range Zbigniew Kempczyński
2025-05-19  7:56   ` Francois Dugast
2025-05-13 18:57 ` [PATCH i-g-t 03/15] tests/xe_spin_batch: " Zbigniew Kempczyński
2025-05-19  7:57   ` Francois Dugast
2025-05-13 18:57 ` [PATCH i-g-t 04/15] tests/xe_copy_basic: use non-zero pitch Zbigniew Kempczyński
2025-05-19  7:57   ` Francois Dugast
2025-05-13 18:58 ` [PATCH i-g-t 05/15] lib/intel_cmds_info: rename M to TYPE in blt_memop_type Zbigniew Kempczyński
2025-05-19  8:03   ` Francois Dugast
2025-05-19 11:17     ` Zbigniew Kempczyński
2025-05-22 11:31       ` Francois Dugast
2025-05-13 18:58 ` [PATCH i-g-t 06/15] lib/intel_blt: separate mem-copy and mem-set Zbigniew Kempczyński
2025-05-19  8:35   ` Francois Dugast
2025-05-13 18:58 ` [PATCH i-g-t 07/15] lib/intel_cmds_info: add blt_memop_mode (byte/page) Zbigniew Kempczyński
2025-05-19  8:54   ` Francois Dugast
2025-05-13 18:58 ` [PATCH i-g-t 08/15] lib/intel_blt: add emit batchbuffer end Zbigniew Kempczyński
2025-05-19  8:55   ` Francois Dugast
2025-05-13 18:58 ` [PATCH i-g-t 09/15] lib/intel_blt: use struct instead of inline coding Zbigniew Kempczyński
2025-05-22 11:50   ` Francois Dugast
2025-05-22 11:52   ` Francois Dugast
2025-05-13 18:58 ` [PATCH i-g-t 10/15] tests/xe_copy_basic: replace size to rect which keeps objects geometry Zbigniew Kempczyński
2025-05-22 12:05   ` Francois Dugast
2025-05-22 14:15     ` Zbigniew Kempczyński
2025-05-13 18:58 ` [PATCH i-g-t 11/15] tests/xe_copy_basic: add testcase with large buffer size Zbigniew Kempczyński
2025-05-13 18:58 ` [PATCH i-g-t 12/15] tests/xe_copy_basic: add subtest to verify mem-copy in pages Zbigniew Kempczyński
2025-05-13 18:58 ` [PATCH i-g-t 13/15] lib/intel_blt: add support for matrix mem-copy Zbigniew Kempczyński
2025-05-13 18:58 ` [PATCH i-g-t 14/15] tests/xe_copy_basic: add mem-copy matrix subtests Zbigniew Kempczyński
2025-05-13 18:58 ` [PATCH i-g-t 15/15] lib/intel_blt: add mem-copy debug facility Zbigniew Kempczyński
2025-05-13 20:26 ` ✓ Xe.CI.BAT: success for Improve mem-copy/mem-set lib and tests Patchwork
2025-05-13 20:44 ` ✓ i915.CI.BAT: " Patchwork
2025-05-13 22:01 ` ✗ Xe.CI.Full: failure " Patchwork
2025-05-14  5:04   ` Zbigniew Kempczyński
2025-05-13 23:12 ` ✗ i915.CI.Full: " Patchwork
2025-05-14  5:05   ` Zbigniew Kempczyński

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=aCrkNboCHoRHMLl3@fdugast-desk \
    --to=francois.dugast@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=zbigniew.kempczynski@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