From: "Jan Beulich" Subject: [PATCH] console: allocate ring buffer earlier Date: Fri, 05 Dec 2014 16:55:24 +0000 Message-ID: <5481F18C020000780004D535@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part3207EA6C.1__=" Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XwwA8-0008Sb-IX for xen-devel@lists.xenproject.org; Fri, 05 Dec 2014 16:55:24 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Keir Fraser , Ian Jackson , Daniel Kiper , Tim Deegan , Ian Campbell List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part3207EA6C.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline ... when "conring_size=3D" was specified on the command line. We can't really do this as early as we would want to when the option was not specified, as the default depends on knowing the system CPU count. Yet the parsing of the ACPI tables is one of the things that generates a lot of output especially on large systems. I didn't change ARM, as I wasn't sure how far ahead this call could be pulled. Signed-off-by: Jan Beulich --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1187,6 +1187,7 @@ void __init noreturn __start_xen(unsigne } =20 vm_init(); + console_init_mem(); vesa_init(); =20 softirq_init(); --- a/xen/drivers/char/console.c +++ b/xen/drivers/char/console.c @@ -744,15 +744,14 @@ void __init console_init_preirq(void) } } =20 -void __init console_init_postirq(void) +void __init console_init_mem(void) { char *ring; unsigned int i, order, memflags; - - serial_init_postirq(); + unsigned long flags; =20 if ( !opt_conring_size ) - opt_conring_size =3D num_present_cpus() << (9 + xenlog_lower_thres= h); + return; =20 order =3D get_order_from_bytes(max(opt_conring_size, conring_size)); memflags =3D MEMF_bits(crashinfo_maxaddr_bits); @@ -763,17 +762,28 @@ void __init console_init_postirq(void) } opt_conring_size =3D PAGE_SIZE << order; =20 - spin_lock_irq(&console_lock); + spin_lock_irqsave(&console_lock, flags); for ( i =3D conringc ; i !=3D conringp; i++ ) ring[i & (opt_conring_size - 1)] =3D conring[i & (conring_size - = 1)]; conring =3D ring; smp_wmb(); /* Allow users of console_force_unlock() to see larger = buffer. */ conring_size =3D opt_conring_size; - spin_unlock_irq(&console_lock); + spin_unlock_irqrestore(&console_lock, flags); =20 printk("Allocated console ring of %u KiB.\n", opt_conring_size >> = 10); } =20 +void __init console_init_postirq(void) +{ + serial_init_postirq(); + + if ( !opt_conring_size ) + opt_conring_size =3D num_present_cpus() << (9 + xenlog_lower_thres= h); + + if ( conring =3D=3D _conring ) + console_init_mem(); +} + void __init console_endboot(void) { int i, j; --- a/xen/include/xen/console.h +++ b/xen/include/xen/console.h @@ -14,6 +14,7 @@ struct xen_sysctl_readconsole; long read_console_ring(struct xen_sysctl_readconsole *op); =20 void console_init_preirq(void); +void console_init_mem(void); void console_init_postirq(void); void console_endboot(void); int console_has(const char *device); --=__Part3207EA6C.1__= Content-Type: text/plain; name="conring-alloc-earlier.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="conring-alloc-earlier.patch" console: allocate ring buffer earlier=0A=0A... when "conring_size=3D" was = specified on the command line. We can't=0Areally do this as early as we = would want to when the option was not=0Aspecified, as the default depends = on knowing the system CPU count. Yet=0Athe parsing of the ACPI tables is = one of the things that generates a=0Alot of output especially on large = systems.=0A=0AI didn't change ARM, as I wasn't sure how far ahead this = call could be=0Apulled.=0A=0ASigned-off-by: Jan Beulich = =0A=0A--- a/xen/arch/x86/setup.c=0A+++ b/xen/arch/x86/setup.c=0A@@ -1187,6 = +1187,7 @@ void __init noreturn __start_xen(unsigne=0A }=0A =0A = vm_init();=0A+ console_init_mem();=0A vesa_init();=0A =0A = softirq_init();=0A--- a/xen/drivers/char/console.c=0A+++ b/xen/drivers/char= /console.c=0A@@ -744,15 +744,14 @@ void __init console_init_preirq(void)=0A= }=0A }=0A =0A-void __init console_init_postirq(void)=0A+void __init = console_init_mem(void)=0A {=0A char *ring;=0A unsigned int i, = order, memflags;=0A-=0A- serial_init_postirq();=0A+ unsigned long = flags;=0A =0A if ( !opt_conring_size )=0A- opt_conring_size =3D = num_present_cpus() << (9 + xenlog_lower_thresh);=0A+ return;=0A =0A = order =3D get_order_from_bytes(max(opt_conring_size, conring_size));=0A= memflags =3D MEMF_bits(crashinfo_maxaddr_bits);=0A@@ -763,17 +762,28 = @@ void __init console_init_postirq(void)=0A }=0A opt_conring_size = =3D PAGE_SIZE << order;=0A =0A- spin_lock_irq(&console_lock);=0A+ = spin_lock_irqsave(&console_lock, flags);=0A for ( i =3D conringc ; i = !=3D conringp; i++ )=0A ring[i & (opt_conring_size - 1)] =3D = conring[i & (conring_size - 1)];=0A conring =3D ring;=0A smp_wmb();= /* Allow users of console_force_unlock() to see larger buffer. */=0A = conring_size =3D opt_conring_size;=0A- spin_unlock_irq(&console_lock);= =0A+ spin_unlock_irqrestore(&console_lock, flags);=0A =0A printk("Al= located console ring of %u KiB.\n", opt_conring_size >> 10);=0A }=0A = =0A+void __init console_init_postirq(void)=0A+{=0A+ serial_init_postirq(= );=0A+=0A+ if ( !opt_conring_size )=0A+ opt_conring_size =3D = num_present_cpus() << (9 + xenlog_lower_thresh);=0A+=0A+ if ( conring = =3D=3D _conring )=0A+ console_init_mem();=0A+}=0A+=0A void __init = console_endboot(void)=0A {=0A int i, j;=0A--- a/xen/include/xen/console= .h=0A+++ b/xen/include/xen/console.h=0A@@ -14,6 +14,7 @@ struct xen_sysctl_= readconsole;=0A long read_console_ring(struct xen_sysctl_readconsole = *op);=0A =0A void console_init_preirq(void);=0A+void console_init_mem(void)= ;=0A void console_init_postirq(void);=0A void console_endboot(void);=0A = int console_has(const char *device);=0A --=__Part3207EA6C.1__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part3207EA6C.1__=--