# \[PATCH\] usbmouse: random freeze/hangup; synchronize irq completion

- List: linux-input
- 3 messages, 3 authors
- Page: https://ratatoskr.run/linux-input/2011/02/8916136/t

## \[PATCH\] usbmouse: random freeze/hangup; synchronize irq completion

- From: Jordi Pujol \<hidden\>
- Date: 2011-02-14 08:51:00 
- Message: https://ratatoskr.run/linux-input/2011/02/8916136.md

```text
Hello,

usbmouse: synchonize the irq completion for each urb.

Without this patch the mouse was a bit erratic and when
using the mouse the system gets freezed/hangup randomly (one or two times a 
day).

Jordi Pujol

Live never ending Tale
GNU/Linux Live forever!
http://livenet.selfip.com
```

## Re: \[PATCH\] usbmouse: random freeze/hangup; synchronize irq completion

- From: Alan Stern \<stern@rowland.harvard.edu\>
- Date: 2011-02-14 15:00:25 
- Message: https://ratatoskr.run/linux-input/2011/02/8916142.md

```text
On Mon, 14 Feb 2011, Jordi Pujol wrote:

> Hello,
> 
> usbmouse: synchonize the irq completion for each urb.
> 
> Without this patch the mouse was a bit erratic and when
> using the mouse the system gets freezed/hangup randomly (one or two times a 
> day).

Your patch is no good, for quite a few reasons.  I'll state only two of 
them:

	It calls mutex_lock(), which can sleep, from within an URB
	completion routine, which runs with interrupts disabled.

	It doesn't synchronize the completion _with_ anything else,
	i.e., it calls mutex_lock() in only one place.

Whatever is causing your problem, this is not the proper solution.

Alan Stern

```

## Re: \[PATCH\] usbmouse: random freeze/hangup; synchronize irq completion

- From: Jordi Pujol \<hidden\>
- Date: 2011-02-15 10:30:39 
- Message: https://ratatoskr.run/linux-input/2011/02/8916149.md

```text
A Dilluns 14 Febrer 2011 16:00:24, Alan Stern va escriure:
> 	It calls mutex_lock(), which can sleep, from within an URB
> 	completion routine, which runs with interrupts disabled.
> 
> 	It doesn't synchronize the completion _with_ anything else,
> 	i.e., it calls mutex_lock() in only one place.
this routine is synchronized with himself.
I said synchronize thinking about synchronized routines that are pieces of 
code scheduled to be executed only in a single thread simultaneously; 
therefore a new call to this routine can not be executed until a previous call 
has been completed.

> 
> Whatever is causing your problem, this is not the proper solution.
Yes, that this is not a patch to be included in the kernel, it's only a 
testing patch, but it solves the hangup. and so this probes that there is some 
kind of problem related to the urb update process; I think the problem should 
be external to this routine.

searching the web, some people has found problems like this, example:
- [ubuntu] Ubuntu 10.04 (Lucid Lynx) Random Freeze / Hang-up

Consider this as an idea to point out the problem and, if possible, someone 
more expert help to look for a good solution.

Jordi Pujol

Live never ending Tale
GNU/Linux Live forever!
http://livenet.selfip.com
```
