linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: John Rose <johnrose@austin.ibm.com>
Cc: External List <linuxppc-dev@ozlabs.org>,
	Paul Mackerras <paulus@samba.org>
Subject: Re: [PATCH] use msleep() for RTAS delays
Date: Thu, 01 Jun 2006 15:31:06 +1000	[thread overview]
Message-ID: <1149139866.28307.32.camel@localhost.localdomain> (raw)
In-Reply-To: <1149103929.2524.8.camel@sinatra.austin.ibm.com>

On Wed, 2006-05-31 at 14:32 -0500, John Rose wrote:
> The current use of udelay() for RTAS extended delay conditions can
> result in CPU soft lockups.  The use of msleep() won't tie up the CPU.

What about putting this whole thing in a helper ? There is a few more
things I've seen floating around implementing the exact same logic (for
example Jake's MSI patches).

We could either do something like

for (;;) {
	rc = rtas_call(...);
	if (!rtas_check_busy(rc))
		break;
}

Or something inside rtas_call

rtas_call_waitbusy(...);

Ben.

> Signed-off-by: John Rose <johnrose@austin.ibm.com>
> 
> ---
> 
> Thanks-
> John
> 
> diff -puN arch/powerpc/kernel/rtas.c~msleep_rtas arch/powerpc/kernel/rtas.c
> --- 2_6_linus/arch/powerpc/kernel/rtas.c~msleep_rtas	2006-05-31 14:07:51.000000000 -0500
> +++ 2_6_linus-johnrose/arch/powerpc/kernel/rtas.c	2006-05-31 14:10:09.000000000 -0500
> @@ -447,10 +447,10 @@ int rtas_set_power_level(int powerdomain
>  	while (1) {
>  		rc = rtas_call(token, 2, 2, setlevel, powerdomain, level);
>  		if (rc == RTAS_BUSY)
> -			udelay(1);
> +			msleep(1);
>  		else if (rtas_is_extended_busy(rc)) {
>  			wait_time = rtas_extended_busy_delay_time(rc);
> -			udelay(wait_time * 1000);
> +			msleep(wait_time);
>  		} else
>  			break;
>  	}
> @@ -472,10 +472,10 @@ int rtas_get_sensor(int sensor, int inde
>  	while (1) {
>  		rc = rtas_call(token, 2, 2, state, sensor, index);
>  		if (rc == RTAS_BUSY)
> -			udelay(1);
> +			msleep(1);
>  		else if (rtas_is_extended_busy(rc)) {
>  			wait_time = rtas_extended_busy_delay_time(rc);
> -			udelay(wait_time * 1000);
> +			msleep(wait_time);
>  		} else
>  			break;
>  	}
> @@ -497,12 +497,11 @@ int rtas_set_indicator(int indicator, in
>  	while (1) {
>  		rc = rtas_call(token, 3, 1, NULL, indicator, index, new_value);
>  		if (rc == RTAS_BUSY)
> -			udelay(1);
> +			msleep(1);
>  		else if (rtas_is_extended_busy(rc)) {
>  			wait_time = rtas_extended_busy_delay_time(rc);
> -			udelay(wait_time * 1000);
> -		}
> -		else
> +			msleep(wait_time);
> +		} else
>  			break;
>  	}
>  
> diff -puN arch/powerpc/kernel/rtas_flash.c~msleep_rtas arch/powerpc/kernel/rtas_flash.c
> --- 2_6_linus/arch/powerpc/kernel/rtas_flash.c~msleep_rtas	2006-05-31 14:10:47.000000000 -0500
> +++ 2_6_linus-johnrose/arch/powerpc/kernel/rtas_flash.c	2006-05-31 14:19:30.000000000 -0500
> @@ -16,7 +16,7 @@
>  #include <linux/module.h>
>  #include <linux/init.h>
>  #include <linux/proc_fs.h>
> -#include <asm/delay.h>
> +#include <linux/delay.h>
>  #include <asm/uaccess.h>
>  #include <asm/rtas.h>
>  #include <asm/abs_addr.h>
> @@ -372,10 +372,10 @@ static void manage_flash(struct rtas_man
>  		rc = rtas_call(rtas_token("ibm,manage-flash-image"), 1, 
>  			       1, NULL, args_buf->op);
>  		if (rc == RTAS_RC_BUSY)
> -			udelay(1);
> +			msleep(1);
>  		else if (rtas_is_extended_busy(rc)) {
>  			wait_time = rtas_extended_busy_delay_time(rc);
> -			udelay(wait_time * 1000);
> +			msleep(wait_time);
>  		} else
>  			break;
>  	}
> @@ -465,10 +465,10 @@ static void validate_flash(struct rtas_v
>  		spin_unlock(&rtas_data_buf_lock);
>  			
>  		if (rc == RTAS_RC_BUSY)
> -			udelay(1);
> +			msleep(1);
>  		else if (rtas_is_extended_busy(rc)) {
>  			wait_time = rtas_extended_busy_delay_time(rc);
> -			udelay(wait_time * 1000);
> +			msleep(wait_time);
>  		} else
>  			break;
>  	}
> 
> _
> 
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev

  reply	other threads:[~2006-06-01  5:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-31 19:32 [PATCH] use msleep() for RTAS delays John Rose
2006-06-01  5:31 ` Benjamin Herrenschmidt [this message]
2006-06-01  5:39   ` Paul Mackerras
2006-06-01 18:09     ` Arnd Bergmann
2006-06-01 15:55   ` John Rose
2006-06-01 22:25     ` John Rose
2006-06-02 20:30       ` [PATCH] reorg RTAS delay code John Rose
2006-06-02 21:33         ` Nathan Lynch
2006-06-05 21:31           ` John Rose
2006-06-05 21:54             ` Nathan Lynch
2006-06-10  2:04             ` Anton Blanchard
2006-06-10  2:08               ` Anton Blanchard
2006-06-12 16:18                 ` John Rose
     [not found]                   ` <17553.4390.79327.634945@cargo.ozlabs.ibm.com>
2006-06-15 22:32                     ` [PATCH] powerpc: RTAS delay, fix module build breaks John Rose
2006-07-13 18:20             ` [PATCH] reorg RTAS delay code Nathan Lynch
2006-07-25  4:39               ` Haren Myneni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1149139866.28307.32.camel@localhost.localdomain \
    --to=benh@kernel.crashing.org \
    --cc=johnrose@austin.ibm.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).