Re: em28xx DEADLOCK reported by lock debug

2013-12-22 Thread Frank Schäfer
Am 22.12.2013 19:14, schrieb Antti Palosaari:
> On 22.12.2013 20:02, Frank Schäfer wrote:
>> Am 22.12.2013 15:34, schrieb Antti Palosaari:
>>> On 22.12.2013 15:51, Frank Schäfer wrote:
 Am 21.12.2013 20:55, schrieb Antti Palosaari:
> On 21.12.2013 18:51, Frank Schäfer wrote:
>> Hi Antti,
>>
>> thank you for reporting this issue.
>>
>> Am 18.12.2013 17:04, schrieb Antti Palosaari:
>>> That same lock debug deadlock is still there (maybe ~4 times I
>>> report
>>> it during 2 years). Is that possible to fix easily at all?
>>
>> Patches are always welcome. ;)
>
> haha, I cannot simply learn every driver I meet some problems...
 Hint:

 If you report a bug ~4 times in 2 years but never get a reply, it
 usually means
 a) nobody cares
 b) nobody has the resources (time, knowledge) to fix it.

 So you either have to live with this issue or to fix it yourself.
>>>
>>> OK, as you request me to fix it, I will fix that by making DVB USB v2
>>> driver for these em28xx devices I have added.
>>>
>>> It should not be very much work as em28xx protocol is still relatively
>>> easy.
>> How would that help to get those lockdep false warnings fixed ?
>> Btw: these warnings should appear for _all_ em28xx extensions (dvb,
>> input, audio).
>
> I am already looking to silence that v4l2 lockdep report. It is hard
> to say how much it is work as I simply don't know even reasons.
>
> I suspect that if I start learning and fixing em28xx driver it will
> take week or two as a workload. Writing new dvb-usb driver is only max
> 2 days of work and as a bonus you will get some missing features for
> free:
> 1) power-management
> 2) suspend/resume
> 3) PID filters
Sure, but we already have a driver for these devices.
I agree with you that em28xx is a big mess, but at least in this case it
doesn't do anything wrong.
Does this false warning really make you so nervous that you're willing
to spent 2 days for it ?
I appreciate that, but I suggest to spend these 2 days for fixing the
issue instead of just avoiding it.

Regards,
Frank

>
> regards
> Antti
>

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


Re: em28xx DEADLOCK reported by lock debug

2013-12-22 Thread Antti Palosaari

On 22.12.2013 20:02, Frank Schäfer wrote:

Am 22.12.2013 15:34, schrieb Antti Palosaari:

On 22.12.2013 15:51, Frank Schäfer wrote:

Am 21.12.2013 20:55, schrieb Antti Palosaari:

On 21.12.2013 18:51, Frank Schäfer wrote:

Hi Antti,

thank you for reporting this issue.

Am 18.12.2013 17:04, schrieb Antti Palosaari:

That same lock debug deadlock is still there (maybe ~4 times I report
it during 2 years). Is that possible to fix easily at all?


Patches are always welcome. ;)


haha, I cannot simply learn every driver I meet some problems...

Hint:

If you report a bug ~4 times in 2 years but never get a reply, it
usually means
a) nobody cares
b) nobody has the resources (time, knowledge) to fix it.

So you either have to live with this issue or to fix it yourself.


OK, as you request me to fix it, I will fix that by making DVB USB v2
driver for these em28xx devices I have added.

It should not be very much work as em28xx protocol is still relatively
easy.

How would that help to get those lockdep false warnings fixed ?
Btw: these warnings should appear for _all_ em28xx extensions (dvb,
input, audio).


I am already looking to silence that v4l2 lockdep report. It is hard to 
say how much it is work as I simply don't know even reasons.


I suspect that if I start learning and fixing em28xx driver it will take 
week or two as a workload. Writing new dvb-usb driver is only max 2 days 
of work and as a bonus you will get some missing features for free:

1) power-management
2) suspend/resume
3) PID filters

regards
Antti

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


Re: em28xx DEADLOCK reported by lock debug

2013-12-22 Thread Frank Schäfer
Am 22.12.2013 15:53, schrieb Mauro Carvalho Chehab:
> Em Sun, 22 Dec 2013 14:51:53 +0100
> Frank Schäfer  escreveu:
>
>> Am 21.12.2013 20:55, schrieb Antti Palosaari:
>>> On 21.12.2013 18:51, Frank Schäfer wrote:
 Hi Antti,

 thank you for reporting this issue.

 Am 18.12.2013 17:04, schrieb Antti Palosaari:
> That same lock debug deadlock is still there (maybe ~4 times I report
> it during 2 years). Is that possible to fix easily at all?
 Patches are always welcome. ;)
>>> haha, I cannot simply learn every driver I meet some problems...
>> Hint:
>>
>> If you report a bug ~4 times in 2 years but never get a reply, it
>> usually means
>> a) nobody cares
>> b) nobody has the resources (time, knowledge) to fix it.
>>
>> So you either have to live with this issue or to fix it yourself.
> It is the latter case: fixing it require lots of efforts.
Yes, I know. ;-)

> One way to fix would be to change em28xx_close_extension() to
> something like:
>
> diff --git a/drivers/media/usb/em28xx/em28xx-core.c 
> b/drivers/media/usb/em28xx/em28xx-core.c
> index f6076a512e8f..d938e2bbd62f 100644
> --- a/drivers/media/usb/em28xx/em28xx-core.c
> +++ b/drivers/media/usb/em28xx/em28xx-core.c
> @@ -1350,13 +1350,19 @@ void em28xx_init_extension(struct em28xx *dev)
>  
>  void em28xx_close_extension(struct em28xx *dev)
>  {
> + int (*fini)(struct em28xx *) = NULL;
>   const struct em28xx_ops *ops = NULL;
>  
>   mutex_lock(&em28xx_devlist_mutex);
>   list_for_each_entry(ops, &em28xx_extension_devlist, next) {
> - if (ops->fini)
> - ops->fini(dev);
> + fini = ops->fini;
>   }
>   list_del(&dev->devlist);
>   mutex_unlock(&em28xx_devlist_mutex);
> +
> + if (fini) {
> + mutex_lock(&dev->lock);
> + fini(dev);
> + mutex_unlock(&dev->lock);
> + }
>  }
>
> Please note that the above is not 100% correct, as one device may have
> more than one extension.
>
> Then, it should be sure that on every place that em28xx_close_extension()
> is called, dev->lock is not taken.
>
> As an alternative, eventually the extension list could be moved to the
> struct em28xx, but a device list is still needed, in order to handle
> extension module removal.
>
> Another way that would probably be better is to convert the em28xx
> code that handles extension (extension here is dvb, rc, alsa) to use
> krefs, And add a kref free code that would call ops->fini. Note that,
> in this case, dev itself would also need to be a kref.
>
> I suspect that using kref would would be cleaner, but a change like that
> would require to rewrite the extensions code.

I have zero knowledge about how the locking correctness stuff works, but
what about improving it ?
Shouldn't it notice that flush_work() waits until the work is done
before the lock is acquired ?

> Btw, there's a related RFC patchset that splits the V4L2 interface from
> em28xx, transforming it also into an extension. With such patch, a DVB 
> only device should not call any v4l2 init code, nor require V4L2 to be
> enabled:
>   https://patchwork.linuxtv.org/patch/17967/ 

Yes, I remember it and it would be a big step forward.

> The above RFC requires testing.
>
> I may be able to find some time to do work on it this end of the year,
> starting with the V4L2 split patchset, depending if I finish some other
> things already on my todo list.

I'm going to review the patch within the next days and do some testing.

Regards,
Frank

> Regards,
> Mauro

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


Re: em28xx DEADLOCK reported by lock debug

2013-12-22 Thread Frank Schäfer
Am 22.12.2013 15:34, schrieb Antti Palosaari:
> On 22.12.2013 15:51, Frank Schäfer wrote:
>> Am 21.12.2013 20:55, schrieb Antti Palosaari:
>>> On 21.12.2013 18:51, Frank Schäfer wrote:
 Hi Antti,

 thank you for reporting this issue.

 Am 18.12.2013 17:04, schrieb Antti Palosaari:
> That same lock debug deadlock is still there (maybe ~4 times I report
> it during 2 years). Is that possible to fix easily at all?

 Patches are always welcome. ;)
>>>
>>> haha, I cannot simply learn every driver I meet some problems...
>> Hint:
>>
>> If you report a bug ~4 times in 2 years but never get a reply, it
>> usually means
>> a) nobody cares
>> b) nobody has the resources (time, knowledge) to fix it.
>>
>> So you either have to live with this issue or to fix it yourself.
>
> OK, as you request me to fix it, I will fix that by making DVB USB v2
> driver for these em28xx devices I have added.
>
> It should not be very much work as em28xx protocol is still relatively
> easy.
How would that help to get those lockdep false warnings fixed ?
Btw: these warnings should appear for _all_ em28xx extensions (dvb,
input, audio).

Regards,
Frank


>
> regards
> Antti
>

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


Re: em28xx DEADLOCK reported by lock debug

2013-12-22 Thread Mauro Carvalho Chehab
Em Sun, 22 Dec 2013 14:51:53 +0100
Frank Schäfer  escreveu:

> Am 21.12.2013 20:55, schrieb Antti Palosaari:
> > On 21.12.2013 18:51, Frank Schäfer wrote:
> >> Hi Antti,
> >>
> >> thank you for reporting this issue.
> >>
> >> Am 18.12.2013 17:04, schrieb Antti Palosaari:
> >>> That same lock debug deadlock is still there (maybe ~4 times I report
> >>> it during 2 years). Is that possible to fix easily at all?
> >>
> >> Patches are always welcome. ;)
> >
> > haha, I cannot simply learn every driver I meet some problems...
> Hint:
> 
> If you report a bug ~4 times in 2 years but never get a reply, it
> usually means
> a) nobody cares
> b) nobody has the resources (time, knowledge) to fix it.
> 
> So you either have to live with this issue or to fix it yourself.

It is the latter case: fixing it require lots of efforts.

One way to fix would be to change em28xx_close_extension() to
something like:

diff --git a/drivers/media/usb/em28xx/em28xx-core.c 
b/drivers/media/usb/em28xx/em28xx-core.c
index f6076a512e8f..d938e2bbd62f 100644
--- a/drivers/media/usb/em28xx/em28xx-core.c
+++ b/drivers/media/usb/em28xx/em28xx-core.c
@@ -1350,13 +1350,19 @@ void em28xx_init_extension(struct em28xx *dev)
 
 void em28xx_close_extension(struct em28xx *dev)
 {
+   int (*fini)(struct em28xx *) = NULL;
const struct em28xx_ops *ops = NULL;
 
mutex_lock(&em28xx_devlist_mutex);
list_for_each_entry(ops, &em28xx_extension_devlist, next) {
-   if (ops->fini)
-   ops->fini(dev);
+   fini = ops->fini;
}
list_del(&dev->devlist);
mutex_unlock(&em28xx_devlist_mutex);
+
+   if (fini) {
+   mutex_lock(&dev->lock);
+   fini(dev);
+   mutex_unlock(&dev->lock);
+   }
 }

Please note that the above is not 100% correct, as one device may have
more than one extension.

Then, it should be sure that on every place that em28xx_close_extension()
is called, dev->lock is not taken.

As an alternative, eventually the extension list could be moved to the
struct em28xx, but a device list is still needed, in order to handle
extension module removal.

Another way that would probably be better is to convert the em28xx
code that handles extension (extension here is dvb, rc, alsa) to use
krefs, And add a kref free code that would call ops->fini. Note that,
in this case, dev itself would also need to be a kref.

I suspect that using kref would would be cleaner, but a change like that
would require to rewrite the extensions code.

Btw, there's a related RFC patchset that splits the V4L2 interface from
em28xx, transforming it also into an extension. With such patch, a DVB 
only device should not call any v4l2 init code, nor require V4L2 to be
enabled:
https://patchwork.linuxtv.org/patch/17967/ 

The above RFC requires testing.

I may be able to find some time to do work on it this end of the year,
starting with the V4L2 split patchset, depending if I finish some other
things already on my todo list.

Regards,
Mauro
-- 

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


Re: em28xx DEADLOCK reported by lock debug

2013-12-22 Thread Antti Palosaari

On 22.12.2013 15:51, Frank Schäfer wrote:

Am 21.12.2013 20:55, schrieb Antti Palosaari:

On 21.12.2013 18:51, Frank Schäfer wrote:

Hi Antti,

thank you for reporting this issue.

Am 18.12.2013 17:04, schrieb Antti Palosaari:

That same lock debug deadlock is still there (maybe ~4 times I report
it during 2 years). Is that possible to fix easily at all?


Patches are always welcome. ;)


haha, I cannot simply learn every driver I meet some problems...

Hint:

If you report a bug ~4 times in 2 years but never get a reply, it
usually means
a) nobody cares
b) nobody has the resources (time, knowledge) to fix it.

So you either have to live with this issue or to fix it yourself.


OK, as you request me to fix it, I will fix that by making DVB USB v2 
driver for these em28xx devices I have added.


It should not be very much work as em28xx protocol is still relatively easy.

regards
Antti

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


Re: em28xx DEADLOCK reported by lock debug

2013-12-22 Thread Frank Schäfer
Am 21.12.2013 20:55, schrieb Antti Palosaari:
> On 21.12.2013 18:51, Frank Schäfer wrote:
>> Hi Antti,
>>
>> thank you for reporting this issue.
>>
>> Am 18.12.2013 17:04, schrieb Antti Palosaari:
>>> That same lock debug deadlock is still there (maybe ~4 times I report
>>> it during 2 years). Is that possible to fix easily at all?
>>
>> Patches are always welcome. ;)
>
> haha, I cannot simply learn every driver I meet some problems...
Hint:

If you report a bug ~4 times in 2 years but never get a reply, it
usually means
a) nobody cares
b) nobody has the resources (time, knowledge) to fix it.

So you either have to live with this issue or to fix it yourself.

>
> But now, when V4L2 SDR module was added RTL28xxU DVB module I see
> quite similar looking bug warning here too :
>
> I wonder if that is same...
>
>
> joulu 21 21:49:19 localhost.localdomain kernel: usb 2-2:
> rtl2832_sdr_queue_setup: nbuffers=32 sizes[0]=131072
> joulu 21 21:49:19 localhost.localdomain kernel: joulu 21 21:49:19
> localhost.localdomain kernel:
> ==
> joulu 21 21:49:19 localhost.localdomain kernel: [ INFO: possible
> circular locking dependency detected ]
> joulu 21 21:49:19 localhost.localdomain kernel: 3.13.0-rc1+ #77
> Tainted: G C O
> joulu 21 21:49:19 localhost.localdomain kernel:
> ---
> joulu 21 21:49:19 localhost.localdomain kernel: python/15284 is trying
> to acquire lock:
> joulu 21 21:49:19 localhost.localdomain kernel:
> (&s->vb_queue_lock){+.+.+.}, at: []
> vb2_fop_mmap+0x33/0x90 [videobuf2_core]
> joulu 21 21:49:19 localhost.localdomain kernel:
> but task is already
> holding lock:
> joulu 21 21:49:19 localhost.localdomain kernel:
> (&mm->mmap_sem){++}, at: [] vm_mmap_pgoff+0x6f/0xc0
> joulu 21 21:49:19 localhost.localdomain kernel:
> which lock already
> depends on the new lock.
> joulu 21 21:49:19 localhost.localdomain kernel:
> the existing
> dependency chain (in reverse order) is:
> joulu 21 21:49:19 localhost.localdomain kernel:
> -> #1
> (&mm->mmap_sem){++}:
> joulu 21 21:49:19 localhost.localdomain kernel: []
> __lock_acquire+0x3d6/0xc40
> joulu 21 21:49:19 localhost.localdomain kernel: []
> lock_acquire+0xb0/0x150
> joulu 21 21:49:19 localhost.localdomain kernel: []
> might_fault+0x8c/0xb0
> joulu 21 21:49:19 localhost.localdomain kernel: []
> video_usercopy+0xba/0x4e0 [videodev]
> joulu 21 21:49:19 localhost.localdomain kernel: []
> video_ioctl2+0x15/0x20 [videodev]
> joulu 21 21:49:19 localhost.localdomain kernel: []
> v4l2_ioctl+0x153/0x240 [videodev]
> joulu 21 21:49:19 localhost.localdomain kernel: []
> do_vfs_ioctl+0x300/0x520
> joulu 21 21:49:19 localhost.localdomain kernel: []
> SyS_ioctl+0x81/0xa0
> joulu 21 21:49:19 localhost.localdomain kernel: []
> system_call_fastpath+0x16/0x1b
> joulu 21 21:49:19 localhost.localdomain kernel:
> -> #0
> (&s->vb_queue_lock){+.+.+.}:
> joulu 21 21:49:19 localhost.localdomain kernel: []
> validate_chain.isra.36+0x10d7/0x1130
> joulu 21 21:49:19 localhost.localdomain kernel: []
> __lock_acquire+0x3d6/0xc40
> joulu 21 21:49:19 localhost.localdomain kernel: []
> lock_acquire+0xb0/0x150
> joulu 21 21:49:19 localhost.localdomain kernel: []
> mutex_lock_interruptible_nested+0x77/0x460
> joulu 21 21:49:19 localhost.localdomain kernel: []
> vb2_fop_mmap+0x33/0x90 [videobuf2_core]
> joulu 21 21:49:19 localhost.localdomain kernel: []
> v4l2_mmap+0x5a/0xa0 [videodev]
> joulu 21 21:49:19 localhost.localdomain kernel: []
> mmap_region+0x3cd/0x5a0
> joulu 21 21:49:19 localhost.localdomain kernel: []
> do_mmap_pgoff+0x357/0x3e0
> joulu 21 21:49:19 localhost.localdomain kernel: []
> vm_mmap_pgoff+0x90/0xc0
> joulu 21 21:49:19 localhost.localdomain kernel: []
> SyS_mmap_pgoff+0x1d3/0x270
> joulu 21 21:49:19 localhost.localdomain kernel: []
> SyS_mmap+0x22/0x30
> joulu 21 21:49:19 localhost.localdomain kernel: []
> system_call_fastpath+0x16/0x1b
> joulu 21 21:49:19 localhost.localdomain kernel:
> other info that might
> help us debug this:
> joulu 21 21:49:19 localhost.localdomain kernel:  Possible unsafe
> locking scenario:
> joulu 21 21:49:19 localhost.localdomain kernel:CPU0CPU1
> joulu 21 21:49:19 localhost.localdomain kernel:
> joulu 21 21:49:19 localhost.localdomain kernel:   lock(&mm->mmap_sem);
> joulu 21 21:49:19 localhost.localdomain kernel:   
> lock(&s->vb_queue_lock);
> joulu 21 21:49:19 localhost.localdomain kernel:   
> lock(&mm->mmap_sem);
> joulu 21 21:49:19 localhost.localdomain kernel:  
> lock(&s->vb_queue_lock);
> joulu 21 21:49:19 localhost.localdomain kernel:
>  *** D

Re: em28xx DEADLOCK reported by lock debug

2013-12-21 Thread Antti Palosaari

On 21.12.2013 18:51, Frank Schäfer wrote:

Hi Antti,

thank you for reporting this issue.

Am 18.12.2013 17:04, schrieb Antti Palosaari:

That same lock debug deadlock is still there (maybe ~4 times I report
it during 2 years). Is that possible to fix easily at all?


Patches are always welcome. ;)


haha, I cannot simply learn every driver I meet some problems...

But now, when V4L2 SDR module was added RTL28xxU DVB module I see quite 
similar looking bug warning here too :S


I wonder if that is same...


joulu 21 21:49:19 localhost.localdomain kernel: usb 2-2: 
rtl2832_sdr_queue_setup: nbuffers=32 sizes[0]=131072
joulu 21 21:49:19 localhost.localdomain kernel: joulu 21 21:49:19 
localhost.localdomain kernel: 
==
joulu 21 21:49:19 localhost.localdomain kernel: [ INFO: possible 
circular locking dependency detected ]
joulu 21 21:49:19 localhost.localdomain kernel: 3.13.0-rc1+ #77 Tainted: 
G C O
joulu 21 21:49:19 localhost.localdomain kernel: 
---
joulu 21 21:49:19 localhost.localdomain kernel: python/15284 is trying 
to acquire lock:
joulu 21 21:49:19 localhost.localdomain kernel: 
(&s->vb_queue_lock){+.+.+.}, at: [] 
vb2_fop_mmap+0x33/0x90 [videobuf2_core]

joulu 21 21:49:19 localhost.localdomain kernel:
but task is already 
holding lock:
joulu 21 21:49:19 localhost.localdomain kernel: 
(&mm->mmap_sem){++}, at: [] vm_mmap_pgoff+0x6f/0xc0

joulu 21 21:49:19 localhost.localdomain kernel:
which lock already 
depends on the new lock.

joulu 21 21:49:19 localhost.localdomain kernel:
the existing dependency 
chain (in reverse order) is:

joulu 21 21:49:19 localhost.localdomain kernel:
-> #1 
(&mm->mmap_sem){++}:
joulu 21 21:49:19 localhost.localdomain kernel: 
[] __lock_acquire+0x3d6/0xc40
joulu 21 21:49:19 localhost.localdomain kernel: 
[] lock_acquire+0xb0/0x150
joulu 21 21:49:19 localhost.localdomain kernel: 
[] might_fault+0x8c/0xb0
joulu 21 21:49:19 localhost.localdomain kernel: 
[] video_usercopy+0xba/0x4e0 [videodev]
joulu 21 21:49:19 localhost.localdomain kernel: 
[] video_ioctl2+0x15/0x20 [videodev]
joulu 21 21:49:19 localhost.localdomain kernel: 
[] v4l2_ioctl+0x153/0x240 [videodev]
joulu 21 21:49:19 localhost.localdomain kernel: 
[] do_vfs_ioctl+0x300/0x520
joulu 21 21:49:19 localhost.localdomain kernel: 
[] SyS_ioctl+0x81/0xa0
joulu 21 21:49:19 localhost.localdomain kernel: 
[] system_call_fastpath+0x16/0x1b

joulu 21 21:49:19 localhost.localdomain kernel:
-> #0 
(&s->vb_queue_lock){+.+.+.}:
joulu 21 21:49:19 localhost.localdomain kernel: 
[] validate_chain.isra.36+0x10d7/0x1130
joulu 21 21:49:19 localhost.localdomain kernel: 
[] __lock_acquire+0x3d6/0xc40
joulu 21 21:49:19 localhost.localdomain kernel: 
[] lock_acquire+0xb0/0x150
joulu 21 21:49:19 localhost.localdomain kernel: 
[] mutex_lock_interruptible_nested+0x77/0x460
joulu 21 21:49:19 localhost.localdomain kernel: 
[] vb2_fop_mmap+0x33/0x90 [videobuf2_core]
joulu 21 21:49:19 localhost.localdomain kernel: 
[] v4l2_mmap+0x5a/0xa0 [videodev]
joulu 21 21:49:19 localhost.localdomain kernel: 
[] mmap_region+0x3cd/0x5a0
joulu 21 21:49:19 localhost.localdomain kernel: 
[] do_mmap_pgoff+0x357/0x3e0
joulu 21 21:49:19 localhost.localdomain kernel: 
[] vm_mmap_pgoff+0x90/0xc0
joulu 21 21:49:19 localhost.localdomain kernel: 
[] SyS_mmap_pgoff+0x1d3/0x270
joulu 21 21:49:19 localhost.localdomain kernel: 
[] SyS_mmap+0x22/0x30
joulu 21 21:49:19 localhost.localdomain kernel: 
[] system_call_fastpath+0x16/0x1b

joulu 21 21:49:19 localhost.localdomain kernel:
other info that might 
help us debug this:
joulu 21 21:49:19 localhost.localdomain kernel:  Possible unsafe locking 
scenario:
joulu 21 21:49:19 localhost.localdomain kernel:CPU0 
   CPU1
joulu 21 21:49:19 localhost.localdomain kernel: 
   

joulu 21 21:49:19 localhost.localdomain kernel:   lock(&mm->mmap_sem);
joulu 21 21:49:19 localhost.localdomain kernel: 
   lock(&s->vb_queue_lock);
joulu 21 21:49:19 localhost.localdomain kernel: 
   lock(&mm->mmap_sem);

joulu 21 21:49:19 localhost.localdomain kernel:   lock(&s->vb_queue_lock);
joulu 21 21:49:19 localhost.localdomain kernel:
 *** DEADLOCK ***
joulu 21 21:49:19 localhost.localdomain kernel: 1 lock held by python/15284:
joulu 21 21:49:19 localhost.localdomain kernel:  #0: 
(&mm->mmap_sem){++}, at: [] vm_mmap_pgoff+0x6f/0xc0

joulu 21 21:49:19 localhost.localdomain kernel:
stack backtrace:
joulu 21 21:49:19 localhost.localdomain kernel: CPU: 3 PID: 15284 Comm: 
python Tainted: G C O 3.13.0-rc1+ #77
joulu 2

Re: em28xx DEADLOCK reported by lock debug

2013-12-21 Thread Frank Schäfer
Hi Antti,

thank you for reporting this issue.

Am 18.12.2013 17:04, schrieb Antti Palosaari:
> That same lock debug deadlock is still there (maybe ~4 times I report
> it during 2 years). Is that possible to fix easily at all?

Patches are always welcome. ;)

