Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ian Rogers" <irogers@google.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH] scsi: aic7xxx: Check ahc->flags instead of ahc->features for AHC_SCB_BTT
Date: Thu, 19 Nov 2026 17:19:58 +0000	[thread overview]
Message-ID: <sashiko-outbox-223682@kernel.org> (raw)
In-Reply-To: <20261119170605.1518761-1-irogers@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] scsi: aic7xxx: missing per-LUN untagged limit in
  ahc_linux_run_command()
--

commit ec21efc91528b4a71de5b706f48c1434b9f8f837
Author: Ian Rogers <irogers@google.com>

scsi: aic7xxx: Check ahc->flags instead of ahc->features for AHC_SCB_BTT

This commit changes the untagged queue throttling check in
ahc_linux_run_command() to test ahc->flags instead of ahc->features for
AHC_SCB_BTT.

> diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
> index d93b522695eba..e12ee18a18d5f 100644
> --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
> +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
> @@ -1432,7 +1432,7 @@ ahc_linux_run_command(struct ahc_softc *ahc, struct ahc_linux_device *dev,
>  	 * table in SCB space.
>  	 */
>  	if (!(cmd->flags & SCMD_TAGGED)
> -	    && (ahc->features & AHC_SCB_BTT) == 0) {
> +	    && (ahc->flags & AHC_SCB_BTT) == 0) {
>  		int target_offset;
>  
>  		target_offset = cmd->device->id + cmd->device->channel * 8;

[Severity: High]
Can this dispatch two concurrent untagged commands to the same target and
LUN when AHC_SCB_BTT is set?

ahc_platform_set_tags() sets queue_depth to 2 for untagged devices:

drivers/scsi/aic7xxx/aic7xxx_osm.c:ahc_platform_set_tags() {
    ...
	default:
		/*
		 * We allow the OS to queue 2 untagged transactions to
		 * us at any time even though we can only execute them
		 * serially on the controller/device.  This should
		 * remove some latency.
		 */
		scsi_change_queue_depth(sdev, 2);
		break;
}

When e4e360c325c9 ("[SCSI] remove aic7xxx busyq") removed the per-device
busyq, it also dropped the dev->openings check that serialized untagged
commands per LUN; ahc_linux_run_command() decrements dev->openings and
increments dev->active without checking either first.  Until now that was
masked because (ahc->features & AHC_SCB_BTT) == 0 was always true, so
ahc->untagged_queues serialized untagged commands across the whole target.

The SCB-space busy target table (SCB_64_BTT) only holds one SCB tag per
(target, LUN) slot to allow concurrent untagged commands across different
LUNs of a target.  Without a per-LUN check (such as returning
SCSI_MLQUEUE_DEVICE_BUSY when dev->active != 0 for an untagged command, or
limiting untagged queue_depth to 1), bypassing untagged_queues sends a
second untagged SCB for the same (target, LUN) to ahc_queue_scb(),
overlapping untagged commands on the bus and overwriting the SCB_64_BTT
slot on disconnect.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261119170605.1518761-1-irogers@google.com?part=1

      reply	other threads:[~2026-11-19 17:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 17:06 [PATCH] scsi: aic7xxx: Check ahc->flags instead of ahc->features for AHC_SCB_BTT Ian Rogers
2026-11-19 17:19 ` sashiko-bot [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=sashiko-outbox-223682@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=irogers@google.com \
    --cc=linux-scsi@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox