Port-xen archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[diff] Some minor corrections and improvements



Hi list,

In an attempt to reduce my future diffs for save/restore in port-xen, I collected some and would like you to review them.

Changes:
- printf => aprint_*
- xs_init() returns an error if it fails, following christoph (cegger@) modifications from yesterday - init_events() => events_init() (closer to netbsd's semantics like found in init_main.c) - some '\n' removal in DPRINTF macros (unneeded, the format in macro already adds one)
- Add and fix some typos in comments
- align start_info_union on a page boundary. This is not strictly required for our current domU, but all Xen code (hypervisor and tools) expect the start_info struct to be page aligned.
- mask xbd event before removing its handler.

The following are not used yet (but will be, in a not too distant future, after branching). I can keep them out of the diff, since all they add is just more bytes to the kernel.

- mfn_to_pfn and pfn_to_mfn (avoids the PAGE_SHIFT and XPMAP_OFFSET stuff if we only care about frame number conversions) - well, this one does not add bytes, they are just macros. Anyway...
- add HYPERVISOR_crash() for i386 and amd64
- change unbind_[pv]irq_from_evtch() to return the unbound evtch for the requested [PV]IRQ. They are now the reverse equivalent of the bind_[pv]irq_to_evtch ones. - add the "protocol" entry to xenstore during xbd initialization. Normally created during domU's first boot by xentools DevController, but is under domU's responsibility in all other cases (save/restore, hot plugging, whatever). - remove the xenbus_suspend() and xenbus_resume() prototypes, they are not used anywhere, and will conflict with xenbus pmf(9) handlers.

It does not seem to break anything. It compiles and works under i386, but is untested under amd64. No reason it shouldn't.

Please review :)

--
Jean-Yves Migeon
jean-yves.migeon%espci.fr@localhost

Index: xen/i386/npx_hv.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/i386/npx_hv.c,v
retrieving revision 1.6
diff -u -u -r1.6 npx_hv.c
--- xen/i386/npx_hv.c   5 Mar 2008 04:58:29 -0000       1.6
+++ xen/i386/npx_hv.c   23 Oct 2008 21:36:32 -0000
@@ -71,7 +71,7 @@
        sc->sc_dev = self;
        sc->sc_type = NPX_EXCEPTION;
 
-       printf(": using exception 16\n");
+       aprint_normal(": using exception 16\n");
 
        npxattach(sc);
 }
Index: xen/include/evtchn.h
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/include/evtchn.h,v
retrieving revision 1.16
diff -u -u -r1.16 evtchn.h
--- xen/include/evtchn.h        1 Jul 2008 18:49:21 -0000       1.16
+++ xen/include/evtchn.h        23 Oct 2008 21:36:32 -0000
@@ -39,7 +39,7 @@
 extern struct evtsource *evtsource[];
 
 void events_default_setup(void);
-void init_events(void);
+void events_init(void);
 unsigned int evtchn_do_event(int, struct intrframe *);
 void call_evtchn_do_event(int, struct intrframe *);
 void call_xenevt_event(int);
@@ -54,8 +54,8 @@
 
 int bind_virq_to_evtch(int);
 int bind_pirq_to_evtch(int);
