From owner-p4-projects@FreeBSD.ORG Wed Jun 30 16:02:27 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 986D01065670; Wed, 30 Jun 2010 16:02:27 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5CEAC106566B for ; Wed, 30 Jun 2010 16:02:27 +0000 (UTC) (envelope-from afiveg@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 4A8AB8FC0C for ; Wed, 30 Jun 2010 16:02:27 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o5UG2RGx034180 for ; Wed, 30 Jun 2010 16:02:27 GMT (envelope-from afiveg@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o5UG2Rvp034178 for perforce@freebsd.org; Wed, 30 Jun 2010 16:02:27 GMT (envelope-from afiveg@FreeBSD.org) Date: Wed, 30 Jun 2010 16:02:27 GMT Message-Id: <201006301602.o5UG2Rvp034178@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to afiveg@FreeBSD.org using -f From: Alexandre Fiveg To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 180344 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jun 2010 16:02:27 -0000 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 #include #include +#include #include #include @@ -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) ====