All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Gavin Shan <gwshan@linux.vnet.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] powerpc/pseries: Avoid context switch in EEH reset if required
Date: Tue, 20 Jan 2015 10:28:16 +0100	[thread overview]
Message-ID: <1421746096.4949.40.camel@kernel.crashing.org> (raw)
In-Reply-To: <1421621243-21265-1-git-send-email-gwshan@linux.vnet.ibm.com>

On Mon, 2015-01-19 at 09:47 +1100, Gavin Shan wrote:
> On pseries platform, the EEH reset backend pseries_eeh_reset() can
> be called in atomic context as follows. For this case, we should
> call udelay() instead of msleep() to avoid context switching.
> 
>      drivers/scsi/ipr.c::ipr_reset_slot_reset_done()
>      drivers/pci/pci.c::pci_set_pcie_reset_state()
>      arch/powerpc/kernel/eeh.c::pcibios_set_pcie_reset_state()
>      arch/powerpc/platforms/pseries/eeh_pseries.c::pseries_eeh_reset()

It's not acceptable to introduce multi-millisecond delays at interrupt
time. In fact, we should generally not use udelay in such context.

I understand that this is an exceptional error handling case but it's
still not right.

Are there many other users of pci_set_pcie_reset_state() at interrupt
time ? Can we have a discussion with the PCI folks as to whether that
should be legal or not ?

I'm tempted to require that it's made illegal.

Ben.

> Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
> Tested-by: Wen Xiong<wenxiong@linux.vnet.ibm.com>
> ---
>  arch/powerpc/platforms/pseries/eeh_pseries.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/pseries/eeh_pseries.c
> index a6c7e19..67623a3 100644
> --- a/arch/powerpc/platforms/pseries/eeh_pseries.c
> +++ b/arch/powerpc/platforms/pseries/eeh_pseries.c
> @@ -503,8 +503,7 @@ static int pseries_eeh_get_state(struct eeh_pe *pe, int *state)
>   */
>  static int pseries_eeh_reset(struct eeh_pe *pe, int option)
>  {
> -	int config_addr;
> -	int ret;
> +	int config_addr, delay, ret;
>  
>  	/* Figure out PE address */
>  	config_addr = pe->config_addr;
> @@ -528,9 +527,14 @@ static int pseries_eeh_reset(struct eeh_pe *pe, int option)
>  	/* We need reset hold or settlement delay */
>  	if (option == EEH_RESET_FUNDAMENTAL ||
>  	    option == EEH_RESET_HOT)
> -		msleep(EEH_PE_RST_HOLD_TIME);
> +		delay = EEH_PE_RST_HOLD_TIME;
> +	else
> +		delay = EEH_PE_RST_SETTLE_TIME;
> +
> +	if (in_atomic())
> +		udelay(delay * 1000);
>  	else
> -		msleep(EEH_PE_RST_SETTLE_TIME);
> +		msleep(delay);
>  
>  	return ret;
>  }

  reply	other threads:[~2015-01-20  9:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-18 22:47 [PATCH] powerpc/pseries: Avoid context switch in EEH reset if required Gavin Shan
2015-01-20  9:28 ` Benjamin Herrenschmidt [this message]
2015-01-20 22:56   ` Gavin Shan
2015-01-20 23:53     ` Gavin Shan
2015-01-23  3:50       ` Gavin Shan
2015-01-24  9:57         ` Benjamin Herrenschmidt
2015-01-26 23:36           ` Brian King
2015-01-27  4:31             ` Benjamin Herrenschmidt
2015-01-27 22:58               ` Brian King
2015-01-27 23:58                 ` Benjamin Herrenschmidt
2015-01-30  1:37                   ` Gavin Shan

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=1421746096.4949.40.camel@kernel.crashing.org \
    --to=benh@kernel.crashing.org \
    --cc=gwshan@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.