From patchwork Sat Jan 6 00:47:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jose Ricardo Ziviani X-Patchwork-Id: 856283 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zD2vn4Fw0z9sNc for ; Sat, 6 Jan 2018 11:48:21 +1100 (AEDT) Received: from localhost ([::1]:38748 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eXcep-0000W0-Iw for incoming@patchwork.ozlabs.org; Fri, 05 Jan 2018 19:48:19 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47837) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eXce9-0000Vj-2G for qemu-devel@nongnu.org; Fri, 05 Jan 2018 19:47:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eXce4-0002IY-WA for qemu-devel@nongnu.org; Fri, 05 Jan 2018 19:47:36 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:52702) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eXce4-0002GY-FW for qemu-devel@nongnu.org; Fri, 05 Jan 2018 19:47:32 -0500 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w060i2gw004395 for ; Fri, 5 Jan 2018 19:47:30 -0500 Received: from e15.ny.us.ibm.com (e15.ny.us.ibm.com [129.33.205.205]) by mx0a-001b2d01.pphosted.com with ESMTP id 2fajpmar6k-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 05 Jan 2018 19:47:29 -0500 Received: from localhost by e15.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 5 Jan 2018 19:47:28 -0500 Received: from b01cxnp23033.gho.pok.ibm.com (9.57.198.28) by e15.ny.us.ibm.com (146.89.104.202) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 5 Jan 2018 19:47:27 -0500 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w060lRDu2884066; Sat, 6 Jan 2018 00:47:27 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B7E4BAC040; Fri, 5 Jan 2018 19:48:37 -0500 (EST) Received: from pacoca.ibm.com (unknown [9.85.187.70]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP id BA192AC041; Fri, 5 Jan 2018 19:48:36 -0500 (EST) From: Jose Ricardo Ziviani To: qemu-ppc@nongnu.org Date: Fri, 5 Jan 2018 22:47:21 -0200 X-Mailer: git-send-email 2.14.1 X-TM-AS-GCONF: 00 x-cbid: 18010600-0036-0000-0000-000002A68AD2 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008326; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000244; SDB=6.00970832; UDB=6.00491727; IPR=6.00750802; BA=6.00005765; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00018901; XFM=3.00000015; UTC=2018-01-06 00:47:28 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18010600-0037-0000-0000-000042E12692 Message-Id: <20180106004722.1152-1-joserz@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-01-05_11:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1801060006 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 0/1] Check SMT based on KVM_CAP_PPC_SMT_POSSIBLE X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" If one defines a P9 guest like -smp sockets=1,cores=1,threads=8 QEMU will silently changes threads to 4: (guest) # lscpu Architecture: ppc64le Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 Thread(s) per core: 4 Core(s) per socket: 1 Socket(s): 1 NUMA node(s): 1 ... (qemu) info cpus * CPU #0: nip=0xc0000000000db9cc thread_id=9440 CPU #1: nip=0xc0000000000db9cc thread_id=9441 CPU #2: nip=0xc0000000000db9cc thread_id=9442 CPU #3: nip=0xc0000000000db9cc thread_id=9443 CPU #4: nip=0x0000000000000100 (halted) thread_id=9444 CPU #5: nip=0x0000000000000100 (halted) thread_id=9445 CPU #6: nip=0x0000000000000100 (halted) thread_id=9446 CPU #7: nip=0x0000000000000100 (halted) thread_id=9447 This behavior is causing confusion and QEMU will crash if one tries to hotplug a CPU. QEMU already has a number of SMT sane checking and this patch adds another one: it verifies if KVM supports (KVM_CAP_PPC_SMT_POSSIBLE) the required number of threads instead of impose a value defined in the compat table. Result: (guest) # lscpu Architecture: ppc64le Byte Order: Little Endian CPU(s): 8 On-line CPU(s) list: 0-7 Thread(s) per core: 8 Core(s) per socket: 1 Socket(s): 1 ... (qemu) info cpus * CPU #0: nip=0xc0000000000d30ac thread_id=80197 CPU #1: nip=0xc0000000000d30ac thread_id=80198 CPU #2: nip=0xc0000000000d30ac thread_id=80199 CPU #3: nip=0xc0000000000d30ac thread_id=80200 CPU #4: nip=0xc0000000000d30ac thread_id=80201 CPU #5: nip=0xc0000000000d30ac thread_id=80202 CPU #6: nip=0xc0000000000d30ac thread_id=80203 CPU #7: nip=0xc0000000000d30ac thread_id=80204 This patch is based on ppc-for-2.12 Jose Ricardo Ziviani (1): spapr: Check SMT based on KVM_CAP_PPC_SMT_POSSIBLE hw/ppc/spapr.c | 14 +++++++++++++- hw/ppc/trace-events | 1 + target/ppc/kvm.c | 5 +++++ target/ppc/kvm_ppc.h | 6 ++++++ 4 files changed, 25 insertions(+), 1 deletion(-)