From 3a7d0411addca79192ed60939f55ec019c27a72a Mon Sep 17 00:00:00 2001 From: David Gibson Date: Tue, 8 Oct 2019 05:08:36 +0100 Subject: [PATCH 4/6] spapr/xive: skip partially initialized vCPUs in presenter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RH-Author: David Gibson Message-id: <20191008050836.11479-1-dgibson@redhat.com> Patchwork-id: 90994 O-Subject: [RHEL-AV-8.1.1 qemu-kvm PATCH] spapr/xive: skip partially initialized vCPUs in presenter Bugzilla: 1754710 RH-Acked-by: Laurent Vivier RH-Acked-by: Thomas Huth RH-Acked-by: Philippe Mathieu-Daudé From: Cédric Le Goater When vCPUs are hotplugged, they are added to the QEMU CPU list before being fully realized. This can crash the XIVE presenter because the 'tctx' pointer is not necessarily initialized when looking for a matching target. These vCPUs are not valid targets for the presenter. Skip them. Signed-off-by: Cédric Le Goater Message-Id: <20191001085722.32755-1-clg@kaod.org> Signed-off-by: David Gibson Reviewed-by: Greg Kurz (cherry picked from commit 627fa61746f70f7c799f08e9048bb6a482402138) Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1754710 Branch: rhel-av-8.1.1 Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=23900462 Testing: Could no longer reproduce bug with brewed qemu Signed-off-by: David Gibson Signed-off-by: Danilo C. L. de Paula --- hw/intc/xive.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/intc/xive.c b/hw/intc/xive.c index da148e9..8f639f6 100644 --- a/hw/intc/xive.c +++ b/hw/intc/xive.c @@ -1345,6 +1345,14 @@ static bool xive_presenter_match(XiveRouter *xrtr, uint8_t format, int ring; /* + * Skip partially initialized vCPUs. This can happen when + * vCPUs are hotplugged. + */ + if (!tctx) { + continue; + } + + /* * HW checks that the CPU is enabled in the Physical Thread * Enable Register (PTER). */ -- 1.8.3.1