>
>
> Antti
>
>
>
> joulu 18 17:56:37 localhost.localdomain kernel: usb 2-2: USB
> disconnect, device number 2
> joulu 18 17:56:37 localhost.localdomain kernel: em28174 #0:
> disconnecting em28174 #0 video
> joulu 18 17:56:37 localhost.localdomain kernel: joulu 18 17:56:37
> localhost.localdomain kernel:
> ==
> joulu 18 17:56:37 localhost.localdomain kernel: [ INFO: possible
> circular locking dependency detected ]
> joulu 18 17:56:37 localhost.localdomain kernel: 3.13.0-rc1+ #77
> Tainted: G C O
> joulu 18 17:56:37 localhost.localdomain kernel:
> ---
> joulu 18 17:56:37 localhost.localdomain kernel: khubd/34 is trying to
> acquire lock:
> joulu 18 17:56:37 localhost.localdomain kernel:
> (em28xx_devlist_mutex){+.+.+.}, at: []
> em28xx_close_extension+0x1d/0x70 [em28xx]
> joulu 18 17:56:37 localhost.localdomain kernel:
> but task is already
> holding lock:
> joulu 18 17:56:37 localhost.localdomain kernel:  (&dev->lock){+.+.+.},
> at: [] em28xx_usb_disconnect+0x99/0x140 [em28xx]
> joulu 18 17:56:37 localhost.localdomain kernel:
> which lock already
> depends on the new lock.
> joulu 18 17:56:37 localhost.localdomain kernel:
> the existing
> dependency chain (in reverse order) is:
> joulu 18 17:56:37 localhost.localdomain kernel:
> -> #1
> (&dev->lock){+.+.+.}:
> joulu 18 17:56:37 localhost.localdomain kernel: []
> __lock_acquire+0x3d6/0xc40
> joulu 18 17:56:37 localhost.localdomain kernel: []
> lock_acquire+0xb0/0x150
> joulu 18 17:56:37 localhost.localdomain kernel: []
> mutex_lock_nested+0x77/0x3d0
> joulu 18 17:56:37 localhost.localdomain kernel: []
> em28xx_dvb_init+0x85/0x1b44 [em28xx_dvb]
> joulu 18 17:56:37 localhost.localdomain kernel: []
> em28xx_register_extension+0x58/0xa0 [em28xx]
> joulu 18 17:56:37 localhost.localdomain kernel: []
> 0xa0783010
> joulu 18 17:56:37 localhost.localdomain kernel: []
> do_one_initcall+0xfa/0x1b0
> joulu 18 17:56:37 localhost.localdomain kernel: []
> load_module+0x13c2/0x1a80
> joulu 18 17:56:37 localhost.localdomain kernel: []
> SyS_finit_module+0x86/0xb0
> joulu 18 17:56:37 localhost.localdomain kernel: []
> system_call_fastpath+0x16/0x1b
> joulu 18 17:56:37 localhost.localdomain kernel:
> -> #0
> (em28xx_devlist_mutex){+.+.+.}:
> joulu 18 17:56:37 localhost.localdomain kernel: []
> validate_chain.isra.36+0x10d7/0x1130
> joulu 18 17:56:37 localhost.localdomain kernel: []
> __lock_acquire+0x3d6/0xc40
> joulu 18 17:56:37 localhost.localdomain kernel: []
> lock_acquire+0xb0/0x150
> joulu 18 17:56:37 localhost.localdomain kernel: []
> mutex_lock_nested+0x77/0x3d0
> joulu 18 17:56:37 localhost.localdomain kernel: []
> em28xx_close_extension+0x1d/0x70 [em28xx]
> joulu 18 17:56:37 localhost.localdomain kernel: []
> em28xx_usb_disconnect+0xb3/0x140 [em28xx]
> joulu 18 17:56:37 localhost.localdomain kernel: []
> usb_unbind_interface+0x67/0x1d0
> joulu 18 17:56:37 localhost.localdomain kernel: []
> __device_release_driver+0x7f/0xf0
> joulu 18 17:56:37 localhost.localdomain kernel: []
> device_release_driver+0x25/0x40
> joulu 18 17:56:37 localhost.localdomain kernel: []
> bus_remove_device+0x11c/0x1a0
> joulu 18 17:56:37 localhost.localdomain kernel: []
> device_del+0x136/0x1d0
> joulu 18 17:56:37 localhost.localdomain kernel: []
> usb_disable_device+0xb0/0x290
> joulu 18 17:56:37 localhost.localdomain kernel: []
> usb_disconnect+0xb5/0x1d0
> joulu 18 17:56:37 localhost.localdomain kernel: []
> hub_port_connect_change+0xd6/0xad0
> joulu 18 17:56:37 localhost.localdomain kernel: []
> hub_events+0x313/0x9b0
> joulu 18 17:56:37 localhost.localdomain kernel: []
> hub_thread+0x35/0x190
> joulu 18 17:56:37 localhost.localdomain kernel: []
> kthread+0xff/0x120
> joulu 18 17:56:37 localhost.localdomain kernel: []
> ret_from_fork+0x7c/0xb0
> joulu 18 17:56:37 localhost.localdomain kernel:
> other info that might
> help us debug this:
> joulu 18 17:56:37 localhost.localdomain kernel:  Possible unsafe
> locking scenario:
> joulu 18 17:56:37 localhost.localdomain kernel:CPU0CPU1
> joulu 18 17:56:37 localhost.localdomain kernel:
> joulu 18 17:56:37 localhost.localdomain kernel:   lock(&dev->lock);
> joulu 18 17:56:37 localhost.localdomain kernel:   
> lock(em28xx_devlist_mutex);
> joulu 18 17:56:37 localhost.localdomain kernel:lock(&dev->lock);
> joulu 18 17:56:37 localhost.localdo

em28xx DEADLOCK reported by lock debug

2013-12-18 Thread Antti Palosaari
That same lock debug deadlock is still there (maybe ~4 times I report it 
during 2 years). Is that possible to fix easily at all?



Antti



joulu 18 17:56:37 localhost.localdomain kernel: usb 2-2: USB disconnect, 
device number 2
joulu 18 17:56:37 localhost.localdomain kernel: em28174 #0: 
disconnecting em28174 #0 video
joulu 18 17:56:37 localhost.localdomain kernel: joulu 18 17:56:37 
localhost.localdomain kernel: 
==
joulu 18 17:56:37 localhost.localdomain kernel: [ INFO: possible 
circular locking dependency detected ]
joulu 18 17:56:37 localhost.localdomain kernel: 3.13.0-rc1+ #77 Tainted: 
G C O
joulu 18 17:56:37 localhost.localdomain kernel: 
---
joulu 18 17:56:37 localhost.localdomain kernel: khubd/34 is trying to 
acquire lock:
joulu 18 17:56:37 localhost.localdomain kernel: 
(em28xx_devlist_mutex){+.+.+.}, at: [] 
em28xx_close_extension+0x1d/0x70 [em28xx]

joulu 18 17:56:37 localhost.localdomain kernel:
but task is already 
holding lock:
joulu 18 17:56:37 localhost.localdomain kernel:  (&dev->lock){+.+.+.}, 
at: [] em28xx_usb_disconnect+0x99/0x140 [em28xx]

