| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: xbdback_xenbus.c,v 1.81 2020/04/20 03:00:33 msaitoh Exp $ */ | | 1 | /* $NetBSD: xbdback_xenbus.c,v 1.82 2020/04/20 14:11:04 jdolecek Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2006 Manuel Bouyer. | | 4 | * Copyright (c) 2006 Manuel Bouyer. |
5 | * | | 5 | * |
6 | * Redistribution and use in source and binary forms, with or without | | 6 | * Redistribution and use in source and binary forms, with or without |
7 | * modification, are permitted provided that the following conditions | | 7 | * modification, are permitted provided that the following conditions |
8 | * are met: | | 8 | * are met: |
9 | * 1. Redistributions of source code must retain the above copyright | | 9 | * 1. Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. | | 10 | * notice, this list of conditions and the following disclaimer. |
11 | * 2. Redistributions in binary form must reproduce the above copyright | | 11 | * 2. Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the | | 12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. | | 13 | * documentation and/or other materials provided with the distribution. |
14 | * | | 14 | * |
| @@ -16,27 +16,27 @@ | | | @@ -16,27 +16,27 @@ |
16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | | 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | | 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | | 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | | 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | | 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | | 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | | 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 | * | | 25 | * |
26 | */ | | 26 | */ |
27 | | | 27 | |
28 | #include <sys/cdefs.h> | | 28 | #include <sys/cdefs.h> |
29 | __KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.81 2020/04/20 03:00:33 msaitoh Exp $"); | | 29 | __KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.82 2020/04/20 14:11:04 jdolecek Exp $"); |
30 | | | 30 | |
31 | #include <sys/atomic.h> | | 31 | #include <sys/atomic.h> |
32 | #include <sys/buf.h> | | 32 | #include <sys/buf.h> |
33 | #include <sys/condvar.h> | | 33 | #include <sys/condvar.h> |
34 | #include <sys/conf.h> | | 34 | #include <sys/conf.h> |
35 | #include <sys/disk.h> | | 35 | #include <sys/disk.h> |
36 | #include <sys/device.h> | | 36 | #include <sys/device.h> |
37 | #include <sys/fcntl.h> | | 37 | #include <sys/fcntl.h> |
38 | #include <sys/kauth.h> | | 38 | #include <sys/kauth.h> |
39 | #include <sys/kernel.h> | | 39 | #include <sys/kernel.h> |
40 | #include <sys/kmem.h> | | 40 | #include <sys/kmem.h> |
41 | #include <sys/kthread.h> | | 41 | #include <sys/kthread.h> |
42 | #include <sys/mutex.h> | | 42 | #include <sys/mutex.h> |
| @@ -1794,27 +1794,28 @@ xbdback_map_shm(struct xbdback_io *xbd_i | | | @@ -1794,27 +1794,28 @@ xbdback_map_shm(struct xbdback_io *xbd_i |
1794 | } | | 1794 | } |
1795 | printf("\n"); | | 1795 | printf("\n"); |
1796 | #endif | | 1796 | #endif |
1797 | xbd_io->xio_mapped = 1; | | 1797 | xbd_io->xio_mapped = 1; |
1798 | return xbdi; | | 1798 | return xbdi; |
1799 | default: | | 1799 | default: |
1800 | if (ratecheck(&xbdi->xbdi_lasterr_time, &xbdback_err_intvl)) { | | 1800 | if (ratecheck(&xbdi->xbdi_lasterr_time, &xbdback_err_intvl)) { |
1801 | printf("xbdback_map_shm: xen_shm error %d ", error); | | 1801 | printf("xbdback_map_shm: xen_shm error %d ", error); |
1802 | } | | 1802 | } |
1803 | xbdback_io_error(xbdi->xbdi_io, error); | | 1803 | xbdback_io_error(xbdi->xbdi_io, error); |
1804 | SLIST_INSERT_HEAD(&xbdi->xbdi_va_free, xbd_io->xio_xv, xv_next); | | 1804 | SLIST_INSERT_HEAD(&xbdi->xbdi_va_free, xbd_io->xio_xv, xv_next); |
1805 | xbd_io->xio_xv = NULL; | | 1805 | xbd_io->xio_xv = NULL; |
1806 | xbdi->xbdi_io = NULL; | | 1806 | xbdi->xbdi_io = NULL; |
1807 | xbdi->xbdi_cont = xbdi->xbdi_cont_aux; | | 1807 | // do not retry |
| | | 1808 | xbdi->xbdi_cont = xbdback_co_main_incr; |
1808 | return xbdi; | | 1809 | return xbdi; |
1809 | } | | 1810 | } |
1810 | } | | 1811 | } |
1811 | | | 1812 | |
1812 | /* unmap a request from our virtual address space (request is done) */ | | 1813 | /* unmap a request from our virtual address space (request is done) */ |
1813 | static void | | 1814 | static void |
1814 | xbdback_unmap_shm(struct xbdback_io *xbd_io) | | 1815 | xbdback_unmap_shm(struct xbdback_io *xbd_io) |
1815 | { | | 1816 | { |
1816 | struct xbdback_instance *xbdi = xbd_io->xio_xbdi; | | 1817 | struct xbdback_instance *xbdi = xbd_io->xio_xbdi; |
1817 | | | 1818 | |
1818 | #ifdef XENDEBUG_VBD | | 1819 | #ifdef XENDEBUG_VBD |
1819 | int i; | | 1820 | int i; |
1820 | printf("xbdback_unmap_shm handle "); | | 1821 | printf("xbdback_unmap_shm handle "); |