-void unbind_pirq_from_evtch(int);
-void unbind_virq_from_evtch(int);
+int unbind_pirq_from_evtch(int);
+int unbind_virq_from_evtch(int);
 
 struct pintrhand {
        int pirq;
Index: xen/include/granttables.h
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/include/granttables.h,v
retrieving revision 1.4
diff -u -u -r1.4 granttables.h
--- xen/include/granttables.h   22 Nov 2007 16:16:56 -0000      1.4
+++ xen/include/granttables.h   23 Oct 2008 21:36:32 -0000
@@ -54,6 +54,6 @@
 
 /*
  * Query grant status (i.e. if remote has a valid mapping to this grant).
- * Returns GTF_reading | GTF_writing.
+ * Returns GTF_reading | GTF_writing (0 if remote does not use it anymore).
  */
 int xengnt_status(grant_ref_t);
Index: xen/include/xenbus.h
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/include/xenbus.h,v
retrieving revision 1.9
diff -u -u -r1.9 xenbus.h
--- xen/include/xenbus.h        16 Apr 2008 18:41:48 -0000      1.9
+++ xen/include/xenbus.h        23 Oct 2008 21:36:32 -0000
@@ -159,10 +159,6 @@
 /* Used by xenbus_dev to borrow kernel's store connection. */
 int xenbus_dev_request_and_reply(struct xsd_sockmsg *msg, void **);
 
-/* Called from xen core code. */
-void xenbus_suspend(void);
-void xenbus_resume(void);
-
 void xenbus_probe(void *);
 
 int xenbus_free_device(struct xenbus_device *);
Index: xen/include/xenpmap.h
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/include/xenpmap.h,v
retrieving revision 1.19
diff -u -u -r1.19 xenpmap.h
--- xen/include/xenpmap.h       23 Jan 2008 19:46:45 -0000      1.19
+++ xen/include/xenpmap.h       23 Oct 2008 21:36:33 -0000
@@ -52,11 +52,11 @@
 extern unsigned long *xpmap_phys_to_machine_mapping;
 
 /*   
- * On Xen-2, the start of the day virual memory starts at KERNTEXTOFF
+ * On Xen-2, the start of the day virtual memory starts at KERNTEXTOFF
  * (0xc0100000). On Xen-3 for domain0 it starts at KERNBASE (0xc0000000).
  * So the offset between physical and virtual address is different on
  * Xen-2 and Xen-3 for domain0.
- * starting with xen-3.0.2, we can add notes so that virual memory starts
+ * starting with xen-3.0.2, we can add notes so that virtual memory starts
  * at KERNBASE for domU as well.
  */  
 #if defined(XEN3) && (defined(DOM0OPS) || !defined(XEN_COMPAT_030001))
@@ -65,6 +65,9 @@
 #define        XPMAP_OFFSET    (KERNTEXTOFF - KERNBASE)
 #endif
 
+#define mfn_to_pfn(mfn) (machine_to_phys_mapping[(mfn)])
+#define pfn_to_mfn(pfn) (xpmap_phys_to_machine_mapping[(pfn)])
+
 static __inline paddr_t
 xpmap_mtop(paddr_t mpa)
 {
Index: xen/include/amd64/hypercalls.h
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/include/amd64/hypercalls.h,v
retrieving revision 1.3
diff -u -u -r1.3 hypercalls.h
--- xen/include/amd64/hypercalls.h      25 Aug 2008 09:21:45 -0000      1.3
+++ xen/include/amd64/hypercalls.h      23 Oct 2008 21:36:33 -0000
@@ -340,6 +340,19 @@
        return _hypercall2(int, sched_op, SCHEDOP_shutdown, SHUTDOWN_poweroff);
 }
 
+static __inline long
+HYPERVISOR_crash(void)
+{
+       long ret;
+       unsigned long ign1, ign2;
+
+       _hypercall(__HYPERVISOR_sched_op,
+               _harg("1" (SCHEDOP_shutdown), "2" (SHUTDOWN_crash)),
+               _harg("=a" (ret), "=b" (ign1), "=c" (ign2)));
+
+       return ret;
+}
+
 static inline long
 HYPERVISOR_reboot(
        void)
Index: xen/include/i386/hypercalls.h
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/include/i386/hypercalls.h,v
retrieving revision 1.5
diff -u -u -r1.5 hypercalls.h
--- xen/include/i386/hypercalls.h       21 Oct 2008 22:35:25 -0000      1.5
+++ xen/include/i386/hypercalls.h       23 Oct 2008 21:36:33 -0000
@@ -420,6 +420,19 @@
 }
 
 static __inline long
