From nobody Wed Nov 27 04:38:46 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=1701380306; cv=none; d=zohomail.com; s=zohoarc; b=A8lweHqsBh5WFODPiS1lTatwPzMnOAzSOINdqRoGMaLuNv2YnqHs7kh3El7vGLmHgaLiwRLE256hF9HVxfIav7I9Sst+xo6uvou7idlau5M0dmeWOHXuYyhlwWOJgYYEhKW3zQA6VBDHxpQmyWfVC+TkljJDWVukn3SWhoehUfw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1701380306; 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=1AXK9qY640tp3xWndVb1h1H773czR1vqkCKmAuhlByk=; b=m//nQ/c3Au++xIz7JBUNVBMJJJeYuW0sbxXfIsNVOAhjaXxiHP2uFZkKMxz0JBx+fcb4b9SYQxfDfCCG/1MqtABjj/xb6DZOdjaRnutcJTHLxOUx+m7gxbLG8LDpvRzpi5+LVOXm530wjSgq2Mx6w3+GGzaAo/y218Q3zO8Qh7U= 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 1701380306230495.56586963001837; Thu, 30 Nov 2023 13:38:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r8ojB-0001pB-O6; Thu, 30 Nov 2023 16:37:45 -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 1r8oj7-0001mR-OH for qemu-devel@nongnu.org; Thu, 30 Nov 2023 16:37:41 -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 1r8oj6-0000mL-1X for qemu-devel@nongnu.org; Thu, 30 Nov 2023 16:37:41 -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 3AULZ1xI012973; Thu, 30 Nov 2023 21:37:38 GMT Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3uq21fg357-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Nov 2023 21:37:37 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 3AUL0J82012729; Thu, 30 Nov 2023 21:37:36 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3uk7cgt0qw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Nov 2023 21:37:36 +0000 Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AULbTg7016589; Thu, 30 Nov 2023 21:37:35 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3uk7cgt0jh-6; Thu, 30 Nov 2023 21:37:35 +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=1AXK9qY640tp3xWndVb1h1H773czR1vqkCKmAuhlByk=; b=flsVJJ+VkHTSuA0WEWhiXQlO35wNjBTA3SyEGiruQGxNnAcRZlitvBPjHCZ7mW9OoyjM 2JNhb9HEeL3VfQ2lYkRV6zb8ebPGbgddYi1nM0IPReZX6cpVnE2+0lEz2vJtTvqX2G9N eZV6DB0s0fXCkid/thhpb8t0/PBYp117xf2PLlPfjBNmMOiyw1vsNA+kFsFoRIY7OxIE SmYwKHOUO/rsdZFE+b+94w0fweNYMYtwdtYIMF6SddbujbjwYa7C5XxPTlSwwz8sQTxF FQqKYrsY9fC5pyKKML6vFNeqrL6VLu/OyWmytMRc8V3LXz/sC90SGD8bdwTpYkyMav2z 8Q== From: Steve Sistare To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Paolo Bonzini , Thomas Huth , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Fabiano Rosas , Leonardo Bras , Steve Sistare Subject: [PATCH V6 05/14] migration: propagate suspended runstate Date: Thu, 30 Nov 2023 13:37:18 -0800 Message-Id: <1701380247-340457-6-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1701380247-340457-1-git-send-email-steven.sistare@oracle.com> References: <1701380247-340457-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-30_21,2023-11-30_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 phishscore=0 mlxscore=0 malwarescore=0 adultscore=0 suspectscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311300158 X-Proofpoint-GUID: OWrbSQzJ7iaFif0QHwALkXOCzMQkHrt- X-Proofpoint-ORIG-GUID: OWrbSQzJ7iaFif0QHwALkXOCzMQkHrt- 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: -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_H5=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: 1701380307890000005 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" If the outgoing machine was previously suspended, propagate that to the incoming side via global_state, so a subsequent vm_start restores the suspended state. To maintain backward and forward compatibility, define the new field in a zero'd hole in the GlobalState struct. Signed-off-by: Steve Sistare --- migration/global_state.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/migration/global_state.c b/migration/global_state.c index 4e2a9d8..de2532c 100644 --- a/migration/global_state.c +++ b/migration/global_state.c @@ -25,6 +25,7 @@ typedef struct { uint8_t runstate[100]; RunState state; bool received; + bool vm_was_suspended; } GlobalState; =20 static GlobalState global_state; @@ -35,6 +36,7 @@ static void global_state_do_store(RunState state) assert(strlen(state_str) < sizeof(global_state.runstate)); strpadcpy((char *)global_state.runstate, sizeof(global_state.runstate), state_str, '\0'); + global_state.vm_was_suspended =3D vm_get_suspended(); } =20 void global_state_store(void) @@ -68,6 +70,12 @@ static bool global_state_needed(void *opaque) return true; } =20 + /* If the suspended state must be remembered, it is needed */ + + if (vm_get_suspended()) { + return true; + } + /* If state is running or paused, it is not needed */ =20 if (strcmp(runstate, "running") =3D=3D 0 || @@ -109,6 +117,7 @@ static int global_state_post_load(void *opaque, int ver= sion_id) return -EINVAL; } s->state =3D r; + vm_set_suspended(s->vm_was_suspended || r =3D=3D RUN_STATE_SUSPENDED); =20 return 0; } @@ -134,6 +143,7 @@ static const VMStateDescription vmstate_globalstate =3D= { .fields =3D (VMStateField[]) { VMSTATE_UINT32(size, GlobalState), VMSTATE_BUFFER(runstate, GlobalState), + VMSTATE_BOOL(vm_was_suspended, GlobalState), VMSTATE_END_OF_LIST() }, }; --=20 1.8.3.1