[openib-general] RE: [PATCH][kdapl] replace spin_lock with spin_lock_irqsave in kd apltest

James Lentini jlentini at netapp.com
Tue May 31 08:40:49 PDT 2005


Ok, then it should be removed completely not commented out. I'll do 
that and commit.

On Tue, 31 May 2005, Itamar Rabenstein wrote:

itamar> it is only declared not in use so we dont need it (;-)
itamar> 
itamar>   Itamar
itamar> 
itamar> > -----Original Message-----
itamar> > From: James Lentini [mailto:jlentini at netapp.com]
itamar> > Sent: Tuesday, May 31, 2005 5:46 PM
itamar> > To: Itamar
itamar> > Cc: openib-general
itamar> > Subject: Re: [PATCH][kdapl] replace spin_lock with 
itamar> > spin_lock_irqsave in
itamar> > kdapltest
itamar> > 
itamar> > 
itamar> > 
itamar> > Itamar,
itamar> > 
itamar> > Why does this patch comment out uses of the g_PerfTestLock? 
itamar> > 
itamar> > james
itamar> > 
itamar> > On Sun, 29 May 2005, Itamar wrote:
itamar> > 
itamar> > itamar> With this patch i can run kdapltest -T T ... -t 4 -w 8 ...
itamar> > itamar> I still see problems but in general this patch helps 
itamar> > the stability a lot.
itamar> > itamar> 
itamar> > itamar> replace spin_lock with spin_lock_irqsave in kdapltest
itamar> > itamar> Signed-off-by: Itamar Rabenstein <itamar at mellanox.co.il>
itamar> > itamar> 
itamar> > itamar> Index: test/dapl_transaction_stats.c
itamar> > itamar> 
itamar> > ===================================================================
itamar> > itamar> --- test/dapl_transaction_stats.c	(revision 2509)
itamar> > itamar> +++ test/dapl_transaction_stats.c	(working copy)
itamar> > itamar> @@ -45,12 +45,13 @@
itamar> > itamar>  DT_transaction_stats_set_ready (DT_Tdep_Print_Head *phead, 
itamar> > itamar>  				Transaction_Stats_t * 
itamar> > transaction_stats)
itamar> > itamar>  {
itamar> > itamar> -    DT_Mdep_Lock (&transaction_stats->lock);
itamar> > itamar> +	unsigned long flags;
itamar> > itamar> +    spin_lock_irqsave (&transaction_stats->lock,flags);
itamar> > itamar>      transaction_stats->wait_count--;
itamar> > itamar>  
itamar> > itamar>      DT_Tdep_PT_Debug (1,(phead,"Received Sync 
itamar> > Message from server (%d left)\n",
itamar> > itamar>  		    transaction_stats->wait_count));
itamar> > itamar> -    DT_Mdep_Unlock (&transaction_stats->lock);
itamar> > itamar> +    spin_unlock_irqrestore (&transaction_stats->lock,flags);
itamar> > itamar>  }
itamar> > itamar>  
itamar> > itamar>  boolean_t
itamar> > itamar> @@ -86,7 +87,8 @@
itamar> > itamar>  		       unsigned int bytes_rdma_read,
itamar> > itamar>  		       unsigned int bytes_rdma_write)
itamar> > itamar>  {
itamar> > itamar> -    DT_Mdep_Lock (&transaction_stats->lock);
itamar> > itamar> +	unsigned long flags;
itamar> > itamar> +    spin_lock_irqsave (&transaction_stats->lock,flags);
itamar> > itamar>  
itamar> > itamar>      /* look for the longest time... */
itamar> > itamar>      if (time_ms > transaction_stats->time_ms)
itamar> > itamar> @@ -99,5 +101,5 @@
itamar> > itamar>      transaction_stats->bytes_recv += bytes_recv;
itamar> > itamar>      transaction_stats->bytes_rdma_read += bytes_rdma_read;
itamar> > itamar>      transaction_stats->bytes_rdma_write += bytes_rdma_write;
itamar> > itamar> -    DT_Mdep_Unlock (&transaction_stats->lock);
itamar> > itamar> +    spin_unlock_irqrestore (&transaction_stats->lock,flags);
itamar> > itamar>  }
itamar> > itamar> Index: test/dapl_server.c
itamar> > itamar> 
itamar> > ===================================================================
itamar> > itamar> --- test/dapl_server.c	(revision 2509)
itamar> > itamar> +++ test/dapl_server.c	(working copy)
itamar> > itamar> @@ -49,7 +49,7 @@
itamar> > itamar>      unsigned char       *buffp          = NULL;
itamar> > itamar>      unsigned char       *module         = "DT_cs_Server";
itamar> > itamar>      int 		status 		= 0;
itamar> > itamar> -
itamar> > itamar> +	unsigned long flags;
itamar> > itamar>      DAT_DTO_COOKIE	dto_cookie;
itamar> > itamar>      struct dat_dto_completion_event_data dto_stat;
itamar> > itamar>      u32          ret;
itamar> > itamar> @@ -616,9 +616,9 @@
itamar> > itamar>  
itamar> > itamar>  
itamar> > itamar>  	/* Count this new client and get ready for the next */
itamar> > itamar> -	DT_Mdep_Lock (&ps_ptr->num_clients_lock);
itamar> > itamar> +	spin_lock_irqsave (&ps_ptr->num_clients_lock,flags);
itamar> > itamar>  	ps_ptr->num_clients++;
itamar> > itamar> -	DT_Mdep_Unlock (&ps_ptr->num_clients_lock);
itamar> > itamar> +	spin_unlock_irqrestore 
itamar> > (&ps_ptr->num_clients_lock,flags);
itamar> > itamar>  
itamar> > itamar>  	/* we passed the pt_ptr to the thread and must 
itamar> > now 'forget' it */
itamar> > itamar>  	pt_ptr = NULL;
itamar> > itamar> Index: test/dapl_thread.c
itamar> > itamar> 
itamar> > ===================================================================
itamar> > itamar> --- test/dapl_thread.c	(revision 2509)
itamar> > itamar> +++ test/dapl_thread.c	(working copy)
itamar> > itamar> @@ -83,6 +83,7 @@
itamar> > itamar>  	      unsigned int stacksize)
itamar> > itamar>  {
itamar> > itamar>      Thread         *thread_ptr;
itamar> > itamar> +	unsigned long flags;
itamar> > itamar>      thread_ptr = (Thread *) DT_MemListAlloc (pt_ptr, 
itamar> > "thread.c", THREAD, sizeof (Thread));
itamar> > itamar>      if (thread_ptr == NULL)
itamar> > itamar>      {
itamar> > itamar> @@ -93,9 +94,9 @@
itamar> > itamar>      thread_ptr->thread_handle = 0;
itamar> > itamar>      thread_ptr->stacksize = stacksize;
itamar> > itamar>  
itamar> > itamar> -    DT_Mdep_Lock (&pt_ptr->Thread_counter_lock);
itamar> > itamar> +    spin_lock_irqsave (&pt_ptr->Thread_counter_lock,flags);
itamar> > itamar>      pt_ptr->Thread_counter++;
itamar> > itamar> -    DT_Mdep_Unlock (&pt_ptr->Thread_counter_lock);
itamar> > itamar> +    spin_unlock_irqrestore 
itamar> > (&pt_ptr->Thread_counter_lock,flags);
itamar> > itamar>  
itamar> > itamar>      DT_Mdep_Thread_Init_Attributes (thread_ptr);
itamar> > itamar>  
itamar> > itamar> @@ -108,11 +109,12 @@
itamar> > itamar>  void
itamar> > itamar>  DT_Thread_Destroy (Thread * thread_ptr, 
itamar> > Per_Test_Data_t * pt_ptr)
itamar> > itamar>  {
itamar> > itamar> +	unsigned long flags;
itamar> > itamar>      if (thread_ptr)
itamar> > itamar>      {
itamar> > itamar> -	DT_Mdep_Lock (&pt_ptr->Thread_counter_lock);
itamar> > itamar> +	spin_lock_irqsave (&pt_ptr->Thread_counter_lock,flags);
itamar> > itamar>  	pt_ptr->Thread_counter--;
itamar> > itamar> -	DT_Mdep_Unlock (&pt_ptr->Thread_counter_lock);
itamar> > itamar> +	spin_unlock_irqrestore 
itamar> > (&pt_ptr->Thread_counter_lock,flags);
itamar> > itamar>  
itamar> > itamar>  	DT_Mdep_Thread_Destroy_Attributes (thread_ptr);
itamar> > itamar>  	DT_MemListFree (pt_ptr, thread_ptr);
itamar> > itamar> Index: test/dapl_test_data.c
itamar> > itamar> 
itamar> > ===================================================================
itamar> > itamar> --- test/dapl_test_data.c	(revision 2509)
itamar> > itamar> +++ test/dapl_test_data.c	(working copy)
itamar> > itamar> @@ -27,7 +27,7 @@
itamar> > itamar>  
itamar> > itamar>  #include "dapl_proto.h"
itamar> > itamar>  
itamar> > itamar> -DT_Mdep_LockType     g_PerfTestLock;
itamar> > itamar> +/*DT_Mdep_LockType     g_PerfTestLock;*/
itamar> > itamar>  /*
itamar> > itamar>   * check memory leaking int             alloc_count; 
itamar> > DT_Mdep_LockType
itamar> > itamar>   * Alloc_Count_Lock;
itamar> > itamar> Index: test/dapl_transaction_test.c
itamar> > itamar> 
itamar> > ===================================================================
itamar> > itamar> --- test/dapl_transaction_test.c	(revision 2509)
itamar> > itamar> +++ test/dapl_transaction_test.c	(working copy)
itamar> > itamar> @@ -99,7 +99,7 @@
itamar> > itamar>      unsigned int      i;
itamar> > itamar>      DT_Tdep_Print_Head *phead;
itamar> > itamar>      int status = 0;
itamar> > itamar> -
itamar> > itamar> +	unsigned long flags;
itamar> > itamar>      phead = pt_ptr->Params.phead;
itamar> > itamar>  
itamar> > itamar>      pt_ptr->Countdown_Counter = cmd->num_threads;
itamar> > itamar> @@ -129,9 +129,9 @@
itamar> > itamar>      }
itamar> > itamar>      DT_Thread_Destroy (pt_ptr->thread, pt_ptr);	
itamar> >     /* destroy Master thread */
itamar> > itamar>  
itamar> > itamar> -    DT_Mdep_Lock (&pt_ptr->ps_ptr->num_clients_lock);
itamar> > itamar> +    spin_lock_irqsave 
itamar> > (&pt_ptr->ps_ptr->num_clients_lock,flags);
itamar> > itamar>      pt_ptr->ps_ptr->num_clients--;
itamar> > itamar> -    DT_Mdep_Unlock (&pt_ptr->ps_ptr->num_clients_lock);
itamar> > itamar> +    spin_unlock_irqrestore 
itamar> > (&pt_ptr->ps_ptr->num_clients_lock,flags);
itamar> > itamar>  
itamar> > itamar>      /* NB: Server has no pt_ptr->remote_netaddr */
itamar> > itamar>      DT_PrintMemList (pt_ptr);	    /* check if 
itamar> > we return all space allocated */
itamar> > itamar> @@ -239,7 +239,7 @@
itamar> > itamar>      enum dat_event_number    event_num;
itamar> > itamar>      DT_Tdep_Print_Head *phead;
itamar> > itamar>      int status = 0;
itamar> > itamar> -
itamar> > itamar> +	unsigned long flags;
itamar> > itamar>      pt_ptr = test_ptr->pt_ptr;
itamar> > itamar>      thread = test_ptr->thread;
itamar> > itamar>      phead = pt_ptr->Params.phead;
itamar> > itamar> @@ -502,7 +502,7 @@
itamar> > itamar>       */
itamar> > itamar>      if (pt_ptr->local_is_server)
itamar> > itamar>      {
itamar> > itamar> -	DT_Mdep_Lock (&pt_ptr->Thread_counter_lock);
itamar> > itamar> +	spin_lock_irqsave (&pt_ptr->Thread_counter_lock,flags);
itamar> > itamar>  	pt_ptr->Countdown_Counter--;
itamar> > itamar>  	/* Deliberate pre-decrement.  Post decrement won't
itamar> > itamar>  	 * work here, so don't do it.
itamar> > itamar> @@ -512,7 +512,7 @@
itamar> > itamar>  	    DT_Mdep_wait_object_wakeup 
itamar> > (&pt_ptr->synch_wait_object);
itamar> > itamar>  	}
itamar> > itamar>  
itamar> > itamar> -	DT_Mdep_Unlock (&pt_ptr->Thread_counter_lock);
itamar> > itamar> +	spin_unlock_irqrestore 
itamar> > (&pt_ptr->Thread_counter_lock,flags);
itamar> > itamar>      }
itamar> > itamar>  
itamar> > itamar>      for (i = 0;  i < test_ptr->cmd->eps_per_thread;  i++)
itamar> > itamar> Index: test/dapl_performance_server.c
itamar> > itamar> 
itamar> > ===================================================================
itamar> > itamar> --- test/dapl_performance_server.c	(revision 2509)
itamar> > itamar> +++ test/dapl_performance_server.c	(working copy)
itamar> > itamar> @@ -36,7 +36,7 @@
itamar> > itamar>      Performance_Test_t 		*test_ptr = NULL;
itamar> > itamar>      DT_Tdep_Print_Head		*phead;
itamar> > itamar>      int 			 status = 0;
itamar> > itamar> -
itamar> > itamar> +	unsigned long flags;
itamar> > itamar>      phead = pt_ptr->Params.phead;
itamar> > itamar>      DT_Tdep_PT_Debug (1,(phead,"Server: Starting 
itamar> > performance test\n"));
itamar> > itamar>  
itamar> > itamar> @@ -75,9 +75,9 @@
itamar> > itamar>      DT_Mdep_Thread_Detach (DT_Mdep_Thread_SELF ());	
itamar> >  /* AMM */
itamar> > itamar>      DT_Thread_Destroy (pt_ptr->thread, pt_ptr);	
itamar> >     /* destroy Master thread */
itamar> > itamar>  
itamar> > itamar> -    DT_Mdep_Lock (&pt_ptr->ps_ptr->num_clients_lock);
itamar> > itamar> +    spin_lock_irqsave 
itamar> > (&pt_ptr->ps_ptr->num_clients_lock,flags);
itamar> > itamar>      pt_ptr->ps_ptr->num_clients--;
itamar> > itamar> -    DT_Mdep_Unlock (&pt_ptr->ps_ptr->num_clients_lock);
itamar> > itamar> +    spin_unlock_irqrestore 
itamar> > (&pt_ptr->ps_ptr->num_clients_lock,flags);
itamar> > itamar>  
itamar> > itamar>      DT_PrintMemList (pt_ptr);	    /* check if 
itamar> > we return all space allocated */
itamar> > itamar>      DT_Mdep_LockDestroy (&pt_ptr->Thread_counter_lock);
itamar> > itamar> Index: test/dapl_memlist.c
itamar> > itamar> 
itamar> > ===================================================================
itamar> > itamar> --- test/dapl_memlist.c	(revision 2509)
itamar> > itamar> +++ test/dapl_memlist.c	(working copy)
itamar> > itamar> @@ -42,6 +42,7 @@
itamar> > itamar>  {
itamar> > itamar>      void           *buffptr;
itamar> > itamar>      MemListEntry_t *entry_ptr;
itamar> > itamar> +	unsigned long flags;
itamar> > itamar>      buffptr = NULL;
itamar> > itamar>      entry_ptr = NULL;
itamar> > itamar>  
itamar> > itamar> @@ -64,10 +65,10 @@
itamar> > itamar>      entry_ptr->MemType = t;
itamar> > itamar>      entry_ptr->mem_ptr = buffptr;
itamar> > itamar>  
itamar> > itamar> -    DT_Mdep_Lock (&pt_ptr->MemListLock);
itamar> > itamar> +    spin_lock_irqsave (&pt_ptr->MemListLock,flags);
itamar> > itamar>      entry_ptr->next = pt_ptr->MemListHead;
itamar> > itamar>      pt_ptr->MemListHead = entry_ptr;
itamar> > itamar> -    DT_Mdep_Unlock (&pt_ptr->MemListLock);
itamar> > itamar> +    spin_unlock_irqrestore (&pt_ptr->MemListLock,flags);
itamar> > itamar>  
itamar> > itamar>      return buffptr;
itamar> > itamar>  }
itamar> > itamar> @@ -76,12 +77,13 @@
itamar> > itamar>  DT_MemListFree (Per_Test_Data_t * pt_ptr, void *ptr)
itamar> > itamar>  {
itamar> > itamar>      MemListEntry_t *pre, *cur;
itamar> > itamar> +	unsigned long flags;
itamar> > itamar>      if (pt_ptr == 0)	      /* not use mem_list */
itamar> > itamar>      {
itamar> > itamar>  	DT_Mdep_Free (ptr);
itamar> > itamar>  	return;
itamar> > itamar>      }
itamar> > itamar> -    DT_Mdep_Lock (&pt_ptr->MemListLock);
itamar> > itamar> +    spin_lock_irqsave (&pt_ptr->MemListLock,flags);
itamar> > itamar>      pre = NULL;
itamar> > itamar>      cur = pt_ptr->MemListHead;
itamar> > itamar>      while (cur)
itamar> > itamar> @@ -106,7 +108,7 @@
itamar> > itamar>  	cur = cur->next;
itamar> > itamar>      }
itamar> > itamar>  unlock_and_return:
itamar> > itamar> -    DT_Mdep_Unlock (&pt_ptr->MemListLock);
itamar> > itamar> +    spin_unlock_irqrestore (&pt_ptr->MemListLock,flags);
itamar> > itamar>  }
itamar> > itamar>  
itamar> > itamar>  void
itamar> > itamar> @@ -119,9 +121,9 @@
itamar> > itamar>      };
itamar> > itamar>      DT_Tdep_Print_Head *phead;
itamar> > itamar>      MemListEntry_t *cur;
itamar> > itamar> -
itamar> > itamar> +	unsigned long flags;
itamar> > itamar>      phead = pt_ptr->Params.phead;
itamar> > itamar> -    DT_Mdep_Lock (&pt_ptr->MemListLock);
itamar> > itamar> +    spin_lock_irqsave (&pt_ptr->MemListLock,flags);
itamar> > itamar>      cur = pt_ptr->MemListHead;
itamar> > itamar>      if (cur != 0)
itamar> > itamar>      {
itamar> > itamar> @@ -133,5 +135,5 @@
itamar> > itamar>  		    cur->filename, type[cur->MemType]);
itamar> > itamar>  	cur = cur->next;
itamar> > itamar>      }
itamar> > itamar> -    DT_Mdep_Unlock (&pt_ptr->MemListLock);
itamar> > itamar> +    spin_unlock_irqrestore (&pt_ptr->MemListLock,flags);
itamar> > itamar>  }
itamar> > itamar> Index: include/dapl_test_data.h
itamar> > itamar> 
itamar> > ===================================================================
itamar> > itamar> --- include/dapl_test_data.h	(revision 2509)
itamar> > itamar> +++ include/dapl_test_data.h	(working copy)
itamar> > itamar> @@ -42,7 +42,7 @@
itamar> > itamar>   * problems on the server side occasionally
itamar> > itamar>   * the server will reject connections.
itamar> > itamar>   */
itamar> > itamar> -extern	 	DT_Mdep_LockType    g_PerfTestLock;
itamar> > itamar> +/*extern	 	DT_Mdep_LockType    g_PerfTestLock; */
itamar> > itamar>  
itamar> > itamar>  /*
itamar> > itamar>   * check memory leaking extern int              
itamar> > alloc_count ; extern
itamar> > itamar> Index: kdapl/kdapl_module.c
itamar> > itamar> 
itamar> > ===================================================================
itamar> > itamar> --- kdapl/kdapl_module.c	(revision 2509)
itamar> > itamar> +++ kdapl/kdapl_module.c	(working copy)
itamar> > itamar> @@ -95,10 +95,10 @@
itamar> > itamar>  				break;
itamar> > itamar>  			}
itamar> > itamar>  
itamar> > itamar> -			DT_Mdep_Lock(&kdapltest_lock);
itamar> > itamar> +			spin_lock_irq(&kdapltest_lock);
itamar> > itamar>  			kdapltest_num++;
itamar> > itamar>  			instance = kdapltest_num;
itamar> > itamar> -			DT_Mdep_Unlock(&kdapltest_lock);
itamar> > itamar> +			spin_unlock_irq(&kdapltest_lock);
itamar> > itamar>  
itamar> > itamar>  			local_params->phead = 
itamar> > KDT_Print_Alloc(instance);
itamar> > itamar>  			if (!local_params->phead) {
itamar> > itamar> @@ -201,7 +201,7 @@
itamar> > itamar>  static __init int kdapltest_init(void)
itamar> > itamar>  {
itamar> > itamar>  
itamar> > itamar> -	DT_Mdep_LockInit(&g_PerfTestLock);	/* For 
itamar> > uDAPL, this is done in Tdep_init() */
itamar> > itamar> +   /* DT_Mdep_LockInit(&g_PerfTestLock);	 For 
itamar> > uDAPL, this is done in Tdep_init() */
itamar> > itamar>  	kdapltest_major = register_chrdev(0, 
itamar> > "kdapltest", &kdapltest_fops);
itamar> > itamar>  	DT_Mdep_LockInit(&kdapltest_lock);
itamar> > itamar>  	kdapltest_num = 0;
itamar> > itamar> @@ -218,7 +218,7 @@
itamar> > itamar>  	KDT_Print_Destroy();
itamar> > itamar>  	KDT_Evd_Destroy();
itamar> > itamar>  	DT_Mdep_LockDestroy(&kdapltest_lock);
itamar> > itamar> -	DT_Mdep_LockDestroy(&g_PerfTestLock);	/* For 
itamar> > uDAPL, this is done in Tdep_end() */
itamar> > itamar> +   /* DT_Mdep_LockDestroy(&g_PerfTestLock);	 For 
itamar> > uDAPL, this is done in Tdep_end() */  
itamar> > itamar>  }
itamar> > itamar>  
itamar> > itamar>  module_init(kdapltest_init);
itamar> > itamar> Index: kdapl/kdapl_tdep_print.c
itamar> > itamar> 
itamar> > ===================================================================
itamar> > itamar> --- kdapl/kdapl_tdep_print.c	(revision 2509)
itamar> > itamar> +++ kdapl/kdapl_tdep_print.c	(working copy)
itamar> > itamar> @@ -106,7 +106,7 @@
itamar> > itamar>      va_list		args;
itamar> > itamar>      int			len;
itamar> > itamar>      Tdep_Print_Entry 	*entry;
itamar> > itamar> -
itamar> > itamar> +	unsigned long flags;
itamar> > itamar>      entry = DT_Mdep_Malloc (sizeof (Tdep_Print_Entry));
itamar> > itamar>  
itamar> > itamar>      va_start (args, fmt);
itamar> > itamar> @@ -120,7 +120,7 @@
itamar> > itamar>      }
itamar> > itamar>      entry->next = NULL;
itamar> > itamar>  
itamar> > itamar> -    DT_Mdep_Lock (&phead->lock);
itamar> > itamar> +    spin_lock_irqsave (&phead->lock,flags);
itamar> > itamar>  
itamar> > itamar>      if (phead->head == NULL)
itamar> > itamar>      {
itamar> > itamar> @@ -133,7 +133,7 @@
itamar> > itamar>  	phead->tail = entry;
itamar> > itamar>      }
itamar> > itamar>      DT_Mdep_wait_object_wakeup (&phead->wait_object);
itamar> > itamar> -    DT_Mdep_Unlock (&phead->lock);
itamar> > itamar> +    spin_unlock_irqrestore (&phead->lock,flags);
itamar> > itamar>  }
itamar> > itamar>  
itamar> > itamar>  int
itamar> > itamar> @@ -143,10 +143,10 @@
itamar> > itamar>      DT_Tdep_Print_Head  *phead;
itamar> > itamar>      Tdep_Print_Entry    *entry;
itamar> > itamar>      int rc;
itamar> > itamar> -
itamar> > itamar> +	unsigned long flags;
itamar> > itamar>      buffer[0] = '\0';
itamar> > itamar>  
itamar> > itamar> -    DT_Mdep_Lock (&DT_Print_List_Lock);
itamar> > itamar> +    spin_lock_irqsave (&DT_Print_List_Lock,flags);
itamar> > itamar>      phead = DT_Print_List;
itamar> > itamar>      while (phead)
itamar> > itamar>      {
itamar> > itamar> @@ -156,7 +156,7 @@
itamar> > itamar>  	}
itamar> > itamar>  	phead = phead->next;
itamar> > itamar>      }
itamar> > itamar> -    DT_Mdep_Unlock (&DT_Print_List_Lock);
itamar> > itamar> +    spin_unlock_irqrestore (&DT_Print_List_Lock,flags);
itamar> > itamar>  
itamar> > itamar>      if (!phead)
itamar> > itamar>      {
itamar> > itamar> @@ -172,7 +172,7 @@
itamar> > itamar>  	    return 0;
itamar> > itamar>  	}
itamar> > itamar>  
itamar> > itamar> -	DT_Mdep_Lock (&phead->lock);
itamar> > itamar> +	spin_lock_irqsave (&phead->lock,flags);
itamar> > itamar>  	entry = phead->head;
itamar> > itamar>  	if (entry)
itamar> > itamar>  	{
itamar> > itamar> @@ -184,7 +184,7 @@
itamar> > itamar>  	    strncpy (buffer, entry->buffer, PRINT_MAX);
itamar> > itamar>  	    DT_Mdep_Free (entry);
itamar> > itamar>  	}
itamar> > itamar> -	DT_Mdep_Unlock (&phead->lock);
itamar> > itamar> +	spin_unlock_irqrestore (&phead->lock,flags);
itamar> > itamar>      }
itamar> > itamar>  
itamar> > itamar>      len = strlen (buffer);
itamar> > itamar> Index: kdapl/kdapl_tdep_evd.c
itamar> > itamar> 
itamar> > ===================================================================
itamar> > itamar> --- kdapl/kdapl_tdep_evd.c	(revision 2509)
itamar> > itamar> +++ kdapl/kdapl_tdep_evd.c	(working copy)
itamar> > itamar> @@ -105,7 +105,7 @@
itamar> > itamar>      u32 		dat_status;
itamar> > itamar>      struct dat_upcall_object upcall;
itamar> > itamar>      Tdep_Evd		*evd_ptr;
itamar> > itamar> -
itamar> > itamar> +	unsigned long flags;
itamar> > itamar>      evd_ptr = NULL;
itamar> > itamar>      dat_status = DAT_SUCCESS;
itamar> > itamar>  
itamar> > itamar> @@ -139,10 +139,10 @@
itamar> > itamar>      DT_Mdep_wait_object_init (&evd_ptr->wait_object);
itamar> > itamar>  
itamar> > itamar>      /* add evd_ptr to front of evd list */
itamar> > itamar> -    DT_Mdep_Lock (&DT_Evd_Lock);
itamar> > itamar> +    spin_lock_irqsave (&DT_Evd_Lock, flags);
itamar> > itamar>      evd_ptr->evd_next = DT_Evd_List;
itamar> > itamar>      DT_Evd_List = evd_ptr;
itamar> > itamar> -    DT_Mdep_Unlock (&DT_Evd_Lock);
itamar> > itamar> +    spin_unlock_irqrestore (&DT_Evd_Lock, flags);
itamar> > itamar>  
itamar> > itamar>  error:
itamar> > itamar>      if (dat_status != DAT_SUCCESS)
itamar> > itamar> @@ -161,7 +161,7 @@
itamar> > itamar>      u32 dat_status;
itamar> > itamar>      Tdep_Evd   *evd_ptr;    
itamar> > itamar>      Tdep_Event *event;
itamar> > itamar> -
itamar> > itamar> +	unsigned long flags;
itamar> > itamar>      dat_status = DAT_SUCCESS;
itamar> > itamar>  
itamar> > itamar>      /* find the evd_ptr associated with evd_handle */
itamar> > itamar> @@ -181,7 +181,7 @@
itamar> > itamar>                 DAT_INTERNAL_ERROR;
itamar> > itamar>      }
itamar> > itamar>      /* Get event */
itamar> > itamar> -    DT_Mdep_Lock (&DT_Evd_Lock);
itamar> > itamar> +    spin_lock_irqsave (&DT_Evd_Lock, flags);
itamar> > itamar>      event = evd_ptr->event_next; /* event present in 
itamar> > evd_ptr corresponding to the given evd_handle */
itamar> > itamar>      if (event)
itamar> > itamar>      {
itamar> > itamar> @@ -207,7 +207,7 @@
itamar> > itamar>      {
itamar> > itamar>          dat_status = DAT_QUEUE_EMPTY;
itamar> > itamar>      }
itamar> > itamar> -    DT_Mdep_Unlock (&DT_Evd_Lock);
itamar> > itamar> +    spin_unlock_irqrestore (&DT_Evd_Lock, flags);
itamar> > itamar>  
itamar> > itamar>      return dat_status;
itamar> > itamar>  }
itamar> > itamar> @@ -261,7 +261,7 @@
itamar> > itamar>      }
itamar> > itamar>  
itamar> > itamar>      /* Got event */
itamar> > itamar> -    DT_Mdep_Lock (&DT_Evd_Lock);
itamar> > itamar> +    spin_lock_irq (&DT_Evd_Lock);
itamar> > itamar>      event = evd_ptr->event_next;
itamar> > itamar>      if (event)
itamar> > itamar>      {
itamar> > itamar> @@ -286,7 +286,7 @@
itamar> > itamar>  	}
itamar> > itamar>      }
itamar> > itamar>  
itamar> > itamar> -    DT_Mdep_Unlock (&DT_Evd_Lock);
itamar> > itamar> +    spin_unlock_irq (&DT_Evd_Lock);
itamar> > itamar>      return dat_status;
itamar> > itamar>  }
itamar> > itamar>  
itamar> > itamar> @@ -297,7 +297,7 @@
itamar> > itamar>      Tdep_Evd	*last;
itamar> > itamar>  
itamar> > itamar>      last = NULL;
itamar> > itamar> -    DT_Mdep_Lock (&DT_Evd_Lock);
itamar> > itamar> +    spin_lock_irq (&DT_Evd_Lock);
itamar> > itamar>      next = DT_Evd_List;
itamar> > itamar>      if (next->evd_handle == evd_handle)
itamar> > itamar>      {
itamar> > itamar> @@ -315,7 +315,7 @@
itamar> > itamar>  	    last->evd_next = next->evd_next;
itamar> > itamar>  	}
itamar> > itamar>      }
itamar> > itamar> -    DT_Mdep_Unlock (&DT_Evd_Lock);
itamar> > itamar> +    spin_unlock_irq (&DT_Evd_Lock);
itamar> > itamar>  
itamar> > itamar>      DT_Mdep_Free (next);
itamar> > itamar>      return dat_evd_free(evd_handle);
itamar> > itamar> @@ -331,7 +331,7 @@
itamar> > itamar>  
itamar> > itamar>      evd_ptr = (Tdep_Evd *) instance_data;
itamar> > itamar>  
itamar> > itamar> -    DT_Mdep_Lock (&DT_Evd_Lock);
itamar> > itamar> +    spin_lock_irq (&DT_Evd_Lock);
itamar> > itamar>      if (DT_Event_Free_List)
itamar> > itamar>      {
itamar> > itamar>  	event = DT_Event_Free_List;
itamar> > itamar> @@ -356,6 +356,6 @@
itamar> > itamar>  	    evd_ptr->event_last = event;
itamar> > itamar>  	}
itamar> > itamar>      }
itamar> > itamar> -    DT_Mdep_Unlock (&DT_Evd_Lock);
itamar> > itamar> +    spin_unlock_irq (&DT_Evd_Lock);
itamar> > itamar>      DT_Mdep_wait_object_wakeup (&evd_ptr->wait_object);
itamar> > itamar>  }
itamar> > itamar> -- 
itamar> > itamar> Itamar
itamar> > itamar> 
itamar> > 
itamar> 



More information about the general mailing list