Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ACPI: APEI: EINJ: Relax platform response timeout to 1 second

When injecting an error into the platform, the OSPM executes an
EXECUTE_OPERATION action to instruct the platform to begin the injection
operation. And then, the OSPM busy waits for a while by continually
executing CHECK_BUSY_STATUS action until the platform indicates that the
operation is complete. More specifically, the platform is limited to
respond within 1 millisecond right now. This is too strict for some
platforms.

For example, in Arm platform, when injecting a Processor Correctable error,
the OSPM will warn:
Firmware does not respond in time.

And a message is printed on the console:
echo: write error: Input/output error

We observe that the waiting time for DDR error injection is about 10 ms and
that for PCIe error injection is about 500 ms in Arm platform.

In this patch, we relax the response timeout to 1 second.

Signed-off-by: Shuai Xue <xueshuai@linux.alibaba.com>
Reviewed-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Shuai Xue and committed by
Rafael J. Wysocki
bf7fc0c3 3906fe9b

+8 -7
+8 -7
drivers/acpi/apei/einj.c
··· 28 28 #undef pr_fmt 29 29 #define pr_fmt(fmt) "EINJ: " fmt 30 30 31 - #define SPIN_UNIT 100 /* 100ns */ 32 - /* Firmware should respond within 1 milliseconds */ 33 - #define FIRMWARE_TIMEOUT (1 * NSEC_PER_MSEC) 31 + #define SLEEP_UNIT_MIN 1000 /* 1ms */ 32 + #define SLEEP_UNIT_MAX 5000 /* 5ms */ 33 + /* Firmware should respond within 1 seconds */ 34 + #define FIRMWARE_TIMEOUT (1 * USEC_PER_SEC) 34 35 #define ACPI5_VENDOR_BIT BIT(31) 35 36 #define MEM_ERROR_MASK (ACPI_EINJ_MEMORY_CORRECTABLE | \ 36 37 ACPI_EINJ_MEMORY_UNCORRECTABLE | \ ··· 172 171 173 172 static int einj_timedout(u64 *t) 174 173 { 175 - if ((s64)*t < SPIN_UNIT) { 174 + if ((s64)*t < SLEEP_UNIT_MIN) { 176 175 pr_warn(FW_WARN "Firmware does not respond in time\n"); 177 176 return 1; 178 177 } 179 - *t -= SPIN_UNIT; 180 - ndelay(SPIN_UNIT); 181 - touch_nmi_watchdog(); 178 + *t -= SLEEP_UNIT_MIN; 179 + usleep_range(SLEEP_UNIT_MIN, SLEEP_UNIT_MAX); 180 + 182 181 return 0; 183 182 } 184 183