Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2622580pxb; Sun, 17 Oct 2021 20:47:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZH5x8lTuY9DKbXUbGFwfCJFWhfkjyy2DIW2ZrZhfDrtgIMvBJ1VKhBq4EL8o0XXIzN1Rt X-Received: by 2002:a17:902:e5d2:b0:13f:21c1:b44f with SMTP id u18-20020a170902e5d200b0013f21c1b44fmr24888012plf.30.1634528840193; Sun, 17 Oct 2021 20:47:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634528840; cv=none; d=google.com; s=arc-20160816; b=ZVjjgqVEsYWGKR5n8atAtXf3kGLydB9hRFqmLEjF63z4I7+JqP+7rudu/P8VNxdHq6 1T/SkxQJFX5ajGIKe26fYz47lF5rf3sVPxfIJl0LcBqwssAIOnXcneiD4Jjuvi47YgKP IYQ1nvC+eJgwx5pMqP6Bq4rowV3SODx5MncVkBRV2ovWsjxWehW0QZRLBcmhz0xM1TeU nCMhdT76lRaMX/XuSQ5BaV25CD96+XTjS0HjA50iIgUj3Sj0DE/+uAvEZeRfmNTqKepA hdltq1wPgn26ZRKcL3z7D8eyGrYXepDmkGraBwpHo76LzfBzDDwXzkZ7cWTE20xUxWl1 9h4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=bS8eHN/rHSzUrokdi0mEHrTigThokrL8A9mvGaDhNak=; b=pEhiiakUI2t01GoNvi8czwkvwV5TzsDJ+Whi1ysOOMiLfniBHHkJqvSlw6Kl2P60cm eSnIq18GpcbUShy+0t+VoWYapehqDCH4MLevjOk4VD7Z8Br6pw5OHNQqYS9OLDBh+qcc /3RmaNqQkSm8B5R8+I+ObUE4dYldXupvH0WME935wMC3tkVe0F+iiXqI2MCgF3ZF/2Td qvanLd/35RbTHdNi4h8te3SMlpnMuij19MzJWc0NhbjDs3c5BkeGMIJW7tpg6BTEmICu EID6cFaMjxq3URqOTiSB0Ng9ou7nNoruGVFR4g5y0JUh+KW+eHJwe/cFoHjSGlBM3aJl HLtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=1HpFXb8d; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h3si18811690plo.18.2021.10.17.20.47.07; Sun, 17 Oct 2021 20:47:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=1HpFXb8d; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344494AbhJQTZv (ORCPT + 98 others); Sun, 17 Oct 2021 15:25:51 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:33852 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231243AbhJQTZr (ORCPT ); Sun, 17 Oct 2021 15:25:47 -0400 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1634498616; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=bS8eHN/rHSzUrokdi0mEHrTigThokrL8A9mvGaDhNak=; b=1HpFXb8dFdPw+4UBK2/aIAb1MK3ODgtMFajEYVjNnF2M4OEwGzmOinr21dPpZ5jJ5EN9ru 2hy4+01DqdlL1DfFxdP0huThY9QVHY5ikMXOjrcniJizkrDmglBD8LrLcvC9jn2LATOkSV Z12WfKhZIMQpm4/Mrv9k8+kx5Bc/hKKLIgZdOAEqvkmRcL83xN8xDku8UIG4uzaMUyJhTj kn1z+uYV5cfvk2E1L7rVLMV122pySoqV8yBZTU1lQ8K5hzVz9vhTjysj/uFauOaHxEv81L IHlurAZliYI1g3tIpKQ2T0eMOTtQYu8Uth+rAaaRAyL5qkd6LLQ0oy5ouDmTQw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1634498616; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=bS8eHN/rHSzUrokdi0mEHrTigThokrL8A9mvGaDhNak=; b=muj8Z2KDBFC3l+jUyBIXgyIhjip5nsSi0vhmW6PRn1cLBaFnPNYFvsM84PNvxswnDyoSfI VX6hV/1yATNbKPBw== To: Kuppuswamy Sathyanarayanan , Ingo Molnar , Borislav Petkov , x86@kernel.org, Paolo Bonzini , David Hildenbrand , Andrea Arcangeli , Josh Poimboeuf , "H . Peter Anvin" Cc: Dave Hansen , Tony Luck , Dan Williams , Andi Kleen , Kirill Shutemov , Sean Christopherson , Kuppuswamy Sathyanarayanan , Kuppuswamy Sathyanarayanan , linux-kernel@vger.kernel.org Subject: Re: [PATCH v7 3/6] x86/topology: Disable CPU online/offline control for TDX guest In-Reply-To: <20211005230550.1819406-4-sathyanarayanan.kuppuswamy@linux.intel.com> References: <20211005230550.1819406-1-sathyanarayanan.kuppuswamy@linux.intel.com> <20211005230550.1819406-4-sathyanarayanan.kuppuswamy@linux.intel.com> Date: Sun, 17 Oct 2021 21:23:31 +0200 Message-ID: <877deb4frg.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 05 2021 at 16:05, Kuppuswamy Sathyanarayanan wrote: > > +static int tdx_cpu_offline_prepare(unsigned int cpu) > +{ > + /* > + * Per Intel TDX Virtual Firmware Design Guide, > + * sec 4.3.5 and sec 9.4, Hotplug is not supported > + * in TDX platforms. So don't support CPU > + * offline feature once it is turned on. > + */ > + return -EOPNOTSUPP; > +} > + > unsigned long tdx_get_ve_info(struct ve_info *ve) > { > struct tdx_module_output out = {0}; > @@ -451,5 +464,8 @@ void __init tdx_early_init(void) > pv_ops.irq.safe_halt = tdx_safe_halt; > pv_ops.irq.halt = tdx_halt; > > + cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "tdx:cpu_hotplug", > + NULL, tdx_cpu_offline_prepare); 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);