From 056762a9104997569b09416c35d9a0bfef175e1f Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 22 Apr 2003 10:18:29 +0000 Subject: remove unused dma histogram code --- linux/drmP.h | 37 ------------- linux/drm_bufs.h | 18 ------- linux/drm_context.h | 8 --- linux/drm_dma.h | 58 --------------------- linux/drm_drv.h | 8 --- linux/drm_lists.h | 7 --- linux/drm_proc.h | 147 ---------------------------------------------------- linux/gamma_dma.c | 27 ---------- 8 files changed, 310 deletions(-) (limited to 'linux') diff --git a/linux/drmP.h b/linux/drmP.h index 8b701467..338345be 100644 --- a/linux/drmP.h +++ b/linux/drmP.h @@ -106,9 +106,6 @@ #ifndef __HAVE_DMA_FREELIST #define __HAVE_DMA_FREELIST 0 #endif -#ifndef __HAVE_DMA_HISTOGRAM -#define __HAVE_DMA_HISTOGRAM 0 -#endif #define __REALLY_HAVE_AGP (__HAVE_AGP && (defined(CONFIG_AGP) || \ defined(CONFIG_AGP_MODULE))) @@ -365,38 +362,11 @@ typedef struct drm_buf { DRM_LIST_RECLAIM = 5 } list; /* Which list we're on */ -#if DRM_DMA_HISTOGRAM - cycles_t time_queued; /* Queued to kernel DMA queue */ - cycles_t time_dispatched; /* Dispatched to hardware */ - cycles_t time_completed; /* Completed by hardware */ - cycles_t time_freed; /* Back on freelist */ -#endif int dev_priv_size; /* Size of buffer private stoarge */ void *dev_private; /* Per-buffer private storage */ } drm_buf_t; -#if DRM_DMA_HISTOGRAM -#define DRM_DMA_HISTOGRAM_SLOTS 9 -#define DRM_DMA_HISTOGRAM_INITIAL 10 -#define DRM_DMA_HISTOGRAM_NEXT(current) ((current)*10) -typedef struct drm_histogram { - atomic_t total; - - atomic_t queued_to_dispatched[DRM_DMA_HISTOGRAM_SLOTS]; - atomic_t dispatched_to_completed[DRM_DMA_HISTOGRAM_SLOTS]; - atomic_t completed_to_freed[DRM_DMA_HISTOGRAM_SLOTS]; - - atomic_t queued_to_completed[DRM_DMA_HISTOGRAM_SLOTS]; - atomic_t queued_to_freed[DRM_DMA_HISTOGRAM_SLOTS]; - - atomic_t dma[DRM_DMA_HISTOGRAM_SLOTS]; - atomic_t schedule[DRM_DMA_HISTOGRAM_SLOTS]; - atomic_t ctx[DRM_DMA_HISTOGRAM_SLOTS]; - atomic_t lacq[DRM_DMA_HISTOGRAM_SLOTS]; - atomic_t lhld[DRM_DMA_HISTOGRAM_SLOTS]; -} drm_histogram_t; -#endif /* bufs is one longer than it has to be */ typedef struct drm_waitlist { @@ -639,9 +609,6 @@ typedef struct drm_device { #endif cycles_t ctx_start; cycles_t lck_start; -#if __HAVE_DMA_HISTOGRAM - drm_histogram_t histo; -#endif /* Callback to X server for context switch and for heavy-handed reset. */ @@ -875,10 +842,6 @@ extern void DRM(vbl_send_signals)( drm_device_t *dev ); #if __HAVE_DMA_IRQ_BH extern void DRM(dma_immediate_bh)( void *dev ); #endif -#endif -#if DRM_DMA_HISTOGRAM -extern int DRM(histogram_slot)(unsigned long count); -extern void DRM(histogram_compute)(drm_device_t *dev, drm_buf_t *buf); #endif /* Buffer list support (drm_lists.h) */ diff --git a/linux/drm_bufs.h b/linux/drm_bufs.h index b27987f1..97997dc1 100644 --- a/linux/drm_bufs.h +++ b/linux/drm_bufs.h @@ -416,12 +416,6 @@ int DRM(addbufs_agp)( struct inode *inode, struct file *filp, } memset( buf->dev_private, 0, buf->dev_priv_size ); -#if __HAVE_DMA_HISTOGRAM - buf->time_queued = 0; - buf->time_dispatched = 0; - buf->time_completed = 0; - buf->time_freed = 0; -#endif DRM_DEBUG( "buffer %d @ %p\n", entry->buf_count, buf->address ); @@ -618,12 +612,6 @@ int DRM(addbufs_pci)( struct inode *inode, struct file *filp, buf->pending = 0; init_waitqueue_head( &buf->dma_wait ); buf->filp = 0; -#if __HAVE_DMA_HISTOGRAM - buf->time_queued = 0; - buf->time_dispatched = 0; - buf->time_completed = 0; - buf->time_freed = 0; -#endif DRM_DEBUG( "buffer %d @ %p\n", entry->buf_count, buf->address ); } @@ -790,12 +778,6 @@ int DRM(addbufs_sg)( struct inode *inode, struct file *filp, memset( buf->dev_private, 0, buf->dev_priv_size ); -# if __HAVE_DMA_HISTOGRAM - buf->time_queued = 0; - buf->time_dispatched = 0; - buf->time_completed = 0; - buf->time_freed = 0; -# endif DRM_DEBUG( "buffer %d @ %p\n", entry->buf_count, buf->address ); diff --git a/linux/drm_context.h b/linux/drm_context.h index 944e1be2..646b2236 100644 --- a/linux/drm_context.h +++ b/linux/drm_context.h @@ -227,9 +227,6 @@ int DRM(context_switch)( drm_device_t *dev, int old, int new ) return -EBUSY; } -#if __HAVE_DMA_HISTOGRAM - dev->ctx_start = get_cycles(); -#endif DRM_DEBUG( "Context switch from %d to %d\n", old, new ); @@ -257,11 +254,6 @@ int DRM(context_switch_complete)( drm_device_t *dev, int new ) /* If a context switch is ever initiated when the kernel holds the lock, release that lock here. */ -#if __HAVE_DMA_HISTOGRAM - atomic_inc( &dev->histo.ctx[DRM(histogram_slot)(get_cycles() - - dev->ctx_start)] ); - -#endif clear_bit( 0, &dev->context_flag ); wake_up( &dev->context_wait ); diff --git a/linux/drm_dma.h b/linux/drm_dma.h index f14e08f0..45c4d321 100644 --- a/linux/drm_dma.h +++ b/linux/drm_dma.h @@ -127,61 +127,6 @@ void DRM(dma_takedown)(drm_device_t *dev) } -#if __HAVE_DMA_HISTOGRAM -/* This is slow, but is useful for debugging. */ -int DRM(histogram_slot)(unsigned long count) -{ - int value = DRM_DMA_HISTOGRAM_INITIAL; - int slot; - - for (slot = 0; - slot < DRM_DMA_HISTOGRAM_SLOTS; - ++slot, value = DRM_DMA_HISTOGRAM_NEXT(value)) { - if (count < value) return slot; - } - return DRM_DMA_HISTOGRAM_SLOTS - 1; -} - -void DRM(histogram_compute)(drm_device_t *dev, drm_buf_t *buf) -{ - cycles_t queued_to_dispatched; - cycles_t dispatched_to_completed; - cycles_t completed_to_freed; - int q2d, d2c, c2f, q2c, q2f; - - if (buf->time_queued) { - queued_to_dispatched = (buf->time_dispatched - - buf->time_queued); - dispatched_to_completed = (buf->time_completed - - buf->time_dispatched); - completed_to_freed = (buf->time_freed - - buf->time_completed); - - q2d = DRM(histogram_slot)(queued_to_dispatched); - d2c = DRM(histogram_slot)(dispatched_to_completed); - c2f = DRM(histogram_slot)(completed_to_freed); - - q2c = DRM(histogram_slot)(queued_to_dispatched - + dispatched_to_completed); - q2f = DRM(histogram_slot)(queued_to_dispatched - + dispatched_to_completed - + completed_to_freed); - - atomic_inc(&dev->histo.total); - atomic_inc(&dev->histo.queued_to_dispatched[q2d]); - atomic_inc(&dev->histo.dispatched_to_completed[d2c]); - atomic_inc(&dev->histo.completed_to_freed[c2f]); - - atomic_inc(&dev->histo.queued_to_completed[q2c]); - atomic_inc(&dev->histo.queued_to_freed[q2f]); - - } - buf->time_queued = 0; - buf->time_dispatched = 0; - buf->time_completed = 0; - buf->time_freed = 0; -} -#endif void DRM(free_buffer)(drm_device_t *dev, drm_buf_t *buf) { @@ -191,9 +136,6 @@ void DRM(free_buffer)(drm_device_t *dev, drm_buf_t *buf) buf->pending = 0; buf->filp = 0; buf->used = 0; -#if __HAVE_DMA_HISTOGRAM - buf->time_completed = get_cycles(); -#endif if ( __HAVE_DMA_WAITQUEUE && waitqueue_active(&buf->dma_wait)) { wake_up_interruptible(&buf->dma_wait); diff --git a/linux/drm_drv.h b/linux/drm_drv.h index 848a2f11..78cd3782 100644 --- a/linux/drm_drv.h +++ b/linux/drm_drv.h @@ -925,11 +925,6 @@ int DRM(lock)( struct inode *inode, struct file *filp, #if __HAVE_MULTIPLE_DMA_QUEUES drm_queue_t *q; #endif -#if __HAVE_DMA_HISTOGRAM - cycles_t start; - - dev->lck_start = start = get_cycles(); -#endif ++priv->lock_count; @@ -1021,9 +1016,6 @@ int DRM(lock)( struct inode *inode, struct file *filp, DRM_DEBUG( "%d %s\n", lock.context, ret ? "interrupted" : "has lock" ); -#if __HAVE_DMA_HISTOGRAM - atomic_inc(&dev->histo.lacq[DRM(histogram_slot)(get_cycles()-start)]); -#endif return ret; } diff --git a/linux/drm_lists.h b/linux/drm_lists.h index 4a64df71..09b6289b 100644 --- a/linux/drm_lists.h +++ b/linux/drm_lists.h @@ -77,9 +77,6 @@ int DRM(waitlist_put)(drm_waitlist_t *bl, drm_buf_t *buf) buf->idx, buf->filp); return -EINVAL; } -#if __HAVE_DMA_HISTOGRAM - buf->time_queued = get_cycles(); -#endif buf->list = DRM_LIST_WAIT; spin_lock_irqsave(&bl->write_lock, flags); @@ -146,10 +143,6 @@ int DRM(freelist_put)(drm_device_t *dev, drm_freelist_t *bl, drm_buf_t *buf) buf->idx, buf->waiting, buf->pending, buf->list); } if (!bl) return 1; -#if __HAVE_DMA_HISTOGRAM - buf->time_freed = get_cycles(); - DRM(histogram_compute)(dev, buf); -#endif buf->list = DRM_LIST_FREE; spin_lock(&bl->lock); diff --git a/linux/drm_proc.h b/linux/drm_proc.h index 5af8ddea..14813722 100644 --- a/linux/drm_proc.h +++ b/linux/drm_proc.h @@ -50,10 +50,6 @@ static int DRM(bufs_info)(char *buf, char **start, off_t offset, static int DRM(vma_info)(char *buf, char **start, off_t offset, int request, int *eof, void *data); #endif -#if __HAVE_DMA_HISTOGRAM -static int DRM(histo_info)(char *buf, char **start, off_t offset, - int request, int *eof, void *data); -#endif struct drm_proc_list { const char *name; @@ -68,9 +64,6 @@ struct drm_proc_list { #if DRM_DEBUG_CODE { "vma", DRM(vma_info) }, #endif -#if __HAVE_DMA_HISTOGRAM - { "histo", DRM(histo_info) }, -#endif }; #define DRM_PROC_ENTRIES (sizeof(DRM(proc_list))/sizeof(DRM(proc_list)[0])) @@ -491,143 +484,3 @@ static int DRM(vma_info)(char *buf, char **start, off_t offset, int request, #endif -#if __HAVE_DMA_HISTOGRAM -static int DRM(_histo_info)(char *buf, char **start, off_t offset, int request, - int *eof, void *data) -{ - drm_device_t *dev = (drm_device_t *)data; - int len = 0; - drm_device_dma_t *dma = dev->dma; - int i; - unsigned long slot_value = DRM_DMA_HISTOGRAM_INITIAL; - unsigned long prev_value = 0; - drm_buf_t *buffer; - - if (offset > DRM_PROC_LIMIT) { - *eof = 1; - return 0; - } - - *start = &buf[offset]; - *eof = 0; - - DRM_PROC_PRINT("general statistics:\n"); - DRM_PROC_PRINT("total %10u\n", atomic_read(&dev->histo.total)); - DRM_PROC_PRINT("open %10u\n", - atomic_read(&dev->counts[_DRM_STAT_OPENS])); - DRM_PROC_PRINT("close %10u\n", - atomic_read(&dev->counts[_DRM_STAT_CLOSES])); - DRM_PROC_PRINT("ioctl %10u\n", - atomic_read(&dev->counts[_DRM_STAT_IOCTLS])); - - DRM_PROC_PRINT("\nlock statistics:\n"); - DRM_PROC_PRINT("locks %10u\n", - atomic_read(&dev->counts[_DRM_STAT_LOCKS])); - DRM_PROC_PRINT("unlocks %10u\n", - atomic_read(&dev->counts[_DRM_STAT_UNLOCKS])); - - if (dma) { -#if 0 - DRM_PROC_PRINT("\ndma statistics:\n"); - DRM_PROC_PRINT("prio %10u\n", - atomic_read(&dma->total_prio)); - DRM_PROC_PRINT("bytes %10u\n", - atomic_read(&dma->total_bytes)); - DRM_PROC_PRINT("dmas %10u\n", - atomic_read(&dma->total_dmas)); - DRM_PROC_PRINT("missed:\n"); - DRM_PROC_PRINT(" dma %10u\n", - atomic_read(&dma->total_missed_dma)); - DRM_PROC_PRINT(" lock %10u\n", - atomic_read(&dma->total_missed_lock)); - DRM_PROC_PRINT(" free %10u\n", - atomic_read(&dma->total_missed_free)); - DRM_PROC_PRINT(" sched %10u\n", - atomic_read(&dma->total_missed_sched)); - DRM_PROC_PRINT("tried %10u\n", - atomic_read(&dma->total_tried)); - DRM_PROC_PRINT("hit %10u\n", - atomic_read(&dma->total_hit)); - DRM_PROC_PRINT("lost %10u\n", - atomic_read(&dma->total_lost)); -#endif - - buffer = dma->next_buffer; - if (buffer) { - DRM_PROC_PRINT("next_buffer %7d\n", buffer->idx); - } else { - DRM_PROC_PRINT("next_buffer none\n"); - } - buffer = dma->this_buffer; - if (buffer) { - DRM_PROC_PRINT("this_buffer %7d\n", buffer->idx); - } else { - DRM_PROC_PRINT("this_buffer none\n"); - } - } - - - DRM_PROC_PRINT("\nvalues:\n"); - if (dev->lock.hw_lock) { - DRM_PROC_PRINT("lock 0x%08x\n", - dev->lock.hw_lock->lock); - } else { - DRM_PROC_PRINT("lock none\n"); - } - DRM_PROC_PRINT("context_flag 0x%08lx\n", dev->context_flag); - DRM_PROC_PRINT("interrupt_flag 0x%08lx\n", dev->interrupt_flag); - DRM_PROC_PRINT("dma_flag 0x%08lx\n", dev->dma_flag); - - DRM_PROC_PRINT("queue_count %10d\n", dev->queue_count); - DRM_PROC_PRINT("last_context %10d\n", dev->last_context); - DRM_PROC_PRINT("last_switch %10lu\n", dev->last_switch); - DRM_PROC_PRINT("last_checked %10d\n", dev->last_checked); - - - DRM_PROC_PRINT("\n q2d d2c c2f" - " q2c q2f dma sch" - " ctx lacq lhld\n\n"); - for (i = 0; i < DRM_DMA_HISTOGRAM_SLOTS; i++) { - DRM_PROC_PRINT("%s %10lu %10u %10u %10u %10u %10u" - " %10u %10u %10u %10u %10u\n", - i == DRM_DMA_HISTOGRAM_SLOTS - 1 ? ">=" : "< ", - i == DRM_DMA_HISTOGRAM_SLOTS - 1 - ? prev_value : slot_value , - - atomic_read(&dev->histo - .queued_to_dispatched[i]), - atomic_read(&dev->histo - .dispatched_to_completed[i]), - atomic_read(&dev->histo - .completed_to_freed[i]), - - atomic_read(&dev->histo - .queued_to_completed[i]), - atomic_read(&dev->histo - .queued_to_freed[i]), - atomic_read(&dev->histo.dma[i]), - atomic_read(&dev->histo.schedule[i]), - atomic_read(&dev->histo.ctx[i]), - atomic_read(&dev->histo.lacq[i]), - atomic_read(&dev->histo.lhld[i])); - prev_value = slot_value; - slot_value = DRM_DMA_HISTOGRAM_NEXT(slot_value); - } - - if (len > request + offset) return request; - *eof = 1; - return len - offset; -} - -static int DRM(histo_info)(char *buf, char **start, off_t offset, int request, - int *eof, void *data) -{ - drm_device_t *dev = (drm_device_t *)data; - int ret; - - down(&dev->struct_sem); - ret = DRM(_histo_info)(buf, start, offset, request, eof, data); - up(&dev->struct_sem); - return ret; -} -#endif diff --git a/linux/gamma_dma.c b/linux/gamma_dma.c index cf25aaba..af64d371 100644 --- a/linux/gamma_dma.c +++ b/linux/gamma_dma.c @@ -145,15 +145,9 @@ static int gamma_do_dma(drm_device_t *dev, int locked) drm_buf_t *buf; int retcode = 0; drm_device_dma_t *dma = dev->dma; -#if DRM_DMA_HISTOGRAM - cycles_t dma_start, dma_stop; -#endif if (test_and_set_bit(0, &dev->dma_flag)) return -EBUSY; -#if DRM_DMA_HISTOGRAM - dma_start = get_cycles(); -#endif if (!dma->next_buffer) { DRM_ERROR("No next_buffer\n"); @@ -227,9 +221,6 @@ static int gamma_do_dma(drm_device_t *dev, int locked) buf->pending = 1; buf->waiting = 0; buf->list = DRM_LIST_PEND; -#if DRM_DMA_HISTOGRAM - buf->time_dispatched = get_cycles(); -#endif /* WE NOW ARE ON LOGICAL PAGES!!! - overriding address */ address = buf->idx << 12; @@ -251,10 +242,6 @@ cleanup: clear_bit(0, &dev->dma_flag); -#if DRM_DMA_HISTOGRAM - dma_stop = get_cycles(); - atomic_inc(&dev->histo.dma[gamma_histogram_slot(dma_stop - dma_start)]); -#endif return retcode; } @@ -279,9 +266,6 @@ int gamma_dma_schedule(drm_device_t *dev, int locked) int missed; int expire = 20; drm_device_dma_t *dma = dev->dma; -#if DRM_DMA_HISTOGRAM - cycles_t schedule_start; -#endif if (test_and_set_bit(0, &dev->interrupt_flag)) { /* Not reentrant */ @@ -290,9 +274,6 @@ int gamma_dma_schedule(drm_device_t *dev, int locked) } missed = atomic_read(&dev->counts[10]); -#if DRM_DMA_HISTOGRAM - schedule_start = get_cycles(); -#endif again: if (dev->context_flag) { @@ -339,10 +320,6 @@ again: clear_bit(0, &dev->interrupt_flag); -#if DRM_DMA_HISTOGRAM - atomic_inc(&dev->histo.schedule[gamma_histogram_slot(get_cycles() - - schedule_start)]); -#endif return retcode; } @@ -454,10 +431,6 @@ static int gamma_dma_priority(struct file *filp, } } -#if DRM_DMA_HISTOGRAM - buf->time_queued = get_cycles(); - buf->time_dispatched = buf->time_queued; -#endif gamma_dma_dispatch(dev, address, length); atomic_inc(&dev->counts[9]); /* _DRM_STAT_SPECIAL */ atomic_add(length, &dev->counts[8]); /* _DRM_STAT_PRIMARY */ -- cgit v1.2.3