From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sasha Levin Subject: Re: [PATCH] kvm tools: Allow remapping guest TTY into host PTS Date: Thu, 15 Sep 2011 15:28:46 +0300 Message-ID: <1316089726.3743.15.camel@lappy> References: <1316076790-4431-1-git-send-email-levinsasha928@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, mingo@elte.hu, asias.hejun@gmail.com, gorcunov@gmail.com, David Evensky To: Pekka Enberg Return-path: Received: from mail-fx0-f46.google.com ([209.85.161.46]:52899 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933473Ab1IOM3T (ORCPT ); Thu, 15 Sep 2011 08:29:19 -0400 Received: by fxe4 with SMTP id 4so600172fxe.19 for ; Thu, 15 Sep 2011 05:29:17 -0700 (PDT) In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On Thu, 2011-09-15 at 12:32 +0300, Pekka Enberg wrote: > On Thu, Sep 15, 2011 at 11:53 AM, Sasha Levin wrote: > > This patch adds the '-tty' option to 'kvm run' which allows the user to > > remap a guest TTY into a PTS on the host. > > > > Usage: > > 'kvm run --tty [id] [other options]' > > > > The tty will be mapped to a pts and will be printed on the screen: > > ' Info: Assigned terminal 1 to pty /dev/pts/X' > > > > At this point, it is possible to communicate with the guest using that pty. > > > > This is useful for debugging guest kernel using KGDB: > > > > 1. Run the guest: > > 'kvm run -k [vmlinuz] -p "kdbgoc=ttyS1 kdbgwait" --tty 1' > > > > And see which PTY got assigned to ttyS1. > > > > 2. Run GDB on the host: > > 'gdb [vmlinuz]' > > > > 3. Connect to the guest (from within GDB): > > 'target remote /dev/pty/X' > > > > 4. Start debugging! (enter 'continue' to continue boot). > > > > Cc: David Evensky > > Signed-off-by: Sasha Levin > > Neat! Would a tools/kvm/Documentation/debugging.txt be helpful for > people who want to do kernel debugging with kvmtool? I'll write a basic doc with the details provided above. David, does this patch allows you to properly debug guest kernels? If so, could you mail back any issues or hacks you had to do to set it up so I could add it to the doc and move it into 'Documentation/'? -- Sasha.