All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] console: allocate ring buffer earlier
@ 2014-12-09 17:34 Jan Beulich
  2014-12-11 12:08 ` Ian Campbell
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2014-12-09 17:34 UTC (permalink / raw)
  To: xen-devel
  Cc: Keir Fraser, Ian Jackson, Stefano Stabellini, Tim Deegan,
	Ian Campbell

[-- Attachment #1: Type: text/plain, Size: 2877 bytes --]

... when "conring_size=" 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.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
v2: Also adjust ARM (as requested by Julien). Rename new function to
    console_init_ring().

--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -745,6 +745,7 @@ void __init start_xen(unsigned long boot
 
     dt_uart_init();
     console_init_preirq();
+    console_init_ring();
 
     system_state = SYS_STATE_boot;
 
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1187,6 +1187,7 @@ void __init noreturn __start_xen(unsigne
     }
 
     vm_init();
+    console_init_ring();
     vesa_init();
 
     softirq_init();
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -744,15 +744,14 @@ void __init console_init_preirq(void)
     }
 }
 
-void __init console_init_postirq(void)
+void __init console_init_ring(void)
 {
     char *ring;
     unsigned int i, order, memflags;
-
-    serial_init_postirq();
+    unsigned long flags;
 
     if ( !opt_conring_size )
-        opt_conring_size = num_present_cpus() << (9 + xenlog_lower_thresh);
+        return;
 
     order = get_order_from_bytes(max(opt_conring_size, conring_size));
     memflags = MEMF_bits(crashinfo_maxaddr_bits);
@@ -763,17 +762,30 @@ void __init console_init_postirq(void)
     }
     opt_conring_size = PAGE_SIZE << order;
 
-    spin_lock_irq(&console_lock);
+    spin_lock_irqsave(&console_lock, flags);
     for ( i = conringc ; i != conringp; i++ )
         ring[i & (opt_conring_size - 1)] = conring[i & (conring_size - 1)];
     conring = ring;
     smp_wmb(); /* Allow users of console_force_unlock() to see larger buffer. */
     conring_size = opt_conring_size;
-    spin_unlock_irq(&console_lock);
+    spin_unlock_irqrestore(&console_lock, flags);
 
     printk("Allocated console ring of %u KiB.\n", opt_conring_size >> 10);
 }
 
+void __init console_init_postirq(void)
+{
+    serial_init_postirq();
+
+    if ( conring != _conring )
+        return;
+
+    if ( !opt_conring_size )
+        opt_conring_size = num_present_cpus() << (9 + xenlog_lower_thresh);
+
+    console_init_ring();
+}
+
 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);
 
 void console_init_preirq(void);
+void console_init_ring(void);
 void console_init_postirq(void);
 void console_endboot(void);
 int console_has(const char *device);




[-- Attachment #2: conring-alloc-earlier.patch --]
[-- Type: text/plain, Size: 2912 bytes --]

console: allocate ring buffer earlier

... when "conring_size=" 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.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
v2: Also adjust ARM (as requested by Julien). Rename new function to
    console_init_ring().

--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -745,6 +745,7 @@ void __init start_xen(unsigned long boot
 
     dt_uart_init();
     console_init_preirq();
+    console_init_ring();
 
     system_state = SYS_STATE_boot;
 
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1187,6 +1187,7 @@ void __init noreturn __start_xen(unsigne
     }
 
     vm_init();
+    console_init_ring();
     vesa_init();
 
     softirq_init();
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -744,15 +744,14 @@ void __init console_init_preirq(void)
     }
 }
 
-void __init console_init_postirq(void)
+void __init console_init_ring(void)
 {
     char *ring;
     unsigned int i, order, memflags;
-
-    serial_init_postirq();
+    unsigned long flags;
 
     if ( !opt_conring_size )
-        opt_conring_size = num_present_cpus() << (9 + xenlog_lower_thresh);
+        return;
 
     order = get_order_from_bytes(max(opt_conring_size, conring_size));
     memflags = MEMF_bits(crashinfo_maxaddr_bits);
@@ -763,17 +762,30 @@ void __init console_init_postirq(void)
     }
     opt_conring_size = PAGE_SIZE << order;
 
-    spin_lock_irq(&console_lock);
+    spin_lock_irqsave(&console_lock, flags);
     for ( i = conringc ; i != conringp; i++ )
         ring[i & (opt_conring_size - 1)] = conring[i & (conring_size - 1)];
     conring = ring;
     smp_wmb(); /* Allow users of console_force_unlock() to see larger buffer. */
     conring_size = opt_conring_size;
-    spin_unlock_irq(&console_lock);
+    spin_unlock_irqrestore(&console_lock, flags);
 
     printk("Allocated console ring of %u KiB.\n", opt_conring_size >> 10);
 }
 
+void __init console_init_postirq(void)
+{
+    serial_init_postirq();
+
+    if ( conring != _conring )
+        return;
+
+    if ( !opt_conring_size )
+        opt_conring_size = num_present_cpus() << (9 + xenlog_lower_thresh);
+
+    console_init_ring();
+}
+
 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);
 
 void console_init_preirq(void);
+void console_init_ring(void);
 void console_init_postirq(void);
 void console_endboot(void);
 int console_has(const char *device);

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] console: allocate ring buffer earlier
  2014-12-09 17:34 [PATCH v2] console: allocate ring buffer earlier Jan Beulich
@ 2014-12-11 12:08 ` Ian Campbell
  2014-12-18  1:55   ` Don Slutz
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Campbell @ 2014-12-11 12:08 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Keir Fraser, Tim Deegan, Stefano Stabellini, Ian Jackson,
	xen-devel

On Tue, 2014-12-09 at 17:34 +0000, Jan Beulich wrote:
> ... when "conring_size=" 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.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Ian Campbell <ian.campbell@citrix.com> (ARM  and generic bits)

> ---
> v2: Also adjust ARM (as requested by Julien). Rename new function to
>     console_init_ring().
> 
> --- a/xen/arch/arm/setup.c
> +++ b/xen/arch/arm/setup.c
> @@ -745,6 +745,7 @@ void __init start_xen(unsigned long boot
>  
>      dt_uart_init();
>      console_init_preirq();
> +    console_init_ring();
>  
>      system_state = SYS_STATE_boot;
>  
> --- a/xen/arch/x86/setup.c
> +++ b/xen/arch/x86/setup.c
> @@ -1187,6 +1187,7 @@ void __init noreturn __start_xen(unsigne
>      }
>  
>      vm_init();
> +    console_init_ring();
>      vesa_init();
>  
>      softirq_init();
> --- a/xen/drivers/char/console.c
> +++ b/xen/drivers/char/console.c
> @@ -744,15 +744,14 @@ void __init console_init_preirq(void)
>      }
>  }
>  
> -void __init console_init_postirq(void)
> +void __init console_init_ring(void)
>  {
>      char *ring;
>      unsigned int i, order, memflags;
> -
> -    serial_init_postirq();
> +    unsigned long flags;
>  
>      if ( !opt_conring_size )
> -        opt_conring_size = num_present_cpus() << (9 + xenlog_lower_thresh);
> +        return;
>  
>      order = get_order_from_bytes(max(opt_conring_size, conring_size));
>      memflags = MEMF_bits(crashinfo_maxaddr_bits);
> @@ -763,17 +762,30 @@ void __init console_init_postirq(void)
>      }
>      opt_conring_size = PAGE_SIZE << order;
>  
> -    spin_lock_irq(&console_lock);
> +    spin_lock_irqsave(&console_lock, flags);
>      for ( i = conringc ; i != conringp; i++ )
>          ring[i & (opt_conring_size - 1)] = conring[i & (conring_size - 1)];
>      conring = ring;
>      smp_wmb(); /* Allow users of console_force_unlock() to see larger buffer. */
>      conring_size = opt_conring_size;
> -    spin_unlock_irq(&console_lock);
> +    spin_unlock_irqrestore(&console_lock, flags);
>  
>      printk("Allocated console ring of %u KiB.\n", opt_conring_size >> 10);
>  }
>  
> +void __init console_init_postirq(void)
> +{
> +    serial_init_postirq();
> +
> +    if ( conring != _conring )
> +        return;
> +
> +    if ( !opt_conring_size )
> +        opt_conring_size = num_present_cpus() << (9 + xenlog_lower_thresh);
> +
> +    console_init_ring();
> +}
> +
>  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);
>  
>  void console_init_preirq(void);
> +void console_init_ring(void);
>  void console_init_postirq(void);
>  void console_endboot(void);
>  int console_has(const char *device);
> 
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] console: allocate ring buffer earlier
  2014-12-11 12:08 ` Ian Campbell
