Driver list,

I have an issue I can't figure out. Any help would be appreciated.

I have written a block driver that works in most cases except one: using
aio_cancel64 to cancel pending DMA(s).

If I run the program below compiled with "gcc test.c", my system hangs.
This test is queuing 16 asynchronous DMAs to the block layer. It then
immediately cancels all DMAs.

If I run the program below compiled with "gcc -DADD_DELAY=1 test.c" my
system does not hang. In this case the added delay is allowing all the
pending DMAs to complete prior to calling aio_cancel64.

I figure I don't have some aio_cancel hook filled out in my driver. As
far as I can tell -- nothing like that exists. Can anyone shed light on
what I need to do to support aio_cancel64?

-Adam



    #define BUF_SIZE 8*1024*1024
    #define NUM_IOS 16

    int main(int argc, char **argv) {
    struct aiocb64 aiocb[NUM_IOS];
    char *ptr, *buf;
    int fd, st, ii;

    ptr = malloc(NUM_IOS * BUF_SIZE);
    memset(ptr, 0, NUM_IOS * BUF_SIZE);

    #ifdef ADD_DELAY
    printf("Adding delay\n");
    #endif

    fd = open("/dev/dsk/c9d0s0", O_RDWR | O_LARGEFILE | O_SYNC);

    memset(aiocb, 0, sizeof(aiocb));
    buf = ptr;

    for (ii = 0; ii < NUM_IOS; ii++) {
    aiocb[ii].aio_fildes = fd;
    aiocb[ii].aio_buf = buf;
    aiocb[ii].aio_offset = ii * BUF_SIZE;
    aiocb[ii].aio_nbytes = BUF_SIZE;

    aio_write64(&aiocb[ii]);
    buf += BUF_SIZE;
    }

    #ifdef ADD_DELAY
    sleep(2);
    #endif

    aio_cancel64(fd, NULL);

    close(fd);
    free(ptr);

    return 0;
    }


_______________________________________________
driver-discuss mailing list
driver-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/driver-discuss

Reply via email to