* re: acpi_memhotplug.c: don't allow to eject the memory device if it is being used
@ 2012-11-05 18:11 Dan Carpenter
2012-11-06 2:10 ` Wen Congyang
0 siblings, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2012-11-05 18:11 UTC (permalink / raw)
To: wency; +Cc: linux-acpi
Hello Wen Congyang,
The patch 306859f13dc1: "acpi_memhotplug.c: don't allow to eject the
memory device if it is being used" from Nov 3, 2012, leads to the
following Smatch warning:
drivers/acpi/acpi_memhotplug.c:367 acpi_memory_remove_memory()
warn: inconsistent returns mutex:&mem_device->list_lock:
locked (357,361) unlocked (367)
341 static int acpi_memory_remove_memory(struct acpi_memory_device *mem_device)
342 {
343 int result;
344 struct acpi_memory_info *info, *n;
345
346 mutex_lock(&mem_device->list_lock);
347 list_for_each_entry_safe(info, n, &mem_device->res_list, list) {
348 if (info->failed)
349 /* The kernel does not use this memory block */
350 continue;
351
352 if (!info->enabled)
353 /*
354 * The kernel uses this memory block, but it may be not
355 * managed by us.
356 */
357 return -EBUSY;
^^^^^^^^^^^^^
358
359 result = remove_memory(info->start_addr, info->length);
360 if (result)
361 return result;
^^^^^^^^^^^^^^
Unlock before returning?
362 list_del(&info->list);
363 kfree(info);
364 }
365 mutex_unlock(&mem_device->list_lock);
366
367 return 0;
368 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: acpi_memhotplug.c: don't allow to eject the memory device if it is being used
2012-11-05 18:11 acpi_memhotplug.c: don't allow to eject the memory device if it is being used Dan Carpenter
@ 2012-11-06 2:10 ` Wen Congyang
2012-11-06 14:05 ` Dan Carpenter
0 siblings, 1 reply; 7+ messages in thread
From: Wen Congyang @ 2012-11-06 2:10 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-acpi, Rafael J. Wysocki
At 11/06/2012 02:11 AM, Dan Carpenter Wrote:
> Hello Wen Congyang,
>
> The patch 306859f13dc1: "acpi_memhotplug.c: don't allow to eject the
> memory device if it is being used" from Nov 3, 2012, leads to the
> following Smatch warning:
> drivers/acpi/acpi_memhotplug.c:367 acpi_memory_remove_memory()
> warn: inconsistent returns mutex:&mem_device->list_lock:
> locked (357,361) unlocked (367)
Thanks for pointing it out.
The patch 306859f13dc1 is in akpm's tree, and it conflicts with another
patch in linux-pm's tree. So Andrew Morton drops them.
I will resend them based on linux-pm's next tree.
Wen Congyang
>
> 341 static int acpi_memory_remove_memory(struct acpi_memory_device *mem_device)
> 342 {
> 343 int result;
> 344 struct acpi_memory_info *info, *n;
> 345
> 346 mutex_lock(&mem_device->list_lock);
> 347 list_for_each_entry_safe(info, n, &mem_device->res_list, list) {
> 348 if (info->failed)
> 349 /* The kernel does not use this memory block */
> 350 continue;
> 351
> 352 if (!info->enabled)
> 353 /*
> 354 * The kernel uses this memory block, but it may be not
> 355 * managed by us.
> 356 */
> 357 return -EBUSY;
> ^^^^^^^^^^^^^
> 358
> 359 result = remove_memory(info->start_addr, info->length);
> 360 if (result)
> 361 return result;
> ^^^^^^^^^^^^^^
> Unlock before returning?
>
> 362 list_del(&info->list);
> 363 kfree(info);
> 364 }
> 365 mutex_unlock(&mem_device->list_lock);
> 366
> 367 return 0;
> 368 }
>
>
>
>
> regards,
> dan carpenter
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: acpi_memhotplug.c: don't allow to eject the memory device if it is being used
2012-11-06 2:10 ` Wen Congyang
@ 2012-11-06 14:05 ` Dan Carpenter
2012-11-07 1:39 ` Wen Congyang
2012-11-08 9:33 ` Wen Congyang
0 siblings, 2 replies; 7+ messages in thread
From: Dan Carpenter @ 2012-11-06 14:05 UTC (permalink / raw)
To: Wen Congyang; +Cc: linux-acpi, Rafael J. Wysocki, Andrew Morton
On Tue, Nov 06, 2012 at 10:10:11AM +0800, Wen Congyang wrote:
> At 11/06/2012 02:11 AM, Dan Carpenter Wrote:
> > Hello Wen Congyang,
> >
> > The patch 306859f13dc1: "acpi_memhotplug.c: don't allow to eject the
> > memory device if it is being used" from Nov 3, 2012, leads to the
> > following Smatch warning:
> > drivers/acpi/acpi_memhotplug.c:367 acpi_memory_remove_memory()
> > warn: inconsistent returns mutex:&mem_device->list_lock:
> > locked (357,361) unlocked (367)
>
> Thanks for pointing it out.
>
> The patch 306859f13dc1 is in akpm's tree, and it conflicts with another
> patch in linux-pm's tree. So Andrew Morton drops them.
>
> I will resend them based on linux-pm's next tree.
Ok. Today's linux-next version 85fcb3758c10e "ACPI / memory-hotplug:
introduce a mutex lock to protect the list in acpi_memory_device"
has a similar problem and should be fixed as well.
319 static int acpi_memory_remove_memory(struct acpi_memory_device *mem_device)
320 {
321 int result;
322 struct acpi_memory_info *info, *n;
323
324 mutex_lock(&mem_device->list_lock);
325 list_for_each_entry_safe(info, n, &mem_device->res_list, list) {
326 if (info->enabled) {
327 result = remove_memory(info->start_addr, info->length);
328 if (result)
329 return result;
^^^^^^^^^^^^^
We are still holding the lock here.
330 }
331
332 list_del(&info->list);
333 kfree(info);
334 }
335 mutex_unlock(&mem_device->list_lock);
336
337 return 0;
338 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: acpi_memhotplug.c: don't allow to eject the memory device if it is being used
2012-11-06 14:05 ` Dan Carpenter
@ 2012-11-07 1:39 ` Wen Congyang
2012-11-08 9:33 ` Wen Congyang
1 sibling, 0 replies; 7+ messages in thread
From: Wen Congyang @ 2012-11-07 1:39 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-acpi, Rafael J. Wysocki, Andrew Morton
At 11/06/2012 10:05 PM, Dan Carpenter Wrote:
> On Tue, Nov 06, 2012 at 10:10:11AM +0800, Wen Congyang wrote:
>> At 11/06/2012 02:11 AM, Dan Carpenter Wrote:
>>> Hello Wen Congyang,
>>>
>>> The patch 306859f13dc1: "acpi_memhotplug.c: don't allow to eject the
>>> memory device if it is being used" from Nov 3, 2012, leads to the
>>> following Smatch warning:
>>> drivers/acpi/acpi_memhotplug.c:367 acpi_memory_remove_memory()
>>> warn: inconsistent returns mutex:&mem_device->list_lock:
>>> locked (357,361) unlocked (367)
>>
>> Thanks for pointing it out.
>>
>> The patch 306859f13dc1 is in akpm's tree, and it conflicts with another
>> patch in linux-pm's tree. So Andrew Morton drops them.
>>
>> I will resend them based on linux-pm's next tree.
>
> Ok. Today's linux-next version 85fcb3758c10e "ACPI / memory-hotplug:
> introduce a mutex lock to protect the list in acpi_memory_device"
> has a similar problem and should be fixed as well.
>
> 319 static int acpi_memory_remove_memory(struct acpi_memory_device *mem_device)
> 320 {
> 321 int result;
> 322 struct acpi_memory_info *info, *n;
> 323
> 324 mutex_lock(&mem_device->list_lock);
> 325 list_for_each_entry_safe(info, n, &mem_device->res_list, list) {
> 326 if (info->enabled) {
> 327 result = remove_memory(info->start_addr, info->length);
> 328 if (result)
> 329 return result;
> ^^^^^^^^^^^^^
> We are still holding the lock here.
Yes, I found this problem.
Thanks
Wen Congyang
>
> 330 }
> 331
> 332 list_del(&info->list);
> 333 kfree(info);
> 334 }
> 335 mutex_unlock(&mem_device->list_lock);
> 336
> 337 return 0;
> 338 }
>
> regards,
> dan carpenter
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: acpi_memhotplug.c: don't allow to eject the memory device if it is being used
2012-11-06 14:05 ` Dan Carpenter
2012-11-07 1:39 ` Wen Congyang
@ 2012-11-08 9:33 ` Wen Congyang
2012-11-08 9:58 ` Rafael J. Wysocki
1 sibling, 1 reply; 7+ messages in thread
From: Wen Congyang @ 2012-11-08 9:33 UTC (permalink / raw)
To: Dan Carpenter, Rafael J. Wysocki; +Cc: linux-acpi, Andrew Morton
Hi, Rafael J. Wysocki
At 11/06/2012 10:05 PM, Dan Carpenter Wrote:
> On Tue, Nov 06, 2012 at 10:10:11AM +0800, Wen Congyang wrote:
>> At 11/06/2012 02:11 AM, Dan Carpenter Wrote:
>>> Hello Wen Congyang,
>>>
>>> The patch 306859f13dc1: "acpi_memhotplug.c: don't allow to eject the
>>> memory device if it is being used" from Nov 3, 2012, leads to the
>>> following Smatch warning:
>>> drivers/acpi/acpi_memhotplug.c:367 acpi_memory_remove_memory()
>>> warn: inconsistent returns mutex:&mem_device->list_lock:
>>> locked (357,361) unlocked (367)
>>
>> Thanks for pointing it out.
>>
>> The patch 306859f13dc1 is in akpm's tree, and it conflicts with another
>> patch in linux-pm's tree. So Andrew Morton drops them.
>>
>> I will resend them based on linux-pm's next tree.
>
> Ok. Today's linux-next version 85fcb3758c10e "ACPI / memory-hotplug:
> introduce a mutex lock to protect the list in acpi_memory_device"
> has a similar problem and should be fixed as well.
This patch is in pm tree, and there is one problem. Should I resend them?
Thanks
Wen Congyang
>
> 319 static int acpi_memory_remove_memory(struct acpi_memory_device *mem_device)
> 320 {
> 321 int result;
> 322 struct acpi_memory_info *info, *n;
> 323
> 324 mutex_lock(&mem_device->list_lock);
> 325 list_for_each_entry_safe(info, n, &mem_device->res_list, list) {
> 326 if (info->enabled) {
> 327 result = remove_memory(info->start_addr, info->length);
> 328 if (result)
> 329 return result;
> ^^^^^^^^^^^^^
> We are still holding the lock here.
>
> 330 }
> 331
> 332 list_del(&info->list);
> 333 kfree(info);
> 334 }
> 335 mutex_unlock(&mem_device->list_lock);
> 336
> 337 return 0;
> 338 }
>
> regards,
> dan carpenter
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: acpi_memhotplug.c: don't allow to eject the memory device if it is being used
2012-11-08 9:33 ` Wen Congyang
@ 2012-11-08 9:58 ` Rafael J. Wysocki
2012-11-08 10:03 ` Wen Congyang
0 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2012-11-08 9:58 UTC (permalink / raw)
To: Wen Congyang; +Cc: Dan Carpenter, linux-acpi, Andrew Morton
On Thursday, November 08, 2012 05:33:43 PM Wen Congyang wrote:
> Hi, Rafael J. Wysocki
>
> At 11/06/2012 10:05 PM, Dan Carpenter Wrote:
> > On Tue, Nov 06, 2012 at 10:10:11AM +0800, Wen Congyang wrote:
> >> At 11/06/2012 02:11 AM, Dan Carpenter Wrote:
> >>> Hello Wen Congyang,
> >>>
> >>> The patch 306859f13dc1: "acpi_memhotplug.c: don't allow to eject the
> >>> memory device if it is being used" from Nov 3, 2012, leads to the
> >>> following Smatch warning:
> >>> drivers/acpi/acpi_memhotplug.c:367 acpi_memory_remove_memory()
> >>> warn: inconsistent returns mutex:&mem_device->list_lock:
> >>> locked (357,361) unlocked (367)
> >>
> >> Thanks for pointing it out.
> >>
> >> The patch 306859f13dc1 is in akpm's tree, and it conflicts with another
> >> patch in linux-pm's tree. So Andrew Morton drops them.
> >>
> >> I will resend them based on linux-pm's next tree.
> >
> > Ok. Today's linux-next version 85fcb3758c10e "ACPI / memory-hotplug:
> > introduce a mutex lock to protect the list in acpi_memory_device"
> > has a similar problem and should be fixed as well.
>
> This patch is in pm tree, and there is one problem. Should I resend them?
Yes, please.
Please also let me know which commits in linux-pm.git/linux-next should be
replaced with the new versions.
Thanks,
Rafael
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: acpi_memhotplug.c: don't allow to eject the memory device if it is being used
2012-11-08 9:58 ` Rafael J. Wysocki
@ 2012-11-08 10:03 ` Wen Congyang
0 siblings, 0 replies; 7+ messages in thread
From: Wen Congyang @ 2012-11-08 10:03 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: Dan Carpenter, linux-acpi, Andrew Morton
At 11/08/2012 05:58 PM, Rafael J. Wysocki Wrote:
> On Thursday, November 08, 2012 05:33:43 PM Wen Congyang wrote:
>> Hi, Rafael J. Wysocki
>>
>> At 11/06/2012 10:05 PM, Dan Carpenter Wrote:
>>> On Tue, Nov 06, 2012 at 10:10:11AM +0800, Wen Congyang wrote:
>>>> At 11/06/2012 02:11 AM, Dan Carpenter Wrote:
>>>>> Hello Wen Congyang,
>>>>>
>>>>> The patch 306859f13dc1: "acpi_memhotplug.c: don't allow to eject the
>>>>> memory device if it is being used" from Nov 3, 2012, leads to the
>>>>> following Smatch warning:
>>>>> drivers/acpi/acpi_memhotplug.c:367 acpi_memory_remove_memory()
>>>>> warn: inconsistent returns mutex:&mem_device->list_lock:
>>>>> locked (357,361) unlocked (367)
>>>>
>>>> Thanks for pointing it out.
>>>>
>>>> The patch 306859f13dc1 is in akpm's tree, and it conflicts with another
>>>> patch in linux-pm's tree. So Andrew Morton drops them.
>>>>
>>>> I will resend them based on linux-pm's next tree.
>>>
>>> Ok. Today's linux-next version 85fcb3758c10e "ACPI / memory-hotplug:
>>> introduce a mutex lock to protect the list in acpi_memory_device"
>>> has a similar problem and should be fixed as well.
>>
>> This patch is in pm tree, and there is one problem. Should I resend them?
>
> Yes, please.
>
> Please also let me know which commits in linux-pm.git/linux-next should be
> replaced with the new versions.
OK. I will write it in the patches.
Thanks
Wen Congyang
>
> Thanks,
> Rafael
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-11-08 9:57 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-05 18:11 acpi_memhotplug.c: don't allow to eject the memory device if it is being used Dan Carpenter
2012-11-06 2:10 ` Wen Congyang
2012-11-06 14:05 ` Dan Carpenter
2012-11-07 1:39 ` Wen Congyang
2012-11-08 9:33 ` Wen Congyang
2012-11-08 9:58 ` Rafael J. Wysocki
2012-11-08 10:03 ` Wen Congyang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.