public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [Bugme-new] [Bug 12768] New: usb_alloc_urb() leaks memory together with uvcvideo driver
       [not found] <bug-12768-10286@http.bugzilla.kernel.org/>
@ 2009-02-24 21:57 ` Andrew Morton
  2009-02-24 22:37   ` Markus Rechberger
  2009-02-25  2:02   ` Mauro Carvalho Chehab
  0 siblings, 2 replies; 10+ messages in thread
From: Andrew Morton @ 2009-02-24 21:57 UTC (permalink / raw)
  To: linux-media; +Cc: bugme-daemon, nm127


(switched to email.  Please respond via emailed reply-to-all, not via the
bugzilla web interface).

On Mon, 23 Feb 2009 22:08:37 -0800 (PST)
bugme-daemon@bugzilla.kernel.org wrote:

> http://bugzilla.kernel.org/show_bug.cgi?id=12768

There's additional info at the link.

>            Summary: usb_alloc_urb() leaks memory together with uvcvideo
>                     driver
>            Product: Drivers
>            Version: 2.5
>      KernelVersion: 2.6.28
>           Platform: All
>         OS/Version: Linux
>               Tree: Mainline
>             Status: NEW
>           Severity: normal
>           Priority: P1
>          Component: USB
>         AssignedTo: greg@kroah.com
>         ReportedBy: nm127@freemail.hu
> 
> 
> Latest working kernel version:
> Earliest failing kernel version:
> Distribution:
> Hardware Environment: EeePC 901
> Software Environment: Debian 5.0
> Problem Description:
> 
> Steps to reproduce:
> 1. Boot the system
> 2. start an xterm window and execute the following command:
> 
> $ while true; do clear; cat /proc/slab_allocators |grep usb_alloc; sleep 1;
> done
> 
> This will print out similar lines each second:
> 
> size-2048: 18 usb_alloc_dev+0x1d/0x212 [usbcore]
> size-2048: 2280 usb_alloc_urb+0xc/0x2b [usbcore]
> size-1024: 85 usb_alloc_urb+0xc/0x2b [usbcore]
> size-128: 10 usb_alloc_urb+0xc/0x2b [usbcore]
> 
> 3. Start xawtv, this will show the picture of the webcam
> 4. Exit xawtv
> 
> Current result:
> In the output of /proc/slab_allocators the number of blocks allocated by
> usb_alloc_urb() increases, however, the xawtv is no longer running:
> 
> size-2048: 18 usb_alloc_dev+0x1d/0x212 [usbcore]
> size-2048: 2280 usb_alloc_urb+0xc/0x2b [usbcore]
> size-1024: 100 usb_alloc_urb+0xc/0x2b [usbcore]
> size-128: 10 usb_alloc_urb+0xc/0x2b [usbcore]
> 
> Each time xawtv is started and stopped the value increases at the
> usb_alloc_urb().
> 
> Expected result: the same memory usage is reached again after xawtv exited.
> 

I assume this is a v4l bug and not a USB core bug?


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

* Re: [Bugme-new] [Bug 12768] New: usb_alloc_urb() leaks memory together with uvcvideo driver
  2009-02-24 21:57 ` [Bugme-new] [Bug 12768] New: usb_alloc_urb() leaks memory together with uvcvideo driver Andrew Morton
@ 2009-02-24 22:37   ` Markus Rechberger
  2009-02-25  2:02   ` Mauro Carvalho Chehab
  1 sibling, 0 replies; 10+ messages in thread
From: Markus Rechberger @ 2009-02-24 22:37 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-media, bugme-daemon, nm127

On Tue, Feb 24, 2009 at 10:57 PM, Andrew Morton
<akpm@linux-foundation.org> wrote:
>
> (switched to email.  Please respond via emailed reply-to-all, not via the
> bugzilla web interface).
>
> On Mon, 23 Feb 2009 22:08:37 -0800 (PST)
> bugme-daemon@bugzilla.kernel.org wrote:
>
>> http://bugzilla.kernel.org/show_bug.cgi?id=12768
>
> There's additional info at the link.
>
>>            Summary: usb_alloc_urb() leaks memory together with uvcvideo
>>                     driver
>>            Product: Drivers
>>            Version: 2.5
>>      KernelVersion: 2.6.28
>>           Platform: All
>>         OS/Version: Linux
>>               Tree: Mainline
>>             Status: NEW
>>           Severity: normal
>>           Priority: P1
>>          Component: USB
>>         AssignedTo: greg@kroah.com
>>         ReportedBy: nm127@freemail.hu
>>
>>
>> Latest working kernel version:
>> Earliest failing kernel version:
>> Distribution:
>> Hardware Environment: EeePC 901
>> Software Environment: Debian 5.0
>> Problem Description:
>>
>> Steps to reproduce:
>> 1. Boot the system
>> 2. start an xterm window and execute the following command:
>>
>> $ while true; do clear; cat /proc/slab_allocators |grep usb_alloc; sleep 1;
>> done
>>
>> This will print out similar lines each second:
>>
>> size-2048: 18 usb_alloc_dev+0x1d/0x212 [usbcore]
>> size-2048: 2280 usb_alloc_urb+0xc/0x2b [usbcore]
>> size-1024: 85 usb_alloc_urb+0xc/0x2b [usbcore]
>> size-128: 10 usb_alloc_urb+0xc/0x2b [usbcore]
>>
>> 3. Start xawtv, this will show the picture of the webcam
>> 4. Exit xawtv
>>
>> Current result:
>> In the output of /proc/slab_allocators the number of blocks allocated by
>> usb_alloc_urb() increases, however, the xawtv is no longer running:
>>
>> size-2048: 18 usb_alloc_dev+0x1d/0x212 [usbcore]
>> size-2048: 2280 usb_alloc_urb+0xc/0x2b [usbcore]
>> size-1024: 100 usb_alloc_urb+0xc/0x2b [usbcore]
>> size-128: 10 usb_alloc_urb+0xc/0x2b [usbcore]
>>
>> Each time xawtv is started and stopped the value increases at the
>> usb_alloc_urb().
>>
>> Expected result: the same memory usage is reached again after xawtv exited.
>>
>
> I assume this is a v4l bug and not a USB core bug?
>

the history of this bug is that someone complained that the em28xx
driver leaked, Nemeth traced it back and found out that it also
happens with uvcvideo - both drivers kinda have an independent
implementation and it happens with both.

Markus

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

* Re: [Bugme-new] [Bug 12768] New: usb_alloc_urb() leaks memory together with uvcvideo driver
  2009-02-24 21:57 ` [Bugme-new] [Bug 12768] New: usb_alloc_urb() leaks memory together with uvcvideo driver Andrew Morton
  2009-02-24 22:37   ` Markus Rechberger
@ 2009-02-25  2:02   ` Mauro Carvalho Chehab
  2009-02-25  2:15     ` Markus Rechberger
  1 sibling, 1 reply; 10+ messages in thread
From: Mauro Carvalho Chehab @ 2009-02-25  2:02 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-media, bugme-daemon, nm127

On Tue, 24 Feb 2009 13:57:20 -0800
Andrew Morton <akpm@linux-foundation.org> wrote:

>> > In the output of /proc/slab_allocators the number of blocks allocated by
> > usb_alloc_urb() increases, however, the xawtv is no longer running:
> > 
> > size-2048: 18 usb_alloc_dev+0x1d/0x212 [usbcore]
> > size-2048: 2280 usb_alloc_urb+0xc/0x2b [usbcore]
> > size-1024: 100 usb_alloc_urb+0xc/0x2b [usbcore]
> > size-128: 10 usb_alloc_urb+0xc/0x2b [usbcore]
> > 
> > Each time xawtv is started and stopped the value increases at the
> > usb_alloc_urb().
> > 
> > Expected result: the same memory usage is reached again after xawtv exited.
> > 
> 
> I assume this is a v4l bug and not a USB core bug?

I guess this is a v4l bug. We've found several memory leaks on em28xx driver,
fixed at the development -git:

http://git.kernel.org/?p=linux/kernel/git/mchehab/devel.git

I'll do some tests again with the latest em28xx driver to double check if it is
there any other memory leak. If not, then we could replicate the same approach
into uvcvideo.

Cheers,
Mauro

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

* Re: [Bugme-new] [Bug 12768] New: usb_alloc_urb() leaks memory together with uvcvideo driver
  2009-02-25  2:02   ` Mauro Carvalho Chehab
@ 2009-02-25  2:15     ` Markus Rechberger
  2009-02-25  3:23       ` Andrew Morton
  0 siblings, 1 reply; 10+ messages in thread
From: Markus Rechberger @ 2009-02-25  2:15 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: Andrew Morton, linux-media, bugme-daemon, nm127

On Wed, Feb 25, 2009 at 3:02 AM, Mauro Carvalho Chehab
<mchehab@infradead.org> wrote:
> On Tue, 24 Feb 2009 13:57:20 -0800
> Andrew Morton <akpm@linux-foundation.org> wrote:
>
>>> > In the output of /proc/slab_allocators the number of blocks allocated by
>> > usb_alloc_urb() increases, however, the xawtv is no longer running:
>> >
>> > size-2048: 18 usb_alloc_dev+0x1d/0x212 [usbcore]
>> > size-2048: 2280 usb_alloc_urb+0xc/0x2b [usbcore]
>> > size-1024: 100 usb_alloc_urb+0xc/0x2b [usbcore]
>> > size-128: 10 usb_alloc_urb+0xc/0x2b [usbcore]
>> >
>> > Each time xawtv is started and stopped the value increases at the
>> > usb_alloc_urb().
>> >
>> > Expected result: the same memory usage is reached again after xawtv exited.
>> >
>>
>> I assume this is a v4l bug and not a USB core bug?
>
> I guess this is a v4l bug. We've found several memory leaks on em28xx driver,
> fixed at the development -git:
>
> http://git.kernel.org/?p=linux/kernel/git/mchehab/devel.git
>
> I'll do some tests again with the latest em28xx driver to double check if it is
> there any other memory leak. If not, then we could replicate the same approach
> into uvcvideo.
>

haha you never even had a look at the issue itself.

Markus

> Cheers,
> Mauro
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

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

* Re: [Bugme-new] [Bug 12768] New: usb_alloc_urb() leaks memory together with uvcvideo driver
  2009-02-25  2:15     ` Markus Rechberger
@ 2009-02-25  3:23       ` Andrew Morton
  2009-02-25  3:35         ` Markus Rechberger
  0 siblings, 1 reply; 10+ messages in thread
From: Andrew Morton @ 2009-02-25  3:23 UTC (permalink / raw)
  To: Markus Rechberger; +Cc: Mauro Carvalho Chehab, linux-media, bugme-daemon, nm127

On Wed, 25 Feb 2009 03:15:35 +0100 Markus Rechberger <mrechberger@gmail.com> wrote:

> On Wed, Feb 25, 2009 at 3:02 AM, Mauro Carvalho Chehab
> <mchehab@infradead.org> wrote:
> > On Tue, 24 Feb 2009 13:57:20 -0800
> > Andrew Morton <akpm@linux-foundation.org> wrote:
> >
> >>> > In the output of /proc/slab_allocators the number of blocks allocated by
> >> > usb_alloc_urb() increases, however, the xawtv is no longer running:
> >> >
> >> > size-2048: 18 usb_alloc_dev+0x1d/0x212 [usbcore]
> >> > size-2048: 2280 usb_alloc_urb+0xc/0x2b [usbcore]
> >> > size-1024: 100 usb_alloc_urb+0xc/0x2b [usbcore]
> >> > size-128: 10 usb_alloc_urb+0xc/0x2b [usbcore]
> >> >
> >> > Each time xawtv is started and stopped the value increases at the
> >> > usb_alloc_urb().
> >> >
> >> > Expected result: the same memory usage is reached again after xawtv exited.
> >> >
> >>
> >> I assume this is a v4l bug and not a USB core bug?
> >
> > I guess this is a v4l bug. We've found several memory leaks on em28xx driver,
> > fixed at the development -git:
> >
> > http://git.kernel.org/?p=linux/kernel/git/mchehab/devel.git
> >
> > I'll do some tests again with the latest em28xx driver to double check if it is
> > there any other memory leak. If not, then we could replicate the same approach
> > into uvcvideo.
> >
> 
> haha you never even had a look at the issue itself.

What a perfectly useless comment.

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

* Re: [Bugme-new] [Bug 12768] New: usb_alloc_urb() leaks memory together with uvcvideo driver
  2009-02-25  3:23       ` Andrew Morton
@ 2009-02-25  3:35         ` Markus Rechberger
  2009-02-25  7:44           ` Németh Márton
  0 siblings, 1 reply; 10+ messages in thread
From: Markus Rechberger @ 2009-02-25  3:35 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Mauro Carvalho Chehab, linux-media, bugme-daemon, nm127

On Wed, Feb 25, 2009 at 4:23 AM, Andrew Morton
<akpm@linux-foundation.org> wrote:
> On Wed, 25 Feb 2009 03:15:35 +0100 Markus Rechberger <mrechberger@gmail.com> wrote:
>
>> On Wed, Feb 25, 2009 at 3:02 AM, Mauro Carvalho Chehab
>> <mchehab@infradead.org> wrote:
>> > On Tue, 24 Feb 2009 13:57:20 -0800
>> > Andrew Morton <akpm@linux-foundation.org> wrote:
>> >
>> >>> > In the output of /proc/slab_allocators the number of blocks allocated by
>> >> > usb_alloc_urb() increases, however, the xawtv is no longer running:
>> >> >
>> >> > size-2048: 18 usb_alloc_dev+0x1d/0x212 [usbcore]
>> >> > size-2048: 2280 usb_alloc_urb+0xc/0x2b [usbcore]
>> >> > size-1024: 100 usb_alloc_urb+0xc/0x2b [usbcore]
>> >> > size-128: 10 usb_alloc_urb+0xc/0x2b [usbcore]
>> >> >
>> >> > Each time xawtv is started and stopped the value increases at the
>> >> > usb_alloc_urb().
>> >> >
>> >> > Expected result: the same memory usage is reached again after xawtv exited.
>> >> >
>> >>
>> >> I assume this is a v4l bug and not a USB core bug?
>> >
>> > I guess this is a v4l bug. We've found several memory leaks on em28xx driver,
>> > fixed at the development -git:
>> >
>> > http://git.kernel.org/?p=linux/kernel/git/mchehab/devel.git
>> >
>> > I'll do some tests again with the latest em28xx driver to double check if it is
>> > there any other memory leak. If not, then we could replicate the same approach
>> > into uvcvideo.
>> >
>>
>> haha you never even had a look at the issue itself.
>
> What a perfectly useless comment.
>

not more or less useless than the one before

http://mcentral.de/pipermail/em28xx/2009-February/002446.html

I followed the other em28xx work too and there has not been anything
which addressed that issue.

Markus

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

* Re: [Bugme-new] [Bug 12768] New: usb_alloc_urb() leaks memory  together with uvcvideo driver
  2009-02-25  3:35         ` Markus Rechberger
@ 2009-02-25  7:44           ` Németh Márton
  2009-02-25 12:49             ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 10+ messages in thread
From: Németh Márton @ 2009-02-25  7:44 UTC (permalink / raw)
  To: Markus Rechberger
  Cc: Andrew Morton, Mauro Carvalho Chehab, linux-media, bugme-daemon

Please, please, please, can we concentrate on the subject?

What I did with the other out-of-tree em28xx-new driver was that
I printed out the urb->kref.refcount before and after each urb operation.

The result was that when the urb->complete function is called, the reference
count was still 2, instead of 1.

I could imagine three possible errors:
1. there is a bug in uvcvideo driver
2. there is a bug in v4l framework
3. there is a bug in usb subsystem

It would be good if someone who have a deeper knowledge than me on these fields could
give some hints or debug patches which would lead us closer to the solution.

Regards,

	Márton Németh

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

* Re: [Bugme-new] [Bug 12768] New: usb_alloc_urb() leaks memory together with uvcvideo driver
  2009-02-25  7:44           ` Németh Márton
@ 2009-02-25 12:49             ` Mauro Carvalho Chehab
  2009-02-25 21:55               ` Laurent Pinchart
  0 siblings, 1 reply; 10+ messages in thread
From: Mauro Carvalho Chehab @ 2009-02-25 12:49 UTC (permalink / raw)
  To: Németh Márton
  Cc: Markus Rechberger, Andrew Morton, linux-media, bugme-daemon

On Wed, 25 Feb 2009 08:44:00 +0100
Németh Márton <nm127@freemail.hu> wrote:

> What I did with the other out-of-tree em28xx-new driver was that
> I printed out the urb->kref.refcount before and after each urb operation.
> 
> The result was that when the urb->complete function is called, the reference
> count was still 2, instead of 1.
> 
> I could imagine three possible errors:
> 1. there is a bug in uvcvideo driver
> 2. there is a bug in v4l framework
> 3. there is a bug in usb subsystem
> 
> It would be good if someone who have a deeper knowledge than me on these fields could
> give some hints or debug patches which would lead us closer to the solution.

Márton,

I did a test yesterday night with 2.6.29-rc6. The em28xx in-kernel still has
same problem we focused a while ago (except that, before, memory were going
exausted on a much higher rate, and we had memory leaks for every close() call).

What happens is that, sometimes, memory are not being freed by
usb_kill_urb()/usb_unlink_urb(). I'm trying to debug it right now, to
understand what's happening.


Cheers,
Mauro

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

* Re: [Bugme-new] [Bug 12768] New: usb_alloc_urb() leaks memory together with uvcvideo driver
  2009-02-25 12:49             ` Mauro Carvalho Chehab
@ 2009-02-25 21:55               ` Laurent Pinchart
  2009-02-26  1:39                 ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 10+ messages in thread
From: Laurent Pinchart @ 2009-02-25 21:55 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Németh Márton, Markus Rechberger, Andrew Morton,
	linux-media, bugme-daemon

On Wednesday 25 February 2009 13:49:29 Mauro Carvalho Chehab wrote:
> On Wed, 25 Feb 2009 08:44:00 +0100
>
> Németh Márton <nm127@freemail.hu> wrote:
> > What I did with the other out-of-tree em28xx-new driver was that
> > I printed out the urb->kref.refcount before and after each urb operation.
> >
> > The result was that when the urb->complete function is called, the
> > reference count was still 2, instead of 1.
> >
> > I could imagine three possible errors:
> > 1. there is a bug in uvcvideo driver
> > 2. there is a bug in v4l framework
> > 3. there is a bug in usb subsystem

I'd vote for 3 (with an option on 1, just in case).

> > It would be good if someone who have a deeper knowledge than me on these
> > fields could give some hints or debug patches which would lead us closer
> > to the solution.
>
> Márton,
>
> I did a test yesterday night with 2.6.29-rc6. The em28xx in-kernel still
> has same problem we focused a while ago (except that, before, memory were
> going exausted on a much higher rate, and we had memory leaks for every
> close() call).
>
> What happens is that, sometimes, memory are not being freed by
> usb_kill_urb()/usb_unlink_urb(). I'm trying to debug it right now, to
> understand what's happening.

Could this

http://article.gmane.org/gmane.linux.usb.general/15315/match=urb+leak

be related ?

Cheers,

Laurent Pinchart


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

* Re: [Bugme-new] [Bug 12768] New: usb_alloc_urb() leaks memory together with uvcvideo driver
  2009-02-25 21:55               ` Laurent Pinchart
@ 2009-02-26  1:39                 ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 10+ messages in thread
From: Mauro Carvalho Chehab @ 2009-02-26  1:39 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Németh Márton, Markus Rechberger, Andrew Morton,
	linux-media, bugme-daemon

On Wed, 25 Feb 2009 22:55:43 +0100
Laurent Pinchart <laurent.pinchart@skynet.be> wrote:

> Could this
> 
> http://article.gmane.org/gmane.linux.usb.general/15315/match=urb+leak
> 
> be related ?

This seems to solve the bug with the em28xx driver. I'll let the stress test
run over the night and see if is everything is all right.

Cheers,
Mauro

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

end of thread, other threads:[~2009-02-26  1:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <bug-12768-10286@http.bugzilla.kernel.org/>
2009-02-24 21:57 ` [Bugme-new] [Bug 12768] New: usb_alloc_urb() leaks memory together with uvcvideo driver Andrew Morton
2009-02-24 22:37   ` Markus Rechberger
2009-02-25  2:02   ` Mauro Carvalho Chehab
2009-02-25  2:15     ` Markus Rechberger
2009-02-25  3:23       ` Andrew Morton
2009-02-25  3:35         ` Markus Rechberger
2009-02-25  7:44           ` Németh Márton
2009-02-25 12:49             ` Mauro Carvalho Chehab
2009-02-25 21:55               ` Laurent Pinchart
2009-02-26  1:39                 ` Mauro Carvalho Chehab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox