From: Michael Ellerman <michael@ellerman.id.au>
To: Miche Baker-Harvey <miche@google.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>,
Greg Kroah-Hartman <gregkh@suse.de>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
Rusty Russell <rusty@rustcorp.com.au>,
linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org,
xen-devel@lists.xensource.com, Anton Blanchard <anton@samba.org>,
Amit Shah <amit.shah@redhat.com>,
Mike Waychison <mikew@google.com>,
ppc-dev <linuxppc-dev@lists.ozlabs.org>,
Eric Northrup <digitaleric@google.com>
Subject: Re: [PATCH v3 3/3] Use separate struct console structure for each hvc_console.
Date: Wed, 09 Nov 2011 19:05:12 +1100 [thread overview]
Message-ID: <1320825912.9376.72.camel@concordia> (raw)
In-Reply-To: <20111108214509.28884.98169.stgit@miche.sea.corp.google.com>
[-- Attachment #1: Type: text/plain, Size: 2758 bytes --]
On Tue, 2011-11-08 at 13:45 -0800, Miche Baker-Harvey wrote:
> It is possible to make any virtio_console port be a console
> by sending VIRITO_CONSOLE_CONSOLE_PORT. But hvc_alloc was
> using a single struct console hvc_console, which contains
> both an index and flags which are per-port.
>
> This adds a separate struct console for each virtio_console
> that is CONSOLE_PORT.
Hi Miche,
I'm testing this on powerpc and unfortunately it's working a little _too
well_. I end up with two struct consoles registered and so I get every
line of output twice :)
The problem is that we're registering two struct consoles. The first
obviously is hvc_console, either in hvc_console_init(), or in my case
from hvc_instantiate().
Then we register the allocated one in hvc_alloc(). But because they both
point back to the same hardware you get duplicate output.
We _do_ want to register a console early, in either/both
hvc_console_init() and hvc_instantiate(), because we want to have
console during boot prior to when hvc_alloc() gets called.
I think maybe we should be checking in hvc_alloc() whether we already
have hvc_console associated with the vtermno and if so we use
hvc_console instead of allocating a new one.
Patch below to do that, and works for me, but it's a bit of a hack,
there must be a better solution.
Finally I'm not sure how your patch affects the code in hvc_poll() which
checks hvc_console.index to do the SYSRQ hack.
cheers
diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c
index fff35da..b249195 100644
--- a/drivers/tty/hvc/hvc_console.c
+++ b/drivers/tty/hvc/hvc_console.c
@@ -815,13 +815,15 @@ struct hvc_struct *hvc_alloc(uint32_t vtermno, int data,
kref_init(&hp->kref);
INIT_WORK(&hp->tty_resize, hvc_set_winsz);
- /*
- * Make each console its own struct console.
- */
- cp = kmemdup(&hvc_console, sizeof(*cp), GFP_KERNEL);
- if (!cp) {
- kfree(hp);
- return ERR_PTR(-ENOMEM);
+
+ if (hvc_console.index >= 0 && vtermnos[hvc_console.index] == hp->vtermno)
+ cp = &hvc_console;
+ else {
+ cp = kmemdup(&hvc_console, sizeof(*cp), GFP_KERNEL);
+ if (!cp) {
+ kfree(hp);
+ return ERR_PTR(-ENOMEM);
+ }
}
hp->hvc_console = cp;
@@ -850,7 +852,9 @@ struct hvc_struct *hvc_alloc(uint32_t vtermno, int data,
list_add_tail(&(hp->next), &hvc_structs);
spin_unlock(&hvc_structs_lock);
- register_console(cp);
+
+ if (cp != &hvc_console)
+ register_console(cp);
return hp;
}
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
prev parent reply other threads:[~2011-11-09 8:05 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-08 21:44 [PATCH RFC v3 0/3] Support multiple VirtioConsoles Miche Baker-Harvey
2011-11-08 21:44 ` [PATCH v3 1/3] virtio_console: Fix locking of vtermno Miche Baker-Harvey
2011-11-11 4:27 ` Rusty Russell
2011-11-17 19:09 ` Amit Shah
2011-11-08 21:45 ` [PATCH v3 2/3] hvc_init(): Enforce one-time initialization Miche Baker-Harvey
2011-11-09 7:24 ` Michael Ellerman
2011-11-11 4:30 ` Rusty Russell
2011-11-17 18:57 ` Miche Baker-Harvey
2011-11-21 5:01 ` Rusty Russell
2011-11-21 22:16 ` Miche Baker-Harvey
2011-11-22 0:58 ` Rusty Russell
2011-11-23 10:38 ` Amit Shah
2011-11-23 12:56 ` Amit Shah
2011-11-23 13:06 ` Sasha Levin
2011-11-23 13:15 ` Amit Shah
2011-11-28 23:40 ` Miche Baker-Harvey
2011-11-29 14:21 ` Amit Shah
2011-11-29 17:04 ` Miche Baker-Harvey
2011-11-29 17:50 ` Miche Baker-Harvey
2011-12-05 10:54 ` Amit Shah
2011-12-06 17:05 ` Miche Baker-Harvey
2011-12-08 12:08 ` Amit Shah
2011-12-12 19:11 ` Miche Baker-Harvey
2011-12-12 19:25 ` Amit Shah
2011-12-16 6:00 ` Amit Shah
2011-11-08 21:45 ` [PATCH v3 3/3] Use separate struct console structure for each hvc_console Miche Baker-Harvey
2011-11-09 8:05 ` Michael Ellerman [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1320825912.9376.72.camel@concordia \
--to=michael@ellerman.id.au \
--cc=amit.shah@redhat.com \
--cc=anton@samba.org \
--cc=digitaleric@google.com \
--cc=gregkh@suse.de \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=miche@google.com \
--cc=mikew@google.com \
--cc=rusty@rustcorp.com.au \
--cc=sfr@canb.auug.org.au \
--cc=virtualization@lists.linux-foundation.org \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).