Re: [Xen-devel] [PATCH] mm: hotplug: Don't release twice the resource on error

2015-10-23 Thread David Vrabel
On 23/10/15 13:57, Julien Grall wrote:
> The function add_memory_resource take in parameter a resource allocated
> by the caller. On error, both add_memory_resource and the caller will
> release the resource via release_memory_source.
[...]
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -1298,7 +1298,6 @@ error:
>   /* rollback pgdat allocation and others */
>   if (new_pgdat)
>   rollback_node_hotadd(nid, pgdat);
> - release_memory_resource(res);
>   memblock_remove(start, size);

I've folded this in, thanks.

David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] mm: hotplug: Don't release twice the resource on error

2015-10-23 Thread Julien Grall
The function add_memory_resource take in parameter a resource allocated
by the caller. On error, both add_memory_resource and the caller will
release the resource via release_memory_source.

This will result to Linux crashing when the caller is trying to release
the resource:

CPU: 1 PID: 45 Comm: xenwatch Not tainted 4.3.0-rc6-00043-g5e1d6ca-dirty #170
Hardware name: XENVM-4.7 (DT)
task: ffc1fb2421c0 ti: ffc1fb27 task.ti:
ffc1fb27
PC is at __release_resource+0x28/0x8c
LR is at __release_resource+0x24/0x8c

[...]

Call trace:
[] __release_resource+0x28/0x8c
[] release_resource+0x24/0x44
[] reserve_additional_memory+0x114/0x128
[] alloc_xenballooned_pages+0x98/0x16c
[] blkfront_gather_backend_features+0x14c/0xd68
[] blkback_changed+0x678/0x150c
[] xenbus_otherend_changed+0x9c/0xa4
[] backend_changed+0xc/0x18
[] xenwatch_thread+0xa0/0x13c
[] kthread+0xdc/0xf4

As the caller is allocating the resource, let him handle the release.
This has been introduced by commit b75351f "mm: memory hotplug with
an existing resource".

Signed-off-by: Julien Grall 

---
Cc: David Vrabel 
Cc: linux...@kvack.org

The patch who introduced this issue is in xentip/for-linus-4.4. So
this patch is a good candidate for Linus 4.4.
---
 mm/memory_hotplug.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 5f394e7..0780d11 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1298,7 +1298,6 @@ error:
/* rollback pgdat allocation and others */
if (new_pgdat)
rollback_node_hotadd(nid, pgdat);
-   release_memory_resource(res);
memblock_remove(start, size);
 
 out:
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Xen-devel] [PATCH] mm: hotplug: Don't release twice the resource on error

2015-10-23 Thread David Vrabel
On 23/10/15 13:57, Julien Grall wrote:
> The function add_memory_resource take in parameter a resource allocated
> by the caller. On error, both add_memory_resource and the caller will
> release the resource via release_memory_source.
[...]
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -1298,7 +1298,6 @@ error:
>   /* rollback pgdat allocation and others */
>   if (new_pgdat)
>   rollback_node_hotadd(nid, pgdat);
> - release_memory_resource(res);
>   memblock_remove(start, size);

I've folded this in, thanks.

David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] mm: hotplug: Don't release twice the resource on error

2015-10-23 Thread Julien Grall
The function add_memory_resource take in parameter a resource allocated
by the caller. On error, both add_memory_resource and the caller will
release the resource via release_memory_source.

This will result to Linux crashing when the caller is trying to release
the resource:

CPU: 1 PID: 45 Comm: xenwatch Not tainted 4.3.0-rc6-00043-g5e1d6ca-dirty #170
Hardware name: XENVM-4.7 (DT)
task: ffc1fb2421c0 ti: ffc1fb27 task.ti:
ffc1fb27
PC is at __release_resource+0x28/0x8c
LR is at __release_resource+0x24/0x8c

[...]

Call trace:
[] __release_resource+0x28/0x8c
[] release_resource+0x24/0x44
[] reserve_additional_memory+0x114/0x128
[] alloc_xenballooned_pages+0x98/0x16c
[] blkfront_gather_backend_features+0x14c/0xd68
[] blkback_changed+0x678/0x150c
[] xenbus_otherend_changed+0x9c/0xa4
[] backend_changed+0xc/0x18
[] xenwatch_thread+0xa0/0x13c
[] kthread+0xdc/0xf4

As the caller is allocating the resource, let him handle the release.
This has been introduced by commit b75351f "mm: memory hotplug with
an existing resource".

Signed-off-by: Julien Grall 

---
Cc: David Vrabel 
Cc: linux...@kvack.org

The patch who introduced this issue is in xentip/for-linus-4.4. So
this patch is a good candidate for Linus 4.4.
---
 mm/memory_hotplug.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 5f394e7..0780d11 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1298,7 +1298,6 @@ error:
/* rollback pgdat allocation and others */
if (new_pgdat)
rollback_node_hotadd(nid, pgdat);
-   release_memory_resource(res);
memblock_remove(start, size);
 
 out:
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/