From nobody Sat Apr 27 23:16:14 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1571832808; cv=none; d=zoho.com; s=zohoarc; b=Uy9qGiL77tIWTj0NrKL2t7IH1iPpM7q5H9hog7ALHy5vD9nE2ch+gAvQ27JG4Nswn18EdpC20DQI3vMqPwGZtbfKbTZW/4MSl8eMnTtfpQbbdiPrOfBNdgeNGZ7/Npx8JKrhvupOE3srbAEppT2qZqtQINbBWBlraJ6gaP6qggM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571832808; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=6iVLHlh8zLpCOkYYeqw5EUThI/nUe55gBKMYvlDCO7g=; b=jB4A16jFCxcbxXvNFsfre1ILxUywhqynyd21ib6AsqKdm+bxS2RtfGnDLzxT8tq1ZgBTnhAL1DuXY6gUu8IRACmvERgJrJYIxxiDHWxE6SA+1uXtyNu8t8ZHJGkNtPyIUACscOYWLyiO8eY0apb6Ovrgg/yqN1hY05JVjB7JQM8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1571832808721483.58183725766867; Wed, 23 Oct 2019 05:13:28 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iNFUv-0001cM-QL; Wed, 23 Oct 2019 12:12:17 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iNFUu-0001cH-Al for xen-devel@lists.xenproject.org; Wed, 23 Oct 2019 12:12:16 +0000 Received: from mx1.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 58b700b2-f58e-11e9-947c-12813bfff9fa; Wed, 23 Oct 2019 12:12:13 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id D70DCB33E; Wed, 23 Oct 2019 12:12:12 +0000 (UTC) X-Inumbo-ID: 58b700b2-f58e-11e9-947c-12813bfff9fa X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Wed, 23 Oct 2019 14:12:09 +0200 Message-Id: <20191023121209.4814-1-jgross@suse.com> X-Mailer: git-send-email 2.16.4 Subject: [Xen-devel] [PATCH] xen/pvhsim: fix cpu onlining X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Wei Liu , George Dunlap , Andrew Cooper , Dario Faggioli , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Since commit 8d3c326f6756d1 ("xen: let vcpu_create() select processor") the initial processor for all pv-shim vcpus will be 0, as no other cpus are online when the vcpus are created. Before that commit the vcpus would have processors set not being online yet, which worked just by chance. When the pv-shim vcpu becomes active it will have a hard affinity not matching its initial processor assignment leading to failing ASSERT()s or other problems depending on the selected scheduler. Fix that by doing the affinity setting after onlining the cpu but before taking the vcpu up. For vcpu 0 this is still in sched_setup_dom0_vcpus(), for the other vcpus setting the affinity there can be dropped. Fixes: 8d3c326f6756d1 ("xen: let vcpu_create() select processor") Reported-by: Sergey Dyasli Tested-by: Sergey Dyasli Signed-off-by: Juergen Gross Acked-by: Jan Beulich Reviewed-by: Roger Pau Monn=C3=A9 --- xen/arch/x86/pv/shim.c | 2 ++ xen/common/schedule.c | 11 +++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/pv/shim.c b/xen/arch/x86/pv/shim.c index 5edbcd9ac5..4329eaaefe 100644 --- a/xen/arch/x86/pv/shim.c +++ b/xen/arch/x86/pv/shim.c @@ -837,6 +837,8 @@ long pv_shim_cpu_up(void *data) v->vcpu_id, rc); return rc; } + + vcpu_set_hard_affinity(v, cpumask_of(v->vcpu_id)); } =20 wake =3D test_and_clear_bit(_VPF_down, &v->pause_flags); diff --git a/xen/common/schedule.c b/xen/common/schedule.c index c327c40b92..326f4d3601 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -3102,13 +3102,12 @@ void __init sched_setup_dom0_vcpus(struct domain *d) for ( i =3D 1; i < d->max_vcpus; i++ ) vcpu_create(d, i); =20 - for_each_sched_unit ( d, unit ) + if ( pv_shim ) + sched_set_affinity(d->vcpu[0]->sched_unit, + cpumask_of(0), cpumask_of(0)); + else { - unsigned int id =3D unit->unit_id; - - if ( pv_shim ) - sched_set_affinity(unit, cpumask_of(id), cpumask_of(id)); - else + for_each_sched_unit ( d, unit ) { if ( !opt_dom0_vcpus_pin && !dom0_affinity_relaxed ) sched_set_affinity(unit, &dom0_cpus, NULL); --=20 2.16.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel