CVS commit: [netbsd-5-1] src/sys/arch/xen/xen
Module Name:src Committed By: sborrill Date: Fri May 22 11:22:03 UTC 2015 Modified Files: src/sys/arch/xen/xen [netbsd-5-1]: xenevt.c Log Message: Pull up the following revisions(s) (requested by bouyer in ticket #1965): sys/arch/xen/xen/xenevt.c: revision 1.42 Fix off by one error, addresses port-xen/49919. To generate a diff of this commit: cvs rdiff -u -r1.29.4.2 -r1.29.4.2.2.1 src/sys/arch/xen/xen/xenevt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/xen/xenevt.c diff -u src/sys/arch/xen/xen/xenevt.c:1.29.4.2 src/sys/arch/xen/xen/xenevt.c:1.29.4.2.2.1 --- src/sys/arch/xen/xen/xenevt.c:1.29.4.2 Wed Sep 30 00:08:03 2009 +++ src/sys/arch/xen/xen/xenevt.c Fri May 22 11:22:03 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: xenevt.c,v 1.29.4.2 2009/09/30 00:08:03 snj Exp $ */ +/* $NetBSD: xenevt.c,v 1.29.4.2.2.1 2015/05/22 11:22:03 sborrill Exp $ */ /* * Copyright (c) 2005 Manuel Bouyer. @@ -31,7 +31,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: xenevt.c,v 1.29.4.2 2009/09/30 00:08:03 snj Exp $); +__KERNEL_RCSID(0, $NetBSD: xenevt.c,v 1.29.4.2.2.1 2015/05/22 11:22:03 sborrill Exp $); #include opt_xen.h #include sys/param.h @@ -496,7 +496,7 @@ xenevt_fwrite(struct file *fp, off_t *of if (uio-uio_resid == 0) return (0); nentries = uio-uio_resid / sizeof(uint16_t); - if (nentries NR_EVENT_CHANNELS) + if (nentries = NR_EVENT_CHANNELS) return EMSGSIZE; chans = kmem_alloc(nentries * sizeof(uint16_t), KM_SLEEP); if (chans == NULL) @@ -580,7 +580,7 @@ xenevt_fioctl(struct file *fp, u_long cm { struct ioctl_evtchn_unbind *unbind = addr; - if (unbind-port NR_EVENT_CHANNELS) + if (unbind-port = NR_EVENT_CHANNELS) return EINVAL; if (devevent[unbind-port] != d) return ENOTCONN; @@ -596,7 +596,7 @@ xenevt_fioctl(struct file *fp, u_long cm { struct ioctl_evtchn_notify *notify = addr; - if (notify-port NR_EVENT_CHANNELS) + if (notify-port = NR_EVENT_CHANNELS) return EINVAL; if (devevent[notify-port] != d) return ENOTCONN;
CVS commit: [netbsd-5-1] src/sys/arch/xen/xen
Module Name:src Committed By: sborrill Date: Fri Dec 13 08:49:41 UTC 2013 Modified Files: src/sys/arch/xen/xen [netbsd-5-1]: evtchn.c Log Message: Pull up the following revisions(s) (requested by bouyer in ticket #1890): sys/arch/xen/xen/evtchn.c: revision 1.70 Remove the evtchn_do_event: handler %p didn't lower ipl %d %d\n printf as analysis shows it actually isn't a bug in the handler, but related to spin mutexes. Fixes port-xen/46313 To generate a diff of this commit: cvs rdiff -u -r1.39.4.2 -r1.39.4.2.6.1 src/sys/arch/xen/xen/evtchn.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/xen/evtchn.c diff -u src/sys/arch/xen/xen/evtchn.c:1.39.4.2 src/sys/arch/xen/xen/evtchn.c:1.39.4.2.6.1 --- src/sys/arch/xen/xen/evtchn.c:1.39.4.2 Fri Nov 14 02:59:39 2008 +++ src/sys/arch/xen/xen/evtchn.c Fri Dec 13 08:49:41 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: evtchn.c,v 1.39.4.2 2008/11/14 02:59:39 snj Exp $ */ +/* $NetBSD: evtchn.c,v 1.39.4.2.6.1 2013/12/13 08:49:41 sborrill Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -64,7 +64,7 @@ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: evtchn.c,v 1.39.4.2 2008/11/14 02:59:39 snj Exp $); +__KERNEL_RCSID(0, $NetBSD: evtchn.c,v 1.39.4.2.6.1 2013/12/13 08:49:41 sborrill Exp $); #include opt_xen.h #include isa.h @@ -301,13 +301,6 @@ splx: ih_fun = (void *)ih-ih_fun; ih_fun(ih-ih_arg, regs); cli(); - if (ci-ci_ilevel != i) { - printf(evtchn_do_event: - handler %p didn't lower - ipl %d %d\n, - ih_fun, ci-ci_ilevel, i); - ci-ci_ilevel = i; - } } hypervisor_enable_ipl(i); /* more pending IPLs may have been registered */
CVS commit: [netbsd-5-1] src/sys/arch/xen/xen
Module Name:src Committed By: riz Date: Wed Nov 2 20:31:40 UTC 2011 Modified Files: src/sys/arch/xen/xen [netbsd-5-1]: xbdback_xenbus.c Log Message: Pull up following revision(s) (requested by bouyer in ticket #1682): sys/arch/xen/xen/xbdback_xenbus.c: revision 1.45 Guard against spurious xbdback_backend_changed() calls which would result in the block device being opened twice. Fixes port-xen/45158, although the underlying cause (multiple open of the same device not properly handled any more) is not fixed. To generate a diff of this commit: cvs rdiff -u -r1.20.4.3.2.2 -r1.20.4.3.2.3 \ src/sys/arch/xen/xen/xbdback_xenbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/xen/xbdback_xenbus.c diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.20.4.3.2.2 src/sys/arch/xen/xen/xbdback_xenbus.c:1.20.4.3.2.3 --- src/sys/arch/xen/xen/xbdback_xenbus.c:1.20.4.3.2.2 Sat Jun 18 16:39:10 2011 +++ src/sys/arch/xen/xen/xbdback_xenbus.c Wed Nov 2 20:31:40 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: xbdback_xenbus.c,v 1.20.4.3.2.2 2011/06/18 16:39:10 bouyer Exp $ */ +/* $NetBSD: xbdback_xenbus.c,v 1.20.4.3.2.3 2011/11/02 20:31:40 riz Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -31,7 +31,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: xbdback_xenbus.c,v 1.20.4.3.2.2 2011/06/18 16:39:10 bouyer Exp $); +__KERNEL_RCSID(0, $NetBSD: xbdback_xenbus.c,v 1.20.4.3.2.3 2011/11/02 20:31:40 riz Exp $); #include sys/types.h #include sys/param.h @@ -673,10 +673,16 @@ xbdback_backend_changed(struct xenbus_wa */ if (err) return; - if (xbdi-xbdi_status == CONNECTED xbdi-xbdi_dev != dev) { - printf(xbdback %s: changing physical device from 0x%x to - 0x%lx not supported\n, xbusd-xbusd_path, xbdi-xbdi_dev, - dev); + /* + * we can also fire up after having opened the device, don't try + * to do it twice. + */ + if (xbdi-xbdi_vp != NULL) { + if (xbdi-xbdi_status == CONNECTED xbdi-xbdi_dev != dev) { + printf(xbdback %s: changing physical device from + 0x%x to 0x%lx not supported\n, + xbusd-xbusd_path, xbdi-xbdi_dev, dev); + } return; } xbdi-xbdi_dev = dev;
CVS commit: [netbsd-5-1] src/sys/arch/xen/xen
Module Name:src Committed By: bouyer Date: Sat Jun 18 16:39:10 UTC 2011 Modified Files: src/sys/arch/xen/xen [netbsd-5-1]: xbdback_xenbus.c Log Message: Pull up following revision(s) (requested by jym in ticket #1630): sys/arch/xen/xen/xbdback_xenbus.c: revision 1.37 In xbdback(4), move the code that copies segments after the bound checks of the ``nr_segments'' variable. In cases where we are running domUs with an architecture different from the dom0 one (for example: 32 bits domUs on 64 bits dom0), copying segments with an invalid nr_segments value will lead to the corruption of the xbdback instance structure and quickly crash the dom0 backend. Tested under 64 bits dom0 with 32 bits domUs. No regression observed. ok bouyer@. Will be pulled up to -4 and -5. To generate a diff of this commit: cvs rdiff -u -r1.20.4.3.2.1 -r1.20.4.3.2.2 \ src/sys/arch/xen/xen/xbdback_xenbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/xen/xbdback_xenbus.c diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.20.4.3.2.1 src/sys/arch/xen/xen/xbdback_xenbus.c:1.20.4.3.2.2 --- src/sys/arch/xen/xen/xbdback_xenbus.c:1.20.4.3.2.1 Mon Mar 7 04:19:42 2011 +++ src/sys/arch/xen/xen/xbdback_xenbus.c Sat Jun 18 16:39:10 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: xbdback_xenbus.c,v 1.20.4.3.2.1 2011/03/07 04:19:42 riz Exp $ */ +/* $NetBSD: xbdback_xenbus.c,v 1.20.4.3.2.2 2011/06/18 16:39:10 bouyer Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -31,7 +31,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: xbdback_xenbus.c,v 1.20.4.3.2.1 2011/03/07 04:19:42 riz Exp $); +__KERNEL_RCSID(0, $NetBSD: xbdback_xenbus.c,v 1.20.4.3.2.2 2011/06/18 16:39:10 bouyer Exp $); #include sys/types.h #include sys/param.h @@ -869,7 +869,6 @@ blkif_request_t *req = xbdi-xbdi_xen_req; blkif_x86_32_request_t *req32; blkif_x86_64_request_t *req64; - int i; (void)obj; if (xbdi-xbdi_ring.ring_n.req_cons != xbdi-xbdi_req_prod) { @@ -887,8 +886,6 @@ req-handle = req32-handle; req-id = req32-id; req-sector_number = req32-sector_number; - for (i = 0; i req-nr_segments; i++) -req-seg[i] = req32-seg[i]; break; case XBDIP_64: @@ -899,8 +896,6 @@ req-handle = req64-handle; req-id = req64-id; req-sector_number = req64-sector_number; - for (i = 0; i req-nr_segments; i++) -req-seg[i] = req64-seg[i]; break; } XENPRINTF((xbdback op %d req_cons 0x%x req_prod 0x%x @@ -1015,16 +1010,23 @@ static void * xbdback_co_io(struct xbdback_instance *xbdi, void *obj) { - int error; + int i, error; + blkif_request_t *req; + blkif_x86_32_request_t *req32; + blkif_x86_64_request_t *req64; (void)obj; - if (xbdi-xbdi_xen_req.nr_segments 1 || - xbdi-xbdi_xen_req.nr_segments BLKIF_MAX_SEGMENTS_PER_REQUEST ) { + + /* some sanity checks */ + req = xbdi-xbdi_xen_req; + if (req-nr_segments 1 || + req-nr_segments BLKIF_MAX_SEGMENTS_PER_REQUEST) { printf(xbdback_io domain %d: %d segments\n, xbdi-xbdi_domid, xbdi-xbdi_xen_req.nr_segments); error = EINVAL; goto end; } + if (xbdi-xbdi_xen_req.operation == BLKIF_OP_WRITE) { if (xbdi-xbdi_ro) { error = EROFS; @@ -1034,6 +1036,25 @@ xbdi-xbdi_segno = 0; + /* copy request segments */ + switch(xbdi-xbdi_proto) { + case XBDIP_NATIVE: + /* already copied in xbdback_co_main_loop */ + break; + case XBDIP_32: + req32 = RING_GET_REQUEST(xbdi-xbdi_ring.ring_32, + xbdi-xbdi_ring.ring_n.req_cons); + for (i = 0; i req-nr_segments; i++) + req-seg[i] = req32-seg[i]; + break; + case XBDIP_64: + req64 = RING_GET_REQUEST(xbdi-xbdi_ring.ring_64, + xbdi-xbdi_ring.ring_n.req_cons); + for (i = 0; i req-nr_segments; i++) + req-seg[i] = req64-seg[i]; + break; + } + xbdi-xbdi_cont = xbdback_co_io_gotreq; return xbdback_pool_get(xbdback_request_pool, xbdi); end: