DMA Engine development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Naresh Maramaina" <naresh.maramaina@oss.qualcomm.com>
Cc: vkoul@kernel.org, linux-serial@vger.kernel.org,
	Frank.Li@kernel.org, dmaengine@vger.kernel.org
Subject: Re: [PATCH 3/4] dmaengine: qcom: gpi: Ignore cancelled transfer-completion events
Date: Fri, 09 Oct 2026 07:11:19 +0000	[thread overview]
Message-ID: <sashiko-outbox-164980@kernel.org> (raw)
In-Reply-To: <20261009-add-gpi-dma-support-for-uart-v1-3-c69e728df686@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] dma: qcom/gpi: dropped transfers during pause due to CANCELLED events
--

commit 4a0fc29a2e60fc21d8e540e5657013e4f69245b6
Author: Naresh Maramaina <naresh.maramaina@oss.qualcomm.com>

dmaengine: qcom: gpi: Ignore cancelled transfer-completion events

Channel cancellation can generate a transfer-completion event marked
with the cancellation status bit. If the event is processed after
the channel has left ACTIVE_STATE, it triggers a false error report.

Ignore transfer-completion events marked as cancellation events when
the channel is no longer active. Continue to report all other
unexpected completion events received on inactive channels.

> diff --git a/drivers/dma/qcom/gpi.c b/drivers/dma/qcom/gpi.c
> index f72b80bf5553c..7e1fa8d249024 100644
> --- a/drivers/dma/qcom/gpi.c
> +++ b/drivers/dma/qcom/gpi.c

[ ... ]

> @@ -1022,7 +1024,15 @@ static void gpi_process_xfer_compl_event(struct gchan *gchan,
>  
>  	/* only process events on active channel */
>  	if (unlikely(gchan->pm_state != ACTIVE_STATE)) {
> -		dev_err(gpii->gpi_dev->dev, "skipping processing event because ch @ %s state\n",
> +		/*
> +		 * A channel cancel may generate a transfer-completion event after
> +		 * the channel has left ACTIVE_STATE. Ignore such events to avoid
> +		 * reporting a spurious error.
> +		 */
> +		if (compl_event->status & GPI_COMPL_STATUS_CANCELLED)
> +			return;
> +

[Severity: Medium]
Will this properly ignore the cancelled event during a pause?

When a client calls gpi_pause(), it stops the channel which generates a
CANCELLED event, but it leaves gchan->pm_state as ACTIVE_STATE:

drivers/dma/qcom/gpi.c:gpi_pause() {
    ...
	for (i = 0; i < MAX_CHANNELS_PER_GPII; i++) {
		ret = gpi_stop_chan(&gpii->gchan[i]);
    ...
	write_lock_irq(&gpii->pm_lock);
	gpii->pm_state = PAUSE_STATE;
    ...
}

Because gchan->pm_state remains ACTIVE_STATE, gpi_process_xfer_compl_event()
will bypass this new check. The function then proceeds to consume the
CANCELLED event and complete the descriptor, permanently dropping the transfer
and breaking the pause/resume state machine.

Should the check for GPI_COMPL_STATUS_CANCELLED be moved outside the pm_state
check, or should gchan->pm_state be updated in gpi_pause() prior to stopping
the channel?

> +		dev_err(gpii->gpi_dev->dev, "skipping processing xfer completion event because ch @ %s state\n",
>  			TO_GPI_PM_STR(gchan->pm_state));
>  		return;
>  	}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261009-add-gpi-dma-support-for-uart-v1-0-c69e728df686@oss.qualcomm.com?part=3

  reply	other threads:[~2026-10-09  7:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-09  6:57 [PATCH 0/4] tty: serial: qcom_geni_serial: Add GPI DMA support Naresh Maramaina
2026-10-09  6:57 ` [PATCH 1/4] dmaengine: qcom: gpi: Add UART transfer support Naresh Maramaina
2026-10-09  7:12   ` sashiko-bot
2026-10-09  6:57 ` [PATCH 2/4] dmaengine: qcom: gpi: Calculate UART TRE count per direction Naresh Maramaina
2026-10-09  7:12   ` sashiko-bot
2026-10-09  6:57 ` [PATCH 3/4] dmaengine: qcom: gpi: Ignore cancelled transfer-completion events Naresh Maramaina
2026-10-09  7:11   ` sashiko-bot [this message]
2026-10-09  6:57 ` [PATCH 4/4] tty: serial: qcom_geni_serial: Add GPI DMA support Naresh Maramaina
2026-10-09  7:09   ` sashiko-bot
2026-10-10  1:11   ` kernel test robot

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-164980@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=naresh.maramaina@oss.qualcomm.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vkoul@kernel.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