All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc/pseries: Avoid context switch in EEH reset if required
@ 2015-01-18 22:47 Gavin Shan
  2015-01-20  9:28 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 11+ messages in thread
From: Gavin Shan @ 2015-01-18 22:47 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Gavin Shan

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()

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;
 }
-- 
1.8.3.2

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

end of thread, other threads:[~2015-01-30  1:38 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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.