mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Baolu Lu <baolu.lu@linux.intel.com>
To: Guanghui Feng <guanghuifeng@linux.alibaba.com>
Cc: bikuan.zbk@alibaba-inc.com, dwmw2@infradead.org,
	iommu@lists.linux.dev, joro@8bytes.org,
	linux-kernel@vger.kernel.org, robin.murphy@arm.com,
	will@kernel.org
Subject: Re: [PATCH v4] iommu/vt-d: Fix IQE handling to cover all descriptors in submission range
Date: Thu, 24 Sep 2026 14:49:18 +0800	[thread overview]
Message-ID: <3ca4360c-75b9-46a4-9cea-85d008d85ccf@linux.intel.com> (raw)
In-Reply-To: <20260916081135.2038574-1-guanghuifeng@linux.alibaba.com>

On 9/16/26 16:11, Guanghui Feng wrote:
> When an Invalidation Queue Error (IQE) occurs, hardware halts fetching
> and IQH points at the faulting descriptor. The previous code only
> checked whether IQH matched the first descriptor index of the current
> submission, missing faults on any other descriptor within the batch.
> 
> Expand the check to cover the entire submission range [index, wait_index],
> accounting for circular wrap-around.
> 
> Furthermore, after detecting IQE, the old recovery only replaced the
> single faulting slot with a copy of the wait descriptor and immediately
> returned -EINVAL. This left two problems:
> 
>    a) Hardware resumed fetching and could hit another invalid descriptor
>       in the same abandoned batch, raising a second IQE that no submitter
>       would claim — permanently deadlocking the queue.
> 
>    b) The caller reclaimed all batch slots (QI_FREE) while hardware might
>       still be asynchronously processing descriptors from that batch,
>       allowing concurrent overwrite and descriptor corruption.
> 
> Fix both by introducing qi_drain_remaining_descs(): upon IQE detection,
> overwrite the stranded slots in [IQH, wait_index) with fenced no-op wait
> descriptors, resubmit the wait descriptor at wait_index, clear IQE, and
> spin until hardware signals QI_DONE (with DMAR_OPERATION_TIMEOUT). This
> guarantees hardware has fully drained the batch before the caller
> reclaims slots.
> 

Fixes: 8a1d82462540 ("iommu/vt-d: Multiple descriptors per 
qi_submit_sync()")

> Signed-off-by: Guanghui Feng<guanghuifeng@linux.alibaba.com>
> ---
>   drivers/iommu/intel/dmar.c | 73 ++++++++++++++++++++++++++++++++------
>   1 file changed, 62 insertions(+), 11 deletions(-)

Queued for iommu/next. Thanks!

      reply	other threads:[~2026-09-24  6:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-05  4:20 [PATCH] " Guanghui Feng
2026-08-20  3:09 ` Baolu Lu
2026-08-20 14:47   ` Guanghui Feng
2026-08-20 19:37     ` Samiullah Khawaja
2026-08-21  2:56     ` Baolu Lu
2026-09-09  7:13       ` Baolu Lu
2026-09-14 14:19         ` [PATCH v3] " Guanghui Feng
2026-09-16  6:23           ` Baolu Lu
2026-09-16  8:11             ` [PATCH v4] " Guanghui Feng
2026-09-24  6:49               ` Baolu Lu [this message]

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=3ca4360c-75b9-46a4-9cea-85d008d85ccf@linux.intel.com \
    --to=baolu.lu@linux.intel.com \
    --cc=bikuan.zbk@alibaba-inc.com \
    --cc=dwmw2@infradead.org \
    --cc=guanghuifeng@linux.alibaba.com \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=will@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

all inboxes | Powered by JetHome®