Date: Wed, 30 Jun 2010 16:02:27 GMT From: Alexandre Fiveg <afiveg@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 180344 for review Message-ID: <201006301602.o5UG2Rvp034178@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@180344?ac=10 Change 180344 by afiveg@cottonmouth on 2010/06/30 16:02:23 setting taskqueue_run() in order to wait for delayed tasks in the taskqueue. I am not sure it is a best solution :( Affected files ... .. //depot/projects/soc2010/ringmap/current/contrib/libpcap/ringmap_pcap.c#9 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.c#17 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.h#15 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.c#16 edit .. //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.h#14 edit .. //depot/projects/soc2010/ringmap/current/sys/net/ringmap.c#20 edit .. //depot/projects/soc2010/ringmap/current/sys/net/ringmap.h#20 edit .. //depot/projects/soc2010/ringmap/scripts/set_ringmap.sh#5 edit Differences ... ==== //depot/projects/soc2010/ringmap/current/contrib/libpcap/ringmap_pcap.c#9 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.c#17 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/if_lem.h#15 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.c#16 (text+ko) ==== @@ -2,6 +2,7 @@ #include <sys/types.h> #include <sys/socket.h> #include <sys/conf.h> +#include <sys/queue.h> #include <sys/taskqueue.h> #include <machine/bus.h> @@ -52,12 +53,15 @@ /* Disable interrupts of adapter */ rm_8254_disable_intr(dev); - /* Check whether we have some tasks in queue */ - taskqueue_drain(adapter->tq, &adapter->rxtx_task); + /* + * Check whether we have some tasks in the queue. It should be done + * because we want to free the memory regions that could be accessed + * from the delayed interrupt tasks + */ + taskqueue_run(adapter->tq); if (ring != NULL){ contigfree(ring, sizeof(struct ring), M_DEVBUF); - ring = NULL; } else { RINGMAP_ERROR(The pointer to ring structure is NULL); } @@ -94,7 +98,7 @@ * Before continue look whether any delayed interrupt tasks are * in the taskqueue. */ - taskqueue_drain(adapter->tq, &adapter->rxtx_task); + taskqueue_run(adapter->tq); /* Set ring fields in the initial state */ ring->kern_wait_user = 0; @@ -155,7 +159,9 @@ struct adapter *adapter; adapter = (struct adapter *)device_get_softc(dev); - RINGMAP_HW_SYNC_TAIL(adapter, ring); /* SW_TAIL ==> HW_TAIL */ + if (ring != NULL) { + RINGMAP_HW_SYNC_TAIL(adapter, ring); /* SW_TAIL ==> HW_TAIL */ + } } @@ -165,7 +171,9 @@ struct adapter *adapter; adapter = (struct adapter *)device_get_softc(dev); - RINGMAP_HW_SYNC_HEAD(adapter, ring); /* SW_TAIL ==> HW_HEAD */ + if (ring != NULL) { + RINGMAP_HW_SYNC_HEAD(adapter, ring); /* SW_TAIL ==> HW_HEAD */ + } } @@ -180,9 +188,6 @@ /* count interrupts */ adapter->rm->ring->interrupts_counter++; -#if (RINGMAP_INTR_DEB) - rm_8254_print_ring_pointers(adapter); -#endif } @@ -198,11 +203,16 @@ * TODO: we want multithreading, it means we should later * sync not one ring but many rings, each per thread */ - rm_8254_sync_tail(adapter->dev, adapter->rm->ring); + + if (adapter->rm != NULL) { + rm_8254_sync_tail(adapter->dev, adapter->rm->ring); + } #ifdef RINGMAP_TIMESTAMP - getmicrotime(&adapter->rm->ring->last_ts); + if (adapter->rm->ring != NULL) { + getmicrotime(&adapter->rm->ring->last_ts); + } #endif RINGMAP_INTR(end); ==== //depot/projects/soc2010/ringmap/current/sys/dev/e1000/ringmap_8254.h#14 (text+ko) ==== ==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap.c#20 (text+ko) ==== @@ -326,6 +326,7 @@ if (rm->ring != NULL){ rm->funcs->free_ring(rm->dev, rm->ring); + rm->ring = NULL; } RINGMAP_FUNC_DEBUG(end); ==== //depot/projects/soc2010/ringmap/current/sys/net/ringmap.h#20 (text+ko) ==== @@ -442,7 +442,7 @@ #define PRINT_SLOT(ring, i, arg) \ if (((ring) != NULL) && ((arg) != NULL) && ((i) < SLOTS_NUMBER)){ \ printf("\n=+= =============================\n"); \ - printf("=+= Kernel slot: %d \n", (ring)->cur_slot_kern); \ + printf("=+= Slot Number: %d \n", (i)); \ printf("=+= Intrr num: %llu\n", (ring)->slot[(i)].intr_num); \ printf("=+= Time stamp: %llu\n", (unsigned long long)(((ring)->slot[(i)].ts.tv_sec*1000000 + (ring)->slot[(i)].ts.tv_usec))); \ printf("=+= Accepted: %d\n", (ring)->slot[(i)].is_ok); \ ==== //depot/projects/soc2010/ringmap/scripts/set_ringmap.sh#5 (text+ko) ====
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201006301602.o5UG2Rvp034178>