Re: svn commit: r270850 - in head/sys: i386/i386 i386/include i386/isa x86/acpica
On Fri, Sep 05, 2014 at 10:44:05AM -0400, John Baldwin wrote: > On Friday, September 05, 2014 4:43:05 am Konstantin Belousov wrote: > > On Thu, Sep 04, 2014 at 10:50:25PM -0400, John Baldwin wrote: > > > On Tuesday, September 02, 2014 06:41:27 PM Konstantin Belousov wrote: > > > > On Tue, Sep 02, 2014 at 11:00:57AM -0400, John Baldwin wrote: > > > > > I thought about that. I could easily make a parallel array, or > > > > > perhaps > > > > > use a separate 'susppcb' structure that includes a pcb and the savefpu > > > > > union and change susppcbs to be an array of those. Which do you > > > > > prefer? > > > > > If we want to move some state out of the PCB on amd64 into this, then > > > > > a > > > > > separate struct for susppcbs might be the sanest. > > > > > > > > Yes, separate structure seems to be a way forward. > > > > > > Please see www.freebsd.org/~jhb/patches/susppcb.patch Note that I moved > > > fpususpend() out into a C function on amd64 so that resumectx() could > > > still > > > operate on just a pcb. This also makes savectx and resumectx more > > > symmetric > > > and matches what I ended up doing on i386. This is tested for suspend and > > > resume on both i386 and amd64. > > > > The implementation of fpuresume() in C is definitely an improvement. > > > > You only moved the fpu context to the susppcb, I think this is good for > > now, we will want to move other bits later. > > > > Do we need to keep pcb layout for KBI compat ? I remember that pcb > > size is asserted to properly fit into pcpu area for percpu zones. > > But why keep the layout ? I.e. moving all padding bits to the end. > > I wasn't sure. I thought the padding was there for ABI reasons. If we don't > need KBI compat, I would much rather consolidate all the padding at the end. The padding is due to functional requirements. I do not see KBI requirements that would cause us to keep the layout, at least in HEAD. > > > There is one weird detail, not touched by your patch. Amd64 resume > > path calls initializecpu(), while i386 does not. I do not see any > > use for the call, the reload of CRX registers by trampoline/resumectx > > should already set everything to working state. E.g., enabling XMM > > in CR4 after fpu state is restored looks strange. > > I can test that. > > > Overall, it looks fine. Do you prefer to have alloc_fpusave() on i386 ? > > Well, it might be nice to have XSAVE on i386. I'm not sure if Intel has > any 32-bit only chips planned that will use AVX or MPX, etc. If they are, > then I do think AVX on i386 would be nice to have. Barring XSAVE I think > we can just use a static savefpu on i386 for now. I mean that having alloc_fpusave() would allow to avoid several #ifdefs by using pointer to save area on i386 as well. > > We might also consider removing support for 486sx CPUs and requiring an > on-CPU FPU for i386. If we do that we might able to use a common fpu.c > which would be even nicer. IMO merging fpu.c and npx.c is very non-trivial. First obstacle is the differences between i386 and amd64 fpu context layouts (software-imposed). pgpp63Z2Cfin6.pgp Description: PGP signature
svn commit: r271186 - in head/sys: arm/altera/socfpga boot/fdt/dts/arm
Author: br Date: Sat Sep 6 08:48:57 2014 New Revision: 271186 URL: http://svnweb.freebsd.org/changeset/base/271186 Log: Add FPGA Manager driver. This driver allows to program FPGA core from FreeBSD userspace running on ARM core. Sponsored by: DARPA, AFRL Added: head/sys/arm/altera/socfpga/socfpga_common.h (contents, props changed) head/sys/arm/altera/socfpga/socfpga_manager.c (contents, props changed) Modified: head/sys/arm/altera/socfpga/files.socfpga head/sys/boot/fdt/dts/arm/socfpga.dtsi Modified: head/sys/arm/altera/socfpga/files.socfpga == --- head/sys/arm/altera/socfpga/files.socfpga Sat Sep 6 04:39:26 2014 (r271185) +++ head/sys/arm/altera/socfpga/files.socfpga Sat Sep 6 08:48:57 2014 (r271186) @@ -15,3 +15,4 @@ arm/arm/mpcore_timer.cstandard arm/altera/socfpga/socfpga_common.cstandard arm/altera/socfpga/socfpga_machdep.c standard +arm/altera/socfpga/socfpga_manager.c standard Added: head/sys/arm/altera/socfpga/socfpga_common.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/altera/socfpga/socfpga_common.hSat Sep 6 08:48:57 2014(r271186) @@ -0,0 +1,44 @@ +/*- + * Copyright (c) 2014 Ruslan Bukin + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#defineREAD4(_sc, _reg)\ + bus_space_read_4(_sc->bst, _sc->bsh, _reg) +#defineWRITE4(_sc, _reg, _val) \ + bus_space_write_4(_sc->bst, _sc->bsh, _reg, _val) +#defineREAD2(_sc, _reg)\ + bus_space_read_2(_sc->bst, _sc->bsh, _reg) +#defineWRITE2(_sc, _reg, _val) \ + bus_space_write_2(_sc->bst, _sc->bsh, _reg, _val) +#defineREAD1(_sc, _reg)\ + bus_space_read_1(_sc->bst, _sc->bsh, _reg) +#defineWRITE1(_sc, _reg, _val) \ + bus_space_write_1(_sc->bst, _sc->bsh, _reg, _val) Added: head/sys/arm/altera/socfpga/socfpga_manager.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/altera/socfpga/socfpga_manager.c Sat Sep 6 08:48:57 2014(r271186) @@ -0,0 +1,436 @@ +/*- + * Copyright (c) 2014 Ruslan Bukin + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SH
svn commit: r271187 - head/usr.sbin/ctld
Author: trasz Date: Sat Sep 6 09:03:13 2014 New Revision: 271187 URL: http://svnweb.freebsd.org/changeset/base/271187 Log: Avoid ctld(8) crash on getaddrinfo(3) failure. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/ctld/ctld.c Modified: head/usr.sbin/ctld/ctld.c == --- head/usr.sbin/ctld/ctld.c Sat Sep 6 08:48:57 2014(r271186) +++ head/usr.sbin/ctld/ctld.c Sat Sep 6 09:03:13 2014(r271187) @@ -561,8 +561,10 @@ portal_new(struct portal_group *pg) static void portal_delete(struct portal *portal) { + TAILQ_REMOVE(&portal->p_portal_group->pg_portals, portal, p_next); - freeaddrinfo(portal->p_ai); + if (portal->p_ai != NULL) + freeaddrinfo(portal->p_ai); free(portal->p_listen); free(portal); } @@ -633,8 +635,7 @@ portal_group_add_listen(struct portal_gr arg = portal->p_listen; if (arg[0] == '\0') { log_warnx("empty listen address"); - free(portal->p_listen); - free(portal); + portal_delete(portal); return (1); } if (arg[0] == '[') { @@ -646,8 +647,7 @@ portal_group_add_listen(struct portal_gr if (arg == NULL) { log_warnx("invalid listen address %s", portal->p_listen); - free(portal->p_listen); - free(portal); + portal_delete(portal); return (1); } if (arg[0] == '\0') { @@ -657,8 +657,7 @@ portal_group_add_listen(struct portal_gr } else { log_warnx("invalid listen address %s", portal->p_listen); - free(portal->p_listen); - free(portal); + portal_delete(portal); return (1); } } else { @@ -691,8 +690,7 @@ portal_group_add_listen(struct portal_gr if (error != 0) { log_warnx("getaddrinfo for %s failed: %s", portal->p_listen, gai_strerror(error)); - free(portal->p_listen); - free(portal); + portal_delete(portal); return (1); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r271186 - in head/sys: arm/altera/socfpga boot/fdt/dts/arm
On Sat, 6 Sep 2014 08:48:58 + (UTC) Ruslan Bukin wrote: > Author: br > Date: Sat Sep 6 08:48:57 2014 > New Revision: 271186 > URL: http://svnweb.freebsd.org/changeset/base/271186 > > Log: > Add FPGA Manager driver. This driver allows to program FPGA core > from FreeBSD userspace running on ARM core. A few comments below. Andrew ... > Added: head/sys/arm/altera/socfpga/socfpga_common.h > == > --- /dev/null 00:00:00 1970 (empty, because file is > newly added) +++ head/sys/arm/altera/socfpga/socfpga_common.h > Sat Sep 6 08:48:57 2014 (r271186) @@ -0,0 +1,44 @@ > +/*- > + * Copyright (c) 2014 Ruslan Bukin > + * All rights reserved. > + * > + * This software was developed by SRI International and the > University of > + * Cambridge Computer Laboratory under DARPA/AFRL contract > (FA8750-10-C-0237) > + * ("CTSRD"), as part of the DARPA CRASH research programme. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + *notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above > copyright > + *notice, this list of conditions and the following disclaimer > in the > + *documentation and/or other materials provided with the > distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS > IS'' AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, > THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A > PARTICULAR PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE > LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR > CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE > GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS > INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN > CONTRACT, STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN > ANY WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE > POSSIBILITY OF > + * SUCH DAMAGE. > + * > + * $FreeBSD$ > + */ > + > +#define READ4(_sc, _reg)\ > + bus_space_read_4(_sc->bst, _sc->bsh, _reg) > +#define WRITE4(_sc, _reg, _val) \ > + bus_space_write_4(_sc->bst, _sc->bsh, _reg, _val) > +#define READ2(_sc, _reg)\ > + bus_space_read_2(_sc->bst, _sc->bsh, _reg) > +#define WRITE2(_sc, _reg, _val) \ > + bus_space_write_2(_sc->bst, _sc->bsh, _reg, _val) > +#define READ1(_sc, _reg)\ > + bus_space_read_1(_sc->bst, _sc->bsh, _reg) > +#define WRITE1(_sc, _reg, _val) \ > + bus_space_write_1(_sc->bst, _sc->bsh, _reg, _val) Why are these in a header when the softc is in a .c file? Also why not use bus_read_n, e.g. READ4 would become: #define READ4(_sc, _reg) bus_read_4((_sc)->res[0], _reg) > > Added: head/sys/arm/altera/socfpga/socfpga_manager.c > == > --- /dev/null 00:00:00 1970 (empty, because file is > newly added) +++ head/sys/arm/altera/socfpga/socfpga_manager.c > Sat Sep 6 08:48:57 2014 (r271186) @@ -0,0 +1,436 @@ > +/*- > + * Copyright (c) 2014 Ruslan Bukin > + * All rights reserved. > + * > + * This software was developed by SRI International and the > University of > + * Cambridge Computer Laboratory under DARPA/AFRL contract > (FA8750-10-C-0237) > + * ("CTSRD"), as part of the DARPA CRASH research programme. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + *notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above > copyright > + *notice, this list of conditions and the following disclaimer > in the > + *documentation and/or other materials provided with the > distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS > IS'' AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, > THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A > PARTICULAR PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE > LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR > CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE > GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS > INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN > CONTRACT, STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
svn commit: r271188 - head/share/man/man4
Author: joel (doc committer) Date: Sat Sep 6 11:19:12 2014 New Revision: 271188 URL: http://svnweb.freebsd.org/changeset/base/271188 Log: mdoc: remove superfluous paragraph macro. Modified: head/share/man/man4/uled.4 Modified: head/share/man/man4/uled.4 == --- head/share/man/man4/uled.4 Sat Sep 6 09:03:13 2014(r271187) +++ head/share/man/man4/uled.4 Sat Sep 6 11:19:12 2014(r271188) @@ -73,7 +73,6 @@ struct uled_color { uint8_t blue; }; .Ed -.Pp .It Dv ULED_SET_COLOR The command sets LED colors with values for RGB. It uses the same structure as above. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r271186 - in head/sys: arm/altera/socfpga boot/fdt/dts/arm
On Sat, Sep 06, 2014 at 11:45:14AM +0100, Andrew Turner wrote: > > +#defineWRITE1(_sc, _reg, _val) \ > > + bus_space_write_1(_sc->bst, _sc->bsh, _reg, _val) > > Why are these in a header when the softc is in a .c file? Also why not > use bus_read_n, e.g. READ4 would become: > > #define READ4(_sc, _reg) bus_read_4((_sc)->res[0], _reg) > > I want to use these defines in other socfpga drivers, so I leaved it in header file. Is that fine ? Excellent review, thanks. I've prepared the patch Ruslan Index: sys/arm/altera/socfpga/socfpga_common.h === --- sys/arm/altera/socfpga/socfpga_common.h (revision 271188) +++ sys/arm/altera/socfpga/socfpga_common.h (working copy) @@ -30,15 +30,9 @@ * $FreeBSD$ */ -#defineREAD4(_sc, _reg)\ - bus_space_read_4(_sc->bst, _sc->bsh, _reg) -#defineWRITE4(_sc, _reg, _val) \ - bus_space_write_4(_sc->bst, _sc->bsh, _reg, _val) -#defineREAD2(_sc, _reg)\ - bus_space_read_2(_sc->bst, _sc->bsh, _reg) -#defineWRITE2(_sc, _reg, _val) \ - bus_space_write_2(_sc->bst, _sc->bsh, _reg, _val) -#defineREAD1(_sc, _reg)\ - bus_space_read_1(_sc->bst, _sc->bsh, _reg) -#defineWRITE1(_sc, _reg, _val) \ - bus_space_write_1(_sc->bst, _sc->bsh, _reg, _val) +#defineREAD4(_sc, _reg) bus_read_4((_sc)->res[0], _reg) +#defineREAD2(_sc, _reg) bus_read_2((_sc)->res[0], _reg) +#defineREAD1(_sc, _reg) bus_read_1((_sc)->res[0], _reg) +#defineWRITE4(_sc, _reg, _val) bus_write_4((_sc)->res[0], _reg, _val) +#defineWRITE2(_sc, _reg, _val) bus_write_2((_sc)->res[0], _reg, _val) +#defineWRITE1(_sc, _reg, _val) bus_write_1((_sc)->res[0], _reg, _val) Index: sys/arm/altera/socfpga/socfpga_manager.c === --- sys/arm/altera/socfpga/socfpga_manager.c(revision 271188) +++ sys/arm/altera/socfpga/socfpga_manager.c(working copy) @@ -91,6 +91,7 @@ #defineGPIO_PORTA_EOI 0x84C /* Clear Interrupt Register */ #define PORTA_EOI_NS (1 << 0) #defineGPIO_EXT_PORTA 0x850 /* External Port A Register */ +#define EXT_PORTA_CDP (1 << 10) /* Configuration done */ #defineGPIO_LS_SYNC0x860 /* Synchronization Level Register */ #defineGPIO_VER_ID_CODE0x86C /* GPIO Version Register */ #defineGPIO_CONFIG_REG20x870 /* Configuration Register 2 */ @@ -147,8 +148,6 @@ struct fpgamgr_softc { struct resource *res[3]; - bus_space_tag_t bst; - bus_space_handle_t bsh; bus_space_tag_t bst_data; bus_space_handle_t bsh_data; struct cdev *mgr_cdev; @@ -163,20 +162,6 @@ }; static int -fpgamgr_probe(device_t dev) -{ - - if (!ofw_bus_status_okay(dev)) - return (ENXIO); - - if (!ofw_bus_is_compatible(dev, "altr,fpga-mgr")) - return (ENXIO); - - device_set_desc(dev, "FPGA Manager"); - return (BUS_PROBE_DEFAULT); -} - -static int fpgamgr_state_get(struct fpgamgr_softc *sc) { int reg; @@ -208,7 +193,7 @@ } static int -fpga_open(struct cdev *dev __unused, int flags __unused, +fpga_open(struct cdev *dev, int flags __unused, int fmt __unused, struct thread *td __unused) { struct fpgamgr_softc *sc; @@ -310,7 +295,7 @@ } static int -fpga_close(struct cdev *dev __unused, int flags __unused, +fpga_close(struct cdev *dev, int flags __unused, int fmt __unused, struct thread *td __unused) { struct fpgamgr_softc *sc; @@ -319,7 +304,7 @@ sc = dev->si_drv1; reg = READ4(sc, GPIO_EXT_PORTA); - if ((reg & (1 << 10)) == 0) { + if ((reg & EXT_PORTA_CDP) == 0) { device_printf(sc->dev, "Err: configuration failed\n"); return (ENXIO); } @@ -388,6 +373,20 @@ }; static int +fpgamgr_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_is_compatible(dev, "altr,fpga-mgr")) + return (ENXIO); + + device_set_desc(dev, "FPGA Manager"); + return (BUS_PROBE_DEFAULT); +} + +static int fpgamgr_attach(device_t dev) { struct fpgamgr_softc *sc; @@ -401,8 +400,6 @@ } /* Memory interface */ - sc->bst = rman_get_bustag(sc->res[0]); - sc->bsh = rman_get_bushandle(sc->res[0]); sc->bst_data = rman_get_bustag(sc->res[1]); sc->bsh_data = rman_get_bushandle(sc->res[1]); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r271189 - head/sys/arm/arm
Author: andrew Date: Sat Sep 6 13:21:07 2014 New Revision: 271189 URL: http://svnweb.freebsd.org/changeset/base/271189 Log: Allow us to use the virtual timer. It is currently disabled, but should be usable as the default timer in place of the physical timer. We are guaranteed to have access to the virtual timer, but when running under a hypervisor may not have access to the physical. Differential Revision: https://reviews.freebsd.org/D588 Modified: head/sys/arm/arm/generic_timer.c Modified: head/sys/arm/arm/generic_timer.c == --- head/sys/arm/arm/generic_timer.cSat Sep 6 11:19:12 2014 (r271188) +++ head/sys/arm/arm/generic_timer.cSat Sep 6 13:21:07 2014 (r271189) @@ -67,7 +67,7 @@ __FBSDID("$FreeBSD$"); #defineGT_CNTKCTL_PL0PTEN (1 << 9) /* PL0 Physical timer reg access */ #defineGT_CNTKCTL_PL0VTEN (1 << 8) /* PL0 Virtual timer reg access */ -#defineGT_CNTKCTL_EVNTI(1 << 4) /* Virtual counter event bits */ +#defineGT_CNTKCTL_EVNTI(0xf << 4) /* Virtual counter event bits */ #defineGT_CNTKCTL_EVNTDIR (1 << 3) /* Virtual counter event transition */ #defineGT_CNTKCTL_EVNTEN (1 << 2) /* Enables virtual counter events */ #defineGT_CNTKCTL_PL0VCTEN (1 << 1) /* PL0 CNTVCT and CNTFRQ access */ @@ -78,6 +78,7 @@ struct arm_tmr_softc { void*ihl[4]; uint32_tclkfreq; struct eventtimer et; + boolphysical; }; static struct arm_tmr_softc *arm_tmr_sc = NULL; @@ -101,81 +102,83 @@ static struct timecounter arm_tmr_timeco .tc_quality= 1000, }; -static inline int +static int get_freq(void) { uint32_t val; + /* cntfrq */ __asm volatile("mrc p15, 0, %0, c14, c0, 0" : "=r" (val)); return (val); } -static inline int -set_freq(uint32_t val) -{ - - __asm volatile("mcr p15, 0, %[val], c14, c0, 0" : : - [val] "r" (val)); - isb(); - - return (val); -} - - -static inline long -get_cntpct(void) +static long +get_cntxct(bool physical) { uint64_t val; - __asm volatile("mrrc p15, 0, %Q0, %R0, c14" : "=r" (val)); + isb(); + if (physical) + /* cntpct */ + __asm volatile("mrrc p15, 0, %Q0, %R0, c14" : "=r" (val)); + else + /* cntvct */ + __asm volatile("mrrc p15, 1, %Q0, %R0, c14" : "=r" (val)); return (val); } -static inline int -set_ctrl(uint32_t val) +static int +set_ctrl(uint32_t val, bool physical) { - __asm volatile("mcr p15, 0, %[val], c14, c2, 1" : : - [val] "r" (val)); + if (physical) + /* cntp_ctl */ + __asm volatile("mcr p15, 0, %[val], c14, c2, 1" : : + [val] "r" (val)); + else + /* cntv_ctl */ + __asm volatile("mcr p15, 0, %[val], c14, c3, 1" : : + [val] "r" (val)); isb(); return (0); } -static inline int -set_tval(uint32_t val) +static int +set_tval(uint32_t val, bool physical) { - __asm volatile("mcr p15, 0, %[val], c14, c2, 0" : : - [val] "r" (val)); + if (physical) + /* cntp_tval */ + __asm volatile("mcr p15, 0, %[val], c14, c2, 0" : : + [val] "r" (val)); + else + /* cntv_tval */ + __asm volatile("mcr p15, 0, %[val], c14, c3, 0" : : + [val] "r" (val)); isb(); return (0); } -static inline int -get_ctrl(void) -{ - uint32_t val; - - __asm volatile("mrc p15, 0, %0, c14, c2, 1" : "=r" (val)); - - return (val); -} - -static inline int -get_tval(void) +static int +get_ctrl(bool physical) { uint32_t val; - __asm volatile("mrc p15, 0, %0, c14, c2, 0" : "=r" (val)); + if (physical) + /* cntp_ctl */ + __asm volatile("mrc p15, 0, %0, c14, c2, 1" : "=r" (val)); + else + /* cntv_ctl */ + __asm volatile("mrc p15, 0, %0, c14, c3, 1" : "=r" (val)); return (val); } -static inline void +static void disable_user_access(void) { uint32_t cntkctl; @@ -191,7 +194,7 @@ static unsigned arm_tmr_get_timecount(struct timecounter *tc) { - return (get_cntpct()); + return (get_cntxct(arm_tmr_sc->physical)); } static int @@ -204,11 +207,11 @@ arm_tmr_start(struct eventtimer *et, sbi if (first != 0) { counts = ((uint32_t)et->et_frequency * first) >> 32; - ctrl = get_ctrl(); + ctrl = get_ctrl(sc->physical); ctrl &= ~GT_CTRL_INT_MASK; ctrl |= GT_CTRL_ENABLE; - set_tval(counts); - set_ctrl(ctrl); + s
svn commit: r271190 - head/sys/dev/ofw
Author: ian Date: Sat Sep 6 15:11:35 2014 New Revision: 271190 URL: http://svnweb.freebsd.org/changeset/base/271190 Log: Add OF_xref_from_node_strict() which returns -1 if there is no xref handle for the node. The default routine returns the untranslated handle, which is sometimes useful, but sometimes you really need to know there's no entry in the xref<->node<->device translation table. Modified: head/sys/dev/ofw/openfirm.c head/sys/dev/ofw/openfirm.h Modified: head/sys/dev/ofw/openfirm.c == --- head/sys/dev/ofw/openfirm.c Sat Sep 6 13:21:07 2014(r271189) +++ head/sys/dev/ofw/openfirm.c Sat Sep 6 15:11:35 2014(r271190) @@ -554,15 +554,15 @@ OF_node_from_xref(phandle_t xref) return (node); } -phandle_t -OF_xref_from_node(phandle_t node) +static phandle_t +xref_from_node(phandle_t node, phandle_t notfoundvalue) { struct xrefinfo *xi; phandle_t xref; if (xref_init_done) { if ((xi = xrefinfo_find(node, FIND_BY_NODE)) == NULL) - return (node); + return (notfoundvalue); return (xi->xref); } @@ -570,10 +570,24 @@ OF_xref_from_node(phandle_t node) -1 && OF_getencprop(node, "ibm,phandle", &xref, sizeof(xref)) == -1 && OF_getencprop(node, "linux,phandle", &xref, sizeof(xref)) == -1) - return (node); + return (notfoundvalue); return (xref); } +phandle_t +OF_xref_from_node(phandle_t node) +{ + + return (xref_from_node(node, node)); +} + +phandle_t +OF_xref_from_node_strict(phandle_t node) +{ + + return (xref_from_node(node, -1)); +} + device_t OF_device_from_xref(phandle_t xref) { Modified: head/sys/dev/ofw/openfirm.h == --- head/sys/dev/ofw/openfirm.h Sat Sep 6 13:21:07 2014(r271189) +++ head/sys/dev/ofw/openfirm.h Sat Sep 6 15:11:35 2014(r271190) @@ -128,10 +128,12 @@ ssize_t OF_package_to_path(phandle_t no * Some OF implementations (IBM, FDT) have a concept of effective phandles * used for device-tree cross-references. Given one of these, returns the * real phandle. If one can't be found (or running on OF implementations - * without this property), returns its input. + * without this property), OF_xref_from_node() returns its input, while the + * strict version returns -1. */ phandle_t OF_node_from_xref(phandle_t xref); phandle_t OF_xref_from_node(phandle_t node); +phandle_t OF_xref_from_node_strict(phandle_t node); /* * When properties contain references to other nodes using xref handles it is ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r271192 - in head/sys: amd64/amd64 amd64/include dev/acpica i386/i386 i386/include sparc64/pci x86/acpica
Author: jhb Date: Sat Sep 6 15:23:28 2014 New Revision: 271192 URL: http://svnweb.freebsd.org/changeset/base/271192 Log: Create a separate structure for per-CPU state saved across suspend and resume that is a superset of a pcb. Move the FPU state out of the pcb and into this new structure. As part of this, move the FPU resume code on amd64 into a C function. This allows resumectx() to still operate only on a pcb and more closely mirrors the i386 code. Reviewed by: kib (earlier version) Modified: head/sys/amd64/amd64/cpu_switch.S head/sys/amd64/amd64/fpu.c head/sys/amd64/amd64/genassym.c head/sys/amd64/amd64/mp_machdep.c head/sys/amd64/include/fpu.h head/sys/amd64/include/pcb.h head/sys/dev/acpica/acpi.c head/sys/i386/i386/mp_machdep.c head/sys/i386/include/pcb.h head/sys/sparc64/pci/psycho.c head/sys/x86/acpica/acpi_wakeup.c Modified: head/sys/amd64/amd64/cpu_switch.S == --- head/sys/amd64/amd64/cpu_switch.S Sat Sep 6 15:15:06 2014 (r271191) +++ head/sys/amd64/amd64/cpu_switch.S Sat Sep 6 15:23:28 2014 (r271192) @@ -399,10 +399,6 @@ ENTRY(savectx) rdmsr movl%eax,PCB_SFMASK(%rdi) movl%edx,PCB_SFMASK+4(%rdi) - movlxsave_mask,%eax - movl%eax,PCB_XSMASK(%rdi) - movlxsave_mask+4,%eax - movl%eax,PCB_XSMASK+4(%rdi) sgdtPCB_GDT(%rdi) sidtPCB_IDT(%rdi) @@ -467,12 +463,9 @@ ENTRY(resumectx) movlPCB_SFMASK(%rdi),%eax wrmsr - /* Restore CR0 except for FPU mode. */ + /* Restore CR0, CR2, CR4 and CR3. */ movqPCB_CR0(%rdi),%rax - andq$~(CR0_EM | CR0_TS),%rax movq%rax,%cr0 - - /* Restore CR2, CR4 and CR3. */ movqPCB_CR2(%rdi),%rax movq%rax,%cr2 movqPCB_CR4(%rdi),%rax @@ -510,26 +503,6 @@ ENTRY(resumectx) movqPCB_DR7(%rdi),%rax movq%rax,%dr7 - /* Restore FPU state. */ - fninit - movqPCB_FPUSUSPEND(%rdi),%rbx - movqPCB_XSMASK(%rdi),%rax - testq %rax,%rax - jz 1f - movq%rax,%rdx - shrq$32,%rdx - movl$XCR0,%ecx - xsetbv - xrstor (%rbx) - jmp 2f -1: - fxrstor (%rbx) -2: - - /* Reload CR0. */ - movqPCB_CR0(%rdi),%rax - movq%rax,%cr0 - /* Restore other callee saved registers. */ movqPCB_R15(%rdi),%r15 movqPCB_R14(%rdi),%r14 Modified: head/sys/amd64/amd64/fpu.c == --- head/sys/amd64/amd64/fpu.c Sat Sep 6 15:15:06 2014(r271191) +++ head/sys/amd64/amd64/fpu.c Sat Sep 6 15:23:28 2014(r271192) @@ -173,6 +173,20 @@ fpususpend(void *addr) load_cr0(cr0); } +void +fpuresume(void *addr) +{ + u_long cr0; + + cr0 = rcr0(); + stop_emulating(); + fninit(); + if (use_xsave) + load_xcr(XCR0, xsave_mask); + fpurestore(addr); + load_cr0(cr0); +} + /* * Enable XSAVE if supported and allowed by user. * Calculate the xsave_mask. Modified: head/sys/amd64/amd64/genassym.c == --- head/sys/amd64/amd64/genassym.c Sat Sep 6 15:15:06 2014 (r271191) +++ head/sys/amd64/amd64/genassym.c Sat Sep 6 15:23:28 2014 (r271192) @@ -163,8 +163,6 @@ ASSYM(PCB_STAR, offsetof(struct pcb, pcb ASSYM(PCB_LSTAR, offsetof(struct pcb, pcb_lstar)); ASSYM(PCB_CSTAR, offsetof(struct pcb, pcb_cstar)); ASSYM(PCB_SFMASK, offsetof(struct pcb, pcb_sfmask)); -ASSYM(PCB_XSMASK, offsetof(struct pcb, pcb_xsmask)); -ASSYM(PCB_FPUSUSPEND, offsetof(struct pcb, pcb_fpususpend)); ASSYM(PCB_SIZE, sizeof(struct pcb)); ASSYM(PCB_FULL_IRET, PCB_FULL_IRET); ASSYM(PCB_DBREGS, PCB_DBREGS); Modified: head/sys/amd64/amd64/mp_machdep.c == --- head/sys/amd64/amd64/mp_machdep.c Sat Sep 6 15:15:06 2014 (r271191) +++ head/sys/amd64/amd64/mp_machdep.c Sat Sep 6 15:23:28 2014 (r271192) @@ -102,7 +102,7 @@ char *nmi_stack; void *dpcpu; struct pcb stoppcbs[MAXCPU]; -struct pcb **susppcbs; +struct susppcb **susppcbs; /* Variables needed for SMP tlb shootdown. */ vm_offset_t smp_tlb_addr2; @@ -1461,11 +1461,12 @@ cpususpend_handler(void) mtx_assert(&smp_ipi_mtx, MA_NOTOWNED); cpu = PCPU_GET(cpuid); - if (savectx(susppcbs[cpu])) { - fpususpend(susppcbs[cpu]->pcb_fpususpend); + if (savectx(&susppcbs[cpu]->sp_pcb)) { + fpususpend(susppcbs[cpu]->sp_fpususpend); wbinvd(); CPU_SET_ATOMIC(cpu, &suspended_cpus); } else { + fpuresume(susppcbs[cpu]->sp_fpususpend); pmap_init_pat();
Re: svn commit: r271190 - head/sys/dev/ofw
What is this for? The way the specification works here explicitly requires this fallback. -Nathan On 09/06/14 08:11, Ian Lepore wrote: Author: ian Date: Sat Sep 6 15:11:35 2014 New Revision: 271190 URL: http://svnweb.freebsd.org/changeset/base/271190 Log: Add OF_xref_from_node_strict() which returns -1 if there is no xref handle for the node. The default routine returns the untranslated handle, which is sometimes useful, but sometimes you really need to know there's no entry in the xref<->node<->device translation table. Modified: head/sys/dev/ofw/openfirm.c head/sys/dev/ofw/openfirm.h Modified: head/sys/dev/ofw/openfirm.c == --- head/sys/dev/ofw/openfirm.c Sat Sep 6 13:21:07 2014(r271189) +++ head/sys/dev/ofw/openfirm.c Sat Sep 6 15:11:35 2014(r271190) @@ -554,15 +554,15 @@ OF_node_from_xref(phandle_t xref) return (node); } -phandle_t -OF_xref_from_node(phandle_t node) +static phandle_t +xref_from_node(phandle_t node, phandle_t notfoundvalue) { struct xrefinfo *xi; phandle_t xref; if (xref_init_done) { if ((xi = xrefinfo_find(node, FIND_BY_NODE)) == NULL) - return (node); + return (notfoundvalue); return (xi->xref); } @@ -570,10 +570,24 @@ OF_xref_from_node(phandle_t node) -1 && OF_getencprop(node, "ibm,phandle", &xref, sizeof(xref)) == -1 && OF_getencprop(node, "linux,phandle", &xref, sizeof(xref)) == -1) - return (node); + return (notfoundvalue); return (xref); } +phandle_t +OF_xref_from_node(phandle_t node) +{ + + return (xref_from_node(node, node)); +} + +phandle_t +OF_xref_from_node_strict(phandle_t node) +{ + + return (xref_from_node(node, -1)); +} + device_t OF_device_from_xref(phandle_t xref) { Modified: head/sys/dev/ofw/openfirm.h == --- head/sys/dev/ofw/openfirm.h Sat Sep 6 13:21:07 2014(r271189) +++ head/sys/dev/ofw/openfirm.h Sat Sep 6 15:11:35 2014(r271190) @@ -128,10 +128,12 @@ ssize_t OF_package_to_path(phandle_t no * Some OF implementations (IBM, FDT) have a concept of effective phandles * used for device-tree cross-references. Given one of these, returns the * real phandle. If one can't be found (or running on OF implementations - * without this property), returns its input. + * without this property), OF_xref_from_node() returns its input, while the + * strict version returns -1. */ phandle_t OF_node_from_xref(phandle_t xref); phandle_t OF_xref_from_node(phandle_t node); +phandle_t OF_xref_from_node_strict(phandle_t node); /* * When properties contain references to other nodes using xref handles it is ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r271190 - head/sys/dev/ofw
On Sat, 2014-09-06 at 08:25 -0700, Nathan Whitehorn wrote: > What is this for? The way the specification works here explicitly > requires this fallback. > -Nathan > It's for determining whether there is an entry in the device<->xref list. If a node has no xref phandle property there will be no entry for it in the list and thus no way to record or retrieve a device association. I found myself coding the "if it has a phandle, or an ibm,phandle, or a linux,phandle" incantation, then realized that all that figuring-out work was done at init time when the xref list is built, I just needed a way to get the result. -- Ian > On 09/06/14 08:11, Ian Lepore wrote: > > Author: ian > > Date: Sat Sep 6 15:11:35 2014 > > New Revision: 271190 > > URL: http://svnweb.freebsd.org/changeset/base/271190 > > > > Log: > >Add OF_xref_from_node_strict() which returns -1 if there is no xref > > handle > >for the node. The default routine returns the untranslated handle, which > >is sometimes useful, but sometimes you really need to know there's no > >entry in the xref<->node<->device translation table. > > > > Modified: > >head/sys/dev/ofw/openfirm.c > >head/sys/dev/ofw/openfirm.h > > > > Modified: head/sys/dev/ofw/openfirm.c > > == > > --- head/sys/dev/ofw/openfirm.c Sat Sep 6 13:21:07 2014 > > (r271189) > > +++ head/sys/dev/ofw/openfirm.c Sat Sep 6 15:11:35 2014 > > (r271190) > > @@ -554,15 +554,15 @@ OF_node_from_xref(phandle_t xref) > > return (node); > > } > > > > -phandle_t > > -OF_xref_from_node(phandle_t node) > > +static phandle_t > > +xref_from_node(phandle_t node, phandle_t notfoundvalue) > > { > > struct xrefinfo *xi; > > phandle_t xref; > > > > if (xref_init_done) { > > if ((xi = xrefinfo_find(node, FIND_BY_NODE)) == NULL) > > - return (node); > > + return (notfoundvalue); > > return (xi->xref); > > } > > > > @@ -570,10 +570,24 @@ OF_xref_from_node(phandle_t node) > > -1 && OF_getencprop(node, "ibm,phandle", &xref, > > sizeof(xref)) == -1 && OF_getencprop(node, > > "linux,phandle", &xref, sizeof(xref)) == -1) > > - return (node); > > + return (notfoundvalue); > > return (xref); > > } > > > > +phandle_t > > +OF_xref_from_node(phandle_t node) > > +{ > > + > > + return (xref_from_node(node, node)); > > +} > > + > > +phandle_t > > +OF_xref_from_node_strict(phandle_t node) > > +{ > > + > > + return (xref_from_node(node, -1)); > > +} > > + > > device_t > > OF_device_from_xref(phandle_t xref) > > { > > > > Modified: head/sys/dev/ofw/openfirm.h > > == > > --- head/sys/dev/ofw/openfirm.h Sat Sep 6 13:21:07 2014 > > (r271189) > > +++ head/sys/dev/ofw/openfirm.h Sat Sep 6 15:11:35 2014 > > (r271190) > > @@ -128,10 +128,12 @@ ssize_t OF_package_to_path(phandle_t no > >* Some OF implementations (IBM, FDT) have a concept of effective phandles > >* used for device-tree cross-references. Given one of these, returns the > >* real phandle. If one can't be found (or running on OF implementations > > - * without this property), returns its input. > > + * without this property), OF_xref_from_node() returns its input, while the > > + * strict version returns -1. > >*/ > > phandle_t OF_node_from_xref(phandle_t xref); > > phandle_t OF_xref_from_node(phandle_t node); > > +phandle_t OF_xref_from_node_strict(phandle_t node); > > > > /* > >* When properties contain references to other nodes using xref handles > > it is > > > ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r271196 - head/sys/dev/ahci
Author: mav Date: Sat Sep 6 15:37:55 2014 New Revision: 271196 URL: http://svnweb.freebsd.org/changeset/base/271196 Log: Fix typo in comments. Submitted by: Benedict Reuschling MFC after:6 days Modified: head/sys/dev/ahci/ahci.c Modified: head/sys/dev/ahci/ahci.c == --- head/sys/dev/ahci/ahci.cSat Sep 6 15:30:57 2014(r271195) +++ head/sys/dev/ahci/ahci.cSat Sep 6 15:37:55 2014(r271196) @@ -1535,8 +1535,9 @@ ahci_execute_transaction(struct ahci_slo /* * Marvell HBAs with non-RAID firmware do not wait for * readiness after soft reset, so we have to wait here. -* Marvell RAIDs have no this problem, but instead sometimes -* forget to update FIS receive area, breaking this wait. +* Marvell RAIDs do not have this problem, but instead +* sometimes forget to update FIS receive area, breaking +* this wait. */ if ((ch->quirks & AHCI_Q_NOBSYRES) == 0 && (ch->quirks & AHCI_Q_ATI_PMP_BUG) == 0 && ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r271190 - head/sys/dev/ofw
On 09/06/14 08:34, Ian Lepore wrote: On Sat, 2014-09-06 at 08:25 -0700, Nathan Whitehorn wrote: What is this for? The way the specification works here explicitly requires this fallback. -Nathan It's for determining whether there is an entry in the device<->xref list. If a node has no xref phandle property there will be no entry for it in the list and thus no way to record or retrieve a device association. I found myself coding the "if it has a phandle, or an ibm,phandle, or a linux,phandle" incantation, then realized that all that figuring-out work was done at init time when the xref list is built, I just needed a way to get the result. This isn't true. On most but not all real OF systems, which use, or will use, the same mechanism, there is no distinction between "regular" and "cross-reference" phandles and device tree cross-references still exist with no explicit phandle property. So registering a device without a phandle property has to to work, and has to fall back to the regular phandle 100% of the time. What may be true is that no single device tree has a mixture of implicit and explicit cross-reference handles, so you could set a flag or something. But it's probably not worth it. Do you have a concrete example where you cared about this? -Nathan -- Ian On 09/06/14 08:11, Ian Lepore wrote: Author: ian Date: Sat Sep 6 15:11:35 2014 New Revision: 271190 URL: http://svnweb.freebsd.org/changeset/base/271190 Log: Add OF_xref_from_node_strict() which returns -1 if there is no xref handle for the node. The default routine returns the untranslated handle, which is sometimes useful, but sometimes you really need to know there's no entry in the xref<->node<->device translation table. Modified: head/sys/dev/ofw/openfirm.c head/sys/dev/ofw/openfirm.h Modified: head/sys/dev/ofw/openfirm.c == --- head/sys/dev/ofw/openfirm.c Sat Sep 6 13:21:07 2014(r271189) +++ head/sys/dev/ofw/openfirm.c Sat Sep 6 15:11:35 2014(r271190) @@ -554,15 +554,15 @@ OF_node_from_xref(phandle_t xref) return (node); } -phandle_t -OF_xref_from_node(phandle_t node) +static phandle_t +xref_from_node(phandle_t node, phandle_t notfoundvalue) { struct xrefinfo *xi; phandle_t xref; if (xref_init_done) { if ((xi = xrefinfo_find(node, FIND_BY_NODE)) == NULL) - return (node); + return (notfoundvalue); return (xi->xref); } @@ -570,10 +570,24 @@ OF_xref_from_node(phandle_t node) -1 && OF_getencprop(node, "ibm,phandle", &xref, sizeof(xref)) == -1 && OF_getencprop(node, "linux,phandle", &xref, sizeof(xref)) == -1) - return (node); + return (notfoundvalue); return (xref); } +phandle_t +OF_xref_from_node(phandle_t node) +{ + + return (xref_from_node(node, node)); +} + +phandle_t +OF_xref_from_node_strict(phandle_t node) +{ + + return (xref_from_node(node, -1)); +} + device_t OF_device_from_xref(phandle_t xref) { Modified: head/sys/dev/ofw/openfirm.h == --- head/sys/dev/ofw/openfirm.h Sat Sep 6 13:21:07 2014(r271189) +++ head/sys/dev/ofw/openfirm.h Sat Sep 6 15:11:35 2014(r271190) @@ -128,10 +128,12 @@ ssize_t OF_package_to_path(phandle_t no * Some OF implementations (IBM, FDT) have a concept of effective phandles * used for device-tree cross-references. Given one of these, returns the * real phandle. If one can't be found (or running on OF implementations - * without this property), returns its input. + * without this property), OF_xref_from_node() returns its input, while the + * strict version returns -1. */ phandle_tOF_node_from_xref(phandle_t xref); phandle_tOF_xref_from_node(phandle_t node); +phandle_t OF_xref_from_node_strict(phandle_t node); /* * When properties contain references to other nodes using xref handles it is ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r271190 - head/sys/dev/ofw
On Sat, 2014-09-06 at 08:39 -0700, Nathan Whitehorn wrote: > On 09/06/14 08:34, Ian Lepore wrote: > > On Sat, 2014-09-06 at 08:25 -0700, Nathan Whitehorn wrote: > >> What is this for? The way the specification works here explicitly > >> requires this fallback. > >> -Nathan > >> > > It's for determining whether there is an entry in the device<->xref > > list. If a node has no xref phandle property there will be no entry for > > it in the list and thus no way to record or retrieve a device > > association. I found myself coding the "if it has a phandle, or an > > ibm,phandle, or a linux,phandle" incantation, then realized that all > > that figuring-out work was done at init time when the xref list is > > built, I just needed a way to get the result. > > This isn't true. On most but not all real OF systems, which use, or will > use, the same mechanism, there is no distinction between "regular" and > "cross-reference" phandles and device tree cross-references still exist > with no explicit phandle property. So registering a device without a > phandle property has to to work, and has to fall back to the regular > phandle 100% of the time. > Oh. That wasn't clear when you helped me last week with the xref list stuff. I'll have to rework that a bit to meet the requirements you list above. -- Ian > What may be true is that no single device tree has a mixture of implicit > and explicit cross-reference handles, so you could set a flag or > something. But it's probably not worth it. Do you have a concrete > example where you cared about this? > -Nathan > > > -- Ian > > > >> On 09/06/14 08:11, Ian Lepore wrote: > >>> Author: ian > >>> Date: Sat Sep 6 15:11:35 2014 > >>> New Revision: 271190 > >>> URL: http://svnweb.freebsd.org/changeset/base/271190 > >>> > >>> Log: > >>> Add OF_xref_from_node_strict() which returns -1 if there is no xref > >>> handle > >>> for the node. The default routine returns the untranslated handle, > >>> which > >>> is sometimes useful, but sometimes you really need to know there's no > >>> entry in the xref<->node<->device translation table. > >>> > >>> Modified: > >>> head/sys/dev/ofw/openfirm.c > >>> head/sys/dev/ofw/openfirm.h > >>> > >>> Modified: head/sys/dev/ofw/openfirm.c > >>> == > >>> --- head/sys/dev/ofw/openfirm.c Sat Sep 6 13:21:07 2014 > >>> (r271189) > >>> +++ head/sys/dev/ofw/openfirm.c Sat Sep 6 15:11:35 2014 > >>> (r271190) > >>> @@ -554,15 +554,15 @@ OF_node_from_xref(phandle_t xref) > >>> return (node); > >>>} > >>> > >>> -phandle_t > >>> -OF_xref_from_node(phandle_t node) > >>> +static phandle_t > >>> +xref_from_node(phandle_t node, phandle_t notfoundvalue) > >>>{ > >>> struct xrefinfo *xi; > >>> phandle_t xref; > >>> > >>> if (xref_init_done) { > >>> if ((xi = xrefinfo_find(node, FIND_BY_NODE)) == NULL) > >>> - return (node); > >>> + return (notfoundvalue); > >>> return (xi->xref); > >>> } > >>> > >>> @@ -570,10 +570,24 @@ OF_xref_from_node(phandle_t node) > >>> -1 && OF_getencprop(node, "ibm,phandle", &xref, > >>> sizeof(xref)) == -1 && OF_getencprop(node, > >>> "linux,phandle", &xref, sizeof(xref)) == -1) > >>> - return (node); > >>> + return (notfoundvalue); > >>> return (xref); > >>>} > >>> > >>> +phandle_t > >>> +OF_xref_from_node(phandle_t node) > >>> +{ > >>> + > >>> + return (xref_from_node(node, node)); > >>> +} > >>> + > >>> +phandle_t > >>> +OF_xref_from_node_strict(phandle_t node) > >>> +{ > >>> + > >>> + return (xref_from_node(node, -1)); > >>> +} > >>> + > >>>device_t > >>>OF_device_from_xref(phandle_t xref) > >>>{ > >>> > >>> Modified: head/sys/dev/ofw/openfirm.h > >>> == > >>> --- head/sys/dev/ofw/openfirm.h Sat Sep 6 13:21:07 2014 > >>> (r271189) > >>> +++ head/sys/dev/ofw/openfirm.h Sat Sep 6 15:11:35 2014 > >>> (r271190) > >>> @@ -128,10 +128,12 @@ ssize_t OF_package_to_path(phandle_t no > >>> * Some OF implementations (IBM, FDT) have a concept of effective > >>> phandles > >>> * used for device-tree cross-references. Given one of these, returns > >>> the > >>> * real phandle. If one can't be found (or running on OF > >>> implementations > >>> - * without this property), returns its input. > >>> + * without this property), OF_xref_from_node() returns its input, while > >>> the > >>> + * strict version returns -1. > >>> */ > >>>phandle_t OF_node_from_xref(phandle_t xref); > >>>phandle_t OF_xref_from_node(phandle_t node); > >>> +phandle_tOF_xref_from_node_strict(phandle_t node); > >>> > >>>/* > >>> * When properties contain refe
svn commit: r271197 - in head/sys/x86: include x86
Author: kib Date: Sat Sep 6 15:45:45 2014 New Revision: 271197 URL: http://svnweb.freebsd.org/changeset/base/271197 Log: Add more bits for the XSAVE features from CPUID 0xd, sub-function 1 %eax report. Print the XSAVE features 0xd/1 in the boot banner. The printcpuinfo() is executed late enough so that XSAVE is already enabled. There is no known to me off the shelf hardware that implements any feature bits except XSAVEOPT, the list is taken from SDM rev. 50. The banner printing will allow us to note the hardware arrival. Sponsored by: The FreeBSD Foundation MFC after:1 week Modified: head/sys/x86/include/specialreg.h head/sys/x86/x86/identcpu.c Modified: head/sys/x86/include/specialreg.h == --- head/sys/x86/include/specialreg.h Sat Sep 6 15:37:55 2014 (r271196) +++ head/sys/x86/include/specialreg.h Sat Sep 6 15:45:45 2014 (r271197) @@ -296,6 +296,9 @@ * CPUID instruction 0xd Processor Extended State Enumeration Sub-leaf 1 */ #defineCPUID_EXTSTATE_XSAVEOPT 0x0001 +#defineCPUID_EXTSTATE_XSAVEC 0x0002 +#defineCPUID_EXTSTATE_XINUSE 0x0004 +#defineCPUID_EXTSTATE_XSAVES 0x0008 /* * AMD extended function 8000_0007h edx info Modified: head/sys/x86/x86/identcpu.c == --- head/sys/x86/x86/identcpu.c Sat Sep 6 15:37:55 2014(r271196) +++ head/sys/x86/x86/identcpu.c Sat Sep 6 15:45:45 2014(r271197) @@ -932,6 +932,19 @@ printcpuinfo(void) ); } + if ((cpu_feature2 & CPUID2_XSAVE) != 0) { + cpuid_count(0xd, 0x1, regs); + if (regs[0] != 0) { + printf("\n XSAVE Features=0x%b", + regs[0], + "\020" + "\001XSAVEOPT" + "\002XSAVEC" + "\003XINUSE" + "\004XSAVES"); + } + } + if (via_feature_rng != 0 || via_feature_xcrypt != 0) print_via_padlock_info(); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r271198 - head/sys/arm/freescale/imx
Author: andrew Date: Sat Sep 6 17:33:41 2014 New Revision: 271198 URL: http://svnweb.freebsd.org/changeset/base/271198 Log: Fixthe spelling of ehci Modified: head/sys/arm/freescale/imx/files.imx51 Modified: head/sys/arm/freescale/imx/files.imx51 == --- head/sys/arm/freescale/imx/files.imx51 Sat Sep 6 15:45:45 2014 (r271197) +++ head/sys/arm/freescale/imx/files.imx51 Sat Sep 6 17:33:41 2014 (r271198) @@ -37,7 +37,7 @@ dev/ata/chipsets/ata-fsl.coptional imx dev/uart/uart_dev_imx.coptional uart # USB OH3 controller (1 OTG, 3 EHCI) -arm/freescale/imx/imx_nop_usbphy.c optional echi +arm/freescale/imx/imx_nop_usbphy.c optional ehci dev/usb/controller/ehci_imx.c optional ehci # Watchdog ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r271199 - head/sys/dev/ofw
Author: ian Date: Sat Sep 6 17:50:59 2014 New Revision: 271199 URL: http://svnweb.freebsd.org/changeset/base/271199 Log: Revert rr271190, it was based on a misunderstanding. The problem of non-existant device<->xref info needs to be handled by creating the info, which will come in a subsequent commit. Modified: head/sys/dev/ofw/openfirm.c head/sys/dev/ofw/openfirm.h Modified: head/sys/dev/ofw/openfirm.c == --- head/sys/dev/ofw/openfirm.c Sat Sep 6 17:33:41 2014(r271198) +++ head/sys/dev/ofw/openfirm.c Sat Sep 6 17:50:59 2014(r271199) @@ -554,15 +554,15 @@ OF_node_from_xref(phandle_t xref) return (node); } -static phandle_t -xref_from_node(phandle_t node, phandle_t notfoundvalue) +phandle_t +OF_xref_from_node(phandle_t node) { struct xrefinfo *xi; phandle_t xref; if (xref_init_done) { if ((xi = xrefinfo_find(node, FIND_BY_NODE)) == NULL) - return (notfoundvalue); + return (node); return (xi->xref); } @@ -570,24 +570,10 @@ xref_from_node(phandle_t node, phandle_t -1 && OF_getencprop(node, "ibm,phandle", &xref, sizeof(xref)) == -1 && OF_getencprop(node, "linux,phandle", &xref, sizeof(xref)) == -1) - return (notfoundvalue); + return (node); return (xref); } -phandle_t -OF_xref_from_node(phandle_t node) -{ - - return (xref_from_node(node, node)); -} - -phandle_t -OF_xref_from_node_strict(phandle_t node) -{ - - return (xref_from_node(node, -1)); -} - device_t OF_device_from_xref(phandle_t xref) { Modified: head/sys/dev/ofw/openfirm.h == --- head/sys/dev/ofw/openfirm.h Sat Sep 6 17:33:41 2014(r271198) +++ head/sys/dev/ofw/openfirm.h Sat Sep 6 17:50:59 2014(r271199) @@ -128,12 +128,10 @@ ssize_t OF_package_to_path(phandle_t no * Some OF implementations (IBM, FDT) have a concept of effective phandles * used for device-tree cross-references. Given one of these, returns the * real phandle. If one can't be found (or running on OF implementations - * without this property), OF_xref_from_node() returns its input, while the - * strict version returns -1. + * without this property), returns its input. */ phandle_t OF_node_from_xref(phandle_t xref); phandle_t OF_xref_from_node(phandle_t node); -phandle_t OF_xref_from_node_strict(phandle_t node); /* * When properties contain references to other nodes using xref handles it is ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r271200 - head/sys/arm/altera/socfpga
Author: br Date: Sat Sep 6 18:08:21 2014 New Revision: 271200 URL: http://svnweb.freebsd.org/changeset/base/271200 Log: o Remove __unused attribute on variables which actually used o Unmagic 'configuration done' bit o Move probe() to place before attach() for better navigation o Use bus_read_n instead of bus_space_read_n functions Pointed out by: andrew Sponsored by: DARPA, AFRL Modified: head/sys/arm/altera/socfpga/socfpga_common.h head/sys/arm/altera/socfpga/socfpga_manager.c Modified: head/sys/arm/altera/socfpga/socfpga_common.h == --- head/sys/arm/altera/socfpga/socfpga_common.hSat Sep 6 17:50:59 2014(r271199) +++ head/sys/arm/altera/socfpga/socfpga_common.hSat Sep 6 18:08:21 2014(r271200) @@ -30,15 +30,9 @@ * $FreeBSD$ */ -#defineREAD4(_sc, _reg)\ - bus_space_read_4(_sc->bst, _sc->bsh, _reg) -#defineWRITE4(_sc, _reg, _val) \ - bus_space_write_4(_sc->bst, _sc->bsh, _reg, _val) -#defineREAD2(_sc, _reg)\ - bus_space_read_2(_sc->bst, _sc->bsh, _reg) -#defineWRITE2(_sc, _reg, _val) \ - bus_space_write_2(_sc->bst, _sc->bsh, _reg, _val) -#defineREAD1(_sc, _reg)\ - bus_space_read_1(_sc->bst, _sc->bsh, _reg) -#defineWRITE1(_sc, _reg, _val) \ - bus_space_write_1(_sc->bst, _sc->bsh, _reg, _val) +#defineREAD4(_sc, _reg) bus_read_4((_sc)->res[0], _reg) +#defineREAD2(_sc, _reg) bus_read_2((_sc)->res[0], _reg) +#defineREAD1(_sc, _reg) bus_read_1((_sc)->res[0], _reg) +#defineWRITE4(_sc, _reg, _val) bus_write_4((_sc)->res[0], _reg, _val) +#defineWRITE2(_sc, _reg, _val) bus_write_2((_sc)->res[0], _reg, _val) +#defineWRITE1(_sc, _reg, _val) bus_write_1((_sc)->res[0], _reg, _val) Modified: head/sys/arm/altera/socfpga/socfpga_manager.c == --- head/sys/arm/altera/socfpga/socfpga_manager.c Sat Sep 6 17:50:59 2014(r271199) +++ head/sys/arm/altera/socfpga/socfpga_manager.c Sat Sep 6 18:08:21 2014(r271200) @@ -91,6 +91,7 @@ __FBSDID("$FreeBSD$"); #defineGPIO_PORTA_EOI 0x84C /* Clear Interrupt Register */ #define PORTA_EOI_NS (1 << 0) #defineGPIO_EXT_PORTA 0x850 /* External Port A Register */ +#define EXT_PORTA_CDP (1 << 10) /* Configuration done */ #defineGPIO_LS_SYNC0x860 /* Synchronization Level Register */ #defineGPIO_VER_ID_CODE0x86C /* GPIO Version Register */ #defineGPIO_CONFIG_REG20x870 /* Configuration Register 2 */ @@ -147,8 +148,6 @@ static struct cfgmgr_mode cfgmgr_modes[] struct fpgamgr_softc { struct resource *res[3]; - bus_space_tag_t bst; - bus_space_handle_t bsh; bus_space_tag_t bst_data; bus_space_handle_t bsh_data; struct cdev *mgr_cdev; @@ -163,20 +162,6 @@ static struct resource_spec fpgamgr_spec }; static int -fpgamgr_probe(device_t dev) -{ - - if (!ofw_bus_status_okay(dev)) - return (ENXIO); - - if (!ofw_bus_is_compatible(dev, "altr,fpga-mgr")) - return (ENXIO); - - device_set_desc(dev, "FPGA Manager"); - return (BUS_PROBE_DEFAULT); -} - -static int fpgamgr_state_get(struct fpgamgr_softc *sc) { int reg; @@ -208,7 +193,7 @@ fpgamgr_state_wait(struct fpgamgr_softc } static int -fpga_open(struct cdev *dev __unused, int flags __unused, +fpga_open(struct cdev *dev, int flags __unused, int fmt __unused, struct thread *td __unused) { struct fpgamgr_softc *sc; @@ -310,7 +295,7 @@ fpga_wait_dclk_pulses(struct fpgamgr_sof } static int -fpga_close(struct cdev *dev __unused, int flags __unused, +fpga_close(struct cdev *dev, int flags __unused, int fmt __unused, struct thread *td __unused) { struct fpgamgr_softc *sc; @@ -319,7 +304,7 @@ fpga_close(struct cdev *dev __unused, in sc = dev->si_drv1; reg = READ4(sc, GPIO_EXT_PORTA); - if ((reg & (1 << 10)) == 0) { + if ((reg & EXT_PORTA_CDP) == 0) { device_printf(sc->dev, "Err: configuration failed\n"); return (ENXIO); } @@ -388,6 +373,20 @@ static struct cdevsw fpga_cdevsw = { }; static int +fpgamgr_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_is_compatible(dev, "altr,fpga-mgr")) + return (ENXIO); + + device_set_desc(dev, "FPGA Manager"); + return (BUS_PROBE_DEFAULT); +} + +static int fpgamgr_attach(device_t dev) { struct fpgamgr_softc *sc; @@ -401,8 +400,6 @@ fpgamgr_attach(device_t dev) } /* Memory interface */ - sc->bst = rman_get_bu
svn commit: r271201 - head/sys/dev/ahci
Author: imp Date: Sat Sep 6 18:20:50 2014 New Revision: 271201 URL: http://svnweb.freebsd.org/changeset/base/271201 Log: Restore order of interrupt setup. Minor problems can result by setting up the interrupts too early: Reviewed by: mav@ Sponsored by: Netflix Modified: head/sys/dev/ahci/ahci.c head/sys/dev/ahci/ahci_pci.c Modified: head/sys/dev/ahci/ahci.c == --- head/sys/dev/ahci/ahci.cSat Sep 6 18:08:21 2014(r271200) +++ head/sys/dev/ahci/ahci.cSat Sep 6 18:20:50 2014(r271201) @@ -229,6 +229,15 @@ ahci_attach(device_t dev) ahci_ctlr_setup(dev); + /* Setup interrupts. */ + if (ahci_setup_interrupt(dev)) { + bus_dma_tag_destroy(ctlr->dma_tag); + bus_release_resource(dev, SYS_RES_MEMORY, ctlr->r_rid, + ctlr->r_mem); + rman_fini(&ctlr->sc_iomem); + return ENXIO; + } + i = 0; for (u = ctlr->ichannels; u != 0; u >>= 1) i += (u & 1); Modified: head/sys/dev/ahci/ahci_pci.c == --- head/sys/dev/ahci/ahci_pci.cSat Sep 6 18:08:21 2014 (r271200) +++ head/sys/dev/ahci/ahci_pci.cSat Sep 6 18:20:50 2014 (r271201) @@ -417,13 +417,6 @@ ahci_pci_attach(device_t dev) ctlr->numirqs = 1; } - if (ahci_setup_interrupt(dev)) { - if (ctlr->msi) - pci_release_msi(dev); - bus_release_resource(dev, SYS_RES_MEMORY, ctlr->r_rid, ctlr->r_mem); - return ENXIO; - } - error = ahci_attach(dev); if (error != 0) if (ctlr->msi) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r271202 - head/sys/dev/ofw
Author: ian Date: Sat Sep 6 18:43:17 2014 New Revision: 271202 URL: http://svnweb.freebsd.org/changeset/base/271202 Log: When registering an association between a device and an xref phandle, create an entry in the xref list if one doesn't already exist for the given handle. On a system that uses phandle properties, the init-time scan of the tree which builds the xref list will pre-create entries for every xref handle that exists in the data. On systems where the xref and node handles are synonymous there is no phandle property in referenced nodes, and the xref list will initialize to an empty state. In the latter case, we still need to be able to associate a device_t with an xref handle, so we create list entries on the fly as needed. Since the node and xref handles are synonymous, we have all the info needed to create a list entry at device registration time. The downside to this change is that it basically allows on the fly creation of xref handles as synonyms of node handles, and the association of a device_t with them. Whether this is a bug or a feature is in the eye of the beholder, I guess. Modified: head/sys/dev/ofw/openfirm.c Modified: head/sys/dev/ofw/openfirm.c == --- head/sys/dev/ofw/openfirm.c Sat Sep 6 18:20:50 2014(r271201) +++ head/sys/dev/ofw/openfirm.c Sat Sep 6 18:43:17 2014(r271202) @@ -62,7 +62,10 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include +#include +#include #include #include @@ -92,6 +95,7 @@ struct xrefinfo { }; static SLIST_HEAD(, xrefinfo) xreflist = SLIST_HEAD_INITIALIZER(xreflist); +static struct mtx xreflist_lock; static boolean_t xref_init_done; #defineFIND_BY_XREF0 @@ -138,6 +142,12 @@ static void xrefinfo_init(void *unsed) { + /* +* There is no locking during this init because it runs much earlier +* than any of the clients/consumers of the xref list data, but we do +* initialize the mutex that will be used for access later. +*/ + mtx_init(&xreflist_lock, "OF xreflist lock", NULL, MTX_DEF); xrefinfo_create(OF_peer(0)); xref_init_done = true; } @@ -146,17 +156,35 @@ SYSINIT(xrefinfo, SI_SUB_KMEM, SI_ORDER_ static struct xrefinfo * xrefinfo_find(phandle_t phandle, int find_by) { - struct xrefinfo * xi; + struct xrefinfo *rv, *xi; + rv = NULL; + mtx_lock(&xreflist_lock); SLIST_FOREACH(xi, &xreflist, next_entry) { - if (find_by == FIND_BY_XREF && phandle == xi->xref) - return (xi); - else if (find_by == FIND_BY_NODE && phandle == xi->node) - return (xi); - else if (find_by == FIND_BY_DEV && phandle == (uintptr_t)xi->dev) - return (xi); + if ((find_by == FIND_BY_XREF && phandle == xi->xref) || + (find_by == FIND_BY_NODE && phandle == xi->node) || + (find_by == FIND_BY_DEV && phandle == (uintptr_t)xi->dev)) { + rv = xi; + break; + } } - return (NULL); + mtx_unlock(&xreflist_lock); + return (rv); +} + +static struct xrefinfo * +xrefinfo_add(phandle_t node, phandle_t xref, device_t dev) +{ + struct xrefinfo *xi; + + xi = malloc(sizeof(*xi), M_OFWPROP, M_WAITOK); + xi->node = node; + xi->xref = xref; + xi->dev = dev; + mtx_lock(&xreflist_lock); + SLIST_INSERT_HEAD(&xreflist, xi, next_entry); + mtx_unlock(&xreflist_lock); + return (xi); } /* @@ -605,10 +633,17 @@ OF_device_register_xref(phandle_t xref, { struct xrefinfo *xi; + /* +* If the given xref handle doesn't already exist in the list then we +* add a list entry. In theory this can only happen on a system where +* nodes don't contain phandle properties and xref and node handles are +* synonymous, so the xref handle is added as the node handle as well. +*/ if (xref_init_done) { if ((xi = xrefinfo_find(xref, FIND_BY_XREF)) == NULL) - return (ENXIO); - xi->dev = dev; + xrefinfo_add(xref, xref, dev); + else + xi->dev = dev; return (0); } panic("Attempt to register device before xreflist_init"); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r271204 - head/sys/netinet
Author: tuexen Date: Sat Sep 6 19:12:14 2014 New Revision: 271204 URL: http://svnweb.freebsd.org/changeset/base/271204 Log: Fix the handling of sysctl variables when used with VIMAGE. While there do some cleanup of the code. MFC after: 1 week Modified: head/sys/netinet/sctp_constants.h head/sys/netinet/sctp_os_bsd.h head/sys/netinet/sctp_sysctl.c head/sys/netinet/sctp_sysctl.h Modified: head/sys/netinet/sctp_constants.h == --- head/sys/netinet/sctp_constants.h Sat Sep 6 19:02:52 2014 (r271203) +++ head/sys/netinet/sctp_constants.h Sat Sep 6 19:12:14 2014 (r271204) @@ -267,18 +267,9 @@ __FBSDID("$FreeBSD$"); /* how many addresses per assoc remote and local */ #define SCTP_SCALE_FOR_ADDR2 -/* default AUTO_ASCONF mode enable(1)/disable(0) value (sysctl) */ -#define SCTP_DEFAULT_AUTO_ASCONF 1 - /* default MULTIPLE_ASCONF mode enable(1)/disable(0) value (sysctl) */ #define SCTP_DEFAULT_MULTIPLE_ASCONFS 0 -/* default MOBILITY_BASE mode enable(1)/disable(0) value (sysctl) */ -#define SCTP_DEFAULT_MOBILITY_BASE 0 - -/* default MOBILITY_FASTHANDOFF mode enable(1)/disable(0) value (sysctl) */ -#define SCTP_DEFAULT_MOBILITY_FASTHANDOFF 0 - /* * Theshold for rwnd updates, we have to read (sb_hiwat >> * SCTP_RWND_HIWAT_SHIFT) before we will look to see if we need to send a Modified: head/sys/netinet/sctp_os_bsd.h == --- head/sys/netinet/sctp_os_bsd.h Sat Sep 6 19:02:52 2014 (r271203) +++ head/sys/netinet/sctp_os_bsd.h Sat Sep 6 19:12:14 2014 (r271204) @@ -152,16 +152,10 @@ MALLOC_DECLARE(SCTP_M_MCORE); #define V_system_base_info VNET(system_base_info) #define SCTP_BASE_INFO(__m) V_system_base_info.sctppcbinfo.__m #define SCTP_BASE_STATS V_system_base_info.sctpstat -#define SCTP_BASE_STATS_SYSCTL VNET_NAME(system_base_info.sctpstat) -#define SCTP_BASE_STAT(__m) V_system_base_info.sctpstat.__m -#define SCTP_BASE_SYSCTL(__m) VNET_NAME(system_base_info.sctpsysctl.__m) +#define SCTP_BASE_STAT(__m) V_system_base_info.sctpstat.__m +#define SCTP_BASE_SYSCTL(__m) V_system_base_info.sctpsysctl.__m #define SCTP_BASE_VAR(__m) V_system_base_info.__m -/* - * - */ -#define USER_ADDR_NULL (NULL) /* FIX ME: temp */ - #define SCTP_PRINTF(params...) printf(params) #if defined(SCTP_DEBUG) #define SCTPDBG(level, params...) \ @@ -175,9 +169,9 @@ MALLOC_DECLARE(SCTP_M_MCORE); #define SCTPDBG_ADDR(level, addr) \ { \ do {\ - if (SCTP_BASE_SYSCTL(sctp_debug_on) & level ) { \ - sctp_print_address(addr); \ - } \ + if (SCTP_BASE_SYSCTL(sctp_debug_on) & level ) { \ + sctp_print_address(addr); \ + } \ } while (0);\ } #else Modified: head/sys/netinet/sctp_sysctl.c == --- head/sys/netinet/sctp_sysctl.c Sat Sep 6 19:02:52 2014 (r271203) +++ head/sys/netinet/sctp_sysctl.c Sat Sep 6 19:12:14 2014 (r271204) @@ -105,9 +105,7 @@ sctp_init_sysctls() SCTP_BASE_SYSCTL(sctp_min_residual) = SCTPCTL_MIN_RESIDUAL_DEFAULT; SCTP_BASE_SYSCTL(sctp_max_retran_chunk) = SCTPCTL_MAX_RETRAN_CHUNK_DEFAULT; SCTP_BASE_SYSCTL(sctp_logging_level) = SCTPCTL_LOGGING_LEVEL_DEFAULT; - /* JRS - Variable for default congestion control module */ SCTP_BASE_SYSCTL(sctp_default_cc_module) = SCTPCTL_DEFAULT_CC_MODULE_DEFAULT; - /* RS - Variable for default stream scheduling module */ SCTP_BASE_SYSCTL(sctp_default_ss_module) = SCTPCTL_DEFAULT_SS_MODULE_DEFAULT; SCTP_BASE_SYSCTL(sctp_default_frag_interleave) = SCTPCTL_DEFAULT_FRAG_INTERLEAVE_DEFAULT; SCTP_BASE_SYSCTL(sctp_mobility_base) = SCTPCTL_MOBILITY_BASE_DEFAULT; @@ -139,7 +137,7 @@ sctp_init_sysctls() /* It returns an upper limit. No filtering is done here */ static unsigned int -number_of_addresses(struct sctp_inpcb *inp) +sctp_sysctl_number_of_addresses(struct sctp_inpcb *inp) { unsigned int cnt; struct sctp_vrf *vrf; @@ -189,7 +187,7 @@ number_of_addresses(struct sctp_inpcb *i } static int -copy_out_local_addresses(struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sysctl_req *req) +sctp_sysctl_copy_out_local_addresses(struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sysctl_req *req) { struct sctp_ifn *sctp_ifn;
Re: svn commit: r271202 - head/sys/dev/ofw
Not looking at the code: what happens if you ask for the node corresponding to a phandle but the device corresponding to that phandle has not registered yet and it has an implicit crossreference mapping? -Nathan On 09/06/14 11:43, Ian Lepore wrote: Author: ian Date: Sat Sep 6 18:43:17 2014 New Revision: 271202 URL: http://svnweb.freebsd.org/changeset/base/271202 Log: When registering an association between a device and an xref phandle, create an entry in the xref list if one doesn't already exist for the given handle. On a system that uses phandle properties, the init-time scan of the tree which builds the xref list will pre-create entries for every xref handle that exists in the data. On systems where the xref and node handles are synonymous there is no phandle property in referenced nodes, and the xref list will initialize to an empty state. In the latter case, we still need to be able to associate a device_t with an xref handle, so we create list entries on the fly as needed. Since the node and xref handles are synonymous, we have all the info needed to create a list entry at device registration time. The downside to this change is that it basically allows on the fly creation of xref handles as synonyms of node handles, and the association of a device_t with them. Whether this is a bug or a feature is in the eye of the beholder, I guess. Modified: head/sys/dev/ofw/openfirm.c Modified: head/sys/dev/ofw/openfirm.c == --- head/sys/dev/ofw/openfirm.c Sat Sep 6 18:20:50 2014(r271201) +++ head/sys/dev/ofw/openfirm.c Sat Sep 6 18:43:17 2014(r271202) @@ -62,7 +62,10 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include +#include +#include #include #include @@ -92,6 +95,7 @@ struct xrefinfo { }; static SLIST_HEAD(, xrefinfo) xreflist = SLIST_HEAD_INITIALIZER(xreflist); +static struct mtx xreflist_lock; static boolean_t xref_init_done; #define FIND_BY_XREF 0 @@ -138,6 +142,12 @@ static void xrefinfo_init(void *unsed) { + /* +* There is no locking during this init because it runs much earlier +* than any of the clients/consumers of the xref list data, but we do +* initialize the mutex that will be used for access later. +*/ + mtx_init(&xreflist_lock, "OF xreflist lock", NULL, MTX_DEF); xrefinfo_create(OF_peer(0)); xref_init_done = true; } @@ -146,17 +156,35 @@ SYSINIT(xrefinfo, SI_SUB_KMEM, SI_ORDER_ static struct xrefinfo * xrefinfo_find(phandle_t phandle, int find_by) { - struct xrefinfo * xi; + struct xrefinfo *rv, *xi; + rv = NULL; + mtx_lock(&xreflist_lock); SLIST_FOREACH(xi, &xreflist, next_entry) { - if (find_by == FIND_BY_XREF && phandle == xi->xref) - return (xi); - else if (find_by == FIND_BY_NODE && phandle == xi->node) - return (xi); - else if (find_by == FIND_BY_DEV && phandle == (uintptr_t)xi->dev) - return (xi); + if ((find_by == FIND_BY_XREF && phandle == xi->xref) || + (find_by == FIND_BY_NODE && phandle == xi->node) || + (find_by == FIND_BY_DEV && phandle == (uintptr_t)xi->dev)) { + rv = xi; + break; + } } - return (NULL); + mtx_unlock(&xreflist_lock); + return (rv); +} + +static struct xrefinfo * +xrefinfo_add(phandle_t node, phandle_t xref, device_t dev) +{ + struct xrefinfo *xi; + + xi = malloc(sizeof(*xi), M_OFWPROP, M_WAITOK); + xi->node = node; + xi->xref = xref; + xi->dev = dev; + mtx_lock(&xreflist_lock); + SLIST_INSERT_HEAD(&xreflist, xi, next_entry); + mtx_unlock(&xreflist_lock); + return (xi); } /* @@ -605,10 +633,17 @@ OF_device_register_xref(phandle_t xref, { struct xrefinfo *xi; + /* +* If the given xref handle doesn't already exist in the list then we +* add a list entry. In theory this can only happen on a system where +* nodes don't contain phandle properties and xref and node handles are +* synonymous, so the xref handle is added as the node handle as well. +*/ if (xref_init_done) { if ((xi = xrefinfo_find(xref, FIND_BY_XREF)) == NULL) - return (ENXIO); - xi->dev = dev; + xrefinfo_add(xref, xref, dev); + else + xi->dev = dev; return (0); } panic("Attempt to register device before xreflist_init"); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail
svn commit: r271206 - head/sys/x86/include
Author: kib Date: Sat Sep 6 19:39:12 2014 New Revision: 271206 URL: http://svnweb.freebsd.org/changeset/base/271206 Log: SDM rev. 50 defines the use of the next 8 bytes in the xstate header. It is the compaction bitmask, with the highest bit defining if compact format of the xsave area is used at all. Adjust the definition of struct xstate_hdr, provide define for bit 63. Sponsored by: The FreeBSD Foundation MFC after:1 week Modified: head/sys/x86/include/fpu.h Modified: head/sys/x86/include/fpu.h == --- head/sys/x86/include/fpu.h Sat Sep 6 19:38:40 2014(r271205) +++ head/sys/x86/include/fpu.h Sat Sep 6 19:39:12 2014(r271206) @@ -150,9 +150,11 @@ struct savefpu { struct xstate_hdr { uint64_txstate_bv; - uint8_t xstate_rsrv0[16]; + uint64_txstate_xcomp_bv; + uint8_t xstate_rsrv0[8]; uint8_t xstate_rsrv[40]; }; +#defineXSTATE_XCOMP_BV_COMPACT (1ULL << 63) struct savexmm_xstate { struct xstate_hdr sx_hd; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r271202 - head/sys/dev/ofw
On Sat, 2014-09-06 at 12:16 -0700, Nathan Whitehorn wrote: > Not looking at the code: what happens if you ask for the node > corresponding to a phandle but the device corresponding to that phandle > has not registered yet and it has an implicit crossreference mapping? > -Nathan > The node<->xref behavior is the same as it has always been: if there isn't a phandle property in a node to supply an xref handle then the node and xref handles are the synonyms. The only thing that has changed is that with my first implementation an xref handle had exist (meaning it had to have been discovered as a phandle property during the init-time scan of the tree) before you could associate a device_t with it. Now you can make associations on the fly whether the data author intended for such associations to exist or not. I can't decide whether that's a good or a bad thing. -- Ian > On 09/06/14 11:43, Ian Lepore wrote: > > Author: ian > > Date: Sat Sep 6 18:43:17 2014 > > New Revision: 271202 > > URL: http://svnweb.freebsd.org/changeset/base/271202 > > > > Log: > >When registering an association between a device and an xref phandle, > > create > >an entry in the xref list if one doesn't already exist for the given > > handle. > > > >On a system that uses phandle properties, the init-time scan of the tree > >which builds the xref list will pre-create entries for every xref handle > >that exists in the data. On systems where the xref and node handles are > >synonymous there is no phandle property in referenced nodes, and the xref > >list will initialize to an empty state. In the latter case, we still > > need > >to be able to associate a device_t with an xref handle, so we create list > >entries on the fly as needed. Since the node and xref handles are > >synonymous, we have all the info needed to create a list entry at device > >registration time. > > > >The downside to this change is that it basically allows on the fly > > creation > >of xref handles as synonyms of node handles, and the association of a > >device_t with them. Whether this is a bug or a feature is in the eye of > >the beholder, I guess. > > > > Modified: > >head/sys/dev/ofw/openfirm.c > > > > Modified: head/sys/dev/ofw/openfirm.c > > == > > --- head/sys/dev/ofw/openfirm.c Sat Sep 6 18:20:50 2014 > > (r271201) > > +++ head/sys/dev/ofw/openfirm.c Sat Sep 6 18:43:17 2014 > > (r271202) > > @@ -62,7 +62,10 @@ __FBSDID("$FreeBSD$"); > > > > #include > > #include > > +#include > > #include > > +#include > > +#include > > #include > > #include > > > > @@ -92,6 +95,7 @@ struct xrefinfo { > > }; > > > > static SLIST_HEAD(, xrefinfo) xreflist = SLIST_HEAD_INITIALIZER(xreflist); > > +static struct mtx xreflist_lock; > > static boolean_t xref_init_done; > > > > #define FIND_BY_XREF0 > > @@ -138,6 +142,12 @@ static void > > xrefinfo_init(void *unsed) > > { > > > > + /* > > +* There is no locking during this init because it runs much earlier > > +* than any of the clients/consumers of the xref list data, but we do > > +* initialize the mutex that will be used for access later. > > +*/ > > + mtx_init(&xreflist_lock, "OF xreflist lock", NULL, MTX_DEF); > > xrefinfo_create(OF_peer(0)); > > xref_init_done = true; > > } > > @@ -146,17 +156,35 @@ SYSINIT(xrefinfo, SI_SUB_KMEM, SI_ORDER_ > > static struct xrefinfo * > > xrefinfo_find(phandle_t phandle, int find_by) > > { > > - struct xrefinfo * xi; > > + struct xrefinfo *rv, *xi; > > > > + rv = NULL; > > + mtx_lock(&xreflist_lock); > > SLIST_FOREACH(xi, &xreflist, next_entry) { > > - if (find_by == FIND_BY_XREF && phandle == xi->xref) > > - return (xi); > > - else if (find_by == FIND_BY_NODE && phandle == xi->node) > > - return (xi); > > - else if (find_by == FIND_BY_DEV && phandle == > > (uintptr_t)xi->dev) > > - return (xi); > > + if ((find_by == FIND_BY_XREF && phandle == xi->xref) || > > + (find_by == FIND_BY_NODE && phandle == xi->node) || > > + (find_by == FIND_BY_DEV && phandle == (uintptr_t)xi->dev)) { > > + rv = xi; > > + break; > > + } > > } > > - return (NULL); > > + mtx_unlock(&xreflist_lock); > > + return (rv); > > +} > > + > > +static struct xrefinfo * > > +xrefinfo_add(phandle_t node, phandle_t xref, device_t dev) > > +{ > > + struct xrefinfo *xi; > > + > > + xi = malloc(sizeof(*xi), M_OFWPROP, M_WAITOK); > > + xi->node = node; > > + xi->xref = xref; > > + xi->dev = dev; > > + mtx_lock(&xreflist_lock); > > + SLIST_INSERT_HEAD(&xreflist, xi, next_entry); > > + mtx_unlock(&xreflist_lock); > > + return (xi); > > } > > > > /* > > @@
svn commit: r271207 - head/sys/dev/ahci
Author: mav Date: Sat Sep 6 19:43:48 2014 New Revision: 271207 URL: http://svnweb.freebsd.org/changeset/base/271207 Log: Save one register read (AHCI_IS) for AHCI controllers with only one port. For controllers with only one port (like PCIe or M.2 SSDs) interrupt can come from only one source, and skipping read saves few percents of CPU time. MFC after:1 month H/W donated by: I/O Switch Modified: head/sys/dev/ahci/ahci.c Modified: head/sys/dev/ahci/ahci.c == --- head/sys/dev/ahci/ahci.cSat Sep 6 19:39:12 2014(r271206) +++ head/sys/dev/ahci/ahci.cSat Sep 6 19:43:48 2014(r271207) @@ -359,7 +359,9 @@ ahci_setup_interrupt(device_t dev) for (i = 0; i < ctlr->numirqs; i++) { ctlr->irqs[i].ctlr = ctlr; ctlr->irqs[i].r_irq_rid = i + (ctlr->msi ? 1 : 0); - if (ctlr->numirqs == 1 || i >= ctlr->channels || + if (ctlr->channels == 1 && !ctlr->ccc) + ctlr->irqs[i].mode = AHCI_IRQ_MODE_ONE; + else if (ctlr->numirqs == 1 || i >= ctlr->channels || (ctlr->ccc && i == ctlr->cccv)) ctlr->irqs[i].mode = AHCI_IRQ_MODE_ALL; else if (i == ctlr->numirqs - 1) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r271208 - head/sys/x86/include
Author: kib Date: Sat Sep 6 19:47:37 2014 New Revision: 271208 URL: http://svnweb.freebsd.org/changeset/base/271208 Log: Add a define for index of IA32_XSS MSR, which is, per SDM rev. 50, an analog of XCR0 for ring 0 FPU state, used by XSAVES and XRSTORS. Sponsored by: The FreeBSD Foundation MFC after:1 week Modified: head/sys/x86/include/specialreg.h Modified: head/sys/x86/include/specialreg.h == --- head/sys/x86/include/specialreg.h Sat Sep 6 19:43:48 2014 (r271207) +++ head/sys/x86/include/specialreg.h Sat Sep 6 19:47:37 2014 (r271208) @@ -490,6 +490,8 @@ #defineMSR_APIC_DCR_TIMER 0x83e #defineMSR_APIC_SELF_IPI 0x83f +#defineMSR_IA32_XSS0xda0 + /* * Constants related to MSR's. */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r271209 - head/sys/netinet
Author: tuexen Date: Sat Sep 6 20:03:24 2014 New Revision: 271209 URL: http://svnweb.freebsd.org/changeset/base/271209 Log: Fix a leak of an address, if the address is scheduled for removal and the stack is torn down. Thanks to Peter Bostroem and Jiayang Liu from Google for reporting the issue. MFC after: 1 week Modified: head/sys/netinet/sctp_pcb.c Modified: head/sys/netinet/sctp_pcb.c == --- head/sys/netinet/sctp_pcb.c Sat Sep 6 19:47:37 2014(r271208) +++ head/sys/netinet/sctp_pcb.c Sat Sep 6 20:03:24 2014(r271209) @@ -5976,6 +5976,9 @@ sctp_pcb_finish(void) LIST_FOREACH_SAFE(wi, &SCTP_BASE_INFO(addr_wq), sctp_nxt_addr, nwi) { LIST_REMOVE(wi, sctp_nxt_addr); SCTP_DECR_LADDR_COUNT(); + if (wi->action == SCTP_DEL_IP_ADDRESS) { + SCTP_FREE(wi->ifa, SCTP_M_IFA); + } SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_laddr), wi); } SCTP_WQ_ADDR_UNLOCK(); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r270850 - in head/sys: i386/i386 i386/include i386/isa x86/acpica
On Friday, September 05, 2014 10:44:05 AM John Baldwin wrote: > On Friday, September 05, 2014 4:43:05 am Konstantin Belousov wrote: > > There is one weird detail, not touched by your patch. Amd64 resume > > path calls initializecpu(), while i386 does not. I do not see any > > use for the call, the reload of CRX registers by trampoline/resumectx > > should already set everything to working state. E.g., enabling XMM > > in CR4 after fpu state is restored looks strange. > > I can test that. I looked at this, and I actually think calling initializecpu() is correct. It is true that it will set bits in CR4 that are already set, but it also does vendor-specific initialization (e.g. init_amd() and init_via() on amd64 set MSRs, and on i386 there is a lot more of those, though most of the CPUs with extra settings probably do not support SMP or run in ACPI systems). We could either save and restore those various vendor-specific MSRs and registers in suspend/resume, or just call initializecpu() to set their values. The latter approach seems simpler, so I chose that route. In immediate terms, it should fix enabling PG_NX in MSR_EFER on i386 + PAE resume, but it also makes the AP startup case simpler and closer to the amd64 code. I also moved some code that set MSRs out of printcpuinfo() in identcpu.c and into initializecpu() instead. Finally, I split initializecpucache() out similar to how it is split on amd64. Ah, I see one bug I will fix in my tree, pc98's machdep.c needs the change to call initializecpucache(). --- //depot/vendor/freebsd/src/sys/i386/i386/initcpu.c +++ //depot/user/jhb/acpipci/i386/i386/initcpu.c @@ -59,6 +59,12 @@ static void init_6x86(void); #endif /* I486_CPU */ +#if defined(I586_CPU) && defined(CPU_WT_ALLOC) +static voidenable_K5_wt_alloc(void); +static voidenable_K6_wt_alloc(void); +static voidenable_K6_2_wt_alloc(void); +#endif + #ifdef I686_CPU static voidinit_6x86MX(void); static voidinit_ppro(void); @@ -527,6 +533,8 @@ intr_restore(saveintr); } +static int ppro_apic_used = -1; + static void init_ppro(void) { @@ -535,9 +543,29 @@ /* * Local APIC should be disabled if it is not going to be used. */ - apicbase = rdmsr(MSR_APICBASE); - apicbase &= ~APICBASE_ENABLED; - wrmsr(MSR_APICBASE, apicbase); + if (ppro_apic_used != 1) { + apicbase = rdmsr(MSR_APICBASE); + apicbase &= ~APICBASE_ENABLED; + wrmsr(MSR_APICBASE, apicbase); + ppro_apic_used = 0; + } +} + +/* + * If the local APIC is going to be used after being disabled above, + * re-enable it and don't disable it in the future. + */ +void +ppro_reenable_apic(void) +{ + u_int64_t apicbase; + + if (ppro_apic_used == 0) { + apicbase = rdmsr(MSR_APICBASE); + apicbase |= APICBASE_ENABLED; + wrmsr(MSR_APICBASE, apicbase); + ppro_apic_used = 1; + } } /* @@ -646,20 +674,6 @@ } #endif -/* - * Initialize CR4 (Control register 4) to enable SSE instructions. - */ -void -enable_sse(void) -{ -#if defined(CPU_ENABLE_SSE) - if ((cpu_feature & CPUID_XMM) && (cpu_feature & CPUID_FXSR)) { - load_cr4(rcr4() | CR4_FXSR | CR4_XMM); - cpu_fxsr = hw_instruction_sse = 1; - } -#endif -} - extern int elf32_nxstack; void @@ -692,6 +706,27 @@ #ifdef I586_CPU case CPU_586: switch (cpu_vendor_id) { + case CPU_VENDOR_AMD: +#ifdef CPU_WT_ALLOC + if (((cpu_id & 0x0f0) > 0) && + ((cpu_id & 0x0f0) < 0x60) && + ((cpu_id & 0x00f) > 3)) + enable_K5_wt_alloc(); + else if (((cpu_id & 0x0f0) > 0x80) || + (((cpu_id & 0x0f0) == 0x80) && + (cpu_id & 0x00f) > 0x07)) + enable_K6_2_wt_alloc(); + else if ((cpu_id & 0x0f0) > 0x50) + enable_K6_wt_alloc(); +#endif + if ((cpu_id & 0xf0) == 0xa0) + /* +* Make sure the TSC runs through +* suspension, otherwise we can't use +* it as timecounter +*/ + wrmsr(0x1900, rdmsr(0x1900) | 0x20ULL); + break; case CPU_VENDOR_CENTAUR: init_winchip(); break; @@ -762,7 +797,17 @@ default: break; } - enable_sse(); +#if defined(CPU_ENABLE_SSE) + if ((cpu_feature & CPUID_XMM) && (cpu_feature & CPUID_FXSR)) { + load_cr4(rcr4() | CR4_FXSR | CR4_XMM); + cpu_fxsr = hw_instruction_sse = 1; + } +#endif +} + +
Re: svn commit: r271202 - head/sys/dev/ofw
On 09/06/14 12:40, Ian Lepore wrote: On Sat, 2014-09-06 at 12:16 -0700, Nathan Whitehorn wrote: Not looking at the code: what happens if you ask for the node corresponding to a phandle but the device corresponding to that phandle has not registered yet and it has an implicit crossreference mapping? -Nathan The node<->xref behavior is the same as it has always been: if there isn't a phandle property in a node to supply an xref handle then the node and xref handles are the synonyms. The only thing that has changed is that with my first implementation an xref handle had exist (meaning it had to have been discovered as a phandle property during the init-time scan of the tree) before you could associate a device_t with it. Now you can make associations on the fly whether the data author intended for such associations to exist or not. I can't decide whether that's a good or a bad thing. -- Ian Thanks for the explanation! That seems like the most reasonable approach. -Nathan On 09/06/14 11:43, Ian Lepore wrote: Author: ian Date: Sat Sep 6 18:43:17 2014 New Revision: 271202 URL: http://svnweb.freebsd.org/changeset/base/271202 Log: When registering an association between a device and an xref phandle, create an entry in the xref list if one doesn't already exist for the given handle. On a system that uses phandle properties, the init-time scan of the tree which builds the xref list will pre-create entries for every xref handle that exists in the data. On systems where the xref and node handles are synonymous there is no phandle property in referenced nodes, and the xref list will initialize to an empty state. In the latter case, we still need to be able to associate a device_t with an xref handle, so we create list entries on the fly as needed. Since the node and xref handles are synonymous, we have all the info needed to create a list entry at device registration time. The downside to this change is that it basically allows on the fly creation of xref handles as synonyms of node handles, and the association of a device_t with them. Whether this is a bug or a feature is in the eye of the beholder, I guess. Modified: head/sys/dev/ofw/openfirm.c Modified: head/sys/dev/ofw/openfirm.c == --- head/sys/dev/ofw/openfirm.c Sat Sep 6 18:20:50 2014(r271201) +++ head/sys/dev/ofw/openfirm.c Sat Sep 6 18:43:17 2014(r271202) @@ -62,7 +62,10 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include +#include +#include #include #include @@ -92,6 +95,7 @@ struct xrefinfo { }; static SLIST_HEAD(, xrefinfo) xreflist = SLIST_HEAD_INITIALIZER(xreflist); +static struct mtx xreflist_lock; static boolean_t xref_init_done; #define FIND_BY_XREF 0 @@ -138,6 +142,12 @@ static void xrefinfo_init(void *unsed) { + /* +* There is no locking during this init because it runs much earlier +* than any of the clients/consumers of the xref list data, but we do +* initialize the mutex that will be used for access later. +*/ + mtx_init(&xreflist_lock, "OF xreflist lock", NULL, MTX_DEF); xrefinfo_create(OF_peer(0)); xref_init_done = true; } @@ -146,17 +156,35 @@ SYSINIT(xrefinfo, SI_SUB_KMEM, SI_ORDER_ static struct xrefinfo * xrefinfo_find(phandle_t phandle, int find_by) { - struct xrefinfo * xi; + struct xrefinfo *rv, *xi; + rv = NULL; + mtx_lock(&xreflist_lock); SLIST_FOREACH(xi, &xreflist, next_entry) { - if (find_by == FIND_BY_XREF && phandle == xi->xref) - return (xi); - else if (find_by == FIND_BY_NODE && phandle == xi->node) - return (xi); - else if (find_by == FIND_BY_DEV && phandle == (uintptr_t)xi->dev) - return (xi); + if ((find_by == FIND_BY_XREF && phandle == xi->xref) || + (find_by == FIND_BY_NODE && phandle == xi->node) || + (find_by == FIND_BY_DEV && phandle == (uintptr_t)xi->dev)) { + rv = xi; + break; + } } - return (NULL); + mtx_unlock(&xreflist_lock); + return (rv); +} + +static struct xrefinfo * +xrefinfo_add(phandle_t node, phandle_t xref, device_t dev) +{ + struct xrefinfo *xi; + + xi = malloc(sizeof(*xi), M_OFWPROP, M_WAITOK); + xi->node = node; + xi->xref = xref; + xi->dev = dev; + mtx_lock(&xreflist_lock); + SLIST_INSERT_HEAD(&xreflist, xi, next_entry); + mtx_unlock(&xreflist_lock); + return (xi); } /* @@ -605,10 +633,17 @@ OF_device_register_xref(phandle_t xref, { struct xrefinfo *xi; + /* +* If the given xref handle doesn't already exist in the lis
Re: svn commit: r269577 - in head/sys: amd64/include arm/arm arm/include conf i386/i386 i386/include kern mips/include mips/mips powerpc/include powerpc/powerpc sparc64/include sparc64/sparc64 sys
Hi Gleb! This commit has broken mips32 on my 128MB RAM routerstation pro board. I've tested the commit before this one (and it works). I've also tested today's -HEAD as there was some subsequent fixes to the sfbuf code. It hasn't completely fixed things - I still see processes throwing VM errors: umass0:0:0: Attached to scbus0 Trying to mount root from ufs:redboot/rootfs.uzip []... warning: no time-of-day clock registered, system time will not be set accurately da0 at umass-sim0 bus 0 scbus0 target 0 lun 0 da0: Removable Direct Access SCSI-0 device da0: Serial Number 9451 da0: 40.000MB/s transfers da0: 3902MB (7991296 512 byte sectors: 255H 63S/T 497C) da0: quirks=0x3 Aug 28 08:07:57 init: login_getclass: unknown class 'daemon' BAD_PAGE_FAULT: pid 27 tid 100045 (mount), uid 0: pc 0x40514dd0 got a read fault (type 0x2) at 0x4040011c Trapframe Register Dump: zero: 0 at: 0x7fff v0: 0 v1: 0x404000fc a0: 0x54a1: 0x4040 a2: 0 a3: 0x1 t0: 0 t1: 0x40c0300c t2: 0x40800168 t3: 0x2f t4: 0x40c00030 t5: 0 t6: 0x748 t7: 0x402c70 t8: 0x13t9: 0x40514d58 s0: 0x3 s1: 0x40418798 s2: 0 s3: 0x404ec4s4: 0x40418798 s5: 0x40418798 s6: 0 s7: 0 k0: 0 k1: 0 gp: 0x405ec910 sp: 0x7ffee348 s8: 0 ra: 0x4051534c sr: 0xfc13 mullo: 0x6719 mulhi: 0xc badvaddr: 0x4040011c cause: 0x8 pc: 0x40514dd0 Page table info for pc address 0x40514dd0: pde = 0x813da000, pte = 0xa00569da Dumping 4 words starting at pc address 0x40514dd0: 8c700020 32030ff0 00032102 240300ff Page table info for bad address 0x4040011c: pde = 0x813da000, pte = 0 pid 27 (mount), uid 0: exited on signal 11 *** Populating /var .. .. so how can we debug what's going on? -a On 5 August 2014 02:44, Gleb Smirnoff wrote: > Author: glebius > Date: Tue Aug 5 09:44:10 2014 > New Revision: 269577 > URL: http://svnweb.freebsd.org/changeset/base/269577 > > Log: > Merge all MD sf_buf allocators into one MI, residing in kern/subr_sfbuf.c > The MD allocators were very common, however there were some minor > differencies. These differencies were all consolidated in the MI allocator, > under ifdefs. The defines from machine/vmparam.h turn on features required > for a particular machine. For details look in the comment in sys/sf_buf.h. > > As result no MD code left in sys/*/*/vm_machdep.c. Some arches still have > machine/sf_buf.h, which is usually quite small. > > Tested by:glebius (i386), tuexen (arm32), kevlo (arm32) > Reviewed by: kib > Sponsored by: Netflix > Sponsored by: Nginx, Inc. > > Added: > head/sys/kern/subr_sfbuf.c (contents, props changed) > Deleted: > head/sys/powerpc/include/sf_buf.h > head/sys/sparc64/include/sf_buf.h > Modified: > head/sys/amd64/include/sf_buf.h > head/sys/arm/arm/vm_machdep.c > head/sys/arm/include/sf_buf.h > head/sys/arm/include/vmparam.h > head/sys/conf/files.arm > head/sys/conf/files.i386 > head/sys/conf/files.mips > head/sys/conf/files.pc98 > head/sys/conf/files.powerpc > head/sys/conf/files.sparc64 > head/sys/i386/i386/vm_machdep.c > head/sys/i386/include/sf_buf.h > head/sys/i386/include/vmparam.h > head/sys/mips/include/sf_buf.h > head/sys/mips/include/vmparam.h > head/sys/mips/mips/vm_machdep.c > head/sys/powerpc/include/vmparam.h > head/sys/powerpc/powerpc/vm_machdep.c > head/sys/sparc64/include/vmparam.h > head/sys/sparc64/sparc64/vm_machdep.c > head/sys/sys/sf_buf.h > > Modified: head/sys/amd64/include/sf_buf.h > == > --- head/sys/amd64/include/sf_buf.h Tue Aug 5 09:35:25 2014 > (r269576) > +++ head/sys/amd64/include/sf_buf.h Tue Aug 5 09:44:10 2014 > (r269577) > @@ -29,42 +29,23 @@ > #ifndef _MACHINE_SF_BUF_H_ > #define _MACHINE_SF_BUF_H_ > > -#include > -#include > -#include > - > /* > * On this machine, the only purpose for which sf_buf is used is to implement > * an opaque pointer required by the machine-independent parts of the kernel. > * That pointer references the vm_page that is "mapped" by the sf_buf. The > * actual mapping is provided by the direct virtual-to-physical mapping. > */ > -struct sf_buf; > - > -static inline struct sf_buf * > -sf_buf_alloc(struct vm_page *m, int pri) > -{ > - > - return ((struct sf_buf *)m); > -} > - > -static inline void > -sf_buf_free(struct sf_buf *sf) > -{ > -} > - > -static __inline vm_offset_t > +static inline vm_offset_t > sf_buf_kva(struct sf_buf *sf) > { > > return (PHYS_TO_DMAP(VM_PAGE_TO_PHYS((vm_page_t)sf))); > } > > -static __inline vm_page_t > +static inline vm_page_t > sf_buf_page(struct sf_buf *sf) > { > > return ((vm_page_t)sf); > } > - > #endif /* !_MACHINE_SF_BUF_H_ */ > > Modified: head/sys/arm/arm/vm_machdep.c > == > -
Re: svn commit: r269577 - in head/sys: amd64/include arm/arm arm/include conf i386/i386 i386/include kern mips/include mips/mips powerpc/include powerpc/powerpc sparc64/include sparc64/sparc64 sys
. and I've submitted this as a bug: Bug: 193400 Note: this is a mipseb platform, not a mipsel platform. -a On 6 September 2014 14:15, Adrian Chadd wrote: > Hi Gleb! > > This commit has broken mips32 on my 128MB RAM routerstation pro board. > > I've tested the commit before this one (and it works). > > I've also tested today's -HEAD as there was some subsequent fixes to > the sfbuf code. It hasn't completely fixed things - I still see > processes throwing VM errors: > > umass0:0:0: Attached to scbus0 > Trying to mount root from ufs:redboot/rootfs.uzip []... > warning: no time-of-day clock registered, system time will not be set > accurately > da0 at umass-sim0 bus 0 scbus0 target 0 lun 0 > da0: Removable Direct Access SCSI-0 device > da0: Serial Number 9451 > da0: 40.000MB/s transfers > da0: 3902MB (7991296 512 byte sectors: 255H 63S/T 497C) > da0: quirks=0x3 > Aug 28 08:07:57 init: login_getclass: unknown class 'daemon' > BAD_PAGE_FAULT: pid 27 tid 100045 (mount), uid 0: pc 0x40514dd0 got a > read fault (type 0x2) at 0x4040011c > Trapframe Register Dump: > zero: 0 at: 0x7fff v0: 0 v1: 0x404000fc > a0: 0x54a1: 0x4040 a2: 0 a3: 0x1 > t0: 0 t1: 0x40c0300c t2: 0x40800168 t3: 0x2f > t4: 0x40c00030 t5: 0 t6: 0x748 t7: 0x402c70 > t8: 0x13t9: 0x40514d58 s0: 0x3 s1: 0x40418798 > s2: 0 s3: 0x404ec4s4: 0x40418798 s5: 0x40418798 > s6: 0 s7: 0 k0: 0 k1: 0 > gp: 0x405ec910 sp: 0x7ffee348 s8: 0 ra: 0x4051534c > sr: 0xfc13 mullo: 0x6719 mulhi: 0xc badvaddr: 0x4040011c > cause: 0x8 pc: 0x40514dd0 > Page table info for pc address 0x40514dd0: pde = 0x813da000, pte = 0xa00569da > Dumping 4 words starting at pc address 0x40514dd0: > 8c700020 32030ff0 00032102 240300ff > Page table info for bad address 0x4040011c: pde = 0x813da000, pte = 0 > pid 27 (mount), uid 0: exited on signal 11 > *** Populating /var .. > > .. so how can we debug what's going on? > > > > -a > > > On 5 August 2014 02:44, Gleb Smirnoff wrote: >> Author: glebius >> Date: Tue Aug 5 09:44:10 2014 >> New Revision: 269577 >> URL: http://svnweb.freebsd.org/changeset/base/269577 >> >> Log: >> Merge all MD sf_buf allocators into one MI, residing in kern/subr_sfbuf.c >> The MD allocators were very common, however there were some minor >> differencies. These differencies were all consolidated in the MI allocator, >> under ifdefs. The defines from machine/vmparam.h turn on features required >> for a particular machine. For details look in the comment in sys/sf_buf.h. >> >> As result no MD code left in sys/*/*/vm_machdep.c. Some arches still have >> machine/sf_buf.h, which is usually quite small. >> >> Tested by:glebius (i386), tuexen (arm32), kevlo (arm32) >> Reviewed by: kib >> Sponsored by: Netflix >> Sponsored by: Nginx, Inc. >> >> Added: >> head/sys/kern/subr_sfbuf.c (contents, props changed) >> Deleted: >> head/sys/powerpc/include/sf_buf.h >> head/sys/sparc64/include/sf_buf.h >> Modified: >> head/sys/amd64/include/sf_buf.h >> head/sys/arm/arm/vm_machdep.c >> head/sys/arm/include/sf_buf.h >> head/sys/arm/include/vmparam.h >> head/sys/conf/files.arm >> head/sys/conf/files.i386 >> head/sys/conf/files.mips >> head/sys/conf/files.pc98 >> head/sys/conf/files.powerpc >> head/sys/conf/files.sparc64 >> head/sys/i386/i386/vm_machdep.c >> head/sys/i386/include/sf_buf.h >> head/sys/i386/include/vmparam.h >> head/sys/mips/include/sf_buf.h >> head/sys/mips/include/vmparam.h >> head/sys/mips/mips/vm_machdep.c >> head/sys/powerpc/include/vmparam.h >> head/sys/powerpc/powerpc/vm_machdep.c >> head/sys/sparc64/include/vmparam.h >> head/sys/sparc64/sparc64/vm_machdep.c >> head/sys/sys/sf_buf.h >> >> Modified: head/sys/amd64/include/sf_buf.h >> == >> --- head/sys/amd64/include/sf_buf.h Tue Aug 5 09:35:25 2014 >> (r269576) >> +++ head/sys/amd64/include/sf_buf.h Tue Aug 5 09:44:10 2014 >> (r269577) >> @@ -29,42 +29,23 @@ >> #ifndef _MACHINE_SF_BUF_H_ >> #define _MACHINE_SF_BUF_H_ >> >> -#include >> -#include >> -#include >> - >> /* >> * On this machine, the only purpose for which sf_buf is used is to >> implement >> * an opaque pointer required by the machine-independent parts of the >> kernel. >> * That pointer references the vm_page that is "mapped" by the sf_buf. The >> * actual mapping is provided by the direct virtual-to-physical mapping. >> */ >> -struct sf_buf; >> - >> -static inline struct sf_buf * >> -sf_buf_alloc(struct vm_page *m, int pri) >> -{ >> - >> - return ((struct sf_buf *)m); >> -} >> - >> -static inline void >> -sf_buf_free(struct sf_buf *sf) >> -{ >> -} >> - >> -static __inline vm_offset_t >> +static inline vm_offset_t >> sf_buf_kva(struct sf_buf *sf) >> { >> >> return (PHYS_TO_DMA
Re: svn commit: r269577 - in head/sys: amd64/include arm/arm arm/include conf i386/i386 i386/include kern mips/include mips/mips powerpc/include powerpc/powerpc sparc64/include sparc64/sparc64 sys
On 09/06/2014 16:15, Adrian Chadd wrote: > Hi Gleb! > > This commit has broken mips32 on my 128MB RAM routerstation pro board. > > I've tested the commit before this one (and it works). > > I've also tested today's -HEAD as there was some subsequent fixes to > the sfbuf code. It hasn't completely fixed things - I still see > processes throwing VM errors: Before this commit, the sf_buf code did not cache mappings on MIPS. Now, it does. So, I suspect that you're experiencing cache consistency issues. To return to the pre-commit state, you'll need to define machine-dependent sf_buf_{un,}map() functions in mips/include/sf_buf.h for mips32 that call pmap_q{remove,enter}, respectively. Look at arm for a similar configuration. > umass0:0:0: Attached to scbus0 > Trying to mount root from ufs:redboot/rootfs.uzip []... > warning: no time-of-day clock registered, system time will not be set > accurately > da0 at umass-sim0 bus 0 scbus0 target 0 lun 0 > da0: Removable Direct Access SCSI-0 device > da0: Serial Number 9451 > da0: 40.000MB/s transfers > da0: 3902MB (7991296 512 byte sectors: 255H 63S/T 497C) > da0: quirks=0x3 > Aug 28 08:07:57 init: login_getclass: unknown class 'daemon' > BAD_PAGE_FAULT: pid 27 tid 100045 (mount), uid 0: pc 0x40514dd0 got a > read fault (type 0x2) at 0x4040011c > Trapframe Register Dump: > zero: 0 at: 0x7fff v0: 0 v1: 0x404000fc > a0: 0x54a1: 0x4040 a2: 0 a3: 0x1 > t0: 0 t1: 0x40c0300c t2: 0x40800168 t3: 0x2f > t4: 0x40c00030 t5: 0 t6: 0x748 t7: 0x402c70 > t8: 0x13t9: 0x40514d58 s0: 0x3 s1: 0x40418798 > s2: 0 s3: 0x404ec4s4: 0x40418798 s5: 0x40418798 > s6: 0 s7: 0 k0: 0 k1: 0 > gp: 0x405ec910 sp: 0x7ffee348 s8: 0 ra: 0x4051534c > sr: 0xfc13 mullo: 0x6719 mulhi: 0xc badvaddr: 0x4040011c > cause: 0x8 pc: 0x40514dd0 > Page table info for pc address 0x40514dd0: pde = 0x813da000, pte = 0xa00569da > Dumping 4 words starting at pc address 0x40514dd0: > 8c700020 32030ff0 00032102 240300ff > Page table info for bad address 0x4040011c: pde = 0x813da000, pte = 0 > pid 27 (mount), uid 0: exited on signal 11 > *** Populating /var .. > > .. so how can we debug what's going on? > > > > -a > > > On 5 August 2014 02:44, Gleb Smirnoff wrote: >> Author: glebius >> Date: Tue Aug 5 09:44:10 2014 >> New Revision: 269577 >> URL: http://svnweb.freebsd.org/changeset/base/269577 >> >> Log: >> Merge all MD sf_buf allocators into one MI, residing in kern/subr_sfbuf.c >> The MD allocators were very common, however there were some minor >> differencies. These differencies were all consolidated in the MI allocator, >> under ifdefs. The defines from machine/vmparam.h turn on features required >> for a particular machine. For details look in the comment in sys/sf_buf.h. >> >> As result no MD code left in sys/*/*/vm_machdep.c. Some arches still have >> machine/sf_buf.h, which is usually quite small. >> >> Tested by:glebius (i386), tuexen (arm32), kevlo (arm32) >> Reviewed by: kib >> Sponsored by: Netflix >> Sponsored by: Nginx, Inc. >> >> Added: >> head/sys/kern/subr_sfbuf.c (contents, props changed) >> Deleted: >> head/sys/powerpc/include/sf_buf.h >> head/sys/sparc64/include/sf_buf.h >> Modified: >> head/sys/amd64/include/sf_buf.h >> head/sys/arm/arm/vm_machdep.c >> head/sys/arm/include/sf_buf.h >> head/sys/arm/include/vmparam.h >> head/sys/conf/files.arm >> head/sys/conf/files.i386 >> head/sys/conf/files.mips >> head/sys/conf/files.pc98 >> head/sys/conf/files.powerpc >> head/sys/conf/files.sparc64 >> head/sys/i386/i386/vm_machdep.c >> head/sys/i386/include/sf_buf.h >> head/sys/i386/include/vmparam.h >> head/sys/mips/include/sf_buf.h >> head/sys/mips/include/vmparam.h >> head/sys/mips/mips/vm_machdep.c >> head/sys/powerpc/include/vmparam.h >> head/sys/powerpc/powerpc/vm_machdep.c >> head/sys/sparc64/include/vmparam.h >> head/sys/sparc64/sparc64/vm_machdep.c >> head/sys/sys/sf_buf.h >> >> Modified: head/sys/amd64/include/sf_buf.h >> == >> --- head/sys/amd64/include/sf_buf.h Tue Aug 5 09:35:25 2014 >> (r269576) >> +++ head/sys/amd64/include/sf_buf.h Tue Aug 5 09:44:10 2014 >> (r269577) >> @@ -29,42 +29,23 @@ >> #ifndef _MACHINE_SF_BUF_H_ >> #define _MACHINE_SF_BUF_H_ >> >> -#include >> -#include >> -#include >> - >> /* >> * On this machine, the only purpose for which sf_buf is used is to >> implement >> * an opaque pointer required by the machine-independent parts of the >> kernel. >> * That pointer references the vm_page that is "mapped" by the sf_buf. The >> * actual mapping is provided by the direct virtual-to-physical mapping. >> */ >> -struct sf_buf; >> - >> -static inline struct sf_buf * >> -sf_buf_alloc(struct vm_page *m, int pri) >> -{ >> - >>
Re: svn commit: r269577 - in head/sys: amd64/include arm/arm arm/include conf i386/i386 i386/include kern mips/include mips/mips powerpc/include powerpc/powerpc sparc64/include sparc64/sparc64 sys
On 6 September 2014 15:01, Alan Cox wrote: > On 09/06/2014 16:15, Adrian Chadd wrote: >> Hi Gleb! >> >> This commit has broken mips32 on my 128MB RAM routerstation pro board. >> >> I've tested the commit before this one (and it works). >> >> I've also tested today's -HEAD as there was some subsequent fixes to >> the sfbuf code. It hasn't completely fixed things - I still see >> processes throwing VM errors: > > > Before this commit, the sf_buf code did not cache mappings on MIPS. > Now, it does. So, I suspect that you're experiencing cache consistency > issues. To return to the pre-commit state, you'll need to define > machine-dependent sf_buf_{un,}map() functions in mips/include/sf_buf.h > for mips32 that call pmap_q{remove,enter}, respectively. Look at arm > for a similar configuration. Yup, I just noticed that, fixed it, and updated the bug (bug 193400.) Is this something that should be fixed in the vm/pmap code somewhere, or is this just the correct behaviour? -a ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r271213 - head/sys/mips/include
Author: adrian Date: Sat Sep 6 22:38:32 2014 New Revision: 271213 URL: http://svnweb.freebsd.org/changeset/base/271213 Log: Implement local sfbuf_map and sfbuf_unmap for MIPS32. The pre-rework behaviour was not to keep the cached mappings around after the sfbuf was used but instead to recycle said mappings. PR: kern/193400 Modified: head/sys/mips/include/sf_buf.h head/sys/mips/include/vmparam.h Modified: head/sys/mips/include/sf_buf.h == --- head/sys/mips/include/sf_buf.h Sat Sep 6 22:37:47 2014 (r271212) +++ head/sys/mips/include/sf_buf.h Sat Sep 6 22:38:32 2014 (r271213) @@ -48,4 +48,23 @@ sf_buf_page(struct sf_buf *sf) } #endif /* __mips_n64 */ + +#ifndef__mips_n64 /* in 32 bit mode we manage our own mappings */ + +static inline void +sf_buf_map(struct sf_buf *sf, int flags) +{ + + pmap_qenter(sf->kva, &sf->m, 1); +} + +static inline int +sf_buf_unmap(struct sf_buf *sf) +{ + pmap_qremove(sf->kva, 1); + return (1); +} + +#endif /* ! __mips_n64 */ + #endif /* !_MACHINE_SF_BUF_H_ */ Modified: head/sys/mips/include/vmparam.h == --- head/sys/mips/include/vmparam.h Sat Sep 6 22:37:47 2014 (r271212) +++ head/sys/mips/include/vmparam.h Sat Sep 6 22:38:32 2014 (r271213) @@ -189,6 +189,7 @@ #ifndef __mips_n64 #defineSFBUF +#defineSFBUF_MAP #endif #endif /* !_MACHINE_VMPARAM_H_ */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r269577 - in head/sys: amd64/include arm/arm arm/include conf i386/i386 i386/include kern mips/include mips/mips powerpc/include powerpc/powerpc sparc64/include sparc64/sparc64 sys
On 09/06/2014 17:36, Adrian Chadd wrote: > On 6 September 2014 15:01, Alan Cox wrote: >> On 09/06/2014 16:15, Adrian Chadd wrote: >>> Hi Gleb! >>> >>> This commit has broken mips32 on my 128MB RAM routerstation pro board. >>> >>> I've tested the commit before this one (and it works). >>> >>> I've also tested today's -HEAD as there was some subsequent fixes to >>> the sfbuf code. It hasn't completely fixed things - I still see >>> processes throwing VM errors: >> >> Before this commit, the sf_buf code did not cache mappings on MIPS. >> Now, it does. So, I suspect that you're experiencing cache consistency >> issues. To return to the pre-commit state, you'll need to define >> machine-dependent sf_buf_{un,}map() functions in mips/include/sf_buf.h >> for mips32 that call pmap_q{remove,enter}, respectively. Look at arm >> for a similar configuration. > Yup, I just noticed that, fixed it, and updated the bug (bug 193400.) > > Is this something that should be fixed in the vm/pmap code somewhere, > or is this just the correct behaviour? No. However, if you feel like tinkering, you could replace the body of sf_buf_unmap() with mips_dcache_wbinv_range_index(va, PAGE_SIZE); return (0); and see what happens. Can you remind me what the cache configuration is on mip32? Does software only have to worry about I and D cache consistency? ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r271216 - head/sys/kern
Author: glebius Date: Sun Sep 7 05:44:14 2014 New Revision: 271216 URL: http://svnweb.freebsd.org/changeset/base/271216 Log: Fix for r271182. Submitted by: mjg Pointy hat to:me, submitter and everyone who urged me to commit Modified: head/sys/kern/uipc_socket.c Modified: head/sys/kern/uipc_socket.c == --- head/sys/kern/uipc_socket.c Sun Sep 7 00:46:57 2014(r271215) +++ head/sys/kern/uipc_socket.c Sun Sep 7 05:44:14 2014(r271216) @@ -3245,6 +3245,7 @@ static int filt_soread(struct knote *kn, long hint) { struct socket *so; + int ret; so = kn->kn_fp->f_data; SOCKBUF_LOCK_ASSERT(&so->so_rcv); @@ -3267,11 +3268,12 @@ filt_soread(struct knote *kn, long hint) CURVNET_SET(so->so_vnet); if (V_socket_hhh[HHOOK_FILT_SOREAD]->hhh_nhooks > 0) - /* This hook returning non-zero indicates an event, not error */ - return (hhook_run_socket(so, NULL, HHOOK_FILT_SOREAD)); + ret = hhook_run_socket(so, NULL, HHOOK_FILT_SOREAD); + else + ret = 0; CURVNET_RESTORE(); - - return (0); + + return (ret); } static void ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r271182 - head/sys/kern
On Fri, Sep 05, 2014 at 09:54:11PM +0200, Mateusz Guzik wrote: M> > + CURVNET_SET(so->so_vnet); M> >if (V_socket_hhh[HHOOK_FILT_SOREAD]->hhh_nhooks > 0) M> >/* This hook returning non-zero indicates an event, not error */ M> >return (hhook_run_socket(so, NULL, HHOOK_FILT_SOREAD)); M> > + CURVNET_RESTORE(); M> > M> M> should not this be something like: M> error = hhook_run_socket(so, NULL, HHOOK_FILT_SOREAD); M> CURVNET_RESTORE(); M> return (error); M> ? Thanks, Mateusz. Fixed. -- Totus tuus, Glebius. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r271213 - head/sys/mips/include
Thanks, Adrian. I noticed that some arches that use SFBUF_MAP actually override only the sf_buf_unmap() routine, and sf_buf_map() matches the default one. Might be a good idea to add SFBUF_UNMAP macro, and override sf_buf_map()/sf_buf_unmap() separately, to reduce copy-n-paste a little bit. On Sat, Sep 06, 2014 at 10:38:33PM +, Adrian Chadd wrote: A> Author: adrian A> Date: Sat Sep 6 22:38:32 2014 A> New Revision: 271213 A> URL: http://svnweb.freebsd.org/changeset/base/271213 A> A> Log: A> Implement local sfbuf_map and sfbuf_unmap for MIPS32. A> A> The pre-rework behaviour was not to keep the cached mappings around after A> the sfbuf was used but instead to recycle said mappings. A> A> PR:kern/193400 A> A> Modified: A> head/sys/mips/include/sf_buf.h A> head/sys/mips/include/vmparam.h A> A> Modified: head/sys/mips/include/sf_buf.h A> == A> --- head/sys/mips/include/sf_buf.h Sat Sep 6 22:37:47 2014 (r271212) A> +++ head/sys/mips/include/sf_buf.h Sat Sep 6 22:38:32 2014 (r271213) A> @@ -48,4 +48,23 @@ sf_buf_page(struct sf_buf *sf) A> } A> A> #endif /* __mips_n64 */ A> + A> +#ifndef __mips_n64 /* in 32 bit mode we manage our own mappings */ A> + A> +static inline void A> +sf_buf_map(struct sf_buf *sf, int flags) A> +{ A> + A> +pmap_qenter(sf->kva, &sf->m, 1); A> +} A> + A> +static inline int A> +sf_buf_unmap(struct sf_buf *sf) A> +{ A> +pmap_qremove(sf->kva, 1); A> +return (1); A> +} A> + A> +#endif /* ! __mips_n64 */ A> + A> #endif /* !_MACHINE_SF_BUF_H_ */ A> A> Modified: head/sys/mips/include/vmparam.h A> == A> --- head/sys/mips/include/vmparam.h Sat Sep 6 22:37:47 2014 (r271212) A> +++ head/sys/mips/include/vmparam.h Sat Sep 6 22:38:32 2014 (r271213) A> @@ -189,6 +189,7 @@ A> A> #ifndef __mips_n64 A> #define SFBUF A> +#define SFBUF_MAP A> #endif A> A> #endif /* !_MACHINE_VMPARAM_H_ */ A> -- Totus tuus, Glebius. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r271217 - head/sys/mips/include
Author: glebius Date: Sun Sep 7 05:47:48 2014 New Revision: 271217 URL: http://svnweb.freebsd.org/changeset/base/271217 Log: style(9) Modified: head/sys/mips/include/sf_buf.h Modified: head/sys/mips/include/sf_buf.h == --- head/sys/mips/include/sf_buf.h Sun Sep 7 05:44:14 2014 (r271216) +++ head/sys/mips/include/sf_buf.h Sun Sep 7 05:47:48 2014 (r271217) @@ -47,9 +47,7 @@ sf_buf_page(struct sf_buf *sf) return ((vm_page_t)sf); } -#endif /* __mips_n64 */ - -#ifndef__mips_n64 /* in 32 bit mode we manage our own mappings */ +#else /* !__mips_n64 */ static inline void sf_buf_map(struct sf_buf *sf, int flags) @@ -61,10 +59,11 @@ sf_buf_map(struct sf_buf *sf, int flags) static inline int sf_buf_unmap(struct sf_buf *sf) { + pmap_qremove(sf->kva, 1); return (1); } -#endif /* ! __mips_n64 */ +#endif /* __mips_n64 */ #endif /* !_MACHINE_SF_BUF_H_ */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r271174 - head/sys/sys
Robert, On Fri, Sep 05, 2014 at 04:46:28PM +, Robert Watson wrote: R> Author: rwatson R> Date: Fri Sep 5 16:46:28 2014 R> New Revision: 271174 R> URL: http://svnweb.freebsd.org/changeset/base/271174 R> R> Log: R> Clarify a diagnostic printf() in the mbuf code: M_EXT doesn't necessarily R> imply a cluster is attached; it could also refer to some other sort of R> external storage (e.g., an sf_buf). R> R> MFC after: 3 days R> Sponsored by: EMC / Isilon Storage Division R> R> Modified: R> head/sys/sys/mbuf.h R> R> Modified: head/sys/sys/mbuf.h R> == R> --- head/sys/sys/mbuf.h Fri Sep 5 16:40:47 2014(r271173) R> +++ head/sys/sys/mbuf.h Fri Sep 5 16:46:28 2014(r271174) R> @@ -672,7 +672,7 @@ m_clget(struct mbuf *m, int how) R> { R> R> if (m->m_flags & M_EXT) R> -printf("%s: %p mbuf already has cluster\n", __func__, m); R> +printf("%s: %p mbuf already has external storage\n", __func__, m); R> m->m_ext.ext_buf = (char *)NULL; R> uma_zalloc_arg(zone_clust, m, how); R> /* R> @@ -698,7 +698,7 @@ m_cljget(struct mbuf *m, int how, int si R> uma_zone_t zone; R> R> if (m && m->m_flags & M_EXT) R> -printf("%s: %p mbuf already has cluster\n", __func__, m); R> +printf("%s: %p mbuf already has external storage\n", __func__, m); R> if (m != NULL) R> m->m_ext.ext_buf = NULL; Shouldn't these be KASSERTs? I'm pretty sure that Andre put it as printf(9) because he was not sure it is correct. But since that time we never seen these prints in the wild, so they can be safely converted to KASSERTs. -- Totus tuus, Glebius. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r271204 - head/sys/netinet
Michael, On Sat, Sep 06, 2014 at 07:12:15PM +, Michael Tuexen wrote: M> Author: tuexen M> Date: Sat Sep 6 19:12:14 2014 M> New Revision: 271204 M> URL: http://svnweb.freebsd.org/changeset/base/271204 M> M> Log: M> Fix the handling of sysctl variables when used with VIMAGE. M> While there do some cleanup of the code. Note that after r261590 you don't need SYSCTL_VNET_* macros. You can use base SYSCTL_* macros adding CTLFLAG_VNET. SCTP was/is the major user of SYSCTL_VNET_* macros. If it is cleansed, then I can fix the rest and then we probably can remove their declarations. -- Totus tuus, Glebius. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r271174 - head/sys/sys
On 7 Sep 2014, at 11:23, Gleb Smirnoff wrote: > R> Modified: head/sys/sys/mbuf.h > R> > == > R> --- head/sys/sys/mbuf.hFri Sep 5 16:40:47 2014(r271173) > R> +++ head/sys/sys/mbuf.hFri Sep 5 16:46:28 2014(r271174) > R> @@ -672,7 +672,7 @@ m_clget(struct mbuf *m, int how) > R> { > R> > R>if (m->m_flags & M_EXT) > R> - printf("%s: %p mbuf already has cluster\n", __func__, m); > R> + printf("%s: %p mbuf already has external storage\n", __func__, > m); > R>m->m_ext.ext_buf = (char *)NULL; > R>uma_zalloc_arg(zone_clust, m, how); > R>/* > R> @@ -698,7 +698,7 @@ m_cljget(struct mbuf *m, int how, int si > R>uma_zone_t zone; > R> > R>if (m && m->m_flags & M_EXT) > R> - printf("%s: %p mbuf already has cluster\n", __func__, m); > R> + printf("%s: %p mbuf already has external storage\n", __func__, > m); > R>if (m != NULL) > R>m->m_ext.ext_buf = NULL; > > Shouldn't these be KASSERTs? I'm pretty sure that Andre put it as printf(9) > because he was not sure it is correct. But since that time we never seen > these prints in the wild, so they can be safely converted to KASSERTs. Hi Gleb: I agree that they should be KASSERT()s -- almost all if (x) panic(..) should be -- but was working offline at the time and so didn't have a chance to spelunk the mailing lists or GNATS/Bugzilla to see if I could find references to the panics so left the current form as is. I am currently on travel but have a TODO to do some spelunking when I get back. I spotted a number of other similar constructs in the mbuf code, which I'm currently working through fairly closely looking at the variable-size mbuf changes, which depend on a number of cleanups. (The ones I've made thus far are cosmetic, but less purely cosmetic ones will follow soon.) Robert ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"