From nobody Sat Apr 20 04:12:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1610544444; cv=none; d=zohomail.com; s=zohoarc; b=UnbeRGfSTa/79G/UN6C7QhTVWgvGbSj8OMsk1lrw3Af1MwzmQW6HyVNlhgui1+xdcAM+WeR2OfkWA2g6aqCq64lHQnM868VsmsyMDbo3HOzSmshTjaQOkx8G5kEPhox4uB7H2G+zPca5Vihb7n0vkb8Tg1tUG4wtj2WP5p3gW9Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610544444; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ho4i3xPvEsfhOFrN+XkJra5kbDJB4fktE5BGtTGmdkU=; b=QTei7nbkohKpOZeS1WdHV/FhlxuF0kL/5iAwGu3XzoxI4d0MeBKnL9u/pF3wVchgs1nmI1Qmasyjsn/WNC2iqETNevULOJ3uOj97xBUp9sflGnGRTkO5IPPSB64kVJwWf2jJzgBh2ZBN3QYGpSBYohM7Lz/cn+DL9ey5phS2osA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) 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 1610544444046399.47051447313765; Wed, 13 Jan 2021 05:27:24 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.66526.118213 (Exim 4.92) (envelope-from ) id 1kzgAw-0002tW-N4; Wed, 13 Jan 2021 13:27:02 +0000 Received: by outflank-mailman (output) from mailman id 66526.118213; Wed, 13 Jan 2021 13:27:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kzgAw-0002tN-JH; Wed, 13 Jan 2021 13:27:02 +0000 Received: by outflank-mailman (input) for mailman id 66526; Wed, 13 Jan 2021 13:27:01 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kzgAv-0002b0-IE for xen-devel@lists.xenproject.org; Wed, 13 Jan 2021 13:27:01 +0000 Received: from casper.infradead.org (unknown [2001:8b0:10b:1236::1]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 103f6eaf-5579-46d5-925d-ea5f697bf342; Wed, 13 Jan 2021 13:26:38 +0000 (UTC) Received: from i7.infradead.org ([2001:8b0:10b:1:21e:67ff:fecb:7a92]) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1kzgA5-006IZR-9A; Wed, 13 Jan 2021 13:26:13 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1kzgA4-001m36-Sg; Wed, 13 Jan 2021 13:26:08 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list X-Inumbo-ID: 103f6eaf-5579-46d5-925d-ea5f697bf342 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=ho4i3xPvEsfhOFrN+XkJra5kbDJB4fktE5BGtTGmdkU=; b=vE/+eI9O0HlmkLl1r4pUM3OrUr 9cWhNLpIvUHDvQjCWluhvgcsQG2NR8l3X+osqWAELZtGkEGbaycbXD36hKA0kmouxC3f8DuFWSObs pG33IKap2OjbCGCr9wzFOW8nMGWpyPJlG1aBQbb2YFfOSZrQIciokmJcQzOy2lFMyd/7bZX5OkRMC fkZ4wSBvpeOXeyQRrHwzlLQ0chWgKL1sp9BHQB5R9uAlLjDbGgk8pKRnfxqWV1EJAZp/woUNGTXYw jUOM6KZaAG074EGLd41HZIwHCS30mDkLoOw70aenwBULqfbymlcRIpU2XNkE4ZrteOJMzIZP7M/KA GQakA87Q==; From: David Woodhouse To: x86@kernel.org Cc: Stefano Stabellini , Boris Ostrovsky , Juergen Gross , Paul Durrant , jgrall@amazon.com, karahmed@amazon.de, xen-devel Subject: [PATCH v4 1/5] xen: Fix event channel callback via INTX/GSI Date: Wed, 13 Jan 2021 13:26:02 +0000 Message-Id: <20210113132606.422794-2-dwmw2@infradead.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210113132606.422794-1-dwmw2@infradead.org> References: <20210113132606.422794-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: David Woodhouse X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html X-ZohoMail-DKIM: pass (identity @infradead.org) Content-Type: text/plain; charset="utf-8" From: David Woodhouse For a while, event channel notification via the PCI platform device has been broken, because we attempt to communicate with xenstore before we even have notifications working, with the xs_reset_watches() call in xs_init(). We tend to get away with this on Xen versions below 4.0 because we avoid calling xs_reset_watches() anyway, because xenstore might not cope with reading a non-existent key. And newer Xen *does* have the vector callback support, so we rarely fall back to INTX/GSI delivery. To fix it, clean up a bit of the mess of xs_init() and xenbus_probe() startup. Call xs_init() directly from xenbus_init() only in the !XS_HVM case, deferring it to be called from xenbus_probe() in the XS_HVM case instead. Then fix up the invocation of xenbus_probe() to happen either from its device_initcall if the callback is available early enough, or when the callback is finally set up. This means that the hack of calling xenbus_probe() from a workqueue after the first interrupt, or directly from the PCI platform device setup, is no longer needed. Signed-off-by: David Woodhouse Reviewed-by: Boris Ostrovsky --- arch/arm/xen/enlighten.c | 2 +- drivers/xen/events/events_base.c | 10 ---- drivers/xen/platform-pci.c | 1 - drivers/xen/xenbus/xenbus.h | 1 + drivers/xen/xenbus/xenbus_comms.c | 8 --- drivers/xen/xenbus/xenbus_probe.c | 81 +++++++++++++++++++++++++------ include/xen/xenbus.h | 2 +- 7 files changed, 70 insertions(+), 35 deletions(-) diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c index 60e901cd0de6..5a957a9a0984 100644 --- a/arch/arm/xen/enlighten.c +++ b/arch/arm/xen/enlighten.c @@ -371,7 +371,7 @@ static int __init xen_guest_init(void) } gnttab_init(); if (!xen_initial_domain()) - xenbus_probe(NULL); + xenbus_probe(); =20 /* * Making sure board specific code will not set up ops for diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_b= ase.c index a8030332a191..e850f79351cb 100644 --- a/drivers/xen/events/events_base.c +++ b/drivers/xen/events/events_base.c @@ -2060,16 +2060,6 @@ static struct irq_chip xen_percpu_chip __read_mostly= =3D { .irq_ack =3D ack_dynirq, }; =20 -int xen_set_callback_via(uint64_t via) -{ - struct xen_hvm_param a; - a.domid =3D DOMID_SELF; - a.index =3D HVM_PARAM_CALLBACK_IRQ; - a.value =3D via; - return HYPERVISOR_hvm_op(HVMOP_set_param, &a); -} -EXPORT_SYMBOL_GPL(xen_set_callback_via); - #ifdef CONFIG_XEN_PVHVM /* Vector callbacks are better than PCI interrupts to receive event * channel notifications because we can receive vector callbacks on any diff --git a/drivers/xen/platform-pci.c b/drivers/xen/platform-pci.c index dd911e1ff782..9db557b76511 100644 --- a/drivers/xen/platform-pci.c +++ b/drivers/xen/platform-pci.c @@ -149,7 +149,6 @@ static int platform_pci_probe(struct pci_dev *pdev, ret =3D gnttab_init(); if (ret) goto grant_out; - xenbus_probe(NULL); return 0; grant_out: gnttab_free_auto_xlat_frames(); diff --git a/drivers/xen/xenbus/xenbus.h b/drivers/xen/xenbus/xenbus.h index 2a93b7c9c159..dc1537335414 100644 --- a/drivers/xen/xenbus/xenbus.h +++ b/drivers/xen/xenbus/xenbus.h @@ -115,6 +115,7 @@ int xenbus_probe_node(struct xen_bus_type *bus, const char *type, const char *nodename); int xenbus_probe_devices(struct xen_bus_type *bus); +void xenbus_probe(void); =20 void xenbus_dev_changed(const char *node, struct xen_bus_type *bus); =20 diff --git a/drivers/xen/xenbus/xenbus_comms.c b/drivers/xen/xenbus/xenbus_= comms.c index eb5151fc8efa..e5fda0256feb 100644 --- a/drivers/xen/xenbus/xenbus_comms.c +++ b/drivers/xen/xenbus/xenbus_comms.c @@ -57,16 +57,8 @@ DEFINE_MUTEX(xs_response_mutex); static int xenbus_irq; static struct task_struct *xenbus_task; =20 -static DECLARE_WORK(probe_work, xenbus_probe); - - static irqreturn_t wake_waiting(int irq, void *unused) { - if (unlikely(xenstored_ready =3D=3D 0)) { - xenstored_ready =3D 1; - schedule_work(&probe_work); - } - wake_up(&xb_waitq); return IRQ_HANDLED; } diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_= probe.c index 44634d970a5c..c8f0282bb649 100644 --- a/drivers/xen/xenbus/xenbus_probe.c +++ b/drivers/xen/xenbus/xenbus_probe.c @@ -683,29 +683,76 @@ void unregister_xenstore_notifier(struct notifier_blo= ck *nb) } EXPORT_SYMBOL_GPL(unregister_xenstore_notifier); =20 -void xenbus_probe(struct work_struct *unused) +void xenbus_probe(void) { xenstored_ready =3D 1; =20 + /* + * In the HVM case, xenbus_init() deferred its call to + * xs_init() in case callbacks were not operational yet. + * So do it now. + */ + if (xen_store_domain_type =3D=3D XS_HVM) + xs_init(); + /* Notify others that xenstore is up */ blocking_notifier_call_chain(&xenstore_chain, 0, NULL); } -EXPORT_SYMBOL_GPL(xenbus_probe); =20 -static int __init xenbus_probe_initcall(void) +/* + * Returns true when XenStore init must be deferred in order to + * allow the PCI platform device to be initialised, before we + * can actually have event channel interrupts working. + */ +static bool xs_hvm_defer_init_for_callback(void) { - if (!xen_domain()) - return -ENODEV; +#ifdef CONFIG_XEN_PVHVM + return xen_store_domain_type =3D=3D XS_HVM && + !xen_have_vector_callback; +#else + return false; +#endif +} =20 - if (xen_initial_domain() || xen_hvm_domain()) - return 0; +static int __init xenbus_probe_initcall(void) +{ + /* + * Probe XenBus here in the XS_PV case, and also XS_HVM unless we + * need to wait for the platform PCI device to come up. + */ + if (xen_store_domain_type =3D=3D XS_PV || + (xen_store_domain_type =3D=3D XS_HVM && + !xs_hvm_defer_init_for_callback())) + xenbus_probe(); =20 - xenbus_probe(NULL); return 0; } - device_initcall(xenbus_probe_initcall); =20 +int xen_set_callback_via(uint64_t via) +{ + struct xen_hvm_param a; + int ret; + + a.domid =3D DOMID_SELF; + a.index =3D HVM_PARAM_CALLBACK_IRQ; + a.value =3D via; + + ret =3D HYPERVISOR_hvm_op(HVMOP_set_param, &a); + if (ret) + return ret; + + /* + * If xenbus_probe_initcall() deferred the xenbus_probe() + * due to the callback not functioning yet, we can do it now. + */ + if (!xenstored_ready && xs_hvm_defer_init_for_callback()) + xenbus_probe(); + + return ret; +} +EXPORT_SYMBOL_GPL(xen_set_callback_via); + /* Set up event channel for xenstored which is run as a local process * (this is normally used only in dom0) */ @@ -818,11 +865,17 @@ static int __init xenbus_init(void) break; } =20 - /* Initialize the interface to xenstore. */ - err =3D xs_init(); - if (err) { - pr_warn("Error initializing xenstore comms: %i\n", err); - goto out_error; + /* + * HVM domains may not have a functional callback yet. In that + * case let xs_init() be called from xenbus_probe(), which will + * get invoked at an appropriate time. + */ + if (xen_store_domain_type !=3D XS_HVM) { + err =3D xs_init(); + if (err) { + pr_warn("Error initializing xenstore comms: %i\n", err); + goto out_error; + } } =20 if ((xen_store_domain_type !=3D XS_LOCAL) && diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h index 00c7235ae93e..2c43b0ef1e4d 100644 --- a/include/xen/xenbus.h +++ b/include/xen/xenbus.h @@ -192,7 +192,7 @@ void xs_suspend_cancel(void); =20 struct work_struct; =20 -void xenbus_probe(struct work_struct *); +void xenbus_probe(void); =20 #define XENBUS_IS_ERR_READ(str) ({ \ if (!IS_ERR(str) && strlen(str) =3D=3D 0) { \ --=20 2.29.2 From nobody Sat Apr 20 04:12:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1610544449; cv=none; d=zohomail.com; s=zohoarc; b=ZKN1J4DA7ZPyPrRL4XOJkD+cP1zrWeVhfEGO7oqj6OEjLsbflwxZxpt2xyWkPjZMGYgk4cGcq6U2dgXTep1Pqx4jBlyXnQz6orpd2K8y3mUl+HBz/hpF8ZxQuKGnY+z1cZk+nRfzg5qsQ39/dV6AesoPZj+YpnFHIFf6ehbEKk8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610544449; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=syx4fu3vYSlHpqPUTOPP75qBiFyto3EbQNXax9AAeb0=; b=MqTvR4Ww6vGYptiA0wkDC0hroNGkEbtRj4Ie86gIH+WvD37g3l65iorFOOqlULda5TwoKwh6a8NarCIBERxzCdmJf3XIO97TfaZJXbNZPMqtsL70WNiY0VGJnOPpGJL4/YKQewJAOyXN+kND7EsPfRz/gnD5jEY2Sy4Me9XRWts= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) 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 1610544449888405.88551132198177; Wed, 13 Jan 2021 05:27:29 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.66525.118201 (Exim 4.92) (envelope-from ) id 1kzgAt-0002qy-E3; Wed, 13 Jan 2021 13:26:59 +0000 Received: by outflank-mailman (output) from mailman id 66525.118201; Wed, 13 Jan 2021 13:26:59 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kzgAt-0002qr-AZ; Wed, 13 Jan 2021 13:26:59 +0000 Received: by outflank-mailman (input) for mailman id 66525; Wed, 13 Jan 2021 13:26:57 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kzgAq-0002b0-Hw for xen-devel@lists.xenproject.org; Wed, 13 Jan 2021 13:26:57 +0000 Received: from casper.infradead.org (unknown [2001:8b0:10b:1236::1]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 9ed141c5-1e13-4e8d-ab65-61b862738d15; Wed, 13 Jan 2021 13:26:38 +0000 (UTC) Received: from i7.infradead.org ([2001:8b0:10b:1:21e:67ff:fecb:7a92]) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1kzgA5-006IZS-AH; Wed, 13 Jan 2021 13:26:13 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1kzgA4-001m38-Tb; Wed, 13 Jan 2021 13:26:08 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list X-Inumbo-ID: 9ed141c5-1e13-4e8d-ab65-61b862738d15 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=syx4fu3vYSlHpqPUTOPP75qBiFyto3EbQNXax9AAeb0=; b=njCsb+X1885IP+Jo5MZr8HIal/ GYKp9MPuFSINd1L828fHtiBUJzOjnuMi0Yqv4Rw/knAuMQ5fU/6DK9Bc0ffBM/+AUiz6ZgwPjLdME momt5HGkIZ7wJptAEHwQrEdkfTk5EJyQ/Y6RU2J2LlHBP8xyGNzOE/esxcKBod7h8DND+hcbbTETL JmB3Eo5XoBOptP3MW2ySGn1lfC1p8edv/+zG/zbXpk/kNJC7pN9Nng+SpiS3/bwjunjo4Mfl5O8fi da21WVycMIKzZ+oaXQZ6Pw+EZg1jkem/UWXTvpGIb1regco2xVidKkKpUmwPCSl61v/ttrxwDWdzJ FbRyLv8A==; From: David Woodhouse To: x86@kernel.org Cc: Stefano Stabellini , Boris Ostrovsky , Juergen Gross , Paul Durrant , jgrall@amazon.com, karahmed@amazon.de, xen-devel Subject: [PATCH v4 2/5] xen: Set platform PCI device INTX affinity to CPU0 Date: Wed, 13 Jan 2021 13:26:03 +0000 Message-Id: <20210113132606.422794-3-dwmw2@infradead.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210113132606.422794-1-dwmw2@infradead.org> References: <20210113132606.422794-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: David Woodhouse X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html X-ZohoMail-DKIM: pass (identity @infradead.org) Content-Type: text/plain; charset="utf-8" From: David Woodhouse With INTX or GSI delivery, Xen uses the event channel structures of CPU0. If the interrupt gets handled by Linux on a different CPU, then no events are seen as pending. Rather than introducing locking to allow other CPUs to process CPU0's events, just ensure that the PCI interrupts happens only on CPU0. Signed-off-by: David Woodhouse Reviewed-by: Boris Ostrovsky --- drivers/xen/platform-pci.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/xen/platform-pci.c b/drivers/xen/platform-pci.c index 9db557b76511..18f0ed8b1f93 100644 --- a/drivers/xen/platform-pci.c +++ b/drivers/xen/platform-pci.c @@ -132,6 +132,13 @@ static int platform_pci_probe(struct pci_dev *pdev, dev_warn(&pdev->dev, "request_irq failed err=3D%d\n", ret); goto out; } + /* + * It doesn't strictly *have* to run on CPU0 but it sure + * as hell better process the event channel ports delivered + * to CPU0. + */ + irq_set_affinity(pdev->irq, cpumask_of(0)); + callback_via =3D get_callback_via(pdev); ret =3D xen_set_callback_via(callback_via); if (ret) { --=20 2.29.2 From nobody Sat Apr 20 04:12:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1610544417; cv=none; d=zohomail.com; s=zohoarc; b=OXbcljdZyO8DSPT9zeRJ+75RnfqwF0qYyopbcEArY2zv4j6zEKAaovIvXaxaOFyj5I4UmkCwneRTQL//iv0786NB6ZSrm6imOEh59ziP2XnxOy4sbAerHKc8HYUsihLj1ZZB56DOUiL913JF9QH1bXMdTRKBqXxib9YGEjgIoDY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610544417; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=v7CKfSooMYiTfyyBmfaP1ca1QwLyd6upiLV+irzFoYc=; b=Sj+ojF0Oq1YSKoCqjOcSfcxq3NZOaP4nmMdPjYMIouQHqPA6PeJbS6PwbH586ZnHj3iD2Xu5DSehGtkrZfjuBGmKAvTpVpagNf4Lzb+zrBaZUDHE4TicGRo/lTPpceko3bie/0/+edgBtiRAeopPCnQsHaADK6TUJe5/o5M+Arg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) 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 1610544417707316.2482530178314; Wed, 13 Jan 2021 05:26:57 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.66517.118188 (Exim 4.92) (envelope-from ) id 1kzgAT-0002gN-4L; Wed, 13 Jan 2021 13:26:33 +0000 Received: by outflank-mailman (output) from mailman id 66517.118188; Wed, 13 Jan 2021 13:26:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kzgAT-0002gG-18; Wed, 13 Jan 2021 13:26:33 +0000 Received: by outflank-mailman (input) for mailman id 66517; Wed, 13 Jan 2021 13:26:31 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kzgAR-0002b0-H8 for xen-devel@lists.xenproject.org; Wed, 13 Jan 2021 13:26:31 +0000 Received: from merlin.infradead.org (unknown [2001:8b0:10b:1231::1]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 88d043f4-4083-47ec-aec0-183899eb4feb; Wed, 13 Jan 2021 13:26:18 +0000 (UTC) Received: from i7.infradead.org ([2001:8b0:10b:1:21e:67ff:fecb:7a92]) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kzgA6-0007Xt-09; Wed, 13 Jan 2021 13:26:10 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1kzgA4-001m3C-UK; Wed, 13 Jan 2021 13:26:08 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list X-Inumbo-ID: 88d043f4-4083-47ec-aec0-183899eb4feb DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=v7CKfSooMYiTfyyBmfaP1ca1QwLyd6upiLV+irzFoYc=; b=uoomMCFDY1aEpsGiW7g8zOFXNA Lb9/FeZUTemCmhTRlfHDh3kuuei8zdoVrJ3tmpvZf+CW9vWmTX0ND67j/bipph5J7K2ql8rulOePa 43v66HmjIxMTfc4igltaYt5MuPhkMgWUffpiGlUoFseqbSFnzuZTvGIqwd9bFmS7WOmEz0iLmj8Xg hiyV/4YeH9BwQJTKvgMcXx6axABXIdyyd3rMGdIW/+jJDSlaAhmM6ZwZih6YNdHBePjvGMKv2ZB4k fqJKeYrnBJlMOobQGq4bBOa1P4yyxE8SD6a70UxGH9v1Cgwa47XwNjkuNjAdF1rUyAG8Uzr5RwVcL k19pqy9Q==; From: David Woodhouse To: x86@kernel.org Cc: Stefano Stabellini , Boris Ostrovsky , Juergen Gross , Paul Durrant , jgrall@amazon.com, karahmed@amazon.de, xen-devel Subject: [PATCH v4 3/5] x86/xen: Add xen_no_vector_callback option to test PCI INTX delivery Date: Wed, 13 Jan 2021 13:26:04 +0000 Message-Id: <20210113132606.422794-4-dwmw2@infradead.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210113132606.422794-1-dwmw2@infradead.org> References: <20210113132606.422794-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: David Woodhouse X-SRS-Rewrite: SMTP reverse-path rewritten from by merlin.infradead.org. See http://www.infradead.org/rpr.html X-ZohoMail-DKIM: pass (identity @infradead.org) Content-Type: text/plain; charset="utf-8" From: David Woodhouse It's useful to be able to test non-vector event channel delivery, to make sure Linux will work properly on older Xen which doesn't have it. It's also useful for those working on Xen and Xen-compatible hypervisors, because there are guest kernels still in active use which use PCI INTX even when vector delivery is available. Signed-off-by: David Woodhouse Reviewed-by: Boris Ostrovsky --- Documentation/admin-guide/kernel-parameters.txt | 4 ++++ arch/x86/xen/enlighten_hvm.c | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentatio= n/admin-guide/kernel-parameters.txt index c722ec19cd00..8b9289b27844 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -5972,6 +5972,10 @@ This option is obsoleted by the "nopv" option, which has equivalent effect for XEN platform. =20 + xen_no_vector_callback + [KNL,X86,XEN] Disable the vector callback for Xen + event channel interrupts. + xen_scrub_pages=3D [XEN] Boolean option to control scrubbing pages before giving them back to Xen, for use by other domains. Can be also changed at runtime diff --git a/arch/x86/xen/enlighten_hvm.c b/arch/x86/xen/enlighten_hvm.c index 9e87ab010c82..ec50b7423a4c 100644 --- a/arch/x86/xen/enlighten_hvm.c +++ b/arch/x86/xen/enlighten_hvm.c @@ -188,6 +188,8 @@ static int xen_cpu_dead_hvm(unsigned int cpu) return 0; } =20 +static bool no_vector_callback __initdata; + static void __init xen_hvm_guest_init(void) { if (xen_pv_domain()) @@ -207,7 +209,7 @@ static void __init xen_hvm_guest_init(void) =20 xen_panic_handler_init(); =20 - if (xen_feature(XENFEAT_hvm_callback_vector)) + if (!no_vector_callback && xen_feature(XENFEAT_hvm_callback_vector)) xen_have_vector_callback =3D 1; =20 xen_hvm_smp_init(); @@ -233,6 +235,13 @@ static __init int xen_parse_nopv(char *arg) } early_param("xen_nopv", xen_parse_nopv); =20 +static __init int xen_parse_no_vector_callback(char *arg) +{ + no_vector_callback =3D true; + return 0; +} +early_param("xen_no_vector_callback", xen_parse_no_vector_callback); + bool __init xen_hvm_need_lapic(void) { if (xen_pv_domain()) --=20 2.29.2 From nobody Sat Apr 20 04:12:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1610544410; cv=none; d=zohomail.com; s=zohoarc; b=TjXQenOUkOY86E4ncdXGmBEWRh9ys6CvweOTCwpCrOu7+bLydr+A8FiJWV+6D9lNvKINDsaadGVC18x8EM9V72xBnOZQjZ+m5J2nroBlBNuIg1RrfYWx9uOJDfVHSxZBfx4XLN0u4V7Chczyyw/jGcH6V2P9c5xudyvdMT9CGWM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610544410; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NF5qU2beGi/rF+3rF7wt8hkPc3cRKRCyW5iFlpMo7CY=; b=HGgVHeSxy3zzeBPjVwgUJW6TIphy8B9VQWhBXjHfiiBz6Dc0qGIHJqlGiMELK33VyljvxwRLdjc3Vz3e4DeWJXH1D5GYuI6l6UII6EQHwUiid0qcmsT0v9Dyaq3wpkidBZB8hAMvD0vP0S7Dy7u9f0bx5cfFypTqOCR+2wtucCU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) 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 16105444101611007.7549886254726; Wed, 13 Jan 2021 05:26:50 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.66516.118177 (Exim 4.92) (envelope-from ) id 1kzgAN-0002cd-Rs; Wed, 13 Jan 2021 13:26:27 +0000 Received: by outflank-mailman (output) from mailman id 66516.118177; Wed, 13 Jan 2021 13:26:27 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kzgAN-0002cV-Od; Wed, 13 Jan 2021 13:26:27 +0000 Received: by outflank-mailman (input) for mailman id 66516; Wed, 13 Jan 2021 13:26:26 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kzgAM-0002b0-Gz for xen-devel@lists.xenproject.org; Wed, 13 Jan 2021 13:26:26 +0000 Received: from merlin.infradead.org (unknown [2001:8b0:10b:1231::1]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id a89d3bf1-6045-4d1f-ba49-921e88dc53fd; Wed, 13 Jan 2021 13:26:18 +0000 (UTC) Received: from i7.infradead.org ([2001:8b0:10b:1:21e:67ff:fecb:7a92]) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kzgA6-0007Xu-0q; Wed, 13 Jan 2021 13:26:10 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1kzgA4-001m3F-V4; Wed, 13 Jan 2021 13:26:08 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list X-Inumbo-ID: a89d3bf1-6045-4d1f-ba49-921e88dc53fd DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=NF5qU2beGi/rF+3rF7wt8hkPc3cRKRCyW5iFlpMo7CY=; b=jpWNDAjgsdyNngY02qMfgCtwL+ Nt2d18UNDp1y8IYApy+dIVtPBqnZqPlWoy9RmGHCNf26nuybKd/UyVEPmc5rUv1L8gTouGmpL0KrW Tvt3j1KFhJDok6DwfyGRwYGVOM1+bZ0OKJBv1zOUztt7cChu2df3sqWc7F8YzCngzao1ItE4+zW6d uG3OyqKfmiUk5L8nBfGOJkzbIiJePTtwVgL6AwaB4B2ydCwYs80F3jueNOx0Pu8hRAlwBsOymXh29 lHTs2+4rU7JIaBLUJyeIU3+NCF+H3ryj26Jyg7Qn9P/Sri0AJn/8+SClE3Otn1u52LGO5dRMZrsms vL5FJlwg==; From: David Woodhouse To: x86@kernel.org Cc: Stefano Stabellini , Boris Ostrovsky , Juergen Gross , Paul Durrant , jgrall@amazon.com, karahmed@amazon.de, xen-devel Subject: [PATCH v4 4/5] x86/xen: Don't register Xen IPIs when they aren't going to be used Date: Wed, 13 Jan 2021 13:26:05 +0000 Message-Id: <20210113132606.422794-5-dwmw2@infradead.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210113132606.422794-1-dwmw2@infradead.org> References: <20210113132606.422794-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: David Woodhouse X-SRS-Rewrite: SMTP reverse-path rewritten from by merlin.infradead.org. See http://www.infradead.org/rpr.html X-ZohoMail-DKIM: pass (identity @infradead.org) Content-Type: text/plain; charset="utf-8" From: David Woodhouse In the case where xen_have_vector_callback is false, we still register the IPI vectors in xen_smp_intr_init() for the secondary CPUs even though they aren't going to be used. Stop doing that. Signed-off-by: David Woodhouse Reviewed-by: Boris Ostrovsky --- arch/x86/xen/enlighten_hvm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/xen/enlighten_hvm.c b/arch/x86/xen/enlighten_hvm.c index ec50b7423a4c..e68ea5f4ad1c 100644 --- a/arch/x86/xen/enlighten_hvm.c +++ b/arch/x86/xen/enlighten_hvm.c @@ -164,10 +164,10 @@ static int xen_cpu_up_prepare_hvm(unsigned int cpu) else per_cpu(xen_vcpu_id, cpu) =3D cpu; rc =3D xen_vcpu_setup(cpu); - if (rc) + if (rc || !xen_have_vector_callback) return rc; =20 - if (xen_have_vector_callback && xen_feature(XENFEAT_hvm_safe_pvclock)) + if (xen_feature(XENFEAT_hvm_safe_pvclock)) xen_setup_timer(cpu); =20 rc =3D xen_smp_intr_init(cpu); --=20 2.29.2 From nobody Sat Apr 20 04:12:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1610544411; cv=none; d=zohomail.com; s=zohoarc; b=NygT0OnoMdFpTkFPPIhCZ83mHASoRe14wDuxFctY2pFROukTZ29RO1/ZFfMXz1PIxhJESBQGyFKvNVYUP54q0aS0MSba4KIUA2L7+iFq4KETyyR4zVnv/tWZRHtAvTcyYk+cwLgOt+GZgP+OopShUGxDxhM75GIHd4aOLSCB4Lk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610544411; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Y4zmIg7u/h9MHqeM4gjTkQQySHu05FosItAdEAKmRis=; b=UR22t77tgJJORUAv30rB6NnuIO60LkcpUwtvh0XW7ZNhaeLBA5B2RZk5d1jPWZ0SLEBePAfyzW1acaMSWD5+hV20/KdCmVcwQbUisv2KGAeAbvdAlKJ6FRjTW4RxylxOHArwwV0+UvpTRqI/UfnWyKv5tDM3iGBmdlvf4cMhhWs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) 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 1610544411573517.2016204498779; Wed, 13 Jan 2021 05:26:51 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.66515.118164 (Exim 4.92) (envelope-from ) id 1kzgAL-0002bC-JR; Wed, 13 Jan 2021 13:26:25 +0000 Received: by outflank-mailman (output) from mailman id 66515.118164; Wed, 13 Jan 2021 13:26:25 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kzgAL-0002b5-GL; Wed, 13 Jan 2021 13:26:25 +0000 Received: by outflank-mailman (input) for mailman id 66515; Wed, 13 Jan 2021 13:26:24 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kzgAH-0002b0-JS for xen-devel@lists.xenproject.org; Wed, 13 Jan 2021 13:26:24 +0000 Received: from merlin.infradead.org (unknown [2001:8b0:10b:1231::1]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 0847f02a-fbde-46bc-a9de-1d961f881292; Wed, 13 Jan 2021 13:26:17 +0000 (UTC) Received: from i7.infradead.org ([2001:8b0:10b:1:21e:67ff:fecb:7a92]) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kzgA6-0007Xv-1g; Wed, 13 Jan 2021 13:26:10 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1kzgA4-001m3I-Vn; Wed, 13 Jan 2021 13:26:08 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list X-Inumbo-ID: 0847f02a-fbde-46bc-a9de-1d961f881292 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description; bh=Y4zmIg7u/h9MHqeM4gjTkQQySHu05FosItAdEAKmRis=; b=RufyiL/GIwWsux2Ru6gogAORBV a65xJVPOwz3qatqWk3zzNwtOYg0i3MKn4wFACQg6qP2D6R/KvTSylaYy74r1r70G87qoVy5p2uE3r w0ic8bkGTB5yJRbdMGspt8U1e/MT+CfXhy0T0q3aIRH0xf7KRrW4DxkD7/s35O94o6kGXcSTDsJFn EoaC19Iz6gcgu+dLZI2cNOEXzDN17I7L/iXV4XLyzzvgW52gcSna0e3051eZ6RZC1kALIuN2aAbV4 vfTxLZuTZcWrbpymZIDADDWbeNVrZLs2cKEWaZesU4DeeWiMzczPjWw2X5d0FfBv+qc2Uqe6h1ha/ 4JXHGvCg==; From: David Woodhouse To: x86@kernel.org Cc: Stefano Stabellini , Boris Ostrovsky , Juergen Gross , Paul Durrant , jgrall@amazon.com, karahmed@amazon.de, xen-devel Subject: [PATCH v4 5/5] x86/xen: Fix xen_hvm_smp_init() when vector callback not available Date: Wed, 13 Jan 2021 13:26:06 +0000 Message-Id: <20210113132606.422794-6-dwmw2@infradead.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210113132606.422794-1-dwmw2@infradead.org> References: <20210113132606.422794-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: David Woodhouse X-SRS-Rewrite: SMTP reverse-path rewritten from by merlin.infradead.org. See http://www.infradead.org/rpr.html X-ZohoMail-DKIM: pass (identity @infradead.org) From: David Woodhouse Only the IPI-related functions in the smp_ops should be conditional on the vector callback being available. The rest should still happen: =E2=80=A2 xen_hvm_smp_prepare_boot_cpu() This function does two things, both of which should still happen if there is no vector callback support. The call to xen_vcpu_setup() for vCPU0 should still happen as it just sets up the vcpu_info for CPU0. That does happen for the secondary vCPUs too, from xen_cpu_up_prepare_hvm(). The second thing it does is call xen_init_spinlocks(), which perhaps counter-intuitively should *also* still be happening in the case without vector callbacks, so that it can clear its local xen_pvspin flag and disable the virt_spin_lock_key accordingly. Checking xen_have_vector_callback in xen_init_spinlocks() itself would affect PV guests, so set the global nopvspin flag in xen_hvm_smp_init() instead, when vector callbacks aren't available. =E2=80=A2 xen_hvm_smp_prepare_cpus() This does some IPI-related setup by calling xen_smp_intr_init() and xen_init_lock_cpu(), which can be made conditional. And it sets the xen_vcpu_id to XEN_VCPU_ID_INVALID for all possible CPUS, which does need to happen. =E2=80=A2 xen_smp_cpus_done() This offlines any vCPUs which doesn't fit in the global shared_info page, if separate vcpu_info placement isn't available. That part also needs to happen regardless of vector callback support. =E2=80=A2 xen_hvm_cpu_die() This doesn't actually do anything other than commin_cpu_die() right right now in the !vector_callback case; all three teardown functions it calls should be no-ops. But to guard against future regressions it's useful to call it anyway, and for it to explicitly check for xen_have_vector_callback before calling those additional functions. Signed-off-by: David Woodhouse Reviewed-by: Boris Ostrovsky --- arch/x86/xen/smp_hvm.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/arch/x86/xen/smp_hvm.c b/arch/x86/xen/smp_hvm.c index f5e7db4f82ab..056430a1080b 100644 --- a/arch/x86/xen/smp_hvm.c +++ b/arch/x86/xen/smp_hvm.c @@ -33,9 +33,11 @@ static void __init xen_hvm_smp_prepare_cpus(unsigned int= max_cpus) int cpu; =20 native_smp_prepare_cpus(max_cpus); - WARN_ON(xen_smp_intr_init(0)); =20 - xen_init_lock_cpu(0); + if (xen_have_vector_callback) { + WARN_ON(xen_smp_intr_init(0)); + xen_init_lock_cpu(0); + } =20 for_each_possible_cpu(cpu) { if (cpu =3D=3D 0) @@ -50,9 +52,11 @@ static void __init xen_hvm_smp_prepare_cpus(unsigned int= max_cpus) static void xen_hvm_cpu_die(unsigned int cpu) { if (common_cpu_die(cpu) =3D=3D 0) { - xen_smp_intr_free(cpu); - xen_uninit_lock_cpu(cpu); - xen_teardown_timer(cpu); + if (xen_have_vector_callback) { + xen_smp_intr_free(cpu); + xen_uninit_lock_cpu(cpu); + xen_teardown_timer(cpu); + } } } #else @@ -64,14 +68,17 @@ static void xen_hvm_cpu_die(unsigned int cpu) =20 void __init xen_hvm_smp_init(void) { - if (!xen_have_vector_callback) + smp_ops.smp_prepare_boot_cpu =3D xen_hvm_smp_prepare_boot_cpu; + smp_ops.smp_prepare_cpus =3D xen_hvm_smp_prepare_cpus; + smp_ops.smp_cpus_done =3D xen_smp_cpus_done; + smp_ops.cpu_die =3D xen_hvm_cpu_die; + + if (!xen_have_vector_callback) { + nopvspin =3D true; return; + } =20 - smp_ops.smp_prepare_cpus =3D xen_hvm_smp_prepare_cpus; smp_ops.smp_send_reschedule =3D xen_smp_send_reschedule; - smp_ops.cpu_die =3D xen_hvm_cpu_die; smp_ops.send_call_func_ipi =3D xen_smp_send_call_function_ipi; smp_ops.send_call_func_single_ipi =3D xen_smp_send_call_function_single_i= pi; - smp_ops.smp_prepare_boot_cpu =3D xen_hvm_smp_prepare_boot_cpu; - smp_ops.smp_cpus_done =3D xen_smp_cpus_done; } --=20 2.29.2