All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Marquardt <davemarq@linux.ibm.com>
To: Tyrel Datwyler <tyreld@linux.ibm.com>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Madhavan Srinivasan <maddy@linux.ibm.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Nicholas Piggin <npiggin@gmail.com>,
	"Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
	linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org, Brian King <brking@linux.ibm.com>,
	Greg Joyce <gjoyce@linux.ibm.com>,
	Kyle Mahlkuch <kmahlkuc@linux.ibm.com>
Subject: Re: [PATCH v2 5/7] ibmvfc: allocate asynchronous sub-queue
Date: Wed, 17 Jun 2026 14:46:34 -0500	[thread overview]
Message-ID: <87ik7har1h.fsf@linux.ibm.com> (raw)
In-Reply-To: <09278991-08df-4b99-9076-8f90689412ee@linux.ibm.com>

Tyrel Datwyler <tyreld@linux.ibm.com> writes:

> On 6/8/26 11:30 AM, Dave Marquardt via B4 Relay wrote:
>> From: Dave Marquardt <davemarq@linux.ibm.com>
>> 
>> Allocate and set up the asynchronous sub-queue for asynchronous
>> events, as required for full and extended FPIN support.
>> ---
>>  drivers/scsi/ibmvscsi/ibmvfc.c | 28 ++++++++++++++++++++++++++++
>>  1 file changed, 28 insertions(+)
>> 
>> diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
>> index a18861808325..ad1f5636e879 100644
>> --- a/drivers/scsi/ibmvscsi/ibmvfc.c
>> +++ b/drivers/scsi/ibmvscsi/ibmvfc.c
>> @@ -5352,6 +5352,8 @@ static void ibmvfc_channel_setup_done(struct ibmvfc_event *evt)
>>  			for (i = 0; i < active_queues; i++)
>>  				scrqs->scrqs[i].vios_cookie =
>>  					be64_to_cpu(setup->channel_handles[i]);
>> +			scrqs->async_scrq->vios_cookie =
>> +				be64_to_cpu(setup->asyncSubqHandle);
>>  
>>  			ibmvfc_dbg(vhost, "Using %u channels\n",
>>  				   vhost->scsi_scrqs.active_queues);
>> @@ -5402,6 +5404,7 @@ static void ibmvfc_channel_setup(struct ibmvfc_host *vhost)
>>  		setup_buf->num_scsi_subq_channels = cpu_to_be32(num_channels);
>>  		for (i = 0; i < num_channels; i++)
>>  			setup_buf->channel_handles[i] = cpu_to_be64(scrqs->scrqs[i].cookie);
>> +		setup_buf->asyncSubqHandle = cpu_to_be64(scrqs->async_scrq->cookie);
>>  	}
>>  
>>  	ibmvfc_init_event(evt, ibmvfc_channel_setup_done, IBMVFC_MAD_FORMAT);
>> @@ -6369,6 +6372,24 @@ static int ibmvfc_alloc_channels(struct ibmvfc_host *vhost,
>>  	if (!channels->scrqs)
>>  		return -ENOMEM;
>>  
>> +	channels->async_scrq = kzalloc_obj(*channels->async_scrq, GFP_KERNEL);
>> +
>> +	if (!channels->async_scrq) {
>> +		kfree(channels->scrqs);
>> +		channels->scrqs = NULL;
>> +		return -ENOMEM;
>
> This failure cleanup code starts duplicating here.
>
>> +	}
>> +
>> +	rc = ibmvfc_alloc_queue(vhost, channels->async_scrq,
>> +				IBMVFC_SUB_CRQ_FMT);
>> +	if (rc) {
>> +		kfree(channels->scrqs);
>> +		channels->scrqs = NULL;
>> +		kfree(channels->async_scrq);
>> +		channels->async_scrq = NULL;
>
> Again here plus freeing channels->scrqs memory.
>
>> +		return rc;
>> +	}
>> +
>>  	for (i = 0; i < channels->max_queues; i++) {
>>  		scrq = &channels->scrqs[i];
>>  		rc = ibmvfc_alloc_queue(vhost, scrq, IBMVFC_SUB_CRQ_FMT);
>> @@ -6380,6 +6401,9 @@ static int ibmvfc_alloc_channels(struct ibmvfc_host *vhost,
>>  			kfree(channels->scrqs);
>>  			channels->scrqs = NULL;
>>  			channels->active_queues = 0;
>> +			ibmvfc_free_queue(vhost, channels->async_scrq);
>> +			kfree(channels->async_scrq);
>> +			channels->async_scrq = NULL;
>
> And then again here. Could use goto to do the frees at the end of the function.
>
> free_async:
> 	kfree(channels->async_scrq);
> 	channels->async = NULL;
> free_scrqs:
> 	kfree(channels->scrqs);
> 	channels->scrqs = NULL;
>
> return rc;
>
>>  			return rc;
>>  		}
>>  	}
>> @@ -6418,6 +6442,10 @@ static void ibmvfc_release_channels(struct ibmvfc_host *vhost,
>>  
>>  		kfree(channels->scrqs);
>>  		channels->scrqs = NULL;
>> +
>> +		ibmvfc_free_queue(vhost, channels->async_scrq);
>
> Looks like missing kfree(channels->async_scrq) here.

I'll clean this up. Thanks.

-Dave


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

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-08 18:30 [PATCH v2 0/7] ibmvfc: make ibmvfc support FPIN messages Dave Marquardt via B4 Relay
2026-06-08 18:30 ` Dave Marquardt
2026-06-08 18:30 ` [PATCH v2 1/7] ibmvfc: add basic FPIN support Dave Marquardt via B4 Relay
2026-06-08 18:30   ` Dave Marquardt
2026-06-12 22:35   ` Tyrel Datwyler
2026-06-15 20:37     ` Dave Marquardt
2026-06-15 22:10       ` Tyrel Datwyler
2026-06-15 23:38   ` Tyrel Datwyler
2026-06-08 18:30 ` [PATCH v2 2/7] ibmvfc: Add NOOP command support Dave Marquardt via B4 Relay
2026-06-08 18:30   ` Dave Marquardt
2026-06-08 18:30 ` [PATCH v2 3/7] ibmvfc: make ibmvfc login to fabric Dave Marquardt via B4 Relay
2026-06-08 18:30   ` Dave Marquardt
2026-06-12 23:11   ` Tyrel Datwyler
2026-06-15 13:42     ` Dave Marquardt
2026-06-08 18:30 ` [PATCH v2 4/7] ibmvfc: define asynchronous sub-queue Dave Marquardt via B4 Relay
2026-06-08 18:30   ` Dave Marquardt
2026-06-15 19:27   ` Tyrel Datwyler
2026-06-15 20:15     ` Dave Marquardt
2026-06-08 18:30 ` [PATCH v2 5/7] ibmvfc: allocate " Dave Marquardt via B4 Relay
2026-06-08 18:30   ` Dave Marquardt
2026-06-15 19:54   ` Tyrel Datwyler
2026-06-17 19:46     ` Dave Marquardt [this message]
2026-06-08 18:30 ` [PATCH v2 6/7] ibmvfc: register and use " Dave Marquardt via B4 Relay
2026-06-08 18:30   ` Dave Marquardt
2026-06-15 20:58   ` Tyrel Datwyler
2026-06-08 18:30 ` [PATCH v2 7/7] ibmvfc: handle extended FPIN events Dave Marquardt via B4 Relay
2026-06-08 18:30   ` Dave Marquardt
2026-06-15 21:52   ` Tyrel Datwyler

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=87ik7har1h.fsf@linux.ibm.com \
    --to=davemarq@linux.ibm.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=brking@linux.ibm.com \
    --cc=chleroy@kernel.org \
    --cc=gjoyce@linux.ibm.com \
    --cc=kmahlkuc@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=martin.petersen@oracle.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=tyreld@linux.ibm.com \
    /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.