From patchwork Fri Jul 5 09:59:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 11032353 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9A0EA13A4 for ; Fri, 5 Jul 2019 09:59:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A1BE28A80 for ; Fri, 5 Jul 2019 09:59:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7DB6E28A86; Fri, 5 Jul 2019 09:59:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 293EE28A80 for ; Fri, 5 Jul 2019 09:59:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727263AbfGEJ7V (ORCPT ); Fri, 5 Jul 2019 05:59:21 -0400 Received: from foss.arm.com ([217.140.110.172]:34682 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727991AbfGEJ7U (ORCPT ); Fri, 5 Jul 2019 05:59:20 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C3F0B1477; Fri, 5 Jul 2019 02:59:19 -0700 (PDT) Received: from donnerap.arm.com (donnerap.cambridge.arm.com [10.1.197.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 022663F246; Fri, 5 Jul 2019 02:59:18 -0700 (PDT) From: Andre Przywara To: Will Deacon , Julien Thierry Cc: kvm@vger.kernel.org, Dave Martin Subject: [PATCH kvmtool 0/2] Add terminal detach feature Date: Fri, 5 Jul 2019 10:59:12 +0100 Message-Id: <20190705095914.151056-1-andre.przywara@arm.com> X-Mailer: git-send-email 2.17.1 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP At the moment running a guest will tie it to the console where kvmtool is running on. So one cannot logout of the terminal without killing the guest. Existing workarounds are running in a terminal multiplexer like screen or using the --tty option to detach kvmtool from the very beginning. Both of these solutions need to be invoked at guest creation time, though. Patch 2 introduces a "detach" command, which can be invoked at any point during the guest's runtime using the terminal escape sequence ("Ctrl+A d" by default). This will redirect the guest's serial output to pseudo-terminals and detach the process from the console. More details in the commit message. Patch 1 contains a bugfix, which avoids the kvmtool terminal thread to hog the full CPU time because poll() is not exactly doing what we think it does. Please have a look and comment! Cheers, Andre Andre Przywara (2): term: Avoid busy loop with unconnected pseudoterminals Add detach feature builtin-run.c | 3 + include/kvm/kvm.h | 2 + term.c | 139 +++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 141 insertions(+), 3 deletions(-)