All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Karthik Poosa" <karthik.poosa@intel.com>,
	intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v5 03/10] drm/xe/pcode: Add ordered write batch helper
Date: Sat, 28 Nov 2026 06:04:11 +0000	[thread overview]
Message-ID: <sashiko-outbox-238481@kernel.org> (raw)
In-Reply-To: <20261128055923.3316956-4-karthik.poosa@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] drm/xe/pcode: missing rationale and lock impact for
  xe_pcode_write_batch()
--

commit 357f40b2588787b30829671c174b780a0ae2ed24
Author: Karthik Poosa <karthik.poosa@intel.com>

> drm/xe/pcode: Add ordered write batch helper
> 
> Add a pcode helper that issues an ordered sequence of mailbox writes
> while holding the pcode lock, so no other mailbox command can be
> interleaved.
> 
> This will be used to write fan tables atomically with respect to other
> pcode users.
> 
> Signed-off-by: Karthik Poosa <karthik.poosa@intel.com>

> diff --git a/drivers/gpu/drm/xe/xe_pcode.c b/drivers/gpu/drm/xe/xe_pcode.c
> index fa9f45d565cb9..409b9ff372e99 100644
> --- a/drivers/gpu/drm/xe/xe_pcode.c
> +++ b/drivers/gpu/drm/xe/xe_pcode.c
> @@ -124,6 +124,45 @@ int xe_pcode_write_timeout(struct xe_tile *tile, u32 mbox, u32 data, int timeout
>  	return err;
>  }
>  
> +/**
> + * xe_pcode_write_batch - issue pcode writes in order under the mailbox lock
> + * @tile: tile
> + * @writes: mailbox/data pairs to write
> + * @count: number of entries in @writes
> + *
> + * Holds the pcode lock across all writes so no other mailbox command can be
> + * interleaved; the lock may be held for up to @count * PCODE_DEFAULT_TIMEOUT_MS.
> + * Stops at the first failure; earlier writes are not reverted.
> + *
> + * Return: 0 on success, negative error code otherwise.
> + */
> +int xe_pcode_write_batch(struct xe_tile *tile, const struct xe_pcode_write *writes,
> +			 unsigned int count)
> +{
> +	unsigned int i;
> +	int err = 0;
> +
> +	if (!count)
> +		return -EINVAL;
> +
> +	mutex_lock(&tile->pcode.lock);
> +	for (i = 0; i < count; i++) {
> +		u32 data = writes[i].data;
> +
> +		err = pcode_mailbox_rw(tile, writes[i].mbox, &data, NULL, PCODE_DEFAULT_TIMEOUT_MS,
> +				       false, false);

[Severity: Low]
As reported by Rodrigo Vivi on v4 [1], the commit message and kernel-doc
still do not explain why pcode requires these writes to be issued without
interleaved mailbox commands, or assess the risk of holding
tile->pcode.lock for up to count * PCODE_DEFAULT_TIMEOUT_MS (110 ms for
an 11-entry fan table write) and starving or causing timeouts on other
pcode paths.

[1] https://lore.kernel.org/r/awcpB6s_32zyhNBi@intel.com

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261128055923.3316956-1-karthik.poosa@intel.com?part=3

  reply	other threads:[~2026-11-28  6:04 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-28  5:59 [PATCH v5 00/10] drm/xe/hwmon: Add fan control support Karthik Poosa
2026-11-28  5:59 ` [PATCH v5 01/10] drm/xe/hwmon: Initialize fan-control backend and table cache Karthik Poosa
2026-11-30  9:49   ` Purkait, Soham
2026-11-30 11:41     ` Poosa, Karthik
2026-11-28  5:59 ` [PATCH v5 02/10] drm/xe/hwmon: Expose fanN_max Karthik Poosa
2026-11-28  5:59 ` [PATCH v5 03/10] drm/xe/pcode: Add ordered write batch helper Karthik Poosa
2026-11-28  6:04   ` sashiko-bot [this message]
2026-11-30 10:33   ` Purkait, Soham
2026-11-28  5:59 ` [PATCH v5 04/10] drm/xe/hwmon: Expose pwm[1-3] Karthik Poosa
2026-11-30 11:51   ` Purkait, Soham
2026-11-30 12:47     ` Poosa, Karthik
2026-11-28  5:59 ` [PATCH v5 05/10] drm/xe/hwmon: Expose pwm[1-3]_enable Karthik Poosa
2026-11-28  6:13   ` sashiko-bot
2026-11-30 11:27     ` Poosa, Karthik
2026-11-30 14:27       ` Poosa, Karthik
2026-11-30 14:29   ` Purkait, Soham
2026-11-28  5:59 ` [PATCH v5 06/10] drm/xe/hwmon: Enable fan curve control support Karthik Poosa
2026-11-28  6:10   ` sashiko-bot
2026-11-30 16:11     ` Poosa, Karthik
2026-11-28  5:59 ` [PATCH v5 07/10] drm/xe/hwmon: Restore fan user tables after resume Karthik Poosa
2026-11-28  6:15   ` sashiko-bot
2026-11-28  5:59 ` [PATCH v5 08/10] drm/xe/hwmon: Refresh fan data after late binding Karthik Poosa
2026-11-28  6:27   ` sashiko-bot
2026-11-30 15:55   ` Purkait, Soham
2026-11-28  5:59 ` [PATCH v5 09/10] drm/xe: Expose tjmax_fan_control_enable device sysfs Karthik Poosa
2026-11-28  6:12   ` sashiko-bot
2026-11-30 16:31   ` Purkait, Soham
2026-11-28  5:59 ` [PATCH v5 10/10] drm/xe/hwmon: Add kernel-doc for fan control Karthik Poosa
2026-11-30 16:44   ` Purkait, Soham
2026-11-28  6:14 ` ✗ CI.KUnit: failure for drm/xe/hwmon: Add fan control support (rev2) 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=sashiko-outbox-238481@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=karthik.poosa@intel.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.