eal: fix unlock in rte_eal_memzone_init

Message ID 1544057251-17351-1-git-send-email-gfree.wind@vip.163.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series eal: fix unlock in rte_eal_memzone_init |

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS

Commit Message

Gao Feng Dec. 6, 2018, 12:47 a.m. UTC
  From: Gao Feng <davidfgao@tencent.com>

The RTE_PROC_PRIMARY error handler lost the unlock statement in the
current codes. Now fix it.

Signed-off-by: Gao Feng <davidfgao@tencent.com>
---
 lib/librte_eal/common/eal_common_memzone.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Anatoly Burakov Dec. 6, 2018, 9:09 a.m. UTC | #1
On 06-Dec-18 12:47 AM, gfree.wind@vip.163.com wrote:
> From: Gao Feng <davidfgao@tencent.com>
> 
> The RTE_PROC_PRIMARY error handler lost the unlock statement in the
> current codes. Now fix it.
> 
> Signed-off-by: Gao Feng <davidfgao@tencent.com>

Fixes: 49df3db84883 ("memzone: replace memzone array with fbarray")
Cc: stable@dpdk.org

> ---
>   lib/librte_eal/common/eal_common_memzone.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/lib/librte_eal/common/eal_common_memzone.c b/lib/librte_eal/common/eal_common_memzone.c
> index b7081af..649cad4 100644
> --- a/lib/librte_eal/common/eal_common_memzone.c
> +++ b/lib/librte_eal/common/eal_common_memzone.c
> @@ -375,6 +375,7 @@
>   			rte_fbarray_init(&mcfg->memzones, "memzone",
>   			RTE_MAX_MEMZONE, sizeof(struct rte_memzone))) {
>   		RTE_LOG(ERR, EAL, "Cannot allocate memzone list\n");
> +		rte_rwlock_write_unlock(&mcfg->mlock);
>   		return -1;
>   	} else if (rte_eal_process_type() == RTE_PROC_SECONDARY &&
>   			rte_fbarray_attach(&mcfg->memzones)) {
> 

Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

Although i would probably remove both unlocks and instead save and 
return a value, so that unlock happens in one place. But this is OK too.
  
Gao Feng Dec. 6, 2018, 9:44 a.m. UTC | #2
At 2018-12-06 17:09:23, "Burakov, Anatoly" <anatoly.burakov@intel.com> wrote:
>On 06-Dec-18 12:47 AM, gfree.wind@vip.163.com wrote:
>> From: Gao Feng <davidfgao@tencent.com>
>> 
>> The RTE_PROC_PRIMARY error handler lost the unlock statement in the
>> current codes. Now fix it.
>> 
>> Signed-off-by: Gao Feng <davidfgao@tencent.com>
>
>Fixes: 49df3db84883 ("memzone: replace memzone array with fbarray")
>Cc: stable@dpdk.org
>
>> ---
>>   lib/librte_eal/common/eal_common_memzone.c | 1 +
>>   1 file changed, 1 insertion(+)
>> 
>> diff --git a/lib/librte_eal/common/eal_common_memzone.c b/lib/librte_eal/common/eal_common_memzone.c
>> index b7081af..649cad4 100644
>> --- a/lib/librte_eal/common/eal_common_memzone.c
>> +++ b/lib/librte_eal/common/eal_common_memzone.c
>> @@ -375,6 +375,7 @@
>>   			rte_fbarray_init(&mcfg->memzones, "memzone",
>>   			RTE_MAX_MEMZONE, sizeof(struct rte_memzone))) {
>>   		RTE_LOG(ERR, EAL, "Cannot allocate memzone list\n");
>> +		rte_rwlock_write_unlock(&mcfg->mlock);
>>   		return -1;
>>   	} else if (rte_eal_process_type() == RTE_PROC_SECONDARY &&
>>   			rte_fbarray_attach(&mcfg->memzones)) {
>> 
>
>Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
>
>Although i would probably remove both unlocks and instead save and 

>return a value, so that unlock happens in one place. But this is OK too.


> Thanks Anatoly. 


Thanks Anatoly's review.
I also prefer keep unlock in one place. 
As a new guy, finally I choose just a fix with a minor change. I would do better next time.


And could I ask you one question, Anatoly?


I sent another dpdk patch with wrong git-send-email command, "git send-email -1 --to dev@dpdk.org patch_xxxx".
As a result, it generated another wrong reply and email thread.


I don't know if i need to send v2 patch to correct it then?
Its url is https://www.mail-archive.com/dev@dpdk.org/msg119925.html.


Best Regards
Feng


>
>-- 
>Thanks,
>Anatoly
  
Anatoly Burakov Dec. 6, 2018, 11:18 a.m. UTC | #3
On 06-Dec-18 9:44 AM, Gao Feng wrote:
> At 2018-12-06 17:09:23, "Burakov, Anatoly" <anatoly.burakov@intel.com> 
> wrote:
> 
>>On 06-Dec-18 12:47 AM, gfree.wind@vip.163.com wrote:
>>> From: Gao Feng <davidfgao@tencent.com>
>>> 
>>> The RTE_PROC_PRIMARY error handler lost the unlock statement in the
>>> current codes. Now fix it.
>>> 
>>> Signed-off-by: Gao Feng <davidfgao@tencent.com>
>>
>>Fixes: 49df3db84883 ("memzone: replace memzone array with fbarray")
>>Cc: stable@dpdk.org
>>
>>> ---
>>>   lib/librte_eal/common/eal_common_memzone.c | 1 +
>>>   1 file changed, 1 insertion(+)
>>> 
>>> diff --git a/lib/librte_eal/common/eal_common_memzone.c b/lib/librte_eal/common/eal_common_memzone.c
>>> index b7081af..649cad4 100644
>>> --- a/lib/librte_eal/common/eal_common_memzone.c
>>> +++ b/lib/librte_eal/common/eal_common_memzone.c
>>> @@ -375,6 +375,7 @@
>>>   			rte_fbarray_init(&mcfg->memzones, "memzone",
>>>   			RTE_MAX_MEMZONE, sizeof(struct rte_memzone))) {
>>>   		RTE_LOG(ERR, EAL, "Cannot allocate memzone list\n");
>>> +		rte_rwlock_write_unlock(&mcfg->mlock);
>>>   		return -1;
>>>   	} else if (rte_eal_process_type() == RTE_PROC_SECONDARY &&
>>>   			rte_fbarray_attach(&mcfg->memzones)) {
>>> 
>>
>>Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
>>
>>Although i would probably remove both unlocks and instead save and 
>  >return a value, so that unlock happens in one place. But this is OK too.
> 
>  > Thanks Anatoly.
> 
> Thanks Anatoly's review.
> I also prefer keep unlock in one place.
> As a new guy, finally I choose just a fix with a minor change. I would 
> do better next time.

That's OK. Regardless, you should resubmit it with proper Fixes: tag and 
a Cc: to stable, since this bug has been there since 18.05 and therefore 
our stable branches will benefit from your contribution as well.

> 
> And could I ask you one question, Anatoly?
> 
> I sent another dpdk patch with wrong git-send-email command, "git 
> send-email -1 --to dev@dpdk.org <mailto:dev@dpdk.org> patch_xxxx".
> As a result, it generated another wrong reply and email thread.
> 
> I don't know if i need to send v2 patch to correct it then?
> Its url is https://www.mail-archive.com/dev@dpdk.org/msg119925.html.

No need to do anything :)

> 
> Best Regards
> Feng
> 
>>
>>-- 
>>Thanks,
>>Anatoly
>
  

Patch

diff --git a/lib/librte_eal/common/eal_common_memzone.c b/lib/librte_eal/common/eal_common_memzone.c
index b7081af..649cad4 100644
--- a/lib/librte_eal/common/eal_common_memzone.c
+++ b/lib/librte_eal/common/eal_common_memzone.c
@@ -375,6 +375,7 @@ 
 			rte_fbarray_init(&mcfg->memzones, "memzone",
 			RTE_MAX_MEMZONE, sizeof(struct rte_memzone))) {
 		RTE_LOG(ERR, EAL, "Cannot allocate memzone list\n");
+		rte_rwlock_write_unlock(&mcfg->mlock);
 		return -1;
 	} else if (rte_eal_process_type() == RTE_PROC_SECONDARY &&
 			rte_fbarray_attach(&mcfg->memzones)) {