diff mbox series

[v2] eal: fix unlock in rte_eal_memzone_init

Message ID 1544145608-828-1-git-send-email-gfree.wind@vip.163.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers show
Series [v2] eal: fix unlock in rte_eal_memzone_init | expand

Checks

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

Commit Message

Gao Feng Dec. 7, 2018, 1:20 a.m. UTC
The RTE_PROC_PRIMARY error handler lost the unlock statement in the
current codes. Now unlock and return in one place to fix it.

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

Signed-off-by: Gao Feng <davidfgao@tencent.com>
---
 v2: Unlock and return in one place, per Anatoly

 lib/librte_eal/common/eal_common_memzone.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Anatoly Burakov Dec. 7, 2018, 8:57 a.m. UTC | #1
On 07-Dec-18 1:20 AM, Gao Feng wrote:
> The RTE_PROC_PRIMARY error handler lost the unlock statement in the
> current codes. Now unlock and return in one place to fix it.
> 
> Fixes: 49df3db84883 ("memzone: replace memzone array with fbarray")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Gao Feng <davidfgao@tencent.com>
> ---
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
Thomas Monjalon Dec. 20, 2018, 11:20 a.m. UTC | #2
07/12/2018 09:57, Burakov, Anatoly:
> On 07-Dec-18 1:20 AM, Gao Feng wrote:
> > The RTE_PROC_PRIMARY error handler lost the unlock statement in the
> > current codes. Now unlock and return in one place to fix it.
> > 
> > Fixes: 49df3db84883 ("memzone: replace memzone array with fbarray")
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Gao Feng <davidfgao@tencent.com>
> > ---
> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

Applied, thanks

I changed your author email (From:) to match the Signed-off-by one.
Please configure your git to use the Tencent email if possible.
Note you can have a "git From" address and use another one for sending.
Thomas Monjalon Dec. 20, 2018, 11:36 a.m. UTC | #3
20/12/2018 12:20, Thomas Monjalon:
> 07/12/2018 09:57, Burakov, Anatoly:
> > On 07-Dec-18 1:20 AM, Gao Feng wrote:
> > > The RTE_PROC_PRIMARY error handler lost the unlock statement in the
> > > current codes. Now unlock and return in one place to fix it.
> > > 
> > > Fixes: 49df3db84883 ("memzone: replace memzone array with fbarray")
> > > Cc: stable@dpdk.org
> > > 
> > > Signed-off-by: Gao Feng <davidfgao@tencent.com>
> > > ---
> > Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
> 
> Applied, thanks
> 
> I changed your author email (From:) to match the Signed-off-by one.
> Please configure your git to use the Tencent email if possible.
> Note you can have a "git From" address and use another one for sending.

One more tip about patch formatting:

I reworded the title to:
	memzone: fix unlock on initialization failure

The prefix "memzone" gives the scope of the change.
We decided that memzone is important enough to have its own scope prefix.
You can find other prefixes in the git history.

Then the rest of the title is written in plain english,
detailing more the scope with "on initialization failure".

Hope it helps, and welcome :)
Gao Feng Dec. 20, 2018, 11:44 a.m. UTC | #4
At 2018-12-20 19:20:53, "Thomas Monjalon" <thomas@monjalon.net> wrote:
>07/12/2018 09:57, Burakov, Anatoly:
>> On 07-Dec-18 1:20 AM, Gao Feng wrote:
>> > The RTE_PROC_PRIMARY error handler lost the unlock statement in the
>> > current codes. Now unlock and return in one place to fix it.
>> > 
>> > Fixes: 49df3db84883 ("memzone: replace memzone array with fbarray")
>> > Cc: stable@dpdk.org
>> > 
>> > Signed-off-by: Gao Feng <davidfgao@tencent.com>
>> > ---
>> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
>
>Applied, thanks
>
>I changed your author email (From:) to match the Signed-off-by one.
>Please configure your git to use the Tencent email if possible.
>Note you can have a "git From" address and use another one for sending.

Thanks,there is one reason.
Because the tencent mailbox is exchange, so I couldn't use git sendmail with tencent email.

Maybe I could add two signed-off to avoid it.

Best Regards
Feng

