All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Marquardt <davemarq@linux.ibm.com>
To: sashiko-reviews@lists.linux.dev
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH v19 12/13] scsi: ibmvfc: register and use asynchronous sub CRQ for events
Date: Mon, 30 Nov 2026 14:38:43 -0600	[thread overview]
Message-ID: <87h5gyawbw.fsf@linux.ibm.com> (raw)
In-Reply-To: <sashiko-outbox-231582@kernel.org>

sashiko-bot@kernel.org writes:

> Thank you for your contribution! Sashiko AI review found 1 potential
> issue to consider:
> - [Medium] scsi: ibmvfc: skipped async vios_cookie setup in
>   ibmvfc_channel_setup_done()
> --
>
> commit 3e247869161ac30df00b0fd2f408f7ef73973ecb
> Author: Dave Marquardt <davemarq@linux.ibm.com>
>
> scsi: ibmvfc: register and use asynchronous sub CRQ for events
>
> This commit wires the asynchronous sub-CRQ into the ibmvfc channel allocation,
> registration, setup, and teardown lifecycle, and advertises async sub-CRQ
> support during NPIV login when multi-queue channels are enabled.
>
>> diff --git a/drivers/scsi/ibmvscsi/ibmvfc-core.c b/drivers/scsi/ibmvscsi/ibmvfc-core.c
>> index 5e8b25673ff5d..f478f10f93ffc 100644
>> --- a/drivers/scsi/ibmvscsi/ibmvfc-core.c
>> +++ b/drivers/scsi/ibmvscsi/ibmvfc-core.c
>
> [ ... ]
>
>> @@ -5912,6 +5940,7 @@ static void ibmvfc_channel_setup_done(struct ibmvfc_event *evt)
>>  {
>>  	struct ibmvfc_host *vhost = evt->vhost;
>>  	struct ibmvfc_channel_setup *setup = vhost->channel_setup_buf;
>> +	struct ibmvfc_channels *async = &vhost->async_scrqs;
>>  	struct ibmvfc_channels *scsi = &vhost->scsi_scrqs;
>>  	struct ibmvfc_channels *nvme = &vhost->nvme_scrqs;
>>  	u32 mad_status = be16_to_cpu(evt->xfer_iu->channel_setup.common.status);
>> @@ -5925,8 +5954,12 @@ static void ibmvfc_channel_setup_done(struct ibmvfc_event *evt)
>>  		ibmvfc_dbg(vhost, "Channel Setup succeeded\n");
>>  		flags = be32_to_cpu(setup->flags);
>>  		vhost->do_enquiry = 0;
>> -		scsi->active_queues = be32_to_cpu(setup->num_scsi_subq_channels);
>> -		nvme->active_queues = be32_to_cpu(setup->num_nvme_subq_channels);
>> +		scsi->active_queues = min(be32_to_cpu(setup->num_scsi_subq_channels),
>> +					  scsi->max_queues);
>> +		nvme->active_queues = nvme->scrqs ?
>> +			min(be32_to_cpu(setup->num_nvme_subq_channels),
>> +			    nvme->max_queues) : 0;
>> +		async->active_queues = (async->scrqs && setup->async_sub_crq_handle) ? 1 : 0;
>>  
>>  		if (flags & IBMVFC_CHANNELS_CANCELED) {
>>  			ibmvfc_dbg(vhost, "Channels Canceled\n");
>> @@ -5942,6 +5975,8 @@ static void ibmvfc_channel_setup_done(struct ibmvfc_event *evt)
>>  		for (i = 0; i < nvme->active_queues; i++)
>>  			nvme->scrqs[i].vios_cookie =
>>  				be64_to_cpu(setup->channel_handles[scsi->active_queues + i]);
>> +		for (i = 0; i < async->active_queues; i++)
>> +			async->scrqs[i].vios_cookie = be64_to_cpu(setup->async_sub_crq_handle);
>
> [Severity: Medium]
> Does breaking out on IBMVFC_CHANNELS_CANCELED skip setting
> async->scrqs[0].vios_cookie while leaving async->active_queues set to 1?
>
> When scsi_channels and nvme_channels are both 0, ibmvfc_channel_setup()
> sets IBMVFC_CANCEL_CHANNELS and still populates
> setup_buf->async_sub_crq_handle so the async sub-CRQ can be used.
> However, when the response returns with IBMVFC_CHANNELS_CANCELED set, the
> break in ibmvfc_channel_setup_done() jumps over the loop that stores
> setup->async_sub_crq_handle in async->scrqs[0].vios_cookie, leaving
> vios_cookie uninitialized or stale.  It also leaves scsi->active_queues
> and nvme->active_queues unzeroed if the response contains non-zero counts.

I agree this is an inconsistent state. IBMVFC_CANCEL_CHANNELS also
cancels the async sub-queue, so after IBMVFC_CHANNELS_CANCELED the async
sub-CRQ isn't usable and shouldn't be marked active. v20 will clear the
async, SCSI, and MVE channel sets that code branch.  Nothing consumes
the async cookie today, and the SCSI/NVMe readers are guarded by us
ing_channels, so this was a stale-state issue rather than an observed
failure.

-Dave

  reply	other threads:[~2026-11-30 20:38 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 16:16 [PATCH v19 00/13] scsi: ibmvfc: make ibmvfc support FPIN messages Dave Marquardt via B4 Relay
2026-11-24 16:16 ` Dave Marquardt
2026-11-24 16:16 ` [PATCH v19 01/13] scsi: ibmvfc: fix IRQ leak and guard deregister on channel reg failure Dave Marquardt via B4 Relay
2026-11-24 16:16   ` Dave Marquardt
2026-11-24 16:27   ` sashiko-bot
2026-11-30 20:15     ` Dave Marquardt
2026-11-24 16:16 ` [PATCH v19 02/13] scsi: ibmvfc: fix potential clobbering of rc after failed irq setup Dave Marquardt via B4 Relay
2026-11-24 16:16   ` Dave Marquardt
2026-11-24 16:27   ` sashiko-bot
2026-11-30 20:22     ` Dave Marquardt
2026-11-24 16:16 ` [PATCH v19 03/13] scsi: ibmvfc: fix potential NULL pointer dereference on failed queue allocation Dave Marquardt via B4 Relay
2026-11-24 16:16   ` Dave Marquardt
2026-11-24 16:16 ` [PATCH v19 04/13] scsi: ibmvfc: fix stale rc and IRQ mapping leak in ibmvfc_register_channel() Dave Marquardt via B4 Relay
2026-11-24 16:16   ` Dave Marquardt
2026-11-24 16:21   ` sashiko-bot
2026-11-30 20:27     ` Dave Marquardt
2026-11-24 16:16 ` [PATCH v19 05/13] scsi: ibmvfc: fix resource leaks on partial queue allocation failure Dave Marquardt via B4 Relay
2026-11-24 16:16   ` Dave Marquardt
2026-11-24 16:27   ` sashiko-bot
2026-11-30 20:31     ` Dave Marquardt
2026-11-24 16:16 ` [PATCH v19 06/13] scsi: ibmvfc: add basic FPIN support Dave Marquardt via B4 Relay
2026-11-24 16:16   ` Dave Marquardt
2026-11-24 16:16 ` [PATCH v19 07/13] scsi: ibmvfc: add NOOP command support Dave Marquardt via B4 Relay
2026-11-24 16:16   ` Dave Marquardt
2026-11-24 16:16 ` [PATCH v19 08/13] scsi: ibmvfc: add FPIN extended flag and async sub-CRQ queue handle Dave Marquardt via B4 Relay
2026-11-24 16:16   ` Dave Marquardt
2026-11-24 16:16 ` [PATCH v19 09/13] scsi: ibmvfc: extend async event handlers for async sub-CRQ events Dave Marquardt via B4 Relay
2026-11-24 16:16   ` Dave Marquardt
2026-11-24 16:16 ` [PATCH v19 10/13] scsi: ibmvfc: add interrupt routine for asynchronous sub CRQ Dave Marquardt via B4 Relay
2026-11-24 16:16   ` Dave Marquardt
2026-11-24 16:16 ` [PATCH v19 11/13] scsi: ibmvfc: extend channel registration for async sub-CRQ Dave Marquardt via B4 Relay
2026-11-24 16:16   ` Dave Marquardt
2026-11-24 16:16 ` [PATCH v19 12/13] scsi: ibmvfc: register and use asynchronous sub CRQ for events Dave Marquardt via B4 Relay
2026-11-24 16:16   ` Dave Marquardt
2026-11-24 16:43   ` sashiko-bot
2026-11-30 20:38     ` Dave Marquardt [this message]
2026-11-24 16:16 ` [PATCH v19 13/13] scsi: ibmvfc: handle extended FPIN events Dave Marquardt via B4 Relay
2026-11-24 16:16   ` Dave Marquardt

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=87h5gyawbw.fsf@linux.ibm.com \
    --to=davemarq@linux.ibm.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 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.