From patchwork Tue Sep 1 09:14:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lukas Straub X-Patchwork-Id: 1354853 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=web.de Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=web.de header.i=@web.de header.a=rsa-sha256 header.s=dbaedf251592 header.b=nIiUSeou; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 4BghYF280kz9sTC for ; Tue, 1 Sep 2020 19:27:13 +1000 (AEST) Received: from localhost ([::1]:51590 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kD2ZK-0002il-Fe for incoming@patchwork.ozlabs.org; Tue, 01 Sep 2020 05:27:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34604) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kD2Nm-0001uG-4M; Tue, 01 Sep 2020 05:15:14 -0400 Received: from mout.web.de ([217.72.192.78]:36267) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kD2Nj-00079G-PP; Tue, 01 Sep 2020 05:15:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1598951704; bh=wtMDis1BYzeS7drdCGqGv2ljKzWp8Uzppju5xOiz3tI=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject; b=nIiUSeouw48NPAOtv0ejiGKtUzSBqIid7RMrlXHPMGrSbkhrxqd4O+Qn/vvF/TD5R F2h90AfTH4Dr33hbSZFmlaFuwMFdNwx5BmAo6DwhGSU79ojJQiwnsnPsPzRahqviJJ EHRIM+vVpQ5d5e1fPLY2rAd0ZuYlB/3O2MMVbScc= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Received: from luklap ([88.130.61.220]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MRl5x-1k2QM52LLF-00Sxx9; Tue, 01 Sep 2020 11:15:04 +0200 Date: Tue, 1 Sep 2020 11:14:54 +0200 From: Lukas Straub To: qemu-devel Subject: [PATCH v8 0/8] Introduce 'yank' oob qmp command to recover from hanging qemu Message-ID: MIME-Version: 1.0 X-Provags-ID: V03:K1:oJZxiroF7OjdWI5zsz0WgbtBrhb6EcVB5FPdRxc8kmw06U0cACU TYbv4Q+W+nXdBTQKx3RzAw9Eokaji2XV39LfVD1hvSbUNUAE/gj/ecb/C57quTtvgTKhJAT MMabr01CVi26K3xABnBUPYkgTXL5KCiuJ9jB3/mMqPH2iEa8SVlrJFdC0o6qHSVM02OXTAk cCa4PKozpmeJZT8CQOhnw== X-UI-Out-Filterresults: notjunk:1;V03:K0:FOf89QtXRr8=:PWHo4zm+kIOn/Kla9tiIlb a+RtP2oe9CX9Fg4F6j6+5JR9VvyKxPeMxZyr+DMM/yJS1DJvNFotCteKEAXU6lknmKoLzYn/7 M6bWcFiiVPCp9yQj2kwCY8bB02CHw+XXbID5Kb0SsDcb+r9yOS9DjgmpSuRfqm660/tJjtzML 9qdQv7z6z/v5jE2JVdj7qwAZbISOlYwR6+BG/kwlsum0uZ8uvr7zznI8IZn97ppEN+2438Mnp dk9RMrtEIFjDcHI7EpqDbMr66yCtPOlO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@web.de; helo=mout.web.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/01 05:15:08 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.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=-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: Kevin Wolf , "Daniel P. =?utf-8?b?QmVycmFuZ8Op?= " , qemu-block , Juan Quintela , Markus Armbruster , "Dr. David Alan Gilbert" , Max Reitz , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9?= Lureau Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Hello Everyone, So here is v8. We still need ACKs from NBD and chardev maintainers. Changes: v8: -add Reviewed-by and Acked-by tags -rebase onto master -minor change to migration -convert to meson -change "Since:" to 5.2 -varios code style fixes (Markus Armbruster) -point to oob restrictions in comment to yank_register_function (Markus Armbruster) -improve qmp documentation (Markus Armbruster) -document oob suitability of qio_channel and io_shutdown (Markus Armbruster) v7: -yank_register_instance now returns error via Error **errp instead of aborting -dropped "chardev/char.c: Check for duplicate id before creating chardev" v6: -add Reviewed-by and Acked-by tags -rebase on master -lots of changes in nbd due to rebase -only take maintainership of util/yank.c and include/qemu/yank.h (Daniel P. Berrangé) -fix a crash discovered by the newly added chardev test -fix the test itself 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 Overview: 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 Lukas Straub (8): 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 qmp oob suitability of qio_channel_shutdown and io_shutdown MAINTAINERS: Add myself as maintainer for yank feature tests/test-char.c: Wait for the chardev to connect in char_socket_client_dupid_test MAINTAINERS | 6 ++ block/nbd.c | 129 ++++++++++++++--------- chardev/char-socket.c | 31 ++++++ include/io/channel.h | 5 +- include/qemu/yank.h | 81 +++++++++++++++ io/channel-tls.c | 6 +- migration/channel.c | 12 +++ migration/migration.c | 25 +++++ migration/multifd.c | 10 ++ migration/qemu-file-channel.c | 6 ++ migration/savevm.c | 6 ++ qapi/misc.json | 62 +++++++++++ tests/test-char.c | 1 + util/meson.build | 1 + util/yank.c | 187 ++++++++++++++++++++++++++++++++++ 15 files changed, 516 insertions(+), 52 deletions(-) create mode 100644 include/qemu/yank.h create mode 100644 util/yank.c --- 2.20.1