public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fixes for IPMI use of timers
@ 2005-05-19 23:30 Corey Minyard
  2005-05-19 23:51 ` Lee Revell
  2005-05-21  1:14 ` George Anzinger
  0 siblings, 2 replies; 6+ messages in thread
From: Corey Minyard @ 2005-05-19 23:30 UTC (permalink / raw)
  To: Andrew Morton; +Cc: lkml

[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: ipmi_hrt_fixes.diff --]
[-- Type: text/x-patch, Size: 1365 bytes --]

Fix some problems with the high-res timer support.

Signed-off-by: Corey Minyard <minyard@acm.org>

Index: linux-2.6.12-rc4/drivers/char/ipmi/ipmi_si_intf.c
===================================================================
--- linux-2.6.12-rc4.orig/drivers/char/ipmi/ipmi_si_intf.c
+++ linux-2.6.12-rc4/drivers/char/ipmi/ipmi_si_intf.c
@@ -769,10 +769,11 @@
 
 		/* We already have irqsave on, so no need for it
                    here. */
-		read_lock(&xtime_lock);
+		read_lock_irqsave(&xtime_lock, flags);
 		jiffies_now = jiffies;
 		smi_info->si_timer.expires = jiffies_now;
 		smi_info->si_timer.sub_expires = get_arch_cycles(jiffies_now);
+		read_unlock_irqrestore(&xtime_lock, flags);
 
 		add_usec_to_timer(&smi_info->si_timer, SI_SHORT_TIMEOUT_USEC);
 
@@ -830,11 +831,11 @@
 		smi_info->short_timeouts++;
 		spin_unlock_irqrestore(&smi_info->count_lock, flags);
 #if defined(CONFIG_HIGH_RES_TIMERS)
-		read_lock(&xtime_lock);
+		read_lock_irqsave(&xtime_lock, flags);
                 smi_info->si_timer.expires = jiffies;
                 smi_info->si_timer.sub_expires
                         = get_arch_cycles(smi_info->si_timer.expires);
-                read_unlock(&xtime_lock);
+		read_unlock_irqrestore(&xtime_lock, flags);
 		add_usec_to_timer(&smi_info->si_timer, SI_SHORT_TIMEOUT_USEC);
 #else
 		smi_info->si_timer.expires = jiffies + 1;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Fixes for IPMI use of timers
  2005-05-19 23:30 [PATCH] Fixes for IPMI use of timers Corey Minyard
@ 2005-05-19 23:51 ` Lee Revell
  2005-05-20  2:20   ` Corey Minyard
  2005-05-21  1:14 ` George Anzinger
  1 sibling, 1 reply; 6+ messages in thread
From: Lee Revell @ 2005-05-19 23:51 UTC (permalink / raw)
  To: Corey Minyard; +Cc: Andrew Morton, lkml

On Thu, 2005-05-19 at 18:30 -0500, Corey Minyard wrote:
>                 /* We already have irqsave on, so no need for it
>                     here. */
> -               read_lock(&xtime_lock);
> +               read_lock_irqsave(&xtime_lock, flags); 

The comment is now wrong.

Lee


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Fixes for IPMI use of timers
  2005-05-19 23:51 ` Lee Revell
