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-changelog

[Xen-changelog] [xen-unstable] libxenctrl headers should not pollute mac

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxenctrl headers should not pollute macro namespace with
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 12 Feb 2008 09:10:11 -0800
Delivery-date: Tue, 12 Feb 2008 09:10:21 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1202816265 0
# Node ID 88818d55e95a75f666839f38158488783245da87
# Parent  bd09d9692bda873687662c321c426169db164eed
libxenctrl headers should not pollute macro namespace with
mb/rmb/wmb. Instead add a xen_ prefix. Modify Xen's public headers to
expect the prefixed names instead of bare mb/rmb/wmb, but gate this
expectation on a bump of __XEN_INTERFACE_VERSION__.
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 tools/blktap/drivers/tapdisk.c       |    2 +-
 tools/console/daemon/io.c            |    8 ++++----
 tools/fs-back/fs-backend.c           |    4 ++--
 tools/ioemu/hw/xen_console.c         |    8 ++++----
 tools/ioemu/hw/xenfb.c               |    8 ++++----
 tools/ioemu/target-i386-dm/helper2.c |    6 +++---
 tools/libxc/xenctrl.h                |   25 ++++++++++++-------------
 tools/xenmon/xenbaked.c              |    4 ++--
 tools/xenstore/xenstored_domain.c    |    8 ++++----
 tools/xentrace/xentrace.c            |    6 +++---
 xen/include/public/io/ring.h         |   24 ++++++++++++++++--------
 xen/include/public/xen-compat.h      |    2 +-
 12 files changed, 56 insertions(+), 49 deletions(-)

