Re: [PATCH] Add locking to twe(4) so it no longer uses Giant

From: Mike Tancsa <mike_at_sentex.net>
Date: Thu, 09 Aug 2012 10:31:02 -0400
On 8/9/2012 9:16 AM, John Baldwin wrote:
>> One more data point, /dev/twe0 does not exist with the patch and I think
>> thats why the utils fail outright.
> 
> Oh, hmm.  That's odd.  Do you get any error messages on the console
> when twe0 attaches?  Also, you have INVARIANTS enabled, yes?
> (make_dev() panics when it fails if INVARIANTS is enabled).

I have INVARIANTS in the kernel, sorry, do I need to do something to
make it active ?

0{offsite2}# sysctl -a | grep -i invar
kern.features.invariant_support: 1
options INVARIANT_SUPPORT
options INVARIANTS
kern.timecounter.invariant_tsc: 1
  TSC: P-state invariant, performance statistics
  TSC: P-state invariant, performance statistics
  TSC: P-state invariant, performance statistics
  TSC: P-state invariant, performance statistics
0{offsite2}#

Nothing odd in dmesg

ZFS filesystem version 5
ZFS storage pool version 28
Timecounters tick every 1.000 msec
twed0 on twe0
twed0: 953878MB (1953542144 sectors)
usbus0: 480Mbps High Speed USB v2.0
usbus1: 480Mbps High Speed USB v2.0


pci6: <ACPI PCI bus> on pcib6
twe0: <3ware Storage Controller. Driver version 1.50.01.002> port
0x2000-0x200f mem 0xe2810000-0xe281000f,0xe2000000-0xe
27fffff at device 0.0 on pci6
twe0: 2 ports, Firmware FE8S 1.05.00.068, BIOS BE7X 1.08.00.048
isab0: <PCI-ISA bridge> at device 31.0 on pci0


Patch below is causing a panic now on boot. Just going to add debugging
to the serial console to see what it is.... and

0{offsite2}# kldload twe
twe0: <3ware Storage Controller. Driver version 1.50.01.002> port
0x2000-0x200f mem 0xe2810000-0xe281000f,0xe2000000-0xe27fffff at device
0.0 on pci6
twe0: [GIANT-LOCKED]


Fatal trap 12: page fault while in kernel mode
cpuid = 4; apic id = 04
fault virtual address   = 0x3
fault code              = supervisor read data, page not present
instruction pointer     = 0x20:0xffffffff81813eb3
stack pointer           = 0x28:0xffffff84529d33f0
frame pointer           = 0x28:0xffffff84529d3430
code segment            = base 0x0, limit 0xfffff, type 0x1b
                        = DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags        = interrupt enabled, resume, IOPL = 0
current process         = 1324 (kldload)
[ thread pid 1324 tid 100146 ]
Stopped at      twe_setup+0x153:        movzbl  0x3(%rdx),%eax
db>



> 
> Maybe try something like this (relative to the patched driver):
> 
> --- //depot/user/jhb/cleanup/sys/dev/twe/twe_freebsd.c	2012-08-03
> 18:10:04.000000000 0000
> +++ /Users/jhb/work/p4/cleanup/sys/dev/twe/twe_freebsd.c	2012-08-03
> 18:10:04.000000000 0000
> _at__at_ -342,9 +342,12 _at__at_
>      /*
>       * Create the control device.
>       */
> +    device_printf(sc->twe_dev, "Calling make_dev()\n");
>      sc->twe_dev_t = make_dev(&twe_cdevsw, device_get_unit(sc->twe_dev),
> UID_ROOT, GID_OPERATOR,
>  			     S_IRUSR | S_IWUSR, "twe%d", device_get_unit(sc->twe_dev));
>      sc->twe_dev_t->si_drv1 = sc;
> +    device_printf(sc->twe_dev, "make_dev() returned %p (%s)\n",
> sc->twe_dev_t,
> +	sc->twe_dev_t->si_name);
>      /*
>       * Schedule ourselves to bring the controller up once interrupts
> are available.
>       * This isn't strictly necessary, since we disable interrupts while
> probing the
> 
> 


-- 
-------------------
Mike Tancsa, tel +1 519 651 3400
Sentex Communications, mike_at_sentex.net
Providing Internet services since 1994 www.sentex.net
Cambridge, Ontario Canada   http://www.tancsa.com/
Received on Thu Aug 09 2012 - 12:31:13 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:29 UTC