Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp976052ybt; Wed, 17 Jun 2020 19:39:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCnf5wU7VUep2lAGt7bfeAM0nlAXvHSg31Lm0LdM2aqQFnxXY6/bo5yTLtuI1Hv8yizsRa X-Received: by 2002:a17:906:2e1a:: with SMTP id n26mr1873636eji.425.1592447990433; Wed, 17 Jun 2020 19:39:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592447990; cv=none; d=google.com; s=arc-20160816; b=XDcI9RJtQ/6k6407lku7+wXNbPmeHlrPehIqef5H2E85nf3nsI/XK7ezV28wyIjkGR Ti3jtWPEsbzW12/HO/iRHn8qoyqTyhl5x3LMEY23oU0VHLHBKUO0Tana8Jw8hrxO0y+w O2Eg1/9qMew1CYxrLsOX3JzQSMBkuKQEp2iOc5jsW6asg1hVCUK0y6FPgKDCypMy6g8q 9jb9NdTnXVzy3g823p2beTXmehx0QBKpStpuUh7HFvWa95G04xmR96SSfZi195I5Zsux /nM28szQrdMUlNZwJijNPYYJQEybwMWUXoE1fvMJ709gwwrD5X6tV//Y4+fndZGOWES4 tOIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oNIXzEQV2i5Gr+Dh61Bbd7muUdncmZIjqslPKlGTw4c=; b=Nc0NtKv7sJaoNLTIJK7kJJp32+He7qXGNwULhGYq7MvbvzPZBwGZsHKG/HKr2YNLxD f3VlAy00zFlbjXXoGXl98tauILJpqXfEdhLcmGmXqmhhSR+zMuIgf6IGocIaSroBaElV xF3I7gwWIum/+VdYI3UiemwJAq0Nj853vxK9dc5oRYaqQ1KC5bTm/o6/BBTofVjGkEjc m6cvkPURyBFFB2aop3W3Dq4v/xy9l4Fb3ycwNIBZmBi5YQj4r0Q3lktPf/8G3Ib7nlKi TlXBuXM7adQRvNfvGecSawek2KAAjAvNTsAcv8O0iPRkQRkzyTV1KkIzT5NqM8CAu2to +SUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uyMWBSbj; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k25si1134674ejk.678.2020.06.17.19.39.28; Wed, 17 Jun 2020 19:39:50 -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=@kernel.org header.s=default header.b=uyMWBSbj; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387400AbgFRCht (ORCPT + 99 others); Wed, 17 Jun 2020 22:37:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:42904 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729158AbgFRBNh (ORCPT ); Wed, 17 Jun 2020 21:13:37 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C07F3221EB; Thu, 18 Jun 2020 01:13:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592442816; bh=w8V3cTH4FJj2K9JiCLrtLjXXfg1XK0Rl1yo5hamlduY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uyMWBSbjABXyGlynbRDNDWGl5kfLLRgPTowTwBJVD98rnW6OyLH+lOSn2PIyd+J9H NigPk/ICcq6pqWp+RACr97Oa0zLZx0sp84jaPb+NFb2CexQ7vlQd/t950GXRZrdg6p aHuH8rl9eRHnX85PfXOdKuaQFyyUf9uOKxfm/IWg= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Boris Ostrovsky , Juergen Gross , Sasha Levin , xen-devel@lists.xenproject.org Subject: [PATCH AUTOSEL 5.7 254/388] xen/cpuhotplug: Fix initial CPU offlining for PV(H) guests Date: Wed, 17 Jun 2020 21:05:51 -0400 Message-Id: <20200618010805.600873-254-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200618010805.600873-1-sashal@kernel.org> References: <20200618010805.600873-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Boris Ostrovsky [ Upstream commit c54b071c192dfe8061336f650ceaf358e6386e0b ] Commit a926f81d2f6c ("xen/cpuhotplug: Replace cpu_up/down() with device_online/offline()") replaced cpu_down() with device_offline() call which requires that the CPU has been registered before. This registration, however, happens later from topology_init() which is called as subsys_initcall(). setup_vcpu_hotplug_event(), on the other hand, is invoked earlier, during arch_initcall(). As result, booting a PV(H) guest with vcpus < maxvcpus causes a crash. Move setup_vcpu_hotplug_event() (and therefore setup_cpu_watcher()) to late_initcall(). In addition, instead of performing all offlining steps in setup_cpu_watcher() simply call disable_hotplug_cpu(). Fixes: a926f81d2f6c (xen/cpuhotplug: Replace cpu_up/down() with device_online/offline()" Signed-off-by: Boris Ostrovsky Link: https://lore.kernel.org/r/1588976923-3667-1-git-send-email-boris.ostrovsky@oracle.com Reviewed-by: Juergen Gross Signed-off-by: Boris Ostrovsky Signed-off-by: Sasha Levin --- drivers/xen/cpu_hotplug.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/xen/cpu_hotplug.c b/drivers/xen/cpu_hotplug.c index ec975decb5de..b96b11e2b571 100644 --- a/drivers/xen/cpu_hotplug.c +++ b/drivers/xen/cpu_hotplug.c @@ -93,10 +93,8 @@ static int setup_cpu_watcher(struct notifier_block *notifier, (void)register_xenbus_watch(&cpu_watch); for_each_possible_cpu(cpu) { - if (vcpu_online(cpu) == 0) { - device_offline(get_cpu_device(cpu)); - set_cpu_present(cpu, false); - } + if (vcpu_online(cpu) == 0) + disable_hotplug_cpu(cpu); } return NOTIFY_DONE; @@ -119,5 +117,5 @@ static int __init setup_vcpu_hotplug_event(void) return 0; } -arch_initcall(setup_vcpu_hotplug_event); +late_initcall(setup_vcpu_hotplug_event); -- 2.25.1