All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [1/4] put xen console message into syslog but xm dmesg is not affected
@ 2006-07-07  8:17 MINAI Katsuhito
  2006-07-10 15:00 ` Keir Fraser
  0 siblings, 1 reply; 6+ messages in thread
From: MINAI Katsuhito @ 2006-07-07  8:17 UTC (permalink / raw)
  To: Akio Takebe; +Cc: Hans-Christian Armingeon, xen-devel, Mark Williamson

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


[1/4] add read pointer to the xen console ring

Signed-off-by: Katsuhito Minai <minai@jp.fujitsu.com>


[-- Attachment #2: 1.consdev.patch --]
[-- Type: application/octet-stream, Size: 1860 bytes --]

diff -r 8e55c5c11475 xen/drivers/char/console.c
--- a/xen/drivers/char/console.c	Wed Jul 05 18:48:41 2006 +0100
+++ b/xen/drivers/char/console.c	Fri Jul 07 16:40:56 2006 +0900
@@ -217,19 +217,27 @@ static void putchar_console_ring(int c)
 static void putchar_console_ring(int c)
 {
     conring[CONRING_IDX_MASK(conringp++)] = c;
-    if ( (conringp - conringc) > CONRING_SIZE )
-        conringc = conringp - CONRING_SIZE;
 }
 
 long read_console_ring(XEN_GUEST_HANDLE(char) str, u32 *pcount, int clear)
 {
     unsigned int idx, len, max, sofar, c;
     unsigned long flags;
+    static int conringlogp = 0;
 
     max   = *pcount;
     sofar = 0;
 
-    c = conringc;
+    if (clear < 0) {
+        if ( (conringp - conringlogp) > CONRING_SIZE )
+            conringlogp = conringp - CONRING_SIZE;
+            c = conringlogp;
+    } else {
+        if ( (conringp - conringc) > CONRING_SIZE )
+            conringc = conringp - CONRING_SIZE;
+            c = conringc;
+    }
+
     while ( (c != conringp) && (sofar < max) )
     {
         idx = CONRING_IDX_MASK(c);
@@ -244,7 +252,7 @@ long read_console_ring(XEN_GUEST_HANDLE(
         c += len;
     }
 
-    if ( clear )
+    if ( clear > 0 )
     {
         spin_lock_irqsave(&console_lock, flags);
         if ( (conringp - c) > CONRING_SIZE )
@@ -252,7 +260,14 @@ long read_console_ring(XEN_GUEST_HANDLE(
         else
             conringc = c;
         spin_unlock_irqrestore(&console_lock, flags);
-    }
+    } else if ( clear < 0 ) {
+        spin_lock_irqsave(&console_lock, flags);
+        if ( (conringp - c) > CONRING_SIZE )
+            conringlogp = conringp - CONRING_SIZE;
+        else
+            conringlogp = c;
+        spin_unlock_irqrestore(&console_lock, flags);
+    }        
 
     *pcount = sofar;
     return 0;

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

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

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

* Re: [PATCH] [1/4] put xen console message into syslog but xm dmesg is not affected
  2006-07-07  8:17 [PATCH] [1/4] put xen console message into syslog but xm dmesg is not affected MINAI Katsuhito
@ 2006-07-10 15:00 ` Keir Fraser
  2006-07-11  1:28   ` MINAI Katsuhito
  0 siblings, 1 reply; 6+ messages in thread
From: Keir Fraser @ 2006-07-10 15:00 UTC (permalink / raw)
  To: MINAI Katsuhito
  Cc: Mark Williamson, Hans-Christian Armingeon, xen-devel, Akio Takebe


On 7 Jul 2006, at 09:17, MINAI Katsuhito wrote:

> [1/4] add read pointer to the xen console ring
>
> Signed-off-by: Katsuhito Minai <minai@jp.fujitsu.com>

Can you briefly explain the semantics of the modified console 
interface. I'd rather change the interface cleanly than abuse the 
'clear' field -- we've broken dom0_op compatibility since 3.0.2 anyway, 
so taking the cleaner route is definitely preferable.

  -- Keir

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

* Re: [PATCH] [1/4] put xen console message into syslog but xm dmesg is not affected
  2006-07-10 15:00 ` Keir Fraser
@ 2006-07-11  1:28   ` MINAI Katsuhito
  2006-07-11  6:42     ` Keir Fraser
  0 siblings, 1 reply; 6+ messages in thread
From: MINAI Katsuhito @ 2006-07-11  1:28 UTC (permalink / raw)
  To: Keir Fraser
  Cc: Mark Williamson, Hans-Christian Armingeon, xen-devel, Akio Takebe

Hi Keir

Thanks for your comments.
My modification is a simple reading interface that is independent
from the interface of "xc_readconsolering (clear/non-clear)"
that xm dmesg uses. It can be used if "clear" argument is
a negative value.

However, I also think that the "clear" interface is unnecessary.
I think that better solution is one of the following idea:
- modification to have independent read pointer of the buffer
  for each commands and daemons just like reading usual file.
  But, this might be difficult for hypervisor.
- modification to give the responsibility of logging of the message
  to only one daemon. Other commands and daemons must read
  the logging file never to issue xc_readconsolering().

best regards,
Katsuhito Minai

