From patchwork Tue Jul 6 16:45:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Sistare X-Patchwork-Id: 12360945 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A84BEC07E96 for ; Tue, 6 Jul 2021 17:05:06 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4372B61C3B for ; Tue, 6 Jul 2021 17:05:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4372B61C3B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:40480 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m0oVN-0001WE-6q for qemu-devel@archiver.kernel.org; Tue, 06 Jul 2021 13:05:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59498) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0oJn-0000sk-PH for qemu-devel@nongnu.org; Tue, 06 Jul 2021 12:53:07 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:13666) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0oJl-00084d-Ud for qemu-devel@nongnu.org; Tue, 06 Jul 2021 12:53:07 -0400 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 166GqSuE028780; Tue, 6 Jul 2021 16:53:03 GMT 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 : content-type : mime-version; s=corp-2020-01-29; bh=XNAmzhW4ZINLLfVPX98uPV47De+X5lYWvXvGuO4KyNc=; b=Pk4zFmObyJg2OhWeQw73IAhyRUJ8rfMjAOUhi8Hl3cHXJW7Rqz5jU/i2Td/Mj0nZ0N+M NBBeXIduA4uchWZvJWLfRtY7QNM5dybshqicawv9vLLhnhE0rSS1Ms2/9OMvvOtjjarh 8Se5I0+oOnuzIsCgx+ED9GuNn6a4ZCu//Oo5W4Z0fV4TuwiuKeeqw4QJ3NBZigyVmXUm x07tSUXEFeSYa6OfR1aMVaxpjUqU0Ry2cahuu1wqYzKjkXto2zuIveVGTj+XNg2S/LdQ vjKcr+6oGpFMqQyhh4GoteUIvyrBpsBnf/Fr6ib4rape+W3ZQ+TsqZe5oLwBo751Nb+i Zw== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by mx0b-00069f02.pphosted.com with ESMTP id 39m2aaaapg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 06 Jul 2021 16:53:03 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 166GoV4I003719; Tue, 6 Jul 2021 16:53:02 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2170.outbound.protection.outlook.com [104.47.57.170]) by aserp3030.oracle.com with ESMTP id 39jdxhgc0v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 06 Jul 2021 16:53:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WbL4T2iISiYZcBxX9dKVn23EOGA+c9lPerX1sSgT5ZQSKybJfLJ3ja7BkIZni8gr2AtsHe7H3WBhuqiaVyzmGVtFNoKTq9hjmfdFfXUdbvUhQmaSBIn2gM+lVFR32bSYtFnDKNELZa9v8j9wEMUMNImv8xd01nvQjf0xPx+L8qCbhuG66JyQloGKnfDCTjSliseuErxtApYg7BrUQHpCmwxsV6jrowKahC2TwljRzmGbnBF0orzYDm0uVkvhJ3kBokhzQ+b97HpEvWtgFdP0W9QK6gT6J70E0pRCc21K/ULQvTP47/O1cSJ6LpMz+0HpXjA6c7Ww7SKxAC2QblUpnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XNAmzhW4ZINLLfVPX98uPV47De+X5lYWvXvGuO4KyNc=; b=UuCN4YpvmG3MoKwL5zDrOomgA+6jrPDHFEOLl/PrSEqtNo7ahTnBREqni9pY/iQ4HvJp3AUWPO37Zcmt+J5gyZ7ZCqWFQuYLVUwjj7+tPgxhvdB/eHSEg/eyW1lKDyd2Mpa4tapabW/P6ezyFUGORLX5Mj0zdoC/a4kZrqoxU9bVabBG59aM7xj2LDUKtFPmowSqNdgwOvX/TJ1vrfHwEQRohakBVjGlkIBDo9NYBzkCjHs3hEm4MGioFqIg88HCNLFLDWmDOz5smONAgf+xH8rTVaiLCYhWHyX8VNQGE9SA0S9rWHDlfAyQjeeghnAQ0Pdqd/Bw3Hhh04ExtVvO6w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XNAmzhW4ZINLLfVPX98uPV47De+X5lYWvXvGuO4KyNc=; b=WnlLvFpw03QdStsIlnRNdz/MaKdzT2TLXaivYiyCt00JlaB+IWVdqDK9bnOIDSZEUOh+XKzyO20a0ZKuXzHzEKf53hqrqD3J9wEwdCXrUYeKi56yyZtUID89ApcpVhkNvVHMnXIrbsit5hULtKNioRLzZsOgVDJXRjUe5QrL4Is= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=oracle.com; Received: from BYAPR10MB3240.namprd10.prod.outlook.com (2603:10b6:a03:155::17) by BYAPR10MB2805.namprd10.prod.outlook.com (2603:10b6:a03:8b::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.20; Tue, 6 Jul 2021 16:53:00 +0000 Received: from BYAPR10MB3240.namprd10.prod.outlook.com ([fe80::59e7:5c8c:71fb:a6ba]) by BYAPR10MB3240.namprd10.prod.outlook.com ([fe80::59e7:5c8c:71fb:a6ba%7]) with mapi id 15.20.4287.033; Tue, 6 Jul 2021 16:53:00 +0000 From: Steve Sistare To: qemu-devel@nongnu.org Subject: [PATCH V4 13/25] cpr: HMP interfaces for restart Date: Tue, 6 Jul 2021 09:45:44 -0700 Message-Id: <1625589956-81651-14-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1625589956-81651-1-git-send-email-steven.sistare@oracle.com> References: <1625589956-81651-1-git-send-email-steven.sistare@oracle.com> X-ClientProxiedBy: SN4PR0201CA0041.namprd02.prod.outlook.com (2603:10b6:803:2e::27) To BYAPR10MB3240.namprd10.prod.outlook.com (2603:10b6:a03:155::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from ca-dev63.us.oracle.com (148.87.23.4) by SN4PR0201CA0041.namprd02.prod.outlook.com (2603:10b6:803:2e::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.19 via Frontend Transport; Tue, 6 Jul 2021 16:52:58 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: eeca880e-d465-40e4-5022-08d9409e835c X-MS-TrafficTypeDiagnostic: BYAPR10MB2805: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:327; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8hlEqjrAdOmhV1y8sG0emJ1ujWPOv4uLbaIcg0RoAde4LCAcpL1bk9u/I/MpVmzQKLiSb7L0wcG4SlqHdU4zpK2CaUKtfJdkOOj8cRx/CCAn6WS505KipM+5fMXgFrpSbZwVsInBNaaze3R3T1zZYhZYbrb2/htweKg4cHzuAEI0AP7HP3hC9QgZG1O1U6wM7MKOUR7aoUyVO+4ZZ97CVk/z56JVfmxaZEYSKdZx/S+qM5yXpvB4rj10j2OLBOxk2qywe8B3rCRtqyodEpbGVFiIHPfQOUikxkSPYNVcsDAaZvEdvw+6a+ymy6fCpQoAkmstjxnieoB/fn77uWhsaP4nwHSe4orkkeWnwuArRRXR6kJJgkajwalQkr+IDS12fkxSfBYSggh3aKUsr2oyALsd11ZD4zJEeNCClWU8bNifxkE4WPvWy3jMA6jAAhIWekbVARhI9Kd6sWWb+7IBx9DuJ2Qj6E0TTW2Vx9VaRM4KICQQBGtXeXMPWIne60yt04HEddKLAcmlH3HdwP0cIvrjmg2YUx9HbAPIQRZ7EvJy1nxvhap9mRFgRYaQBW3vwYhYk5edL++sot7q7kY07TFG9Zc9TUKwR6PInwTANtN2JtRk2TWUjOjAHNC8//4pemEyb5W1p9sHNyxzznwLp1akuPpXOMUMx9wen8teJ5w97hzAJXugBJkXjYXKvkuSQT/29M7QhL9lZzLuOcZOpA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB3240.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(39860400002)(376002)(346002)(396003)(366004)(4326008)(2616005)(54906003)(26005)(107886003)(5660300002)(83380400001)(6486002)(7696005)(186003)(66946007)(66476007)(66556008)(52116002)(956004)(86362001)(6916009)(7416002)(36756003)(316002)(38100700002)(6666004)(38350700002)(2906002)(8676002)(478600001)(8936002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: scIYqEqcSFvXTUVBxrqLJJ79NCuA+k/v3fEnePjG0ipEjTWfPu3TtNye7QyAYsG4SJ1mJo2ET0UdmOkFXTL/ah0D07kuTfH4Frh3HxOLra95t1YAyDSZVyLep6qFXtO7rAHcDhNEhKmKo9KbqIQaOKOsx7Hu17ngefxTz0ysTFnjn38X37jWJmlkrBB0JOsdVWev7kh6DjE7bT2/L+tdE6QOvzsvSMQsK4EeBCMQJA9JKrDVwrGwNVnFeVxwqiJejGRm7Q0XQwRxDVNFqkXGH63DdhU6C0MJ43pTw2CJuoqBP90iMOydCB6PHYP0bpbrgd+I6ZIp8gnjjknpyTMwDg05cjFdEHrwlZH6qrcwL/RjBEeslKnPqxLJjXT6l22jgSw6Cb0lVrOxktkrh2zrYj/hIwPnZJLVCI1w7Z7ZG6pBy9L2GTOhG9k1kOrFxaCN+LQMptgq8K3AyImYcBHpSXo0SUvqvno6g6Ve8r4sScxZA+p/++m9B9kah2PBiGkIe5A7eHItFYBN4E/cVG2sinVlP/aBgTg0o3qqAuwwO0pJ8D9I9k/aSRNfXZKREEuhzEUr4gI9lHhRg8U5fojhqTsFVfJhUrdgRl/wDVSFUITXaoWLCY8AZRt2yQ8OZXfXvU005N5kPblaxtaFoAEgHlf0e33xfIKAnwrE4lk256ND0V908opHbIynJe4QTP6odSgV29OmjPMgYb6tmRTh+TcK27VqTxhG+V2FFfbRfA3pV0x9Kfy5+K495mcISOPM5nNiqBhZLvA93KGN1/u1YU7vmNcqjWoaAoVW33TOCdqyDhPQHCWq9WnaW/1HsvCBtjrbU+F1sEIpGfTIwNiuVsXGOX1XLbn0rr7rh+3GyOgNKsFVLWzeF8xGbAV0dKaPXgim+6BwnP8PMD5MBtZ4aLHuBzzHim8MJ3sJwYj1FG4kaBJO58cj8kVGMysyzGXTXORRNUk4vFaooMQ0KqTd1OLarN3s26TqunHjbBHPlRpWr1LJbEZIA/75/WGDKyckesH/7z/jsg4tnmrLc9IBVSG/PzDL9GrmovGEGRsL4WZXis52RuHxl0B1VvHCfViMZpJnj1Yy6TmRDB3QAxi2GooXuuxwL9+xgmMblJZFRW/NpwpHZix0wWzsYzEbK7gUlgGsW8XvoTrmg0fhz2Mrd6gVKh3bTVpvmNgvlEE7buo14R48OSCXag7ECigsFxT3zGd4NZFA0AM3rLP3hhJlrszPEPUbvn28CyuW+FKkptEGq5DmWIpgogIIvB97w9fGLmAwGmVEXKLB4ckktbexMRpJAdQyf/1t4GwjdDjY5ZYhzJtm4FRuwcHuI4OTCPtA X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: eeca880e-d465-40e4-5022-08d9409e835c X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3240.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jul 2021 16:53:00.3640 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9paNMDNAO2ZWBmJj6iejkZFfVQOBPDj5w4F6W7H/W8QV57WWELHCEnyoMXTKDFPatxAEfChzPn39e4uIMW4/wlt/7FHCLxSiIIKF5ZvbxgA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR10MB2805 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10037 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 spamscore=0 adultscore=0 malwarescore=0 mlxscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2107060079 X-Proofpoint-ORIG-GUID: 7yGELa2Jl4UH6K3p7PW6eXXIuveHTnBw X-Proofpoint-GUID: 7yGELa2Jl4UH6K3p7PW6eXXIuveHTnBw 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Daniel P. Berrange" , "Michael S. Tsirkin" , Jason Zeng , =?utf-8?q?Alex_Benn=C3=A9e?= , Juan Quintela , "Dr. David Alan Gilbert" , Eric Blake , Markus Armbruster , Alex Williamson , Steve Sistare , Stefan Hajnoczi , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" cprsave mode may be "restart" cprexec Call cprexec(). Arguments: command : command line to execute, with space-separated arguments Signed-off-by: Steve Sistare --- hmp-commands.hx | 20 +++++++++++++++++++- include/monitor/hmp.h | 1 + monitor/hmp-cmds.c | 11 +++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index 015faae..1066fe7 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -366,7 +366,7 @@ ERST { .name = "cprsave", .args_type = "file:s,mode:s", - .params = "file 'reboot'", + .params = "file 'restart'|'reboot'", .help = "create a checkpoint of the VM in file", .cmd = hmp_cprsave, }, @@ -379,6 +379,24 @@ If *mode* is 'reboot', the checkpoint remains valid after a host kexec reboot, and guest ram must be backed by persistant shared memory. To resume from the checkpoint, issue the quit command, reboot the system, and issue the cprload command. + +If *mode* is 'restart', the checkpoint remains valid after restarting qemu, +and guest ram must be allocated with the memfd-alloc machine option. To +resume from the checkpoint, issue the cprexec command to restart, and issue +the cprload command. +ERST + + { + .name = "cprexec", + .args_type = "command:S", + .params = "command", + .help = "Restart qemu by directly exec'ing command", + .cmd = hmp_cprexec, + }, + +SRST +``cprexec`` *command* +Restart qemu by directly exec'ing *command*, replacing the qemu process. ERST { diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index e4ebdf1..c26d0d7 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -60,6 +60,7 @@ void hmp_savevm(Monitor *mon, const QDict *qdict); void hmp_delvm(Monitor *mon, const QDict *qdict); void hmp_cprinfo(Monitor *mon, const QDict *qdict); void hmp_cprsave(Monitor *mon, const QDict *qdict); +void hmp_cprexec(Monitor *mon, const QDict *qdict); void hmp_cprload(Monitor *mon, const QDict *qdict); void hmp_migrate_cancel(Monitor *mon, const QDict *qdict); void hmp_migrate_continue(Monitor *mon, const QDict *qdict); diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index f902dcf..adffe80 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -1213,6 +1213,17 @@ out: hmp_handle_error(mon, err); } +void hmp_cprexec(Monitor *mon, const QDict *qdict) +{ + Error *err = NULL; + const char *command = qdict_get_try_str(qdict, "command"); + strList *args = strList_from_string(command, ' '); + + qmp_cprexec(args, &err); + qapi_free_strList(args); + hmp_handle_error(mon, err); +} + void hmp_cprload(Monitor *mon, const QDict *qdict) { Error *err = NULL;