skipping locks, mutex_owned, usb

Hans Petter Selasky hselasky at c2i.net
Mon Aug 29 14:02:15 UTC 2011


On Monday 29 August 2011 15:19:28 Andriy Gapon wrote:
> on 25/08/2011 14:52 Hans Petter Selasky said the following:
> >> http://people.freebsd.org/~avg/stop_scheduler_on_panic.diff
> >> http://people.freebsd.org/~avg/stop_scheduler_on_panic.8.x.diff
> > 
> > The following patch complements Andriy's patch with regard to USB. Please
> > test and report back!
> > 
> > http://hselasky.homeunix.org:8192/usb_scheduler_stopped.patch
> 
> Here is my take on the issue:
> http://people.freebsd.org/~avg/ukbd-polling.diff
> Admittedly it has a few hairy places, but overall it should reduce the
> number of lines and quirks in the ukbd code.
> The patch can be logically separated into three parts:
> - locking Giant around kbdd_poll and scgetc calls in sc_cngetc
> - SCHEDULER_STOPPED-vs-mutex_owned changes in usb_transfer.c
> - removing explicit Giant checks and manipulations in ukbd.c
> 
Hi,

> I would like to ask for a review of these changes in whole or in parts.
> Thank you!

I am bit worried by all the mtx_lock(&Giant) removal, though if it passes the 
following tests, it should be OK.

The non-ukbd USB part looks fine!

Compile a kernel with WITNESS and INVARIANTS options.

Test cases:

T1) NON-X11 login console:

Press SCROLL LOCK. Press PAGE UP to scroll history. Type something or plug 
another USB device. Does SCROLL lock clear seamlessly when other text is 
printed on the console?

T2) Switching between X11 and text console using ALT+CTRL+FX. Make sure no 
mutex related errors appear even when pressing keys/SCROLLOCK/NUMLOCK during 
the switchover.

T3) Typing text at mount-root prompt should work without any keys lost.

T4) Typing text in KDB should work.

T5) Typing text after dump should work when scheduler is stopped.

T6) Toggle Num-lock both in X11 and non-X11.

> 
> Further, I think that ideally we should follow bde's suggestion of
> extending syscons interface to allow explicitly going into and out of the
> polling mode instead of implicitly doing that for every character.
> Also, perhaps kernel doesn't always have to use the polling mode - for
> example I think that the mountroot prompt should do fine in the regular
> mode.

Right.

--HPS


More information about the freebsd-arch mailing list