+HYPERVISOR_crash(void)
+{
+    long ret;
+    unsigned long ign1, ign2;
+
+    _hypercall(__HYPERVISOR_sched_op,
+       _harg("1" (SCHEDOP_shutdown), "2" (SHUTDOWN_crash)),
+       _harg("=a" (ret), "=b" (ign1), "=c" (ign2)));
+
+    return ret;
+}
+
+static __inline long
 HYPERVISOR_reboot(void)
 {
     long ret;
Index: xen/x86/x86_xpmap.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/x86/x86_xpmap.c,v
retrieving revision 1.10
diff -u -u -r1.10 x86_xpmap.c
--- xen/x86/x86_xpmap.c 21 Oct 2008 15:46:32 -0000      1.10
+++ xen/x86/x86_xpmap.c 23 Oct 2008 21:36:34 -0000
@@ -123,7 +123,8 @@
 #endif
 
 volatile shared_info_t *HYPERVISOR_shared_info;
-union start_info_union start_info_union;
+/* Xen requires the start_info struct to be page aligned */
+union start_info_union start_info_union __aligned(PAGE_SIZE);
 unsigned long *xpmap_phys_to_machine_mapping;
 
 void xen_failsafe_handler(void);
Index: xen/xen/evtchn.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/xen/evtchn.c,v
retrieving revision 1.38
diff -u -u -r1.38 evtchn.c
--- xen/xen/evtchn.c    24 May 2008 15:09:34 -0000      1.38
+++ xen/xen/evtchn.c    23 Oct 2008 21:36:34 -0000
@@ -174,7 +174,7 @@
 }
 
 void
-init_events(void)
+events_init(void)
 {
 #ifndef XEN3
        int evtch;
@@ -346,7 +346,7 @@
        return evtchn;
 }
 
-void
+int
 unbind_virq_from_evtch(int virq)
 {
        evtchn_op_t op;
@@ -370,6 +370,8 @@
 
        simple_unlock(&irq_mapping_update_lock);
        splx(s);
+
+       return evtchn;
 }
 
 #if NPCI > 0 || NISA > 0
@@ -409,7 +411,7 @@
        return evtchn;
 }
 
-void
+int
 unbind_pirq_from_evtch(int pirq)
 {
        evtchn_op_t op;
@@ -433,6 +435,8 @@
 
        simple_unlock(&irq_mapping_update_lock);
        splx(s);
+
+       return evtchn;
 }
 
 struct pintrhand *
Index: xen/xen/hypervisor.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/xen/hypervisor.c,v
retrieving revision 1.40
diff -u -u -r1.40 hypervisor.c
--- xen/xen/hypervisor.c        21 Oct 2008 15:46:32 -0000      1.40
+++ xen/xen/hypervisor.c        23 Oct 2008 21:36:34 -0000
@@ -251,7 +251,7 @@
 
 #ifdef XEN3
        xen_version = HYPERVISOR_xen_version(XENVER_version, NULL);
-       printf(": Xen version %d.%d\n", (xen_version & 0xffff0000) >> 16,
+       aprint_normal(": Xen version %d.%d\n", (xen_version & 0xffff0000) >> 16,
               xen_version & 0x0000ffff);
 
        xengnt_init();
@@ -263,10 +263,10 @@
        hac.hac_vcaa.vcaa_caa.cpu_func = 0;
        config_found_ia(self, "xendevbus", &hac.hac_vcaa, hypervisor_print);
 #else
-       printf("\n");
+       aprint_normal("\n");
 #endif
 
-       init_events();
+       events_init();
 
 #if NXENBUS > 0
        hac.hac_xenbus.xa_device = "xenbus";
Index: xen/xen/if_xennet_xenbus.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/xen/if_xennet_xenbus.c,v
retrieving revision 1.25
diff -u -u -r1.25 if_xennet_xenbus.c
--- xen/xen/if_xennet_xenbus.c  16 Apr 2008 18:41:48 -0000      1.25
+++ xen/xen/if_xennet_xenbus.c  23 Oct 2008 21:36:35 -0000
@@ -289,7 +289,7 @@
                        break;
                if (!pmap_extract(pmap_kernel(), rxreq->rxreq_va,
                    &rxreq->rxreq_pa))
-                       panic("xennet: no pa for mapped va ?");
+                       panic("%s: no pa for mapped va ?", device_xname(self));
                rxreq->rxreq_gntref = GRANT_INVALID_REF;
                SLIST_INSERT_HEAD(&sc->sc_rxreq_head, rxreq, rxreq_next);
        }
@@ -336,7 +336,8 @@
        ether_ifattach(ifp, sc->sc_enaddr);
        sc->sc_softintr = softint_establish(SOFTINT_NET, xennet_softstart, sc);
        if (sc->sc_softintr == NULL)
-               panic(" xennet: can't establish soft interrupt");
+               panic("%s: can't establish soft interrupt",
+                       device_xname(self));
 
        /* initialise shared structures and tell backend that we are ready */
        xennet_xenbus_resume(sc);
@@ -690,8 +691,8 @@
                KASSERT(req->txreq_id ==
                    RING_GET_RESPONSE(&sc->sc_tx_ring, i)->id);
                if (__predict_false(xengnt_status(req->txreq_gntref))) {
-                       printf("%s: grant still used by backend\n",
-                           device_xname(sc->sc_dev));
+                       aprint_verbose_dev(sc->sc_dev,
+                                          "grant still used by backend\n");
                        sc->sc_tx_ring.rsp_cons = i;
                        goto end;
                }
@@ -706,7 +707,7 @@
                SLIST_INSERT_HEAD(&sc->sc_txreq_head, req, txreq_next);
        }
        sc->sc_tx_ring.rsp_cons = resp_prod;
-       /* set new event and check fopr race with rsp_cons update */
+       /* set new event and check for race with rsp_cons update */
        sc->sc_tx_ring.sring->rsp_event = 
            resp_prod + ((sc->sc_tx_ring.sring->req_prod - resp_prod) >> 1) + 1;
        ifp->if_timer = 0;
@@ -1103,9 +1104,7 @@
 void
 xennet_watchdog(struct ifnet *ifp)
 {
-       struct xennet_xenbus_softc *sc = ifp->if_softc;
-
-       printf("%s: xennet_watchdog\n", device_xname(sc->sc_dev));
+       aprint_verbose_ifnet(ifp, "xennet_watchdog\n");
 }
 
 int
Index: xen/xen/shutdown_xenbus.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/xen/shutdown_xenbus.c,v
retrieving revision 1.4
diff -u -u -r1.4 shutdown_xenbus.c
--- xen/xen/shutdown_xenbus.c   22 Nov 2007 16:17:08 -0000      1.4
+++ xen/xen/shutdown_xenbus.c   23 Oct 2008 21:36:35 -0000
@@ -148,10 +148,10 @@
 
        if (sysmon_pswitch_register(&xenbus_power) != 0 ||
            sysmon_pswitch_register(&xenbus_reset) != 0) {
-               printf("%s: unable to register with sysmon\n", __func__);
+               aprint_error("%s: unable to register with sysmon\n", __func__);
                return;
        }
        if (register_xenbus_watch(&xenbus_shutdown_watch)) {
-               printf("%s: unable to watch control/shutdown\n", __func__);
+               aprint_error("%s: unable to watch control/shutdown\n", 
__func__);
        }
 }
Index: xen/xen/xbd_xenbus.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/xen/xbd_xenbus.c,v
retrieving revision 1.30
diff -u -u -r1.30 xbd_xenbus.c
--- xen/xen/xbd_xenbus.c        5 Jul 2008 19:06:01 -0000       1.30
+++ xen/xen/xbd_xenbus.c        23 Oct 2008 21:36:35 -0000
@@ -57,6 +57,7 @@
 
 #include <xen/xen3-public/io/ring.h>
 #include <xen/xen3-public/io/blkif.h>
+#include <xen/xen3-public/io/protocols.h>
 
 #include <xen/granttables.h>
 #include <xen/xenbus.h>
@@ -78,7 +79,7 @@
 
 struct xbd_req {
        SLIST_ENTRY(xbd_req) req_next;
-       uint16_t req_id; /* ID passed to backed */
+       uint16_t req_id; /* ID passed to backend */
        grant_ref_t req_gntref[BLKIF_MAX_SEGMENTS_PER_REQUEST];
        int req_nr_segments; /* number of segments in this request */
        struct buf *req_bp; /* buffer associated with this request */
@@ -200,7 +201,7 @@
 #endif
 
        config_pending_incr();
-       printf(": Xen Virtual Block Device Interface\n");
+       aprint_normal(": Xen Virtual Block Device Interface\n");
 
        sc->sc_dev = self;
 
@@ -286,6 +287,7 @@
                disk_destroy(&sc->sc_dksc.sc_dkdev);
        }
 
+       hypervisor_mask_event(sc->sc_evtchn);
        event_remove_handler(sc->sc_evtchn, &xbd_handler, sc);
        while (xengnt_status(sc->sc_ring_gntref)) {
                tsleep(xbd_xenbus_detach, PRIBIO, "xbd_ref", hz/2);
@@ -346,6 +348,12 @@
                errmsg = "writing event channel";
                goto abort_transaction;
        }
+       error = xenbus_printf(xbt, sc->sc_xbusd->xbusd_path,
+                       "protocol", "%s", XEN_IO_PROTO_ABI_NATIVE);
+       if (error) {
+               errmsg = "writing protocol";
+               goto abort_transaction;
+       }
        error = xenbus_switch_state(sc->sc_xbusd, xbt, XenbusStateInitialised);
        if (error) {
                errmsg = "writing frontend XenbusStateInitialised";
@@ -423,9 +431,9 @@
                /* try to read the disklabel */
                dk_getdisklabel(sc->sc_di, &sc->sc_dksc, 0 /* XXX ? */);
                format_bytes(buf, sizeof(buf), sc->sc_sectors * sc->sc_secsize);
-               printf("%s: %s, %d bytes/sect x %" PRIu64 " sectors\n",
-                   device_xname(sc->sc_dev), buf, (int)pdg->pdg_secsize,
-                   sc->sc_xbdsize);
+               aprint_verbose_dev(sc->sc_dev,
+                               "%s, %d bytes/sect x %" PRIu64 " sectors\n",
+                               buf, (int)pdg->pdg_secsize, sc->sc_xbdsize);
                /* Discover wedges on this disk. */
                dkwedge_discover(&sc->sc_dksc.sc_dkdev);
 
@@ -494,8 +502,8 @@
                for (seg = xbdreq->req_nr_segments - 1; seg >= 0; seg--) {
                        if (__predict_false(
                            xengnt_status(xbdreq->req_gntref[seg]))) {
-                               printf("%s: grant still used by backend\n",
-                                   device_xname(sc->sc_dev));
+                               aprint_verbose_dev(sc->sc_dev,
+                                       "grant still used by backend\n");
                                sc->sc_ring.rsp_cons = i;
                                xbdreq->req_nr_segments = seg + 1;
                                goto done;
@@ -506,8 +514,9 @@
                }
                if (rep->operation != BLKIF_OP_READ &&
                    rep->operation != BLKIF_OP_WRITE) {
-                       printf("%s: bad operation %d from backend\n",
-                            device_xname(sc->sc_dev), rep->operation);
+                       aprint_error_dev(sc->sc_dev,
+                                        "bad operation %d from backend\n",
+                                        rep->operation);
                                bp->b_error = EIO;
                                bp->b_resid = bp->b_bcount;
                                goto next;
Index: xen/xen/xbdback_xenbus.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/xen/xbdback_xenbus.c,v
retrieving revision 1.19
diff -u -u -r1.19 xbdback_xenbus.c
--- xen/xen/xbdback_xenbus.c    16 Sep 2008 19:53:05 -0000      1.19
+++ xen/xen/xbdback_xenbus.c    23 Oct 2008 21:36:36 -0000
@@ -546,7 +546,8 @@
                evop.u.bind_interdomain.remote_port = revtchn;
                err = HYPERVISOR_event_channel_op(&evop);
                if (err) {
-                       printf("blkback %s: can't get event channel: %d\n",
+                       aprint_error("blkback %s: "
+                           "can't get event channel: %d\n",
                            xbusd->xbusd_otherend, err);
                        xenbus_dev_fatal(xbusd, err,
                            "can't bind event channel", xbusd->xbusd_otherend);
@@ -557,7 +558,7 @@
                    xbdi->xbdi_domid, xbdi->xbdi_handle);
                event_set_handler(xbdi->xbdi_evtchn, xbdback_evthandler,
                    xbdi, IPL_BIO, evname);
-               printf("xbd backend 0x%x for domain %d "
+               aprint_verbose("xbd backend 0x%x for domain %d "
                    "using event channel %d, protocol %s\n", xbdi->xbdi_handle,
                    xbdi->xbdi_domid, xbdi->xbdi_evtchn, proto);
                hypervisor_enable_event(xbdi->xbdi_evtchn);
Index: xen/xen/xengnt.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/xen/xengnt.c,v
retrieving revision 1.8
diff -u -u -r1.8 xengnt.c
--- xen/xen/xengnt.c    5 Sep 2008 13:37:24 -0000       1.8
+++ xen/xen/xengnt.c    23 Oct 2008 21:36:37 -0000
@@ -137,10 +137,10 @@
        setup.frame_list = pages;
 
        if (HYPERVISOR_grant_table_op(GNTTABOP_setup_table, &setup, 1) != 0)
-               panic("xengnt_more_entries: setup table failed");
-       if (setup.status != 0) {
-               printf("xengnt_more_entries: setup table returned %d\n",
-                   setup.status);
+               panic("%s: setup table failed", __func__);
+       if (setup.status != GNTST_okay) {
+               aprint_error("%s: setup table returned %d\n",
+                   __func__, setup.status);
                free(pages, M_DEVBUF);
                return ENOMEM;
        }
@@ -149,10 +149,17 @@
            pages[gnt_nr_grant_frames],
            (char *)grant_table + gnt_nr_grant_frames * PAGE_SIZE));
 
+       /*
+        * map between grant_table addresses and the machine addresses of
+        * the grant table frames
+        */
        pmap_kenter_ma(((vaddr_t)grant_table) + gnt_nr_grant_frames * PAGE_SIZE,
            pages[gnt_nr_grant_frames] << PAGE_SHIFT, VM_PROT_WRITE);
 
-
+       /*
+        * add the grant entries associated to the last grant table frame
+        * and mark them as free
+        */
        for (i = gnt_nr_grant_frames * NR_GRANT_ENTRIES_PER_PAGE;
            i < nframes_new * NR_GRANT_ENTRIES_PER_PAGE;
            i++) {
@@ -165,6 +172,9 @@
        return 0;
 }
 
+/*
+ * Returns a reference to the first free entry in grant table
+ */
 static grant_ref_t
 xengnt_get_entry()
 {
@@ -192,6 +202,9 @@
        return entry;
 }
 
+/*
+ * Mark the grant table entry as free
+ */
 static void
 xengnt_free_entry(grant_ref_t entry)
 {
Index: xen/xen/xennetback_xenbus.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/xen/xennetback_xenbus.c,v
retrieving revision 1.23
diff -u -u -r1.23 xennetback_xenbus.c
--- xen/xen/xennetback_xenbus.c 4 Jun 2008 12:41:42 -0000       1.23
+++ xen/xen/xennetback_xenbus.c 23 Oct 2008 21:36:37 -0000
@@ -307,7 +307,7 @@
        /* create pseudo-interface */
        snprintf(xneti->xni_if.if_xname, IFNAMSIZ, "xvif%d.%d",
            (int)domid, (int)handle);
-       printf("%s: Ethernet address %s\n", ifp->if_xname,
+       aprint_verbose_ifnet(ifp, "Ethernet address %s\n",
            ether_sprintf(xneti->xni_enaddr));
        ifp->if_flags =
            IFF_BROADCAST|IFF_SIMPLEX|IFF_NOTRAILERS|IFF_MULTICAST;
@@ -357,7 +357,7 @@
                return EBUSY;
        }
 #endif
-       printf("%s: disconnecting\n", xneti->xni_if.if_xname);
+       aprint_verbose_ifnet(&xneti->xni_if, "disconnecting\n");
        hypervisor_mask_event(xneti->xni_evtchn);
        event_remove_handler(xneti->xni_evtchn, xennetback_evthandler, xneti);
        softint_disestablish(xneti->xni_softintr);
@@ -375,8 +375,8 @@
                err = HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref,
                    &op, 1);
                if (err)
-                       printf("%s: unmap_grant_ref failed: %d\n",
-                           xneti->xni_if.if_xname, err);
+                       aprint_error_ifnet(&xneti->xni_if,
+                                       "unmap_grant_ref failed: %d\n", err);
        }
        if (xneti->xni_rxring.sring) {
                op.host_addr = xneti->xni_rx_ring_va;
@@ -385,8 +385,8 @@
                err = HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref,
                    &op, 1);
                if (err)
-                       printf("%s: unmap_grant_ref failed: %d\n",
-                           xneti->xni_if.if_xname, err);
+                       aprint_error_ifnet(&xneti->xni_if,
+                                       "unmap_grant_ref failed: %d\n", err);
        }
        uvm_km_free(kernel_map, xneti->xni_tx_ring_va,
            PAGE_SIZE, UVM_KMF_VAONLY);
Index: xen/xenbus/xenbus_comms.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/xenbus/xenbus_comms.c,v
retrieving revision 1.8
diff -u -u -r1.8 xenbus_comms.c
--- xen/xenbus/xenbus_comms.c   21 Oct 2008 15:46:32 -0000      1.8
+++ xen/xenbus/xenbus_comms.c   23 Oct 2008 21:36:37 -0000
@@ -214,7 +214,7 @@
        return 0;
 }
 
-/* Set up interrupt handler off store event channel. */
+/* Set up interrupt handler of store event channel. */
 int
 xb_init_comms(device_t dev)
 {
@@ -226,11 +226,11 @@
        err = event_set_handler(xen_start_info.store_evtchn, wake_waiting,
            NULL, IPL_TTY, "xenbus");
        if (err) {
-               printf("XENBUS request irq failed %i\n", err);
+               aprint_error_dev(dev, "request irq failed %i\n", err);
                return err;
        }
        xenbus_irq = xen_start_info.store_evtchn;
-       printf("%s: using event channel %d\n", device_xname(dev), xenbus_irq);
+       aprint_verbose_dev(dev, "using event channel %d\n", xenbus_irq);
        hypervisor_enable_event(xenbus_irq);
        return 0;
 }
Index: xen/xenbus/xenbus_comms.h
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/xenbus/xenbus_comms.h,v
retrieving revision 1.4
diff -u -u -r1.4 xenbus_comms.h
--- xen/xenbus/xenbus_comms.h   16 Apr 2008 18:41:48 -0000      1.4
+++ xen/xenbus/xenbus_comms.h   23 Oct 2008 21:36:37 -0000
@@ -30,7 +30,7 @@
 #define _XENBUS_COMMS_H
 
 void xenbus_kernfs_init(void);
-int xs_init(void);
+int xs_init(device_t dev);
 int xb_init_comms(device_t dev);
 
 /* Low level routines. */
Index: xen/xenbus/xenbus_probe.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/xenbus/xenbus_probe.c,v
retrieving revision 1.24
diff -u -u -r1.24 xenbus_probe.c
--- xen/xenbus/xenbus_probe.c   21 Oct 2008 21:55:44 -0000      1.24
+++ xen/xenbus/xenbus_probe.c   23 Oct 2008 21:36:37 -0000
@@ -566,7 +566,7 @@
        xb_init_comms(xenbus_dev);
 
        /* Initialize the interface to xenstore. */
-       err = xs_init(); 
+       err = xs_init(xenbus_dev); 
        if (err) {
                aprint_error_dev(xenbus_dev,
                                "Error initializing xenstore comms: %i\n", err);
Index: xen/xenbus/xenbus_xs.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/xenbus/xenbus_xs.c,v
retrieving revision 1.14
diff -u -u -r1.14 xenbus_xs.c
--- xen/xenbus/xenbus_xs.c      13 Mar 2008 22:19:39 -0000      1.14
+++ xen/xenbus/xenbus_xs.c      23 Oct 2008 21:36:38 -0000
@@ -139,7 +139,7 @@
        if (len)
                *len = msg->hdr.len;
        body = msg->u.reply.body;
-       DPRINTK("read_reply: type %d body %s\n",
+       DPRINTK("read_reply: type %d body %s",
            msg->hdr.type, body);
 
        free(msg, M_DEVBUF);
@@ -219,7 +219,7 @@
 
        for (i = 0; i < num_vecs; i++) {
                DPRINTK("write iovect");
-               err = xb_write(iovec[i].iov_base, iovec[i].iov_len);;
+               err = xb_write(iovec[i].iov_base, iovec[i].iov_len);
                DPRINTK("write iovect err %d", err);
                if (err) {
                        mutex_exit(&xs_state.xs_lock);
@@ -746,7 +746,7 @@
                        simple_lock(&watch_events_lock);
                        SIMPLEQ_REMOVE_HEAD(&watch_events, msg_next);
                        simple_unlock(&watch_events_lock);
-                       DPRINTK("xenwatch_thread: got event\n");
+                       DPRINTK("xenwatch_thread: got event");
 
                        msg->u.watch.handle->xbw_callback(
                                msg->u.watch.handle,
@@ -794,7 +794,7 @@
        body[msg->hdr.len] = '\0';
 
        if (msg->hdr.type == XS_WATCH_EVENT) {
-               DPRINTK("process_msg: XS_WATCH_EVENT\n");
+               DPRINTK("process_msg: XS_WATCH_EVENT");
                msg->u.watch.vec = split(body, msg->hdr.len,
                                         &msg->u.watch.vec_size);
                if (msg->u.watch.vec == NULL) {
@@ -818,7 +818,7 @@
                splx(s);
                simple_unlock(&watches_lock);
        } else {
-               DPRINTK("process_msg: type %d body %s\n", msg->hdr.type, body);
+               DPRINTK("process_msg: type %d body %s", msg->hdr.type, body);
                    
                msg->u.reply.body = body;
                simple_lock(&xs_state.reply_lock);
@@ -845,7 +845,7 @@
 }
 
 int
-xs_init(void)
+xs_init(device_t dev)
 {
        int err;
 
@@ -855,13 +855,17 @@
 
        err = kthread_create(PRI_NONE, 0, NULL, xenwatch_thread,
            NULL, NULL, "xenwatch");
-       if (err)
-               printf("kthread_create(xenwatch): %d\n", err);
+       if (err) {
+               aprint_error_dev(dev, "kthread_create(xenwatch): %d\n", err);
+               return err;
+       }
 
        err = kthread_create(PRI_NONE, 0, NULL, xenbus_thread,
            NULL, NULL, "xenbus");
-       if (err)
-               printf("kthread_create(xenbus): %d\n", err);
+       if (err) {
+               aprint_error_dev(dev, "kthread_create(xenbus): %d\n", err);
+               return err;
+       }
 
        return 0;
 }


Home | Main Index | Thread Index | Old Index