From nobody Mon May 13 10:25:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1708622967; cv=none; d=zohomail.com; s=zohoarc; b=BpdDpuDFXGVlZa53PyIf+lbnFRuyrIYVDBGnqJGkxbl8b60z5xpx8CYIVXp3xyFomHmRT9KDwImxqtQVCeMXHIId8ImMH2Y8zvSxpFbeWZQf/fSSBO99POhY0RfkpRoGuulv2bDvfMNOIluvolB4gp6YqXyHbUuTTlEX2n1/a3c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708622967; h=Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=alSGxZlfCylgGyVfn6yQmA3B7Gi0wPsmqVLM6lxwUBE=; b=flLO9VJwl/tyxOjp6NN8nEGixBZT1jyvdjBP68Z1sXNDUbUojSn/vDf+Wovff09KE8hY9ByM95iw85C8CpXg8cHuFiTY6f64kFVfdB/mJtt2q2Dx8SV+2dz9+yr2aKat2NqhuzGIEC5XxMpIO75o9p/VZpNAVWSQ6zwDRqbX4Ug= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708622967150717.0889389271142; Thu, 22 Feb 2024 09:29:27 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdCsR-0004f5-70; Thu, 22 Feb 2024 12:28:55 -0500 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 1rdCsP-0004Z2-AY for qemu-devel@nongnu.org; Thu, 22 Feb 2024 12:28:53 -0500 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdCsN-0003Bd-B3 for qemu-devel@nongnu.org; Thu, 22 Feb 2024 12:28:53 -0500 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41MH940A003399; Thu, 22 Feb 2024 17:28:50 GMT Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3wd4knw19y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 17:28:49 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41MG8elX024593; Thu, 22 Feb 2024 17:28:44 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3wak8ayrgr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 17:28:44 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 41MHSg9n032453; Thu, 22 Feb 2024 17:28:43 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3wak8ayre4-2; Thu, 22 Feb 2024 17:28:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2023-11-20; bh=alSGxZlfCylgGyVfn6yQmA3B7Gi0wPsmqVLM6lxwUBE=; b=lI2FZgDhYXLUVjNlzC79FVxaylkYklgf7+ALN5nSwXpHg7gpnJN3APFvmeU5TOP1MY5x R4y1sTz23H6UZZudu20BOVpQsdm5i/dMCANp9Y1FhEPWIb5Y2GFTFzC9aV7mp/0Wi2Bi 6FVt0uGLMkc/ebJwMAnzRq6M8KkLVwPJ/9qdiEem286vyapmkUSxm6uZUpWKqKQHgB9Z dmt1ToCZHnaMHcYWp9SXlP98v0xoiFSXBoWEA4B3/2YdJ6WM7w1L3ngrRJW7yHNIzEV9 ZRhVu2hsFU49H85Iwse62ZzYmFQKCVJXgO26p/V+ILWpwKmhpesXKOVP0SaRmTNhUls+ /w== From: Steve Sistare To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , "Michael S. Tsirkin" , Jason Wang , Alex Williamson , Cedric Le Goater , Gerd Hoffmann , Marc-Andre Lureau , David Hildenbrand , Steve Sistare Subject: [PATCH V4 01/14] notify: pass error to notifier with return Date: Thu, 22 Feb 2024 09:28:27 -0800 Message-Id: <1708622920-68779-2-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1708622920-68779-1-git-send-email-steven.sistare@oracle.com> References: <1708622920-68779-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-22_13,2024-02-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 phishscore=0 suspectscore=0 mlxscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402220138 X-Proofpoint-ORIG-GUID: RI5Om39NcVMwLgtzzAB3vNHPWXyNOUkD X-Proofpoint-GUID: RI5Om39NcVMwLgtzzAB3vNHPWXyNOUkD Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=205.220.177.32; envelope-from=steven.sistare@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1708622967705100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Pass an error object as the third parameter to "notifier with return" notifiers, so clients no longer need to bundle an error object in the opaque data. The new parameter is used in a later patch. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu Reviewed-by: David Hildenbrand --- hw/virtio/vhost-user.c | 2 +- hw/virtio/virtio-balloon.c | 3 ++- include/qemu/notify.h | 7 +++++-- migration/postcopy-ram.c | 2 +- migration/ram.c | 2 +- util/notify.c | 5 +++-- 6 files changed, 13 insertions(+), 8 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index f214df8..f502345 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -2084,7 +2084,7 @@ static int vhost_user_postcopy_end(struct vhost_dev *= dev, Error **errp) } =20 static int vhost_user_postcopy_notifier(NotifierWithReturn *notifier, - void *opaque) + void *opaque, Error **errp) { struct PostcopyNotifyData *pnd =3D opaque; struct vhost_user *u =3D container_of(notifier, struct vhost_user, diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 486fe3d..89f853f 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -633,7 +633,8 @@ static void virtio_balloon_free_page_done(VirtIOBalloon= *s) } =20 static int -virtio_balloon_free_page_hint_notify(NotifierWithReturn *n, void *data) +virtio_balloon_free_page_hint_notify(NotifierWithReturn *n, void *data, + Error **errp) { VirtIOBalloon *dev =3D container_of(n, VirtIOBalloon, free_page_hint_n= otify); VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); diff --git a/include/qemu/notify.h b/include/qemu/notify.h index bcfa70f..9a85631 100644 --- a/include/qemu/notify.h +++ b/include/qemu/notify.h @@ -45,12 +45,15 @@ bool notifier_list_empty(NotifierList *list); /* Same as Notifier but allows .notify() to return errors */ typedef struct NotifierWithReturn NotifierWithReturn; =20 +typedef int (*NotifierWithReturnFunc)(NotifierWithReturn *notifier, void *= data, + Error **errp); + struct NotifierWithReturn { /** * Return 0 on success (next notifier will be invoked), otherwise * notifier_with_return_list_notify() will stop and return the value. */ - int (*notify)(NotifierWithReturn *notifier, void *data); + NotifierWithReturnFunc notify; QLIST_ENTRY(NotifierWithReturn) node; }; =20 @@ -69,6 +72,6 @@ void notifier_with_return_list_add(NotifierWithReturnList= *list, void notifier_with_return_remove(NotifierWithReturn *notifier); =20 int notifier_with_return_list_notify(NotifierWithReturnList *list, - void *data); + void *data, Error **errp); =20 #endif diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 893ec8f..3ab2f6b 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -80,7 +80,7 @@ int postcopy_notify(enum PostcopyNotifyReason reason, Err= or **errp) pnd.errp =3D errp; =20 return notifier_with_return_list_notify(&postcopy_notifier_list, - &pnd); + &pnd, errp); } =20 /* diff --git a/migration/ram.c b/migration/ram.c index 4649a81..5b6b09e 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -428,7 +428,7 @@ int precopy_notify(PrecopyNotifyReason reason, Error **= errp) pnd.reason =3D reason; pnd.errp =3D errp; =20 - return notifier_with_return_list_notify(&precopy_notifier_list, &pnd); + return notifier_with_return_list_notify(&precopy_notifier_list, &pnd, = errp); } =20 uint64_t ram_bytes_remaining(void) diff --git a/util/notify.c b/util/notify.c index 76bab21..c6e158f 100644 --- a/util/notify.c +++ b/util/notify.c @@ -61,13 +61,14 @@ void notifier_with_return_remove(NotifierWithReturn *no= tifier) QLIST_REMOVE(notifier, node); } =20 -int notifier_with_return_list_notify(NotifierWithReturnList *list, void *d= ata) +int notifier_with_return_list_notify(NotifierWithReturnList *list, void *d= ata, + Error **errp) { NotifierWithReturn *notifier, *next; int ret =3D 0; =20 QLIST_FOREACH_SAFE(notifier, &list->notifiers, node, next) { - ret =3D notifier->notify(notifier, data); + ret =3D notifier->notify(notifier, data, errp); if (ret !=3D 0) { break; } --=20 1.8.3.1 From nobody Mon May 13 10:25:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1708623074; cv=none; d=zohomail.com; s=zohoarc; b=QAu76OnSy/XGkOojupZozMg9hSofHEyecobbJisGDkuuX/20vur4Yrdln9bPQ6v9aSLN9deLpFvys+6d2eA4UdleH1xJ1uAn5VDCz5b/bL9K9s/GM6YlmsgpdH5tLTqbMHHRscvPEDK5Txn2J3wcUeD6yPLXzqFmQzABnzZac1o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708623074; h=Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=3jiTR2PQkkC7AVYhvOLwprjdn5h1XZj9813c0epo5TQ=; b=K9xmr7pTyxa2uRaDckk9pksDrexnOGD+RxzxAEIdFSQGX6Qag0Sm6qmIR0+NkJMfopdzmyhq/gGM0veZQmKCm1mCE55zQ7dSQABWCYUuRpqFUX7jMZP5m4EY6psz/Y7NIdBxWvkDUc0eT+Q1ViS+UfGYTuJE5d0U4+GmG9foBso= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708623074387951.8234341272723; Thu, 22 Feb 2024 09:31:14 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdCsP-0004Yz-Ch; Thu, 22 Feb 2024 12:28:53 -0500 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 1rdCsO-0004TB-6U for qemu-devel@nongnu.org; Thu, 22 Feb 2024 12:28:52 -0500 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdCsL-0003BO-9J for qemu-devel@nongnu.org; Thu, 22 Feb 2024 12:28:51 -0500 Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41MGteBJ017892; Thu, 22 Feb 2024 17:28:47 GMT Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3wanbvn9wh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 17:28:47 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41MGDr0f024604; Thu, 22 Feb 2024 17:28:45 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3wak8ayrhs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 17:28:45 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 41MHSg9p032453; Thu, 22 Feb 2024 17:28:45 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3wak8ayre4-3; Thu, 22 Feb 2024 17:28:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2023-11-20; bh=3jiTR2PQkkC7AVYhvOLwprjdn5h1XZj9813c0epo5TQ=; b=dAMws7Bc0K08xlFDDMWwNLhP8xWu6jhrhhNLXnT82TUEGPLfveqm65Garc26LtBqQYdW DeovjPiGgpwksgQ25FlvPtnFeAZsCV/leS7BbxCoqrRflU4b09VDISo6jmEnm4TVk2Ve 4wp8VS2HMASs8d0TlPSWM4/n7cinpUdAU9eaPMFvnLvR0bc0CmpHen7vQJUfr9urssIj aXuzmz2CUb273uJu/t8IUeM/5x6ekk2fgeZJ2YSlSpnhU7QmGbpbxYoibFE3nrdOzV5x 8oPQDkYtkALu7P/c1hwwnW5xzCvqtYe9UL4tPAdRFv4+eI30waV7ecIgZ140WxVkgeWS WQ== From: Steve Sistare To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , "Michael S. Tsirkin" , Jason Wang , Alex Williamson , Cedric Le Goater , Gerd Hoffmann , Marc-Andre Lureau , David Hildenbrand , Steve Sistare Subject: [PATCH V4 02/14] migration: remove error from notifier data Date: Thu, 22 Feb 2024 09:28:28 -0800 Message-Id: <1708622920-68779-3-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1708622920-68779-1-git-send-email-steven.sistare@oracle.com> References: <1708622920-68779-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-22_13,2024-02-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 phishscore=0 suspectscore=0 mlxscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402220138 X-Proofpoint-GUID: Dj-tweztUxhthAuWdsdB1663VbUcifXH X-Proofpoint-ORIG-GUID: Dj-tweztUxhthAuWdsdB1663VbUcifXH Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=205.220.165.32; envelope-from=steven.sistare@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1708623076188100007 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Remove the error object from opaque data passed to notifiers. Use the new error parameter passed to the notifier instead. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu Reviewed-by: David Hildenbrand --- hw/virtio/vhost-user.c | 8 ++++---- include/migration/misc.h | 1 - migration/postcopy-ram.c | 1 - migration/postcopy-ram.h | 1 - migration/ram.c | 1 - 5 files changed, 4 insertions(+), 8 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index f502345..a1eea85 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -2096,20 +2096,20 @@ static int vhost_user_postcopy_notifier(NotifierWit= hReturn *notifier, if (!virtio_has_feature(dev->protocol_features, VHOST_USER_PROTOCOL_F_PAGEFAULT)) { /* TODO: Get the device name into this error somehow */ - error_setg(pnd->errp, + error_setg(errp, "vhost-user backend not capable of postcopy"); return -ENOENT; } break; =20 case POSTCOPY_NOTIFY_INBOUND_ADVISE: - return vhost_user_postcopy_advise(dev, pnd->errp); + return vhost_user_postcopy_advise(dev, errp); =20 case POSTCOPY_NOTIFY_INBOUND_LISTEN: - return vhost_user_postcopy_listen(dev, pnd->errp); + return vhost_user_postcopy_listen(dev, errp); =20 case POSTCOPY_NOTIFY_INBOUND_END: - return vhost_user_postcopy_end(dev, pnd->errp); + return vhost_user_postcopy_end(dev, errp); =20 default: /* We ignore notifications we don't know */ diff --git a/include/migration/misc.h b/include/migration/misc.h index 1bc8902..5e65c18 100644 --- a/include/migration/misc.h +++ b/include/migration/misc.h @@ -31,7 +31,6 @@ typedef enum PrecopyNotifyReason { =20 typedef struct PrecopyNotifyData { enum PrecopyNotifyReason reason; - Error **errp; } PrecopyNotifyData; =20 void precopy_infrastructure_init(void); diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index 3ab2f6b..0273dc6 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -77,7 +77,6 @@ int postcopy_notify(enum PostcopyNotifyReason reason, Err= or **errp) { struct PostcopyNotifyData pnd; pnd.reason =3D reason; - pnd.errp =3D errp; =20 return notifier_with_return_list_notify(&postcopy_notifier_list, &pnd, errp); diff --git a/migration/postcopy-ram.h b/migration/postcopy-ram.h index 442ab89..ecae941 100644 --- a/migration/postcopy-ram.h +++ b/migration/postcopy-ram.h @@ -128,7 +128,6 @@ enum PostcopyNotifyReason { =20 struct PostcopyNotifyData { enum PostcopyNotifyReason reason; - Error **errp; }; =20 void postcopy_add_notifier(NotifierWithReturn *nn); diff --git a/migration/ram.c b/migration/ram.c index 5b6b09e..45a00b4 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -426,7 +426,6 @@ int precopy_notify(PrecopyNotifyReason reason, Error **= errp) { PrecopyNotifyData pnd; pnd.reason =3D reason; - pnd.errp =3D errp; =20 return notifier_with_return_list_notify(&precopy_notifier_list, &pnd, = errp); } --=20 1.8.3.1 From nobody Mon May 13 10:25:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1708622945; cv=none; d=zohomail.com; s=zohoarc; b=lVrBcLQLvEOC1MTjpHHz4lGKNaVtJn3vtHcosyZq4atIT69AU0OvmnTL/RQhXvu7acqz8vYHJQmdwr6iT8sV+nM9vRIqHy6IEFvaY2tNUonRyOoTMWd2aN+epaTlACh2PJ6KH2eiCAIKERWqODa6n4u7okZSEJ3LjqUinC+9/J0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708622945; h=Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=hkziptoNJoRVRAXP7AqFNK/vltVyfbPSHrKKbVtAiv0=; b=fq1VLk4AMKDb60ZPRSswMGJpCS9XkfVK0Cjl+Hdi3RS51GeNGdwCx5UDdDj2bIA8pgolNmqokKEu/UmJ/QQScuaBo54L+2C/jfl2pCCFZR9tgsz1r5dhde/KBvvn5syCoF09fgnjxU6Dbwr+mMu1etEf2iwsWX7J1TVsCMDqV4o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 170862294580759.557875324060205; Thu, 22 Feb 2024 09:29:05 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdCsS-0004hJ-04; Thu, 22 Feb 2024 12:28:56 -0500 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 1rdCsQ-0004b6-0T for qemu-devel@nongnu.org; Thu, 22 Feb 2024 12:28:54 -0500 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdCsN-0003Bq-OQ for qemu-devel@nongnu.org; Thu, 22 Feb 2024 12:28:53 -0500 Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41MH95SJ014861; Thu, 22 Feb 2024 17:28:50 GMT Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3wamdu58c8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 17:28:50 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41MG6w14024563; Thu, 22 Feb 2024 17:28:47 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3wak8ayrjq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 17:28:47 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 41MHSg9r032453; Thu, 22 Feb 2024 17:28:46 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3wak8ayre4-4; Thu, 22 Feb 2024 17:28:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2023-11-20; bh=hkziptoNJoRVRAXP7AqFNK/vltVyfbPSHrKKbVtAiv0=; b=B2u4wyV/zKGzYs6+MmgpAbE328qnCu/tteHKKDNEAmlpeUyiNTZG+lMwo76kGY8fCERK UVNbQeQNdlO+ZbmvTAM0gQjnUguQolijQFAmX9vpSUVYHOjPEQnHDeoAjDT7SqGNrOb4 RcFkzDOHq7OewICPs57rZLMR1v9SX1x7WFeScPzjG59oEnERMlzPCrn87R+u/3sbUkrG CNahNaCAz3KM0loWVUVvbGmvix9/R/O/5KCoLvSwr/opJ2zhk8SWG/dNFIqZtvAH/lvS YBTuQsRHzB7jpy5QTn3JubkfIa2lxXYmPnHGorV6/oMJ5UQNdtnUtAgHGTpA2tUwWg0s 0Q== From: Steve Sistare To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , "Michael S. Tsirkin" , Jason Wang , Alex Williamson , Cedric Le Goater , Gerd Hoffmann , Marc-Andre Lureau , David Hildenbrand , Steve Sistare Subject: [PATCH V4 03/14] migration: convert to NotifierWithReturn Date: Thu, 22 Feb 2024 09:28:29 -0800 Message-Id: <1708622920-68779-4-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1708622920-68779-1-git-send-email-steven.sistare@oracle.com> References: <1708622920-68779-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-22_13,2024-02-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 phishscore=0 suspectscore=0 mlxscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402220138 X-Proofpoint-GUID: pTnxuNWLSab6R6hxGL7kTjYYRKJ8D0r7 X-Proofpoint-ORIG-GUID: pTnxuNWLSab6R6hxGL7kTjYYRKJ8D0r7 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=205.220.177.32; envelope-from=steven.sistare@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1708622947606100003 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Change all migration notifiers to type NotifierWithReturn, so notifiers can return an error status in a future patch. For now, pass NULL for the notifier error parameter, and do not check the return value. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu Reviewed-by: David Hildenbrand --- hw/net/virtio-net.c | 4 +++- hw/vfio/migration.c | 4 +++- include/hw/vfio/vfio-common.h | 2 +- include/hw/virtio/virtio-net.h | 2 +- include/migration/misc.h | 6 +++--- include/qemu/notify.h | 1 + migration/migration.c | 16 ++++++++-------- net/vhost-vdpa.c | 6 ++++-- roms/seabios-hppa | 2 +- ui/spice-core.c | 8 +++++--- 10 files changed, 30 insertions(+), 21 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 5a79bc3..75f4e86 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -3534,11 +3534,13 @@ static void virtio_net_handle_migration_primary(Vir= tIONet *n, MigrationState *s) } } =20 -static void virtio_net_migration_state_notifier(Notifier *notifier, void *= data) +static int virtio_net_migration_state_notifier(NotifierWithReturn *notifie= r, + void *data, Error **errp) { MigrationState *s =3D data; VirtIONet *n =3D container_of(notifier, VirtIONet, migration_state); virtio_net_handle_migration_primary(n, s); + return 0; } =20 static bool failover_hide_primary_device(DeviceListener *listener, diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c index 70e6b1a..6b6acc4 100644 --- a/hw/vfio/migration.c +++ b/hw/vfio/migration.c @@ -754,7 +754,8 @@ static void vfio_vmstate_change(void *opaque, bool runn= ing, RunState state) mig_state_to_str(new_state)); } =20 -static void vfio_migration_state_notifier(Notifier *notifier, void *data) +static int vfio_migration_state_notifier(NotifierWithReturn *notifier, + void *data, Error **errp) { MigrationState *s =3D data; VFIOMigration *migration =3D container_of(notifier, VFIOMigration, @@ -770,6 +771,7 @@ static void vfio_migration_state_notifier(Notifier *not= ifier, void *data) case MIGRATION_STATUS_FAILED: vfio_migration_set_state_or_reset(vbasedev, VFIO_DEVICE_STATE_RUNN= ING); } + return 0; } =20 static void vfio_migration_free(VFIODevice *vbasedev) diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h index 9b7ef7d..4a6c262 100644 --- a/include/hw/vfio/vfio-common.h +++ b/include/hw/vfio/vfio-common.h @@ -62,7 +62,7 @@ typedef struct VFIORegion { typedef struct VFIOMigration { struct VFIODevice *vbasedev; VMChangeStateEntry *vm_state; - Notifier migration_state; + NotifierWithReturn migration_state; uint32_t device_state; int data_fd; void *data_buffer; diff --git a/include/hw/virtio/virtio-net.h b/include/hw/virtio/virtio-net.h index 55977f0..eaee8f4 100644 --- a/include/hw/virtio/virtio-net.h +++ b/include/hw/virtio/virtio-net.h @@ -221,7 +221,7 @@ struct VirtIONet { DeviceListener primary_listener; QDict *primary_opts; bool primary_opts_from_json; - Notifier migration_state; + NotifierWithReturn migration_state; VirtioNetRssData rss_data; struct NetRxPkt *rx_pkt; struct EBPFRSSContext ebpf_rss; diff --git a/include/migration/misc.h b/include/migration/misc.h index 5e65c18..b62e351 100644 --- a/include/migration/misc.h +++ b/include/migration/misc.h @@ -60,9 +60,9 @@ void migration_object_init(void); void migration_shutdown(void); bool migration_is_idle(void); bool migration_is_active(MigrationState *); -void migration_add_notifier(Notifier *notify, - void (*func)(Notifier *notifier, void *data)); -void migration_remove_notifier(Notifier *notify); +void migration_add_notifier(NotifierWithReturn *notify, + NotifierWithReturnFunc func); +void migration_remove_notifier(NotifierWithReturn *notify); void migration_call_notifiers(MigrationState *s); bool migration_in_setup(MigrationState *); bool migration_has_finished(MigrationState *); diff --git a/include/qemu/notify.h b/include/qemu/notify.h index 9a85631..abf18db 100644 --- a/include/qemu/notify.h +++ b/include/qemu/notify.h @@ -45,6 +45,7 @@ bool notifier_list_empty(NotifierList *list); /* Same as Notifier but allows .notify() to return errors */ typedef struct NotifierWithReturn NotifierWithReturn; =20 +/* Return int to allow for different failure modes and recovery actions */ typedef int (*NotifierWithReturnFunc)(NotifierWithReturn *notifier, void *= data, Error **errp); =20 diff --git a/migration/migration.c b/migration/migration.c index ab21de2..6d4072e 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -69,8 +69,8 @@ #include "qemu/sockets.h" #include "sysemu/kvm.h" =20 -static NotifierList migration_state_notifiers =3D - NOTIFIER_LIST_INITIALIZER(migration_state_notifiers); +static NotifierWithReturnList migration_state_notifiers =3D + NOTIFIER_WITH_RETURN_LIST_INITIALIZER(migration_state_notifiers); =20 /* Messages sent on the return path from destination to source */ enum mig_rp_message_type { @@ -1459,24 +1459,24 @@ static void migrate_fd_cancel(MigrationState *s) } } =20 -void migration_add_notifier(Notifier *notify, - void (*func)(Notifier *notifier, void *data)) +void migration_add_notifier(NotifierWithReturn *notify, + NotifierWithReturnFunc func) { notify->notify =3D func; - notifier_list_add(&migration_state_notifiers, notify); + notifier_with_return_list_add(&migration_state_notifiers, notify); } =20 -void migration_remove_notifier(Notifier *notify) +void migration_remove_notifier(NotifierWithReturn *notify) { if (notify->notify) { - notifier_remove(notify); + notifier_with_return_remove(notify); notify->notify =3D NULL; } } =20 void migration_call_notifiers(MigrationState *s) { - notifier_list_notify(&migration_state_notifiers, s); + notifier_with_return_list_notify(&migration_state_notifiers, s, 0); } =20 bool migration_in_setup(MigrationState *s) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 3726ee5..1c00519 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -34,7 +34,7 @@ typedef struct VhostVDPAState { NetClientState nc; struct vhost_vdpa vhost_vdpa; - Notifier migration_state; + NotifierWithReturn migration_state; VHostNetState *vhost_net; =20 /* Control commands shadow buffers */ @@ -322,7 +322,8 @@ static void vhost_vdpa_net_log_global_enable(VhostVDPAS= tate *s, bool enable) } } =20 -static void vdpa_net_migration_state_notifier(Notifier *notifier, void *da= ta) +static int vdpa_net_migration_state_notifier(NotifierWithReturn *notifier, + void *data, Error **errp) { MigrationState *migration =3D data; VhostVDPAState *s =3D container_of(notifier, VhostVDPAState, @@ -333,6 +334,7 @@ static void vdpa_net_migration_state_notifier(Notifier = *notifier, void *data) } else if (migration_has_failed(migration)) { vhost_vdpa_net_log_global_enable(s, false); } + return 0; } =20 static void vhost_vdpa_net_data_start_first(VhostVDPAState *s) diff --git a/roms/seabios-hppa b/roms/seabios-hppa index 03774ed..e4eac85 160000 --- a/roms/seabios-hppa +++ b/roms/seabios-hppa @@ -1 +1 @@ -Subproject commit 03774edaad3bfae090ac96ca5450353c641637d1 +Subproject commit e4eac85880e8677f96d8b9e94de9f2eec9c0751f diff --git a/ui/spice-core.c b/ui/spice-core.c index 37b277f..b3cd229 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c @@ -42,7 +42,7 @@ /* core bits */ =20 static SpiceServer *spice_server; -static Notifier migration_state; +static NotifierWithReturn migration_state; static const char *auth =3D "spice"; static char *auth_passwd; static time_t auth_expires =3D TIME_MAX; @@ -568,12 +568,13 @@ static SpiceInfo *qmp_query_spice_real(Error **errp) return info; } =20 -static void migration_state_notifier(Notifier *notifier, void *data) +static int migration_state_notifier(NotifierWithReturn *notifier, + void *data, Error **errp) { MigrationState *s =3D data; =20 if (!spice_have_target_host) { - return; + return 0; } =20 if (migration_in_setup(s)) { @@ -586,6 +587,7 @@ static void migration_state_notifier(Notifier *notifier= , void *data) spice_server_migrate_end(spice_server, false); spice_have_target_host =3D false; } + return 0; } =20 int qemu_spice_migrate_info(const char *hostname, int port, int tls_port, --=20 1.8.3.1 From nobody Mon May 13 10:25:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1708622953; cv=none; d=zohomail.com; s=zohoarc; b=Ung2EeKJ020svWjTXnRNMK0Zrlq5bbWG8CervqVseG88KZMtXY4cJIpOBsEyjjN3eKbXzoVsa/XoLhI4U7GEmZIP8TygILsCx/zYJhkIwvqu9iUa9ey57bj2VrLtus9+DN/ZuRfL39fD/9WO1aP1GeoIylVqfidd2vkvzfSLxUk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708622953; h=Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ms8b2iIxIVZ1xSpg7mOv/l2DMI10Vq8dLH/JDgdmBn0=; b=IneDGX8fLhXXE9L5zl1wTJ24ojguFOM+9KsPdoiA04snK98TJXbXPkSsWhSlcpiRl6Ocqa6iUHeMTVljUoXg3i5TmzFrcgbAPlSvmjQ09BafS44Uda4FpCKDuFn+ZcS1j70RhWy1PG2BeflptcvguBRBPY1oE8ufD5rixkkqBcM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708622953426386.41715167925713; Thu, 22 Feb 2024 09:29:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdCsT-0004jC-Lk; Thu, 22 Feb 2024 12:28:57 -0500 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 1rdCsS-0004hY-1m for qemu-devel@nongnu.org; Thu, 22 Feb 2024 12:28:56 -0500 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdCsN-0003Bo-SE for qemu-devel@nongnu.org; Thu, 22 Feb 2024 12:28:55 -0500 Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41MGtbZS005144; Thu, 22 Feb 2024 17:28:50 GMT Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3wd5fw52uf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 17:28:50 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41MG59NG024661; Thu, 22 Feb 2024 17:28:49 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3wak8ayrkx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 17:28:48 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 41MHSg9v032453; Thu, 22 Feb 2024 17:28:47 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3wak8ayre4-5; Thu, 22 Feb 2024 17:28:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2023-11-20; bh=ms8b2iIxIVZ1xSpg7mOv/l2DMI10Vq8dLH/JDgdmBn0=; b=HT9eOJRZRmavzNQH5qklwGWRrqpoISLnCCMSR4UKrr4ayvW7j2AWpBG29AqmqxOhxic5 XrPhubR1YCeTTongRvR8FsA0kEiljVezKlSpBd6WcVaxjTV+F0eTWlJha7I4Jnl2Wa8b YlG9ascCecmdWHHMC+SkFDvDUCDzxGmTcsabc2ocWytSM+lBEz1LcOsJrbdFTHqCnaMi tXrszlg5is7nYRmsa8N38aTI43d9AzABIe+YBwXZegTiUAkxLLUtVyBm0hJcTZAqJ1GM SnqY1IDLH7nGnQcm3Fn2Tiw9tgFuqz97MqRNoN+fPAkT/shIVotNN2dqgxistegiUGLA XQ== From: Steve Sistare To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , "Michael S. Tsirkin" , Jason Wang , Alex Williamson , Cedric Le Goater , Gerd Hoffmann , Marc-Andre Lureau , David Hildenbrand , Steve Sistare Subject: [PATCH V4 04/14] migration: MigrationEvent for notifiers Date: Thu, 22 Feb 2024 09:28:30 -0800 Message-Id: <1708622920-68779-5-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1708622920-68779-1-git-send-email-steven.sistare@oracle.com> References: <1708622920-68779-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-22_13,2024-02-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 phishscore=0 suspectscore=0 mlxscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402220138 X-Proofpoint-GUID: sVvmSZ8fxo5FfuHDvh-QLYlog6CPL90f X-Proofpoint-ORIG-GUID: sVvmSZ8fxo5FfuHDvh-QLYlog6CPL90f Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=205.220.165.32; envelope-from=steven.sistare@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1708622955676100003 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Passing MigrationState to notifiers is unsound because they could access unstable migration state internals or even modify the state. Instead, pass the minimal info needed in a new MigrationEvent struct, which could be extended in the future if needed. Suggested-by: Peter Xu Signed-off-by: Steve Sistare Reviewed-by: Peter Xu Reviewed-by: David Hildenbrand --- hw/net/virtio-net.c | 11 ++++++----- hw/vfio/migration.c | 10 +++------- hw/vfio/trace-events | 2 +- include/migration/misc.h | 23 ++++++++++++++++++++++- migration/migration.c | 17 ++++++++++++----- net/vhost-vdpa.c | 6 +++--- ui/spice-core.c | 9 ++++----- 7 files changed, 51 insertions(+), 27 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 75f4e86..e803f98 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -3504,7 +3504,7 @@ out: return !err; } =20 -static void virtio_net_handle_migration_primary(VirtIONet *n, MigrationSta= te *s) +static void virtio_net_handle_migration_primary(VirtIONet *n, MigrationEve= nt *e) { bool should_be_hidden; Error *err =3D NULL; @@ -3516,7 +3516,7 @@ static void virtio_net_handle_migration_primary(VirtI= ONet *n, MigrationState *s) =20 should_be_hidden =3D qatomic_read(&n->failover_primary_hidden); =20 - if (migration_in_setup(s) && !should_be_hidden) { + if (e->type =3D=3D MIG_EVENT_PRECOPY_SETUP && !should_be_hidden) { if (failover_unplug_primary(n, dev)) { vmstate_unregister(VMSTATE_IF(dev), qdev_get_vmsd(dev), dev); qapi_event_send_unplug_primary(dev->id); @@ -3524,7 +3524,7 @@ static void virtio_net_handle_migration_primary(VirtI= ONet *n, MigrationState *s) } else { warn_report("couldn't unplug primary device"); } - } else if (migration_has_failed(s)) { + } else if (e->type =3D=3D MIG_EVENT_PRECOPY_FAILED) { /* We already unplugged the device let's plug it back */ if (!failover_replug_primary(n, dev, &err)) { if (err) { @@ -3537,9 +3537,10 @@ static void virtio_net_handle_migration_primary(Virt= IONet *n, MigrationState *s) static int virtio_net_migration_state_notifier(NotifierWithReturn *notifie= r, void *data, Error **errp) { - MigrationState *s =3D data; + MigrationEvent *e =3D data; + VirtIONet *n =3D container_of(notifier, VirtIONet, migration_state); - virtio_net_handle_migration_primary(n, s); + virtio_net_handle_migration_primary(n, e); return 0; } =20 diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c index 6b6acc4..869d841 100644 --- a/hw/vfio/migration.c +++ b/hw/vfio/migration.c @@ -757,18 +757,14 @@ static void vfio_vmstate_change(void *opaque, bool ru= nning, RunState state) static int vfio_migration_state_notifier(NotifierWithReturn *notifier, void *data, Error **errp) { - MigrationState *s =3D data; + MigrationEvent *e =3D data; VFIOMigration *migration =3D container_of(notifier, VFIOMigration, migration_state); VFIODevice *vbasedev =3D migration->vbasedev; =20 - trace_vfio_migration_state_notifier(vbasedev->name, - MigrationStatus_str(s->state)); + trace_vfio_migration_state_notifier(vbasedev->name, e->type); =20 - switch (s->state) { - case MIGRATION_STATUS_CANCELLING: - case MIGRATION_STATUS_CANCELLED: - case MIGRATION_STATUS_FAILED: + if (e->type =3D=3D MIG_EVENT_PRECOPY_FAILED) { vfio_migration_set_state_or_reset(vbasedev, VFIO_DEVICE_STATE_RUNN= ING); } return 0; diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events index 8fdde54..f0474b2 100644 --- a/hw/vfio/trace-events +++ b/hw/vfio/trace-events @@ -153,7 +153,7 @@ vfio_load_state(const char *name, uint64_t data) " (%s)= data 0x%"PRIx64 vfio_load_state_device_data(const char *name, uint64_t data_size, int ret)= " (%s) size 0x%"PRIx64" ret %d" vfio_migration_realize(const char *name) " (%s)" vfio_migration_set_state(const char *name, const char *state) " (%s) state= %s" -vfio_migration_state_notifier(const char *name, const char *state) " (%s) = state %s" +vfio_migration_state_notifier(const char *name, int state) " (%s) state %d" vfio_save_block(const char *name, int data_size) " (%s) data_size %d" vfio_save_cleanup(const char *name) " (%s)" vfio_save_complete_precopy(const char *name, int ret) " (%s) ret %d" diff --git a/include/migration/misc.h b/include/migration/misc.h index b62e351..9e4abae 100644 --- a/include/migration/misc.h +++ b/include/migration/misc.h @@ -60,10 +60,31 @@ void migration_object_init(void); void migration_shutdown(void); bool migration_is_idle(void); bool migration_is_active(MigrationState *); + +typedef enum MigrationEventType { + MIG_EVENT_PRECOPY_SETUP, + MIG_EVENT_PRECOPY_DONE, + MIG_EVENT_PRECOPY_FAILED, + MIG_EVENT_MAX +} MigrationEventType; + +typedef struct MigrationEvent { + MigrationEventType type; +} MigrationEvent; + +/* + * Register the notifier @notify to be called when a migration event occurs + * for MIG_MODE_NORMAL, as specified by the MigrationEvent passed to @func. + * Notifiers may receive events in any of the following orders: + * - MIG_EVENT_PRECOPY_SETUP -> MIG_EVENT_PRECOPY_DONE + * - MIG_EVENT_PRECOPY_SETUP -> MIG_EVENT_PRECOPY_FAILED + * - MIG_EVENT_PRECOPY_FAILED + */ void migration_add_notifier(NotifierWithReturn *notify, NotifierWithReturnFunc func); + void migration_remove_notifier(NotifierWithReturn *notify); -void migration_call_notifiers(MigrationState *s); +void migration_call_notifiers(MigrationState *s, MigrationEventType type); bool migration_in_setup(MigrationState *); bool migration_has_finished(MigrationState *); bool migration_has_failed(MigrationState *); diff --git a/migration/migration.c b/migration/migration.c index 6d4072e..4650c21 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1319,6 +1319,8 @@ void migrate_set_state(int *state, int old_state, int= new_state) =20 static void migrate_fd_cleanup(MigrationState *s) { + MigrationEventType type; + g_free(s->hostname); s->hostname =3D NULL; json_writer_free(s->vmdesc); @@ -1367,7 +1369,9 @@ static void migrate_fd_cleanup(MigrationState *s) /* It is used on info migrate. We can't free it */ error_report_err(error_copy(s->error)); } - migration_call_notifiers(s); + type =3D migration_has_failed(s) ? MIG_EVENT_PRECOPY_FAILED : + MIG_EVENT_PRECOPY_DONE; + migration_call_notifiers(s, type); block_cleanup_parameters(); yank_unregister_instance(MIGRATION_YANK_INSTANCE); } @@ -1474,9 +1478,12 @@ void migration_remove_notifier(NotifierWithReturn *n= otify) } } =20 -void migration_call_notifiers(MigrationState *s) +void migration_call_notifiers(MigrationState *s, MigrationEventType type) { - notifier_with_return_list_notify(&migration_state_notifiers, s, 0); + MigrationEvent e; + + e.type =3D type; + notifier_with_return_list_notify(&migration_state_notifiers, &e, 0); } =20 bool migration_in_setup(MigrationState *s) @@ -2537,7 +2544,7 @@ static int postcopy_start(MigrationState *ms, Error *= *errp) * spice needs to trigger a transition now */ ms->postcopy_after_devices =3D true; - migration_call_notifiers(ms); + migration_call_notifiers(ms, MIG_EVENT_PRECOPY_DONE); =20 migration_downtime_end(ms); =20 @@ -3601,7 +3608,7 @@ void migrate_fd_connect(MigrationState *s, Error *err= or_in) rate_limit =3D migrate_max_bandwidth(); =20 /* Notify before starting migration thread */ - migration_call_notifiers(s); + migration_call_notifiers(s, MIG_EVENT_PRECOPY_SETUP); } =20 migration_rate_set(rate_limit); diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 1c00519..a29d18a 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -325,13 +325,13 @@ static void vhost_vdpa_net_log_global_enable(VhostVDP= AState *s, bool enable) static int vdpa_net_migration_state_notifier(NotifierWithReturn *notifier, void *data, Error **errp) { - MigrationState *migration =3D data; + MigrationEvent *e =3D data; VhostVDPAState *s =3D container_of(notifier, VhostVDPAState, migration_state); =20 - if (migration_in_setup(migration)) { + if (e->type =3D=3D MIG_EVENT_PRECOPY_SETUP) { vhost_vdpa_net_log_global_enable(s, true); - } else if (migration_has_failed(migration)) { + } else if (e->type =3D=3D MIG_EVENT_PRECOPY_FAILED) { vhost_vdpa_net_log_global_enable(s, false); } return 0; diff --git a/ui/spice-core.c b/ui/spice-core.c index b3cd229..0a59876 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c @@ -571,19 +571,18 @@ static SpiceInfo *qmp_query_spice_real(Error **errp) static int migration_state_notifier(NotifierWithReturn *notifier, void *data, Error **errp) { - MigrationState *s =3D data; + MigrationEvent *e =3D data; =20 if (!spice_have_target_host) { return 0; } =20 - if (migration_in_setup(s)) { + if (e->type =3D=3D MIG_EVENT_PRECOPY_SETUP) { spice_server_migrate_start(spice_server); - } else if (migration_has_finished(s) || - migration_in_postcopy_after_devices(s)) { + } else if (e->type =3D=3D MIG_EVENT_PRECOPY_DONE) { spice_server_migrate_end(spice_server, true); spice_have_target_host =3D false; - } else if (migration_has_failed(s)) { + } else if (e->type =3D=3D MIG_EVENT_PRECOPY_FAILED) { spice_server_migrate_end(spice_server, false); spice_have_target_host =3D false; } --=20 1.8.3.1 From nobody Mon May 13 10:25:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1708622979; cv=none; d=zohomail.com; s=zohoarc; b=SCdV824+6e/sPsMXER2vLjL5L5WKEC3l/JFmZ17F0wJMrF6V3jeR4G/aKi8o/sQS6jv3lTmHA2w81t6Wv4+QntPv9V5qCaVqfdKAc/rwELq7nyWpp3fAvvyyuomR1uXVq6YkZqrPYIo7EFuVt/3V8fV729zS9s/lbOFD11/BU6A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708622979; h=Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=KlJLh/6RU9GLdY8NyeX3J6nBDN5nwI4L14aZ20jhEbc=; b=HaI7wJNAEaOnJllT3nokhAewmZk9JzYY/LuMDRmI4L5Gzd7/5X9aGdlOl+NOmCp9bCrZICdkolcZGg1/IRewJhtQDCnZahKBN856j2F7p1aamh2hu/tY6X3b7yMFLiI7DmVID3sBT0e7qG7XBSPwX6/OkcrnxNFLyrPq0fIGRRg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708622979095859.1242381219918; Thu, 22 Feb 2024 09:29:39 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdCsW-0004k1-4I; Thu, 22 Feb 2024 12:29:00 -0500 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 1rdCsS-0004im-G6 for qemu-devel@nongnu.org; Thu, 22 Feb 2024 12:28:56 -0500 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdCsQ-0003Cz-Rc for qemu-devel@nongnu.org; Thu, 22 Feb 2024 12:28:56 -0500 Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41MH93lc014694; Thu, 22 Feb 2024 17:28:53 GMT Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3wamdu58ct-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 17:28:53 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41MG9MZh024755; Thu, 22 Feb 2024 17:28:49 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3wak8ayrn0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 17:28:49 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 41MHSg9x032453; Thu, 22 Feb 2024 17:28:49 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3wak8ayre4-6; Thu, 22 Feb 2024 17:28:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2023-11-20; bh=KlJLh/6RU9GLdY8NyeX3J6nBDN5nwI4L14aZ20jhEbc=; b=Ti62egYAtZB8gEtBIkRZ+MKAerwK5f8rfnOmXFg8gnH6N3jaSK0PHj/X5iHd/kO84bRa B2RSMatTS2sBcxmtKHW/EfwcWgbgOJyUYD/a14zKp4locxaRYEl1QGXv4H1PrmB9h0v9 2IAqRezxRCY+rEsY+4aWkua36XCnPoFeULXmd7RZndHMVITS/GFpEsviGXvhK6U+OWMO 0OtdyzWpLRCBGvqSH/dLtTfuhrxpuNS69BxjQm848XoT7Ku5PP44pNctKO3GXFINFpK6 paC94ash0IVe09NV0Q+yrCHGJfGhWaA/6lxkgGENUkhQ3thFlbQ8BzL+B1oqA7fSAv7G 2A== From: Steve Sistare To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , "Michael S. Tsirkin" , Jason Wang , Alex Williamson , Cedric Le Goater , Gerd Hoffmann , Marc-Andre Lureau , David Hildenbrand , Steve Sistare Subject: [PATCH V4 05/14] migration: remove postcopy_after_devices Date: Thu, 22 Feb 2024 09:28:31 -0800 Message-Id: <1708622920-68779-6-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1708622920-68779-1-git-send-email-steven.sistare@oracle.com> References: <1708622920-68779-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-22_13,2024-02-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 phishscore=0 suspectscore=0 mlxscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402220138 X-Proofpoint-GUID: rSiiiyi-nNn1Y4_VZDHmHx6moZj8XFEo X-Proofpoint-ORIG-GUID: rSiiiyi-nNn1Y4_VZDHmHx6moZj8XFEo Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=205.220.177.32; envelope-from=steven.sistare@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1708622979738100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" postcopy_after_devices and migration_in_postcopy_after_devices are no longer used, so delete them. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- include/migration/misc.h | 1 - migration/migration.c | 7 ------- migration/migration.h | 2 -- 3 files changed, 10 deletions(-) diff --git a/include/migration/misc.h b/include/migration/misc.h index 9e4abae..e615000 100644 --- a/include/migration/misc.h +++ b/include/migration/misc.h @@ -89,7 +89,6 @@ bool migration_in_setup(MigrationState *); bool migration_has_finished(MigrationState *); bool migration_has_failed(MigrationState *); /* ...and after the device transmission */ -bool migration_in_postcopy_after_devices(MigrationState *); /* True if incoming migration entered POSTCOPY_INCOMING_DISCARD */ bool migration_in_incoming_postcopy(void); /* True if incoming migration entered POSTCOPY_INCOMING_ADVISE */ diff --git a/migration/migration.c b/migration/migration.c index 4650c21..8f7f2d9 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1527,11 +1527,6 @@ bool migration_postcopy_is_alive(int state) } } =20 -bool migration_in_postcopy_after_devices(MigrationState *s) -{ - return migration_in_postcopy() && s->postcopy_after_devices; -} - bool migration_in_incoming_postcopy(void) { PostcopyState ps =3D postcopy_state_get(); @@ -1613,7 +1608,6 @@ int migrate_init(MigrationState *s, Error **errp) s->expected_downtime =3D 0; s->setup_time =3D 0; s->start_postcopy =3D false; - s->postcopy_after_devices =3D false; s->migration_thread_running =3D false; error_free(s->error); s->error =3D NULL; @@ -2543,7 +2537,6 @@ static int postcopy_start(MigrationState *ms, Error *= *errp) * at the transition to postcopy and after the device state; in partic= ular * spice needs to trigger a transition now */ - ms->postcopy_after_devices =3D true; migration_call_notifiers(ms, MIG_EVENT_PRECOPY_DONE); =20 migration_downtime_end(ms); diff --git a/migration/migration.h b/migration/migration.h index f2c8b8f..aef8afb 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -348,8 +348,6 @@ struct MigrationState { =20 /* Flag set once the migration has been asked to enter postcopy */ bool start_postcopy; - /* Flag set after postcopy has sent the device state */ - bool postcopy_after_devices; =20 /* Flag set once the migration thread is running (and needs joining) */ bool migration_thread_running; --=20 1.8.3.1 From nobody Mon May 13 10:25:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1708623071; cv=none; d=zohomail.com; s=zohoarc; b=ExVaxgmP9gAC3jSpmKpYXg1SLKSltIIJYCLZ82QNt16yjLAfroNDTdXDH7LqeW4LpKhFHcMkDARFnM5kx2yKvf/ViFj17DLXpHDkSJuPQQBmYhNUvQwYGhLFOUB1/Ydn6UAhftvolt2mgSHcx1rLDBS0bOmpa7S6Weau89SUT4g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708623071; h=Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=WXOj8Hs3aVF9OD0ufbP6GM+yImju3a8Lnlz3aHOX2EE=; b=FJYuhcBYx7WvrkywyWkVGA6GNpKIQVQg78JzNCOlzfbHJJPXu4ixzkpbcpHx4wvp+yZFpIOAUlgUHJgW0k1mWdSPoh84tsAS0eZaKNMlQWUh1ni9OHbegWPPsOnREdTx4bH8PBaYC+hORcoexJHeRz7pEf9uwJ8cwwHabXNdos0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708623071091726.6959326849957; Thu, 22 Feb 2024 09:31:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdCsy-0005jR-Mz; Thu, 22 Feb 2024 12:29:28 -0500 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 1rdCsw-0005fm-WF for qemu-devel@nongnu.org; Thu, 22 Feb 2024 12:29:27 -0500 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdCsh-0003HX-Vp for qemu-devel@nongnu.org; Thu, 22 Feb 2024 12:29:26 -0500 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41MH91q4026007; Thu, 22 Feb 2024 17:29:10 GMT Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3wakk45cxr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 17:29:03 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41MHSVQl024791; Thu, 22 Feb 2024 17:28:51 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3wak8ayrp1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 17:28:51 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 41MHSgA1032453; Thu, 22 Feb 2024 17:28:50 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3wak8ayre4-7; Thu, 22 Feb 2024 17:28:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2023-11-20; bh=WXOj8Hs3aVF9OD0ufbP6GM+yImju3a8Lnlz3aHOX2EE=; b=HgfO5L4sFrrimAc+gYIGiBH/AYstVnClKHDbJfobn8i2s57byR++5wulqhtKtJ9FlHIO /tS+Z6cc7j7nkZtMOLVNRG2gpE5NDitgTsGjnblmIM4Z+nBeSUr5I4Hxi4MNNoPLwLEL JqZyFW+rKGoIV7SWx+yuq5BnKL//+z1DNWUlXDJRNoQK51tW/1jMs+SEp64xffdci0T/ uymgNV6x8H8vkU0RJcqGGhHKpQu7KupO36nNSoLXEAFEj8NsTmSdOqHEf6pdnj3IAefu L0rPfcLHOjRqYAPpa313GoKR0ehN2iQtkH7AZYIOKOfmRZDQ3awCeGln8go/LsApAemm kg== From: Steve Sistare To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , "Michael S. Tsirkin" , Jason Wang , Alex Williamson , Cedric Le Goater , Gerd Hoffmann , Marc-Andre Lureau , David Hildenbrand , Steve Sistare Subject: [PATCH V4 06/14] migration: MigrationNotifyFunc Date: Thu, 22 Feb 2024 09:28:32 -0800 Message-Id: <1708622920-68779-7-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1708622920-68779-1-git-send-email-steven.sistare@oracle.com> References: <1708622920-68779-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-22_13,2024-02-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 phishscore=0 suspectscore=0 mlxscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402220138 X-Proofpoint-ORIG-GUID: rfk0UvxOKih5dJPhM3PNV8eIT7LA2kpL X-Proofpoint-GUID: rfk0UvxOKih5dJPhM3PNV8eIT7LA2kpL Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=205.220.177.32; envelope-from=steven.sistare@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1708623072187100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Define MigrationNotifyFunc to improve type safety and simplify migration notifiers. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu Reviewed-by: David Hildenbrand --- hw/net/virtio-net.c | 4 +--- hw/vfio/migration.c | 3 +-- include/migration/misc.h | 5 ++++- migration/migration.c | 4 ++-- net/vhost-vdpa.c | 6 ++---- ui/spice-core.c | 4 +--- 6 files changed, 11 insertions(+), 15 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index e803f98..a3c711b 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -3535,10 +3535,8 @@ static void virtio_net_handle_migration_primary(Virt= IONet *n, MigrationEvent *e) } =20 static int virtio_net_migration_state_notifier(NotifierWithReturn *notifie= r, - void *data, Error **errp) + MigrationEvent *e, Error **= errp) { - MigrationEvent *e =3D data; - VirtIONet *n =3D container_of(notifier, VirtIONet, migration_state); virtio_net_handle_migration_primary(n, e); return 0; diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c index 869d841..50140ed 100644 --- a/hw/vfio/migration.c +++ b/hw/vfio/migration.c @@ -755,9 +755,8 @@ static void vfio_vmstate_change(void *opaque, bool runn= ing, RunState state) } =20 static int vfio_migration_state_notifier(NotifierWithReturn *notifier, - void *data, Error **errp) + MigrationEvent *e, Error **errp) { - MigrationEvent *e =3D data; VFIOMigration *migration =3D container_of(notifier, VFIOMigration, migration_state); VFIODevice *vbasedev =3D migration->vbasedev; diff --git a/include/migration/misc.h b/include/migration/misc.h index e615000..e36a1f3 100644 --- a/include/migration/misc.h +++ b/include/migration/misc.h @@ -72,6 +72,9 @@ typedef struct MigrationEvent { MigrationEventType type; } MigrationEvent; =20 +typedef int (*MigrationNotifyFunc)(NotifierWithReturn *notify, + MigrationEvent *e, Error **errp); + /* * Register the notifier @notify to be called when a migration event occurs * for MIG_MODE_NORMAL, as specified by the MigrationEvent passed to @func. @@ -81,7 +84,7 @@ typedef struct MigrationEvent { * - MIG_EVENT_PRECOPY_FAILED */ void migration_add_notifier(NotifierWithReturn *notify, - NotifierWithReturnFunc func); + MigrationNotifyFunc func); =20 void migration_remove_notifier(NotifierWithReturn *notify); void migration_call_notifiers(MigrationState *s, MigrationEventType type); diff --git a/migration/migration.c b/migration/migration.c index 8f7f2d9..33149c4 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1464,9 +1464,9 @@ static void migrate_fd_cancel(MigrationState *s) } =20 void migration_add_notifier(NotifierWithReturn *notify, - NotifierWithReturnFunc func) + MigrationNotifyFunc func) { - notify->notify =3D func; + notify->notify =3D (NotifierWithReturnFunc)func; notifier_with_return_list_add(&migration_state_notifiers, notify); } =20 diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index a29d18a..e6bdb45 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -323,11 +323,9 @@ static void vhost_vdpa_net_log_global_enable(VhostVDPA= State *s, bool enable) } =20 static int vdpa_net_migration_state_notifier(NotifierWithReturn *notifier, - void *data, Error **errp) + MigrationEvent *e, Error **er= rp) { - MigrationEvent *e =3D data; - VhostVDPAState *s =3D container_of(notifier, VhostVDPAState, - migration_state); + VhostVDPAState *s =3D container_of(notifier, VhostVDPAState, migration= _state); =20 if (e->type =3D=3D MIG_EVENT_PRECOPY_SETUP) { vhost_vdpa_net_log_global_enable(s, true); diff --git a/ui/spice-core.c b/ui/spice-core.c index 0a59876..15be640 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c @@ -569,10 +569,8 @@ static SpiceInfo *qmp_query_spice_real(Error **errp) } =20 static int migration_state_notifier(NotifierWithReturn *notifier, - void *data, Error **errp) + MigrationEvent *e, Error **errp) { - MigrationEvent *e =3D data; - if (!spice_have_target_host) { return 0; } --=20 1.8.3.1 From nobody Mon May 13 10:25:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1708622990; cv=none; d=zohomail.com; s=zohoarc; b=bvmAH+AUZ6Dz+PQ1zPycFPFYQKI2w2iViUyZmCcs8Tyx7vq0Bimsa54Ox2ENkXuuy+q8gWccOrQOsL+5CXg3ZoUpQPIex8kr4KViscZRGC+FImsSSongzmKXSaD43HhQwsmo77jFKxpCOlUktGnD4w/kw330BnV4/THzAFzI/o4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708622990; h=Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=hFgl8tvTrOvJ0dXJAR8o7o4bvOTku39BFJ3n9ZyNU1Y=; b=AO2rBZryOvOyE//BEefrDMI32812MepR+Q1c4llgbzklLhfMeoJ8eXIYIFwnFz3UPeVySBBwz+leKZrrkdj1zxWOitQ6av33OYlW8EVdRB/aDR7pJPBkm+vBBx7HIqncO8GkBhaHKwkxPsKIHp9foM7u4IBcLP73XCyVp4WLNoQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708622990508502.6140399221912; Thu, 22 Feb 2024 09:29:50 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdCsY-0004ko-ES; Thu, 22 Feb 2024 12:29:02 -0500 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 1rdCsT-0004j3-EU for qemu-devel@nongnu.org; Thu, 22 Feb 2024 12:28:57 -0500 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdCsR-0003D9-QF for qemu-devel@nongnu.org; Thu, 22 Feb 2024 12:28:57 -0500 Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41MGtc6q005183; Thu, 22 Feb 2024 17:28:54 GMT Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3wd5fw52v1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 17:28:54 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41MG9UJn024561; Thu, 22 Feb 2024 17:28:52 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3wak8ayrq8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 17:28:52 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 41MHSgA3032453; Thu, 22 Feb 2024 17:28:52 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3wak8ayre4-8; Thu, 22 Feb 2024 17:28:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2023-11-20; bh=hFgl8tvTrOvJ0dXJAR8o7o4bvOTku39BFJ3n9ZyNU1Y=; b=bo/u/J81vGErnfvhPnPEWrQ+0GgYocoX+d2VwLKdwx6u8+N6ipr/SIohPiNNylD46UOB oAGPPbiVPyxUklMUtJTQ1o5YoZNyibvqsk/IJ2/IpKdjhUvflBd5BZd9F5AV+5JGv4fG uX9GK67H3bDuJNcnlHFmGfS2NKZRCaaFRrVU0PUyS67uNK/2FSFiYgl5XTiAfNekFnV/ eGXsjCGvhTW/VPneesv9a7GXTFdjouY1VTSzKVAcWN91ouSBBjR11vec/h9E5l+OwB0z UfJLE8o8iJYcy8BhL6V8iSaXh7gOkR5x/rs7Vt49Gam2bESzN9RN85AamJqg6xTZH+7J QQ== From: Steve Sistare To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , "Michael S. Tsirkin" , Jason Wang , Alex Williamson , Cedric Le Goater , Gerd Hoffmann , Marc-Andre Lureau , David Hildenbrand , Steve Sistare Subject: [PATCH V4 07/14] migration: per-mode notifiers Date: Thu, 22 Feb 2024 09:28:33 -0800 Message-Id: <1708622920-68779-8-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1708622920-68779-1-git-send-email-steven.sistare@oracle.com> References: <1708622920-68779-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-22_13,2024-02-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 phishscore=0 suspectscore=0 mlxscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402220138 X-Proofpoint-GUID: Gsmrrpfx117hphCD1zdhg_TqezvPCIVI X-Proofpoint-ORIG-GUID: Gsmrrpfx117hphCD1zdhg_TqezvPCIVI Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=205.220.165.32; envelope-from=steven.sistare@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1708622991750100005 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Keep a separate list of migration notifiers for each migration mode. Suggested-by: Peter Xu Signed-off-by: Steve Sistare Reviewed-by: Peter Xu Reviewed-by: David Hildenbrand --- include/migration/misc.h | 6 ++++++ migration/migration.c | 22 +++++++++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/include/migration/misc.h b/include/migration/misc.h index e36a1f3..4dc06a9 100644 --- a/include/migration/misc.h +++ b/include/migration/misc.h @@ -86,6 +86,12 @@ typedef int (*MigrationNotifyFunc)(NotifierWithReturn *n= otify, void migration_add_notifier(NotifierWithReturn *notify, MigrationNotifyFunc func); =20 +/* + * Same as migration_add_notifier, but applies to be specified @mode. + */ +void migration_add_notifier_mode(NotifierWithReturn *notify, + MigrationNotifyFunc func, MigMode mode); + void migration_remove_notifier(NotifierWithReturn *notify); void migration_call_notifiers(MigrationState *s, MigrationEventType type); bool migration_in_setup(MigrationState *); diff --git a/migration/migration.c b/migration/migration.c index 33149c4..925103b 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -69,8 +69,13 @@ #include "qemu/sockets.h" #include "sysemu/kvm.h" =20 -static NotifierWithReturnList migration_state_notifiers =3D - NOTIFIER_WITH_RETURN_LIST_INITIALIZER(migration_state_notifiers); +#define NOTIFIER_ELEM_INIT(array, elem) \ + [elem] =3D NOTIFIER_WITH_RETURN_LIST_INITIALIZER((array)[elem]) + +static NotifierWithReturnList migration_state_notifiers[] =3D { + NOTIFIER_ELEM_INIT(migration_state_notifiers, MIG_MODE_NORMAL), + NOTIFIER_ELEM_INIT(migration_state_notifiers, MIG_MODE_CPR_REBOOT), +}; =20 /* Messages sent on the return path from destination to source */ enum mig_rp_message_type { @@ -1463,11 +1468,17 @@ static void migrate_fd_cancel(MigrationState *s) } } =20 +void migration_add_notifier_mode(NotifierWithReturn *notify, + MigrationNotifyFunc func, MigMode mode) +{ + notify->notify =3D (NotifierWithReturnFunc)func; + notifier_with_return_list_add(&migration_state_notifiers[mode], notify= ); +} + void migration_add_notifier(NotifierWithReturn *notify, MigrationNotifyFunc func) { - notify->notify =3D (NotifierWithReturnFunc)func; - notifier_with_return_list_add(&migration_state_notifiers, notify); + migration_add_notifier_mode(notify, func, MIG_MODE_NORMAL); } =20 void migration_remove_notifier(NotifierWithReturn *notify) @@ -1480,10 +1491,11 @@ void migration_remove_notifier(NotifierWithReturn *= notify) =20 void migration_call_notifiers(MigrationState *s, MigrationEventType type) { + MigMode mode =3D s->parameters.mode; MigrationEvent e; =20 e.type =3D type; - notifier_with_return_list_notify(&migration_state_notifiers, &e, 0); + notifier_with_return_list_notify(&migration_state_notifiers[mode], &e,= 0); } =20 bool migration_in_setup(MigrationState *s) --=20 1.8.3.1 From nobody Mon May 13 10:25:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1708623032; cv=none; d=zohomail.com; s=zohoarc; b=TWvspuBG+y+nAyq2yoGBtNAX/czOCoq2bFYABz0bWQrsAuFfPvyUgUXoX+9h8Ww3zrroDxXNPllGvaoapHICbIBbYHzJIU4MrJj3rWCcO1K2IlFUystSOYippTViNUoovUi9gvZ6twr7HxRfNUNvABueuzpffejAp46YBpmc5Y0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708623032; h=Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=OISgfmaC8XJcvMA2hWN919WhOcj2Y49PcJ1f27Elswc=; b=LRgtc6n9osWl9d/WJSmVxgA5IF5oDe7yHNLtys2+Z640vvX5Fq9WUXw3KHcZVjColICgaliCaEqL5r8pgnYy5Jzke9QX9oakD2iVtRAUrTNTjud+ZSBH1ePMgHKa9e4CDRuzz/SJuOQFMr9XtuKs0b0X/SXc1Obz6T4Eko26yA8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708623032855129.07830531841648; Thu, 22 Feb 2024 09:30:32 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdCsZ-0004lh-Te; Thu, 22 Feb 2024 12:29:03 -0500 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 1rdCsT-0004jD-O5 for qemu-devel@nongnu.org; Thu, 22 Feb 2024 12:28:57 -0500 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdCsS-0003DI-BG for qemu-devel@nongnu.org; Thu, 22 Feb 2024 12:28:57 -0500 Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41MH95SR014861; Thu, 22 Feb 2024 17:28:55 GMT Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3wamdu58e3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 17:28:55 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41MGE5cn024480; Thu, 22 Feb 2024 17:28:54 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3wak8ayrs3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 17:28:54 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 41MHSgA5032453; Thu, 22 Feb 2024 17:28:53 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3wak8ayre4-9; Thu, 22 Feb 2024 17:28:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2023-11-20; bh=OISgfmaC8XJcvMA2hWN919WhOcj2Y49PcJ1f27Elswc=; b=DKfoEiC/20fnO89Wq26Sl52MuJ+jEQRaSRIJqok3PAZ8aNpEAiFiGiU5KRkf1KgHcYs6 6VwDT8U53TVsZyrzQH+GgfNsP+aJ+nU5vQeRVpw8Nfdlldbl8cCp76txbygXx0heBqdD 7TxoerOq6sFHJ65yRBqE8zzVHNoUqNArh/9Q7FTNjobLtGYyAMqXzdR1NoJKYexjN9iZ lDKOFW4BznBoRI3u7Q2mMW4IkzAXXeMdAuJvCDpb6el5GKBC1tT/B6SdnNfU+ixmizFA I5an1ilXoNWmDPzipzmx6NPyaehJBpbGLaeQFqSDiC9jj4yFAZw5tSK0fLSscM/Tawwi Gw== From: Steve Sistare To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , "Michael S. Tsirkin" , Jason Wang , Alex Williamson , Cedric Le Goater , Gerd Hoffmann , Marc-Andre Lureau , David Hildenbrand , Steve Sistare Subject: [PATCH V4 08/14] migration: refactor migrate_fd_connect failures Date: Thu, 22 Feb 2024 09:28:34 -0800 Message-Id: <1708622920-68779-9-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1708622920-68779-1-git-send-email-steven.sistare@oracle.com> References: <1708622920-68779-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-22_13,2024-02-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 phishscore=0 suspectscore=0 mlxscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402220138 X-Proofpoint-GUID: J49Lw5vCIUV0Btx8HMVxy92ScYL1GuEM X-Proofpoint-ORIG-GUID: J49Lw5vCIUV0Btx8HMVxy92ScYL1GuEM Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=205.220.177.32; envelope-from=steven.sistare@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1708623034028100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Move common code for the error path in migrate_fd_connect to a shared fail label. No functional change. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu Reviewed-by: David Hildenbrand --- migration/migration.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 925103b..6a115d2 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3627,11 +3627,7 @@ void migrate_fd_connect(MigrationState *s, Error *er= ror_in) if (migrate_postcopy_ram() || migrate_return_path()) { if (open_return_path_on_source(s)) { error_setg(&local_err, "Unable to open return-path for postcop= y"); - migrate_set_state(&s->state, s->state, MIGRATION_STATUS_FAILED= ); - migrate_set_error(s, local_err); - error_report_err(local_err); - migrate_fd_cleanup(s); - return; + goto fail; } } =20 @@ -3660,6 +3656,13 @@ void migrate_fd_connect(MigrationState *s, Error *er= ror_in) migration_thread, s, QEMU_THREAD_JOINABLE); } s->migration_thread_running =3D true; + return; + +fail: + migrate_set_error(s, local_err); + migrate_set_state(&s->state, s->state, MIGRATION_STATUS_FAILED); + error_report_err(local_err); + migrate_fd_cleanup(s); } =20 static void migration_class_init(ObjectClass *klass, void *data) --=20 1.8.3.1 From nobody Mon May 13 10:25:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1708623019; cv=none; d=zohomail.com; s=zohoarc; b=Ns5k49GxhL+9iUZukwQde0QQgxH6RUEFNeefOEX8LMHEKKgdXbxQKI/5Y5PoBolwP9A0tEOu8s3Bq5N88Mil1lj4S/KQ47J06I4/5X3rfsUbxSjOeGpHCQ6DnSADsxamkQe8X6BRCy1b+dZ68RPbc6ADog8AJipdPHewbgzYgOI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708623019; h=Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Tblg+6OG6Lt4MehE1ykRrcRbYGVc+HXXJGb9aqjcWwo=; b=LvG8iplOValKYBN8HL26J3PPcC+IezcyWvaXIly/Q0FDILrj9nN1RF9F1//DVR38emM2iJhYvnJjcHcS9lcTZdnOHQU8TtHRYROMTCXaOECRDf1EGs1RMeApxHSZIDAMuwruDkz8KITA4cNdQChZQMvIr7cr1jcxZEUsPo+bLAo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708623019802832.5584392167281; Thu, 22 Feb 2024 09:30:19 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdCsX-0004kf-WF; Thu, 22 Feb 2024 12:29:02 -0500 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 1rdCsW-0004kI-Kk for qemu-devel@nongnu.org; Thu, 22 Feb 2024 12:29:00 -0500 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdCsU-0003ER-Tl for qemu-devel@nongnu.org; Thu, 22 Feb 2024 12:29:00 -0500 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41MH93vN003389; Thu, 22 Feb 2024 17:28:58 GMT Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3wd4knw1cr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 17:28:57 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41MG4lZx024355; Thu, 22 Feb 2024 17:28:55 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3wak8ayrtb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 17:28:55 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 41MHSgA7032453; Thu, 22 Feb 2024 17:28:55 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3wak8ayre4-10; Thu, 22 Feb 2024 17:28:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2023-11-20; bh=Tblg+6OG6Lt4MehE1ykRrcRbYGVc+HXXJGb9aqjcWwo=; b=ImhQSAntfymYxztspEX3IPpMmei5TFLyky/RIxBK1h5E9gaEaKeXxE+Xb0uM5g90EpF5 iRCMxpYoTwJ2kSbrsMGBboOJX9eMY3/T3OcZU8R+7dmnBukNqAWME/tKDTzqKTxcAsqs axkOAMzGHATQCKNwMFK6QcF08bYTjMt84IMV2C0UwSyzOVhInBRiNGwR10KvLqi6/wOp alXQjtIGzU5ONkg1AVFzdPXfHl7SUdPP1vkBPgrHnafPmqUp4emkykUQY+SFK9Q8GjMY dJvPoL32JdSiDX0/qOBtVSL5D6kVPB2sAy2Iw1zTKkEm7p11yzkCdJ/+ZOdec+M6Eu2+ ww== From: Steve Sistare To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , "Michael S. Tsirkin" , Jason Wang , Alex Williamson , Cedric Le Goater , Gerd Hoffmann , Marc-Andre Lureau , David Hildenbrand , Steve Sistare Subject: [PATCH V4 09/14] migration: notifier error checking Date: Thu, 22 Feb 2024 09:28:35 -0800 Message-Id: <1708622920-68779-10-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1708622920-68779-1-git-send-email-steven.sistare@oracle.com> References: <1708622920-68779-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-22_13,2024-02-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 phishscore=0 suspectscore=0 mlxscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402220138 X-Proofpoint-ORIG-GUID: xq6s9JdbXDsISQP5FYapEljN5vDHLmjl X-Proofpoint-GUID: xq6s9JdbXDsISQP5FYapEljN5vDHLmjl Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=205.220.177.32; envelope-from=steven.sistare@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1708623021951100003 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Check the status returned by migration notifiers for event type MIG_EVENT_PRECOPY_SETUP, and report errors. None of the notifiers return an error status at this time. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- include/migration/misc.h | 8 +++++++- migration/migration.c | 25 ++++++++++++++++--------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/include/migration/misc.h b/include/migration/misc.h index 4dc06a9..e4933b8 100644 --- a/include/migration/misc.h +++ b/include/migration/misc.h @@ -72,6 +72,11 @@ typedef struct MigrationEvent { MigrationEventType type; } MigrationEvent; =20 +/* + * A MigrationNotifyFunc may return an error code and an Error object, + * but only when @e->type is MIG_EVENT_PRECOPY_SETUP. The code is an int + * to allow for different failure modes and recovery actions. + */ typedef int (*MigrationNotifyFunc)(NotifierWithReturn *notify, MigrationEvent *e, Error **errp); =20 @@ -93,7 +98,8 @@ void migration_add_notifier_mode(NotifierWithReturn *noti= fy, MigrationNotifyFunc func, MigMode mode); =20 void migration_remove_notifier(NotifierWithReturn *notify); -void migration_call_notifiers(MigrationState *s, MigrationEventType type); +int migration_call_notifiers(MigrationState *s, MigrationEventType type, + Error **errp); bool migration_in_setup(MigrationState *); bool migration_has_finished(MigrationState *); bool migration_has_failed(MigrationState *); diff --git a/migration/migration.c b/migration/migration.c index 6a115d2..37c836b 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1376,7 +1376,7 @@ static void migrate_fd_cleanup(MigrationState *s) } type =3D migration_has_failed(s) ? MIG_EVENT_PRECOPY_FAILED : MIG_EVENT_PRECOPY_DONE; - migration_call_notifiers(s, type); + migration_call_notifiers(s, type, NULL); block_cleanup_parameters(); yank_unregister_instance(MIGRATION_YANK_INSTANCE); } @@ -1489,13 +1489,18 @@ void migration_remove_notifier(NotifierWithReturn *= notify) } } =20 -void migration_call_notifiers(MigrationState *s, MigrationEventType type) +int migration_call_notifiers(MigrationState *s, MigrationEventType type, + Error **errp) { MigMode mode =3D s->parameters.mode; MigrationEvent e; + int ret; =20 e.type =3D type; - notifier_with_return_list_notify(&migration_state_notifiers[mode], &e,= 0); + ret =3D notifier_with_return_list_notify(&migration_state_notifiers[mo= de], + &e, errp); + assert(!ret || type =3D=3D MIG_EVENT_PRECOPY_SETUP); + return ret; } =20 bool migration_in_setup(MigrationState *s) @@ -2549,7 +2554,7 @@ static int postcopy_start(MigrationState *ms, Error *= *errp) * at the transition to postcopy and after the device state; in partic= ular * spice needs to trigger a transition now */ - migration_call_notifiers(ms, MIG_EVENT_PRECOPY_DONE); + migration_call_notifiers(ms, MIG_EVENT_PRECOPY_DONE, NULL); =20 migration_downtime_end(ms); =20 @@ -2569,11 +2574,10 @@ static int postcopy_start(MigrationState *ms, Error= **errp) =20 ret =3D qemu_file_get_error(ms->to_dst_file); if (ret) { - error_setg(errp, "postcopy_start: Migration stream errored"); - migrate_set_state(&ms->state, MIGRATION_STATUS_POSTCOPY_ACTIVE, - MIGRATION_STATUS_FAILED); + error_setg_errno(errp, -ret, "postcopy_start: Migration stream err= or"); + bql_lock(); + goto fail; } - trace_postcopy_preempt_enabled(migrate_postcopy_preempt()); =20 return ret; @@ -2594,6 +2598,7 @@ fail: error_report_err(local_err); } } + migration_call_notifiers(ms, MIG_EVENT_PRECOPY_FAILED, NULL); bql_unlock(); return -1; } @@ -3613,7 +3618,9 @@ void migrate_fd_connect(MigrationState *s, Error *err= or_in) rate_limit =3D migrate_max_bandwidth(); =20 /* Notify before starting migration thread */ - migration_call_notifiers(s, MIG_EVENT_PRECOPY_SETUP); + if (migration_call_notifiers(s, MIG_EVENT_PRECOPY_SETUP, &local_er= r)) { + goto fail; + } } =20 migration_rate_set(rate_limit); --=20 1.8.3.1 From nobody Mon May 13 10:25:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1708622988; cv=none; d=zohomail.com; s=zohoarc; b=I0L7B5+uvIG6IYmK6FL6e35f+wmHfBpV99udQmQRPRawUYu+CYoCQogIFnv9xBnRU/vIWrHfQ6WXwpxuuAH4Omn/imsyW3rle324Tv1HxLJzjOIGw7gOjslB74IFfsWnMZ8y91j2/w9yDMZm7yGBRPhvg6KkjCJMQJ4Ex2GiUxw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708622988; h=Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=yYkqhag+ZGTXKPDA5eix+T8bZQxSgGbYTN0RzZrNURA=; b=cPJAGZ8Z2QPrmEfQ/EFN+HLOtDkG7PX5jpEAfh2g+nsKafqSne5sEl+x5qAC1EnMpZGKLWTI+z0YfNaHjsmGOPi8LGuhWIVFsa/ceCSBsO2E5WOSUcF/P+kENBApBf+VehcQiy8kldIN+/gGR55yoYQO3RCZtIgwV1O2NWWqhNA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708622988735776.0568201310577; Thu, 22 Feb 2024 09:29:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdCsr-0005No-5f; Thu, 22 Feb 2024 12:29:21 -0500 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 1rdCsp-0005Mb-6q for qemu-devel@nongnu.org; Thu, 22 Feb 2024 12:29:19 -0500 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdCsn-0003J0-AP for qemu-devel@nongnu.org; Thu, 22 Feb 2024 12:29:18 -0500 Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41MH9aGe031377; Thu, 22 Feb 2024 17:29:16 GMT Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3wakd2dfy7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 17:29:15 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41MG4la1024355; Thu, 22 Feb 2024 17:28:57 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3wak8ayrum-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 17:28:57 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 41MHSgA9032453; Thu, 22 Feb 2024 17:28:56 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3wak8ayre4-11; Thu, 22 Feb 2024 17:28:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2023-11-20; bh=yYkqhag+ZGTXKPDA5eix+T8bZQxSgGbYTN0RzZrNURA=; b=IPB7mvfqLH0XDWvIzdq3AgNifFgTQWrZWjhqx/uNQjZiPewp54yFXLAhhHMfAdrO5IqF UCfPTAWycFMyDAWBS3cnXVPJed/VZlcv2K9J9Tcx3icJixi2SQTeLfHIIGtY4z31gFyO 4qE+PnBq8ANrvIA7P3ZCGbrKb5xKXcQYLe/6bHO0QKQcILWfDKVzzgwtLvV0kkxM7Mt0 eXwfFYVAut9qPzGQv8Wzg+K7xv5qzElTx75s0jyZ5lD0o47aKxMDmD9bhmGa2O3jq8vQ zCwmsamlEVguLxIQuycU76b2/92OKZVk4cXXhX7VRMPdBYSyE+HhFACfoRkEPMomh+ES gA== From: Steve Sistare To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , "Michael S. Tsirkin" , Jason Wang , Alex Williamson , Cedric Le Goater , Gerd Hoffmann , Marc-Andre Lureau , David Hildenbrand , Steve Sistare Subject: [PATCH V4 10/14] migration: stop vm for cpr Date: Thu, 22 Feb 2024 09:28:36 -0800 Message-Id: <1708622920-68779-11-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1708622920-68779-1-git-send-email-steven.sistare@oracle.com> References: <1708622920-68779-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-22_13,2024-02-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 phishscore=0 suspectscore=0 mlxscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402220138 X-Proofpoint-GUID: SFswUIRABeJ6Duo_pXWc6LKlQ64c5frt X-Proofpoint-ORIG-GUID: SFswUIRABeJ6Duo_pXWc6LKlQ64c5frt Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=205.220.165.32; envelope-from=steven.sistare@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1708622989775100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" When migration for cpr is initiated, stop the vm and set state RUN_STATE_FINISH_MIGRATE before ram is saved. This eliminates the possibility of ram and device state being out of sync, and guarantees that a guest in the suspended state remains suspended, because qmp_cont rejects a cont command in the RUN_STATE_FINISH_MIGRATE state. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- include/migration/misc.h | 1 + migration/migration.c | 51 +++++++++++++++++++++++++++++---------------= ---- migration/migration.h | 2 -- 3 files changed, 32 insertions(+), 22 deletions(-) diff --git a/include/migration/misc.h b/include/migration/misc.h index e4933b8..5d1aa59 100644 --- a/include/migration/misc.h +++ b/include/migration/misc.h @@ -60,6 +60,7 @@ void migration_object_init(void); void migration_shutdown(void); bool migration_is_idle(void); bool migration_is_active(MigrationState *); +bool migrate_mode_is_cpr(MigrationState *); =20 typedef enum MigrationEventType { MIG_EVENT_PRECOPY_SETUP, diff --git a/migration/migration.c b/migration/migration.c index 37c836b..90a9094 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -167,11 +167,19 @@ static gint page_request_addr_cmp(gconstpointer ap, g= constpointer bp) return (a > b) - (a < b); } =20 -int migration_stop_vm(RunState state) +static int migration_stop_vm(MigrationState *s, RunState state) { - int ret =3D vm_stop_force_state(state); + int ret; + + migration_downtime_start(s); + + s->vm_old_state =3D runstate_get(); + global_state_store(); + + ret =3D vm_stop_force_state(state); =20 trace_vmstate_downtime_checkpoint("src-vm-stopped"); + trace_migration_completion_vm_stop(ret); =20 return ret; } @@ -1602,6 +1610,11 @@ bool migration_is_active(MigrationState *s) s->state =3D=3D MIGRATION_STATUS_POSTCOPY_ACTIVE); } =20 +bool migrate_mode_is_cpr(MigrationState *s) +{ + return s->parameters.mode =3D=3D MIG_MODE_CPR_REBOOT; +} + int migrate_init(MigrationState *s, Error **errp) { int ret; @@ -2454,10 +2467,7 @@ static int postcopy_start(MigrationState *ms, Error = **errp) bql_lock(); trace_postcopy_start_set_run(); =20 - migration_downtime_start(ms); - - global_state_store(); - ret =3D migration_stop_vm(RUN_STATE_FINISH_MIGRATE); + ret =3D migration_stop_vm(ms, RUN_STATE_FINISH_MIGRATE); if (ret < 0) { goto fail; } @@ -2652,15 +2662,12 @@ static int migration_completion_precopy(MigrationSt= ate *s, int ret; =20 bql_lock(); - migration_downtime_start(s); =20 - s->vm_old_state =3D runstate_get(); - global_state_store(); - - ret =3D migration_stop_vm(RUN_STATE_FINISH_MIGRATE); - trace_migration_completion_vm_stop(ret); - if (ret < 0) { - goto out_unlock; + if (!migrate_mode_is_cpr(s)) { + ret =3D migration_stop_vm(s, RUN_STATE_FINISH_MIGRATE); + if (ret < 0) { + goto out_unlock; + } } =20 ret =3D migration_maybe_pause(s, current_active_state, @@ -3500,15 +3507,10 @@ static void *bg_migration_thread(void *opaque) s->setup_time =3D qemu_clock_get_ms(QEMU_CLOCK_HOST) - setup_start; =20 trace_migration_thread_setup_complete(); - migration_downtime_start(s); =20 bql_lock(); =20 - s->vm_old_state =3D runstate_get(); - - global_state_store(); - /* Forcibly stop VM before saving state of vCPUs and devices */ - if (migration_stop_vm(RUN_STATE_PAUSED)) { + if (migration_stop_vm(s, RUN_STATE_PAUSED)) { goto fail; } /* @@ -3584,6 +3586,7 @@ void migrate_fd_connect(MigrationState *s, Error *err= or_in) Error *local_err =3D NULL; uint64_t rate_limit; bool resume =3D s->state =3D=3D MIGRATION_STATUS_POSTCOPY_PAUSED; + int ret; =20 /* * If there's a previous error, free it and prepare for another one. @@ -3655,6 +3658,14 @@ void migrate_fd_connect(MigrationState *s, Error *er= ror_in) return; } =20 + if (migrate_mode_is_cpr(s)) { + ret =3D migration_stop_vm(s, RUN_STATE_FINISH_MIGRATE); + if (ret < 0) { + error_setg(&local_err, "migration_stop_vm failed, error %d", -= ret); + goto fail; + } + } + if (migrate_background_snapshot()) { qemu_thread_create(&s->thread, "bg_snapshot", bg_migration_thread, s, QEMU_THREAD_JOINABLE); diff --git a/migration/migration.h b/migration/migration.h index aef8afb..65c0b61 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -541,6 +541,4 @@ int migration_rp_wait(MigrationState *s); */ void migration_rp_kick(MigrationState *s); =20 -int migration_stop_vm(RunState state); - #endif --=20 1.8.3.1 From nobody Mon May 13 10:25:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1708623008; cv=none; d=zohomail.com; s=zohoarc; b=N0MbBNtcyFz++ZUtzTX606IQQzsQeqS1EMMCrwmDOuBQjdDeF/hpVsAiepTffzjT/BjUOH29PwI2Xq8LYDLLkgXfRUbKKJB1rGmfnoJ8rfVKFhypaDe1+GDZoHRb+FMgjPnjRe2vpvSHgzUEWVwd/LYiSYM0wfIyi7TkY2/oceI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708623008; h=Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=rH7BH7+m4emVEj2RIKS77Ga1/IdPcieuJjzqzULPCFo=; b=Kl4pmcim/4DkvYbpwCyIx4LB0myHACDW7NfVUM8TtwprUNeGrHNGLiuwNxyqAb44R8TyH6Uiiqbnitoilert/1XmlqcPdVJtrLy6B3YxA39h2fcaL9mH4DVOllzoxVO8bWddLPLYx3Pw/mDVR9EhFy1lJFHr3zb3UcgpdrxeAy0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 170862300835878.33850783950527; Thu, 22 Feb 2024 09:30:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdCsa-0004m5-Hq; Thu, 22 Feb 2024 12:29:04 -0500 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 1rdCsY-0004kg-1D for qemu-devel@nongnu.org; Thu, 22 Feb 2024 12:29:02 -0500 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdCsW-0003Er-CY for qemu-devel@nongnu.org; Thu, 22 Feb 2024 12:29:01 -0500 Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41MH95Di003429; Thu, 22 Feb 2024 17:28:59 GMT Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3wamud5dq0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 17:28:59 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41MG9UJu024561; Thu, 22 Feb 2024 17:28:58 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3wak8ayrvk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 17:28:58 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 41MHSgAB032453; Thu, 22 Feb 2024 17:28:58 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3wak8ayre4-12; Thu, 22 Feb 2024 17:28:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2023-11-20; bh=rH7BH7+m4emVEj2RIKS77Ga1/IdPcieuJjzqzULPCFo=; b=MoSqnUGszoQtfcbuRK7+2TMcMokncKF17e+fyHdp45Ypk6YdlbHqAXj3vf7JcCiK3b47 q+MHgOMni9uiC7/Zyz4XpCjoFKlY3WSKf2McCGmKP08iy2PINhw2c8pgq9Rs1WUKPDMn EhpZHnRhUVsBPqgkU2TfG92a8tYNsO1ubzgk/GjOubZtLYwCssQ0ZPiT2Z2rh4bEHc/N E7hdLZXMI7Ju8QxHRE7KqXZjLJkRgtYyM6bDCcgYa9lT+gbiGjiHoKdTkGNpLHsPbkgH Bhekj+tzN4BliZB/suHyA0NMpeOfqBrxgpcW20l+hL1KbwrixSC30BnSqsZk22iQeERm 2w== From: Steve Sistare To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , "Michael S. Tsirkin" , Jason Wang , Alex Williamson , Cedric Le Goater , Gerd Hoffmann , Marc-Andre Lureau , David Hildenbrand , Steve Sistare Subject: [PATCH V4 11/14] vfio: register container for cpr Date: Thu, 22 Feb 2024 09:28:37 -0800 Message-Id: <1708622920-68779-12-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1708622920-68779-1-git-send-email-steven.sistare@oracle.com> References: <1708622920-68779-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-22_13,2024-02-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 phishscore=0 suspectscore=0 mlxscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402220138 X-Proofpoint-GUID: ZUGGXzxHkRH1V_cVgBLTEFlgWJNvn-zq X-Proofpoint-ORIG-GUID: ZUGGXzxHkRH1V_cVgBLTEFlgWJNvn-zq Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=205.220.177.32; envelope-from=steven.sistare@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1708623009868100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Define entry points to perform per-container cpr-specific initialization and teardown. Signed-off-by: Steve Sistare Reviewed-by: C=C3=A9dric Le Goater --- hw/vfio/container.c | 11 ++++++++++- hw/vfio/cpr.c | 19 +++++++++++++++++++ hw/vfio/iommufd.c | 6 ++++++ hw/vfio/meson.build | 1 + include/hw/vfio/vfio-common.h | 3 +++ 5 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 hw/vfio/cpr.c diff --git a/hw/vfio/container.c b/hw/vfio/container.c index bd25b9f..096d77e 100644 --- a/hw/vfio/container.c +++ b/hw/vfio/container.c @@ -621,10 +621,15 @@ static int vfio_connect_container(VFIOGroup *group, A= ddressSpace *as, goto free_container_exit; } =20 + ret =3D vfio_cpr_register_container(bcontainer, errp); + if (ret) { + goto free_container_exit; + } + ret =3D vfio_ram_block_discard_disable(container, true); if (ret) { error_setg_errno(errp, -ret, "Cannot set discarding of RAM broken"= ); - goto free_container_exit; + goto unregister_container_exit; } =20 assert(bcontainer->ops->setup); @@ -667,6 +672,9 @@ listener_release_exit: enable_discards_exit: vfio_ram_block_discard_disable(container, false); =20 +unregister_container_exit: + vfio_cpr_unregister_container(bcontainer); + free_container_exit: g_free(container); =20 @@ -710,6 +718,7 @@ static void vfio_disconnect_container(VFIOGroup *group) vfio_container_destroy(bcontainer); =20 trace_vfio_disconnect_container(container->fd); + vfio_cpr_unregister_container(bcontainer); close(container->fd); g_free(container); =20 diff --git a/hw/vfio/cpr.c b/hw/vfio/cpr.c new file mode 100644 index 0000000..3bede54 --- /dev/null +++ b/hw/vfio/cpr.c @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2021-2024 Oracle and/or its affiliates. + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "hw/vfio/vfio-common.h" +#include "qapi/error.h" + +int vfio_cpr_register_container(VFIOContainerBase *bcontainer, Error **err= p) +{ + return 0; +} + +void vfio_cpr_unregister_container(VFIOContainerBase *bcontainer) +{ +} diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c index 9bfddc1..e1be224 100644 --- a/hw/vfio/iommufd.c +++ b/hw/vfio/iommufd.c @@ -411,6 +411,11 @@ found_container: goto err_listener_register; } =20 + ret =3D vfio_cpr_register_container(bcontainer, errp); + if (ret) { + goto err_listener_register; + } + /* * TODO: examine RAM_BLOCK_DISCARD stuff, should we do group level * for discarding incompatibility check as well? @@ -461,6 +466,7 @@ static void iommufd_cdev_detach(VFIODevice *vbasedev) iommufd_cdev_ram_block_discard_disable(false); } =20 + vfio_cpr_unregister_container(bcontainer); iommufd_cdev_detach_container(vbasedev, container); iommufd_cdev_container_destroy(container); vfio_put_address_space(space); diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build index bb98493..bba776f 100644 --- a/hw/vfio/meson.build +++ b/hw/vfio/meson.build @@ -5,6 +5,7 @@ vfio_ss.add(files( 'container-base.c', 'container.c', 'migration.c', + 'cpr.c', )) vfio_ss.add(when: 'CONFIG_PSERIES', if_true: files('spapr.c')) vfio_ss.add(when: 'CONFIG_IOMMUFD', if_true: files( diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h index 4a6c262..b9da6c0 100644 --- a/include/hw/vfio/vfio-common.h +++ b/include/hw/vfio/vfio-common.h @@ -205,6 +205,9 @@ void vfio_detach_device(VFIODevice *vbasedev); int vfio_kvm_device_add_fd(int fd, Error **errp); int vfio_kvm_device_del_fd(int fd, Error **errp); =20 +int vfio_cpr_register_container(VFIOContainerBase *bcontainer, Error **err= p); +void vfio_cpr_unregister_container(VFIOContainerBase *bcontainer); + extern const MemoryRegionOps vfio_region_ops; typedef QLIST_HEAD(VFIOGroupList, VFIOGroup) VFIOGroupList; typedef QLIST_HEAD(VFIODeviceList, VFIODevice) VFIODeviceList; --=20 1.8.3.1 From nobody Mon May 13 10:25:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1708622979; cv=none; d=zohomail.com; s=zohoarc; b=FD0Ns/k1+lMs4adzcZgiHlO+YldinVg2oVQsCdwkEoOZKeLvCcXqHr5LAsq98DPtNvB3k35+ZONRfpRsvVN/Su991jpch5z8yOQLD36zujF0fMoMjB46WnxpmolqlBEwbGwF/BE7jz32D7ipE38UQCftVR+nSh90KT6mlfT40Gs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708622979; h=Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=gsBCfpYo6nRhd1lyMEyOJxnbTlx2IARryMCqC21aU7A=; b=n4b6KOhqS49aIJFw0sCwbgwhC9iLu/jezAV94ljijURBFV16c3LDCpqipDuT4tgAV+UHO4M2YtUBN8/R6ymKIjhGbWe4yZU930IamhuycL4hthqH/x4wiJRdB2hAcuUvEtYMZT853V6MnA9QrJjhse6b4wJ0kd7CIwCj6d5wvkY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708622979025467.71971404276417; Thu, 22 Feb 2024 09:29:39 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdCsb-0004o9-KG; Thu, 22 Feb 2024 12:29:05 -0500 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 1rdCsZ-0004lo-Fo for qemu-devel@nongnu.org; Thu, 22 Feb 2024 12:29:03 -0500 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdCsX-0003F2-Uj for qemu-devel@nongnu.org; Thu, 22 Feb 2024 12:29:03 -0500 Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41MH95YQ014805; Thu, 22 Feb 2024 17:29:01 GMT Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3wamdu58fr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 17:29:00 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41MGE5cq024480; Thu, 22 Feb 2024 17:29:00 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3wak8ayrws-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 17:29:00 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 41MHSgAD032453; Thu, 22 Feb 2024 17:28:59 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3wak8ayre4-13; Thu, 22 Feb 2024 17:28:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2023-11-20; bh=gsBCfpYo6nRhd1lyMEyOJxnbTlx2IARryMCqC21aU7A=; b=JltrTnMowPH6jU38mhaVSgdxseyJo4VfgGi2Qk2Kh2qQW0oaxjW+svw0dkkGSpckFcPw lgRT4DuIReSZrg0DSq1BZE3sKpxMEVYGG+hgJi8gqWLOv0JMAB99n17Ux1WXj1qEAGWI RKaZOuJ5HkLTRDVx8G6QoOL+tPRYUWqpFDmGmC4hPcTluCPZOFkqbq0CfXYJN5c3xDud LjPeV4FQhG4/yjnr4kT89X3Ei67ZYtqjcF8K0WffxToeMybO5PH4rrWC9XBsQTetodxP Jp3Gj8G0Bwq57IyqTgLE58m1krefsvRAI7urRFC50GEsvl9z3Vqiwkn/oem3ZOQMEbAt yg== From: Steve Sistare To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , "Michael S. Tsirkin" , Jason Wang , Alex Williamson , Cedric Le Goater , Gerd Hoffmann , Marc-Andre Lureau , David Hildenbrand , Steve Sistare Subject: [PATCH V4 12/14] vfio: allow cpr-reboot migration if suspended Date: Thu, 22 Feb 2024 09:28:38 -0800 Message-Id: <1708622920-68779-13-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1708622920-68779-1-git-send-email-steven.sistare@oracle.com> References: <1708622920-68779-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-22_13,2024-02-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 phishscore=0 suspectscore=0 mlxscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402220138 X-Proofpoint-GUID: QGkaSMZ-cgOUK36kp-jXl8JkDi-bpef3 X-Proofpoint-ORIG-GUID: QGkaSMZ-cgOUK36kp-jXl8JkDi-bpef3 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=205.220.177.32; envelope-from=steven.sistare@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1708622979752100003 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Allow cpr-reboot for vfio if the guest is in the suspended runstate. The guest drivers' suspend methods flush outstanding requests and re-initialize the devices, and thus there is no device state to save and restore. The user is responsible for suspending the guest before initiating cpr, such as by issuing guest-suspend-ram to the qemu guest agent. Relax the vfio blocker so it does not apply to cpr, and add a notifier that verifies the guest is suspended. Signed-off-by: Steve Sistare Reviewed-by: C=C3=A9dric Le Goater --- hw/vfio/common.c | 2 +- hw/vfio/cpr.c | 20 ++++++++++++++++++++ hw/vfio/migration.c | 2 +- include/hw/vfio/vfio-container-base.h | 1 + 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 059bfdc..ff88c3f 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -128,7 +128,7 @@ int vfio_block_multiple_devices_migration(VFIODevice *v= basedev, Error **errp) error_setg(&multiple_devices_migration_blocker, "Multiple VFIO devices migration is supported only if all o= f " "them support P2P migration"); - ret =3D migrate_add_blocker(&multiple_devices_migration_blocker, errp); + ret =3D migrate_add_blocker_normal(&multiple_devices_migration_blocker= , errp); =20 return ret; } diff --git a/hw/vfio/cpr.c b/hw/vfio/cpr.c index 3bede54..392c2dd 100644 --- a/hw/vfio/cpr.c +++ b/hw/vfio/cpr.c @@ -7,13 +7,33 @@ =20 #include "qemu/osdep.h" #include "hw/vfio/vfio-common.h" +#include "migration/misc.h" #include "qapi/error.h" +#include "sysemu/runstate.h" + +static int vfio_cpr_reboot_notifier(NotifierWithReturn *notifier, + MigrationEvent *e, Error **errp) +{ + if (e->type =3D=3D MIG_EVENT_PRECOPY_SETUP && + !runstate_check(RUN_STATE_SUSPENDED) && !vm_get_suspended()) { + + error_setg(errp, + "VFIO device only supports cpr-reboot for runstate suspended"); + + return -1; + } + return 0; +} =20 int vfio_cpr_register_container(VFIOContainerBase *bcontainer, Error **err= p) { + migration_add_notifier_mode(&bcontainer->cpr_reboot_notifier, + vfio_cpr_reboot_notifier, + MIG_MODE_CPR_REBOOT); return 0; } =20 void vfio_cpr_unregister_container(VFIOContainerBase *bcontainer) { + migration_remove_notifier(&bcontainer->cpr_reboot_notifier); } diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c index 50140ed..2050ac8 100644 --- a/hw/vfio/migration.c +++ b/hw/vfio/migration.c @@ -889,7 +889,7 @@ static int vfio_block_migration(VFIODevice *vbasedev, E= rror *err, Error **errp) vbasedev->migration_blocker =3D error_copy(err); error_free(err); =20 - return migrate_add_blocker(&vbasedev->migration_blocker, errp); + return migrate_add_blocker_normal(&vbasedev->migration_blocker, errp); } =20 /* ---------------------------------------------------------------------- = */ diff --git a/include/hw/vfio/vfio-container-base.h b/include/hw/vfio/vfio-c= ontainer-base.h index b2813b0..3582d5f 100644 --- a/include/hw/vfio/vfio-container-base.h +++ b/include/hw/vfio/vfio-container-base.h @@ -49,6 +49,7 @@ typedef struct VFIOContainerBase { QLIST_ENTRY(VFIOContainerBase) next; QLIST_HEAD(, VFIODevice) device_list; GList *iova_ranges; + NotifierWithReturn cpr_reboot_notifier; } VFIOContainerBase; =20 typedef struct VFIOGuestIOMMU { --=20 1.8.3.1 From nobody Mon May 13 10:25:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1708622978; cv=none; d=zohomail.com; s=zohoarc; b=l8brNuoulx3LpIhy505AMHUp54QdR2lJ/nsv4flmBsFXjhkdPDTxQMWcqG2KB4fvPdlyVcyEQIXirKXn1h9okzGqAlb1LpwPNE/Y7Hc94IY4aGTiHGvh1mogobaasKUJu6S84De1QVtGbjg/4dSC0g1VA6skhqr3GDouWM7F0N4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708622978; h=Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=xATcafse/wUuxDOzzgHfYRL4vsb0ilbGj2zzju+9HeY=; b=C5SqH+2MBq39zAAoKp2rqdjPm2yeMCUoBwxcbXM1wE/vJ5aQyJh/oJ4tzwj2KJ+p/TqSR3TLYHNdLcWBFAHnKDJ4VQ4vxRDKXEF2+6hq8W7+JFqI0x3bhh9mvz1AuYYWKDXKntMNzsckAhpUJ8rXiPdxu+0HRT8zceU37OKFWiw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708622978791511.57125681533387; Thu, 22 Feb 2024 09:29:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdCsg-0004qu-RV; Thu, 22 Feb 2024 12:29:10 -0500 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 1rdCsf-0004q8-Dy for qemu-devel@nongnu.org; Thu, 22 Feb 2024 12:29:09 -0500 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdCsa-0003FL-Md for qemu-devel@nongnu.org; Thu, 22 Feb 2024 12:29:09 -0500 Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41MGtnIe018397; Thu, 22 Feb 2024 17:29:03 GMT Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3wanbvn9yw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 17:29:03 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41MG4la8024355; Thu, 22 Feb 2024 17:29:01 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3wak8ayrxx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 17:29:01 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 41MHSgAF032453; Thu, 22 Feb 2024 17:29:01 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3wak8ayre4-14; Thu, 22 Feb 2024 17:29:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2023-11-20; bh=xATcafse/wUuxDOzzgHfYRL4vsb0ilbGj2zzju+9HeY=; b=OMndT/PjPlD6SyEh+5peqoJ8x+qcUCyD2P9JnlLEcUM1fKwlS03dNDxk6dIKYEY4BqHL /F/lGpwVnwRq29dSksBzlVtf0vqonUePd3djd8Tdl3uZa8Pxnon5DWApGahskKZjKJis By6WKXdz8B/l/Olv6l9YppDfBq2yvDPHEZAu461QVv3bia4+gnxCOBTA5L8oHlyTjaaX HK2yPsTTbTdNCqBY3JstnTMVuAbDSI/gGJlqe0s/Gr72p7pAzEE8YSgkrH0i96UA+rvy T7rGMCu8rW01E2e59upwf/CrKldd1lfXgZgcfVaQ44mRo1Fbv7nZJoLZCeby2OkPQna+ tw== From: Steve Sistare To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , "Michael S. Tsirkin" , Jason Wang , Alex Williamson , Cedric Le Goater , Gerd Hoffmann , Marc-Andre Lureau , David Hildenbrand , Steve Sistare Subject: [PATCH V4 13/14] migration: update cpr-reboot description Date: Thu, 22 Feb 2024 09:28:39 -0800 Message-Id: <1708622920-68779-14-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1708622920-68779-1-git-send-email-steven.sistare@oracle.com> References: <1708622920-68779-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-22_13,2024-02-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 phishscore=0 suspectscore=0 mlxscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402220138 X-Proofpoint-GUID: DwRjC9gQ-oOgKkAedkzOJdcrM2LVRuHy X-Proofpoint-ORIG-GUID: DwRjC9gQ-oOgKkAedkzOJdcrM2LVRuHy Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=205.220.165.32; envelope-from=steven.sistare@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1708622979742100002 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Clarify qapi for cpr-reboot migration mode, and add vfio support. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- qapi/migration.json | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/qapi/migration.json b/qapi/migration.json index 5a565d9..0990297 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -636,19 +636,28 @@ # # @normal: the original form of migration. (since 8.2) # -# @cpr-reboot: The migrate command saves state to a file, allowing one to -# quit qemu, reboot to an updated kernel, and restart an upda= ted -# version of qemu. The caller must specify a migration URI -# that writes to and reads from a file. Unlike normal mode, -# the use of certain local storage options does not block the -# migration, but the caller must not modify guest block devic= es -# between the quit and restart. To avoid saving guest RAM to= the -# file, the memory backend must be shared, and the @x-ignore-= shared -# migration capability must be set. Guest RAM must be non-vo= latile -# across reboot, such as by backing it with a dax device, but= this -# is not enforced. The restarted qemu arguments must match t= hose -# used to initially start qemu, plus the -incoming option. -# (since 8.2) +# @cpr-reboot: The migrate command stops the VM and saves state to the URI. +# After quitting qemu, the user resumes by running qemu -incoming. +# +# This mode allows the user to quit qemu, and restart an updated versi= on +# of qemu. The user may even update and reboot the OS before restarti= ng, +# as long as the URI persists across a reboot. +# +# Unlike normal mode, the use of certain local storage options does not +# block the migration, but the user must not modify guest block devices +# between the quit and restart. +# +# This mode supports vfio devices provided the user first puts the gue= st +# in the suspended runstate, such as by issuing guest-suspend-ram to t= he +# qemu guest agent. +# +# Best performance is achieved when the memory backend is shared and t= he +# @x-ignore-shared migration capability is set, but this is not requir= ed. +# Further, if the user reboots before restarting such a configuration,= the +# shared backend must be be non-volatile across reboot, such as by bac= king +# it with a dax device. +# +# (since 8.2) ## { 'enum': 'MigMode', 'data': [ 'normal', 'cpr-reboot' ] } --=20 1.8.3.1 From nobody Mon May 13 10:25:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1708622999; cv=none; d=zohomail.com; s=zohoarc; b=AhycDJIXs+EwSUbZcZPf8bmEDRD3B7NRjuwxFqcKVnC2alnm4VsJfHdPZ3bKFkFzF553jnIR/elaCBoMUHTZ7CaD9tbPLEV0cSYKwSYCrpKRx6GdSADeJ87/WfoiEzNeElh0NZOB1qa9vmr11+TuX+E5h4zOwgBHJgI0sYWBtFM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708622999; h=Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=wVz1B2cs/KV7XZxdXZrfE7CvTr69TpbqwHL6XmEN+qU=; b=DUzADjeouElYpFqdcSKNrAOtkjafIeQpyjRcH2KPtBXgYH7jGfBjnsOTwPyRolQPZGUSMADmWJH5ooo0A0b9HhVleYlm5UwoPRyULO0fg8dHu6y3oeBOM7LFmcriNiDxOK1TUqwYMNnEtg0yPAJtC3MO7h344pVo8JsHXmAaLIY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708622999761142.62454873738102; Thu, 22 Feb 2024 09:29:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdCsw-0005bO-3K; Thu, 22 Feb 2024 12:29:26 -0500 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 1rdCsu-0005U2-2F for qemu-devel@nongnu.org; Thu, 22 Feb 2024 12:29:24 -0500 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdCsr-0003KF-To for qemu-devel@nongnu.org; Thu, 22 Feb 2024 12:29:23 -0500 Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41MH9aGn031377; Thu, 22 Feb 2024 17:29:20 GMT Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3wakd2dfyv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 17:29:20 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41MHSVQp024791; Thu, 22 Feb 2024 17:29:03 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3wak8ays03-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Feb 2024 17:29:03 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 41MHSgAH032453; Thu, 22 Feb 2024 17:29:02 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3wak8ayre4-15; Thu, 22 Feb 2024 17:29:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2023-11-20; bh=wVz1B2cs/KV7XZxdXZrfE7CvTr69TpbqwHL6XmEN+qU=; b=ku8yryDrKE3red+r8gwv4RZML4qGZA/vLKAXOaQ799xwFJE9VQyOH52k37Evk+/jquTW 3pXeasRt0yyZo+cUrc0h1hSNWNhXmj34+PYbLmqxmPx4Z3TQ1pqavf9KUejrE/sguAUz DUfqzFQibDSLsPUvrxKfKGZgG1afbpWIEv8T1lpMfCpmFmhKH4Z/au2Tw4rv7W7db6bc GvyKYbtmUthCkkEwXUU9mdGZTNWTyKDew5JjLZKW7uauZEJoF6gX2qVUgqnanKrrkOft RQ99jaZLHIHNZzOpCMQKo2SQBFEnvdShuay0QkmKFG4sMVvR/jUW6FlSrKcBFLcYl6uY Uw== From: Steve Sistare To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , "Michael S. Tsirkin" , Jason Wang , Alex Williamson , Cedric Le Goater , Gerd Hoffmann , Marc-Andre Lureau , David Hildenbrand , Steve Sistare Subject: [PATCH V4 14/14] migration: options incompatible with cpr Date: Thu, 22 Feb 2024 09:28:40 -0800 Message-Id: <1708622920-68779-15-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1708622920-68779-1-git-send-email-steven.sistare@oracle.com> References: <1708622920-68779-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-22_13,2024-02-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 phishscore=0 suspectscore=0 mlxscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402220138 X-Proofpoint-GUID: GD-xtRYXNFAjQWLWt2k1e94V9rvhjn2J X-Proofpoint-ORIG-GUID: GD-xtRYXNFAjQWLWt2k1e94V9rvhjn2J Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=205.220.165.32; envelope-from=steven.sistare@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1708623001806100003 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Fail the migration request if options are set that are incompatible with cpr. Signed-off-by: Steve Sistare Reviewed-by: Peter Xu --- migration/migration.c | 17 +++++++++++++++++ qapi/migration.json | 2 ++ 2 files changed, 19 insertions(+) diff --git a/migration/migration.c b/migration/migration.c index 90a9094..7652fd4 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1953,6 +1953,23 @@ static bool migrate_prepare(MigrationState *s, bool = blk, bool blk_inc, return false; } =20 + if (migrate_mode_is_cpr(s)) { + const char *conflict =3D NULL; + + if (migrate_postcopy()) { + conflict =3D "postcopy"; + } else if (migrate_background_snapshot()) { + conflict =3D "background snapshot"; + } else if (migrate_colo()) { + conflict =3D "COLO"; + } + + if (conflict) { + error_setg(errp, "Cannot use %s with CPR", conflict); + return false; + } + } + if (blk || blk_inc) { if (migrate_colo()) { error_setg(errp, "No disk migration is required in COLO mode"); diff --git a/qapi/migration.json b/qapi/migration.json index 0990297..c6bfe2e 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -657,6 +657,8 @@ # shared backend must be be non-volatile across reboot, such as by bac= king # it with a dax device. # +# cpr-reboot may not be used with postcopy, colo, or background-snapsh= ot. +# # (since 8.2) ## { 'enum': 'MigMode', --=20 1.8.3.1