sorflush hack
Diff below shuffle the socket buffer definition to "properly" memset() all required fields in sorflush(). It also gets rid of the sbrelease() abstraction since zeroing out `sb_hiwat' and `sb_mbmax' is required in only one place. ok? Index: kern/uipc_socket.c === RCS file: /cvs/src/sys/kern/uipc_socket.c,v retrieving revision 1.210 diff -u -p -r1.210 uipc_socket.c --- kern/uipc_socket.c 10 Dec 2017 11:31:54 - 1.210 +++ kern/uipc_socket.c 11 Dec 2017 07:46:02 - @@ -216,7 +216,7 @@ sofree(struct socket *so) so->so_sp = NULL; } #endif /* SOCKET_SPLICE */ - sbrelease(so, &so->so_snd); + sbflush(so, &so->so_snd); sorflush(so); pool_put(&socket_pool, so); } @@ -1052,15 +1052,11 @@ sorflush(struct socket *so) sbunlock(so, sb); aso.so_proto = pr; aso.so_rcv = *sb; - memset(sb, 0, sizeof (*sb)); - /* XXX - the memset stomps all over so_rcv */ - if (aso.so_rcv.sb_flagsintr & SB_KNOTE) { - sb->sb_sel.si_note = aso.so_rcv.sb_sel.si_note; - sb->sb_flagsintr = SB_KNOTE; - } + memset(&sb->sb_startzero, 0, +(caddr_t)&sb->sb_endzero - (caddr_t)&sb->sb_startzero); if (pr->pr_flags & PR_RIGHTS && pr->pr_domain->dom_dispose) (*pr->pr_domain->dom_dispose)(aso.so_rcv.sb_mb); - sbrelease(&aso, &aso.so_rcv); + sbflush(&aso, &aso.so_rcv); } #ifdef SOCKET_SPLICE Index: kern/uipc_socket2.c === RCS file: /cvs/src/sys/kern/uipc_socket2.c,v retrieving revision 1.88 diff -u -p -r1.88 uipc_socket2.c --- kern/uipc_socket2.c 10 Dec 2017 11:31:54 - 1.88 +++ kern/uipc_socket2.c 11 Dec 2017 07:43:29 - @@ -423,8 +423,7 @@ sowakeup(struct socket *so, struct sockb * Before using a new socket structure it is first necessary to reserve * buffer space to the socket, by calling sbreserve(). This should commit * some of the available buffer space in the system buffer pool for the - * socket (currently, it does nothing but enforce limits). The space - * should be released by calling sbrelease() when the socket is destroyed. + * socket (currently, it does nothing but enforce limits). */ int @@ -446,7 +445,8 @@ soreserve(struct socket *so, u_long sndc so->so_snd.sb_lowat = so->so_snd.sb_hiwat; return (0); bad2: - sbrelease(so, &so->so_snd); + sbflush(so, &so->so_snd); + so->so_snd.sb_hiwat = so->so_snd.sb_mbmax = 0; bad: return (ENOBUFS); } @@ -495,17 +495,6 @@ sbchecklowmem(void) mbpool.pr_nout > mbpool.pr_hardlimit * 80 / 100) sblowmem = 1; return (sblowmem); -} - -/* - * Free mbufs held by a socket, and reserved mbuf space. - */ -void -sbrelease(struct socket *so, struct sockbuf *sb) -{ - - sbflush(so, sb); - sb->sb_hiwat = sb->sb_mbmax = 0; } /* Index: sys/socketvar.h === RCS file: /cvs/src/sys/sys/socketvar.h,v retrieving revision 1.79 diff -u -p -r1.79 socketvar.h --- sys/socketvar.h 23 Nov 2017 13:45:46 - 1.79 +++ sys/socketvar.h 11 Dec 2017 07:49:06 - @@ -98,6 +98,8 @@ struct socket { * Variables for socket buffering. */ struct sockbuf { +/* The following fields are all zeroed on flush. */ +#definesb_startzerosb_cc u_long sb_cc; /* actual chars in buffer */ u_long sb_datacc; /* data only chars in buffer */ u_long sb_hiwat; /* max actual char count */ @@ -109,10 +111,12 @@ struct socket { struct mbuf *sb_mbtail; /* the last mbuf in the chain */ struct mbuf *sb_lastrecord;/* first mbuf of last record in socket buffer */ - struct selinfo sb_sel; /* process selecting read/write */ - int sb_flagsintr; /* flags, changed during interrupt */ - short sb_flags; /* flags, see below */ u_short sb_timeo; /* timeout for read/write */ + short sb_flags; /* flags, see below */ +/* End area that is zeroed on flush. */ +#definesb_endzero sb_flags + int sb_flagsintr; /* flags, changed atomically */ + struct selinfo sb_sel; /* process selecting read/write */ } so_rcv, so_snd; #defineSB_MAX (2*1024*1024) /* default for max chars in sockbuf */ #defineSB_LOCK 0x01/* lock on data queue */
Re: Fix mg(1) man page
On Mon, Dec 11, 2017 at 07:30:03AM +0200, MazoComp wrote: > diff --git usr.bin/mg/mg.1 usr.bin/mg/mg.1 > index 96bc62ae8f8..a20b026a32c 100644 > --- usr.bin/mg/mg.1 > +++ usr.bin/mg/mg.1 > @@ -496,8 +496,8 @@ Delete trailing whitespace on the current line. > Delete all lines after dot that contain a string matching > the supplied regular expression. > .It delete-non-matching-lines > -Delete all lines after dot that contain a string matching > -the supplied regular expression. > +Delete all lines after dot that don't contain a string > +matching the supplied regular expression. > .It delete-other-windows > Make the current window the only window visible on the screen. > .It delete-window > fixed, thanks. jmc
Re: unlock more of rtsock
On 29/11/17(Wed) 20:28, Claudio Jeker wrote: > This diff changes the the PCB list into an SRP list. Therefor concurrent > access is no longer an issue and route_input() could be more unlocked. > There is not much point of releasing the KERNEL_LOCK for now but I added > commented lock / unlock to the code. > > Next on the list are now the socekt functions sorwakeup, sbspace and > sbappendaddr. If those are save then route_input should be save. > > If this is the way to go then doing the same for pfkey should be straight > forward. > > Looking forward to test reports and comments rw_enter() will not wail so its returned value don't need to be checked. I'm not fan of the commented KERNEL_LOCK/UNLOCK dance, but either way I think this should go in. > Index: net/rtsock.c > === > RCS file: /cvs/src/sys/net/rtsock.c,v > retrieving revision 1.255 > diff -u -p -r1.255 rtsock.c > --- net/rtsock.c 3 Nov 2017 16:23:20 - 1.255 > +++ net/rtsock.c 29 Nov 2017 18:54:26 - > @@ -70,6 +70,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -94,7 +95,6 @@ > #include > #include > > -struct sockaddr route_dst = { 2, PF_ROUTE, }; > struct sockaddr route_src = { 2, PF_ROUTE, }; > > struct walkarg { > @@ -103,6 +103,8 @@ struct walkarg { > }; > > void route_prinit(void); > +void route_ref(void *, void *); > +void route_unref(void *, void *); > int route_output(struct mbuf *, struct socket *, struct sockaddr *, > struct mbuf *); > int route_ctloutput(int, struct socket *, int, int, struct mbuf *); > @@ -133,7 +135,8 @@ intsysctl_rtable_rtstat(void *, size_ > > struct routecb { > struct rawcbrcb; > - LIST_ENTRY(routecb) rcb_list; > + SRPL_ENTRY(routecb) rcb_list; > + struct refcnt refcnt; > struct timeout timeout; > unsigned intmsgfilter; > unsigned intflags; > @@ -142,11 +145,10 @@ struct routecb { > #define sotoroutecb(so) ((struct routecb *)(so)->so_pcb) > > struct route_cb { > - LIST_HEAD(, routecb)rcb; > - int ip_count; > - int ip6_count; > - int mpls_count; > - int any_count; > + SRPL_HEAD(, routecb)rcb; > + struct srpl_rc rcb_rc; > + struct rwlock rcb_lk; > + unsigned intany_count; > }; > > struct route_cb route_cb; > @@ -165,9 +167,26 @@ struct route_cb route_cb; > void > route_prinit(void) > { > - LIST_INIT(&route_cb.rcb); > + srpl_rc_init(&route_cb.rcb_rc, route_ref, route_unref, NULL); > + rw_init(&route_cb.rcb_lk, "rtsock"); > + SRPL_INIT(&route_cb.rcb); > } > > +void > +route_ref(void *null, void *v) > +{ > + struct routecb *rop = v; > + > + refcnt_take(&rop->refcnt); > +} > + > +void > +route_unref(void *null, void *v) > +{ > + struct routecb *rop = v; > + > + refcnt_rele_wake(&rop->refcnt); > +} > > int > route_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, > @@ -218,9 +237,10 @@ route_attach(struct socket *so, int prot >*/ > rop = malloc(sizeof(struct routecb), M_PCB, M_WAITOK|M_ZERO); > rp = &rop->rcb; > - so->so_pcb = rp; > + so->so_pcb = rop; > /* Init the timeout structure */ > - timeout_set(&rop->timeout, route_senddesync, rp); > + timeout_set(&rop->timeout, route_senddesync, rop); > + refcnt_init(&rop->refcnt); > > if (curproc == NULL) > error = EACCES; > @@ -230,31 +250,33 @@ route_attach(struct socket *so, int prot > free(rop, M_PCB, sizeof(struct routecb)); > return (error); > } > + > rp->rcb_socket = so; > rp->rcb_proto.sp_family = so->so_proto->pr_domain->dom_family; > rp->rcb_proto.sp_protocol = proto; > > rop->rtableid = curproc->p_p->ps_rtableid; > - switch (rp->rcb_proto.sp_protocol) { > - case AF_INET: > - route_cb.ip_count++; > - break; > - case AF_INET6: > - route_cb.ip6_count++; > - break; > -#ifdef MPLS > - case AF_MPLS: > - route_cb.mpls_count++; > - break; > -#endif > - } > > soisconnected(so); > so->so_options |= SO_USELOOPBACK; > > + /* KERNEL_UNLOCK(); */ > + > rp->rcb_faddr = &route_src; > + > + error = rw_enter(&route_cb.rcb_lk, RW_WRITE); > + if (error != 0) { > + free(rop, M_PCB, sizeof(struct routecb)); > + /* KERNEL_LOCK(); */ > + return (error); > + } > + > + SRPL_INSERT_HEAD_LOCKED(&route_cb.rcb_rc, &route_cb.rcb, rop, rcb_list); > route_cb.any_count++; > - LIST_INSERT_HEAD(&route_cb.rcb, rop, rcb_list); > + > + rw_exit(&route_cb.rcb
Fix mg(1) man page
diff --git usr.bin/mg/mg.1 usr.bin/mg/mg.1 index 96bc62ae8f8..a20b026a32c 100644 --- usr.bin/mg/mg.1 +++ usr.bin/mg/mg.1 @@ -496,8 +496,8 @@ Delete trailing whitespace on the current line. Delete all lines after dot that contain a string matching the supplied regular expression. .It delete-non-matching-lines -Delete all lines after dot that contain a string matching -the supplied regular expression. +Delete all lines after dot that don't contain a string +matching the supplied regular expression. .It delete-other-windows Make the current window the only window visible on the screen. .It delete-window
faq13: livestreamer -> streamlink
multimedia/livestreamer was ditched in favor of multimedia/streamlink about a month ago, reflect this. While here, switch minitube's link to HTTPS. Index: faq/faq13.html === RCS file: /cvs/www/faq/faq13.html,v retrieving revision 1.205 diff -u -p -r1.205 faq13.html --- faq/faq13.html 10 Dec 2017 18:01:22 - 1.205 +++ faq/faq13.html 11 Dec 2017 00:26:45 - @@ -938,8 +938,8 @@ Considering their security record, we th If you are just looking to watch Flash videos from common websites, there are a number of options in packages, including https://github.com/monsieurvideo/get-flash-videos";>get-flash-videos, -http://flavio.tordini.org/minitube";>minitube, -http://docs.livestreamer.io/";>livestreamer +https://flavio.tordini.org/minitube";>minitube, +https://streamlink.github.io/";>streamlink and https://rg3.github.io/youtube-dl/";>youtube-dl.
ldomctl usage is incomplete
ldomctl leaves out a ton of commands from its usage, this caused me a moment of confusion while using it. We could list all commands programatically like vmctl, or just a one-line thing like smtpctl. As it is, it's a bit confusing since it lists some but not all commands. diff --git ldomctl.c ldomctl.c index 7e6dcb708a4..bf00bfe6b6b 100644 --- ldomctl.c +++ ldomctl.c @@ -159,8 +159,7 @@ usage(void) { extern char *__progname; - fprintf(stderr, "usage: %s start|stop|panic domain\n", __progname); - fprintf(stderr, " %s status [domain]\n", __progname); + fprintf(stderr, "usage: %s command [argument ...]\n", __progname); exit(EXIT_FAILURE); }
Re: Removal of PIM support in kernel
> I'd welcome anyone interested in PIM to work on it. I'd be great to > have proper kernel support that meets OpenBSD standard and have it > enabled by default. If you're interested in such work, I can help you > getting started ;) Joachim, In our tree, all security or front-facing code must be maintained by an interested individual/group. If it isn't maintained eventually it will become a hinderance towards other developments, or error prone and therefore a risk factor. It gets marginalized by other changes. Then it gets the axe. Every part of the tree needs believers who commit their time to keeping that part good, or even better -- improving it. Especially relevant as minimum standards of quality rises. You'll see an errata posted later today -- I think it is somewhat related to this discussion. I believe there is a minimum mindshare required to keep code "good enough", and therefore present in the tree, but a greater mindshare is required to make it high and of increasing quality. The code the mistake happened in, simply doesn't have enough mindshare to have spotted the mistakes. Expanding mindshare is a hard social problem, so I'm glad you mailed in... hopefully you take the bait mpi has placed in the trap^W^W^W^W^W^W^W
Re: armv7/imx: freezing fec
On Sun, Dec 10, 2017 at 07:05:11PM +0100, Mark Kettenis wrote: > > Date: Sun, 10 Dec 2017 19:03:41 +0200 > > From: Artturi Alm > > > > On Wed, Nov 29, 2017 at 11:45:51AM +0200, Artturi Alm wrote: > > > Hi, > > > > > > > > > there's more work to be done for fec, but this will allow changing > > > changing address/ifconfig up&down etc. without the freeze/kernel hangup > > > preventing ie. autoinstall i've reported to bugs@. > > > > > > i didn't see these while loops being done in nbsd if_enet, where i think > > > fec originates from. > > > > > > -Artturi > > > > > > > Ping? should I minimize the diff i sent earlier, or? > > Does this fix any real problems? If not, just drop it. > Yes, the problem/hang/bug is very real, and reported[0], it does prevent normal things from happening. -Artturi [0] https://marc.info/?l=openbsd-bugs&m=150762924913018&w=2 > > > diff --git a/sys/arch/armv7/imx/if_fec.c b/sys/arch/armv7/imx/if_fec.c > > > index 899c1904144..5b494a6c92c 100644 > > > --- a/sys/arch/armv7/imx/if_fec.c > > > +++ b/sys/arch/armv7/imx/if_fec.c > > > @@ -181,6 +181,8 @@ > > > #define ENET_TXD_INT (1 << 30) > > > #endif > > > > > > +#define ENET_MII_TIMEOUT10 /* --loop_cnt { delay(5); } */ > > > + > > > /* > > > * Bus dma allocation structure used by > > > * fec_dma_malloc and fec_dma_free. > > > @@ -339,7 +341,6 @@ fec_attach(struct device *parent, struct device > > > *self, void *aux) > > > > > > /* reset the controller */ > > > HSET4(sc, ENET_ECR, ENET_ECR_RESET); > > > - while(HREAD4(sc, ENET_ECR) & ENET_ECR_RESET); > > > > > > HWRITE4(sc, ENET_EIMR, 0); > > > HWRITE4(sc, ENET_EIR, 0x); > > > @@ -604,7 +605,6 @@ fec_init(struct fec_softc *sc) > > > > > > /* reset the controller */ > > > HSET4(sc, ENET_ECR, ENET_ECR_RESET); > > > - while(HREAD4(sc, ENET_ECR) & ENET_ECR_RESET); > > > > > > /* set hw address */ > > > HWRITE4(sc, ENET_PALR, > > > @@ -616,7 +616,8 @@ fec_init(struct fec_softc *sc) > > > (sc->sc_ac.ac_enaddr[4] << 24) | > > > (sc->sc_ac.ac_enaddr[5] << 16)); > > > > > > - /* clear outstanding interrupts */ > > > + /* mask and clear all interrupts */ > > > + HWRITE4(sc, ENET_EIMR, 0); > > > HWRITE4(sc, ENET_EIR, 0x); > > > > > > /* set max receive buffer size, 3-0 bits always zero for alignment */ > > > @@ -692,6 +693,8 @@ fec_stop(struct fec_softc *sc) > > > { > > > struct ifnet *ifp = &sc->sc_ac.ac_if; > > > > > > + HCLR4(sc, ENET_ECR, ENET_ECR_ETHEREN); > > > + > > > /* > > >* Mark the interface down and cancel the watchdog timer. > > >*/ > > > @@ -701,9 +704,7 @@ fec_stop(struct fec_softc *sc) > > > > > > timeout_del(&sc->sc_tick); > > > > > > - /* reset the controller */ > > > - HSET4(sc, ENET_ECR, ENET_ECR_RESET); > > > - while(HREAD4(sc, ENET_ECR) & ENET_ECR_RESET); > > > + mii_down(&sc->sc_mii); > > > } > > > > > > void > > > @@ -996,6 +997,7 @@ fec_miibus_readreg(struct device *dev, int phy, int > > > reg) > > > { > > > int r = 0; > > > struct fec_softc *sc = (struct fec_softc *)dev; > > > + u_int timo = ENET_MII_TIMEOUT; > > > > > > HSET4(sc, ENET_EIR, ENET_EIR_MII); > > > > > > @@ -1003,10 +1005,16 @@ fec_miibus_readreg(struct device *dev, int phy, > > > int reg) > > > ENET_MMFR_ST | ENET_MMFR_OP_RD | ENET_MMFR_TA | > > > phy << ENET_MMFR_PA_SHIFT | reg << ENET_MMFR_RA_SHIFT); > > > > > > - while(!(HREAD4(sc, ENET_EIR) & ENET_EIR_MII)); > > > + while (!(HREAD4(sc, ENET_EIR) & ENET_EIR_MII) && --timo) > > > + delay(5); > > > > > > r = bus_space_read_4(sc->sc_iot, sc->sc_ioh, ENET_MMFR); > > > > > > +#ifdef DIAGNOSTIC > > > + if (!timo) > > > + printf("%s: %s timeout\n", sc->sc_dev.dv_xname, __func__); > > > +#endif > > > + > > > return (r & 0x); > > > } > > > > > > @@ -1014,6 +1022,7 @@ void > > > fec_miibus_writereg(struct device *dev, int phy, int reg, int val) > > > { > > > struct fec_softc *sc = (struct fec_softc *)dev; > > > + u_int timo = ENET_MII_TIMEOUT; > > > > > > HSET4(sc, ENET_EIR, ENET_EIR_MII); > > > > > > @@ -1022,7 +1031,12 @@ fec_miibus_writereg(struct device *dev, int phy, > > > int reg, int val) > > > phy << ENET_MMFR_PA_SHIFT | reg << ENET_MMFR_RA_SHIFT | > > > (val & 0x)); > > > > > > - while(!(HREAD4(sc, ENET_EIR) & ENET_EIR_MII)); > > > + while (!(HREAD4(sc, ENET_EIR) & ENET_EIR_MII) && --timo) > > > + delay(5); > > > +#ifdef DIAGNOSTIC > > > + if (!timo) > > > + printf("%s: %s timeout\n", sc->sc_dev.dv_xname, __func__); > > > +#endif > > > > > > return; > > > } > > > >
disable "continous active mode" in iwm(4)
We have been running iwm(4) devices in "continous active mode (CAM)". Apparently this mode is meant for debugging only and wastes power. This diff turns CAM off and enables device-level power saving. As far as I can tell, this means the firmware can turn off some parts of the chip when they are not needed. So it might save some battery life. There is no visible change in behaviour. This does *not* enable powersaving in the sense that we're telling the AP that we'll snooze and it will have to buffer frames for us etc. That behaviour is controlled by a separate "power management" flag and unfortunately when setting that flag iwm(4) does not work well with my athn(4) AP so I'll leave that feature disabled. Index: if_iwm.c === RCS file: /cvs/src/sys/dev/pci/if_iwm.c,v retrieving revision 1.221 diff -u -p -r1.221 if_iwm.c --- if_iwm.c8 Dec 2017 21:16:01 - 1.221 +++ if_iwm.c10 Dec 2017 19:07:19 - @@ -4498,11 +4498,7 @@ iwm_power_build_cmd(struct iwm_softc *sc keep_alive = roundup(keep_alive, 1000) / 1000; cmd->keep_alive_seconds = htole16(keep_alive); -#ifdef notyet cmd->flags = htole16(IWM_POWER_FLAGS_POWER_SAVE_ENA_MSK); - cmd->rx_data_timeout = IWM_DEFAULT_PS_RX_DATA_TIMEOUT; - cmd->tx_data_timeout = IWM_DEFAULT_PS_TX_DATA_TIMEOUT; -#endif } int @@ -4530,15 +4526,11 @@ int iwm_power_update_device(struct iwm_softc *sc) { struct iwm_device_power_cmd cmd = { -#ifdef notyet .flags = htole16(IWM_DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK), -#endif }; if (!(sc->sc_capaflags & IWM_UCODE_TLV_FLAGS_DEVICE_PS_CMD)) return 0; - - cmd.flags |= htole16(IWM_DEVICE_POWER_FLAGS_CAM_MSK); return iwm_send_cmd_pdu(sc, IWM_POWER_TABLE_CMD, 0, sizeof(cmd), &cmd);
Re: Removal of PIM support in kernel
On Sun, Dec 10, 2017 at 07:14:43PM +0100, Martin Pieuchot wrote: > On 10/12/17(Sun) 17:59, Joachim Nilsson wrote: > > [...] > > Now, I've got a few worried questions recently about the removal[3] > > of PIM support in OpenBSD, so I thought I'd ask here. Why have you > > removed it? I'd be very happy if someone could just fill me in, or > > provide a pointer to a mailing list discussion (I couldn't find any). > > At the very least I'd like to have up to date information to provide > > my users. > > PIM support has been added to the OpenBSD kernel in 2005 and has never > been enabled by default. A feature, or set of features, that is/are not > enabled by default are not maintained and thus not supported. In the > last 5 years, the code that lied under '#ifdef PIM' got broken multiple > times by changes in the network stack and did not even compile for > multiple months. > > Last year rzalamena@ rewrote the multicast code to reduce the number of > global data structures, add rdomain support and sync v6 with v4. When > he started working on that we considered that adapting unmaintained > and non-compiled PIM code was too much extra work. That's why this code > has been removed. > > I'd welcome anyone interested in PIM to work on it. I'd be great to > have proper kernel support that meets OpenBSD standard and have it > enabled by default. If you're interested in such work, I can help you > getting started ;) Hi, As a network admin I can say that I have some interest seeing PIM support back to OpenBSD I've some use cases for multicast routing and my users would be glad to see it back. Unfortnatly I totally lack time to help working on this. -- Matthieu Herrb
Re: Removal of PIM support in kernel
On 10/12/17(Sun) 17:59, Joachim Nilsson wrote: > [...] > Now, I've got a few worried questions recently about the removal[3] > of PIM support in OpenBSD, so I thought I'd ask here. Why have you > removed it? I'd be very happy if someone could just fill me in, or > provide a pointer to a mailing list discussion (I couldn't find any). > At the very least I'd like to have up to date information to provide > my users. PIM support has been added to the OpenBSD kernel in 2005 and has never been enabled by default. A feature, or set of features, that is/are not enabled by default are not maintained and thus not supported. In the last 5 years, the code that lied under '#ifdef PIM' got broken multiple times by changes in the network stack and did not even compile for multiple months. Last year rzalamena@ rewrote the multicast code to reduce the number of global data structures, add rdomain support and sync v6 with v4. When he started working on that we considered that adapting unmaintained and non-compiled PIM code was too much extra work. That's why this code has been removed. I'd welcome anyone interested in PIM to work on it. I'd be great to have proper kernel support that meets OpenBSD standard and have it enabled by default. If you're interested in such work, I can help you getting started ;) Cheers, Martin
Re: armv7/imx: freezing fec
> Date: Sun, 10 Dec 2017 19:03:41 +0200 > From: Artturi Alm > > On Wed, Nov 29, 2017 at 11:45:51AM +0200, Artturi Alm wrote: > > Hi, > > > > > > there's more work to be done for fec, but this will allow changing > > changing address/ifconfig up&down etc. without the freeze/kernel hangup > > preventing ie. autoinstall i've reported to bugs@. > > > > i didn't see these while loops being done in nbsd if_enet, where i think > > fec originates from. > > > > -Artturi > > > > Ping? should I minimize the diff i sent earlier, or? Does this fix any real problems? If not, just drop it. > > diff --git a/sys/arch/armv7/imx/if_fec.c b/sys/arch/armv7/imx/if_fec.c > > index 899c1904144..5b494a6c92c 100644 > > --- a/sys/arch/armv7/imx/if_fec.c > > +++ b/sys/arch/armv7/imx/if_fec.c > > @@ -181,6 +181,8 @@ > > #define ENET_TXD_INT (1 << 30) > > #endif > > > > +#defineENET_MII_TIMEOUT10 /* --loop_cnt { delay(5); } */ > > + > > /* > > * Bus dma allocation structure used by > > * fec_dma_malloc and fec_dma_free. > > @@ -339,7 +341,6 @@ fec_attach(struct device *parent, struct device *self, > > void *aux) > > > > /* reset the controller */ > > HSET4(sc, ENET_ECR, ENET_ECR_RESET); > > - while(HREAD4(sc, ENET_ECR) & ENET_ECR_RESET); > > > > HWRITE4(sc, ENET_EIMR, 0); > > HWRITE4(sc, ENET_EIR, 0x); > > @@ -604,7 +605,6 @@ fec_init(struct fec_softc *sc) > > > > /* reset the controller */ > > HSET4(sc, ENET_ECR, ENET_ECR_RESET); > > - while(HREAD4(sc, ENET_ECR) & ENET_ECR_RESET); > > > > /* set hw address */ > > HWRITE4(sc, ENET_PALR, > > @@ -616,7 +616,8 @@ fec_init(struct fec_softc *sc) > > (sc->sc_ac.ac_enaddr[4] << 24) | > > (sc->sc_ac.ac_enaddr[5] << 16)); > > > > - /* clear outstanding interrupts */ > > + /* mask and clear all interrupts */ > > + HWRITE4(sc, ENET_EIMR, 0); > > HWRITE4(sc, ENET_EIR, 0x); > > > > /* set max receive buffer size, 3-0 bits always zero for alignment */ > > @@ -692,6 +693,8 @@ fec_stop(struct fec_softc *sc) > > { > > struct ifnet *ifp = &sc->sc_ac.ac_if; > > > > + HCLR4(sc, ENET_ECR, ENET_ECR_ETHEREN); > > + > > /* > > * Mark the interface down and cancel the watchdog timer. > > */ > > @@ -701,9 +704,7 @@ fec_stop(struct fec_softc *sc) > > > > timeout_del(&sc->sc_tick); > > > > - /* reset the controller */ > > - HSET4(sc, ENET_ECR, ENET_ECR_RESET); > > - while(HREAD4(sc, ENET_ECR) & ENET_ECR_RESET); > > + mii_down(&sc->sc_mii); > > } > > > > void > > @@ -996,6 +997,7 @@ fec_miibus_readreg(struct device *dev, int phy, int reg) > > { > > int r = 0; > > struct fec_softc *sc = (struct fec_softc *)dev; > > + u_int timo = ENET_MII_TIMEOUT; > > > > HSET4(sc, ENET_EIR, ENET_EIR_MII); > > > > @@ -1003,10 +1005,16 @@ fec_miibus_readreg(struct device *dev, int phy, int > > reg) > > ENET_MMFR_ST | ENET_MMFR_OP_RD | ENET_MMFR_TA | > > phy << ENET_MMFR_PA_SHIFT | reg << ENET_MMFR_RA_SHIFT); > > > > - while(!(HREAD4(sc, ENET_EIR) & ENET_EIR_MII)); > > + while (!(HREAD4(sc, ENET_EIR) & ENET_EIR_MII) && --timo) > > + delay(5); > > > > r = bus_space_read_4(sc->sc_iot, sc->sc_ioh, ENET_MMFR); > > > > +#ifdef DIAGNOSTIC > > + if (!timo) > > + printf("%s: %s timeout\n", sc->sc_dev.dv_xname, __func__); > > +#endif > > + > > return (r & 0x); > > } > > > > @@ -1014,6 +1022,7 @@ void > > fec_miibus_writereg(struct device *dev, int phy, int reg, int val) > > { > > struct fec_softc *sc = (struct fec_softc *)dev; > > + u_int timo = ENET_MII_TIMEOUT; > > > > HSET4(sc, ENET_EIR, ENET_EIR_MII); > > > > @@ -1022,7 +1031,12 @@ fec_miibus_writereg(struct device *dev, int phy, int > > reg, int val) > > phy << ENET_MMFR_PA_SHIFT | reg << ENET_MMFR_RA_SHIFT | > > (val & 0x)); > > > > - while(!(HREAD4(sc, ENET_EIR) & ENET_EIR_MII)); > > + while (!(HREAD4(sc, ENET_EIR) & ENET_EIR_MII) && --timo) > > + delay(5); > > +#ifdef DIAGNOSTIC > > + if (!timo) > > + printf("%s: %s timeout\n", sc->sc_dev.dv_xname, __func__); > > +#endif > > > > return; > > } > >
Re: Removal of PIM support in kernel
On Sun, Dec 10, 2017 at 05:59:33PM +0100, Joachim Nilsson wrote: > Hi, > > my name i Joachim and I'm the current upstream maintainer of the > original pimd[1] and mrouted[2] multicast routing daemons. > > First of all, I'd like to give a huge thank you to the OpenBSD team > for all the hard work you put in with Stanford to relicense mrouted > under a BSD license[4]! I don't think you know this, but your work > also freed pimd[1], which in large parts is based on mrouted. > > Now, I've got a few worried questions recently about the removal[3] > of PIM support in OpenBSD, so I thought I'd ask here. Why have you > removed it? I'd be very happy if someone could just fill me in, or > provide a pointer to a mailing list discussion (I couldn't find any). > At the very least I'd like to have up to date information to provide > my users. > > There are currently three major open source PIM implementations for > UNIX that I know of: pimd[1] which today supports both PIM-SM and > PIM-SSM, Xorp pimd[5] (PIM-SM only), and the Quagga PIM-SSM only > pimd[6]. All of them support(ed) OpenBSD, and at least I tested > regularly on OpenBSD. I think the community could greatly benefit > from keeping the PIM kernel support, however, I do understand that > you primarily only support your in-tree applications, like mrouted. > > Best regards > /Joachim Nilsson > > [1]: https://github.com/troglobit/pimd/ > [2]: https://github.com/troglobit/mrouted/ > [3]: https://marc.info/?l=openbsd-cvs&m=148240469327159 > [4]: http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.sbin/mrouted/LICE > NSE > [5]: https://github.com/greearb/xorp.ct/ > [6]: https://github.com/FRRouting/frr/ > Hi Joachim, apparently PIM support was in the way of unlocking the network stack, and since no one stepped up to help improving PIM so that it does not block the ongoing work, it was simply removed. I guess no one would object to re-gaining PIM support as long as it is maintained and is is written in a way that does not hinder the ongoing efforts. Patrick
Re: armv7/imx: freezing fec
On Wed, Nov 29, 2017 at 11:45:51AM +0200, Artturi Alm wrote: > Hi, > > > there's more work to be done for fec, but this will allow changing > changing address/ifconfig up&down etc. without the freeze/kernel hangup > preventing ie. autoinstall i've reported to bugs@. > > i didn't see these while loops being done in nbsd if_enet, where i think > fec originates from. > > -Artturi > Ping? should I minimize the diff i sent earlier, or? -Artturi > > diff --git a/sys/arch/armv7/imx/if_fec.c b/sys/arch/armv7/imx/if_fec.c > index 899c1904144..5b494a6c92c 100644 > --- a/sys/arch/armv7/imx/if_fec.c > +++ b/sys/arch/armv7/imx/if_fec.c > @@ -181,6 +181,8 @@ > #define ENET_TXD_INT (1 << 30) > #endif > > +#define ENET_MII_TIMEOUT10 /* --loop_cnt { delay(5); } */ > + > /* > * Bus dma allocation structure used by > * fec_dma_malloc and fec_dma_free. > @@ -339,7 +341,6 @@ fec_attach(struct device *parent, struct device *self, > void *aux) > > /* reset the controller */ > HSET4(sc, ENET_ECR, ENET_ECR_RESET); > - while(HREAD4(sc, ENET_ECR) & ENET_ECR_RESET); > > HWRITE4(sc, ENET_EIMR, 0); > HWRITE4(sc, ENET_EIR, 0x); > @@ -604,7 +605,6 @@ fec_init(struct fec_softc *sc) > > /* reset the controller */ > HSET4(sc, ENET_ECR, ENET_ECR_RESET); > - while(HREAD4(sc, ENET_ECR) & ENET_ECR_RESET); > > /* set hw address */ > HWRITE4(sc, ENET_PALR, > @@ -616,7 +616,8 @@ fec_init(struct fec_softc *sc) > (sc->sc_ac.ac_enaddr[4] << 24) | > (sc->sc_ac.ac_enaddr[5] << 16)); > > - /* clear outstanding interrupts */ > + /* mask and clear all interrupts */ > + HWRITE4(sc, ENET_EIMR, 0); > HWRITE4(sc, ENET_EIR, 0x); > > /* set max receive buffer size, 3-0 bits always zero for alignment */ > @@ -692,6 +693,8 @@ fec_stop(struct fec_softc *sc) > { > struct ifnet *ifp = &sc->sc_ac.ac_if; > > + HCLR4(sc, ENET_ECR, ENET_ECR_ETHEREN); > + > /* >* Mark the interface down and cancel the watchdog timer. >*/ > @@ -701,9 +704,7 @@ fec_stop(struct fec_softc *sc) > > timeout_del(&sc->sc_tick); > > - /* reset the controller */ > - HSET4(sc, ENET_ECR, ENET_ECR_RESET); > - while(HREAD4(sc, ENET_ECR) & ENET_ECR_RESET); > + mii_down(&sc->sc_mii); > } > > void > @@ -996,6 +997,7 @@ fec_miibus_readreg(struct device *dev, int phy, int reg) > { > int r = 0; > struct fec_softc *sc = (struct fec_softc *)dev; > + u_int timo = ENET_MII_TIMEOUT; > > HSET4(sc, ENET_EIR, ENET_EIR_MII); > > @@ -1003,10 +1005,16 @@ fec_miibus_readreg(struct device *dev, int phy, int > reg) > ENET_MMFR_ST | ENET_MMFR_OP_RD | ENET_MMFR_TA | > phy << ENET_MMFR_PA_SHIFT | reg << ENET_MMFR_RA_SHIFT); > > - while(!(HREAD4(sc, ENET_EIR) & ENET_EIR_MII)); > + while (!(HREAD4(sc, ENET_EIR) & ENET_EIR_MII) && --timo) > + delay(5); > > r = bus_space_read_4(sc->sc_iot, sc->sc_ioh, ENET_MMFR); > > +#ifdef DIAGNOSTIC > + if (!timo) > + printf("%s: %s timeout\n", sc->sc_dev.dv_xname, __func__); > +#endif > + > return (r & 0x); > } > > @@ -1014,6 +1022,7 @@ void > fec_miibus_writereg(struct device *dev, int phy, int reg, int val) > { > struct fec_softc *sc = (struct fec_softc *)dev; > + u_int timo = ENET_MII_TIMEOUT; > > HSET4(sc, ENET_EIR, ENET_EIR_MII); > > @@ -1022,7 +1031,12 @@ fec_miibus_writereg(struct device *dev, int phy, int > reg, int val) > phy << ENET_MMFR_PA_SHIFT | reg << ENET_MMFR_RA_SHIFT | > (val & 0x)); > > - while(!(HREAD4(sc, ENET_EIR) & ENET_EIR_MII)); > + while (!(HREAD4(sc, ENET_EIR) & ENET_EIR_MII) && --timo) > + delay(5); > +#ifdef DIAGNOSTIC > + if (!timo) > + printf("%s: %s timeout\n", sc->sc_dev.dv_xname, __func__); > +#endif > > return; > }
Removal of PIM support in kernel
Hi, my name i Joachim and I'm the current upstream maintainer of the original pimd[1] and mrouted[2] multicast routing daemons. First of all, I'd like to give a huge thank you to the OpenBSD team for all the hard work you put in with Stanford to relicense mrouted under a BSD license[4]! I don't think you know this, but your work also freed pimd[1], which in large parts is based on mrouted. Now, I've got a few worried questions recently about the removal[3] of PIM support in OpenBSD, so I thought I'd ask here. Why have you removed it? I'd be very happy if someone could just fill me in, or provide a pointer to a mailing list discussion (I couldn't find any). At the very least I'd like to have up to date information to provide my users. There are currently three major open source PIM implementations for UNIX that I know of: pimd[1] which today supports both PIM-SM and PIM-SSM, Xorp pimd[5] (PIM-SM only), and the Quagga PIM-SSM only pimd[6]. All of them support(ed) OpenBSD, and at least I tested regularly on OpenBSD. I think the community could greatly benefit from keeping the PIM kernel support, however, I do understand that you primarily only support your in-tree applications, like mrouted. Best regards /Joachim Nilsson [1]: https://github.com/troglobit/pimd/ [2]: https://github.com/troglobit/mrouted/ [3]: https://marc.info/?l=openbsd-cvs&m=148240469327159 [4]: http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.sbin/mrouted/LICE NSE [5]: https://github.com/greearb/xorp.ct/ [6]: https://github.com/FRRouting/frr/
Re: jot: make DOU format strings behave like ld, lo, lu
On Sun, Dec 10, 2017 at 03:29:51PM +0100, Theo Buehler wrote: > The printf(3) manual says that DOU are deprecated but are supposed to > behave the same way as ld, lo and lu. I forgot to say that I found this while looking into the code coverage report by Sergey Bronnikov and found that these format strings aren't covered by our tests. One small comment below. > However: > $ jot -w '%ld' 5 -2 > -2 > -1 > 0 > 1 > 2 > $ jot -w '%D' 5 -2 > 4294967294 > 4294967295 > 0 > 1 > 2 > $ jot -w '%ld' 4 4294967294 > 4294967294 > 4294967295 > 4294967296 > 4294967297 > $ jot -w '%D' 4 4294967294 > jot: range error in conversion: 4294967294.00 > > Similarly for %O and %U. > > This makes %{D,O,U} synonymous with %l{d,o,u}: > > Index: usr.bin/jot/jot.c > === > RCS file: /var/cvs/src/usr.bin/jot/jot.c,v > retrieving revision 1.36 > diff -u -p -r1.36 jot.c > --- usr.bin/jot/jot.c 2 Sep 2016 14:23:09 - 1.36 > +++ usr.bin/jot/jot.c 10 Dec 2017 14:26:47 - > @@ -420,12 +420,16 @@ getformat(void) > intdata = true; > break; > case 'D': > + /* %lD is undefined */ > if (!longdata) { > + longdata = true; /* %D behaves as %ld */ > intdata = true; > break; > } > case 'O': case 'U': > + /* %lO and %lU are undefined */ > if (!longdata) { > + longdata = true; /* %O, %U behave as %ld, %lu */ I'll change %ld into %lo in this comment before committing. > intdata = nosign = true; > break; > } >
Add sizes for free() in libsa for amd64 and i386
Hi tech@, Add sizes for free() in libsa for amd64 and i386. Comments? OK? Index: sys/arch/amd64/stand/libsa/diskprobe.c === RCS file: /cvs/src/sys/arch/amd64/stand/libsa/diskprobe.c,v retrieving revision 1.21 diff -u -p -r1.21 diskprobe.c --- sys/arch/amd64/stand/libsa/diskprobe.c 6 Nov 2017 08:57:34 - 1.21 +++ sys/arch/amd64/stand/libsa/diskprobe.c 8 Dec 2017 14:35:27 - @@ -94,7 +94,7 @@ floppyprobe(void) if (debug) printf(" ", i); #endif - free(dip, 0); + free(dip, sizeof(*dip)); break; } @@ -136,7 +136,7 @@ hardprobe(void) if (debug) printf(" ", i&0x7f); #endif - free(dip, 0); + free(dip, sizeof(*dip)); break; } @@ -323,7 +323,7 @@ cdprobe(void) #if 0 if (bios_getdiskinfo(cddev, &dip->bios_info)) { printf(" "); /* XXX */ - free(dip, 0); + free(dip, sizeof(*dip)); return; } #endif Index: sys/arch/amd64/stand/libsa/softraid_amd64.c === RCS file: /cvs/src/sys/arch/amd64/stand/libsa/softraid_amd64.c,v retrieving revision 1.4 diff -u -p -r1.4 softraid_amd64.c --- sys/arch/amd64/stand/libsa/softraid_amd64.c 5 Jan 2017 11:18:54 - 1.4 +++ sys/arch/amd64/stand/libsa/softraid_amd64.c 8 Dec 2017 14:35:27 - @@ -305,7 +305,7 @@ srprobe(void) } explicit_bzero(md, SR_META_SIZE * DEV_BSIZE); - free(md, 0); + free(md, SR_META_SIZE * DEV_BSIZE); } int Index: sys/arch/i386/stand/libsa/diskprobe.c === RCS file: /cvs/src/sys/arch/i386/stand/libsa/diskprobe.c,v retrieving revision 1.44 diff -u -p -r1.44 diskprobe.c --- sys/arch/i386/stand/libsa/diskprobe.c 21 Jul 2017 01:21:42 - 1.44 +++ sys/arch/i386/stand/libsa/diskprobe.c 8 Dec 2017 14:35:27 - @@ -94,7 +94,7 @@ floppyprobe(void) if (debug) printf(" ", i); #endif - free(dip, 0); + free(dip, sizeof(*dip)); break; } @@ -136,7 +136,7 @@ hardprobe(void) if (debug) printf(" ", i&0x7f); #endif - free(dip, 0); + free(dip, sizeof(*dip)); break; } @@ -310,7 +310,7 @@ cdprobe(void) #if 0 if (bios_getdiskinfo(cddev, &dip->bios_info)) { printf(" "); /* XXX */ - free(dip, 0); + free(dip, sizeof(*dip)); return; } #endif Index: sys/arch/i386/stand/libsa/softraid_i386.c === RCS file: /cvs/src/sys/arch/i386/stand/libsa/softraid_i386.c,v retrieving revision 1.2 diff -u -p -r1.2 softraid_i386.c --- sys/arch/i386/stand/libsa/softraid_i386.c 11 Sep 2016 17:52:47 - 1.2 +++ sys/arch/i386/stand/libsa/softraid_i386.c 8 Dec 2017 14:35:27 - @@ -300,7 +300,7 @@ srprobe(void) } explicit_bzero(md, SR_META_SIZE * DEV_BSIZE); - free(md, 0); + free(md, SR_META_SIZE * DEV_BSIZE); } int
jot: make DOU format strings behave like ld, lo, lu
The printf(3) manual says that DOU are deprecated but are supposed to behave the same way as ld, lo and lu. However: $ jot -w '%ld' 5 -2 -2 -1 0 1 2 $ jot -w '%D' 5 -2 4294967294 4294967295 0 1 2 $ jot -w '%ld' 4 4294967294 4294967294 4294967295 4294967296 4294967297 $ jot -w '%D' 4 4294967294 jot: range error in conversion: 4294967294.00 Similarly for %O and %U. This makes %{D,O,U} synonymous with %l{d,o,u}: Index: usr.bin/jot/jot.c === RCS file: /var/cvs/src/usr.bin/jot/jot.c,v retrieving revision 1.36 diff -u -p -r1.36 jot.c --- usr.bin/jot/jot.c 2 Sep 2016 14:23:09 - 1.36 +++ usr.bin/jot/jot.c 10 Dec 2017 14:26:47 - @@ -420,12 +420,16 @@ getformat(void) intdata = true; break; case 'D': + /* %lD is undefined */ if (!longdata) { + longdata = true; /* %D behaves as %ld */ intdata = true; break; } case 'O': case 'U': + /* %lO and %lU are undefined */ if (!longdata) { + longdata = true; /* %O, %U behave as %ld, %lu */ intdata = nosign = true; break; }
Re: UPDATE: freetype 2.8.1
On Sun, Dec 10, 2017 at 02:46:48PM +0100, David Coppa wrote: > Il 10 dic 2017 10:44 AM, "Matthieu Herrb" ha scritto: > > On Sun, Sep 24, 2017 at 10:03:13AM +0200, David Coppa wrote: > > On Wed, Sep 20, 2017 at 7:06 PM, David Coppa wrote: > > > > > > Here's the update to FreeType-2.8.1. > > > > > > I don't know if there's enough time to have it in for 6.2. > > > > Just catching up with icb logs... > > > > i'm uncomfortable with updating freetype at this point. i'm > > more afraid of runtime fallout than build problems. > > ok no freetype upgrade before release. > > > > ok with me too, we'll come back to this after the unlock. > > Ping ? > > > Can I commit it? As far as I'm concerned, yes. I've been running with it since you posted it. Haven't spotted issues. -- Matthieu Herrb
Re: UPDATE: freetype 2.8.1
Il 10 dic 2017 10:44 AM, "Matthieu Herrb" ha scritto: On Sun, Sep 24, 2017 at 10:03:13AM +0200, David Coppa wrote: > On Wed, Sep 20, 2017 at 7:06 PM, David Coppa wrote: > > > > Here's the update to FreeType-2.8.1. > > > > I don't know if there's enough time to have it in for 6.2. > > Just catching up with icb logs... > > i'm uncomfortable with updating freetype at this point. i'm > more afraid of runtime fallout than build problems. > ok no freetype upgrade before release. > > ok with me too, we'll come back to this after the unlock. Ping ? Can I commit it?
Re: [Patch] man cdce(4) added ZTE MF831 LTE USB Modem
Thanks. You are right, I forgot the capitalisation differences betwenn German and English. > On Sun, Dec 10, 2017 at 12:42:32AM +0100, Christoph R. Murauer wrote: >> Hello ! > morning. > fixed, thanks. > jmc
Re: net/rtsock.c: size to free(9)
On 08/12/17(Fri) 12:58, kshe wrote: > I noticed one instance where the size given to free(9) can easily be > determined. What about the other free(9)s in the same function?
Re: UPDATE: freetype 2.8.1
On Sun, Sep 24, 2017 at 10:03:13AM +0200, David Coppa wrote: > On Wed, Sep 20, 2017 at 7:06 PM, David Coppa wrote: > > > > Here's the update to FreeType-2.8.1. > > > > I don't know if there's enough time to have it in for 6.2. > > Just catching up with icb logs... > > i'm uncomfortable with updating freetype at this point. i'm > more afraid of runtime fallout than build problems. > ok no freetype upgrade before release. > > ok with me too, we'll come back to this after the unlock. Ping ? -- Matthieu Herrb