On 2006年  7月月 11日 (火) 12:00 am, Keir Fraser said:
>
> On 7 Jul 2006, at 09:17, MINAI Katsuhito wrote:
>
>> [1/4] add read pointer to the xen console ring
>>
>> Signed-off-by: Katsuhito Minai <minai@jp.fujitsu.com>
>
> Can you briefly explain the semantics of the modified console
> interface. I'd rather change the interface cleanly than abuse the
> 'clear' field -- we've broken dom0_op compatibility since 3.0.2 anyway,
> so taking the cleaner route is definitely preferable.
>
>   -- Keir
>
>

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

* Re: [PATCH] [1/4] put xen console message into syslog but xm dmesg is not affected
  2006-07-11  1:28   ` MINAI Katsuhito
@ 2006-07-11  6:42     ` Keir Fraser
  2006-07-11  8:34       ` [PATCH] [1/4] put xen console message into syslog butxm " MINAI Katsuhito
  0 siblings, 1 reply; 6+ messages in thread
From: Keir Fraser @ 2006-07-11  6:42 UTC (permalink / raw)
  To: MINAI Katsuhito
  Cc: Mark Williamson, Hans-Christian Armingeon, xen-devel, Akio Takebe


On 11 Jul 2006, at 02:28, MINAI Katsuhito wrote:

> However, I also think that the "clear" interface is unnecessary.
> I think that better solution is one of the following idea:
> - modification to have independent read pointer of the buffer
>   for each commands and daemons just like reading usual file.
>   But, this might be difficult for hypervisor.

Yes, this would be good. The caller could pass a start index and a 
length. Xen then returns characters from that index, up to length bytes 
(if available). If the given index is too far behind Xen's producer 
index, Xen would provide bytes from index position (producer - 
ring_size). In either case Xen would return index position of first 
byte returned.

  -- Keir

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

* Re: [PATCH] [1/4] put xen console message into syslog butxm dmesg is not affected
  2006-07-11  6:42     ` Keir Fraser
@ 2006-07-11  8:34       ` MINAI Katsuhito
  2006-07-11 15:07         ` Keir Fraser
  0 siblings, 1 reply; 6+ messages in thread
From: MINAI Katsuhito @ 2006-07-11  8:34 UTC (permalink / raw)
  To: Keir Fraser
  Cc: Akio Takebe, Hans-Christian Armingeon, xen-devel, Mark Williamson

Hi keir

Thank you for advice.
I'd like to attempt to change xc_readconsolering() interface.

Please let me confirm the following for my understanding.

- Xen should return the index of the oldest character on the console
  ring when the index that the caller specified is older than
  the range of the console ring.

- I think that Xen would return index position of "last" byte
  returned, not first byte.

Best regards,
Katsuhito Minai


On 11 Jul 2006, at 03:42 pm, Keir Fraser said:
>
> On 11 Jul 2006, at 02:28, MINAI Katsuhito wrote:
>
>> However, I also think that the "clear" interface is unnecessary.
>> I think that better solution is one of the following idea:
>> - modification to have independent read pointer of the buffer
>>   for each commands and daemons just like reading usual file.
>>   But, this might be difficult for hypervisor.
>
> Yes, this would be good. The caller could pass a start index and a
> length. Xen then returns characters from that index, up to length bytes
> (if available). If the given index is too far behind Xen's producer
> index, Xen would provide bytes from index position (producer -
> ring_size). In either case Xen would return index position of first
> byte returned.
>
>   -- Keir

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

* Re: [PATCH] [1/4] put xen console message into syslog butxm dmesg is not affected
  2006-07-11  8:34       ` [PATCH] [1/4] put xen console message into syslog butxm " MINAI Katsuhito
@ 2006-07-11 15:07         ` Keir Fraser
  0 siblings, 0 replies; 6+ messages in thread
From: Keir Fraser @ 2006-07-11 15:07 UTC (permalink / raw)
  To: MINAI Katsuhito
  Cc: Mark Williamson, Hans-Christian Armingeon, xen-devel, Akio Takebe


On 11 Jul 2006, at 09:34, MINAI Katsuhito wrote:

> Please let me confirm the following for my understanding.
>
> - Xen should return the index of the oldest character on the console
>   ring when the index that the caller specified is older than
>   the range of the console ring.

Yes, that is an out-of-range input index gets 'rounded up' to the first 
in-range index. I think that seems a sensible method for bootstrapping 
a caller with no knowledge about current ring indexes -- they'd pass 
zero as input and then get back information about the first valid 
index. Another way would be to have an input flag or unique input index 
value that means 'just get me characters from the first valid index'. I 
somewhat prefer the method I already described though.

> - I think that Xen would return index position of "last" byte
>   returned, not first byte.

Seems less natural to me, but we could do it either way. Clearly first 
can be computed from last, and vice versa.

Also, keeping the facility to clear the console buffer seems sensible 
(so that 'xm dmesg' can continue to support the normal Linux dmesg -c 
option) -- but having a separate clear_console_ring dom0_op for that 
would be cleaner.

Thanks!

  -- Keir

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

end of thread, other threads:[~2006-07-11 15:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-07  8:17 [PATCH] [1/4] put xen console message into syslog but xm dmesg is not affected MINAI Katsuhito
2006-07-10 15:00 ` Keir Fraser
2006-07-11  1:28   ` MINAI Katsuhito
2006-07-11  6:42     ` Keir Fraser
2006-07-11  8:34       ` [PATCH] [1/4] put xen console message into syslog butxm " MINAI Katsuhito
2006-07-11 15:07         ` Keir Fraser

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.