Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2810458pxb; Thu, 3 Feb 2022 15:12:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJwgfLM/ibALHhkDl+vJnoF9YCoPgysjCgflLoF947cp2s/gna3JzxQJfnqz4d/FrcIQT6Rl X-Received: by 2002:a65:5a8f:: with SMTP id c15mr300009pgt.270.1643929952722; Thu, 03 Feb 2022 15:12:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643929952; cv=none; d=google.com; s=arc-20160816; b=Omz/azVpUrunXLIKfjvjc9V4Z/+89oClgphAlTdomIYrTlLVc8oMGbPsaOVJF7bv8Y BJvVwb/h0m0+2kpjez4UVrzKB9pQrenDWnGcUGQAJysIjw+M39Pu/vchD2QCG80W+iie 4wlfFTnQYfXDUVd6W2NGB07OJ+bwZM84OGqGd2b9eKEsSkgzD20QtFajKLteA1aGTHBV HA19Hi83PjZA4SKA5XkceKQ9yVQWMoJSMRIua7UIpSNejuli9ig1fqMqxno7EaDP9gc/ u8AW69DjaKi/Ur0W7qXseZhAoTZ5YsqBSo+aGwvslxQAUGg8/57yK9s8fL50D2nweQq2 WXhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=nGtniP/ZuSvnwnPoaU4PQX/0piWBb9dVWe0n763a2eI=; b=iryCe9u9e5LryuVwXTDs55m356Uwmc5QLe/yLeYctAkupjhS8Jcb0+qyv2zcn+keH+ j4U4d5wLxtSXPKTduqdyU9FIdMqyzv09oXr2ZkR/sPoKaOiHs5cT8T42/R64Whrt03yL hTMZ4U5M0isSL52p4PcdKdJYTk13FZ8WlkTGex8EOilLbMJVRrkcjFyviSJS4R8lB88w GWObxitU5iRFQEzuF28sKjWvyFGFofYK68Izy1qHz6NTK3wbpR7pdpAEFRELOd8IGEcE sw4zx4piz88oI3LPPaajVNmC2VcDwiCJ9KOdvVOl653UMwmSOBdbGzrXfOGflTJuQ8FT 0QGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=W1yRP06V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u3si187225ple.88.2022.02.03.15.12.20; Thu, 03 Feb 2022 15:12:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=W1yRP06V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238254AbiBAM4O (ORCPT + 99 others); Tue, 1 Feb 2022 07:56:14 -0500 Received: from mail.skyhub.de ([5.9.137.197]:41570 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238238AbiBAM4M (ORCPT ); Tue, 1 Feb 2022 07:56:12 -0500 Received: from zn.tnic (dslb-088-067-221-104.088.067.pools.vodafone-ip.de [88.67.221.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 552CB1EC0441; Tue, 1 Feb 2022 13:56:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1643720166; 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: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=nGtniP/ZuSvnwnPoaU4PQX/0piWBb9dVWe0n763a2eI=; b=W1yRP06VZIG2iZVXxUMtaGrrFhFQiW9wFWg8S4RXC5N+aRmQIUqZiNxIFGkx6dKsMT0jfG aF5AULNAcU9t7T7RhPGRrkoz3FAd9/2uMMNiKZdw3STZssNex4aZxo6UjNAJHN0qoW0B3F nYJF+mbZ+9U/S97CTSfM8kwokK9Um58= Date: Tue, 1 Feb 2022 13:56:02 +0100 From: Borislav Petkov To: David Woodhouse Cc: Tom Lendacky , Thomas Gleixner , Sean Christopherson , Ingo Molnar , Dave Hansen , "x86@kernel.org" , "H . Peter Anvin" , Paolo Bonzini , "Paul E . McKenney" , "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" , "rcu@vger.kernel.org" , "mimoja@mimoja.de" , "hewenliang4@huawei.com" , "hushiyuan@huawei.com" , "luolongjun@huawei.com" , "hejingxian@huawei.com" , Joerg Roedel , Andrew Cooper Subject: Re: [PATCH v3 6/9] x86/smpboot: Support parallel startup of secondary CPUs Message-ID: References: <20211215145633.5238-7-dwmw2@infradead.org> <3d8e2d0d-1830-48fb-bc2d-995099f39ef0@amd.com> <330bedfee12022c1180d8752fb4abe908dac08d1.camel@infradead.org> <3bc401a9f110a24a429316371c767507b493025a.camel@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 01, 2022 at 12:39:17PM +0000, David Woodhouse wrote: > In the top of my git tree, you can see a half-baked 'parallel part 2' > commit which introduces a new x86/cpu:wait-init cpuhp state that would > invoke do_wait_cpu_initialized() for each CPU in turn, which *would* > release them all into load_ucode_bsp() at the same time and have > precisely the problem you're describing. The load_ucode_bsp() is the variant that runs on the boot CPU but yeah... > I'll commit a FIXME comment now so that it doesn't slip my mind. Yap, thank Cooper for pointing out that whole thing about how microcode loading is special and can't always handle parallelism. :) > Hm, not sure I see how that's protecting itself from someone > simultaneously echoing 1 > /sys/devices/system/cpu/cpu${SIBLING}/online So echo 1 > ../online means onlining the sibling. But reload_store() grabs the CPU hotplug lock *first* and *then* runs check_online_cpus() to see if all CPUs are online. It doesn't do the update if even one CPU is missing. You can't offline any CPU for the duration of the update... So I guess you'd need to explain in more detail what protection hole you're seeing because I might be missing something here. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette