Re: ucom_free Fatal trap on shutdown / module unload

2014-07-01 Thread Hans Petter Selasky

Hi Johannes,

Thank you for your patience!

http://svnweb.freebsd.org/changeset/base/268078

--HPS
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: ucom_free Fatal trap on shutdown / module unload

2014-06-30 Thread Hans Petter Selasky

Hi,

Try the attached patch. Does it make any difference?

--HPS
=== uhso.c
==
--- uhso.c	(revision 268059)
+++ uhso.c	(local)
@@ -559,8 +559,6 @@
 	mtx_init(&sc->sc_mtx, "uhso", NULL, MTX_DEF);
 	ucom_ref(&sc->sc_super_ucom);
 
-	sc->sc_ucom = NULL;
-	sc->sc_ttys = 0;
 	sc->sc_radio = 1;
 
 	id = usbd_get_interface_descriptor(uaa->iface);
@@ -680,9 +678,6 @@
 UHSO_CTRL_MAX);
 			}
 		}
-
-		free(sc->sc_tty, M_USBDEV);
-		free(sc->sc_ucom, M_USBDEV);
 	}
 
 	if (sc->sc_ifp != NULL) {
@@ -710,6 +705,8 @@
 uhso_free_softc(struct uhso_softc *sc)
 {
 	if (ucom_unref(&sc->sc_super_ucom)) {
+		free(sc->sc_tty, M_USBDEV);
+		free(sc->sc_ucom, M_USBDEV);
 		mtx_destroy(&sc->sc_mtx);
 		device_free_softc(sc);
 	}
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Re: ucom_free Fatal trap on shutdown / module unload

2014-06-30 Thread Lundberg, Johannes
Hi Hans

Thanks for the uhso patch. That did the trick. Now reboot and kldunload
works fine.

--
Johannes Lundberg
BRILLIANTSERVICE CO., LTD.


On Tue, Jul 1, 2014 at 2:33 PM, Hans Petter Selasky  wrote:

> Hi,
>
> Try the attached patch. Does it make any difference?
>
> --HPS
>

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
秘密保持について:この電子メールは、名宛人に送信したものであり、秘匿特権の対象となる情報を含んでいます。
もし、名宛人以外の方が受信された場合、このメールの破棄、およびこのメールに関する一切の開示、
複写、配布、その他の利用、または記載内容に基づくいかなる行動もされないようお願い申し上げます。
---
CONFIDENTIALITY NOTE: The information in this email is confidential
and intended solely for the addressee.
Disclosure, copying, distribution or any other action of use of this
email by person other than intended recipient, is prohibited.
If you are not the intended recipient and have received this email in
error, please destroy the original message.
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Re: ucom_free Fatal trap on shutdown / module unload

2014-06-29 Thread Lundberg, Johannes
Hi Hans

Thanks for the tips.

I tried both adding them in kernel config and the patch (not
simultaneously) but no effect. Still crash on unload/reboot.

--
Johannes Lundberg
BRILLIANTSERVICE CO., LTD.


On Mon, Jun 30, 2014 at 1:13 PM, Hans Petter Selasky 
wrote:

> On 06/30/14 06:01, Lundberg, Johannes wrote:
>
>> As I mention in earlier mail, it is when I comment out following lines it
>> works
>>
>> # For full debugger support use (turn off in stable branch):
>> options DDB # Support DDB.
>> options GDB # Support remote GDB.
>> options DEADLKRES   # Enable the deadlock resolver
>> options INVARIANTS  # Enable calls of extra sanity
>> checking
>> options INVARIANT_SUPPORT   # Extra sanity checks of internal
>> structures, required by INVARIANTS
>> options WITNESS # Enable checks to detect
>> deadlocks
>> and cycles
>> options WITNESS_SKIPSPIN# Don't run witness on spinlocks
>> for speed
>> options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones
>>
>>
>> I have tried different levels of debugging and I have narrowed it down to
>> INVARIANTS.
>>
>>
> Hi,
>
> What happens if you put ucom and uhso in the kernel config file, instead
> of loading them as modules.
>
> Please find attached a patch you can try. It ensures that the ucom mtx is
> not destroyed before we are finished using it at shutdown.
>
> --HPS
>
>

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
秘密保持について:この電子メールは、名宛人に送信したものであり、秘匿特権の対象となる情報を含んでいます。
もし、名宛人以外の方が受信された場合、このメールの破棄、およびこのメールに関する一切の開示、
複写、配布、その他の利用、または記載内容に基づくいかなる行動もされないようお願い申し上げます。
---
CONFIDENTIALITY NOTE: The information in this email is confidential
and intended solely for the addressee.
Disclosure, copying, distribution or any other action of use of this
email by person other than intended recipient, is prohibited.
If you are not the intended recipient and have received this email in
error, please destroy the original message.
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Re: ucom_free Fatal trap on shutdown / module unload

2014-06-29 Thread Hans Petter Selasky

On 06/30/14 06:01, Lundberg, Johannes wrote:

As I mention in earlier mail, it is when I comment out following lines it
works

# For full debugger support use (turn off in stable branch):
options DDB # Support DDB.
options GDB # Support remote GDB.
options DEADLKRES   # Enable the deadlock resolver
options INVARIANTS  # Enable calls of extra sanity
checking
options INVARIANT_SUPPORT   # Extra sanity checks of internal
structures, required by INVARIANTS
options WITNESS # Enable checks to detect deadlocks
and cycles
options WITNESS_SKIPSPIN# Don't run witness on spinlocks
for speed
options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones


I have tried different levels of debugging and I have narrowed it down to
INVARIANTS.



Hi,

What happens if you put ucom and uhso in the kernel config file, instead 
of loading them as modules.


Please find attached a patch you can try. It ensures that the ucom mtx 
is not destroyed before we are finished using it at shutdown.


--HPS

=== dev/usb/serial/usb_serial.c
==
--- dev/usb/serial/usb_serial.c	(revision 268010)
+++ dev/usb/serial/usb_serial.c	(local)
@@ -200,7 +200,7 @@
 
 	mtx_destroy(&ucom_mtx);
 }
-SYSUNINIT(ucom_uninit, SI_SUB_KLD - 2, SI_ORDER_ANY, ucom_uninit, NULL);
+SYSUNINIT(ucom_uninit, SI_SUB_KLD - 3, SI_ORDER_ANY, ucom_uninit, NULL);
 
 /*
  * Mark a unit number (the X in cuaUX) as in use.
=== dev/usb/serial/usb_serial.h
==
--- dev/usb/serial/usb_serial.h	(revision 268010)
+++ dev/usb/serial/usb_serial.h	(local)
@@ -195,7 +195,7 @@
 #define	UCOM_MTX_LOCK(sc) mtx_lock((sc)->sc_mtx)
 #define	UCOM_MTX_UNLOCK(sc) mtx_unlock((sc)->sc_mtx)
 #define	UCOM_UNLOAD_DRAIN(x) \
-SYSUNINIT(var, SI_SUB_KLD - 3, SI_ORDER_ANY, ucom_drain_all, 0)
+SYSUNINIT(var, SI_SUB_KLD - 2, SI_ORDER_ANY, ucom_drain_all, 0)
 
 #define	ucom_cfg_do_request(udev,com,req,ptr,flags,timo) \
 usbd_do_request_proc(udev,&(com)->sc_super->sc_tq,req,ptr,flags,NULL,timo)
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Re: ucom_free Fatal trap on shutdown / module unload

2014-06-29 Thread Lundberg, Johannes
As I mention in earlier mail, it is when I comment out following lines it
works

# For full debugger support use (turn off in stable branch):
options DDB # Support DDB.
options GDB # Support remote GDB.
options DEADLKRES   # Enable the deadlock resolver
options INVARIANTS  # Enable calls of extra sanity
checking
options INVARIANT_SUPPORT   # Extra sanity checks of internal
structures, required by INVARIANTS
options WITNESS # Enable checks to detect deadlocks
and cycles
options WITNESS_SKIPSPIN# Don't run witness on spinlocks
for speed
options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones


I have tried different levels of debugging and I have narrowed it down to
INVARIANTS.

That is

# For full debugger support use (turn off in stable branch):
#options DDB # Support DDB.
#options GDB # Support remote GDB.
#options DEADLKRES   # Enable the deadlock resolver
#options INVARIANTS  # Enable calls of extra sanity
checking
#options INVARIANT_SUPPORT   # Extra sanity checks of internal
structures, required by INVARIANTS
#options WITNESS # Enable checks to detect
deadlocks and cycles
#options WITNESS_SKIPSPIN# Don't run witness on spinlocks
for speed
#options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones

works but the following crashes when unloading uhso.

# For full debugger support use (turn off in stable branch):
#options DDB # Support DDB.
#options GDB # Support remote GDB.
#options DEADLKRES   # Enable the deadlock resolver
options INVARIANTS  # Enable calls of extra sanity
checking
options INVARIANT_SUPPORT   # Extra sanity checks of internal
structures, required by INVARIANTS
#options WITNESS # Enable checks to detect
deadlocks and cycles
#options WITNESS_SKIPSPIN# Don't run witness on spinlocks
for speed
#options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones




--
Johannes Lundberg
BRILLIANTSERVICE CO., LTD.


On Sat, Jun 28, 2014 at 11:56 PM, Hans Petter Selasky 
wrote:

> On 06/28/14 08:59, Lundberg, Johannes wrote:
>
>> The problem exists already from Revision *239180*
>>  where ucom
>>
>> was introduced.. Also observe that it only crashes when full debugging is
>> enabled. No problems with debugging off (release settings in kernel conf).
>>
>>
> Interesting.
>
> You mean USB_DEBUG is defined or hw.usb.ucom.debug is set?
>
> --HPS
>
>

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
秘密保持について:この電子メールは、名宛人に送信したものであり、秘匿特権の対象となる情報を含んでいます。
もし、名宛人以外の方が受信された場合、このメールの破棄、およびこのメールに関する一切の開示、
複写、配布、その他の利用、または記載内容に基づくいかなる行動もされないようお願い申し上げます。
---
CONFIDENTIALITY NOTE: The information in this email is confidential
and intended solely for the addressee.
Disclosure, copying, distribution or any other action of use of this
email by person other than intended recipient, is prohibited.
If you are not the intended recipient and have received this email in
error, please destroy the original message.
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Re: ucom_free Fatal trap on shutdown / module unload

2014-06-23 Thread Lundberg, Johannes
Hi

Well I'm running the snaphot memstick image from June of 11-CURRENT amd64,
with newcons.

The device is embedded in the laptop and I can not remove it easily so I
don't know what would happen if I do.

I'm sending you the screenshots separately in direct mail so we don't have
to wait for large attachment approval on the list.




--
Johannes Lundberg
BRILLIANTSERVICE CO., LTD.


On Tue, Jun 24, 2014 at 1:39 PM, Hans Petter Selasky 
wrote:

> On 06/23/14 07:34, Lundberg, Johannes wrote:
>
>> I added some logging to see what is going on and this is what I got (none
>> of the proposed solution solved the problem)
>>
>> uhso_detach gets called 7 times (for oid 0-6). It crashes the 2nd time on
>> the call usbd_transfer_unsetup(sc->sc_xfer, 3);
>>
>>
> Hi,
>
> You are running -stable presumably?
>
> Can you set hw.usb.debug=16 and collects the 10 last prints before the
> panic, and backtrace would be nice too. This does not happen when you
> unplug the device, correct?
>
> --HPS
>
>

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
秘密保持について:この電子メールは、名宛人に送信したものであり、秘匿特権の対象となる情報を含んでいます。
もし、名宛人以外の方が受信された場合、このメールの破棄、およびこのメールに関する一切の開示、
複写、配布、その他の利用、または記載内容に基づくいかなる行動もされないようお願い申し上げます。
---
CONFIDENTIALITY NOTE: The information in this email is confidential
and intended solely for the addressee.
Disclosure, copying, distribution or any other action of use of this
email by person other than intended recipient, is prohibited.
If you are not the intended recipient and have received this email in
error, please destroy the original message.
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Re: ucom_free Fatal trap on shutdown / module unload

2014-06-23 Thread Hans Petter Selasky

On 06/23/14 07:34, Lundberg, Johannes wrote:

I added some logging to see what is going on and this is what I got (none
of the proposed solution solved the problem)

uhso_detach gets called 7 times (for oid 0-6). It crashes the 2nd time on
the call usbd_transfer_unsetup(sc->sc_xfer, 3);



Hi,

You are running -stable presumably?

Can you set hw.usb.debug=16 and collects the 10 last prints before the 
panic, and backtrace would be nice too. This does not happen when you 
unplug the device, correct?


--HPS

___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: ucom_free Fatal trap on shutdown / module unload

2014-06-22 Thread Lundberg, Johannes
I added some logging to see what is going on and this is what I got (none
of the proposed solution solved the problem)

uhso_detach gets called 7 times (for oid 0-6). It crashes the 2nd time on
the call usbd_transfer_unsetup(sc->sc_xfer, 3);

--
Johannes Lundberg
BRILLIANTSERVICE CO., LTD.


On Mon, Jun 23, 2014 at 11:55 AM, Hans Petter Selasky 
wrote:

> On 06/23/14 03:30, Lundberg, Johannes wrote:
>
>> Hi
>>
>> I tried replacing
>> DRIVER_MODULE(uhso, uhub, uhso_driver, uhso_devclass, uhso_driver_loaded,
>> 0);
>> with
>> DRIVER_MODULE_ORDERED(uhso, uhub, uhso_driver, uhso_devclass,
>> uhso_driver_loaded, 0, SI_ORDER_ANY);
>> but makes no difference..
>>
>> Don't know if its relevant but with ucom debug on I get a message just
>> before crash in method ucom_close that it tries to close a connection that
>> has already been closed.
>>
>>
> Hi Johannes,
>
> Try the opposite:
>
> DRIVER_MODULE_ORDERED(uhso, uhub, uhso_driver, uhso_devclass,
> uhso_driver_loaded, 0, SI_ORDER_MIDDLE + 1);
>
> Because I suspect that the "uhso_ifnet_unit" unrhdr is freed before the
> "fake" detach is executed:
>
>  static int
>> uhso_driver_loaded(struct module *mod, int what, void *arg)
>> {
>> switch (what) {
>> case MOD_LOAD:
>> /* register our autoinstall handler */
>> uhso_etag = EVENTHANDLER_REGISTER(usb_dev_configured,
>> uhso_test_autoinst, NULL, EVENTHANDLER_PRI_ANY);
>> /* create our unit allocator for inet devs */
>> uhso_ifnet_unit = new_unrhdr(0, INT_MAX, NULL);
>> break;
>> case MOD_UNLOAD:
>> EVENTHANDLER_DEREGISTER(usb_dev_configured, uhso_etag);
>> delete_unrhdr(uhso_ifnet_unit);
>> break;
>> default:
>> return (EOPNOTSUPP);
>> }
>> return (0);
>> }
>>
>
> Alternativly set "uhso_ifnet_unit" to NULL and check this in probe and
> attach!
>
> --HPS
>
> --HPS
>

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
秘密保持について:この電子メールは、名宛人に送信したものであり、秘匿特権の対象となる情報を含んでいます。
もし、名宛人以外の方が受信された場合、このメールの破棄、およびこのメールに関する一切の開示、
複写、配布、その他の利用、または記載内容に基づくいかなる行動もされないようお願い申し上げます。
---
CONFIDENTIALITY NOTE: The information in this email is confidential
and intended solely for the addressee.
Disclosure, copying, distribution or any other action of use of this
email by person other than intended recipient, is prohibited.
If you are not the intended recipient and have received this email in
error, please destroy the original message.
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Re: ucom_free Fatal trap on shutdown / module unload

2014-06-22 Thread Hans Petter Selasky

On 06/23/14 03:30, Lundberg, Johannes wrote:

Hi

I tried replacing
DRIVER_MODULE(uhso, uhub, uhso_driver, uhso_devclass, uhso_driver_loaded,
0);
with
DRIVER_MODULE_ORDERED(uhso, uhub, uhso_driver, uhso_devclass,
uhso_driver_loaded, 0, SI_ORDER_ANY);
but makes no difference..

Don't know if its relevant but with ucom debug on I get a message just
before crash in method ucom_close that it tries to close a connection that
has already been closed.



Hi Johannes,

Try the opposite:

DRIVER_MODULE_ORDERED(uhso, uhub, uhso_driver, uhso_devclass, 
uhso_driver_loaded, 0, SI_ORDER_MIDDLE + 1);


Because I suspect that the "uhso_ifnet_unit" unrhdr is freed before the 
"fake" detach is executed:



static int
uhso_driver_loaded(struct module *mod, int what, void *arg)
{
switch (what) {
case MOD_LOAD:
/* register our autoinstall handler */
uhso_etag = EVENTHANDLER_REGISTER(usb_dev_configured,
uhso_test_autoinst, NULL, EVENTHANDLER_PRI_ANY);
/* create our unit allocator for inet devs */
uhso_ifnet_unit = new_unrhdr(0, INT_MAX, NULL);
break;
case MOD_UNLOAD:
EVENTHANDLER_DEREGISTER(usb_dev_configured, uhso_etag);
delete_unrhdr(uhso_ifnet_unit);
break;
default:
return (EOPNOTSUPP);
}
return (0);
}


Alternativly set "uhso_ifnet_unit" to NULL and check this in probe and 
attach!


--HPS

--HPS
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: ucom_free Fatal trap on shutdown / module unload

2014-06-22 Thread Lundberg, Johannes
Hi

I tried replacing
DRIVER_MODULE(uhso, uhub, uhso_driver, uhso_devclass, uhso_driver_loaded,
0);
with
DRIVER_MODULE_ORDERED(uhso, uhub, uhso_driver, uhso_devclass,
uhso_driver_loaded, 0, SI_ORDER_ANY);
but makes no difference..

Don't know if its relevant but with ucom debug on I get a message just
before crash in method ucom_close that it tries to close a connection that
has already been closed.



--
Johannes Lundberg
BRILLIANTSERVICE CO., LTD.


On Fri, Jun 20, 2014 at 4:51 PM, Hans Petter Selasky 
wrote:

> On 06/20/14 04:25, Lundberg, Johannes wrote:
>
>> Hi
>>
>> I'm getting this error on 11-CURRENT amd64 (snapshot from June). (see
>> attached image)
>> Worked fine with 10 I think..
>>
>> The ucom module is loaded as a dependency by the uhso module.
>>
>> Any clues?
>> --
>> Johannes Lundberg
>>
>>
>> [image: Inline image 1]
>>
>>
> Hi,
>
> Possibly something similar to what was done in USB audio that
> DRIVER_MODULE_ORDERED() needs to be used instead of DRIVER_MODULE().
>
> --HPS
>

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
秘密保持について:この電子メールは、名宛人に送信したものであり、秘匿特権の対象となる情報を含んでいます。
もし、名宛人以外の方が受信された場合、このメールの破棄、およびこのメールに関する一切の開示、
複写、配布、その他の利用、または記載内容に基づくいかなる行動もされないようお願い申し上げます。
---
CONFIDENTIALITY NOTE: The information in this email is confidential
and intended solely for the addressee.
Disclosure, copying, distribution or any other action of use of this
email by person other than intended recipient, is prohibited.
If you are not the intended recipient and have received this email in
error, please destroy the original message.
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Re: ucom_free Fatal trap on shutdown / module unload