>
>
Gao Feng Dec. 20, 2018, 11:47 a.m. UTC | #5
At 2018-12-20 19:36:14, "Thomas Monjalon" <thomas@monjalon.net> wrote:
>20/12/2018 12:20, Thomas Monjalon:
>> 07/12/2018 09:57, Burakov, Anatoly:
>> > On 07-Dec-18 1:20 AM, Gao Feng wrote:
>> > > The RTE_PROC_PRIMARY error handler lost the unlock statement in the
>> > > current codes. Now unlock and return in one place to fix it.
>> > > 
>> > > Fixes: 49df3db84883 ("memzone: replace memzone array with fbarray")
>> > > Cc: stable@dpdk.org
>> > > 
>> > > Signed-off-by: Gao Feng <davidfgao@tencent.com>
>> > > ---
>> > Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
>> 
>> Applied, thanks
>> 
>> I changed your author email (From:) to match the Signed-off-by one.
>> Please configure your git to use the Tencent email if possible.
>> Note you can have a "git From" address and use another one for sending.
>
>One more tip about patch formatting:
>
>I reworded the title to:
>	memzone: fix unlock on initialization failure
>
>The prefix "memzone" gives the scope of the change.
>We decided that memzone is important enough to have its own scope prefix.
>You can find other prefixes in the git history.
>
>Then the rest of the title is written in plain english,
>detailing more the scope with "on initialization failure".
>
>Hope it helps, and welcome :)

Thanks your enhancement, I think it's better.

Best Regards
Feng

>
>
Thomas Monjalon Dec. 20, 2018, 1:40 p.m. UTC | #6
20/12/2018 12:44, Gao Feng:
> At 2018-12-20 19:20:53, "Thomas Monjalon" <thomas@monjalon.net> wrote:
> >07/12/2018 09:57, Burakov, Anatoly:
> >> On 07-Dec-18 1:20 AM, Gao Feng wrote:
> >> > The RTE_PROC_PRIMARY error handler lost the unlock statement in the
> >> > current codes. Now unlock and return in one place to fix it.
> >> > 
> >> > Fixes: 49df3db84883 ("memzone: replace memzone array with fbarray")
> >> > Cc: stable@dpdk.org
> >> > 
> >> > Signed-off-by: Gao Feng <davidfgao@tencent.com>
> >> > ---
> >> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
> >
> >Applied, thanks
> >
> >I changed your author email (From:) to match the Signed-off-by one.
> >Please configure your git to use the Tencent email if possible.
> >Note you can have a "git From" address and use another one for sending.
> 
> Thanks,there is one reason.
> Because the tencent mailbox is exchange, so I couldn't use git sendmail with tencent email.
> 
> Maybe I could add two signed-off to avoid it.

No, you can use your Tencent email in git,
and send with another email.
In such case, git will add "From: Gao Feng <davidfgao@tencent.com>"
at the head of the patch when sending, so it will be fine when applying.
diff mbox series

Patch

diff --git a/lib/librte_eal/common/eal_common_memzone.c b/lib/librte_eal/common/eal_common_memzone.c
index b7081af..664df5b 100644
--- a/lib/librte_eal/common/eal_common_memzone.c
+++ b/lib/librte_eal/common/eal_common_memzone.c
@@ -365,6 +365,7 @@  int
 rte_eal_memzone_init(void)
 {
 	struct rte_mem_config *mcfg;
+	int ret = 0;
 
 	/* get pointer to global configuration */
 	mcfg = rte_eal_get_configuration()->mem_config;
@@ -375,17 +376,16 @@  rte_eal_memzone_init(void)
 			rte_fbarray_init(&mcfg->memzones, "memzone",
 			RTE_MAX_MEMZONE, sizeof(struct rte_memzone))) {
 		RTE_LOG(ERR, EAL, "Cannot allocate memzone list\n");
-		return -1;
+		ret = -1;
 	} else if (rte_eal_process_type() == RTE_PROC_SECONDARY &&
 			rte_fbarray_attach(&mcfg->memzones)) {
 		RTE_LOG(ERR, EAL, "Cannot attach to memzone list\n");
-		rte_rwlock_write_unlock(&mcfg->mlock);
-		return -1;
+		ret = -1;
 	}
 
 	rte_rwlock_write_unlock(&mcfg->mlock);
 
-	return 0;
+	return ret;
 }
 
 /* Walk all reserved memory zones */