From patchwork Tue Jun 18 08:23:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harsh Prateek Bora X-Patchwork-Id: 1948988 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=RSGCF3o2; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W3KZY484qz20Wb for ; Tue, 18 Jun 2024 18:25:41 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sJU98-0005BY-6c; Tue, 18 Jun 2024 04:24:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sJU96-00052W-S7; Tue, 18 Jun 2024 04:24:52 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sJU8n-0000UK-Fn; Tue, 18 Jun 2024 04:24:52 -0400 Received: from pps.filterd (m0353726.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45I8Mbgc028631; Tue, 18 Jun 2024 08:24:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from :to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=pp1; bh=0NcivlH2vL4+ZkUuJHQqlDQ/Uu SsmxoZcd3CNJ7Lbhk=; b=RSGCF3o2Des9j0cslmv+GTCAkt9+YjnFkk+KYiUxHT cqtnQjB5wWmQgDOhojt27fQP9jfxy4VNsupfxtPyJVCVtAYJD82gEwwXY6VCD2bZ 1Y4vFufH6MkktgXq4iJbMQZbLuokIwrIUkHa8jRkBY3qq89YtL0XgNLl8lxTk1YL EL4QjQuH0buyh+nm2d3re0LJAWPBmR7VHNHMY/bUutm2+waUz70R8hel+ite5ymJ qQNmEevtIbdZZ1NeDoiMhdaKOvyy36rxV71rXaULDlmbpIM5FiJubKPp/kvg0RNp /qifCcqtTW6SI8rHRdpOi2vAxBiyhsvSx/gsPRvLPFJw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yu59087xm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jun 2024 08:24:14 +0000 (GMT) Received: from m0353726.ppops.net (m0353726.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45I8OE38032700; Tue, 18 Jun 2024 08:24:14 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yu59087ws-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jun 2024 08:24:14 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45I6rf2Z019495; Tue, 18 Jun 2024 08:24:04 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3ysnp11cf2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jun 2024 08:24:04 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45I8NwZj56557958 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Jun 2024 08:24:01 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DE9D02004D; Tue, 18 Jun 2024 08:23:58 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8702120063; Tue, 18 Jun 2024 08:23:57 +0000 (GMT) Received: from localhost.localdomain (unknown [9.109.242.165]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 18 Jun 2024 08:23:57 +0000 (GMT) From: Harsh Prateek Bora To: npiggin@gmail.com, pbonzini@redhat.com, qemu-ppc@nongnu.org, qemu-devel@nongnu.org Cc: danielhb413@gmail.com, vaibhav@linux.ibm.com, sbhat@linux.ibm.com Subject: [PATCH v4 0/3] target/ppc: vcpu hotplug failure handling fixes Date: Tue, 18 Jun 2024 13:53:51 +0530 Message-ID: <20240618082354.13919-1-harshpb@linux.ibm.com> X-Mailer: git-send-email 2.45.1 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 29OhGXUMyOYK86WTIpUP1gfvEmqbIGgW X-Proofpoint-ORIG-GUID: Q48QLB34eUnD3F8fL1fJGYxrnY5cseyP X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-18_02,2024-06-17_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 lowpriorityscore=0 priorityscore=1501 suspectscore=0 mlxlogscore=638 malwarescore=0 impostorscore=0 phishscore=0 adultscore=0 clxscore=1015 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406180061 Received-SPF: pass client-ip=148.163.156.1; envelope-from=harshpb@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On ppc64, the PowerVM hypervisor runs with limited memory and a VCPU creation during hotplug may fail during kvm_ioctl for KVM_CREATE_VCPU, leading to termination of guest since errp is set to &error_fatal while calling kvm_init_vcpu. This unexpected behaviour can be avoided by pre-creating and parking vcpu on success or return error otherwise. This enables graceful error delivery for any vcpu hotplug failures while the guest can keep running. This series adds another helper to create and park vcpu, based on [1], exports cpu_get_free_index to be reused later and adds ppc arch specfic handling for vcpu hotplug failure using kvm accel helper cpu_target_realize. [1] <20240607115649.214622-1-salil.mehta@huawei.com> Changelog: v4: rebased, comment update in patch 3, added R-bys. v3: Addressed review comments from Nick v2: Addressed review comments from Nick v1: Initial patch Harsh Prateek Bora (3): accel/kvm: Introduce kvm_create_and_park_vcpu() helper cpu-common.c: export cpu_get_free_index to be reused later target/ppc: handle vcpu hotplug failure gracefully include/exec/cpu-common.h | 2 ++ include/sysemu/kvm.h | 8 +++++++ accel/kvm/kvm-all.c | 12 ++++++++++ cpu-common.c | 7 +++--- target/ppc/kvm.c | 46 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 72 insertions(+), 3 deletions(-)