netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* small design problem with hso driver
@ 2008-10-08 13:52 Denis Joseph Barrow
       [not found] ` <48ECBB26.7080402-x9gZzRpC1QbQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Denis Joseph Barrow @ 2008-10-08 13:52 UTC (permalink / raw)
  To: Linux USB kernel mailing list, Linux netdev Mailing list

Hi,
I'm getting a fairly consistently reproducable problem
with the 3g modem hso driver. The most reproducable
bug I have.

It happens when I plug out the usb modem & ctrl-c
out of an ioctl call with the modem connected in paralell over ppp
with wvdial 

Basically whats happening is the hso_serial_close
is being called more times than the hso_serial_open &
I don't know why.

I can put in a kludge to cure the symptom which would prevent the crash
but it would be nice to know why this might be
happening.


-- 
best regards,
D.J. Barrow
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: small design problem with hso driver
       [not found] ` <48ECBB26.7080402-x9gZzRpC1QbQT0dZR+AlfA@public.gmane.org>
@ 2008-10-08 17:45   ` Greg KH
       [not found]     ` <20081008174556.GA15387-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2008-10-08 17:45 UTC (permalink / raw)
  To: Denis Joseph Barrow
  Cc: Linux USB kernel mailing list, Linux netdev Mailing list

On Wed, Oct 08, 2008 at 03:52:38PM +0200, Denis Joseph Barrow wrote:
> Hi,
> I'm getting a fairly consistently reproducable problem
> with the 3g modem hso driver. The most reproducable
> bug I have.
> 
> It happens when I plug out the usb modem & ctrl-c
> out of an ioctl call with the modem connected in paralell over ppp
> with wvdial 
> 
> Basically whats happening is the hso_serial_close
> is being called more times than the hso_serial_open &
> I don't know why.

Care to put a trace or printk() to determine who is doing each open and
close?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: small design problem with hso driver
       [not found]     ` <20081008174556.GA15387-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
@ 2008-10-09  9:01       ` Denis Joseph Barrow
       [not found]         ` <48EDC887.8010403-x9gZzRpC1QbQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Denis Joseph Barrow @ 2008-10-09  9:01 UTC (permalink / raw)
  To: Greg KH, Alan Cox
  Cc: Linux USB kernel mailing list, Linux netdev Mailing list

Hi,
I've found something suspicous but am not sure if
it's my problem. It looks like it when I'm
doing a gdb debug session but I can't believe
code so wrong can get into the kernel
& it didn't cause problems before.

Have a look at /drivers/char/tty_io.c

tty_open

around line 2234 this calls
tty->ops->open which calls hso_serial_open
& if this returns an error i.e. -ENODEV
release_dev is called which calls in tty_open
which calls tty->ops_close around line 2003 in tty_io.c.

Surely if the driver returns an error code on hso_serial_open
hso_serial_close shouldn't be called
or have I a complete misunderstanding
of char driver semantics.

Greg KH wrote:
> On Wed, Oct 08, 2008 at 03:52:38PM +0200, Denis Joseph Barrow wrote:
>> Hi,
>> I'm getting a fairly consistently reproducable problem
>> with the 3g modem hso driver. The most reproducable
>> bug I have.
>>
>> It happens when I plug out the usb modem & ctrl-c
>> out of an ioctl call with the modem connected in paralell over ppp
>> with wvdial 
>>
>> Basically whats happening is the hso_serial_close
>> is being called more times than the hso_serial_open &
>> I don't know why.
> 
> Care to put a trace or printk() to determine who is doing each open and
> close?
> 
> thanks,
> 
> greg k-h


-- 
best regards,
D.J. Barrow
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: small design problem with hso driver
       [not found]         ` <48EDC887.8010403-x9gZzRpC1QbQT0dZR+AlfA@public.gmane.org>
@ 2008-10-09  9:32           ` Alan Cox
       [not found]             ` <20081009103259.066cc94a-qBU/x9rampVanCEyBjwyrvXRex20P6io@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Cox @ 2008-10-09  9:32 UTC (permalink / raw)
  To: Denis Joseph Barrow
  Cc: Greg KH, Linux USB kernel mailing list, Linux netdev Mailing list

> Surely if the driver returns an error code on hso_serial_open
> hso_serial_close shouldn't be called
> or have I a complete misunderstanding
> of char driver semantics.

Generally yes that would be sane. The tty layer has always called the
close method of drivers on a failed open and the drivers are all written
assuming that.

It would be nice to change but there are far bigger fish to fry.

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

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

