Skip to contentSkip to conversation

ACPI: reboot: Increase the delay to avoid racing after writing to ACPI RESET_REG on AMD Milan platforms.

PATCH In review James Liu 2 participants 5 messages Jun 7, 2023 – Aug 17, 2023 1 message not in the archive ACPI

lore
Share & tools
lore

James Liu

author
#0 lore raw

PATCH 1/1 ACPI: reboot: Increase the delay to avoid racing after writing to ACPI RESET_REG on AMD Milan platforms.

For AMD Milan platforms, the delay of 15ms is insufficient to avoid racing of reboot mechanisms. That said, the AMD Milan processors don't reboot in 15ms after invoking acpi_reset().

The proposed 50ms delay can effectively work around this issue. This extended delay aligns better with ACPI v6.4 (i.e., sec. 4.8.4.6), which indicates that ideally OSPM should execute spin loops on the CPUs in the system following a write to this register.

---
 drivers/acpi/reboot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/reboot.c +1 -1
index b79b7c99c237..002f7c7814a1 100644
@@ -78,5 +78,5 @@ void acpi_reboot(void)
 	 * The 15ms delay has been found to be long enough for the system
 	 * to reboot on the affected platforms.
 	 */
-	mdelay(15);
+	mdelay(50);
 }
Signature · 1 line
2.40.1
#1 lore raw
Quoted 11 lines · James Liu

For AMD Milan platforms, the delay of 15ms is insufficient to avoid racing of reboot mechanisms. That said, the AMD Milan processors don't reboot in 15ms after invoking acpi_reset().

The proposed 50ms delay can effectively work around this issue. This extended delay aligns better with ACPI v6.4 (i.e., sec. 4.8.4.6), which indicates that ideally OSPM should execute spin loops on the CPUs in the system following a write to this register.

Why do you want to affect everyone (including guest kernels running in virtual machines AFAICS) in order to address a problem specific to one platform?

Wouldn't it be better to quirk that platform and document the quirk properly?

Quoted 18 lines
---
 drivers/acpi/reboot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/reboot.c +1 -2
index b79b7c99c237..002f7c7814a1 100644
@@ -78,5 +78,5 @@ void acpi_reboot(void)
         * The 15ms delay has been found to be long enough for the system
         * to reboot on the affected platforms.
         */
-       mdelay(15);
+       mdelay(50);
 }
--

2.40.1

author
#2 lore raw
Quoted 11 lines · Rafael J. Wysocki
Quoted 10 lines · James Liu

For AMD Milan platforms, the delay of 15ms is insufficient to avoid racing of reboot mechanisms. That said, the AMD Milan processors don't reboot in 15ms after invoking acpi_reset().

The proposed 50ms delay can effectively work around this issue. This extended delay aligns better with ACPI v6.4 (i.e., sec. 4.8.4.6), which indicates that ideally OSPM should execute spin loops on the CPUs in the system following a write to this register.

Quoted 5 lines
Quoted 1 line

Why do you want to affect everyone (including guest kernels running in virtual machines AFAICS) in order to address a problem specific to one platform?

I hoped to address this issue for any platform requiring a longer delay to complete ACPI reset in time for any (maybe silicon-level) reasons. Some AMD Milan platforms were the cases that we've found so far.

Except that, since ACPI spec indicates there should be a spin loop (long enough) after the write instruction to Reset Register, I thought it should be no harms to the other systems which well consider this spin loop when they claim to support ACPI reboot.

Btw, I am just curious, why is the virtual machine mentioned here?

is the 50ms delay in acpi_reboot() for a guest OS on VM so long that some unexpected behavior might happen?

Quoted 1 line

Wouldn't it be better to quirk that platform and document the quirk properly?

Yeah, it could be. Actually we considered this, and we will consider it again.

Quoted 18 lines
Quoted 18 lines
---
 drivers/acpi/reboot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/reboot.c +1 -2
index b79b7c99c237..002f7c7814a1 100644
@@ -78,5 +78,5 @@ void acpi_reboot(void)
         * The 15ms delay has been found to be long enough for the system
         * to reboot on the affected platforms.
         */
-       mdelay(15);
+       mdelay(50);
 }
--

2.40.1

#3 lore raw
Quoted 15 lines · James Liu
Quoted 13 lines · Rafael J. Wysocki
Quoted 11 lines · James Liu

For AMD Milan platforms, the delay of 15ms is insufficient to avoid racing of reboot mechanisms. That said, the AMD Milan processors don't reboot in 15ms after invoking acpi_reset().

The proposed 50ms delay can effectively work around this issue. This extended delay aligns better with ACPI v6.4 (i.e., sec. 4.8.4.6), which indicates that ideally OSPM should execute spin loops on the CPUs in the system following a write to this register.

Quoted 7 lines
Quoted 3 lines

Why do you want to affect everyone (including guest kernels running in virtual machines AFAICS) in order to address a problem specific to one platform?

I hoped to address this issue for any platform requiring a longer delay to complete ACPI reset in time for any (maybe silicon-level) reasons. Some AMD Milan platforms were the cases that we've found so far.

Do you know about any other?

Quoted 6 lines

Except that, since ACPI spec indicates there should be a spin loop (long enough) after the write instruction to Reset Register, I thought it should be no harms to the other systems which well consider this spin loop when they claim to support ACPI reboot.

Btw, I am just curious, why is the virtual machine mentioned here?

The new delay would be over 3 times larger, so some users might be surprised by it at least potentially.

Quoted 23 lines

is the 50ms delay in acpi_reboot() for a guest OS on VM so long that some unexpected behavior might happen?

Quoted 1 line

Wouldn't it be better to quirk that platform and document the quirk properly?

Yeah, it could be. Actually we considered this, and we will consider it again.

Quoted 16 lines
Quoted 16 lines
---
 drivers/acpi/reboot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/reboot.c +1 -2
index b79b7c99c237..002f7c7814a1 100644
@@ -78,5 +78,5 @@ void acpi_reboot(void)
         * The 15ms delay has been found to be long enough for the system
         * to reboot on the affected platforms.
         */
-       mdelay(15);
+       mdelay(50);
 }
--

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw
Quoted 38 lines · James Liu
Quoted 20 lines · Rafael J. Wysocki
Quoted 19 lines · James Liu
Quoted 16 lines · Rafael J. Wysocki
Quoted 11 lines · James Liu

For AMD Milan platforms, the delay of 15ms is insufficient to avoid racing of reboot mechanisms. That said, the AMD Milan processors don't reboot in 15ms after invoking acpi_reset().

The proposed 50ms delay can effectively work around this issue. This extended delay aligns better with ACPI v6.4 (i.e., sec. 4.8.4.6), which indicates that ideally OSPM should execute spin loops on the CPUs in the system following a write to this register.

Why do you want to affect everyone (including guest kernels running in virtual machines AFAICS) in order to address a problem specific to one platform?

Quoted 5 lines
Quoted 3 lines

I hoped to address this issue for any platform requiring a longer delay to complete ACPI reset in time for any (maybe silicon-level) reasons. Some AMD Milan platforms were the cases that we've found so far.

Do you know about any other?

So far, no. Thus, I wont' proceed with anything until I find the same syndrome on next-gen platforms (e.g., AMD Genoa). Now, as you say, it is satisfying to document this quirk properly.

Quoted 6 lines
Quoted 6 lines

Except that, since ACPI spec indicates there should be a spin loop (long enough) after the write instruction to Reset Register, I thought it should be no harms to the other systems which well consider this spin loop when they claim to support ACPI reboot.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Btw, I am just curious, why is the virtual machine mentioned here?

The new delay would be over 3 times larger, so some users might be surprised by it at least potentially.

Got it. Just in case, if we really need to increase the delay to address it for certain amount of platforms, in experience, how long is the delay acceptable so that VM users will not be surprised?

Honestly, I don't know.

Also, it is not quite clear to me from the changelog what the problem with the Milan platforms vs the reboot delay is and I don't think that the second paragraph (regarding the ACPI specification compliance) is relevant for this patch at all.