iked: remove print_host()
With the last print_host() contortions out of the way, this is only used via print_addr() and can go. Make sa, buf, len local. Align variables. Unindent the if (buf == NULL) path. Index: iked.h === RCS file: /cvs/src/sbin/iked/iked.h,v retrieving revision 1.216 diff -u -p -r1.216 iked.h --- iked.h 13 Jun 2023 12:34:12 - 1.216 +++ iked.h 16 Jun 2023 04:58:59 - @@ -1251,8 +1251,6 @@ struct in6_addr * uint32_t prefixlen2mask(uint8_t); const char * -print_host(struct sockaddr *, char *, size_t); -const char * print_addr(void *); char *get_string(uint8_t *, size_t); const char * Index: util.c === RCS file: /cvs/src/sbin/iked/util.c,v retrieving revision 1.41 diff -u -p -r1.41 util.c --- util.c 13 Jun 2023 12:34:12 - 1.41 +++ util.c 14 Jun 2023 14:33:54 - @@ -636,19 +636,20 @@ prefixlen2mask6(uint8_t prefixlen, uint3 } const char * -print_host(struct sockaddr *sa, char *buf, size_t len) +print_addr(void *addr) { - static char sbuf[IKED_CYCLE_BUFFERS][NI_MAXHOST + 7]; - static int idx = 0; - charpbuf[7]; - in_port_t port; - - if (buf == NULL) { - buf = sbuf[idx]; - len = sizeof(sbuf[idx]); - if (++idx >= IKED_CYCLE_BUFFERS) - idx = 0; - } + struct sockaddr *sa = addr; + static char sbuf[IKED_CYCLE_BUFFERS][NI_MAXHOST + 7]; + char*buf; + size_t len; + static int idx = 0; + char pbuf[7]; + in_port_tport; + + buf = sbuf[idx]; + len = sizeof(sbuf[idx]); + if (++idx >= IKED_CYCLE_BUFFERS) + idx = 0; if (sa->sa_family == AF_UNSPEC) { strlcpy(buf, "any", len); @@ -667,12 +668,6 @@ print_host(struct sockaddr *sa, char *bu } return (buf); -} - -const char * -print_addr(void *addr) -{ - return print_host(addr, NULL, 0); } char *
nv(4) acceleration disabled by default + enabling EXA
Hello! I have found that for nv(4) nVidia driver the acceleration is disabled by default for historical reasons: As properly documented on: https://man.openbsd.org/nv.4 the: Option "AccelMethod" "string" has default value "XAA". However XAA was removed several years ago (in XServer 13, current version is 21). Therefore as we can verify in Xorg.0.log it has same effect as disabling acceleration entirely: (II) LoadModule: "xaa" (WW) Warning, couldn't open module xaa (EE) NV: Failed to load module "xaa" (module does not exist, 0) To enable EXA acceleration (the only that is supported in current X-Window distribution) we can for example create file /etc/X11/xorg.conf.d/15-nv-exa.conf with contents: Section "Device" Identifier "nv" Driver "nv" Option "AccelMethod" "EXA" EndSection Now again start X-Window and verify that EXA acceleration is enabled - in such case following messages should appear in Xorg.0.log: (**) NV(0): Option "AccelMethod" "EXA" ... (II) EXA(0): Offscreen pixmap area of 201320448 bytes (II) EXA(0): Driver registered support for the following operations: (II) Solid (II) Copy (II) UploadToScreen I'm now curious if there are enough volunteers that are willing to test if EXA acceleration helps them noticeably with nVidia performance (personally I have nVidia GT218 - which is G80 Series). In case of positive reports we may think of enabling EXA acceleration as default (just swapping order of items in enum Accel in g80_type.h should do the trick, because the one that has 0 value is default), but considering if there are any cases where EXA causes regressions (crashes or rendering issues). Best regards --Henryk Paluch
OpenBSD Errata: June 15, 2023 (libx11)
Errata patches for libX11 CVE-2023-3138 have been released for OpenBSD 7.2 and 7.3. Binary updates for the amd64, i386 and arm64 platform are available via the syspatch utility. Source code patches can be found on the respective errata page: https://www.openbsd.org/errata72.html https://www.openbsd.org/errata73.html
virtio: Fix handling of feature bits >= 32
Fix handling of feature bits >= 32. This does not yet affect any driver as no high feature bit besides VERSION_1 is used, and that one has special handling. Also, with VIRTIO_DEBUG, simply walk through all transport and device feature names, so that we don't need to adjust the if clause whenever the standard introduces new transport features. ok? diff --git a/sys/dev/pv/virtio.c b/sys/dev/pv/virtio.c index d085376d054..fe0ac053c88 100644 --- a/sys/dev/pv/virtio.c +++ b/sys/dev/pv/virtio.c @@ -97,7 +97,7 @@ virtio_log_features(uint64_t host, uint64_t neg, const struct virtio_feature_name *namep; int i; char c; - uint32_t bit; + uint64_t bit; for (i = 0; i < 64; i++) { if (i == 30) { @@ -107,13 +107,17 @@ virtio_log_features(uint64_t host, uint64_t neg, */ continue; } - bit = 1 << i; + bit = 1ULL << i; if ((host) == 0) continue; - namep = (i < 24 || i > 37) ? guest_feature_names : - transport_feature_names; + namep = guest_feature_names; while (namep->bit && namep->bit != bit) namep++; + if (namep->name == NULL) { + namep = transport_feature_names; + while (namep->bit && namep->bit != bit) + namep++; + } c = (neg) ? '+' : '-'; if (namep->name) printf(" %c%s", c, namep->name); diff --git a/sys/dev/pv/virtiovar.h b/sys/dev/pv/virtiovar.h index 9e3e9c9a27b..f1c6d8cde1b 100644 --- a/sys/dev/pv/virtiovar.h +++ b/sys/dev/pv/virtiovar.h @@ -138,7 +138,7 @@ struct virtqueue { }; struct virtio_feature_name { - uint32_t bit; + uint64_t bit; const char *name; }; @@ -203,7 +203,7 @@ struct virtio_softc { #definevirtio_device_reset(sc) virtio_set_status((sc), 0) static inline int -virtio_has_feature(struct virtio_softc *sc, unsigned int fbit) +virtio_has_feature(struct virtio_softc *sc, uint64_t fbit) { if (sc->sc_active_features & fbit) return 1;
Re: all platforms, main(): call clockqueue_init() just before sched_init_cpu()
On Tue, Jun 13, 2023 at 02:19:36PM +0200, Mark Kettenis wrote: > > Date: Mon, 12 Jun 2023 19:09:59 -0500 > > From: Scott Cheloha > > > > We need to initialize the per-CPU clockintr_queue struct before we can > > call clockintr_establish() from sched_init_cpu(). > > > > Initialization is done with a call to clockqueue_init(). Currently we > > call it during clockintr_cpu_init(), i.e. each CPU initializes its own > > clockintr_queue struct. > > > > This patch moves the clockqueue_init() call out into main() and out > > into the MD code, just before sched_init_cpu(). So, now the primary > > CPU initializes the clockintr_queue struct on behalf of the secondary > > CPUs. > > > > No behavior change. > > > > With this in place, we can start breaking pieces off of the > > hardclock() and statclock() in the next patch. > > > > ok? > > Maybe we should consider having an MI "initialize data structures for > this CPU" function at some point. But having thise next to > sched_init_cpu() is fine for now. > > ok kettenis@ It would be nice to have a MI way but right now this needs to go in so we can make progress with hardclock() and statclock(). I have this diff (plus more) running on my system for a while now. No problems noticed. OK claudio@ > > Index: kern/init_main.c > > === > > RCS file: /cvs/src/sys/kern/init_main.c,v > > retrieving revision 1.320 > > diff -u -p -r1.320 init_main.c > > --- kern/init_main.c1 Jan 2023 07:00:51 - 1.320 > > +++ kern/init_main.c12 Jun 2023 23:55:43 - > > @@ -47,6 +47,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -313,6 +314,7 @@ main(void *framep) > > /* Initialize run queues */ > > sched_init_runqueues(); > > sleep_queue_init(); > > + clockqueue_init(()->ci_queue); > > sched_init_cpu(curcpu()); > > p->p_cpu->ci_randseed = (arc4random() & 0x7fff) + 1; > > > > Index: kern/kern_clockintr.c > > === > > RCS file: /cvs/src/sys/kern/kern_clockintr.c,v > > retrieving revision 1.21 > > diff -u -p -r1.21 kern_clockintr.c > > --- kern/kern_clockintr.c 23 Apr 2023 00:08:36 - 1.21 > > +++ kern/kern_clockintr.c 12 Jun 2023 23:55:43 - > > @@ -66,7 +66,6 @@ void clockintr_schedule(struct clockintr > > void clockintr_schedule_locked(struct clockintr *, uint64_t); > > void clockintr_statclock(struct clockintr *, void *); > > void clockintr_statvar_init(int, uint32_t *, uint32_t *, uint32_t *); > > -void clockqueue_init(struct clockintr_queue *); > > uint64_t clockqueue_next(const struct clockintr_queue *); > > void clockqueue_reset_intrclock(struct clockintr_queue *); > > uint64_t nsec_advance(uint64_t *, uint64_t, uint64_t); > > @@ -114,7 +113,6 @@ clockintr_cpu_init(const struct intrcloc > > > > KASSERT(ISSET(clockintr_flags, CL_INIT)); > > > > - clockqueue_init(cq); > > if (ic != NULL && !ISSET(cq->cq_flags, CQ_INTRCLOCK)) { > > cq->cq_intrclock = *ic; > > SET(cq->cq_flags, CQ_INTRCLOCK); > > Index: sys/clockintr.h > > === > > RCS file: /cvs/src/sys/sys/clockintr.h,v > > retrieving revision 1.7 > > diff -u -p -r1.7 clockintr.h > > --- sys/clockintr.h 20 Apr 2023 14:51:28 - 1.7 > > +++ sys/clockintr.h 12 Jun 2023 23:55:43 - > > @@ -129,6 +129,7 @@ void clockintr_trigger(void); > > * Kernel API > > */ > > > > +void clockqueue_init(struct clockintr_queue *); > > int sysctl_clockintr(int *, u_int, void *, size_t *, void *, size_t); > > > > #endif /* _KERNEL */ > > Index: arch/alpha/alpha/cpu.c > > === > > RCS file: /cvs/src/sys/arch/alpha/alpha/cpu.c,v > > retrieving revision 1.46 > > diff -u -p -r1.46 cpu.c > > --- arch/alpha/alpha/cpu.c 10 Dec 2022 15:02:29 - 1.46 > > +++ arch/alpha/alpha/cpu.c 12 Jun 2023 23:55:43 - > > @@ -597,6 +597,7 @@ cpu_hatch(struct cpu_info *ci) > > ALPHA_TBIA(); > > alpha_pal_imb(); > > > > + clockqueue_init(>ci_queue); > > KERNEL_LOCK(); > > sched_init_cpu(ci); > > nanouptime(>ci_schedstate.spc_runtime); > > Index: arch/amd64/amd64/cpu.c > > === > > RCS file: /cvs/src/sys/arch/amd64/amd64/cpu.c,v > > retrieving revision 1.168 > > diff -u -p -r1.168 cpu.c > > --- arch/amd64/amd64/cpu.c 24 Apr 2023 09:04:03 - 1.168 > > +++ arch/amd64/amd64/cpu.c 12 Jun 2023 23:55:43 - > > @@ -664,6 +664,7 @@ cpu_attach(struct device *parent, struct > > #if defined(MULTIPROCESSOR) > > cpu_intr_init(ci); > > cpu_start_secondary(ci); > > + clockqueue_init(>ci_queue); > > sched_init_cpu(ci); > > ncpus++; > > if (ci->ci_flags &
Re: msdosfs: fixes for Undefined Behavior
On Thu, Jun 15, 2023 at 11:36:21AM +0200, Stefan Fritsch wrote: > >From FreeBSD commits > > commit c0db7289c3de290d821311942d5533f2284af77f > Author: pfg > Date: Wed Aug 8 15:08:22 2018 + > > msdosfs: fixes for Undefined Behavior. > > and > > commit 852150953b828e4e8c32789637061001158a8cf4 > Author: kib > Date: Fri Oct 11 18:37:02 2019 + > > Plug the rest of undef behavior places that were missed in r337456. > > > ok ? OK bluhm@ > diff --git a/sys/msdosfs/msdosfs_fat.c b/sys/msdosfs/msdosfs_fat.c > index d31abf7d11d..be23e161e29 100644 > --- a/sys/msdosfs/msdosfs_fat.c > +++ b/sys/msdosfs/msdosfs_fat.c > @@ -411,7 +411,7 @@ usemap_alloc(struct msdosfsmount *pmp, uint32_t cn) > { > KASSERT(cn <= pmp->pm_maxcluster); > > - pmp->pm_inusemap[cn / N_INUSEBITS] |= 1 << (cn % N_INUSEBITS); > + pmp->pm_inusemap[cn / N_INUSEBITS] |= 1U << (cn % N_INUSEBITS); > pmp->pm_freeclustercount--; > } > > @@ -421,7 +421,7 @@ usemap_free(struct msdosfsmount *pmp, uint32_t cn) > KASSERT(cn <= pmp->pm_maxcluster); > > pmp->pm_freeclustercount++; > - pmp->pm_inusemap[cn / N_INUSEBITS] &= ~(1 << (cn % N_INUSEBITS)); > + pmp->pm_inusemap[cn / N_INUSEBITS] &= ~(1U << (cn % N_INUSEBITS)); > } > > int > @@ -652,7 +652,7 @@ chainlength(struct msdosfsmount *pmp, uint32_t start, > uint32_t count) > idx = start / N_INUSEBITS; > start %= N_INUSEBITS; > map = pmp->pm_inusemap[idx]; > - map &= ~((1 << start) - 1); > + map &= ~((1U << start) - 1); > if (map) { > len = ffs(map) - 1 - start; > len = MIN(len, count); > @@ -759,7 +759,7 @@ clusteralloc(struct msdosfsmount *pmp, uint32_t start, > uint32_t count, > for (cn = newst; cn <= pmp->pm_maxcluster;) { > idx = cn / N_INUSEBITS; > map = pmp->pm_inusemap[idx]; > - map |= (1 << (cn % N_INUSEBITS)) - 1; > + map |= (1U << (cn % N_INUSEBITS)) - 1; > if (map != (u_int)-1) { > cn = idx * N_INUSEBITS + ffs(map^(u_int)-1) - 1; > if ((l = chainlength(pmp, cn, count)) >= count) > @@ -776,7 +776,7 @@ clusteralloc(struct msdosfsmount *pmp, uint32_t start, > uint32_t count, > for (cn = 0; cn < newst;) { > idx = cn / N_INUSEBITS; > map = pmp->pm_inusemap[idx]; > - map |= (1 << (cn % N_INUSEBITS)) - 1; > + map |= (1U << (cn % N_INUSEBITS)) - 1; > if (map != (u_int)-1) { > cn = idx * N_INUSEBITS + ffs(map^(u_int)-1) - 1; > if ((l = chainlength(pmp, cn, count)) >= count)
msdosfs: fixes for Undefined Behavior
>From FreeBSD commits commit c0db7289c3de290d821311942d5533f2284af77f Author: pfg Date: Wed Aug 8 15:08:22 2018 + msdosfs: fixes for Undefined Behavior. and commit 852150953b828e4e8c32789637061001158a8cf4 Author: kib Date: Fri Oct 11 18:37:02 2019 + Plug the rest of undef behavior places that were missed in r337456. ok ? diff --git a/sys/msdosfs/msdosfs_fat.c b/sys/msdosfs/msdosfs_fat.c index d31abf7d11d..be23e161e29 100644 --- a/sys/msdosfs/msdosfs_fat.c +++ b/sys/msdosfs/msdosfs_fat.c @@ -411,7 +411,7 @@ usemap_alloc(struct msdosfsmount *pmp, uint32_t cn) { KASSERT(cn <= pmp->pm_maxcluster); - pmp->pm_inusemap[cn / N_INUSEBITS] |= 1 << (cn % N_INUSEBITS); + pmp->pm_inusemap[cn / N_INUSEBITS] |= 1U << (cn % N_INUSEBITS); pmp->pm_freeclustercount--; } @@ -421,7 +421,7 @@ usemap_free(struct msdosfsmount *pmp, uint32_t cn) KASSERT(cn <= pmp->pm_maxcluster); pmp->pm_freeclustercount++; - pmp->pm_inusemap[cn / N_INUSEBITS] &= ~(1 << (cn % N_INUSEBITS)); + pmp->pm_inusemap[cn / N_INUSEBITS] &= ~(1U << (cn % N_INUSEBITS)); } int @@ -652,7 +652,7 @@ chainlength(struct msdosfsmount *pmp, uint32_t start, uint32_t count) idx = start / N_INUSEBITS; start %= N_INUSEBITS; map = pmp->pm_inusemap[idx]; - map &= ~((1 << start) - 1); + map &= ~((1U << start) - 1); if (map) { len = ffs(map) - 1 - start; len = MIN(len, count); @@ -759,7 +759,7 @@ clusteralloc(struct msdosfsmount *pmp, uint32_t start, uint32_t count, for (cn = newst; cn <= pmp->pm_maxcluster;) { idx = cn / N_INUSEBITS; map = pmp->pm_inusemap[idx]; - map |= (1 << (cn % N_INUSEBITS)) - 1; + map |= (1U << (cn % N_INUSEBITS)) - 1; if (map != (u_int)-1) { cn = idx * N_INUSEBITS + ffs(map^(u_int)-1) - 1; if ((l = chainlength(pmp, cn, count)) >= count) @@ -776,7 +776,7 @@ clusteralloc(struct msdosfsmount *pmp, uint32_t start, uint32_t count, for (cn = 0; cn < newst;) { idx = cn / N_INUSEBITS; map = pmp->pm_inusemap[idx]; - map |= (1 << (cn % N_INUSEBITS)) - 1; + map |= (1U << (cn % N_INUSEBITS)) - 1; if (map != (u_int)-1) { cn = idx * N_INUSEBITS + ffs(map^(u_int)-1) - 1; if ((l = chainlength(pmp, cn, count)) >= count)