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 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH v2] libxl: reimplement buffer for bootloading and

To: Roger Pau Monne <roger.pau@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH v2] libxl: reimplement buffer for bootloading and drop data if buffer is full
From: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Date: Mon, 17 Oct 2011 17:17:03 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, Ian.Campbell@xxxxxxxxxx
Delivery-date: Mon, 17 Oct 2011 09:46:49 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <72ef13cb4609c97a26ef.1318503856@loki>
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/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Newsgroups: chiark.mail.xen.devel
References: <72ef13cb4609c97a26ef.1318503856@loki>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Roger Pau Monne writes ("[Xen-devel] [PATCH v2] libxl: reimplement buffer for 
bootloading and drop data if buffer is full"):
> +        /* Move buffers around to drop already consumed data */
> +        if (xenconsoled_cons > 0) {
> +            xenconsoled_prod -= xenconsoled_cons;
> +            memmove(xenconsoled_buf, &xenconsoled_buf[xenconsoled_cons], 
> xenconsoled_prod);

This has quite a few overly-long lines.  Can you keep them to 75ish
please ?

> -        ret = select(nfds, &rsel, &wsel, NULL, NULL);
> +        ret = select(nfds, &rsel, &wsel, NULL, &wait);
>          if (ret < 0)
>              goto out_err;

This needs to handle EINTR.  Ie, if EINTR happens, just loop again.
(A better implementation would actually subtract the timeout but
let's not do that now).

> +        timeout = ret == 0 ? 1 : 0;

This seems a slightly odd approach.  How about
  if (ret==0) {
     empty the ring buffer
     continue;
  }
?

And you should avoid setting a timeout if the buffer is empty, so that
a completely idle setup just sits and waits rather than polling every
second.

Ian.

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

<Prev in Thread] Current Thread [Next in Thread>