@ 2005-05-20  2:20   ` Corey Minyard
  0 siblings, 0 replies; 6+ messages in thread
From: Corey Minyard @ 2005-05-20  2:20 UTC (permalink / raw)
  To: Lee Revell; +Cc: Andrew Morton, lkml

[-- Attachment #1: Type: text/plain, Size: 436 bytes --]

Lee Revell wrote:

>On Thu, 2005-05-19 at 18:30 -0500, Corey Minyard wrote:
>  
>
>>                /* We already have irqsave on, so no need for it
>>                    here. */
>>-               read_lock(&xtime_lock);
>>+               read_lock_irqsave(&xtime_lock, flags); 
>>    
>>
>
>The comment is now wrong.
>
>Lee
>  
>
I know I deleted that at least once.  Oh well, here it is with the 
comment removed.

Thanks.

-Corey



[-- Attachment #2: ipmi_hrt_fixes.diff --]
[-- Type: text/x-patch, Size: 1454 bytes --]

Fix some problems with the high-res timer support.

Signed-off-by: Corey Minyard <minyard@acm.org>

Index: linux-2.6.12-rc4/drivers/char/ipmi/ipmi_si_intf.c
===================================================================
--- linux-2.6.12-rc4.orig/drivers/char/ipmi/ipmi_si_intf.c
+++ linux-2.6.12-rc4/drivers/char/ipmi/ipmi_si_intf.c
@@ -767,12 +767,11 @@
 		   immediately, anyway.  So we only process if we
 		   actually delete the timer. */
 
-		/* We already have irqsave on, so no need for it
-                   here. */
-		read_lock(&xtime_lock);
+		read_lock_irqsave(&xtime_lock, flags);
 		jiffies_now = jiffies;
 		smi_info->si_timer.expires = jiffies_now;
 		smi_info->si_timer.sub_expires = get_arch_cycles(jiffies_now);
+		read_unlock_irqrestore(&xtime_lock, flags);
 
 		add_usec_to_timer(&smi_info->si_timer, SI_SHORT_TIMEOUT_USEC);
 
@@ -830,11 +829,11 @@
 		smi_info->short_timeouts++;
 		spin_unlock_irqrestore(&smi_info->count_lock, flags);
 #if defined(CONFIG_HIGH_RES_TIMERS)
-		read_lock(&xtime_lock);
+		read_lock_irqsave(&xtime_lock, flags);
                 smi_info->si_timer.expires = jiffies;
                 smi_info->si_timer.sub_expires
                         = get_arch_cycles(smi_info->si_timer.expires);
-                read_unlock(&xtime_lock);
+		read_unlock_irqrestore(&xtime_lock, flags);
 		add_usec_to_timer(&smi_info->si_timer, SI_SHORT_TIMEOUT_USEC);
 #else
 		smi_info->si_timer.expires = jiffies + 1;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Fixes for IPMI use of timers
  2005-05-19 23:30 [PATCH] Fixes for IPMI use of timers Corey Minyard
  2005-05-19 23:51 ` Lee Revell
@ 2005-05-21  1:14 ` George Anzinger
  2005-05-21  1:30   ` Lee Revell
  1 sibling, 1 reply; 6+ messages in thread
From: George Anzinger @ 2005-05-21  1:14 UTC (permalink / raw)
  To: Corey Minyard; +Cc: Andrew Morton, lkml

Corey Minyard wrote:
> 
> 
> ------------------------------------------------------------------------
> 
> Fix some problems with the high-res timer support.
> 
> Signed-off-by: Corey Minyard <minyard@acm.org>
> 
> Index: linux-2.6.12-rc4/drivers/char/ipmi/ipmi_si_intf.c
> ===================================================================
> --- linux-2.6.12-rc4.orig/drivers/char/ipmi/ipmi_si_intf.c
> +++ linux-2.6.12-rc4/drivers/char/ipmi/ipmi_si_intf.c
> @@ -769,10 +769,11 @@
>  
>  		/* We already have irqsave on, so no need for it
>                     here. */
> -		read_lock(&xtime_lock);
> +		read_lock_irqsave(&xtime_lock, flags);

I rather hope this fails to compile :)  xtime_lock is a sequence lock in the 2.6 
kernel.

>  		jiffies_now = jiffies;
>  		smi_info->si_timer.expires = jiffies_now;
>  		smi_info->si_timer.sub_expires = get_arch_cycles(jiffies_now);
> +		read_unlock_irqrestore(&xtime_lock, flags);
>  
>  		add_usec_to_timer(&smi_info->si_timer, SI_SHORT_TIMEOUT_USEC);
>  
> @@ -830,11 +831,11 @@
>  		smi_info->short_timeouts++;
>  		spin_unlock_irqrestore(&smi_info->count_lock, flags);
>  #if defined(CONFIG_HIGH_RES_TIMERS)
> -		read_lock(&xtime_lock);
> +		read_lock_irqsave(&xtime_lock, flags);
>                  smi_info->si_timer.expires = jiffies;
>                  smi_info->si_timer.sub_expires
>                          = get_arch_cycles(smi_info->si_timer.expires);
> -                read_unlock(&xtime_lock);
> +		read_unlock_irqrestore(&xtime_lock, flags);
>  		add_usec_to_timer(&smi_info->si_timer, SI_SHORT_TIMEOUT_USEC);
>  #else
>  		smi_info->si_timer.expires = jiffies + 1;

-- 
George Anzinger   george@mvista.com
High-res-timers:  http://sourceforge.net/projects/high-res-timers/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Fixes for IPMI use of timers
  2005-05-21  1:14 ` George Anzinger
@ 2005-05-21  1:30   ` Lee Revell
  2005-05-21  2:00     ` Corey Minyard
  0 siblings, 1 reply; 6+ messages in thread
From: Lee Revell @ 2005-05-21  1:30 UTC (permalink / raw)
  To: george; +Cc: Corey Minyard, Andrew Morton, lkml

On Fri, 2005-05-20 at 18:14 -0700, George Anzinger wrote:
> >  		/* We already have irqsave on, so no need for it
> >                     here. */
> > -		read_lock(&xtime_lock);
> > +		read_lock_irqsave(&xtime_lock, flags);
> 
> I rather hope this fails to compile :)  xtime_lock is a sequence lock in the 2.6 
> kernel.
> 
> >  		jiffies_now = jiffies;
> >  		smi_info->si_timer.expires = jiffies_now;
> >  		smi_info->si_timer.sub_expires = get_arch_cycles(jiffies_now);
> > +		read_unlock_irqrestore(&xtime_lock, flags);

The old code clearly has an unbalanced lock/unlock, maybe it's
sufficient to just fix that?

Lee


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Fixes for IPMI use of timers
  2005-05-21  1:30   ` Lee Revell
@ 2005-05-21  2:00     ` Corey Minyard
  0 siblings, 0 replies; 6+ messages in thread
From: Corey Minyard @ 2005-05-21  2:00 UTC (permalink / raw)
  To: Lee Revell; +Cc: george, Andrew Morton, lkml

Lee Revell wrote:

>On Fri, 2005-05-20 at 18:14 -0700, George Anzinger wrote:
>  
>
>>> 		/* We already have irqsave on, so no need for it
>>>                    here. */
>>>-		read_lock(&xtime_lock);
>>>+		read_lock_irqsave(&xtime_lock, flags);
>>>      
>>>
>>I rather hope this fails to compile :)  xtime_lock is a sequence lock in the 2.6 
>>kernel.
>>
>>    
>>
>>> 		jiffies_now = jiffies;
>>> 		smi_info->si_timer.expires = jiffies_now;
>>> 		smi_info->si_timer.sub_expires = get_arch_cycles(jiffies_now);
>>>+		read_unlock_irqrestore(&xtime_lock, flags);
>>>      
>>>
>
>The old code clearly has an unbalanced lock/unlock, maybe it's
>sufficient to just fix that?
>  
>
Yes, probably just best to fix that up.  When high-res timers make it 
into the kernel, this can be fixed up, this is left over from the 2.4 
high-res timers.

-Corey

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-05-21  2:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-19 23:30 [PATCH] Fixes for IPMI use of timers Corey Minyard
2005-05-19 23:51 ` Lee Revell
2005-05-20  2:20   ` Corey Minyard
2005-05-21  1:14 ` George Anzinger
2005-05-21  1:30   ` Lee Revell
2005-05-21  2:00     ` Corey Minyard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox