AIO stupidity

2004-05-19 Thread Bjorn Dittmer-Roche
Hey all,

I'm pretty sure I am being stupid, but I couldn't get any help
from google or by searching the archives. Any pointer would be greatly
appretiated!

I am trying to use aio functions in a real-time thread. The
trouble is I keep getting Function not implemented errors. I thought
these functions were implemented! I am using FreeBSD 4.9. the
kernel is self compiled (config below). Anyway, here's a code snipit:

  if( asyncWriteBuffers[ asyncWriteIndex ].pending ) {
 int err = aio_error( (asyncWriteBuffers[asyncWriteIndex].asyncData) );
 if( err == EINPROGRESS )
throw UnderflowException( -16 );
 else if( err != 0 ) {
cout  Async IO Error:   strerror( err )  endl;
throw FatalException( -12, strerror( err ) );
 }
  }
  bzero( (char *) asyncWriteBuffers[asyncWriteIndex].asyncData.aio_fildes,
   sizeof (struct aiocb));
  asyncWriteBuffers[asyncWriteIndex].asyncData.aio_fildes = fd;
  asyncWriteBuffers[asyncWriteIndex].asyncData.aio_buf = localIOBuff;
  asyncWriteBuffers[asyncWriteIndex].asyncData.aio_nbytes
  = (end-start)*(bitdepth3)*channels ;
  asyncWriteBuffers[asyncWriteIndex].asyncData.aio_reqprio = 0;
  if( -1 == aio_write( (asyncWriteBuffers[asyncWriteIndex].asyncData) ) )
 throw FatalException( -12, strerror( errno ) );
  asyncWriteIndex = ( asyncWriteIndex + 1 ) % NUM_ASYNC_WRITE_BUFFERS;


The error happens on call to aio_write, which is the first aio_ function
that gets called. I have checked pretty carefully to make sure the values
in asyncData are valid. (asyncData is of type struct aiocb of course).


TIA,


bjorn

Here's my kernel config:

#
# GENERIC -- Generic kernel configuration file for FreeBSD/i386
#
# For more information on this file, please read the handbook section on
# Kernel Configuration Files:
#
#http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html
#
# The handbook is also available locally in /usr/share/doc/handbook
# if you've installed the doc distribution, otherwise always see the
# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the
# latest information.
#
# An exhaustive list of options and more detailed explanations of the
# device lines is also present in the ./LINT configuration file. If you are
# in doubt as to the purpose or necessity of a line, check first in LINT.
#
# $FreeBSD: src/sys/i386/conf/GENERIC,v 1.246.2.51.2.2 2003/03/25 23:35:15 jhb Exp $

machine i386
cpu I686_CPU
ident   TWIGGY
maxusers0

#makeoptionsDEBUG=-g#Build kernel with gdb(1) debug symbols

options MATH_EMULATE#Support for x87 emulation
options INET#InterNETworking
options INET6   #IPv6 communications protocols
options FFS #Berkeley Fast Filesystem
options FFS_ROOT#FFS usable as root device [keep this!]
options SOFTUPDATES #Enable FFS soft updates support
options UFS_DIRHASH #Improve performance on big directories
options MFS #Memory Filesystem
options MD_ROOT #MD is a potential root device
options NFS #Network Filesystem
options NFS_ROOT#NFS usable as root device, NFS required
options MSDOSFS #MSDOS Filesystem
options CD9660  #ISO 9660 Filesystem
options CD9660_ROOT #CD-ROM usable as root, CD9660 required
options PROCFS  #Process filesystem
options COMPAT_43   #Compatible with BSD 4.3 [KEEP THIS!]
options SCSI_DELAY=5000 #Delay (in ms) before probing SCSI
options UCONSOLE#Allow users to grab the console
options USERCONFIG  #boot -c editor
options VISUAL_USERCONFIG   #visual boot -c editor
options KTRACE  #ktrace(1) support
options SYSVSHM #SYSV-style shared memory
options SYSVMSG #SYSV-style message queues
options SYSVSEM #SYSV-style semaphores
options P1003_1B#Posix P1003_1B real-time extensions
options _KPOSIX_PRIORITY_SCHEDULING
options ICMP_BANDLIM#Rate limit bad replies
options KBD_INSTALL_CDEV# install a CDEV entry in /dev
options AHC_REG_PRETTY_PRINT# Print register bitfields in debug
# output.  Adds ~128k to driver.
options AHD_REG_PRETTY_PRINT# Print register bitfields in debug
# output.  Adds ~215k to driver.
options  NETATALK #appletalk

# To make an SMP kernel, the next two are needed

Re: 5.1 crashes with USB to IDE

2003-09-18 Thread Bjorn Dittmer-Roche
On Wed, 17 Sep 2003, Kris Kennaway wrote:

 On Wed, Sep 17, 2003 at 07:41:55PM -0400, Bjorn Dittmer-Roche wrote:
  Hey all,
 
  I've got a USB to IDE converter which, if I try and put it to use
  for any amount of time, causes my 5.1 release system to hang in various
  ways, and it either leaves me with a completely locked system or with
  disks that won't sync (meaning, amount other things, that I can't shutdown
  properly).

 Try again with current (new ATA driver) or stick to 4.x.

Sadly, the problem happened last night when the drive wasn't even plugged
in. The only thing the incidents have in common is lots of disk activity
(My main drive is IDE). A new ATA driver would probably be a very good
thing as far as that goes, but I've had bad luck with current.  (last time
I tried current, using nfs caused my machine to crash! On second thought,
it was the same machine so maybe it was the same problem?). I think if 5.1
release is so unstable, current is probably not for me. Back to 4.8, I
guess


bjorn


 Kris

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


5.1 crashes with USB to IDE

2003-09-17 Thread Bjorn Dittmer-Roche
Hey all,

I've got a USB to IDE converter which, if I try and put it to use
for any amount of time, causes my 5.1 release system to hang in various
ways, and it either leaves me with a completely locked system or with
disks that won't sync (meaning, amount other things, that I can't shutdown
properly).  Commands opperating on the offending disk are left in ps's D
state, meaning uninterruptable sleep. Nothing wierd shows up in messeges
or dmesg, and the drive worked okay in freebsd 4.8, though I didn't use it
that much, so I can't be sure. The kernel is custom, but I was able to
repeat the problem with a generic kernel. I was also able to reproduce the
problem with both the built in USB driver (VIA 83C572 USB controller) and
an old USB card I pulled out of my mac (OPTi 82C861 (FireLink) USB
controller). I have also tried two drives, so the problem is either the
adaptor or FreeBSD.

My machine is currently up, but all processes accessing the drive are
frozen (and so are a few others), in case someone wants to ask about that.
Any help greatly appretiated!

Here are the relevent parts of dmesg from boot:

ohci0: OPTi 82C861 (FireLink) USB controller mem 0xe7002000-0xe7002fff
irq 5 at device 14.0 on pci0
usb0: OHCI version 1.0, legacy support
usb0: OPTi 82C861 (FireLink) USB controller on ohci0
usb0: USB revision 1.0
uhub0: OPTi OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 2 ports with 2 removable, self powered
uhub1: NEC Corporation USB2.0 Hub Controller, class 9/0, rev 2.00/1.00,
addr 2
uhub1: 4 ports with 4 removable, self powered
ums0: MOUSE SYSTEM U+P mouse, rev 1.00/0.00, addr 3, iclass 3/1
ums0: 3 buttons and Z dir.
pcm0: Creative CT5880-C port 0xd800-0xd83f irq 11 at device 15.0 on pci0
pcm0: TriTech TR28602 AC97 Codec
isab0: PCI-ISA bridge at device 17.0 on pci0
isa0: ISA bus on isab0
atapci0: VIA 8233 UDMA100 controller port 0xdc00-0xdc0f at device 17.1
on pci0
ata0: at 0x1f0 irq 14 on atapci0
ata1: at 0x170 irq 15 on atapci0
uhci0: VIA 83C572 USB controller port 0xe000-0xe01f irq 12 at device
17.2 on pci0
usb1: VIA 83C572 USB controller on uhci0
usb1: USB revision 1.0
uhub2: VIA UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub2: 2 ports with 2 removable, self powered
uhci1: VIA 83C572 USB controller port 0xe400-0xe41f irq 12 at device
17.3 on pci0
usb2: VIA 83C572 USB controller on uhci1
usb2: USB revision 1.0
uhub3: VIA UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub3: 2 ports with 2 removable, self powered
uhci2: VIA 83C572 USB controller port 0xe800-0xe81f irq 12 at device
17.4 on pci0
usb3: VIA 83C572 USB controller on uhci2
usb3: USB revision 1.0
uhub4: VIA UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub4: 2 ports with 2 removable, self powered

---

Here are the relevent parts of dmesg from and from when I attach the USB
to IDE adaptor:

umass0: Genesys Logic USB TO IDE, rev 2.00/0.02, addr 6
da0 at umass-sim0 bus 0 target 0 lun 0
da0: ST312002 6A 0811 Fixed Direct Access SCSI-0 device
da0: 1.000MB/s transfers
da0: 114473MB (234441648 512 byte sectors: 255H 63S/T 14593C)
(da0:umass-sim0:0:0:0): READ(6)/WRITE(6) not supported, increasing
minimum_cmd_size to 10.


Last line does seem mysterious

bjorn
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]