All of lore.kernel.org
 help / color / mirror / Atom feed
* kmemleak in apei_res_add
@ 2013-08-12  2:45 Alexandra N. Kossovsky
  2013-08-21  9:38 ` Catalin Marinas
  0 siblings, 1 reply; 5+ messages in thread
From: Alexandra N. Kossovsky @ 2013-08-12  2:45 UTC (permalink / raw)
  To: Len Brown, Rafael J. Wysocki, linux-acpi, linux-kernel

When running 3.10.3 with kmemleak enabled, I see following warnings from
kmemleak:

unreferenced object 0xffff88024d2219a0 (size 32):
  comm "swapper/0", pid 1, jiffies 4294894532 (age 26865.180s)
  hex dump (first 32 bytes):
    58 de 0c 73 02 88 ff ff 58 de 0c 73 02 88 ff ff  X..s....X..s....
    18 50 fd 7d 00 00 00 00 3f 50 fd 7d 00 00 00 00  .P.}....?P.}....
  backtrace:
    [<ffffffff813ddf40>] kmemleak_alloc+0x21/0x3e
    [<ffffffff8111cb99>] kmemleak_alloc_recursive.constprop.58+0x16/0x18
    [<ffffffff8111efac>] kmem_cache_alloc_trace+0xe6/0x12f
    [<ffffffff81278f0e>] apei_res_add+0xb9/0xe8
    [<ffffffff81278faa>] collect_res_callback+0x6d/0x7c
    [<ffffffff812788ed>] apei_exec_for_each_entry+0x78/0x93
    [<ffffffff8127891d>] apei_exec_collect_resources+0x15/0x17
    [<ffffffff81b010e5>] erst_init+0x278/0x2a3
    [<ffffffff810020b5>] do_one_initcall+0x7b/0x116
    [<ffffffff81ac9ee7>] kernel_init_freeable+0x13f/0x1cc
    [<ffffffff813db19f>] kernel_init+0x9/0xd6
    [<ffffffff813fe5bc>] ret_from_fork+0x7c/0xb0
    [<ffffffffffffffff>] 0xffffffffffffffff
unreferenced object 0xffff88024d221980 (size 32):
  comm "swapper/0", pid 1, jiffies 4294894532 (age 26865.180s)
  hex dump (first 32 bytes):
    68 de 0c 73 02 88 ff ff 68 de 0c 73 02 88 ff ff  h..s....h..s....
    b2 00 00 00 00 00 00 00 b3 00 00 00 00 00 00 00  ................
  backtrace:
    [<ffffffff813ddf40>] kmemleak_alloc+0x21/0x3e
    [<ffffffff8111cb99>] kmemleak_alloc_recursive.constprop.58+0x16/0x18
    [<ffffffff8111efac>] kmem_cache_alloc_trace+0xe6/0x12f
    [<ffffffff81278f0e>] apei_res_add+0xb9/0xe8
    [<ffffffff81278faa>] collect_res_callback+0x6d/0x7c
    [<ffffffff812788ed>] apei_exec_for_each_entry+0x78/0x93
    [<ffffffff8127891d>] apei_exec_collect_resources+0x15/0x17
    [<ffffffff81b010e5>] erst_init+0x278/0x2a3
    [<ffffffff810020b5>] do_one_initcall+0x7b/0x116
    [<ffffffff81ac9ee7>] kernel_init_freeable+0x13f/0x1cc
    [<ffffffff813db19f>] kernel_init+0x9/0xd6
    [<ffffffff813fe5bc>] ret_from_fork+0x7c/0xb0
    [<ffffffffffffffff>] 0xffffffffffffffff
unreferenced object 0xffff88024d221960 (size 32):
  comm "swapper/0", pid 1, jiffies 4294894532 (age 26865.180s)
  hex dump (first 32 bytes):
    00 de 0c 73 02 88 ff ff 40 19 22 4d 02 88 ff ff  ...s....@."M....
    00 50 09 7e 00 00 00 00 00 90 29 7e 00 00 00 00  .P.~......)~....
  backtrace:
    [<ffffffff813ddf40>] kmemleak_alloc+0x21/0x3e
    [<ffffffff8111cb99>] kmemleak_alloc_recursive.constprop.58+0x16/0x18
    [<ffffffff8111efac>] kmem_cache_alloc_trace+0xe6/0x12f
    [<ffffffff81278f0e>] apei_res_add+0xb9/0xe8
    [<ffffffff81278fce>] apei_get_nvs_callback+0x15/0x17
    [<ffffffff8125197d>] acpi_nvs_for_each_region+0x25/0x46
    [<ffffffff8127903b>] apei_resources_request+0x56/0x217
    [<ffffffff81b00f28>] erst_init+0xbb/0x2a3
    [<ffffffff810020b5>] do_one_initcall+0x7b/0x116
    [<ffffffff81ac9ee7>] kernel_init_freeable+0x13f/0x1cc
    [<ffffffff813db19f>] kernel_init+0x9/0xd6
    [<ffffffff813fe5bc>] ret_from_fork+0x7c/0xb0
    [<ffffffffffffffff>] 0xffffffffffffffff
unreferenced object 0xffff88024d221940 (size 32):
  comm "swapper/0", pid 1, jiffies 4294894532 (age 26865.180s)
  hex dump (first 32 bytes):
    60 19 22 4d 02 88 ff ff 00 de 0c 73 02 88 ff ff  `."M.......s....
    00 00 37 7f 00 00 00 00 00 60 3f 7f 00 00 00 00  ..7......`?.....
  backtrace:
    [<ffffffff813ddf40>] kmemleak_alloc+0x21/0x3e
    [<ffffffff8111cb99>] kmemleak_alloc_recursive.constprop.58+0x16/0x18
    [<ffffffff8111efac>] kmem_cache_alloc_trace+0xe6/0x12f
    [<ffffffff81278f0e>] apei_res_add+0xb9/0xe8
    [<ffffffff81278fce>] apei_get_nvs_callback+0x15/0x17
    [<ffffffff8125197d>] acpi_nvs_for_each_region+0x25/0x46
    [<ffffffff8127903b>] apei_resources_request+0x56/0x217
    [<ffffffff81b00f28>] erst_init+0xbb/0x2a3
    [<ffffffff810020b5>] do_one_initcall+0x7b/0x116
    [<ffffffff81ac9ee7>] kernel_init_freeable+0x13f/0x1cc
    [<ffffffff813db19f>] kernel_init+0x9/0xd6
    [<ffffffff813fe5bc>] ret_from_fork+0x7c/0xb0
    [<ffffffffffffffff>] 0xffffffffffffffff

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

* Re: kmemleak in apei_res_add
  2013-08-12  2:45 kmemleak in apei_res_add Alexandra N. Kossovsky
@ 2013-08-21  9:38 ` Catalin Marinas
  2013-08-21 13:44   ` Alexandra N. Kossovsky
  0 siblings, 1 reply; 5+ messages in thread
From: Catalin Marinas @ 2013-08-21  9:38 UTC (permalink / raw)
  To: Alexandra N. Kossovsky
  Cc: Len Brown, Rafael J. Wysocki, linux-acpi,
	Linux Kernel Mailing List, Huang Ying

On 12 August 2013 03:45, Alexandra N. Kossovsky
<Alexandra.Kossovsky@oktetlabs.ru> wrote:
> When running 3.10.3 with kmemleak enabled, I see following warnings from
> kmemleak:
>
> unreferenced object 0xffff88024d2219a0 (size 32):
>   comm "swapper/0", pid 1, jiffies 4294894532 (age 26865.180s)
>   hex dump (first 32 bytes):
>     58 de 0c 73 02 88 ff ff 58 de 0c 73 02 88 ff ff  X..s....X..s....
>     18 50 fd 7d 00 00 00 00 3f 50 fd 7d 00 00 00 00  .P.}....?P.}....
>   backtrace:
>     [<ffffffff813ddf40>] kmemleak_alloc+0x21/0x3e
>     [<ffffffff8111cb99>] kmemleak_alloc_recursive.constprop.58+0x16/0x18
>     [<ffffffff8111efac>] kmem_cache_alloc_trace+0xe6/0x12f
>     [<ffffffff81278f0e>] apei_res_add+0xb9/0xe8
>     [<ffffffff81278faa>] collect_res_callback+0x6d/0x7c
>     [<ffffffff812788ed>] apei_exec_for_each_entry+0x78/0x93
>     [<ffffffff8127891d>] apei_exec_collect_resources+0x15/0x17
>     [<ffffffff81b010e5>] erst_init+0x278/0x2a3
>     [<ffffffff810020b5>] do_one_initcall+0x7b/0x116
>     [<ffffffff81ac9ee7>] kernel_init_freeable+0x13f/0x1cc
>     [<ffffffff813db19f>] kernel_init+0x9/0xd6
>     [<ffffffff813fe5bc>] ret_from_fork+0x7c/0xb0
>     [<ffffffffffffffff>] 0xffffffffffffffff

Are there any "APEI:" errors in the kernel log? It could be some
freeing missing on an error path.

apei_res_add() allocates struct apei_res objects and places them on
the erst_resources.{iomem,ioport} list heads as given by erst_init().
The erst_resources is just a local variable on the erst_init() stack,
hence kmemleak doesn't have any trace of the allocated objects.

It looks like erst_init() calls apei_resources_request() which should
merge the local erst_resources list heads with the global
apei_resources_all but for whatever reason, this or any of the
previous calls in erst_init() fail and we don't get the merging. Some
of the goto err_fini in this function should probably be err_release.
I cc'ed Huang as the driver author.

-- 
Catalin

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

* Re: kmemleak in apei_res_add
  2013-08-21  9:38 ` Catalin Marinas