joulu 18 17:56:37 localhost.localdomain kernel:
which lock already 
depends on the new lock.

joulu 18 17:56:37 localhost.localdomain kernel:
the existing dependency 
chain (in reverse order) is:

joulu 18 17:56:37 localhost.localdomain kernel:
-> #1 (&dev->lock){+.+.+.}:
joulu 18 17:56:37 localhost.localdomain kernel: 
[] __lock_acquire+0x3d6/0xc40
joulu 18 17:56:37 localhost.localdomain kernel: 
[] lock_acquire+0xb0/0x150
joulu 18 17:56:37 localhost.localdomain kernel: 
[] mutex_lock_nested+0x77/0x3d0
joulu 18 17:56:37 localhost.localdomain kernel: 
[] em28xx_dvb_init+0x85/0x1b44 [em28xx_dvb]
joulu 18 17:56:37 localhost.localdomain kernel: 
[] em28xx_register_extension+0x58/0xa0 [em28xx]
joulu 18 17:56:37 localhost.localdomain kernel: 
[] 0xa0783010
joulu 18 17:56:37 localhost.localdomain kernel: 
[] do_one_initcall+0xfa/0x1b0
joulu 18 17:56:37 localhost.localdomain kernel: 
[] load_module+0x13c2/0x1a80
joulu 18 17:56:37 localhost.localdomain kernel: 
[] SyS_finit_module+0x86/0xb0
joulu 18 17:56:37 localhost.localdomain kernel: 
[] system_call_fastpath+0x16/0x1b

joulu 18 17:56:37 localhost.localdomain kernel:
-> #0 
(em28xx_devlist_mutex){+.+.+.}:
joulu 18 17:56:37 localhost.localdomain kernel: 
[] validate_chain.isra.36+0x10d7/0x1130
joulu 18 17:56:37 localhost.localdomain kernel: 
[] __lock_acquire+0x3d6/0xc40
joulu 18 17:56:37 localhost.localdomain kernel: 
[] lock_acquire+0xb0/0x150
joulu 18 17:56:37 localhost.localdomain kernel: 
[] mutex_lock_nested+0x77/0x3d0
joulu 18 17:56:37 localhost.localdomain kernel: 
[] em28xx_close_extension+0x1d/0x70 [em28xx]
joulu 18 17:56:37 localhost.localdomain kernel: 
[] em28xx_usb_disconnect+0xb3/0x140 [em28xx]
joulu 18 17:56:37 localhost.localdomain kernel: 
[] usb_unbind_interface+0x67/0x1d0
joulu 18 17:56:37 localhost.localdomain kernel: 
[] __device_release_driver+0x7f/0xf0
joulu 18 17:56:37 localhost.localdomain kernel: 
[] device_release_driver+0x25/0x40
joulu 18 17:56:37 localhost.localdomain kernel: 
[] bus_remove_device+0x11c/0x1a0
joulu 18 17:56:37 localhost.localdomain kernel: 
[] device_del+0x136/0x1d0
joulu 18 17:56:37 localhost.localdomain kernel: 
[] usb_disable_device+0xb0/0x290
joulu 18 17:56:37 localhost.localdomain kernel: 
[] usb_disconnect+0xb5/0x1d0
joulu 18 17:56:37 localhost.localdomain kernel: 
[] hub_port_connect_change+0xd6/0xad0
joulu 18 17:56:37 localhost.localdomain kernel: 
[] hub_events+0x313/0x9b0
joulu 18 17:56:37 localhost.localdomain kernel: 
[] hub_thread+0x35/0x190
joulu 18 17:56:37 localhost.localdomain kernel: 
[] kthread+0xff/0x120
joulu 18 17:56:37 localhost.localdomain kernel: 
[] ret_from_fork+0x7c/0xb0

joulu 18 17:56:37 localhost.localdomain kernel:
other info that might 
help us debug this:
joulu 18 17:56:37 localhost.localdomain kernel:  Possible unsafe locking 
scenario:
joulu 18 17:56:37 localhost.localdomain kernel:CPU0 
   CPU1
joulu 18 17:56:37 localhost.localdomain kernel: 
   

joulu 18 17:56:37 localhost.localdomain kernel:   lock(&dev->lock);
joulu 18 17:56:37 localhost.localdomain kernel: 
   lock(em28xx_devlist_mutex);
joulu 18 17:56:37 localhost.localdomain kernel: 
   lock(&dev->lock);
joulu 18 17:56:37 localhost.localdomain kernel: 
lock(em28xx_devlist_mutex);

joulu 18 17:56:37 localhost.localdomain kernel:
 *** DEADLOCK ***
joulu 18 17:56:37 localhost.localdomain kernel: 4 locks held by khubd/34:
joulu 18 17:56:37 localhost.localdomain kernel:  #0: 
(