DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] mem: fix freeing of memzone used by ivshmem
@ 2016-04-14 13:48 Mauricio Vasquez B
  2016-04-14 14:48 ` Sergio Gonzalez Monroy
  2016-04-15  8:29 ` [dpdk-dev] [PATCH v2] " Mauricio Vasquez B
  0 siblings, 2 replies; 6+ messages in thread
From: Mauricio Vasquez B @ 2016-04-14 13:48 UTC (permalink / raw)
  To: sergio.gonzalez.monroy; +Cc: dev

although previous implementation returned an error when trying to release a
memzone assigned to an ivshmem device, it stills freed it.

Fixes: cd10c42eb5bc ("mem: fix ivshmem freeing")

Signed-off-by: Mauricio Vasquez B <mauricio.vasquezbernal@studenti.polito.it>
---
 lib/librte_eal/common/eal_common_memzone.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/common/eal_common_memzone.c b/lib/librte_eal/common/eal_common_memzone.c
index 711c845..1fce906 100644
--- a/lib/librte_eal/common/eal_common_memzone.c
+++ b/lib/librte_eal/common/eal_common_memzone.c
@@ -321,15 +321,19 @@ rte_memzone_free(const struct rte_memzone *mz)
 	idx = ((uintptr_t)mz - (uintptr_t)mcfg->memzone);
 	idx = idx / sizeof(struct rte_memzone);
 
-	addr = mcfg->memzone[idx].addr;
 #ifdef RTE_LIBRTE_IVSHMEM
 	/*
 	 * If ioremap_addr is set, it's an IVSHMEM memzone and we cannot
 	 * free it.
 	 */
-	if (mcfg->memzone[idx].ioremap_addr != 0)
+	if (mcfg->memzone[idx].ioremap_addr != 0) {
 		ret = -EINVAL;
+		goto error;
+	}
 #endif
+
+	addr = mcfg->memzone[idx].addr;
+
 	if (addr == NULL)
 		ret = -EINVAL;
 	else if (mcfg->memzone_cnt == 0) {
@@ -345,6 +349,10 @@ rte_memzone_free(const struct rte_memzone *mz)
 	rte_free(addr);
 
 	return ret;
+
+error:
+	rte_rwlock_write_unlock(&mcfg->mlock);
+	return ret;
 }
 
 /*
-- 
1.9.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] mem: fix freeing of memzone used by ivshmem
  2016-04-14 13:48 [dpdk-dev] [PATCH] mem: fix freeing of memzone used by ivshmem Mauricio Vasquez B
@ 2016-04-14 14:48 ` Sergio Gonzalez Monroy
  2016-04-15  8:23   ` Mauricio Vásquez
  2016-04-15  8:29 ` [dpdk-dev] [PATCH v2] " Mauricio Vasquez B
  1 sibling, 1 reply; 6+ messages in thread
From: Sergio Gonzalez Monroy @ 2016-04-14 14:48 UTC (permalink / raw)
  To: Mauricio Vasquez B; +Cc: dev

On 14/04/2016 14:48, Mauricio Vasquez B wrote:
> although previous implementation returned an error when trying to release a
> memzone assigned to an ivshmem device, it stills freed it.
>
> Fixes: cd10c42eb5bc ("mem: fix ivshmem freeing")
>
> Signed-off-by: Mauricio Vasquez B <mauricio.vasquezbernal@studenti.polito.it>
> ---
>   lib/librte_eal/common/eal_common_memzone.c | 12 ++++++++++--
>   1 file changed, 10 insertions(+), 2 deletions(-)
>
>

Thanks for the fix (not sure what I was thinking at the time).

Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] mem: fix freeing of memzone used by ivshmem
  2016-04-14 14:48 ` Sergio Gonzalez Monroy
@ 2016-04-15  8:23   ` Mauricio Vásquez
  0 siblings, 0 replies; 6+ messages in thread
From: Mauricio Vásquez @ 2016-04-15  8:23 UTC (permalink / raw)
  To: Sergio Gonzalez Monroy; +Cc: dev

This patch does not compile when ivshmem is disabled:

compile error:
  CC malloc_heap.o

/home/patchWorkOrg/compilation/lib/librte_eal/common/eal_common_memzone.c(353):
error #177: label "error" was declared but never referenced
    error:
  ^

I'll send a v2 solving this issue


On Thu, Apr 14, 2016 at 4:48 PM, Sergio Gonzalez Monroy <
sergio.gonzalez.monroy@intel.com> wrote:

> On 14/04/2016 14:48, Mauricio Vasquez B wrote:
>
>> although previous implementation returned an error when trying to release
>> a
>> memzone assigned to an ivshmem device, it stills freed it.
>>
>> Fixes: cd10c42eb5bc ("mem: fix ivshmem freeing")
>>
>> Signed-off-by: Mauricio Vasquez B <
>> mauricio.vasquezbernal@studenti.polito.it>
>> ---
>>   lib/librte_eal/common/eal_common_memzone.c | 12 ++++++++++--
>>   1 file changed, 10 insertions(+), 2 deletions(-)
>>
>>
>>
> Thanks for the fix (not sure what I was thinking at the time).
>
> Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH v2] mem: fix freeing of memzone used by ivshmem
  2016-04-14 13:48 [dpdk-dev] [PATCH] mem: fix freeing of memzone used by ivshmem Mauricio Vasquez B
  2016-04-14 14:48 ` Sergio Gonzalez Monroy
@ 2016-04-15  8:29 ` Mauricio Vasquez B
  2016-04-21 11:21   ` Sergio Gonzalez Monroy
  1 sibling, 1 reply; 6+ messages in thread
From: Mauricio Vasquez B @ 2016-04-15  8:29 UTC (permalink / raw)
  To: sergio.gonzalez.monroy; +Cc: dev

although previous implementation returned an error when trying to release a
memzone assigned to an ivshmem device, it stills freed it.

Fixes: cd10c42eb5bc ("mem: fix ivshmem freeing")

Signed-off-by: Mauricio Vasquez B <mauricio.vasquezbernal@studenti.polito.it>
---
v2: 
solved compilation problem when ivshmem is disabled
 lib/librte_eal/common/eal_common_memzone.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/librte_eal/common/eal_common_memzone.c b/lib/librte_eal/common/eal_common_memzone.c
index 711c845..a8f804c 100644
--- a/lib/librte_eal/common/eal_common_memzone.c
+++ b/lib/librte_eal/common/eal_common_memzone.c
@@ -321,15 +321,19 @@ rte_memzone_free(const struct rte_memzone *mz)
 	idx = ((uintptr_t)mz - (uintptr_t)mcfg->memzone);
 	idx = idx / sizeof(struct rte_memzone);
 
-	addr = mcfg->memzone[idx].addr;
 #ifdef RTE_LIBRTE_IVSHMEM
 	/*
 	 * If ioremap_addr is set, it's an IVSHMEM memzone and we cannot
 	 * free it.
 	 */
-	if (mcfg->memzone[idx].ioremap_addr != 0)
-		ret = -EINVAL;
+	if (mcfg->memzone[idx].ioremap_addr != 0) {
+		rte_rwlock_write_unlock(&mcfg->mlock);
+		return -EINVAL;
+	}
 #endif
+
+	addr = mcfg->memzone[idx].addr;
+
 	if (addr == NULL)
 		ret = -EINVAL;
 	else if (mcfg->memzone_cnt == 0) {
-- 
1.9.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH v2] mem: fix freeing of memzone used by ivshmem
  2016-04-15  8:29 ` [dpdk-dev] [PATCH v2] " Mauricio Vasquez B
@ 2016-04-21 11:21   ` Sergio Gonzalez Monroy
  2016-04-29 14:34     ` Thomas Monjalon
  0 siblings, 1 reply; 6+ messages in thread
From: Sergio Gonzalez Monroy @ 2016-04-21 11:21 UTC (permalink / raw)
  To: Mauricio Vasquez B; +Cc: dev

On 15/04/2016 09:29, Mauricio Vasquez B wrote:
> although previous implementation returned an error when trying to release a
> memzone assigned to an ivshmem device, it stills freed it.
>
> Fixes: cd10c42eb5bc ("mem: fix ivshmem freeing")
>
> Signed-off-by: Mauricio Vasquez B <mauricio.vasquezbernal@studenti.polito.it>
> ---
> v2:
> solved compilation problem when ivshmem is disabled
>   lib/librte_eal/common/eal_common_memzone.c | 10 +++++++---
>   1 file changed, 7 insertions(+), 3 deletions(-)

This time I have waited to see the test-report (which I should have done 
for the v1).

Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH v2] mem: fix freeing of memzone used by ivshmem
  2016-04-21 11:21   ` Sergio Gonzalez Monroy
@ 2016-04-29 14:34     ` Thomas Monjalon
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2016-04-29 14:34 UTC (permalink / raw)
  To: Mauricio Vasquez B; +Cc: dev, Sergio Gonzalez Monroy

2016-04-21 12:21, Sergio Gonzalez Monroy:
> On 15/04/2016 09:29, Mauricio Vasquez B wrote:
> > although previous implementation returned an error when trying to release a
> > memzone assigned to an ivshmem device, it stills freed it.
> >
> > Fixes: cd10c42eb5bc ("mem: fix ivshmem freeing")
> >
> > Signed-off-by: Mauricio Vasquez B <mauricio.vasquezbernal@studenti.polito.it>
> > ---
> > v2:
> > solved compilation problem when ivshmem is disabled
> >   lib/librte_eal/common/eal_common_memzone.c | 10 +++++++---
> >   1 file changed, 7 insertions(+), 3 deletions(-)
> 
> This time I have waited to see the test-report (which I should have done 
> for the v1).
> 
> Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-04-29 14:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-14 13:48 [dpdk-dev] [PATCH] mem: fix freeing of memzone used by ivshmem Mauricio Vasquez B
2016-04-14 14:48 ` Sergio Gonzalez Monroy
2016-04-15  8:23   ` Mauricio Vásquez
2016-04-15  8:29 ` [dpdk-dev] [PATCH v2] " Mauricio Vasquez B
2016-04-21 11:21   ` Sergio Gonzalez Monroy
2016-04-29 14:34     ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).