@ 2013-08-21 13:44   ` Alexandra N. Kossovsky
  2013-08-22  8:43     ` Huang Ying
  0 siblings, 1 reply; 5+ messages in thread
From: Alexandra N. Kossovsky @ 2013-08-21 13:44 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: Len Brown, Rafael J. Wysocki, linux-acpi,
	Linux Kernel Mailing List, Huang Ying

On Aug 21 10:38, Catalin Marinas wrote:
> On 12 August 2013 03:45, Alexandra N. Kossovsky
> <Alexandra.Kossovsky@oktetlabs.ru> wrote:
> > When running 3.10.3 with kmemleak enabled, I see following warnings from
> > kmemleak:
> >
> > unreferenced object 0xffff88024d2219a0 (size 32):
> >   comm "swapper/0", pid 1, jiffies 4294894532 (age 26865.180s)
> >   hex dump (first 32 bytes):
> >     58 de 0c 73 02 88 ff ff 58 de 0c 73 02 88 ff ff  X..s....X..s....
> >     18 50 fd 7d 00 00 00 00 3f 50 fd 7d 00 00 00 00  .P.}....?P.}....
> >   backtrace:
> >     [<ffffffff813ddf40>] kmemleak_alloc+0x21/0x3e
> >     [<ffffffff8111cb99>] kmemleak_alloc_recursive.constprop.58+0x16/0x18
> >     [<ffffffff8111efac>] kmem_cache_alloc_trace+0xe6/0x12f
> >     [<ffffffff81278f0e>] apei_res_add+0xb9/0xe8
> >     [<ffffffff81278faa>] collect_res_callback+0x6d/0x7c
> >     [<ffffffff812788ed>] apei_exec_for_each_entry+0x78/0x93
> >     [<ffffffff8127891d>] apei_exec_collect_resources+0x15/0x17
> >     [<ffffffff81b010e5>] erst_init+0x278/0x2a3
> >     [<ffffffff810020b5>] do_one_initcall+0x7b/0x116
> >     [<ffffffff81ac9ee7>] kernel_init_freeable+0x13f/0x1cc
> >     [<ffffffff813db19f>] kernel_init+0x9/0xd6
> >     [<ffffffff813fe5bc>] ret_from_fork+0x7c/0xb0
> >     [<ffffffffffffffff>] 0xffffffffffffffff
> 
> Are there any "APEI:" errors in the kernel log? It could be some
> freeing missing on an error path.

No.
dmesg |grep APEI
[    9.602274] GHES: APEI firmware first mode is enabled by APEI bit and WHEA _OSC.


-- 
Alexandra N. Kossovsky
OKTET Labs (http://www.oktetlabs.ru/)
e-mail: sasha@oktetlabs.ru

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

* Re: kmemleak in apei_res_add
  2013-08-21 13:44   ` Alexandra N. Kossovsky
@ 2013-08-22  8:43     ` Huang Ying
  2013-08-23 12:32       ` Alexandra N. Kossovsky
  0 siblings, 1 reply; 5+ messages in thread
From: Huang Ying @ 2013-08-22  8:43 UTC (permalink / raw)
  To: Alexandra N. Kossovsky
  Cc: Catalin Marinas, Len Brown, Rafael J. Wysocki, linux-acpi,
	Linux Kernel Mailing List

Hi, Alexandra,

On Wed, 2013-08-21 at 17:44 +0400, Alexandra N. Kossovsky wrote:
> On Aug 21 10:38, Catalin Marinas wrote:
> > On 12 August 2013 03:45, Alexandra N. Kossovsky
> > <Alexandra.Kossovsky@oktetlabs.ru> wrote:
> > > When running 3.10.3 with kmemleak enabled, I see following warnings from
> > > kmemleak:
> > >
> > > unreferenced object 0xffff88024d2219a0 (size 32):
> > >   comm "swapper/0", pid 1, jiffies 4294894532 (age 26865.180s)
> > >   hex dump (first 32 bytes):
> > >     58 de 0c 73 02 88 ff ff 58 de 0c 73 02 88 ff ff  X..s....X..s....
> > >     18 50 fd 7d 00 00 00 00 3f 50 fd 7d 00 00 00 00  .P.}....?P.}....
> > >   backtrace:
> > >     [<ffffffff813ddf40>] kmemleak_alloc+0x21/0x3e
> > >     [<ffffffff8111cb99>] kmemleak_alloc_recursive.constprop.58+0x16/0x18
> > >     [<ffffffff8111efac>] kmem_cache_alloc_trace+0xe6/0x12f
> > >     [<ffffffff81278f0e>] apei_res_add+0xb9/0xe8
> > >     [<ffffffff81278faa>] collect_res_callback+0x6d/0x7c
> > >     [<ffffffff812788ed>] apei_exec_for_each_entry+0x78/0x93
> > >     [<ffffffff8127891d>] apei_exec_collect_resources+0x15/0x17
> > >     [<ffffffff81b010e5>] erst_init+0x278/0x2a3
> > >     [<ffffffff810020b5>] do_one_initcall+0x7b/0x116
> > >     [<ffffffff81ac9ee7>] kernel_init_freeable+0x13f/0x1cc
> > >     [<ffffffff813db19f>] kernel_init+0x9/0xd6
> > >     [<ffffffff813fe5bc>] ret_from_fork+0x7c/0xb0
> > >     [<ffffffffffffffff>] 0xffffffffffffffff
> > 
> > Are there any "APEI:" errors in the kernel log? It could be some
> > freeing missing on an error path.
> 
> No.
> dmesg |grep APEI
> [    9.602274] GHES: APEI firmware first mode is enabled by APEI bit and WHEA _OSC.
> 

Can you try the following debug patch, and send me back the output of:

$ dmesg | grep apei_res

Best Regards,
Huang Ying


---
 drivers/acpi/apei/apei-base.c |    4 ++++
 1 file changed, 4 insertions(+)

--- a/drivers/acpi/apei/apei-base.c
+++ b/drivers/acpi/apei/apei-base.c
@@ -310,6 +310,8 @@ static int apei_res_add(struct list_head
 	struct apei_res *res, *resn, *res_ins = NULL;
 	unsigned long end = start + size;
 
+	pr_info("apei_res_add: %p: %lx - %lx\n", res_list, start, end);
+
 	if (end <= start)
 		return 0;
 repeat:
@@ -346,6 +348,7 @@ static int apei_res_sub(struct list_head
 			struct list_head *res_list2)
 {
 	struct apei_res *res1, *resn1, *res2, *res;
+	pr_info("apei_res_sub: %p - %p\n", res_list1, res_list2);
 	res1 = list_entry(res_list1->next, struct apei_res, list);
 	resn1 = list_entry(res1->list.next, struct apei_res, list);
 	while (&res1->list != res_list1) {
@@ -386,6 +389,7 @@ static void apei_res_clean(struct list_h
 {
 	struct apei_res *res, *resn;
 
+	pr_info("apei_res_clean: %p\n", res_list);
 	list_for_each_entry_safe(res, resn, res_list, list) {
 		list_del(&res->list);
 		kfree(res);



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

* Re: kmemleak in apei_res_add
  2013-08-22  8:43     ` Huang Ying
@ 2013-08-23 12:32       ` Alexandra N. Kossovsky
  0 siblings, 0 replies; 5+ messages in thread
From: Alexandra N. Kossovsky @ 2013-08-23 12:32 UTC (permalink / raw)
  To: Huang Ying
  Cc: Catalin Marinas, Len Brown, Rafael J. Wysocki, linux-acpi,
	Linux Kernel Mailing List

Hi Huang,

On Aug 22 16:43, Huang Ying wrote:
> Hi, Alexandra,
> Can you try the following debug patch, and send me back the output of:
> 
> $ dmesg | grep apei_res

bash$ dmesg |grep apei
[    9.608829] apei_res_add: ffff8802730cde48: 7dfd5018 - 7dfd5019
[    9.615354] apei_res_add: ffff8802730cde48: 7dfd5018 - 7dfd5019
[    9.621595] apei_res_add: ffff8802730cde48: 7dfd5018 - 7dfd5019
[    9.627915] apei_res_add: ffff8802730cde48: 7dfd5019 - 7dfd501a
[    9.634363] apei_res_add: ffff8802730cde48: 7dfd501a - 7dfd501e
[    9.640689] apei_res_add: ffff8802730cde58: b2 - b3
[    9.646008] apei_res_add: ffff8802730cde48: 7dfd501e - 7dfd501f
[    9.652320] apei_res_add: ffff8802730cde48: 7dfd501f - 7dfd5020
[    9.658637] apei_res_add: ffff8802730cde48: 7dfd5020 - 7dfd5028
[    9.664952] apei_res_add: ffff8802730cde48: 7dfd5028 - 7dfd5030
[    9.671227] apei_res_add: ffff8802730cde48: 7dfd5030 - 7dfd5032
[    9.686533] apei_res_add: ffff8802730cde48: 7dfd5018 - 7dfd5019
[    9.702283] apei_res_add: ffff8802730cde48: 7dfd5032 - 7dfd5033
[    9.718050] apei_res_add: ffff8802730cde48: 7dfd5032 - 7dfd503a
[    9.732699] apei_res_add: ffff8802730cde48: 7dfd503a - 7dfd503e
[    9.747231] apei_res_add: ffff8802730cde48: 7dfd503e - 7dfd503f
[    9.761822] apei_res_sub: ffff8802730cde48 - ffffffff81a76ee0
[    9.775718] apei_res_sub: ffff8802730cde58 - ffffffff81a76ef0
[    9.789058] apei_res_add: ffff8802730cdde8: 7e095000 - 7e299000
[    9.803780] apei_res_add: ffff8802730cdde8: 7f370000 - 7f3f6000
[    9.818264] apei_res_sub: ffff8802730cde48 - ffff8802730cdde8
[    9.831933] apei_res_sub: ffff8802730cde58 - ffff8802730cddf8
[    9.846091] apei_res_add: ffffffff81a76ee0: 7dfd5018 - 7dfd503f
[    9.859528] apei_res_add: ffffffff81a76ef0: b2 - b3

I hope it helps.

Alexandra.
-- 
Alexandra N. Kossovsky
OKTET Labs (http://www.oktetlabs.ru/)
e-mail: sasha@oktetlabs.ru

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

end of thread, other threads:[~2013-08-23 12:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-12  2:45 kmemleak in apei_res_add Alexandra N. Kossovsky
2013-08-21  9:38 ` Catalin Marinas
2013-08-21 13:44   ` Alexandra N. Kossovsky
2013-08-22  8:43     ` Huang Ying
2013-08-23 12:32       ` Alexandra N. Kossovsky

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.