On 05/04/2018 12:41 PM, Michael Ellerman wrote: > Cédric Le Goater <c...@kaod.org> writes: > >> diff --git a/arch/powerpc/sysdev/xive/spapr.c >> b/arch/powerpc/sysdev/xive/spapr.c >> index 091f1d0d0af1..7113f5d87952 100644 >> --- a/arch/powerpc/sysdev/xive/spapr.c >> +++ b/arch/powerpc/sysdev/xive/spapr.c >> @@ -108,6 +109,52 @@ static void xive_irq_bitmap_free(int irq) >> } >> } >> >> + >> +/* Based on the similar routines in RTAS */ >> +static unsigned int plpar_busy_delay_time(long rc) >> +{ >> + unsigned int ms = 0; >> + >> + if (H_IS_LONG_BUSY(rc)) { >> + ms = get_longbusy_msecs(rc); >> + } else if (rc == H_BUSY) { >> + ms = 10; /* seems appropriate for XIVE hcalls */ >> + } >> + >> + return ms; >> +} >> + >> +static unsigned int plpar_busy_delay(int rc) >> +{ >> + unsigned int ms; >> + >> + might_sleep(); >> + ms = plpar_busy_delay_time(rc); >> + if (ms && need_resched()) >> + msleep(ms); > > This is called from kexec shutdown isn't it? > > In which case I don't think msleep() is a great idea.>> We could be crashing > for example.
yes. > An mdelay would be safer I think? I agree but we would mdelay be OK ? The hcall can take up to 160ms. Thanks, C.