WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Xen

xen-devel

[Top] [All Lists]

[Xen-devel] Re: [RFC PATCH 29/35] Add the Xen virtual console driver.

To: Chris Wright <chrisw@xxxxxxxxxxxx>
Subject: [Xen-devel] Re: [RFC PATCH 29/35] Add the Xen virtual console driver.
From: Andrew Morton <akpm@xxxxxxxx>
Date: 2006年5月13日 05:27:57 -0700
Cc: virtualization@xxxxxxxxxxxxxx, Christian.Limpach@xxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, ian.pratt@xxxxxxxxxxxxx
Delivery-date: 2006年5月15日 00:34:18 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20060509085159.285105000@xxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20060509084945.373541000@xxxxxxxxxxxx> <20060509085159.285105000@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On 2006年5月09日 00:00:29 -0700
Chris Wright <chrisw@xxxxxxxxxxxx> wrote:
> This provides a bootstrap and ongoing emergency console which is
> intended to be available from very early during boot and at all times
> thereafter, in contrast with alternatives such as UDP-based syslogd,
> or logging in via ssh. The protocol is based on a simple shared-memory
> ring buffer.
>
> ...
>
> +/* The kernel and user-land drivers share a common transmit buffer. */
> +static unsigned int wbuf_size = 4096;
> +#define WBUF_MASK(_i) ((_i)&(wbuf_size-1))
> +static char *wbuf;
> +static unsigned int wc, wp; /* write_cons, write_prod */
> +
> +static int __init xencons_bufsz_setup(char *str)
> +{
> + unsigned int goal;
> + goal = simple_strtoul(str, NULL, 0);
> + while (wbuf_size < goal)
> + wbuf_size <<= 1;
roundup_pow_of_two()
> +/* This lock protects accesses to the common transmit buffer. */
> +static spinlock_t xencons_lock = SPIN_LOCK_UNLOCKED;
DEFINE_SPINLOCK() (entire patchset)
> +
> +static void kcons_write(
> + struct console *c, const char *s, unsigned int count)
> +{
> + int i = 0;
> + unsigned long flags;
> +
> + spin_lock_irqsave(&xencons_lock, flags);
> +
> + while (i < count) {
> + for (; i < count; i++) {
> + if ((wp - wc) >= (wbuf_size - 1))
> + break;
> + if ((wbuf[WBUF_MASK(wp++)] = s[i]) == '\n')
> + wbuf[WBUF_MASK(wp++)] = '\r';
> + }
> +
> + __xencons_tx_flush();
> + }
> +
> + spin_unlock_irqrestore(&xencons_lock, flags);
> +}
hm. You have all that elaborate generate-ringbuffer-code-with-C-macros
stuff in the header file patch, yet this code (blessedly) doesn't use it.
> +static void kcons_write_dom0(
> + struct console *c, const char *s, unsigned int count)
> +{
> + int rc;
> +
> + while ((count > 0) &&
> + ((rc = HYPERVISOR_console_io(
> + CONSOLEIO_write, count, (char *)s)) > 0)) {
> + count -= rc;
> + s += rc;
> + }
> +}
must.. not.. mention.. coding.. style..
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
Previous by Date: [Xen-devel] Re: [RFC PATCH 24/35] Add support for Xen event channels. , Andrew Morton
Next by Date: [Xen-devel] Re: [RFC PATCH 33/35] Add the Xenbus sysfs and virtual device hotplug driver. , Andrew Morton
Previous by Thread: [Xen-devel] Re: [RFC PATCH 29/35] Add the Xen virtual console driver. , Christian Limpach
Next by Thread: [Xen-devel] Re: [RFC PATCH 29/35] Add the Xen virtual console driver. , Nick Piggin
Indexes: [Date] [Thread] [Top] [All Lists]

Copyright ©, Citrix Systems Inc. All rights reserved. Legal and Privacy
Citrix This site is hosted by Citrix

AltStyle によって変換されたページ (->オリジナル) /