common/cnxk/roc_npa: fix npa_aura_fini

Message ID 20230620085134.3124796-1-thierry.herbelot@6wind.com (mailing list archive)
State Superseded, archived
Delegated to: Jerin Jacob
Headers
Series common/cnxk/roc_npa: fix npa_aura_fini |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation fail Compilation issues
ci/intel-Testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch-unit-testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-abi-testing success Testing PASS
ci/iol-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS

Commit Message

Thierry Herbelot June 20, 2023, 8:51 a.m. UTC
  Unlock mbox when an error is detected.

Fixes: ea4d70cc4f0b46d5 ('common/cnxk: add NPA aura create/destroy ROC APIs')
Signed-off-by: Thierry Herbelot <thierry.herbelot@6wind.com>
---
 drivers/common/cnxk/roc_npa.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
  

Comments

Ashwin Sekhar T K June 20, 2023, 9:27 a.m. UTC | #1
Hi Thierry,

Could you please add the same fix in npa_aura_pool_fini() as well.

Thanks
Ashwin Sekhar T K 

> -----Original Message-----
> From: Thierry Herbelot <thierry.herbelot@6wind.com>
> Sent: Tuesday, June 20, 2023 2:22 PM
> To: dev@dpdk.org
> Cc: Thierry Herbelot <thierry.herbelot@6wind.com>; Thomas Monjalon
> <thomas@monjalon.net>; Nithin Kumar Dabilpuram
> <ndabilpuram@marvell.com>; Satha Koteswara Rao Kottidi
> <skoteshwar@marvell.com>; Jerin Jacob Kollanukkaran
> <jerinj@marvell.com>
> Subject: [EXT] [PATCH] common/cnxk/roc_npa: fix npa_aura_fini
> 
> External Email
> 
> ----------------------------------------------------------------------
> Unlock mbox when an error is detected.
> 
> Fixes: ea4d70cc4f0b46d5 ('common/cnxk: add NPA aura create/destroy ROC
> APIs')
> Signed-off-by: Thierry Herbelot <thierry.herbelot@6wind.com>
> ---
>  drivers/common/cnxk/roc_npa.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/common/cnxk/roc_npa.c
> b/drivers/common/cnxk/roc_npa.c index 377439c2baaf..38e149da82cc
> 100644
> --- a/drivers/common/cnxk/roc_npa.c
> +++ b/drivers/common/cnxk/roc_npa.c
> @@ -245,8 +245,10 @@ npa_aura_fini(struct mbox *m_box, uint32_t
> aura_id)
>  	if (rc < 0)
>  		goto exit;
> 
> -	if (aura_rsp->hdr.rc != 0)
> -		return NPA_ERR_AURA_POOL_FINI;
> +	if (aura_rsp->hdr.rc != 0) {
> +		rc = NPA_ERR_AURA_POOL_FINI;
> +		goto exit;
> +	}
> 
>  	/* Sync NDC-NPA for LF */
>  	ndc_req = mbox_alloc_msg_ndc_sync_op(mbox);
> --
> 2.39.2
  
Thierry Herbelot June 20, 2023, 9:29 a.m. UTC | #2
Hello Ashwin,

I will resend a patch with a fix also in npa_aura_pool_fini

	Thierry

On 6/20/23 11:27, Ashwin Sekhar T K wrote:
> Hi Thierry,
> 
> Could you please add the same fix in npa_aura_pool_fini() as well.
> 
> Thanks
> Ashwin Sekhar T K
> 
>> -----Original Message-----
>> From: Thierry Herbelot <thierry.herbelot@6wind.com>
>> Sent: Tuesday, June 20, 2023 2:22 PM
>> To: dev@dpdk.org
>> Cc: Thierry Herbelot <thierry.herbelot@6wind.com>; Thomas Monjalon
>> <thomas@monjalon.net>; Nithin Kumar Dabilpuram
>> <ndabilpuram@marvell.com>; Satha Koteswara Rao Kottidi
>> <skoteshwar@marvell.com>; Jerin Jacob Kollanukkaran
>> <jerinj@marvell.com>
>> Subject: [EXT] [PATCH] common/cnxk/roc_npa: fix npa_aura_fini
>>
>> External Email
>>
>> ----------------------------------------------------------------------
>> Unlock mbox when an error is detected.
>>
>> Fixes: ea4d70cc4f0b46d5 ('common/cnxk: add NPA aura create/destroy ROC
>> APIs')
>> Signed-off-by: Thierry Herbelot <thierry.herbelot@6wind.com>
>> ---
>>   drivers/common/cnxk/roc_npa.c | 6 ++++--
>>   1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/common/cnxk/roc_npa.c
>> b/drivers/common/cnxk/roc_npa.c index 377439c2baaf..38e149da82cc
>> 100644
>> --- a/drivers/common/cnxk/roc_npa.c
>> +++ b/drivers/common/cnxk/roc_npa.c
>> @@ -245,8 +245,10 @@ npa_aura_fini(struct mbox *m_box, uint32_t
>> aura_id)
>>   	if (rc < 0)
>>   		goto exit;
>>
>> -	if (aura_rsp->hdr.rc != 0)
>> -		return NPA_ERR_AURA_POOL_FINI;
>> +	if (aura_rsp->hdr.rc != 0) {
>> +		rc = NPA_ERR_AURA_POOL_FINI;
>> +		goto exit;
>> +	}
>>
>>   	/* Sync NDC-NPA for LF */
>>   	ndc_req = mbox_alloc_msg_ndc_sync_op(mbox);
>> --
>> 2.39.2
>
  
David Marchand June 20, 2023, 9:32 a.m. UTC | #3
On Tue, Jun 20, 2023 at 10:51 AM Thierry Herbelot
<thierry.herbelot@6wind.com> wrote:
>
> Unlock mbox when an error is detected.

Out of curiosity, how did you catch it?

This issue could probably be caught with clang thread safety checks,
but it is disabled on this driver atm.
https://git.dpdk.org/dpdk/commit/drivers/common/cnxk?id=70cc4e1fed665712e68f2f45d98dda4abc6accda
  
Thierry Herbelot June 20, 2023, 9:49 a.m. UTC | #4
Hello David,

I added a trace in mbox_get() to print when a mbox lock was already locked.
The traces were displayed when running an internal CI/CD test suite.

	Best regards

	Thierry

On 6/20/23 11:32, David Marchand wrote:
> On Tue, Jun 20, 2023 at 10:51 AM Thierry Herbelot
> <thierry.herbelot@6wind.com> wrote:
>>
>> Unlock mbox when an error is detected.
> 
> Out of curiosity, how did you catch it?
> 
> This issue could probably be caught with clang thread safety checks,
> but it is disabled on this driver atm.
> https://git.dpdk.org/dpdk/commit/drivers/common/cnxk?id=70cc4e1fed665712e68f2f45d98dda4abc6accda
> 
>
  

Patch

diff --git a/drivers/common/cnxk/roc_npa.c b/drivers/common/cnxk/roc_npa.c
index 377439c2baaf..38e149da82cc 100644
--- a/drivers/common/cnxk/roc_npa.c
+++ b/drivers/common/cnxk/roc_npa.c
@@ -245,8 +245,10 @@  npa_aura_fini(struct mbox *m_box, uint32_t aura_id)
 	if (rc < 0)
 		goto exit;
 
-	if (aura_rsp->hdr.rc != 0)
-		return NPA_ERR_AURA_POOL_FINI;
+	if (aura_rsp->hdr.rc != 0) {
+		rc = NPA_ERR_AURA_POOL_FINI;
+		goto exit;
+	}
 
 	/* Sync NDC-NPA for LF */
 	ndc_req = mbox_alloc_msg_ndc_sync_op(mbox);