2014-06-20 Thread Hans Petter Selasky

On 06/20/14 04:25, Lundberg, Johannes wrote:

Hi

I'm getting this error on 11-CURRENT amd64 (snapshot from June). (see
attached image)
Worked fine with 10 I think..

The ucom module is loaded as a dependency by the uhso module.

Any clues?
--
Johannes Lundberg


[image: Inline image 1]



Hi,

Possibly something similar to what was done in USB audio that 
DRIVER_MODULE_ORDERED() needs to be used instead of DRIVER_MODULE().


--HPS
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


ucom_free Fatal trap on shutdown / module unload

2014-06-19 Thread Lundberg, Johannes
Hi

I'm getting this error on 11-CURRENT amd64 (snapshot from June). (see
attached image)
Worked fine with 10 I think..

The ucom module is loaded as a dependency by the uhso module.

Any clues?
--
Johannes Lundberg


[image: Inline image 1]

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
秘密保持について:この電子メールは、名宛人に送信したものであり、秘匿特権の対象となる情報を含んでいます。
もし、名宛人以外の方が受信された場合、このメールの破棄、およびこのメールに関する一切の開示、
複写、配布、その他の利用、または記載内容に基づくいかなる行動もされないようお願い申し上げます。
---
CONFIDENTIALITY NOTE: The information in this email is confidential
and intended solely for the addressee.
Disclosure, copying, distribution or any other action of use of this
email by person other than intended recipient, is prohibited.
If you are not the intended recipient and have received this email in
error, please destroy the original message.
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"