Re: [PATCH v7 3/6] x86/topology: Disable CPU online/offline control for TDX guest

From: Sathyanarayanan Kuppuswamy
Date: Sun Oct 17 2021 - 15:28:43 EST



On 10/17/21 12:23 PM, Thomas Gleixner wrote:
Seriously? This lets the unplug start, which starts to kick off tasks
from the CPU just to make it fail a few steps later?

The obvious place to prevent this is the CPU hotplug code itself, right?

Thanks,

tglx
---
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 192e43a87407..c544eb6c79d3 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -1178,6 +1178,8 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen,
static int cpu_down_maps_locked(unsigned int cpu, enum cpuhp_state target)
{
+ if (cc_platform_has(CC_HOTPLUG_DISABLED))
+ return -ENOTSUPP;
if (cpu_hotplug_disabled)
return -EBUSY;
return _cpu_down(cpu, 0, target);

Makes sense. I will use it in next version.

--
Sathyanarayanan Kuppuswamy
Linux Kernel Developer