* Re: small design problem with hso driver
       [not found]             ` <20081009103259.066cc94a-qBU/x9rampVanCEyBjwyrvXRex20P6io@public.gmane.org>
@ 2008-10-09  9:56               ` Denis Joseph Barrow
       [not found]                 ` <48EDD556.1070508-x9gZzRpC1QbQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Denis Joseph Barrow @ 2008-10-09  9:56 UTC (permalink / raw)
  To: Alan Cox, Filip Aben, Andrew Bird, Paul Hardwick
  Cc: Greg KH, Linux USB kernel mailing list, Linux netdev Mailing list

Hi Alan,
No they are not.
Have a look at.
/drivers/char/nozomi.c
admittedly it's written by some of the same guys.
/* Called when the userspace process opens the tty, /dev/noz*.  */
static int ntty_open(struct tty_struct *tty, struct file *file)
{
	struct port *port = get_port_by_tty(tty);
	struct nozomi *dc = get_dc_by_tty(tty);
	unsigned long flags;

	if (!port || !dc || dc->state != NOZOMI_STATE_READY)
		return -ENODEV;

	if (mutex_lock_interruptible(&port->tty_sem))
		return -ERESTARTSYS;

	port->tty_open_count++;
	dc->open_ttys++;

	/* Enable interrupt downlink for channel */
	if (port->tty_open_count == 1) {
		tty->low_latency = 1;
		tty->driver_data = port;
		port->tty = tty;
		DBG1("open: %d", port->token_dl);
		spin_lock_irqsave(&dc->spin_mutex, flags);
		dc->last_ier = dc->last_ier | port->token_dl;
		writew(dc->last_ier, dc->reg_ier);
		spin_unlock_irqrestore(&dc->spin_mutex, flags);
	}

	mutex_unlock(&port->tty_sem);

	return 0;
}

/* Called when the userspace process close the tty, /dev/noz*. */
static void ntty_close(struct tty_struct *tty, struct file *file)
{
	struct nozomi *dc = get_dc_by_tty(tty);
	struct port *port = tty->driver_data;
	unsigned long flags;

	if (!dc || !port)
		return;

	if (mutex_lock_interruptible(&port->tty_sem))
		return;

	if (!port->tty_open_count)
		goto exit;

	dc->open_ttys--;
	port->tty_open_count--;

	if (port->tty_open_count == 0) {
		DBG1("close: %d", port->token_dl);
		spin_lock_irqsave(&dc->spin_mutex, flags);
		dc->last_ier &= ~(port->token_dl);
		writew(dc->last_ier, dc->reg_ier);
		spin_unlock_irqrestore(&dc->spin_mutex, flags);
	}

exit:
	mutex_unlock(&port->tty_sem);
}


Alan Cox wrote:
>> Surely if the driver returns an error code on hso_serial_open
>> hso_serial_close shouldn't be called
>> or have I a complete misunderstanding
>> of char driver semantics.
> 
> Generally yes that would be sane. The tty layer has always called the
> close method of drivers on a failed open and the drivers are all written
> assuming that.
> 
> It would be nice to change but there are far bigger fish to fry.
> 
> Alan


-- 
best regards,
D.J. Barrow
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: small design problem with hso driver
       [not found]                 ` <48EDD556.1070508-x9gZzRpC1QbQT0dZR+AlfA@public.gmane.org>
@ 2008-10-09 10:11                   ` Alan Cox
  0 siblings, 0 replies; 6+ messages in thread
From: Alan Cox @ 2008-10-09 10:11 UTC (permalink / raw)
  To: Denis Joseph Barrow
  Cc: Filip Aben, Andrew Bird, Paul Hardwick, Greg KH,
	Linux USB kernel mailing list, Linux netdev Mailing list

On Thu, 09 Oct 2008 11:56:38 +0200
Denis Joseph Barrow <D.Barow-x9gZzRpC1QbQT0dZR+AlfA@public.gmane.org> wrote:

> Hi Alan,
> No they are not.
> Have a look at.
> /drivers/char/nozomi.c
> admittedly it's written by some of the same guys.

Nozomi still has lots and lots of bugs left. Compared to the original its
now a work of art and much good stuff has been done but it is not by any
means 'done'.

File a bug with the nozomi author
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2008-10-09 10:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-08 13:52 small design problem with hso driver Denis Joseph Barrow
     [not found] ` <48ECBB26.7080402-x9gZzRpC1QbQT0dZR+AlfA@public.gmane.org>
2008-10-08 17:45   ` Greg KH
     [not found]     ` <20081008174556.GA15387-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2008-10-09  9:01       ` Denis Joseph Barrow
     [not found]         ` <48EDC887.8010403-x9gZzRpC1QbQT0dZR+AlfA@public.gmane.org>
2008-10-09  9:32           ` Alan Cox
     [not found]             ` <20081009103259.066cc94a-qBU/x9rampVanCEyBjwyrvXRex20P6io@public.gmane.org>
2008-10-09  9:56               ` Denis Joseph Barrow
     [not found]                 ` <48EDD556.1070508-x9gZzRpC1QbQT0dZR+AlfA@public.gmane.org>
2008-10-09 10:11                   ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).