diff -r bd09d9692bda -r 88818d55e95a tools/blktap/drivers/tapdisk.c
--- a/tools/blktap/drivers/tapdisk.c    Tue Feb 12 10:57:49 2008 +0000
+++ b/tools/blktap/drivers/tapdisk.c    Tue Feb 12 11:37:45 2008 +0000
@@ -641,7 +641,7 @@ static void get_io_request(struct td_sta
        if (!run) return; /*We have received signal to close*/
 
        rp = info->fe_ring.sring->req_prod; 
-       rmb();
+       xen_rmb();
        for (j = info->fe_ring.req_cons; j != rp; j++)
        {
                int done = 0, start_seg = 0; 
diff -r bd09d9692bda -r 88818d55e95a tools/console/daemon/io.c
--- a/tools/console/daemon/io.c Tue Feb 12 10:57:49 2008 +0000
+++ b/tools/console/daemon/io.c Tue Feb 12 11:37:45 2008 +0000
@@ -153,7 +153,7 @@ static void buffer_append(struct domain 
 
        cons = intf->out_cons;
        prod = intf->out_prod;
-       mb();
+       xen_mb();
 
        size = prod - cons;
        if ((size == 0) || (size > sizeof(intf->out)))
@@ -172,7 +172,7 @@ static void buffer_append(struct domain 
                buffer->data[buffer->size++] = intf->out[
                        MASK_XENCONS_IDX(cons++, intf->out)];
 
-       mb();
+       xen_mb();
        intf->out_cons = cons;
        xc_evtchn_notify(dom->xce_handle, dom->local_port);
 
@@ -750,7 +750,7 @@ static int ring_free_bytes(struct domain
 
        cons = intf->in_cons;
        prod = intf->in_prod;
-       mb();
+       xen_mb();
 
        space = prod - cons;
        if (space > sizeof(intf->in))
@@ -797,7 +797,7 @@ static void handle_tty_read(struct domai
                        intf->in[MASK_XENCONS_IDX(prod++, intf->in)] =
                                msg[i];
                }
-               wmb();
+               xen_wmb();
                intf->in_prod = prod;
                xc_evtchn_notify(dom->xce_handle, dom->local_port);
        } else {
diff -r bd09d9692bda -r 88818d55e95a tools/fs-back/fs-backend.c
--- a/tools/fs-back/fs-backend.c        Tue Feb 12 10:57:49 2008 +0000
+++ b/tools/fs-back/fs-backend.c        Tue Feb 12 11:37:45 2008 +0000
@@ -140,8 +140,8 @@ void* handle_mount(void *data)
         handle_aio_events(mount);
 moretodo:
         rp = mount->ring.sring->req_prod;
-        rmb(); /* Ensure we see queued requests up to 'rp'. */
-                
+        xen_rmb(); /* Ensure we see queued requests up to 'rp'. */
+
         while ((cons = mount->ring.req_cons) != rp)
         {
             int i;
diff -r bd09d9692bda -r 88818d55e95a tools/ioemu/hw/xen_console.c
--- a/tools/ioemu/hw/xen_console.c      Tue Feb 12 10:57:49 2008 +0000
+++ b/tools/ioemu/hw/xen_console.c      Tue Feb 12 11:37:45 2008 +0000
@@ -75,7 +75,7 @@ static void buffer_append(struct domain 
 
        cons = intf->out_cons;
        prod = intf->out_prod;
-       mb();
+       xen_mb();
 
        size = prod - cons;
        if ((size == 0) || (size > sizeof(intf->out)))
@@ -94,7 +94,7 @@ static void buffer_append(struct domain 
                buffer->data[buffer->size++] = intf->out[
                        MASK_XENCONS_IDX(cons++, intf->out)];
 
-       mb();
+       xen_mb();
        intf->out_cons = cons;
        xc_evtchn_notify(dom->xce_handle, dom->local_port);
 
@@ -289,7 +289,7 @@ static int ring_free_bytes(struct domain
 
        cons = intf->in_cons;
        prod = intf->in_prod;
-       mb();
+       xen_mb();
 
        space = prod - cons;
        if (space > sizeof(intf->in))
@@ -322,7 +322,7 @@ static void xencons_receive(void *opaque
                intf->in[MASK_XENCONS_IDX(prod++, intf->in)] =
                        buf[i];
        }
-       wmb();
+       xen_wmb();
        intf->in_prod = prod;
        xc_evtchn_notify(dom->xce_handle, dom->local_port);
 }
diff -r bd09d9692bda -r 88818d55e95a tools/ioemu/hw/xenfb.c
--- a/tools/ioemu/hw/xenfb.c    Tue Feb 12 10:57:49 2008 +0000
+++ b/tools/ioemu/hw/xenfb.c    Tue Feb 12 11:37:45 2008 +0000
@@ -485,7 +485,7 @@ static void xenfb_on_fb_event(struct xen
        prod = page->out_prod;
        if (prod == page->out_cons)
                return;
-       rmb();                  /* ensure we see ring contents up to prod */
+       xen_rmb();              /* ensure we see ring contents up to prod */
        for (cons = page->out_cons; cons != prod; cons++) {
                union xenfb_out_event *event = &XENFB_OUT_RING_REF(page, cons);
                int x, y, w, h;
@@ -512,7 +512,7 @@ static void xenfb_on_fb_event(struct xen
                        break;
                }
        }
-       mb();                   /* ensure we're done with ring contents */
+       xen_mb();               /* ensure we're done with ring contents */
        page->out_cons = cons;
        xc_evtchn_notify(xenfb->evt_xch, xenfb->fb.port);
 }
@@ -571,9 +571,9 @@ static int xenfb_kbd_event(struct xenfb 
                return -1;
        }
 
-       mb();                   /* ensure ring space available */
+       xen_mb();               /* ensure ring space available */
        XENKBD_IN_RING_REF(page, prod) = *event;
-       wmb();                  /* ensure ring contents visible */
+       xen_wmb();              /* ensure ring contents visible */
        page->in_prod = prod + 1;
        return xc_evtchn_notify(xenfb->evt_xch, xenfb->kbd.port);
 }
diff -r bd09d9692bda -r 88818d55e95a tools/ioemu/target-i386-dm/helper2.c
--- a/tools/ioemu/target-i386-dm/helper2.c      Tue Feb 12 10:57:49 2008 +0000
+++ b/tools/ioemu/target-i386-dm/helper2.c      Tue Feb 12 11:37:45 2008 +0000
@@ -218,7 +218,7 @@ static ioreq_t *__cpu_get_ioreq(int vcpu
         return NULL;
     }
 
-    rmb(); /* see IOREQ_READY /then/ read contents of ioreq */
+    xen_rmb(); /* see IOREQ_READY /then/ read contents of ioreq */
 
     req->state = STATE_IOREQ_INPROCESS;
     return req;
@@ -568,7 +568,7 @@ void __handle_buffered_iopage(CPUState *
 
         __handle_ioreq(env, &req);
 
-        mb();
+        xen_mb();
         buffered_io_page->read_pointer += qw ? 2 : 1;
     }
 }
@@ -603,7 +603,7 @@ void cpu_handle_ioreq(void *opaque)
             return;
         }
 
-        wmb(); /* Update ioreq contents /then/ update state. */
+        xen_wmb(); /* Update ioreq contents /then/ update state. */
 
        /*
          * We do this before we send the response so that the tools
diff -r bd09d9692bda -r 88818d55e95a tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Tue Feb 12 10:57:49 2008 +0000
+++ b/tools/libxc/xenctrl.h     Tue Feb 12 11:37:45 2008 +0000
@@ -43,22 +43,21 @@
  */
 
 #if defined(__i386__)
-#define mb()  __asm__ __volatile__ ( "lock; addl $0,0(%%esp)" : : : "memory" )
-#define rmb() __asm__ __volatile__ ( "lock; addl $0,0(%%esp)" : : : "memory" )
-#define wmb() __asm__ __volatile__ ( "" : : : "memory")
+#define xen_mb()  asm volatile ( "lock; addl $0,0(%%esp)" : : : "memory" )
+#define xen_rmb() asm volatile ( "lock; addl $0,0(%%esp)" : : : "memory" )
+#define xen_wmb() asm volatile ( "" : : : "memory")
 #elif defined(__x86_64__)
-#define mb()  __asm__ __volatile__ ( "mfence" : : : "memory")
-#define rmb() __asm__ __volatile__ ( "lfence" : : : "memory")
-#define wmb() __asm__ __volatile__ ( "" : : : "memory")
+#define xen_mb()  asm volatile ( "mfence" : : : "memory")
+#define xen_rmb() asm volatile ( "lfence" : : : "memory")
+#define xen_wmb() asm volatile ( "" : : : "memory")
 #elif defined(__ia64__)
-#define mb()   __asm__ __volatile__ ("mf" ::: "memory")
-#define rmb()  __asm__ __volatile__ ("mf" ::: "memory")
-#define wmb()  __asm__ __volatile__ ("mf" ::: "memory")
+#define xen_mb()   asm volatile ("mf" ::: "memory")
+#define xen_rmb()  asm volatile ("mf" ::: "memory")
+#define xen_wmb()  asm volatile ("mf" ::: "memory")
 #elif defined(__powerpc__)
-/* XXX loosen these up later */
-#define mb()   __asm__ __volatile__ ("sync" : : : "memory")
-#define rmb()  __asm__ __volatile__ ("sync" : : : "memory") /* lwsync? */
-#define wmb()  __asm__ __volatile__ ("sync" : : : "memory") /* eieio? */
+#define xen_mb()   asm volatile ("sync" : : : "memory")
+#define xen_rmb()  asm volatile ("sync" : : : "memory") /* lwsync? */
+#define xen_wmb()  asm volatile ("sync" : : : "memory") /* eieio? */
 #else
 #error "Define barriers"
 #endif
diff -r bd09d9692bda -r 88818d55e95a tools/xenmon/xenbaked.c
--- a/tools/xenmon/xenbaked.c   Tue Feb 12 10:57:49 2008 +0000
+++ b/tools/xenmon/xenbaked.c   Tue Feb 12 11:37:45 2008 +0000
@@ -511,10 +511,10 @@ int monitor_tbufs(void)
         {
             while ( meta[i]->cons != meta[i]->prod )
             {
-                rmb(); /* read prod, then read item. */
+                xen_rmb(); /* read prod, then read item. */
                 rec_size = process_record(
                     i, (struct t_rec *)(data[i] + meta[i]->cons % data_size));
-                mb(); /* read item, then update cons. */
+                xen_mb(); /* read item, then update cons. */
                 meta[i]->cons += rec_size;
             }
         }
diff -r bd09d9692bda -r 88818d55e95a tools/xenstore/xenstored_domain.c
--- a/tools/xenstore/xenstored_domain.c Tue Feb 12 10:57:49 2008 +0000
+++ b/tools/xenstore/xenstored_domain.c Tue Feb 12 11:37:45 2008 +0000
@@ -112,7 +112,7 @@ static int writechn(struct connection *c
        /* Must read indexes once, and before anything else, and verified. */
        cons = intf->rsp_cons;
        prod = intf->rsp_prod;
-       mb();
+       xen_mb();
 
        if (!check_indexes(cons, prod)) {
                errno = EIO;
@@ -124,7 +124,7 @@ static int writechn(struct connection *c
                len = avail;
 
        memcpy(dest, data, len);
-       mb();
+       xen_mb();
        intf->rsp_prod += len;
 
        xc_evtchn_notify(xce_handle, conn->domain->port);
@@ -142,7 +142,7 @@ static int readchn(struct connection *co
        /* Must read indexes once, and before anything else, and verified. */
        cons = intf->req_cons;
        prod = intf->req_prod;
-       mb();
+       xen_mb();
 
        if (!check_indexes(cons, prod)) {
                errno = EIO;
@@ -154,7 +154,7 @@ static int readchn(struct connection *co
                len = avail;
 
        memcpy(data, src, len);
-       mb();
+       xen_mb();
        intf->req_cons += len;
 
        xc_evtchn_notify(xce_handle, conn->domain->port);
diff -r bd09d9692bda -r 88818d55e95a tools/xentrace/xentrace.c
--- a/tools/xentrace/xentrace.c Tue Feb 12 10:57:49 2008 +0000
+++ b/tools/xentrace/xentrace.c Tue Feb 12 11:37:45 2008 +0000
@@ -384,8 +384,8 @@ int monitor_tbufs(int outfd)
             /* Read window information only once. */
             cons = meta[i]->cons;
             prod = meta[i]->prod;
-            rmb(); /* read prod, then read item. */
-            
+            xen_rmb(); /* read prod, then read item. */
+
             if ( cons == prod )
                 continue;
            
@@ -428,7 +428,7 @@ int monitor_tbufs(int outfd)
                              outfd);
             }
 
-            mb(); /* read buffer, then update cons. */
+            xen_mb(); /* read buffer, then update cons. */
             meta[i]->cons = prod;
         }
 
diff -r bd09d9692bda -r 88818d55e95a xen/include/public/io/ring.h
--- a/xen/include/public/io/ring.h      Tue Feb 12 10:57:49 2008 +0000
+++ b/xen/include/public/io/ring.h      Tue Feb 12 11:37:45 2008 +0000
@@ -26,6 +26,14 @@
 
 #ifndef __XEN_PUBLIC_IO_RING_H__
 #define __XEN_PUBLIC_IO_RING_H__
+
+#include "../xen-compat.h"
+
+#if __XEN_INTERFACE_VERSION__ < 0x00030208
+#define xen_mb()  mb()
+#define xen_rmb() rmb()
+#define xen_wmb() wmb()
+#endif
 
 typedef unsigned int RING_IDX;
 
@@ -211,12 +219,12 @@ typedef struct __name##_back_ring __name
     (((_cons) - (_r)->rsp_prod_pvt) >= RING_SIZE(_r))
 
 #define RING_PUSH_REQUESTS(_r) do {                                     \
-    wmb(); /* back sees requests /before/ updated producer index */     \
+    xen_wmb(); /* back sees requests /before/ updated producer index */ \
     (_r)->sring->req_prod = (_r)->req_prod_pvt;                         \
 } while (0)
 
 #define RING_PUSH_RESPONSES(_r) do {                                    \
-    wmb(); /* front sees responses /before/ updated producer index */   \
+    xen_wmb(); /* front sees resps /before/ updated producer index */   \
     (_r)->sring->rsp_prod = (_r)->rsp_prod_pvt;                         \
 } while (0)
 
@@ -253,9 +261,9 @@ typedef struct __name##_back_ring __name
 #define RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(_r, _notify) do {           \
     RING_IDX __old = (_r)->sring->req_prod;                             \
     RING_IDX __new = (_r)->req_prod_pvt;                                \
-    wmb(); /* back sees requests /before/ updated producer index */     \
+    xen_wmb(); /* back sees requests /before/ updated producer index */ \
     (_r)->sring->req_prod = __new;                                      \
-    mb(); /* back sees new requests /before/ we check req_event */      \
+    xen_mb(); /* back sees new requests /before/ we check req_event */  \
     (_notify) = ((RING_IDX)(__new - (_r)->sring->req_event) <           \
                  (RING_IDX)(__new - __old));                            \
 } while (0)
@@ -263,9 +271,9 @@ typedef struct __name##_back_ring __name
 #define RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(_r, _notify) do {          \
     RING_IDX __old = (_r)->sring->rsp_prod;                             \
     RING_IDX __new = (_r)->rsp_prod_pvt;                                \
-    wmb(); /* front sees responses /before/ updated producer index */   \
+    xen_wmb(); /* front sees resps /before/ updated producer index */   \
     (_r)->sring->rsp_prod = __new;                                      \
-    mb(); /* front sees new responses /before/ we check rsp_event */    \
+    xen_mb(); /* front sees new resps /before/ we check rsp_event */    \
     (_notify) = ((RING_IDX)(__new - (_r)->sring->rsp_event) <           \
                  (RING_IDX)(__new - __old));                            \
 } while (0)
@@ -274,7 +282,7 @@ typedef struct __name##_back_ring __name
     (_work_to_do) = RING_HAS_UNCONSUMED_REQUESTS(_r);                   \
     if (_work_to_do) break;                                             \
     (_r)->sring->req_event = (_r)->req_cons + 1;                        \
-    mb();                                                               \
+    xen_mb();                                                           \
     (_work_to_do) = RING_HAS_UNCONSUMED_REQUESTS(_r);                   \
 } while (0)
 
@@ -282,7 +290,7 @@ typedef struct __name##_back_ring __name
     (_work_to_do) = RING_HAS_UNCONSUMED_RESPONSES(_r);                  \
     if (_work_to_do) break;                                             \
     (_r)->sring->rsp_event = (_r)->rsp_cons + 1;                        \
-    mb();                                                               \
+    xen_mb();                                                           \
     (_work_to_do) = RING_HAS_UNCONSUMED_RESPONSES(_r);                  \
 } while (0)
 
diff -r bd09d9692bda -r 88818d55e95a xen/include/public/xen-compat.h
--- a/xen/include/public/xen-compat.h   Tue Feb 12 10:57:49 2008 +0000
+++ b/xen/include/public/xen-compat.h   Tue Feb 12 11:37:45 2008 +0000
@@ -27,7 +27,7 @@
 #ifndef __XEN_PUBLIC_XEN_COMPAT_H__
 #define __XEN_PUBLIC_XEN_COMPAT_H__
 
-#define __XEN_LATEST_INTERFACE_VERSION__ 0x00030207
+#define __XEN_LATEST_INTERFACE_VERSION__ 0x00030208
 
 #if defined(__XEN__) || defined(__XEN_TOOLS__)
 /* Xen is built with matching headers and implements the latest interface. */

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] libxenctrl headers should not pollute macro namespace with, Xen patchbot-unstable <=