From nobody Tue Feb 10 10:04:00 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1571932813; cv=none; d=zoho.com; s=zohoarc; b=mMDGnl1Oo8oaxYVT3GoViE5d62n7eVITjuGps6WT2l4ItLtjD1qZ/1jpyKUblTESfm8ovZg0aPtV+tGj7QWyakNDen7j6HTBlA0fmruuI55F8cTQAOsL5CXQvrwk36Qa8R6TstOg6jQWxSp+MPehU9P3m2I/9zme+IxzTCVtYLQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571932813; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=O8f43T5N1t/HmGUnnd3ltx2YKTIcCgKKcnCYZ5D6OYo=; b=DF1rgPCtaX/XVlXpdXpUPSRYX+Lbqm9rvqY7eepAMCgylgp7dmo5uZsJDHxuP9aHIO8bvnzjipV91NGxmbF/eZi5AJmqyTLIjtafavBQmCYr6KjKFRNfkWSx+nYHQZ+Ltc4beKuCh9MHLe9ZrCbMX3ICt2rvWJNlFIUPpZvknk4= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1571932813810949.6141606462595; Thu, 24 Oct 2019 09:00:13 -0700 (PDT) Received: from localhost ([::1]:45864 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNfX0-0002HZ-Fd for importer@patchew.org; Thu, 24 Oct 2019 12:00:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39268) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNe5X-0003MV-KB for qemu-devel@nongnu.org; Thu, 24 Oct 2019 10:27:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNe5V-0004ns-KA for qemu-devel@nongnu.org; Thu, 24 Oct 2019 10:27:43 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:24404) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iNe5V-0004mC-CR for qemu-devel@nongnu.org; Thu, 24 Oct 2019 10:27:41 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x9OEOcKX056201 for ; Thu, 24 Oct 2019 10:27:39 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2vucuytmmf-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 24 Oct 2019 10:27:39 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 24 Oct 2019 15:27:36 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 24 Oct 2019 15:27:34 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x9OERXq153870660 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 24 Oct 2019 14:27:34 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CD12A11C052; Thu, 24 Oct 2019 14:27:33 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9B56411C04A; Thu, 24 Oct 2019 14:27:33 +0000 (GMT) Received: from bahia.lan (unknown [9.145.36.67]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 24 Oct 2019 14:27:33 +0000 (GMT) Subject: [PATCH 3/3] ppc: Skip partially initialized vCPUs in 'info pic' From: Greg Kurz To: David Gibson Date: Thu, 24 Oct 2019 16:27:33 +0200 In-Reply-To: <157192723646.3146912.1271674896169655201.stgit@bahia.lan> References: <157192723646.3146912.1271674896169655201.stgit@bahia.lan> User-Agent: StGit/unknown-version MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 x-cbid: 19102414-0008-0000-0000-00000326DF3E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19102414-0009-0000-0000-00004A46131F Message-Id: <157192725327.3146912.12047076483178652551.stgit@bahia.lan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-10-24_09:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=760 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910240135 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, =?utf-8?q?C=C3=A9dric?= Le Goater , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" CPU_FOREACH() can race with vCPU hotplug/unplug on sPAPR machines, ie. we may try to print out info about a vCPU with a NULL presenter pointer. Check that in order to prevent QEMU from crashing. Signed-off-by: Greg Kurz --- hw/intc/xics.c | 11 ++++++++++- hw/intc/xive.c | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 5f746079be46..e7ac9ba618fa 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -44,7 +44,16 @@ =20 void icp_pic_print_info(ICPState *icp, Monitor *mon) { - int cpu_index =3D icp->cs ? icp->cs->cpu_index : -1; + int cpu_index; + + /* Skip partially initialized vCPUs. This can happen on sPAPR when vCP= Us + * are hot plugged or unplugged. + */ + if (!icp) { + return; + } + + cpu_index =3D icp->cs ? icp->cs->cpu_index : -1; =20 if (!icp->output) { return; diff --git a/hw/intc/xive.c b/hw/intc/xive.c index 952a461d5329..75dce82fb205 100644 --- a/hw/intc/xive.c +++ b/hw/intc/xive.c @@ -523,9 +523,18 @@ static const char * const xive_tctx_ring_names[] =3D { =20 void xive_tctx_pic_print_info(XiveTCTX *tctx, Monitor *mon) { - int cpu_index =3D tctx->cs ? tctx->cs->cpu_index : -1; + int cpu_index; int i; =20 + /* Skip partially initialized vCPUs. This can happen on sPAPR when vCP= Us + * are hot plugged or unplugged. + */ + if (!tctx) { + return; + } + + cpu_index =3D tctx->cs ? tctx->cs->cpu_index : -1; + if (kvm_irqchip_in_kernel()) { Error *local_err =3D NULL; =20