linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Suppress "Device <device name> does not have a release() function" warning
@ 2012-10-11  5:19 Yasuaki Ishimatsu
  2012-10-11  5:22 ` [PATCH 1/2]suppress "Device memoryX " Yasuaki Ishimatsu
  2012-10-11  5:26 ` [PATCH 2/2]suppress "Device nodeX " Yasuaki Ishimatsu
  0 siblings, 2 replies; 11+ messages in thread
From: Yasuaki Ishimatsu @ 2012-10-11  5:19 UTC (permalink / raw)
  To: linux-mm, linux-kernel
  Cc: rientjes, liuj97, minchan.kim, akpm, kosaki.motohiro,
	isimatu.yasuaki, wency

This patch-set is patches to which [1] and [2] are updated
  [1] memory-hotplug: add memory_block_release
  [2] memory-hotplug: add node_device_release
from following patch-set.

https://lkml.org/lkml/2012/9/27/39

So the patch-set version is v2.

v1 -> v2
[PATCH 1/2]
- change subject to Suppress "Device memoryX does not have a release()
  function" warning.
- Add detail information into description
- change function name from release_memory_block() to memory_block_release(),
  because other device release() function is named to <device_name>_release()
[PATCH 2/2]
- change subject to Suppress "Device nodeX does not have a release() function"
  warning.
- Add detail information into description
- Remove memset() to initialize a node struct from node_device_release()
- Add memset() to initialize a node struct into register_node()



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

* [PATCH 1/2]suppress "Device memoryX does not have a release() function" warning
  2012-10-11  5:19 [PATCH v2 0/2] Suppress "Device <device name> does not have a release() function" warning Yasuaki Ishimatsu
@ 2012-10-11  5:22 ` Yasuaki Ishimatsu
  2012-10-11 20:23   ` David Rientjes
  2012-10-11 22:30   ` KOSAKI Motohiro
  2012-10-11  5:26 ` [PATCH 2/2]suppress "Device nodeX " Yasuaki Ishimatsu
  1 sibling, 2 replies; 11+ messages in thread
From: Yasuaki Ishimatsu @ 2012-10-11  5:22 UTC (permalink / raw)
  To: linux-mm, linux-kernel
  Cc: Yasuaki Ishimatsu, rientjes, liuj97, minchan.kim, akpm,
	kosaki.motohiro, wency

When calling remove_memory_block(), the function shows following message at
device_release().

"Device 'memory528' does not have a release() function, it is broken and must
be fixed."

The reason is memory_block's device struct does not have a release() function.

So the patch registers memory_block_release() to the device's release() function
for suppressing the warning message. Additionally, the patch moves kfree(mem)
into the release function since the release function is prepared as a means
to free a memory_block struct.

CC: David Rientjes <rientjes@google.com>
CC: Jiang Liu <liuj97@gmail.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
CC: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
---
 drivers/base/memory.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Index: linux-3.6/drivers/base/memory.c
===================================================================
--- linux-3.6.orig/drivers/base/memory.c	2012-10-11 11:37:33.404668048 +0900
+++ linux-3.6/drivers/base/memory.c	2012-10-11 11:38:27.865672989 +0900
@@ -70,6 +70,13 @@ void unregister_memory_isolate_notifier(
 }
 EXPORT_SYMBOL(unregister_memory_isolate_notifier);
 
+static void memory_block_release(struct device *dev)
+{
+	struct memory_block *mem = container_of(dev, struct memory_block, dev);
+
+	kfree(mem);
+}
+
 /*
  * register_memory - Setup a sysfs device for a memory block
  */
@@ -80,6 +87,7 @@ int register_memory(struct memory_block 
 
 	memory->dev.bus = &memory_subsys;
 	memory->dev.id = memory->start_section_nr / sections_per_block;
+	memory->dev.release = memory_block_release;
 
 	error = device_register(&memory->dev);
 	return error;
@@ -630,7 +638,6 @@ int remove_memory_block(unsigned long no
 		mem_remove_simple_file(mem, phys_device);
 		mem_remove_simple_file(mem, removable);
 		unregister_memory(mem);
-		kfree(mem);
 	} else
 		kobject_put(&mem->dev.kobj);
 


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

* [PATCH 2/2]suppress "Device nodeX does not have a release() function" warning
  2012-10-11  5:19 [PATCH v2 0/2] Suppress "Device <device name> does not have a release() function" warning Yasuaki Ishimatsu
  2012-10-11  5:22 ` [PATCH 1/2]suppress "Device memoryX " Yasuaki Ishimatsu
@ 2012-10-11  5:26 ` Yasuaki Ishimatsu
  2012-10-11 20:31   ` David Rientjes
  2012-10-11 22:33   ` KOSAKI Motohiro
  1 sibling, 2 replies; 11+ messages in thread
From: Yasuaki Ishimatsu @ 2012-10-11  5:26 UTC (permalink / raw)
  To: linux-mm, linux-kernel
  Cc: Yasuaki Ishimatsu, rientjes, liuj97, minchan.kim, akpm,
	kosaki.motohiro, wency

When calling unregister_node(), the function shows following message at
device_release().

"Device 'node2' does not have a release() function, it is broken and must
be fixed."

The reason is node's device struct does not have a release() function.

So the patch registers node_device_release() to the device's release()
function for suppressing the warning message. Additionally, the patch adds
memset() to initialize a node struct into register_node(). Because the node
struct is part of node_devices[] array and it cannot be freed by
node_device_release(). So if system reuses the node struct, it has a garbage.

CC: David Rientjes <rientjes@google.com>
CC: Jiang Liu <liuj97@gmail.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
---
 drivers/base/node.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

Index: linux-3.6/drivers/base/node.c
===================================================================
--- linux-3.6.orig/drivers/base/node.c	2012-10-11 10:04:02.149758748 +0900
+++ linux-3.6/drivers/base/node.c	2012-10-11 10:20:34.111806931 +0900
@@ -252,6 +252,14 @@ static inline void hugetlb_register_node
 static inline void hugetlb_unregister_node(struct node *node) {}
 #endif
 
+static void node_device_release(struct device *dev)
+{
+#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS)
+	struct node *node_dev = to_node(dev);
+
+	flush_work(&node_dev->node_work);
+#endif
+}
 
 /*
  * register_node - Setup a sysfs device for a node.
@@ -263,8 +271,11 @@ int register_node(struct node *node, int
 {
 	int error;
 
+	memset(node, 0, sizeof(*node));
+
 	node->dev.id = num;
 	node->dev.bus = &node_subsys;
+	node->dev.release = node_device_release;
 	error = device_register(&node->dev);
 
 	if (!error){


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

* Re: [PATCH 1/2]suppress "Device memoryX does not have a release() function" warning
  2012-10-11  5:22 ` [PATCH 1/2]suppress "Device memoryX " Yasuaki Ishimatsu
@ 2012-10-11 20:23   ` David Rientjes
  2012-10-11 22:30   ` KOSAKI Motohiro
  1 sibling, 0 replies; 11+ messages in thread
From: David Rientjes @ 2012-10-11 20:23 UTC (permalink / raw)
  To: Yasuaki Ishimatsu
  Cc: linux-mm, linux-kernel, liuj97, minchan.kim, akpm,
	kosaki.motohiro, wency

On Thu, 11 Oct 2012, Yasuaki Ishimatsu wrote:

> When calling remove_memory_block(), the function shows following message at
> device_release().
> 
> "Device 'memory528' does not have a release() function, it is broken and must
> be fixed."
> 
> The reason is memory_block's device struct does not have a release() function.
> 
> So the patch registers memory_block_release() to the device's release() function
> for suppressing the warning message. Additionally, the patch moves kfree(mem)
> into the release function since the release function is prepared as a means
> to free a memory_block struct.
> 
> CC: David Rientjes <rientjes@google.com>
> CC: Jiang Liu <liuj97@gmail.com>
> Cc: Minchan Kim <minchan.kim@gmail.com>
> CC: Andrew Morton <akpm@linux-foundation.org>
> CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> CC: Wen Congyang <wency@cn.fujitsu.com>
> Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>

Acked-by: David Rientjes <rientjes@google.com>

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

* Re: [PATCH 2/2]suppress "Device nodeX does not have a release() function" warning
  2012-10-11  5:26 ` [PATCH 2/2]suppress "Device nodeX " Yasuaki Ishimatsu
@ 2012-10-11 20:31   ` David Rientjes
  2012-10-12  0:13     ` Yasuaki Ishimatsu
  2012-10-11 22:33   ` KOSAKI Motohiro
  1 sibling, 1 reply; 11+ messages in thread
From: David Rientjes @ 2012-10-11 20:31 UTC (permalink / raw)
  To: Yasuaki Ishimatsu
  Cc: linux-mm, linux-kernel, liuj97, minchan.kim, akpm,
	kosaki.motohiro, wency

On Thu, 11 Oct 2012, Yasuaki Ishimatsu wrote:

> When calling unregister_node(), the function shows following message at
> device_release().
> 
> "Device 'node2' does not have a release() function, it is broken and must
> be fixed."
> 
> The reason is node's device struct does not have a release() function.
> 
> So the patch registers node_device_release() to the device's release()
> function for suppressing the warning message. Additionally, the patch adds
> memset() to initialize a node struct into register_node(). Because the node
> struct is part of node_devices[] array and it cannot be freed by
> node_device_release(). So if system reuses the node struct, it has a garbage.
> 

Nice catch on reuse of the statically allocated node_devices[] for node 
hotplug.

> CC: David Rientjes <rientjes@google.com>
> CC: Jiang Liu <liuj97@gmail.com>
> Cc: Minchan Kim <minchan.kim@gmail.com>
> CC: Andrew Morton <akpm@linux-foundation.org>
> CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
> Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>

Can register_node() be made static in drivers/base/node.c and its 
declaration removed from linux/node.h?

Acked-by: David Rientjes <rientjes@google.com>

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

* Re: [PATCH 1/2]suppress "Device memoryX does not have a release() function" warning
  2012-10-11  5:22 ` [PATCH 1/2]suppress "Device memoryX " Yasuaki Ishimatsu
  2012-10-11 20:23   ` David Rientjes
@ 2012-10-11 22:30   ` KOSAKI Motohiro
  1 sibling, 0 replies; 11+ messages in thread
From: KOSAKI Motohiro @ 2012-10-11 22:30 UTC (permalink / raw)
  To: Yasuaki Ishimatsu
  Cc: linux-mm, linux-kernel, rientjes, liuj97, minchan.kim, akpm, wency

On Thu, Oct 11, 2012 at 1:22 AM, Yasuaki Ishimatsu
<isimatu.yasuaki@jp.fujitsu.com> wrote:
> When calling remove_memory_block(), the function shows following message at
> device_release().
>
> "Device 'memory528' does not have a release() function, it is broken and must
> be fixed."
>
> The reason is memory_block's device struct does not have a release() function.
>
> So the patch registers memory_block_release() to the device's release() function
> for suppressing the warning message. Additionally, the patch moves kfree(mem)
> into the release function since the release function is prepared as a means
> to free a memory_block struct.
>
> CC: David Rientjes <rientjes@google.com>
> CC: Jiang Liu <liuj97@gmail.com>
> Cc: Minchan Kim <minchan.kim@gmail.com>
> CC: Andrew Morton <akpm@linux-foundation.org>
> CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> CC: Wen Congyang <wency@cn.fujitsu.com>
> Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>

Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>

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

* Re: [PATCH 2/2]suppress "Device nodeX does not have a release() function" warning
  2012-10-11  5:26 ` [PATCH 2/2]suppress "Device nodeX " Yasuaki Ishimatsu
  2012-10-11 20:31   ` David Rientjes
@ 2012-10-11 22:33   ` KOSAKI Motohiro
  2012-10-17  6:24     ` Wen Congyang
  1 sibling, 1 reply; 11+ messages in thread
From: KOSAKI Motohiro @ 2012-10-11 22:33 UTC (permalink / raw)
  To: Yasuaki Ishimatsu
  Cc: linux-mm, linux-kernel, rientjes, liuj97, minchan.kim, akpm, wency

On Thu, Oct 11, 2012 at 1:26 AM, Yasuaki Ishimatsu
<isimatu.yasuaki@jp.fujitsu.com> wrote:
> When calling unregister_node(), the function shows following message at
> device_release().
>
> "Device 'node2' does not have a release() function, it is broken and must
> be fixed."
>
> The reason is node's device struct does not have a release() function.
>
> So the patch registers node_device_release() to the device's release()
> function for suppressing the warning message. Additionally, the patch adds
> memset() to initialize a node struct into register_node(). Because the node
> struct is part of node_devices[] array and it cannot be freed by
> node_device_release(). So if system reuses the node struct, it has a garbage.
>
> CC: David Rientjes <rientjes@google.com>
> CC: Jiang Liu <liuj97@gmail.com>
> Cc: Minchan Kim <minchan.kim@gmail.com>
> CC: Andrew Morton <akpm@linux-foundation.org>
> CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
> Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
> ---
>  drivers/base/node.c |   11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> Index: linux-3.6/drivers/base/node.c
> ===================================================================
> --- linux-3.6.orig/drivers/base/node.c  2012-10-11 10:04:02.149758748 +0900
> +++ linux-3.6/drivers/base/node.c       2012-10-11 10:20:34.111806931 +0900
> @@ -252,6 +252,14 @@ static inline void hugetlb_register_node
>  static inline void hugetlb_unregister_node(struct node *node) {}
>  #endif
>
> +static void node_device_release(struct device *dev)
> +{
> +#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS)
> +       struct node *node_dev = to_node(dev);
> +
> +       flush_work(&node_dev->node_work);
> +#endif
> +}

The patch description don't explain why this flush_work() is needed.


>  /*
>   * register_node - Setup a sysfs device for a node.
> @@ -263,8 +271,11 @@ int register_node(struct node *node, int
>  {
>         int error;
>
> +       memset(node, 0, sizeof(*node));
> +

You should add a comment why we need initialize a node here. A lot
of developers don't have hotplug knowledge.

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

* Re: [PATCH 2/2]suppress "Device nodeX does not have a release() function" warning
  2012-10-11 20:31   ` David Rientjes
@ 2012-10-12  0:13     ` Yasuaki Ishimatsu
  0 siblings, 0 replies; 11+ messages in thread
From: Yasuaki Ishimatsu @ 2012-10-12  0:13 UTC (permalink / raw)
  To: David Rientjes
  Cc: linux-mm, linux-kernel, liuj97, minchan.kim, akpm,
	kosaki.motohiro, wency

2012/10/12 5:31, David Rientjes wrote:
> On Thu, 11 Oct 2012, Yasuaki Ishimatsu wrote:
>
>> When calling unregister_node(), the function shows following message at
>> device_release().
>>
>> "Device 'node2' does not have a release() function, it is broken and must
>> be fixed."
>>
>> The reason is node's device struct does not have a release() function.
>>
>> So the patch registers node_device_release() to the device's release()
>> function for suppressing the warning message. Additionally, the patch adds
>> memset() to initialize a node struct into register_node(). Because the node
>> struct is part of node_devices[] array and it cannot be freed by
>> node_device_release(). So if system reuses the node struct, it has a garbage.
>>
>
> Nice catch on reuse of the statically allocated node_devices[] for node
> hotplug.
>
>> CC: David Rientjes <rientjes@google.com>
>> CC: Jiang Liu <liuj97@gmail.com>
>> Cc: Minchan Kim <minchan.kim@gmail.com>
>> CC: Andrew Morton <akpm@linux-foundation.org>
>> CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
>> Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
>> Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
>
> Can register_node() be made static in drivers/base/node.c and its
> declaration removed from linux/node.h?

Yah. I'll fix it.

Thanks,
Yasuaki Ishimatsu

>
> Acked-by: David Rientjes <rientjes@google.com>
>



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

* Re: [PATCH 2/2]suppress "Device nodeX does not have a release() function" warning
  2012-10-11 22:33   ` KOSAKI Motohiro
@ 2012-10-17  6:24     ` Wen Congyang
  2012-10-17  8:50       ` KOSAKI Motohiro
  0 siblings, 1 reply; 11+ messages in thread
From: Wen Congyang @ 2012-10-17  6:24 UTC (permalink / raw)
  To: KOSAKI Motohiro
  Cc: Yasuaki Ishimatsu, linux-mm, linux-kernel, rientjes, liuj97,
	minchan.kim, akpm

At 10/12/2012 06:33 AM, KOSAKI Motohiro Wrote:
> On Thu, Oct 11, 2012 at 1:26 AM, Yasuaki Ishimatsu
> <isimatu.yasuaki@jp.fujitsu.com> wrote:
>> When calling unregister_node(), the function shows following message at
>> device_release().
>>
>> "Device 'node2' does not have a release() function, it is broken and must
>> be fixed."
>>
>> The reason is node's device struct does not have a release() function.
>>
>> So the patch registers node_device_release() to the device's release()
>> function for suppressing the warning message. Additionally, the patch adds
>> memset() to initialize a node struct into register_node(). Because the node
>> struct is part of node_devices[] array and it cannot be freed by
>> node_device_release(). So if system reuses the node struct, it has a garbage.
>>
>> CC: David Rientjes <rientjes@google.com>
>> CC: Jiang Liu <liuj97@gmail.com>
>> Cc: Minchan Kim <minchan.kim@gmail.com>
>> CC: Andrew Morton <akpm@linux-foundation.org>
>> CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
>> Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
>> Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
>> ---
>>  drivers/base/node.c |   11 +++++++++++
>>  1 file changed, 11 insertions(+)
>>
>> Index: linux-3.6/drivers/base/node.c
>> ===================================================================
>> --- linux-3.6.orig/drivers/base/node.c  2012-10-11 10:04:02.149758748 +0900
>> +++ linux-3.6/drivers/base/node.c       2012-10-11 10:20:34.111806931 +0900
>> @@ -252,6 +252,14 @@ static inline void hugetlb_register_node
>>  static inline void hugetlb_unregister_node(struct node *node) {}
>>  #endif
>>
>> +static void node_device_release(struct device *dev)
>> +{
>> +#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS)
>> +       struct node *node_dev = to_node(dev);
>> +
>> +       flush_work(&node_dev->node_work);
>> +#endif
>> +}
> 
> The patch description don't explain why this flush_work() is needed.

If the node is onlined after it is offlined, we will clear the memory,
so we should flush_work() before node_dev is set to 0.

Thanks
Wen Congyang

> 
> 
>>  /*
>>   * register_node - Setup a sysfs device for a node.
>> @@ -263,8 +271,11 @@ int register_node(struct node *node, int
>>  {
>>         int error;
>>
>> +       memset(node, 0, sizeof(*node));
>> +
> 
> You should add a comment why we need initialize a node here. A lot
> of developers don't have hotplug knowledge.
> 


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

* Re: [PATCH 2/2]suppress "Device nodeX does not have a release() function" warning
  2012-10-17  6:24     ` Wen Congyang
@ 2012-10-17  8:50       ` KOSAKI Motohiro
  2012-10-19  5:42         ` Wen Congyang
  0 siblings, 1 reply; 11+ messages in thread
From: KOSAKI Motohiro @ 2012-10-17  8:50 UTC (permalink / raw)
  To: Wen Congyang
  Cc: Yasuaki Ishimatsu, linux-mm, linux-kernel, rientjes, liuj97,
	minchan.kim, akpm

On Wed, Oct 17, 2012 at 2:24 AM, Wen Congyang <wency@cn.fujitsu.com> wrote:
> At 10/12/2012 06:33 AM, KOSAKI Motohiro Wrote:
>> On Thu, Oct 11, 2012 at 1:26 AM, Yasuaki Ishimatsu
>> <isimatu.yasuaki@jp.fujitsu.com> wrote:
>>> When calling unregister_node(), the function shows following message at
>>> device_release().
>>>
>>> "Device 'node2' does not have a release() function, it is broken and must
>>> be fixed."
>>>
>>> The reason is node's device struct does not have a release() function.
>>>
>>> So the patch registers node_device_release() to the device's release()
>>> function for suppressing the warning message. Additionally, the patch adds
>>> memset() to initialize a node struct into register_node(). Because the node
>>> struct is part of node_devices[] array and it cannot be freed by
>>> node_device_release(). So if system reuses the node struct, it has a garbage.
>>>
>>> CC: David Rientjes <rientjes@google.com>
>>> CC: Jiang Liu <liuj97@gmail.com>
>>> Cc: Minchan Kim <minchan.kim@gmail.com>
>>> CC: Andrew Morton <akpm@linux-foundation.org>
>>> CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
>>> Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
>>> Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
>>> ---
>>>  drivers/base/node.c |   11 +++++++++++
>>>  1 file changed, 11 insertions(+)
>>>
>>> Index: linux-3.6/drivers/base/node.c
>>> ===================================================================
>>> --- linux-3.6.orig/drivers/base/node.c  2012-10-11 10:04:02.149758748 +0900
>>> +++ linux-3.6/drivers/base/node.c       2012-10-11 10:20:34.111806931 +0900
>>> @@ -252,6 +252,14 @@ static inline void hugetlb_register_node
>>>  static inline void hugetlb_unregister_node(struct node *node) {}
>>>  #endif
>>>
>>> +static void node_device_release(struct device *dev)
>>> +{
>>> +#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS)
>>> +       struct node *node_dev = to_node(dev);
>>> +
>>> +       flush_work(&node_dev->node_work);
>>> +#endif
>>> +}
>>
>> The patch description don't explain why this flush_work() is needed.
>
> If the node is onlined after it is offlined, we will clear the memory,
> so we should flush_work() before node_dev is set to 0.

So then, it is irrelevant from warning supressness. You should make an
another patch.

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

* Re: [PATCH 2/2]suppress "Device nodeX does not have a release() function" warning
  2012-10-17  8:50       ` KOSAKI Motohiro
@ 2012-10-19  5:42         ` Wen Congyang
  0 siblings, 0 replies; 11+ messages in thread
From: Wen Congyang @ 2012-10-19  5:42 UTC (permalink / raw)
  To: KOSAKI Motohiro
  Cc: Yasuaki Ishimatsu, linux-mm, linux-kernel, rientjes, liuj97,
	minchan.kim, akpm

At 10/17/2012 04:50 PM, KOSAKI Motohiro Wrote:
> On Wed, Oct 17, 2012 at 2:24 AM, Wen Congyang <wency@cn.fujitsu.com> wrote:
>> At 10/12/2012 06:33 AM, KOSAKI Motohiro Wrote:
>>> On Thu, Oct 11, 2012 at 1:26 AM, Yasuaki Ishimatsu
>>> <isimatu.yasuaki@jp.fujitsu.com> wrote:
>>>> When calling unregister_node(), the function shows following message at
>>>> device_release().
>>>>
>>>> "Device 'node2' does not have a release() function, it is broken and must
>>>> be fixed."
>>>>
>>>> The reason is node's device struct does not have a release() function.
>>>>
>>>> So the patch registers node_device_release() to the device's release()
>>>> function for suppressing the warning message. Additionally, the patch adds
>>>> memset() to initialize a node struct into register_node(). Because the node
>>>> struct is part of node_devices[] array and it cannot be freed by
>>>> node_device_release(). So if system reuses the node struct, it has a garbage.
>>>>
>>>> CC: David Rientjes <rientjes@google.com>
>>>> CC: Jiang Liu <liuj97@gmail.com>
>>>> Cc: Minchan Kim <minchan.kim@gmail.com>
>>>> CC: Andrew Morton <akpm@linux-foundation.org>
>>>> CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
>>>> Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
>>>> Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
>>>> ---
>>>>  drivers/base/node.c |   11 +++++++++++
>>>>  1 file changed, 11 insertions(+)
>>>>
>>>> Index: linux-3.6/drivers/base/node.c
>>>> ===================================================================
>>>> --- linux-3.6.orig/drivers/base/node.c  2012-10-11 10:04:02.149758748 +0900
>>>> +++ linux-3.6/drivers/base/node.c       2012-10-11 10:20:34.111806931 +0900
>>>> @@ -252,6 +252,14 @@ static inline void hugetlb_register_node
>>>>  static inline void hugetlb_unregister_node(struct node *node) {}
>>>>  #endif
>>>>
>>>> +static void node_device_release(struct device *dev)
>>>> +{
>>>> +#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS)
>>>> +       struct node *node_dev = to_node(dev);
>>>> +
>>>> +       flush_work(&node_dev->node_work);
>>>> +#endif
>>>> +}
>>>
>>> The patch description don't explain why this flush_work() is needed.
>>
>> If the node is onlined after it is offlined, we will clear the memory,
>> so we should flush_work() before node_dev is set to 0.
> 
> So then, it is irrelevant from warning supressness. You should make an
> another patch.
> 

OK, I will update it soon.

Thanks
Wen Congyang


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

end of thread, other threads:[~2012-10-19  5:36 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-11  5:19 [PATCH v2 0/2] Suppress "Device <device name> does not have a release() function" warning Yasuaki Ishimatsu
2012-10-11  5:22 ` [PATCH 1/2]suppress "Device memoryX " Yasuaki Ishimatsu
2012-10-11 20:23   ` David Rientjes
2012-10-11 22:30   ` KOSAKI Motohiro
2012-10-11  5:26 ` [PATCH 2/2]suppress "Device nodeX " Yasuaki Ishimatsu
2012-10-11 20:31   ` David Rientjes
2012-10-12  0:13     ` Yasuaki Ishimatsu
2012-10-11 22:33   ` KOSAKI Motohiro
2012-10-17  6:24     ` Wen Congyang
2012-10-17  8:50       ` KOSAKI Motohiro
2012-10-19  5:42         ` Wen Congyang

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).