@ 2014-12-18  1:55   ` Don Slutz
  0 siblings, 0 replies; 3+ messages in thread
From: Don Slutz @ 2014-12-18  1:55 UTC (permalink / raw)
  To: Ian Campbell, Jan Beulich
  Cc: Tim Deegan, xen-devel, Keir Fraser, Ian Jackson,
	Stefano Stabellini

On 12/11/14 07:08, Ian Campbell wrote:
> On Tue, 2014-12-09 at 17:34 +0000, Jan Beulich wrote:
>> ... when "conring_size=" 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.
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> Acked-by: Ian Campbell <ian.campbell@citrix.com> (ARM  and generic bits)
> 

This change looks good to me, so:

Reviewed-by: Don Slutz <dslutz@verizon.com>

  -Don Slutz

>> ---
>> v2: Also adjust ARM (as requested by Julien). Rename new function to
>>     console_init_ring().
>>
>> --- a/xen/arch/arm/setup.c
>> +++ b/xen/arch/arm/setup.c
>> @@ -745,6 +745,7 @@ void __init start_xen(unsigned long boot
>>  
>>      dt_uart_init();
>>      console_init_preirq();
>> +    console_init_ring();
>>  
>>      system_state = SYS_STATE_boot;
>>  
>> --- a/xen/arch/x86/setup.c
>> +++ b/xen/arch/x86/setup.c
>> @@ -1187,6 +1187,7 @@ void __init noreturn __start_xen(unsigne
>>      }
>>  
>>      vm_init();
>> +    console_init_ring();
>>      vesa_init();
>>  
>>      softirq_init();
>> --- a/xen/drivers/char/console.c
>> +++ b/xen/drivers/char/console.c
>> @@ -744,15 +744,14 @@ void __init console_init_preirq(void)
>>      }
>>  }
>>  
>> -void __init console_init_postirq(void)
>> +void __init console_init_ring(void)
>>  {
>>      char *ring;
>>      unsigned int i, order, memflags;
>> -
>> -    serial_init_postirq();
>> +    unsigned long flags;
>>  
>>      if ( !opt_conring_size )
>> -        opt_conring_size = num_present_cpus() << (9 + xenlog_lower_thresh);
>> +        return;
>>  
>>      order = get_order_from_bytes(max(opt_conring_size, conring_size));
>>      memflags = MEMF_bits(crashinfo_maxaddr_bits);
>> @@ -763,17 +762,30 @@ void __init console_init_postirq(void)
>>      }
>>      opt_conring_size = PAGE_SIZE << order;
>>  
>> -    spin_lock_irq(&console_lock);
>> +    spin_lock_irqsave(&console_lock, flags);
>>      for ( i = conringc ; i != conringp; i++ )
>>          ring[i & (opt_conring_size - 1)] = conring[i & (conring_size - 1)];
>>      conring = ring;
>>      smp_wmb(); /* Allow users of console_force_unlock() to see larger buffer. */
>>      conring_size = opt_conring_size;
>> -    spin_unlock_irq(&console_lock);
>> +    spin_unlock_irqrestore(&console_lock, flags);
>>  
>>      printk("Allocated console ring of %u KiB.\n", opt_conring_size >> 10);
>>  }
>>  
>> +void __init console_init_postirq(void)
>> +{
>> +    serial_init_postirq();
>> +
>> +    if ( conring != _conring )
>> +        return;
>> +
>> +    if ( !opt_conring_size )
>> +        opt_conring_size = num_present_cpus() << (9 + xenlog_lower_thresh);
>> +
>> +    console_init_ring();
>> +}
>> +
>>  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);
>>  
>>  void console_init_preirq(void);
>> +void console_init_ring(void);
>>  void console_init_postirq(void);
>>  void console_endboot(void);
>>  int console_has(const char *device);
>>
>>
>>
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-12-18  1:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-09 17:34 [PATCH v2] console: allocate ring buffer earlier Jan Beulich
2014-12-11 12:08 ` Ian Campbell
2014-12-18  1:55   ` Don Slutz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.