From patchwork Tue Jun 23 14:42:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Straub X-Patchwork-Id: 11620873 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BDCDB6C1 for ; Tue, 23 Jun 2020 14:45:49 +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 31EFB20720 for ; Tue, 23 Jun 2020 14:45:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=web.de header.i=@web.de header.b="Ch8QBjXA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 31EFB20720 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=web.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:58588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jnkBH-0006vu-PO for patchwork-qemu-devel@patchwork.kernel.org; Tue, 23 Jun 2020 10:45:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58342) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jnk8Q-0003q4-J5; Tue, 23 Jun 2020 10:42:50 -0400 Received: from mout.web.de ([217.72.192.78]:38165) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jnk8O-0002OR-Fk; Tue, 23 Jun 2020 10:42:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1592923359; bh=zU3tUlcfEiS1VRl2HTIV2XY+CU7mnQK3zvjyq4JYrQU=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject; b=Ch8QBjXAoiwoBUnSpR+b19FjnCtys6Fe6FfI48UIC5yWbkU1vgEa5xZ9QL+2C6X4z NsnRgo/sOme90SdZamHOyxllaHaFrCWX5S9VdLAK0n82bVLalE8qFsspQilFFZpWdS AFGOOuQ0kbf3E5sc3ErZhV/fpQmFTIy4O8Gv+hOU= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Received: from luklap ([88.130.61.8]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MSJKJ-1jPNtU1Dwp-00TXTJ; Tue, 23 Jun 2020 16:42:39 +0200 Date: Tue, 23 Jun 2020 16:42:30 +0200 From: Lukas Straub To: qemu-devel Subject: [PATCH v5 0/7] Introduce 'yank' oob qmp command to recover from hanging qemu Message-ID: MIME-Version: 1.0 X-Provags-ID: V03:K1:6NcYVHB39GveGzmUOrXYEBaxnK3d0/z+GR+MsokDIvZCjes2KRO 1wFy0sHFldU/9sZmbHGbvlkd2++YLmvFjuyVDdzguHnJCMT2e8h/b9wqakVtsooU9BOct4X NEOIsxJrC3jZh2+pmIjBvNPqK/Hn4pSc0sRSO6pgGmukYUQGcCyj4LzAhIMDk9LQIqSrN4O PV8dmqtQ7SSVeM2OQ7Z/w== X-UI-Out-Filterresults: notjunk:1;V03:K0:xqIwGPV2rt0=:mHggX/GeUCjrE8SDnVLKBd jDkwhdUF7xYS/s0kmimQ77Jt2m1PYR113SwZp3pZBfx4J3Y+iZXInFoe7AQMQtra+7tSeKnm7 gQ/OhhYYIzyaan3V2ogmjmvW4lrdxOHHW5TSPq2JzJiIGG3OYk6UqfVQZWbUbhq8c3p5mrRt7 RjFVzkZDS3HKq7cGKTXgxgbcQdBBzEquM2jIQenxfV+Mo+ErrIyJxW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72.192.78; envelope-from=lukasstraub2@web.de; helo=mout.web.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/23 10:42:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN 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: Kevin Wolf , "Daniel P. =?utf-8?b?QmVycmFuZ8Op?= " , qemu-block , Juan Quintela , "Dr. David Alan Gilbert" , Max Reitz , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9?= Lureau Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Hello Everyone, In many cases, if qemu has a network connection (qmp, migration, chardev, etc.) to some other server and that server dies or hangs, qemu hangs too. These patches introduce the new 'yank' out-of-band qmp command to recover from these kinds of hangs. The different subsystems register callbacks which get executed with the yank command. For example the callback can shutdown() a socket. This is intended for the colo use-case, but it can be used for other things too of course. Regards, Lukas Straub v5: -move yank.c to util/ -move yank.h to include/qemu/ -add license to yank.h -use const char* -nbd: use atomic_store_release and atomic_load_aqcuire -io-channel: ensure thread-safety and document it -add myself as maintainer for yank v4: -fix build errors... v3: -don't touch softmmu/vl.c, use __contructor__ attribute instead (Paolo Bonzini) -fix build errors -rewrite migration patch so it actually passes all tests v2: -don't touch io/ code anymore -always register yank functions -'yank' now takes a list of instances to yank -'query-yank' returns a list of yankable instances Lukas Straub (7): Introduce yank feature block/nbd.c: Add yank feature chardev/char-socket.c: Add yank feature migration: Add yank feature io/channel-tls.c: make qio_channel_tls_shutdown thread-safe io: Document thread-safety of qio_channel_shutdown MAINTAINERS: Add myself as maintainer for yank feature MAINTAINERS | 13 +++ block/nbd.c | 101 ++++++++++++------- chardev/char-socket.c | 24 +++++ include/io/channel.h | 2 + include/qemu/yank.h | 79 +++++++++++++++ io/channel-tls.c | 6 +- migration/channel.c | 12 +++ migration/migration.c | 18 +++- migration/multifd.c | 10 ++ migration/qemu-file-channel.c | 6 ++ migration/savevm.c | 2 + qapi/misc.json | 45 +++++++++ tests/Makefile.include | 2 +- util/Makefile.objs | 1 + util/yank.c | 179 ++++++++++++++++++++++++++++++++++ 15 files changed, 459 insertions(+), 41 deletions(-) create mode 100644 include/qemu/yank.h create mode 100644 util/yank.c Acked-by: Stefan Hajnoczi --- 2.20.1