CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Sun Jun 13 08:48:29 UTC 2021 Modified Files: src/sys/dev/usb: usb_subr.c Log Message: Fix non-DIAGNOSTIC build. To generate a diff of this commit: cvs rdiff -u -r1.261 -r1.262 src/sys/dev/usb/usb_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/usb/usb_subr.c diff -u src/sys/dev/usb/usb_subr.c:1.261 src/sys/dev/usb/usb_subr.c:1.262 --- src/sys/dev/usb/usb_subr.c:1.261 Sun Jun 13 00:13:24 2021 +++ src/sys/dev/usb/usb_subr.c Sun Jun 13 08:48:29 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: usb_subr.c,v 1.261 2021/06/13 00:13:24 riastradh Exp $ */ +/* $NetBSD: usb_subr.c,v 1.262 2021/06/13 08:48:29 mlelstv Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */ /* @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.261 2021/06/13 00:13:24 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.262 2021/06/13 08:48:29 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -421,7 +421,7 @@ usbd_iface_init(struct usbd_device *dev, static void usbd_iface_fini(struct usbd_device *dev, int ifaceidx) { - struct usbd_interface *ifc = >ud_ifaces[ifaceidx]; + struct usbd_interface *ifc __diagused = >ud_ifaces[ifaceidx]; KASSERT(ifc->ui_dev == dev); KASSERT(ifc->ui_idesc == NULL);
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Sun Jun 13 08:48:29 UTC 2021 Modified Files: src/sys/dev/usb: usb_subr.c Log Message: Fix non-DIAGNOSTIC build. To generate a diff of this commit: cvs rdiff -u -r1.261 -r1.262 src/sys/dev/usb/usb_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Sun Jun 13 07:51:09 UTC 2021 Modified Files: src/sys/dev/usb: uaudio.c Log Message: Don't use aprint* for non-autoconf errors. Also print status value. To generate a diff of this commit: cvs rdiff -u -r1.170 -r1.171 src/sys/dev/usb/uaudio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Sun Jun 13 07:51:09 UTC 2021 Modified Files: src/sys/dev/usb: uaudio.c Log Message: Don't use aprint* for non-autoconf errors. Also print status value. To generate a diff of this commit: cvs rdiff -u -r1.170 -r1.171 src/sys/dev/usb/uaudio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/usb/uaudio.c diff -u src/sys/dev/usb/uaudio.c:1.170 src/sys/dev/usb/uaudio.c:1.171 --- src/sys/dev/usb/uaudio.c:1.170 Sun Jun 13 07:49:43 2021 +++ src/sys/dev/usb/uaudio.c Sun Jun 13 07:51:09 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: uaudio.c,v 1.170 2021/06/13 07:49:43 mlelstv Exp $ */ +/* $NetBSD: uaudio.c,v 1.171 2021/06/13 07:51:09 mlelstv Exp $ */ /* * Copyright (c) 1999, 2012 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.170 2021/06/13 07:49:43 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.171 2021/06/13 07:51:09 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -2835,8 +2835,9 @@ uaudio_chan_pintr(struct usbd_xfer *xfer count, ch->transferred); #ifdef DIAGNOSTIC if (count != cb->size) { - aprint_error("uaudio_chan_pintr: count(%d) != size(%d)\n", - count, cb->size); + device_printf(ch->sc->sc_dev, + "uaudio_chan_pintr: count(%d) != size(%d), status(%d)\n", + count, cb->size, status); } #endif @@ -2918,8 +2919,9 @@ uaudio_chan_rintr(struct usbd_xfer *xfer /* count < cb->size is normal for asynchronous source */ #ifdef DIAGNOSTIC if (count > cb->size) { - aprint_error("uaudio_chan_rintr: count(%d) > size(%d)\n", - count, cb->size); + device_printf(ch->sc->sc_dev, + "uaudio_chan_rintr: count(%d) > size(%d) status(%d)\n", + count, cb->size, status); } #endif
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Sun Jun 13 07:49:43 UTC 2021 Modified Files: src/sys/dev/usb: uaudio.c Log Message: Don't ignore detach errors from children. To generate a diff of this commit: cvs rdiff -u -r1.169 -r1.170 src/sys/dev/usb/uaudio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Sun Jun 13 07:49:43 UTC 2021 Modified Files: src/sys/dev/usb: uaudio.c Log Message: Don't ignore detach errors from children. To generate a diff of this commit: cvs rdiff -u -r1.169 -r1.170 src/sys/dev/usb/uaudio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/usb/uaudio.c diff -u src/sys/dev/usb/uaudio.c:1.169 src/sys/dev/usb/uaudio.c:1.170 --- src/sys/dev/usb/uaudio.c:1.169 Mon Feb 15 13:39:18 2021 +++ src/sys/dev/usb/uaudio.c Sun Jun 13 07:49:43 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: uaudio.c,v 1.169 2021/02/15 13:39:18 isaki Exp $ */ +/* $NetBSD: uaudio.c,v 1.170 2021/06/13 07:49:43 mlelstv Exp $ */ /* * Copyright (c) 1999, 2012 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.169 2021/02/15 13:39:18 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.170 2021/06/13 07:49:43 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -519,7 +519,7 @@ static int uaudio_detach(device_t self, int flags) { struct uaudio_softc *sc = device_private(self); - int rv = 0; + int rv; sc->sc_dying = 1; @@ -529,8 +529,11 @@ uaudio_detach(device_t self, int flags) uaudio_halt_out_dma_unlocked(sc); uaudio_halt_in_dma_unlocked(sc); - if (sc->sc_audiodev != NULL) + if (sc->sc_audiodev != NULL) { rv = config_detach(sc->sc_audiodev, flags); + if (rv) + return rv; + } usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev, sc->sc_dev); @@ -541,7 +544,7 @@ uaudio_detach(device_t self, int flags) mutex_destroy(>sc_lock); mutex_destroy(>sc_intr_lock); - return rv; + return 0; } Static int
Re: 9.1 panic in ccb/iscsi
ci4...@gmail.com (Chavdar Ivanov) writes: >> istgt is the iSCSI server. >> The crash is about the in-kernel iscsi initiator. >The first sentence in the first message in the thread says 'I can see >some panics on a server that exports iSCSI volumes (istgt on >a CCB device' (CCB later corrected as CCD), so as far as I understand >it, istgt is the pkgsrc's net/istgt, the server. It continues to >explain that this server exports the volumes to some workstations. Yes, confusing. But the crash and backtrace are for the initiator.
Re: 9.1 panic in ccb/iscsi
On Sat, Jun 12, 2021 at 05:02:11PM +0100, Chavdar Ivanov wrote: > Not that this has any connection to your problem, but I'd nevertheless > add my 5c about istgt - I have been serving zvols for perhaps one year > now under -current without any problems. istgt is the iSCSI server. The crash is about the in-kernel iscsi initiator. -- Michael van Elst Internet: mlel...@serpens.de "A potential Snark may lurk in every tree."
Re: 9.1 panic in ccb/iscsi
joel.bertr...@systella.fr (=?UTF-8?Q?BERTRAND_Jo=c3=abl?=) writes: >> If you have a version of the kernel with debug symbols, you could >> use addr2line to identify the instruction that caused the uvm_fault >> at address 0x802280cc. Without debug symbols it is not >> that easy. > I have this kind of kernel, but I cannot obtain more information. addr2line -e $yourdebugkernel 0x802280cc should retrieve some information.
Re: 9.1 panic in ccb/iscsi
joel.bertr...@systella.fr (=?UTF-8?Q?BERTRAND_Jo=c3=abl?=) writes: > Hello, > I can see some panics on a server that exports iSCSI volumes (istgt on >a CCB device) to some workstations. dmesg always contains this kind of >backtrace : That would be on the workstation that uses the volumes unless your server would also be a client. >[ 308324,087343] S-1C-1: ccb_timeout: num=1 total=1 disp=0 >[ 308324,087343] uvm_fault(0x81585e20, 0x0, 2) -> e >[ 308324,087343] fatal page fault in supervisor mode >[ 308324,087343] trap type 6 code 0x2 rip 0x802280cc cs 0x8 >rflags 0x10246 cr2 0x10 ilevel 0 rsp 0x97813fa16f48 A NULL pointer dereference... >[ 308324,087343] curlwp 0xc947d4f304c0 pid 0.201 lowest kstack >0x97813fa142c0 >[ 308324,087343] panic: trap >[ 308324,087343] cpu1: Begin traceback... >[ 308324,087343] vpanic() at netbsd:vpanic+0x160 >[ 308324,087343] snprintf() at netbsd:snprintf >[ 308324,087343] startlwp() at netbsd:startlwp >[ 308324,087343] alltraps() at netbsd:alltraps+0xbb >[ 308324,087343] ccb_timeout() at iscsi:ccb_timeout+0xf0 >[ 308324,087343] iscsi_cleanup_thread() at iscsi:iscsi_cleanup_thread+0x2b6 in something called by ccb_timeout(). If you have a version of the kernel with debug symbols, you could use addr2line to identify the instruction that caused the uvm_fault at address 0x802280cc. Without debug symbols it is not that easy.
Re: st.c update has broken dump multi-tape support
On Sat, Jun 12, 2021 at 11:17:14AM +0200, Frank Kardel wrote: > Hi ! > > Look pretty good so far, ... can we remove following marked lines which are > already > taken care of in ststart1 complete case? I guess so. -- Michael van Elst Internet: mlel...@serpens.de "A potential Snark may lurk in every tree."
Re: st.c update has broken dump multi-tape support
mlel...@serpens.de (Michael van Elst) writes: >I'm currently testing >http://ftp.netbsd.org/pub/NetBSD/misc/mlelstv/st.diff Works for me: DUMP: Found /dev/rdk0 on / in /etc/fstab DUMP: Date of this level 0 dump: Sat Jun 12 00:24:45 2021 DUMP: Date of last level 0 dump: the epoch DUMP: Dumping /dev/rdk0 (/) to /dev/nrst0 DUMP: Label: none DUMP: mapping (Pass I) [regular files] DUMP: mapping (Pass II) [directories] DUMP: estimated 11948298 tape blocks. DUMP: Volume 1 started at: Sat Jun 12 00:24:54 2021 DUMP: dumping (Pass III) [directories] DUMP: dumping (Pass IV) [regular files] DUMP: 18.18% done, finished in 0:22 DUMP: 39.37% done, finished in 0:15 DUMP: 56.67% done, finished in 0:11 DUMP: End of tape detected DUMP: Closing /dev/nrst0 DUMP: Volume 1 completed at: Sat Jun 12 00:44:21 2021 DUMP: Volume 1 took 0:19:27 DUMP: Volume 1 transfer rate: 7380 KB/s DUMP: Change Volumes: Mount volume #2 DUMP: Is the new volume mounted and ready to go?: ("yes" or "no") yes DUMP: Volume 2 started at: Sat Jun 12 00:45:06 2021 DUMP: Volume 2 begins with blocks from inode 1448282 DUMP: 72.08% done, finished in 0:07 DUMP: 87.50% done, finished in 0:03 DUMP: 11948472 tape blocks on 2 volumes DUMP: Volume 2 completed at: Sat Jun 12 00:54:40 2021 DUMP: Volume 2 took 0:09:34 DUMP: Volume 2 transfer rate: 5812 KB/s DUMP: Date of this level 0 dump: Sat Jun 12 00:24:45 2021 DUMP: Date this dump completed: Sat Jun 12 00:54:40 2021 DUMP: Average transfer rate: 6596 KB/s DUMP: level 0 dump on Sat Jun 12 00:24:45 2021 DUMP: Closing /dev/nrst0 DUMP: DUMP IS DONE Can you please verify?
Re: st.c update has broken dump multi-tape support
bl...@internode.on.net (Brett Lymn) writes: >Here is the patch that makes multi-tape dumps work for me: I'm currently testing http://ftp.netbsd.org/pub/NetBSD/misc/mlelstv/st.diff It's a bit cumbersome to do multi-tape dumps if your disk has 11GB data and the tape fits 40GB uncompressed.
Re: st.c update has broken dump multi-tape support
On Thu, Jun 10, 2021 at 04:57:21PM +0200, Frank Kardel wrote: > Hi ! > > I assumed Michael was proposing a solution for the missing biodone() in the > fixed block path (though that part was missing in the patch). Yes, biodone needs to be called without the lock being held, so not in ststart1(). Greetings, -- Michael van Elst Internet: mlel...@serpens.de "A potential Snark may lurk in every tree."
Re: st.c update has broken dump multi-tape support
On Thu, Jun 10, 2021 at 12:02:19PM +0200, Michael van Elst wrote: > If you don't like the fake errno, the function needs to return > two values, the error value and a boolean to finish the > unqueued request. Cleaner, but more changes. E.g. (not even compile-tested): Index: st.c === RCS file: /cvsroot/src/sys/dev/scsipi/st.c,v retrieving revision 1.240 diff -p -u -r1.240 st.c --- st.c27 Dec 2019 09:41:51 - 1.240 +++ st.c10 Jun 2021 10:11:47 - @@ -343,7 +343,7 @@ static int st_mount_tape(dev_t, int); static voidst_unmount(struct st_softc *, boolean); static int st_decide_mode(struct st_softc *, boolean); static voidststart(struct scsipi_periph *); -static int ststart1(struct scsipi_periph *, struct buf *); +static int ststart1(struct scsipi_periph *, struct buf *, int *); static voidstrestart(void *); static voidstdone(struct scsipi_xfer *, int); static int st_read(struct st_softc *, char *, int, int); @@ -1183,13 +1183,13 @@ abort: * ststart() is called with channel lock held */ static int -ststart1(struct scsipi_periph *periph, struct buf *bp) +ststart1(struct scsipi_periph *periph, struct buf *bp, int *errnop) { struct st_softc *st = device_private(periph->periph_dev); struct scsipi_channel *chan = periph->periph_channel; struct scsi_rw_tape cmd; struct scsipi_xfer *xs; - int flags, error; + int flags, error, complete = 1; SC_DEBUG(periph, SCSIPI_DB2, ("ststart1 ")); @@ -1299,11 +1299,14 @@ ststart1(struct scsipi_periph *periph, s error = scsipi_execute_xs(xs); /* with a scsipi_xfer preallocated, scsipi_command can't fail */ KASSERT(error == 0); + if (error == 0) + complete = 0; out: mutex_exit(chan_mtx(chan)); - return error; + *errnop = error; + return complete; } static void @@ -1312,7 +1315,7 @@ ststart(struct scsipi_periph *periph) struct st_softc *st = device_private(periph->periph_dev); struct scsipi_channel *chan = periph->periph_channel; struct buf *bp; - int error; + int error, complete; SC_DEBUG(periph, SCSIPI_DB2, ("ststart ")); @@ -1325,19 +1328,20 @@ ststart(struct scsipi_periph *periph) iostat_busy(st->stats); mutex_exit(>sc_iolock); - error = ststart1(periph, bp); + complete = ststart1(periph, bp, ); mutex_enter(>sc_iolock); - if (error != 0) + if (complete) { iostat_unbusy(st->stats, 0, ((bp->b_flags & B_READ) == B_READ)); - if (error == EAGAIN) { - bufq_put(st->buf_defer, bp); - break; + if (error == EAGAIN) { + bufq_put(st->buf_defer, bp); + break; + } } mutex_exit(>sc_iolock); - if (error != 0) { + if (complete) { bp->b_error = error; bp->b_resid = bp->b_bcount; biodone(bp); -- Michael van Elst Internet: mlel...@serpens.de "A potential Snark may lurk in every tree."
Re: st.c update has broken dump multi-tape support
On Thu, Jun 10, 2021 at 11:10:23AM +0200, Frank Kardel wrote: > Hi Brett, > > I meant the section in ststart1 where error is set to zero followed by goto > out inf the fixed blocksize part. The biodone is missing, but also other parts. We have 5 cases. - I/O request is queued, error == 0. -> will be finished in callback. - I/O request is queued, error != 0. -> ststart calls biodone. - I/O request is not queued, error == EAGAIN -> ststart requeues request - I/O request is not queued, error != 0 -> ststart calls biodone. and - I/O request is not queued, error == 0 -> this is broken. I would make the last case return error == -1 instead (!= any possible errno value). In ststart errno is checked != 0, so it will - finish the I/O request for iostat. - call biodone The latter needs an adjustment like: bp->b_error = error < 0 ? 0 : error; so that the fake errno is replaced with end-of-file. If you don't like the fake errno, the function needs to return two values, the error value and a boolean to finish the unqueued request. Cleaner, but more changes. Greetings, -- Michael van Elst Internet: mlel...@serpens.de "A potential Snark may lurk in every tree."
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: mlelstv Date: Mon Jun 7 05:29:22 UTC 2021 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: Don't overwrite changed autofs config files. To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/postinstall
Module Name:src Committed By: mlelstv Date: Mon Jun 7 05:29:22 UTC 2021 Modified Files: src/usr.sbin/postinstall: postinstall.in Log Message: Don't overwrite changed autofs config files. To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/postinstall/postinstall.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/postinstall/postinstall.in diff -u src/usr.sbin/postinstall/postinstall.in:1.38 src/usr.sbin/postinstall/postinstall.in:1.39 --- src/usr.sbin/postinstall/postinstall.in:1.38 Sun Apr 25 06:21:37 2021 +++ src/usr.sbin/postinstall/postinstall.in Mon Jun 7 05:29:22 2021 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: postinstall.in,v 1.38 2021/04/25 06:21:37 lukem Exp $ +# $NetBSD: postinstall.in,v 1.39 2021/06/07 05:29:22 mlelstv Exp $ # # Copyright (c) 2002-2021 The NetBSD Foundation, Inc. # All rights reserved. @@ -902,12 +902,12 @@ special_null mkdir -p "${DEST_DIR}/etc/autofs" fi failed=$(( ${failed} + $? )) - populate_dir "$op" false "${SRC_DIR}/etc" \ + populate_dir "$op" true "${SRC_DIR}/etc" \ "${DEST_DIR}/etc" \ 644 \ auto_master failed=$(( ${failed} + $? )) - populate_dir "$op" false "${SRC_DIR}/etc/autofs" \ + populate_dir "$op" true "${SRC_DIR}/etc/autofs" \ "${DEST_DIR}/etc/autofs" \ 644 \ ${autofs_files}
CVS commit: src/sys/dev
Module Name:src Committed By: mlelstv Date: Sun Jun 6 11:48:55 UTC 2021 Modified Files: src/sys/dev: ipmi.c Log Message: Fail open when ipmi device was found. Clear sc_envsys on failure to prevent double-free. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ipmi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev
Module Name:src Committed By: mlelstv Date: Sun Jun 6 11:48:55 UTC 2021 Modified Files: src/sys/dev: ipmi.c Log Message: Fail open when ipmi device was found. Clear sc_envsys on failure to prevent double-free. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ipmi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ipmi.c diff -u src/sys/dev/ipmi.c:1.5 src/sys/dev/ipmi.c:1.6 --- src/sys/dev/ipmi.c:1.5 Mon Aug 17 08:34:36 2020 +++ src/sys/dev/ipmi.c Sun Jun 6 11:48:55 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ipmi.c,v 1.5 2020/08/17 08:34:36 nonaka Exp $ */ +/* $NetBSD: ipmi.c,v 1.6 2021/06/06 11:48:55 mlelstv Exp $ */ /* * Copyright (c) 2019 Michael van Elst @@ -76,7 +76,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ipmi.c,v 1.5 2020/08/17 08:34:36 nonaka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ipmi.c,v 1.6 2021/06/06 11:48:55 mlelstv Exp $"); #include #include @@ -238,7 +238,6 @@ static int bmc_io_wait(struct ipmi_softc static int bmc_io_wait_spin(struct ipmi_softc *, int, uint8_t, uint8_t); static int bmc_io_wait_sleep(struct ipmi_softc *, int, uint8_t, uint8_t); -static void *bt_buildmsg(struct ipmi_softc *, int, int, int, const void *, int *); static void *cmn_buildmsg(struct ipmi_softc *, int, int, int, const void *, int *); static int getbits(uint8_t *, int, int); @@ -268,6 +267,7 @@ static int kcs_reset(struct ipmi_softc * static int kcs_sendmsg(struct ipmi_softc *, int, const uint8_t *); static int kcs_recvmsg(struct ipmi_softc *, int, int *len, uint8_t *); +static void *bt_buildmsg(struct ipmi_softc *, int, int, int, const void *, int *); static int bt_probe(struct ipmi_softc *); static int bt_reset(struct ipmi_softc *); static int bt_sendmsg(struct ipmi_softc *, int, const uint8_t *); @@ -2034,6 +2034,7 @@ ipmi_thread(void *cookie) if (sysmon_envsys_register(sc->sc_envsys)) { aprint_error_dev(self, "unable to register with sysmon\n"); sysmon_envsys_destroy(sc->sc_envsys); + sc->sc_envsys = NULL; } /* initialize sensor list for thread */ @@ -2314,6 +2315,13 @@ ipmi_suspend(device_t dev, const pmf_qua static int ipmi_open(dev_t dev, int flag, int fmt, lwp_t *l) { + struct ipmi_softc *sc; + int unit; + + unit = IPMIUNIT(dev); + if ((sc = device_lookup_private(_cd, unit)) == NULL) + return (ENXIO); + return 0; }
CVS commit: src/sys/dev/iscsi
Module Name:src Committed By: mlelstv Date: Sun Jun 6 10:40:14 UTC 2021 Modified Files: src/sys/dev/iscsi: iscsi_main.c Log Message: Provide missing file ops. Before a simple read() would panic the kernel. No longer fail close(). To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/dev/iscsi/iscsi_main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/iscsi
Module Name:src Committed By: mlelstv Date: Sun Jun 6 10:40:14 UTC 2021 Modified Files: src/sys/dev/iscsi: iscsi_main.c Log Message: Provide missing file ops. Before a simple read() would panic the kernel. No longer fail close(). To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/dev/iscsi/iscsi_main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/iscsi/iscsi_main.c diff -u src/sys/dev/iscsi/iscsi_main.c:1.35 src/sys/dev/iscsi/iscsi_main.c:1.36 --- src/sys/dev/iscsi/iscsi_main.c:1.35 Sat Apr 24 23:36:56 2021 +++ src/sys/dev/iscsi/iscsi_main.c Sun Jun 6 10:40:14 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: iscsi_main.c,v 1.35 2021/04/24 23:36:56 thorpej Exp $ */ +/* $NetBSD: iscsi_main.c,v 1.36 2021/06/06 10:40:14 mlelstv Exp $ */ /*- * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc. @@ -87,8 +87,15 @@ static int iscsiclose(struct file *); static const struct fileops iscsi_fileops = { .fo_name = "iscsi", + .fo_read = fbadop_read, + .fo_write = fbadop_write, .fo_ioctl = iscsiioctl, + .fo_fcntl = fnullop_fcntl, + .fo_poll = fnullop_poll, + .fo_stat = fbadop_stat, .fo_close = iscsiclose, + .fo_kqfilter = fnullop_kqfilter, + .fo_restart = fnullop_restart }; struct cdevsw iscsi_cdevsw = { @@ -166,15 +173,12 @@ iscsiclose(struct file *fp) struct iscsi_softc *sc; sc = device_lookup_private(_cd, d->fd_unit); - if (sc == NULL) { - DEBOUT(("%s: Cannot find private data\n",__func__)); - return ENXIO; + if (sc != NULL) { + mutex_enter(>lock); + TAILQ_REMOVE(>fds, d, fd_link); + mutex_exit(>lock); } - mutex_enter(>lock); - TAILQ_REMOVE(>fds, d, fd_link); - mutex_exit(>lock); - kmem_free(d, sizeof(*d)); fp->f_iscsi = NULL;
CVS commit: src/sys/dev/iscsi
Module Name:src Committed By: mlelstv Date: Sun Jun 6 10:39:10 UTC 2021 Modified Files: src/sys/dev/iscsi: iscsi_send.c Log Message: Schedule command timeout without connection lock being held to prevent a deadlock. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/dev/iscsi/iscsi_send.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/iscsi/iscsi_send.c diff -u src/sys/dev/iscsi/iscsi_send.c:1.37 src/sys/dev/iscsi/iscsi_send.c:1.38 --- src/sys/dev/iscsi/iscsi_send.c:1.37 Sun Mar 4 07:39:45 2018 +++ src/sys/dev/iscsi/iscsi_send.c Sun Jun 6 10:39:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: iscsi_send.c,v 1.37 2018/03/04 07:39:45 mlelstv Exp $ */ +/* $NetBSD: iscsi_send.c,v 1.38 2021/06/06 10:39:10 mlelstv Exp $ */ /*- * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc. @@ -548,9 +548,10 @@ resend_pdu(ccb_t *ccb) } else { TAILQ_INSERT_TAIL(>c_pdus_to_send, pdu, pdu_send_chain); } - ccb_timeout_start(ccb, COMMAND_TIMEOUT); cv_broadcast(>c_conn_cv); mutex_exit(>c_lock); + + ccb_timeout_start(ccb, COMMAND_TIMEOUT); }
CVS commit: src/sys/dev/iscsi
Module Name:src Committed By: mlelstv Date: Sun Jun 6 10:39:10 UTC 2021 Modified Files: src/sys/dev/iscsi: iscsi_send.c Log Message: Schedule command timeout without connection lock being held to prevent a deadlock. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/dev/iscsi/iscsi_send.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: dump/restore out of range inode
pr...@cam.ac.uk (Patrick Welche) writes: >How can gdb not see a spcl anywhere? /usr/include/protocols/dumprestore.h:#define spcl u_spcl.s_spcl spcl is just a define that got resolved by the compiler.
Re: procfs difference between NetBSD and Linux
mar...@duskware.de (Martin Husemann) writes: >And any software requiring a procfs mount to work correctly is not portable >(for some sense of portable). The bad behaviour is not restricted to procfs. % pwd /tmp/x % ls -l total 4 -rw-r--r-- 1 mlelstv wheel 6 Jun 4 16:20 mountpoint2 % echo Hello > ordinaryfile % echo Hello > mountpoint2 mountpoint2: File exists. % ls -l total 12 -rw-r--r-- 1 mlelstv wheel 6 Jun 4 16:20 mountpoint2 -rw-r--r-- 1 mlelstv wheel 6 Jun 4 16:24 ordinaryfile % mount -v | grep overlay fud:/d/1/overlay on /tmp/x/mountpoint2 type nfs (fsid: 0xb03/0x70b, reads: sync 0 async 0, writes: sync 0 async 0) We need to understand why namei() does this check and how it can be corrected.
Re: procfs difference between NetBSD and Linux
k...@munnari.oz.au (Robert Elz) writes: >Date:Thu, 3 Jun 2021 09:12:52 - (UTC) >From:mlel...@serpens.de (Michael van Elst) >Message-ID: > | namei() return EEXIST when it works on a CREATE operation and > | crosses a mountpoint. >Could we perhaps simply have procfs remove O_CREAT from the flags >passed by the user? It is never going to work to create a file >inside a procfs mount, is it? procfs will anser EOPNOTSUPP on VOP_CREATE. But it never comes that far. On the other hand, the logic in namei() might not be correct. It looks like a check to prevent CREATE operations on a mountpoint, but that's neither necessary nor compatible when the object already exists.
Re: dump/restore out of range inode
pr...@cam.ac.uk (Patrick Welche) writes: > DUMP: Child 29322 returns LOB status 213 >213=0xd5 That's octal. Return status 0213 = 139 -> WCOREFLAG(==128) + signal 11. >Can this happen if the original filesystem is broken? At a distance >it just looks as though restore hasn't read a symbol table before using it >and the filesystem seems to have a valid inode? Segfaults should never happen. maxino has probably never been set since dump crashed and restore got an early end-of-file.
Re: procfs difference between NetBSD and Linux
rhia...@falu.nl (Rhialto) writes: >On Thu 03 Jun 2021 at 09:12:52 -0000, Michael van Elst wrote: >> What happens: >>=20 >> namei() return EEXIST when it works on a CREATE operation and >> crosses a mountpoint. >>=20 >> procfs cheats in that the directory nodes like /proc/$pid/fd are >> served by procfs and have a v_mount pointing to /proc. But the >> file descriptors /proc/$pid/fd/$fd are magic aliases and you get >> the real vnode of that open file which belongs to a different >> mount, e.g. /dev/pts for a pty or a ffs filesystem for a regular file. >>=20 >> For namei() that's crossing a mountpoint -> EEXIST. >I guess the question for the short term is: will it work as intended >when the O_CREAT flag is omitted from the call (since it is redundant >in this case anyway)? I guess so. But AFAIK Samba has refactored the code so that O_CREAT is always used when writing a file. You'd need to add a hack that detects the procfs writes to strip O_CREAT for only that case.
Re: procfs difference between NetBSD and Linux
sim...@netbsd.org (Simon Burge) writes: >Jaromir wrote: >> > On 3/06/21 9:58 am, Mark Davies wrote: >> > > done - https://bugzilla.samba.org/show_bug.cgi?id=14727 >> > >> > And looks like they are throwing it back as a kernel bug >> > >> > https://bugzilla.samba.org/show_bug.cgi?id=14727#c3 >> >> O_CREAT really shouldn't cause the open to fail if the file already >> exists regardless of filesystem, so they are right. >I agree with Jaromir here. From the link in the samba bug, the SUSv3 >open() page entry for the O_CREAT flag starts with: >O_CREAT >If the file exists, this flag has no effect except as noted >under O_EXCL below. What happens: namei() return EEXIST when it works on a CREATE operation and crosses a mountpoint. procfs cheats in that the directory nodes like /proc/$pid/fd are served by procfs and have a v_mount pointing to /proc. But the file descriptors /proc/$pid/fd/$fd are magic aliases and you get the real vnode of that open file which belongs to a different mount, e.g. /dev/pts for a pty or a ffs filesystem for a regular file. For namei() that's crossing a mountpoint -> EEXIST.
Re: Cisco USB serial console compatiblity?
buh...@nfbcal.org (Brian Buhrow) writes: > hello. Does anyone know what USB serial chip the Cisco USB serial > console is closest to >in our USB serial drivers list? the vendor code for the device I'm talking >about is: 0x05a6 >and the product code is: 0x0009. The umodem(4) driver is for the USB CDC class and should understand it.
CVS commit: src/sys/dev/dkwedge
Module Name:src Committed By: mlelstv Date: Wed Jun 2 17:56:41 UTC 2021 Modified Files: src/sys/dev/dkwedge: dk.c Log Message: Clear sc_mode only on last close. To generate a diff of this commit: cvs rdiff -u -r1.104 -r1.105 src/sys/dev/dkwedge/dk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/dkwedge/dk.c diff -u src/sys/dev/dkwedge/dk.c:1.104 src/sys/dev/dkwedge/dk.c:1.105 --- src/sys/dev/dkwedge/dk.c:1.104 Wed Jun 2 15:59:08 2021 +++ src/sys/dev/dkwedge/dk.c Wed Jun 2 17:56:40 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dk.c,v 1.104 2021/06/02 15:59:08 mlelstv Exp $ */ +/* $NetBSD: dk.c,v 1.105 2021/06/02 17:56:40 mlelstv Exp $ */ /*- * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.104 2021/06/02 15:59:08 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.105 2021/06/02 17:56:40 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_dkwedge.h" @@ -1221,6 +1221,7 @@ dklastclose(struct dkwedge_softc *sc) KASSERT(sc->sc_parent->dk_rawvp != NULL); vp = sc->sc_parent->dk_rawvp; sc->sc_parent->dk_rawvp = NULL; + sc->sc_mode = 0; } } @@ -1264,9 +1265,7 @@ dkclose(dev_t dev, int flags, int fmt, s if (sc->sc_dk.dk_openmask == 0) { error = dklastclose(sc); /* releases locks */ - sc->sc_mode = 0; } else { - sc->sc_mode = 0; mutex_exit(>sc_parent->dk_rawlock); mutex_exit(>sc_dk.dk_openlock); }
CVS commit: src/sys/dev/dkwedge
Module Name:src Committed By: mlelstv Date: Wed Jun 2 17:56:41 UTC 2021 Modified Files: src/sys/dev/dkwedge: dk.c Log Message: Clear sc_mode only on last close. To generate a diff of this commit: cvs rdiff -u -r1.104 -r1.105 src/sys/dev/dkwedge/dk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/dkwedge
Module Name:src Committed By: mlelstv Date: Wed Jun 2 15:59:08 UTC 2021 Modified Files: src/sys/dev/dkwedge: dk.c Log Message: Copy mode of open wedges with the same parent and validate it. Remove race on mode value when closing. To generate a diff of this commit: cvs rdiff -u -r1.103 -r1.104 src/sys/dev/dkwedge/dk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/dkwedge/dk.c diff -u src/sys/dev/dkwedge/dk.c:1.103 src/sys/dev/dkwedge/dk.c:1.104 --- src/sys/dev/dkwedge/dk.c:1.103 Sat May 22 13:43:50 2021 +++ src/sys/dev/dkwedge/dk.c Wed Jun 2 15:59:08 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dk.c,v 1.103 2021/05/22 13:43:50 mlelstv Exp $ */ +/* $NetBSD: dk.c,v 1.104 2021/06/02 15:59:08 mlelstv Exp $ */ /*- * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.103 2021/05/22 13:43:50 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.104 2021/06/02 15:59:08 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_dkwedge.h" @@ -1137,6 +1137,7 @@ static int dkopen(dev_t dev, int flags, int fmt, struct lwp *l) { struct dkwedge_softc *sc = dkwedge_lookup(dev); + struct dkwedge_softc *nsc; struct vnode *vp; int error = 0; int mode; @@ -1169,13 +1170,24 @@ dkopen(dev_t dev, int flags, int fmt, st } if (error) goto popen_fail; - /* remember open mode */ - sc->sc_mode = mode; sc->sc_parent->dk_rawvp = vp; + } else { + /* + * Retrieve mode from an already opened wedge. + */ + mode = 0; + LIST_FOREACH(nsc, >sc_parent->dk_wedges, sc_plink) { +if (nsc == sc || nsc->sc_dk.dk_openmask == 0) + continue; +mode = nsc->sc_mode; +break; + } } + sc->sc_mode = mode; sc->sc_parent->dk_rawopens++; - } else if (flags & ~sc->sc_mode & FWRITE) { - /* parent is opened read-only, cannot open read-write */ + } + KASSERT(sc->sc_mode != 0); + if (flags & ~sc->sc_mode & FWRITE) { error = EROFS; goto popen_fail; } @@ -1199,7 +1211,9 @@ static int dklastclose(struct dkwedge_softc *sc) { struct vnode *vp; - int error = 0; + int error = 0, mode; + + mode = sc->sc_mode; vp = NULL; if (sc->sc_parent->dk_rawopens > 0) { @@ -1214,7 +1228,7 @@ dklastclose(struct dkwedge_softc *sc) mutex_exit(>sc_dk.dk_openlock); if (vp) { - dk_close_parent(vp, sc->sc_mode); + dk_close_parent(vp, mode); } return error; @@ -1248,9 +1262,11 @@ dkclose(dev_t dev, int flags, int fmt, s sc->sc_dk.dk_openmask = sc->sc_dk.dk_copenmask | sc->sc_dk.dk_bopenmask; - if (sc->sc_dk.dk_openmask == 0) + if (sc->sc_dk.dk_openmask == 0) { error = dklastclose(sc); /* releases locks */ - else { + sc->sc_mode = 0; + } else { + sc->sc_mode = 0; mutex_exit(>sc_parent->dk_rawlock); mutex_exit(>sc_dk.dk_openlock); }
CVS commit: src/sys/dev/dkwedge
Module Name:src Committed By: mlelstv Date: Wed Jun 2 15:59:08 UTC 2021 Modified Files: src/sys/dev/dkwedge: dk.c Log Message: Copy mode of open wedges with the same parent and validate it. Remove race on mode value when closing. To generate a diff of this commit: cvs rdiff -u -r1.103 -r1.104 src/sys/dev/dkwedge/dk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: Devices.
wo...@planix.ca ("Greg A. Woods") writes: >My understanding w.r.t. the rationale FreeBSD used in deciding to remove >the block devices was that FreeBSD never really buffered/cached by >device in the first place. Also, according to PHK in his 2002 BSDCan >paper about FreeBSD's /dev, "In FreeBSD block devices were not even >implemented in a fashion which would be of any use, since any write >errors would never be reported to the writing process."[*] >[*] >https://www.usenix.org/legacy/events/bsdcon02/full_papers/kamp/kamp_html/index.html >If I'm not mistaken that's all different in NetBSD though (except maybe >for the error handling issue), or am I mistaken??? The same arguments are pretty much valid for NetBSD too. But to a large degree that's more an argument to make such things work. If you remove block devices, you still want to distinguish between buffered access (can be done in arbitrary sizes, read-modify-write as necessary) and raw access (direct hardware I/O with its limitations). You can do that with e.g. flags to open(). Or you can require that each program handles this privately. Neither will be compatible with the current behaviour.
Re: Devices.
mueller6...@twc.com ("Thomas Mueller") writes: >Where do I find the "enough dk* nodes" mode? Would it be in the kernel >config? I never saw it. You can run devpubd. When a wedge and thus the dk* unit attaches, it runs the 01-makedev hook that creates the device node in /dev.
Re: Devices.
mueller6...@twc.com ("Thomas Mueller") writes: >It's a nuisance not to be able to recognize all partitions on a >GPT-partitioned drive because not enough dk* nodes have been configured. >FreeBSD even distinguishes between USB or SCSI disks and SATA disks, and >between GPT partitions and MBR-based partitions: better than Linux in that >regard. We don't even use MBR based partitions, that's just compatibility for firwmare. We also have a "enough dk* nodes" mode but that's disabled by default. I personally think that all the "we don't do things like system X" claims are a nuisance.
CVS commit: src/share/man/man8/man8.x86
Module Name:src Committed By: mlelstv Date: Sun May 30 06:05:24 UTC 2021 Modified Files: src/share/man/man8/man8.x86: boot.8 Log Message: Add "root" command to pass a root specification. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/share/man/man8/man8.x86/boot.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man8/man8.x86/boot.8 diff -u src/share/man/man8/man8.x86/boot.8:1.24 src/share/man/man8/man8.x86/boot.8:1.25 --- src/share/man/man8/man8.x86/boot.8:1.24 Thu Apr 22 01:36:25 2021 +++ src/share/man/man8/man8.x86/boot.8 Sun May 30 06:05:24 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: boot.8,v 1.24 2021/04/22 01:36:25 rin Exp $ +.\" $NetBSD: boot.8,v 1.25 2021/05/30 06:05:24 mlelstv Exp $ .\" .\" Copyright (c) 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -617,6 +617,9 @@ See the foreign operating system's docum .El .It Ic quit Reboot the system. +.It Ic root Ar spec +Pass an explicit root specification to the kernel. +See BTINFO_ROOTDEVICE for details. .It Ic rndseed Ar file Load the specified .Ar file @@ -713,8 +716,10 @@ This will be automatically substituted b .Xr dk 4 wedge if one is discovered. .Pp -The bootloader passes a wedge name as +If the bootloader passes a wedge name as .Dq Li wedge: +or +.Dq Li NAME= followed by the name. The kernel will search for a .Xr dk 4
CVS commit: src/share/man/man8/man8.x86
Module Name:src Committed By: mlelstv Date: Sun May 30 06:05:24 UTC 2021 Modified Files: src/share/man/man8/man8.x86: boot.8 Log Message: Add "root" command to pass a root specification. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/share/man/man8/man8.x86/boot.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys
Module Name:src Committed By: mlelstv Date: Sun May 30 05:59:23 UTC 2021 Modified Files: src/sys/arch/i386/stand/boot: boot2.c src/sys/arch/i386/stand/efiboot: boot.c src/sys/arch/i386/stand/lib: biosdisk.c biosdisk.h exec.c src/sys/lib/libsa: bootcfg.c bootcfg.h Log Message: Add "root" command to provide a BTINFO_ROOTDEVICE parameter. To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.75 src/sys/arch/i386/stand/boot/boot2.c cvs rdiff -u -r1.17 -r1.18 src/sys/arch/i386/stand/efiboot/boot.c cvs rdiff -u -r1.54 -r1.55 src/sys/arch/i386/stand/lib/biosdisk.c cvs rdiff -u -r1.12 -r1.13 src/sys/arch/i386/stand/lib/biosdisk.h cvs rdiff -u -r1.76 -r1.77 src/sys/arch/i386/stand/lib/exec.c cvs rdiff -u -r1.5 -r1.6 src/sys/lib/libsa/bootcfg.c cvs rdiff -u -r1.3 -r1.4 src/sys/lib/libsa/bootcfg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/i386/stand/boot/boot2.c diff -u src/sys/arch/i386/stand/boot/boot2.c:1.74 src/sys/arch/i386/stand/boot/boot2.c:1.75 --- src/sys/arch/i386/stand/boot/boot2.c:1.74 Wed Jul 15 12:36:30 2020 +++ src/sys/arch/i386/stand/boot/boot2.c Sun May 30 05:59:22 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: boot2.c,v 1.74 2020/07/15 12:36:30 kim Exp $ */ +/* $NetBSD: boot2.c,v 1.75 2021/05/30 05:59:22 mlelstv Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -83,6 +83,9 @@ #include #include "devopen.h" +#ifdef _STANDALONE +#include +#endif #ifdef SUPPORT_PS2 #include #endif @@ -130,6 +133,7 @@ void command_boot(char *); void command_pkboot(char *); void command_dev(char *); void command_consdev(char *); +void command_root(char *); #ifndef SMALL void command_menu(char *); #endif @@ -147,6 +151,7 @@ const struct bootblk_command commands[] { "pkboot", command_pkboot }, { "dev", command_dev }, { "consdev", command_consdev }, + { "root", command_root }, #ifndef SMALL { "menu", command_menu }, #endif @@ -450,6 +455,9 @@ command_help(char *arg) #endif "dev [dev:]\n" "consdev {pc|{com[0123]|com[0123]kbd|auto}[,{speed}]}\n" + "root{spec}\n" + " spec can be disk, e.g. wd0, sd0\n" + " or string like wedge:name\n" "vesa {modenum|on|off|enabled|disabled|list}\n" #ifndef SMALL "menu (reenters boot menu, if defined in boot.cfg)\n" @@ -610,6 +618,18 @@ error: printf("invalid console device.\n"); } +void +command_root(char *arg) +{ + struct btinfo_rootdevice *biv = _root; + + strncpy(biv->devname, arg, sizeof(biv->devname)); + if (biv->devname[sizeof(biv->devname)-1] != '\0') { + biv->devname[sizeof(biv->devname)-1] = '\0'; + printf("truncated to %s\n",biv->devname); + } +} + #ifndef SMALL /* ARGSUSED */ void Index: src/sys/arch/i386/stand/efiboot/boot.c diff -u src/sys/arch/i386/stand/efiboot/boot.c:1.17 src/sys/arch/i386/stand/efiboot/boot.c:1.18 --- src/sys/arch/i386/stand/efiboot/boot.c:1.17 Thu Sep 26 12:21:03 2019 +++ src/sys/arch/i386/stand/efiboot/boot.c Sun May 30 05:59:22 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: boot.c,v 1.17 2019/09/26 12:21:03 nonaka Exp $ */ +/* $NetBSD: boot.c,v 1.18 2021/05/30 05:59:22 mlelstv Exp $ */ /*- * Copyright (c) 2016 Kimihiro Nonaka @@ -38,6 +38,10 @@ #include "biosdisk.h" #include "devopen.h" +#ifdef _STANDALONE +#include +#endif + int errno; int boot_biosdev; daddr_t boot_biossector; @@ -65,6 +69,7 @@ void command_quit(char *); void command_boot(char *); void command_pkboot(char *); void command_consdev(char *); +void command_root(char *); void command_dev(char *); void command_devpath(char *); void command_efivar(char *); @@ -88,6 +93,7 @@ const struct bootblk_command commands[] { "boot", command_boot }, { "pkboot", command_pkboot }, { "consdev", command_consdev }, + { "root", command_root }, { "dev", command_dev }, { "devpath", command_devpath }, { "efivar", command_efivar }, @@ -396,6 +402,9 @@ command_help(char *arg) "pkboot [dev:][filename] [-12acdqsvxz]\n" "dev [dev:]\n" "consdev {pc|com[0123][,{speed}]|com,{ioport}[,{speed}]}\n" + "root{spec}\n" + " spec can be disk, e.g. wd0, sd0\n" + " or string like wedge:name\n" "devpath\n" "efivar\n" "gop [{modenum|list}]\n" @@ -590,6 +599,19 @@ error: printf("invalid console device.\n"); } +void +command_root(char *arg) +{ + struct btinfo_rootdevice *biv = _root; + + strncpy(biv->devname, arg, sizeof(biv->devname)); + if (biv->devname[sizeof(biv->devname)-1] != '\0') { + biv->devname[sizeof(biv->devname)-1] = '\0'; + printf("truncated to %s\n",biv->devname); + } +} + + #ifndef SMALL /* ARGSUSED */ void Index: src/sys/arch/i386/stand/lib/biosdisk.c diff -u src/sys/arch/i386/stand/lib/biosdisk.c:1.54 src/sys/arch/i386/stand/lib/biosdisk.c:1.55 --- src/sys/arch/i386/stand/lib/biosdisk.c:1.54 Tue Dec 17 01:37:53 2019 +++
CVS commit: src/sys
Module Name:src Committed By: mlelstv Date: Sun May 30 05:59:23 UTC 2021 Modified Files: src/sys/arch/i386/stand/boot: boot2.c src/sys/arch/i386/stand/efiboot: boot.c src/sys/arch/i386/stand/lib: biosdisk.c biosdisk.h exec.c src/sys/lib/libsa: bootcfg.c bootcfg.h Log Message: Add "root" command to provide a BTINFO_ROOTDEVICE parameter. To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.75 src/sys/arch/i386/stand/boot/boot2.c cvs rdiff -u -r1.17 -r1.18 src/sys/arch/i386/stand/efiboot/boot.c cvs rdiff -u -r1.54 -r1.55 src/sys/arch/i386/stand/lib/biosdisk.c cvs rdiff -u -r1.12 -r1.13 src/sys/arch/i386/stand/lib/biosdisk.h cvs rdiff -u -r1.76 -r1.77 src/sys/arch/i386/stand/lib/exec.c cvs rdiff -u -r1.5 -r1.6 src/sys/lib/libsa/bootcfg.c cvs rdiff -u -r1.3 -r1.4 src/sys/lib/libsa/bootcfg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: Devices.
dholland-t...@netbsd.org (David Holland) writes: >This was all based on the experience of adding discard and adding the >dispatching for it as a first-class [bc]devsw op rather than an ioctl: >it was a pain because it ultimately required touching _every_ driver, >not just the ones that needed to support it, but it was far less of a >mess than plumbing it as an ioctl would have been. And it was a questionable decision as you need the discard operations to queue with other I/O operations.
Re: 9.1: boot-time delay? [WORKAROUND FOUND]
On Fri, May 28, 2021 at 05:13:02AM +0700, Robert Elz wrote: > But it isn't, you can't convert 60 ticks/second into some number of > milliseconds, the two are different units. Sure you can. period = 1/frequency. But HZ (and now hz) in the code is also used as a period, thus the idioms: delay(5*HZ)wait 5 seconds timeout(ttrstrt, tp, HZ/4) trigger ttrstrt in 1/4 second That's the simplicity when your time units are 1/HZ, then the same number (called HZ) can stand for a frequency and a one second period. If the programming language would use measures (number + specific unit) instead of (integer) numbers, it became more explicit. But I guess a modern language would still allow to use the same value as a frequency or a period with some automatic type conversion. Can we go back now to the original problem ? Greetings, -- Michael van Elst Internet: mlel...@serpens.de "A potential Snark may lurk in every tree."
Re: 9.1: boot-time delay? [WORKAROUND FOUND]
mlel...@serpens.de (Michael van Elst) writes: >Either direction mstohz or hztoms should better always round up to >guarantee a minimal delay. And both should be replaced by hztous()/ustohz(). Microseconds allow a time value of ~35 minutes as 32bit signed integer, which should be a safe range for delays. A higher resolution might have its use too, but then you have to assure that such values are always carried in 64bit integers or handled by a structure. There is already a hz2bintime() macro in that realm, which is unsafe (truncates to milliseconds) but AFAIK also unused.
Re: 9.1: boot-time delay? [WORKAROUND FOUND]
mo...@rodents-montreal.org (Mouse) writes: >How heavily is hztoms used? (I would expect mstohz to be used far more >heavily.) sys/dev/acpi/acpi_cpu_cstate.c: sc->sc_cstate_sleep = hztoms(acpitimer_delta(end, start)) * 1000; sys/dev/spkr_audio.c: audiobell(sc->sc_audiodev, xhz, hztoms(ticks), sc->sc_spkr.sc_vol, 0); sys/dev/i2c/tsllux.c: if (ms < hztoms(1)) { sys/dev/ic/mvsata.c: timeout = mstohz(timeout + hztoms(1) - 1); sys/dev/ic/mvsata.c: ata_delay(chp, hztoms(1), "mvsata_edma2", wflags); sys/dev/pci/ixgbe/ixgbe_netbsd.c: else if ((us / 1000) >= hztoms(1)) { sys/dev/sdmmc/if_bwfm_sdio.c: sdmmc_pause(hztoms(1)*1000, NULL); sys/dev/usb/if_axe.c: usbd_delay_ms(sc->axe_un.un_udev, hztoms(y)); \ sys/dev/usb/if_axe.c: usbd_delay_ms(un->un_udev, hztoms(hz / 32)); sys/dev/usb/if_axe.c: usbd_delay_ms(un->un_udev, hztoms(hz / 32)); sys/dev/usb/if_axe.c: usbd_delay_ms(un->un_udev, hztoms(hz / 32)); sys/dev/usb/if_axe.c: usbd_delay_ms(un->un_udev, hztoms(hz / 32)); sys/external/bsd/drm2/include/linux/jiffies.h:return hztoms(j); sys/external/bsd/drm2/include/linux/sched.h: unsigned ms = hztoms(MIN((unsigned long)timeout, sys/kern/sched_4bsd.c:int rttsms = hztoms(sched_rrticks); sys/kern/sched_m2.c: int rttsms = hztoms(sched_rrticks); sys/kern/sched_m2.c: newsize = hztoms(min_ts); sys/kern/sched_m2.c: newsize = hztoms(max_ts); >> 0 can sometimes mean "never block" and sometimes can mean "block >> forever". >What does hztoms's return value get used for? Is it actually used to >compute delay values? It sounds dodgy to me to do so, for this among >other reasons. Mostly to compute a delay. Either direction mstohz or hztoms should better always round up to guarantee a minimal delay.
Re: 9.1: boot-time delay? [WORKAROUND FOUND]
bou...@antioche.eu.org (Manuel Bouyer) writes: >Another issue could be mstohz() called with a delay too short; >mstohz() will round it up to 1 tick. # define mstohz(ms) ((unsigned int)((ms + 0ul) * hz / 1000ul)) If mstohz() would round up to full ticks, it could actually avoid some pitfalls. But it doesn't.
Re: Anyone using a Jabra USB Headset with -current?
On Mon, May 24, 2021 at 08:49:26AM +0300, Andrius V wrote: > Jabra Evolve 20 is not working on NetBSD 9.2 for me (submitted pr > 56172 recently). But yes, it does work on current branch, except that > removing headset on audio play causes panic. Possible. I test on -current. Removing the headset doesn't panic for me which might be caused by: Index: uaudio.c === RCS file: /cvsroot/src/sys/dev/usb/uaudio.c,v retrieving revision 1.169 diff -p -u -r1.169 uaudio.c --- uaudio.c15 Feb 2021 13:39:18 - 1.169 +++ uaudio.c24 May 2021 08:05:05 - @@ -519,7 +519,7 @@ static int uaudio_detach(device_t self, int flags) { struct uaudio_softc *sc = device_private(self); - int rv = 0; + int rv; sc->sc_dying = 1; @@ -529,8 +529,11 @@ uaudio_detach(device_t self, int flags) uaudio_halt_out_dma_unlocked(sc); uaudio_halt_in_dma_unlocked(sc); - if (sc->sc_audiodev != NULL) + if (sc->sc_audiodev != NULL) { rv = config_detach(sc->sc_audiodev, flags); + if (rv) + return rv; + } usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev, sc->sc_dev); @@ -541,7 +544,7 @@ uaudio_detach(device_t self, int flags) mutex_destroy(>sc_lock); mutex_destroy(>sc_intr_lock); - return rv; + return 0; } Static int Greetings, -- Michael van Elst Internet: mlel...@serpens.de "A potential Snark may lurk in every tree."
Re: Constructing a GPT disk image
br...@nmsu.edu (Brook Milligan) writes: >- create an empty image file by, for example, dd if=3D/dev/zero of=disk.img ... >- label image file with gpt create disk.img >- create partitions on image file: gpt add disk.image -t ffs ... >- configure vnconfig: vnconfig -c vnd0 disk.image >- find wedges: dkctl vnd0 listwedges >- create a filesystem: newfs /dev/rdkX >- mount filesystem: mount /dev/dkX /mnt >- populate filesystem with stuff >- unmount filesystem: umount /mnt >- unconfigure vnconfig: vnconfig -u vnd0 >- copy filesystem to a device: dd if=3Ddisk.img of=3D/dev/rXXX =E2=80=A6 You can also: - create an empty image file by, for example, dd if=/dev/zero of=disk.img ... - configure vnconfig: vnconfig -c vnd0 disk.image - label vnd0 with gpt create vnd0 - create partitions on vnd0: gpt add -t ffs ... vnd0 and continue as above. vnd also understands sparse files, with e.g. dd if=/dev/zero of=disk.img bs=1k count=1 seek=1048575 you would create a 1 GByte file but only allocate and write the last 1 kB. When vnd0 then writes it allocates blocks as necessary. As long as the disk image isn't filled completely, that method is more efficient.
Re: Constructing a GPT disk image
br...@nmsu.edu (Brook Milligan) writes: >- vnconfig seems to want a file that corresponds to a single partition, = >not a partitioned disk. vnconfig wants a file that corresponds to a partitioned disk. >Is this a correct procedure? Is it the best option? What would be = >needed to recognize wedges in a GPT disk image so this could be = >simplified (i.e., create the GPT file image and mount the wedges = >directly)? When you use vnconfig to attach a file as a disk, a GPT is detected and wedges are created automatically.
Re: Anyone using a Jabra USB Headset with -current?
mlel...@serpens.de (Michael van Elst) writes: >A Jabra Evolve 75 fails like yours: >uaudio0 at uhub3 port 2 configuration 1 interface 0 >uaudio0: vendor 0b0e (0x0b0e) Jabra Evolve 75 (0x2465), rev 2.00/2.32, addr 4 >uaudio0: autoconfiguration error: no usable endpoint found >uaudio0: autoconfiguration error: audio descriptors make no sense, error=4 >uhidev0 at uhub3 port 2 configuration 1 interface 3 >uhidev0: vendor 0b0e (0x0b0e) Jabra Evolve 75 (0x2465), rev 2.00/2.32, addr 4, >iclass 3/0 And now it works: uaudio0 at uhub3 port 2 configuration 1 interface 0 uaudio0: vendor 0b0e (0x0b0e) Jabra Evolve 75 (0x2465), rev 2.00/2.32, addr 4 uaudio0: audio rev 1.00 uaudio0: 8 mixer controls audio2 at uaudio0: playback, capture, full duplex, independent audio2: slinear_le:16 2ch 48000Hz, blk 11520 bytes (60ms) for playback audio2: slinear_le:16 1ch 16000Hz, blk 1920 bytes (60ms) for recording audio2: PC Speaker (synthesized) wsbell at spkr3 not configured uhidev0 at uhub3 port 2 configuration 1 interface 3 uhidev0: vendor 0b0e (0x0b0e) Jabra Evolve 75 (0x2465), rev 2.00/2.32, addr 4, iclass 3/0 uhidev0: 155 report ids uhid0 at uhidev0 reportid 1: input=2, output=0, feature=0 uhid1 at uhidev0 reportid 2: input=2, output=2, feature=0 uhid2 at uhidev0 reportid 4: input=2, output=2, feature=1 uhid3 at uhidev0 reportid 5: input=63, output=63, feature=0 uhid4 at uhidev0 reportid 154: input=0, output=0, feature=63 uhid5 at uhidev0 reportid 155: input=2, output=0, feature=0 The code assumed some specific order of USB descriptors. When I have cleaned up the patch I'll commit. It probably also applies to older netbsd versions.
Re: Anyone using a Jabra USB Headset with -current?
jarle.greipsl...@norid.no (Jarle Greipsland) writes: >Excerpts from dmesg (after I plugged in the cable): >[71.345366] uaudio0 at uhub1 port 2 configuration 1 interface 0 >[71.345366] uaudio0: vendor 0b0e (0x0b0e) Jabra Evolve 65 (0x030c), rev >2.00/2.91, addr 2 >[71.355369] uaudio0: autoconfiguration error: no usable endpoint found >[71.355369] uaudio0: autoconfiguration error: audio descriptors make no >sense, error=4 >[71.355369] uhidev0 at uhub1 port 2 configuration 1 interface 3 >[71.355369] uhidev0: vendor 0b0e (0x0b0e) Jabra Evolve 65 (0x030c), rev >2.00/2.91, addr 2, iclass 3/0 >[71.365368] uhidev0: 155 report ids >[71.365368] uhid0 at uhidev0 reportid 1: input=2, output=0, feature=0 >[71.365368] uhid1 at uhidev0 reportid 2: input=2, output=2, feature=0 >[71.365368] uhid2 at uhidev0 reportid 4: input=2, output=2, feature=1 >[71.365368] uhid3 at uhidev0 reportid 5: input=63, output=63, feature=0 >[71.365368] uhid4 at uhidev0 reportid 154: input=0, output=0, feature=63 >[71.365368] uhid5 at uhidev0 reportid 155: input=2, output=0, feature=0 A Jabra Evolve 20 is recognized: uaudio0 at uhub2 port 2 configuration 1 interface 0 uaudio0: GN Netcom A/S (0x0b0e) Jabra EVOLVE 20 MS (0x0300), rev 2.00/3.00, addr 3 uaudio0: audio rev 1.00 uaudio0: 7 mixer controls uhidev0 at uhub2 port 2 configuration 1 interface 3 uhidev0: GN Netcom A/S (0x0b0e) Jabra EVOLVE 20 MS (0x0300), rev 2.00/3.00, addr 3, iclass 3/0 uhidev0: 5 report ids uhid0 at uhidev0 reportid 1: input=2, output=0, feature=0 uhid1 at uhidev0 reportid 2: input=2, output=2, feature=0 uhid2 at uhidev0 reportid 4: input=2, output=2, feature=0 uhid3 at uhidev0 reportid 5: input=32, output=32, feature=0 A Jabra Evolve 75 fails like yours: uaudio0 at uhub3 port 2 configuration 1 interface 0 uaudio0: vendor 0b0e (0x0b0e) Jabra Evolve 75 (0x2465), rev 2.00/2.32, addr 4 uaudio0: autoconfiguration error: no usable endpoint found uaudio0: autoconfiguration error: audio descriptors make no sense, error=4 uhidev0 at uhub3 port 2 configuration 1 interface 3 uhidev0: vendor 0b0e (0x0b0e) Jabra Evolve 75 (0x2465), rev 2.00/2.32, addr 4, iclass 3/0 uhidev0: 155 report ids uhid0 at uhidev0 reportid 1: input=2, output=0, feature=0 uhid1 at uhidev0 reportid 2: input=2, output=2, feature=0 uhid2 at uhidev0 reportid 4: input=2, output=2, feature=1 uhid3 at uhidev0 reportid 5: input=63, output=63, feature=0 uhid4 at uhidev0 reportid 154: input=0, output=0, feature=63 uhid5 at uhidev0 reportid 155: input=2, output=0, feature=0 Time for UAUDIO_DEBUG.
CVS commit: src/sys/dev/dkwedge
Module Name:src Committed By: mlelstv Date: Sat May 22 13:43:50 UTC 2021 Modified Files: src/sys/dev/dkwedge: dk.c Log Message: Handle read-only parent devices. Currently this only affects xbd(4). Other disk drivers succeed opening read-only disks as read-write and only fail subsequent write requests. To generate a diff of this commit: cvs rdiff -u -r1.102 -r1.103 src/sys/dev/dkwedge/dk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/dkwedge/dk.c diff -u src/sys/dev/dkwedge/dk.c:1.102 src/sys/dev/dkwedge/dk.c:1.103 --- src/sys/dev/dkwedge/dk.c:1.102 Tue Oct 6 15:05:54 2020 +++ src/sys/dev/dkwedge/dk.c Sat May 22 13:43:50 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dk.c,v 1.102 2020/10/06 15:05:54 mlelstv Exp $ */ +/* $NetBSD: dk.c,v 1.103 2021/05/22 13:43:50 mlelstv Exp $ */ /*- * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.102 2020/10/06 15:05:54 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.103 2021/05/22 13:43:50 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_dkwedge.h" @@ -90,6 +90,7 @@ struct dkwedge_softc { kcondvar_t sc_dkdrn; u_int sc_iopend; /* I/Os pending */ int sc_flags; /* flags (sc_iolock) */ + int sc_mode; /* parent open mode */ }; #define DK_F_WAIT_DRAIN 0x0001 /* waiting for I/O to drain */ @@ -1138,6 +1139,7 @@ dkopen(dev_t dev, int flags, int fmt, st struct dkwedge_softc *sc = dkwedge_lookup(dev); struct vnode *vp; int error = 0; + int mode; if (sc == NULL) return (ENODEV); @@ -1155,12 +1157,27 @@ dkopen(dev_t dev, int flags, int fmt, st if (sc->sc_dk.dk_openmask == 0) { if (sc->sc_parent->dk_rawopens == 0) { KASSERT(sc->sc_parent->dk_rawvp == NULL); - error = dk_open_parent(sc->sc_pdev, FREAD | FWRITE, ); + /* + * Try open read-write. If this fails for EROFS + * and wedge is read-only, retry to open read-only. + */ + mode = FREAD | FWRITE; + error = dk_open_parent(sc->sc_pdev, mode, ); + if (error == EROFS && (flags & FWRITE) == 0) { +mode &= ~FWRITE; +error = dk_open_parent(sc->sc_pdev, mode, ); + } if (error) goto popen_fail; + /* remember open mode */ + sc->sc_mode = mode; sc->sc_parent->dk_rawvp = vp; } sc->sc_parent->dk_rawopens++; + } else if (flags & ~sc->sc_mode & FWRITE) { + /* parent is opened read-only, cannot open read-write */ + error = EROFS; + goto popen_fail; } if (fmt == S_IFCHR) sc->sc_dk.dk_copenmask |= 1; @@ -1197,7 +1214,7 @@ dklastclose(struct dkwedge_softc *sc) mutex_exit(>sc_dk.dk_openlock); if (vp) { - dk_close_parent(vp, FREAD | FWRITE); + dk_close_parent(vp, sc->sc_mode); } return error;
CVS commit: src/sys/dev/dkwedge
Module Name:src Committed By: mlelstv Date: Sat May 22 13:43:50 UTC 2021 Modified Files: src/sys/dev/dkwedge: dk.c Log Message: Handle read-only parent devices. Currently this only affects xbd(4). Other disk drivers succeed opening read-only disks as read-write and only fail subsequent write requests. To generate a diff of this commit: cvs rdiff -u -r1.102 -r1.103 src/sys/dev/dkwedge/dk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: remserial and usb converters
jmitc...@bigjar.com (Jason Mitchell) writes: >   The remserial command is: >remserial -d -p 48310 -s "9600 sane" /dev/ttyu0 & Works fine for me, except it's ttyU0 and configuring "sane" may not be what you need. For e.g. a console, use "raw". I prefer to use conserver which adds some features and also authentication. The drawback is that 'telnet' isn't sufficient as a client.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Sun May 16 09:17:23 UTC 2021 Modified Files: src/sys/dev/usb: uvideo.c Log Message: close pipe before freeing frame length array. To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/sys/dev/usb/uvideo.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/usb/uvideo.c diff -u src/sys/dev/usb/uvideo.c:1.59 src/sys/dev/usb/uvideo.c:1.60 --- src/sys/dev/usb/uvideo.c:1.59 Mon Aug 10 19:27:27 2020 +++ src/sys/dev/usb/uvideo.c Sun May 16 09:17:23 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: uvideo.c,v 1.59 2020/08/10 19:27:27 rjs Exp $ */ +/* $NetBSD: uvideo.c,v 1.60 2021/05/16 09:17:23 mlelstv Exp $ */ /* * Copyright (c) 2008 Patrick Mahoney @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.59 2020/08/10 19:27:27 rjs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.60 2021/05/16 09:17:23 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -1659,7 +1659,15 @@ uvideo_stream_stop_xfer(struct uvideo_st usbd_destroy_xfer(isoc->i_xfer); isoc->i_xfer = NULL; } + } + + if (ix->ix_pipe != NULL) { + usbd_close_pipe(ix->ix_pipe); + ix->ix_pipe = NULL; + } + for (i = 0; i < UVIDEO_NXFERS; i++) { + struct uvideo_isoc *isoc = >ix_i[i]; if (isoc->i_frlengths != NULL) { kmem_free(isoc->i_frlengths, sizeof(isoc->i_frlengths[0]) * @@ -1668,10 +1676,6 @@ uvideo_stream_stop_xfer(struct uvideo_st } } - if (ix->ix_pipe != NULL) { - usbd_close_pipe(ix->ix_pipe); - ix->ix_pipe = NULL; - } /* Give it some time to settle */ usbd_delay_ms(vs->vs_parent->sc_udev, 1000);
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Sun May 16 09:17:23 UTC 2021 Modified Files: src/sys/dev/usb: uvideo.c Log Message: close pipe before freeing frame length array. To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/sys/dev/usb/uvideo.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/spi
Module Name:src Committed By: mlelstv Date: Sun May 16 08:48:20 UTC 2021 Modified Files: src/sys/dev/spi: spi.c Log Message: Protect ioctl and declare MPSAFE. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/dev/spi/spi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/spi/spi.c diff -u src/sys/dev/spi/spi.c:1.17 src/sys/dev/spi/spi.c:1.18 --- src/sys/dev/spi/spi.c:1.17 Sat Apr 24 23:36:59 2021 +++ src/sys/dev/spi/spi.c Sun May 16 08:48:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: spi.c,v 1.17 2021/04/24 23:36:59 thorpej Exp $ */ +/* $NetBSD: spi.c,v 1.18 2021/05/16 08:48:20 mlelstv Exp $ */ /*- * Copyright (c) 2006 Urbana-Champaign Independent Media Center. @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: spi.c,v 1.17 2021/04/24 23:36:59 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: spi.c,v 1.18 2021/05/16 08:48:20 mlelstv Exp $"); #include "locators.h" @@ -70,6 +70,7 @@ struct spi_softc { struct spi_handle *sc_slaves; kmutex_t sc_lock; kcondvar_t sc_cv; + kmutex_t sc_dev_lock; int sc_flags; #define SPIC_BUSY 1 }; @@ -90,7 +91,7 @@ const struct cdevsw spi_cdevsw = { .d_mmap = nommap, .d_kqfilter = nokqfilter, .d_discard = nodiscard, - .d_flag = D_OTHER + .d_flag = D_OTHER | D_MPSAFE }; /* @@ -287,6 +288,7 @@ spi_attach(device_t parent, device_t sel aprint_naive(": SPI bus\n"); aprint_normal(": SPI bus\n"); + mutex_init(>sc_dev_lock, MUTEX_DEFAULT, IPL_NONE); mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_VM); cv_init(>sc_cv, "spictl"); @@ -350,6 +352,8 @@ spi_ioctl(dev_t dev, u_long cmd, void *d if (sc == NULL) return ENXIO; + mutex_enter(>sc_dev_lock); + switch (cmd) { case SPI_IOCTL_CONFIGURE: sic = (spi_ioctl_configure_t *)data; @@ -408,6 +412,8 @@ spi_ioctl(dev_t dev, u_long cmd, void *d break; } + mutex_exit(>sc_dev_lock); + return error; }
CVS commit: src/sys/dev/spi
Module Name:src Committed By: mlelstv Date: Sun May 16 08:48:20 UTC 2021 Modified Files: src/sys/dev/spi: spi.c Log Message: Protect ioctl and declare MPSAFE. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/dev/spi/spi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: mlelstv Date: Sun May 16 08:46:38 UTC 2021 Modified Files: src/sys/dev/wscons: wsdisplay_vcons.c Log Message: Try to guess attributes better. To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/sys/dev/wscons/wsdisplay_vcons.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: mlelstv Date: Sun May 16 08:46:38 UTC 2021 Modified Files: src/sys/dev/wscons: wsdisplay_vcons.c Log Message: Try to guess attributes better. To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/sys/dev/wscons/wsdisplay_vcons.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_vcons.c diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.52 src/sys/dev/wscons/wsdisplay_vcons.c:1.53 --- src/sys/dev/wscons/wsdisplay_vcons.c:1.52 Sun May 16 08:44:26 2021 +++ src/sys/dev/wscons/wsdisplay_vcons.c Sun May 16 08:46:38 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vcons.c,v 1.52 2021/05/16 08:44:26 mlelstv Exp $ */ +/* $NetBSD: wsdisplay_vcons.c,v 1.53 2021/05/16 08:46:38 mlelstv Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.52 2021/05/16 08:44:26 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.53 2021/05/16 08:46:38 mlelstv Exp $"); #include #include @@ -1404,6 +1404,7 @@ vcons_getwschar(struct vcons_screen *scr int offset; long attr; struct rasops_info *ri; + int fg, bg, ul; KASSERT(scr != NULL && wsc != NULL); @@ -1433,18 +1434,38 @@ vcons_getwschar(struct vcons_screen *scr wsc->letter = scr->scr_chars[offset]; attr = scr->scr_attrs[offset]; +#ifdef VCONS_DEBUG + printf("vcons_getwschar: %d, %d, %x, %lx\n", wsc->row, + wsc->col, wsc->letter, attr); +#endif + /* * this is ugly. We need to break up an attribute into colours and * flags but there's no rasops method to do that so we must rely on * the 'canonical' encoding. */ -#ifdef VCONS_DEBUG - printf("vcons_getwschar: %d, %d, %x, %lx\n", wsc->row, - wsc->col, wsc->letter, attr); -#endif - wsc->foreground = (attr >> 24) & 0xff; - wsc->background = (attr >> 16) & 0xff; - wsc->flags = attr & 0xff; + + /* only fetches underline attribute */ + /* rasops_unpack_attr(attr, , , ); */ + fg = (attr >> 24) & 0xf; + bg = (attr >> 16) & 0xf; + ul = (attr & 1); + + wsc->foreground = fg; + wsc->background = bg; + + /* clear trashed bits and restore underline flag */ + attr &= ~(WSATTR_HILIT | WSATTR_BLINK | WSATTR_UNDERLINE); + if (ul) + attr |= WSATTR_UNDERLINE; + + /* restore highlight boost */ + if (attr & WSATTR_HILIT) + if (wsc->foreground >= 8) + wsc->foreground -= 8; + + /* we always use colors, even when not stored */ + attr |= WSATTR_WSCOLORS; return 0; }
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: mlelstv Date: Sun May 16 08:44:26 UTC 2021 Modified Files: src/sys/dev/wscons: wsdisplay_vcons.c Log Message: No need to check cell count. To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/sys/dev/wscons/wsdisplay_vcons.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/wscons/wsdisplay_vcons.c diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.51 src/sys/dev/wscons/wsdisplay_vcons.c:1.52 --- src/sys/dev/wscons/wsdisplay_vcons.c:1.51 Thu Jan 28 17:40:00 2021 +++ src/sys/dev/wscons/wsdisplay_vcons.c Sun May 16 08:44:26 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: wsdisplay_vcons.c,v 1.51 2021/01/28 17:40:00 macallan Exp $ */ +/* $NetBSD: wsdisplay_vcons.c,v 1.52 2021/05/16 08:44:26 mlelstv Exp $ */ /*- * Copyright (c) 2005, 2006 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.51 2021/01/28 17:40:00 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.52 2021/05/16 08:44:26 mlelstv Exp $"); #include #include @@ -1630,9 +1630,6 @@ vcons_invalidate_cache(struct vcons_data { int i; - if (vd->cells == 0) - return; - for (i = 0; i < vd->cells; i++) { vd->chars[i] = -1; vd->attrs[i] = -1;
CVS commit: src/sys/dev/wscons
Module Name:src Committed By: mlelstv Date: Sun May 16 08:44:26 UTC 2021 Modified Files: src/sys/dev/wscons: wsdisplay_vcons.c Log Message: No need to check cell count. To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/sys/dev/wscons/wsdisplay_vcons.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: Problem reports for version control systems
b...@update.uu.se (Johnny Billquist) writes: >And as a "fun" fact. On my 4000/90, it takes about 3h after I start a >cvs update until I actually start having any network traffic... A SCSI SSD could help. :)
Re: xhci "device problem, disabling port 5"
rhia...@falu.nl (Rhialto) writes: >> sudo drvctl -r -a usbdevif uhub1 >>=20 >> should work. >It works in the sense that it doesn't give any error. But it has no >noticable effect either, unfortunately. No messages printed on the >console, visible via dmesg or /var/log/messages. It does not clear the error condition nor re-enable a port. I'm not sure if you can recover from that condition except by a reboot.
Re: xhci "device problem, disabling port 5"
rhia...@falu.nl (Rhialto) writes: >hexander$ sudo drvctl -r uhub1 >drvctl: DRVRESCANBUS: Invalid argument A bus can have the notion of an "interface attribute" that you must pass. uhub knows about "usbifif" for network interfaces and "usbdevif" for other devices like umass. sudo drvctl -r -a usbdevif uhub1 should work.
Re: GCC 10 available for testing etc. in -current.
ll...@must-have-coffee.gen.nz (Lloyd Parkes) writes: >On 17/04/21 6:30 pm, Lloyd Parkes wrote: >> I am using the Mercurial repository at https://anonhg.NetBSD.org/src >> for fetching the source code because it's nice and quick >I've been running CVS for more than two hours now, and it has terminated >with a broken connection 10 (make that 11) times so far. The funny thing is that it works the opposite way for me. CVS checkout works without problems and Mercurial checkouts almost always time out or aren't succesful. Should tell you that the software is only a small part of the problem.
CVS commit: src/share/mk
Module Name:src Committed By: mlelstv Date: Sat Apr 17 09:39:33 UTC 2021 Modified Files: src/share/mk: bsd.own.mk Log Message: Use GCC10 for all amd64 including XEN kernels. To generate a diff of this commit: cvs rdiff -u -r1.1240 -r1.1241 src/share/mk/bsd.own.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/mk/bsd.own.mk diff -u src/share/mk/bsd.own.mk:1.1240 src/share/mk/bsd.own.mk:1.1241 --- src/share/mk/bsd.own.mk:1.1240 Sat Apr 17 04:07:16 2021 +++ src/share/mk/bsd.own.mk Sat Apr 17 09:39:33 2021 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.own.mk,v 1.1240 2021/04/17 04:07:16 mrg Exp $ +# $NetBSD: bsd.own.mk,v 1.1241 2021/04/17 09:39:33 mlelstv Exp $ # This needs to be before bsd.init.mk .if defined(BSD_MK_COMPAT_FILE) @@ -64,7 +64,7 @@ TOOLCHAIN_MISSING?= no # What GCC is used? # .if ${MACHINE} == "alpha" || \ -${MACHINE} == "amd64" || \ +${MACHINE_ARCH} == "x86_64" || \ ${MACHINE} == "ia64" || \ ${MACHINE} == "sparc" || \ ${MACHINE} == "sparc64" || \
CVS commit: src/share/mk
Module Name:src Committed By: mlelstv Date: Sat Apr 17 09:39:33 UTC 2021 Modified Files: src/share/mk: bsd.own.mk Log Message: Use GCC10 for all amd64 including XEN kernels. To generate a diff of this commit: cvs rdiff -u -r1.1240 -r1.1241 src/share/mk/bsd.own.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: Resize window size
On Wed, Apr 14, 2021 at 08:57:29PM +0200, Rhialto wrote: > On Wed 14 Apr 2021 at 17:38:05 +0200, Michael van Elst wrote: > > The window height calculation in add_window.c differs from those > > done in functions_win_moveresize.c and win_resize.c. Aligning > > the code in add_window.c like: > > That is from 4.0.3 I guess. I just see that there is a new branch in the > NetBSD repository; you're importing the 4.0.3 release? I like it! Yes, we imported 4.0.3. But the issue existed before. Greetings, -- Michael van Elst Internet: mlel...@serpens.de "A potential Snark may lurk in every tree."
CVS commit: src/sys/compat/netbsd32
Module Name:src Committed By: mlelstv Date: Wed Apr 14 16:26:23 UTC 2021 Modified Files: src/sys/compat/netbsd32: netbsd32_ioctl.c netbsd32_ioctl.h Log Message: Add DIOCGDISKINFO compat. To generate a diff of this commit: cvs rdiff -u -r1.118 -r1.119 src/sys/compat/netbsd32/netbsd32_ioctl.c cvs rdiff -u -r1.77 -r1.78 src/sys/compat/netbsd32/netbsd32_ioctl.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/netbsd32/netbsd32_ioctl.c diff -u src/sys/compat/netbsd32/netbsd32_ioctl.c:1.118 src/sys/compat/netbsd32/netbsd32_ioctl.c:1.119 --- src/sys/compat/netbsd32/netbsd32_ioctl.c:1.118 Sun Jan 17 10:50:01 2021 +++ src/sys/compat/netbsd32/netbsd32_ioctl.c Wed Apr 14 16:26:23 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_ioctl.c,v 1.118 2021/01/17 10:50:01 simonb Exp $ */ +/* $NetBSD: netbsd32_ioctl.c,v 1.119 2021/04/14 16:26:23 mlelstv Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.118 2021/01/17 10:50:01 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.119 2021/04/14 16:26:23 mlelstv Exp $"); #if defined(_KERNEL_OPT) #include "opt_ntp.h" @@ -1693,6 +1693,8 @@ netbsd32_ioctl(struct lwp *l, IOCTL_STRUCT_CONV_TO(DIOCGSTRATEGY, disk_strategy); case DIOCSSTRATEGY32: IOCTL_STRUCT_CONV_TO(DIOCSSTRATEGY, disk_strategy); + case DIOCGDISKINFO32: + IOCTL_STRUCT_CONV_TO(DIOCGDISKINFO, plistref); case DIOCLWEDGES32: IOCTL_STRUCT_CONV_TO(DIOCLWEDGES, dkwedge_list); Index: src/sys/compat/netbsd32/netbsd32_ioctl.h diff -u src/sys/compat/netbsd32/netbsd32_ioctl.h:1.77 src/sys/compat/netbsd32/netbsd32_ioctl.h:1.78 --- src/sys/compat/netbsd32/netbsd32_ioctl.h:1.77 Sun Jan 17 10:50:01 2021 +++ src/sys/compat/netbsd32/netbsd32_ioctl.h Wed Apr 14 16:26:23 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_ioctl.h,v 1.77 2021/01/17 10:50:01 simonb Exp $ */ +/* $NetBSD: netbsd32_ioctl.h,v 1.78 2021/04/14 16:26:23 mlelstv Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -672,6 +672,7 @@ struct netbsd32_disk_strategy { #define DIOCGSTRATEGY32 _IOR('d', 125, struct netbsd32_disk_strategy) #define DIOCSSTRATEGY32 _IOW('d', 126, struct netbsd32_disk_strategy) +#define DIOCGDISKINFO32 _IOR('d', 127, struct netbsd32_plistref) /* from */ struct netbsd32_lsenable {
CVS commit: src/sys/compat/netbsd32
Module Name:src Committed By: mlelstv Date: Wed Apr 14 16:26:23 UTC 2021 Modified Files: src/sys/compat/netbsd32: netbsd32_ioctl.c netbsd32_ioctl.h Log Message: Add DIOCGDISKINFO compat. To generate a diff of this commit: cvs rdiff -u -r1.118 -r1.119 src/sys/compat/netbsd32/netbsd32_ioctl.c cvs rdiff -u -r1.77 -r1.78 src/sys/compat/netbsd32/netbsd32_ioctl.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Resize window size
Hello, (c)twm opens a small window showing title and geometry when placing a window, moving or resizing it. I noticed that the first case displays the text truncated at the bottom when using a larger ResizeFont like: ResizeFont "-misc-fixed-medium-r-*-*-*-200-*-*-*-*-iso10646-1" The Resize window is sized correctly for the move and resize case. The window height calculation in add_window.c differs from those done in functions_win_moveresize.c and win_resize.c. Aligning the code in add_window.c like: Index: add_window.c === RCS file: /cvsroot/xsrc/external/mit/ctwm/dist/add_window.c,v retrieving revision 1.3 retrieving revision 1.4 diff -p -u -r1.3 -r1.4 --- add_window.c11 Apr 2021 10:11:57 - 1.3 +++ add_window.c12 Apr 2021 06:42:31 - 1.4 @@ -1000,7 +1000,7 @@ AddWindow(Window w, AWType wtype, IconMg tmp_win->name, namelen, _rect, _rect); width = SIZE_HINDENT + ink_rect.width; - height = logical_rect.height + SIZE_VINDENT * 2; + height = Scr->SizeFont.height + SIZE_VINDENT * 2; XmbTextExtents(Scr->SizeFont.font_set, ": ", 2, NULL, _rect); fixes the problem. logical_rect.height is only the height of the ":" string, which isn't tall enough to display arbitrary characters. I don't know if or how you accept patches, but if you think this is correct, feel free to use it. Greetings, -- Michael van Elst Internet: mlel...@serpens.de "A potential Snark may lurk in every tree."
Re: NetBSD 9.1 amd64 base X11: hypersensitive touchpad
mayur...@acm.org (Mayuresh) writes: >pms0: synaptics_probe: Not synaptics. >It's not synaptics, but in an older log that I shared Linux did treat it >as so. You could replace the pms_synaptics_probe_init() function with something that just sets the capabilities flags that you assume to be right. If you do, build the kernel with PMSDEBUG option to get the protocol dumped to the console. But I doubt it will work.
Re: NetBSD 9.1 amd64 base X11: hypersensitive touchpad
mayur...@acm.org (Mayuresh) writes: >Seems so now. I have posted a link to my 2017 post where Linux was also >using synaptics for the same device and it was working fine. So worth a >try if it works even partly (+ whatever we can achieve with sysctl option >tuning). I'm not sure if that was really the same device. It sounds more like Focaltech producing devices that are Synaptics compatible and devices that are not. It is even possible that this depends on some device firmware. Since we don't upload any firmware, that would then be a matter of the BIOS/UEFI version. Lots of things that may be responsible for the failure.
CVS commit: xsrc/external/mit/ctwm/dist
Module Name:xsrc Committed By: mlelstv Date: Mon Apr 12 06:42:31 UTC 2021 Modified Files: xsrc/external/mit/ctwm/dist: add_window.c Log Message: Reapply font calculation fix. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 xsrc/external/mit/ctwm/dist/add_window.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: xsrc/external/mit/ctwm/dist
Module Name:xsrc Committed By: mlelstv Date: Mon Apr 12 06:42:31 UTC 2021 Modified Files: xsrc/external/mit/ctwm/dist: add_window.c Log Message: Reapply font calculation fix. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 xsrc/external/mit/ctwm/dist/add_window.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: xsrc/external/mit/ctwm/dist/add_window.c diff -u xsrc/external/mit/ctwm/dist/add_window.c:1.3 xsrc/external/mit/ctwm/dist/add_window.c:1.4 --- xsrc/external/mit/ctwm/dist/add_window.c:1.3 Sun Apr 11 10:11:57 2021 +++ xsrc/external/mit/ctwm/dist/add_window.c Mon Apr 12 06:42:31 2021 @@ -1000,7 +1000,7 @@ AddWindow(Window w, AWType wtype, IconMg tmp_win->name, namelen, _rect, _rect); width = SIZE_HINDENT + ink_rect.width; -height = logical_rect.height + SIZE_VINDENT * 2; +height = Scr->SizeFont.height + SIZE_VINDENT * 2; XmbTextExtents(Scr->SizeFont.font_set, ": ", 2, NULL, _rect);
Re: NetBSD 9.1 amd64 base X11: hypersensitive touchpad
mayur...@acm.org (Mayuresh) writes: >On Mon, Apr 12, 2021 at 05:16:37AM -0000, Michael van Elst wrote: >> >options PMS_SYNAPTICS_TOUCHPAD # Enable support for Synaptics Touchpads >> >> It's a compile-time option for the pms driver to include code that >> handles Synaptics Touchpads. >So I can assume synaptics support is compiled in. So why doesn't sysctl -a >show the synaptics options mentioned in man pms? Is there any alternative >way to cross check whether option is compiled into the running kernel? A kernel can have the config embedded, and 'config -x' will dump that config. config -x | grep SYNAP options PMS_SYNAPTICS_TOUCHPAD # Enable support for Synaptics Touchpads ident will extract compiled-in RCS/CVS tags from a binary. ident /netbsd | grep synap $NetBSD: synaptics.c,v 1.70 2020/10/01 17:13:19 nia Exp $ nm will reveal linker symbols nm /netbsd | grep synap | grep T 8042a04c T pms_synaptics_enable 80428d7a T pms_synaptics_probe_init 8042a18c T pms_synaptics_resume The sysctl nodes however are only created if the driver actually finds a synaptics touchpad. You can boot a kernel with '-x' option to enable debug messages. A failed synaptics detection then should print: pms0: synaptics_probe: Not synaptics A successful synaptics detection prints (also without debug) e.g.: pms0: Synaptics touchpad version 7.2 But if further initialization goes wrong you also get pms0: synaptics_probe: Failed to query capabilities. then you also do not get the sysctl nodes. You can see how it works in the pms_synaptics_probe_init() function. My guess is that the Focaltech touchpad which isn't a Synaptics touchpad is not compatible enough to be treated like one. Google returns lots of hits of Windows and Linux users that have a similar issue (i.e. Focaltech not being Synaptics compatible so that Synaptics tools and drivers don't work). Linux has a dedicated Focaltech mouse/touchpad driver. It's possible that this reveals enough information to add support to our mouse driver just like we support devices from Synaptics, Elan and ALPS. Greetings,
Re: NetBSD 9.1 amd64 base X11: hypersensitive touchpad
mayur...@acm.org (Mayuresh) writes: >On Sun, Apr 11, 2021 at 08:15:03PM +0200, Martin Husemann wrote: >> grep '^pms' /var/run/dmesg.boot >pms0 at pckbc2 (aux slot) >wsmouse0 at pms0 mux 0 >But the following line in the kernel config is enabled. How is it supposed >to play a role? The name Synaptics comes only on 'options' line and not >like a device line (e.g. like 'wsmouse*at pms? mux 0'). >options PMS_SYNAPTICS_TOUCHPAD # Enable support for Synaptics Touchpads It's a compile-time option for the pms driver to include code that handles Synaptics Touchpads. There is: defflag opt_pms.h PMS_SYNAPTICS_TOUCHPAD defflag opt_pms.h PMS_ELANTECH_TOUCHPAD defflag opt_pms.h PMS_ALPS_TOUCHPAD and filedev/pckbport/synaptics.cpms & pms_synaptics_touchpad filedev/pckbport/elantech.c pms & pms_elantech_touchpad filedev/pckbport/alps.c pms & pms_alps_touchpad in the included files.pckbport config file. The upper case defflags are used as lower case condition names to optionally include source files. opt_pms.h is created by the config program and includes definitions for the flags that are enabled by the option statement. E.g. #define PMS_SYNAPTICS_TOUCHPAD 1 #ifdef _LOCORE .ifndef _KERNEL_OPT_PMS_SYNAPTICS_TOUCHPAD .global _KERNEL_OPT_PMS_SYNAPTICS_TOUCHPAD .equiv _KERNEL_OPT_PMS_SYNAPTICS_TOUCHPAD,0x1 .endif #else __asm(" .ifndef _KERNEL_OPT_PMS_SYNAPTICS_TOUCHPAD\n .global _KERNEL_OPT_PMS_SYNAPTICS_TOUCHPAD\n .equiv _KERNEL_OPT_PMS_SYNAPTICS_TOUCHPAD,0x1\n .endif"); #endif C code can just use the macro PMS_SYNAPTICS_TOUCHPAD, assembler code can evaluate the global symbol _KERNEL_OPT_PMS_SYNAPTICS_TOUCHPAD.
Re: one remaining mystery about the FreeBSD domU failure on NetBSD XEN3_DOM0
wo...@planix.ca ("Greg A. Woods") writes: >system was suffering the effects of accessing the corrupted filesystem I >was experimenting with. Note the SIGSEGV's from processes apparently >after the kernel has gone into its halt-spin loop (this is the first >time I've seen this particular misbehaviour): >The operating system has halted. >Please press any key to reboot. >pid 412 (syslogd), jid 0, uid 0: exited on signal 11 >pid 343 (devd), jid 0, uid 0: exited on signal 11 This looks like some processes haven't been killed succesfully (probably hanging in disk-wait) and when they fail to fault in pages, the process gets a signal 11.
Re: one remaining mystery about the FreeBSD domU failure on NetBSD XEN3_DOM0
wo...@planix.ca ("Greg A. Woods") writes: >SALVAGE? [yn] ^Cada0: disk error cmd=write 8145-8152 status: fffe That seems to be a message from the disk driver: /* Operation not supported (only happens on barrier writes). */ #define BLKIF_RSP_EOPNOTSUPP -2 If I understand that correctly, a NetBSD Dom0 will return this status for writing to a read-only backend or for issuing a cache sync to a disk that doesn't support this operation. The latter case should log a message on Dom0 about DIOCCACHESYNC failing. >So, what could be different about how fsck reads v.s. the kernel itself? With NetBSD the major difference is how kernel and userland address disk blocks. The original BSD code would address disks in sector size units. This is still true for userland, the NetBSD kernel however was changed to address blocks in DEV_BSIZE units. AFAIK FreeBSD stayed with using sector size units. But if you have sectors of DEV_BSIZE like here there is no difference and no conflict. >It seems NetBSD can make sense of the BSD label inside the FreeBSD >mini-memstick.img file, e.g. when accessed through vnd(4), No, it cannot. You see a fictious label generated from the MBR. The FreeBSD-12.2-RELEASE-amd64-mini-memstick.img I just fetched has two MBR partitions: Partition table: 0: EFI system partition (sysid 239) start 1, size 1600 (1 MB, Cyls 0/0/2-0/50/1) 1: FreeBSD or 386BSD or old NetBSD (sysid 165) start 1601, size 789520 (386 MB, Cyls 0/50/2-386/18/17), Active Making our disklabel program read the FreeBSD disklabel was a bit tricky, there is a bug that makes it segfault, but: type: unknown disk: label: flags: bytes/sector: 512 sectors/track: 1 tracks/cylinder: 1 sectors/cylinder: 1 cylinders: 789520 total sectors: 789520 rpm: 3600 interleave: 0 trackskew: 0 cylinderskew: 0 headswitch: 0 # microseconds track-to-track seek: 0 # microseconds drivedata: 0 8 partitions: #sizeoffset fstype [fsize bsize cpg/sgs] a:78950416 4.2BSD 0 0 0 # (Cyl. 16 - 789519) c:789520 0 unused 0 0# (Cyl. 0 - 789519) Apparently the MBR partition 1 starting at sector 1601 is a disk image itself and the disklabel is in sector 1 of that image. Adding a wedge to access the partition at offset 16 (+1601) gives: # dkctl vnd0 addwedge freebsd 1617 789504 ffs dk6 created successfully. # file -s /dev/rdk6 /dev/rdk6: Unix Fast File system [v2] (little-endian) last mounted on , volume name FreeBSD_Install, last written at Fri Oct 23 08:04:24 2020, clean flag 1, readonly flag 0, number of blocks 98688, number of data blocks 97871, number of cylinder groups 1, block size 32768, fragment size 4096, average file size 16384, average number of files in dir 64, pending blocks to free 0, pending inodes to free 0, system-wide uuid 0, minimum percentage of free blocks 8, TIME optimization # fsck -f -n /dev/rdk6 ** /dev/rdk6 (NO WRITE) ** File system is already clean ** Last Mounted on ** Phase 1 - Check Blocks and Sizes ** Phase 2 - Check Pathnames ** Phase 3 - Check Connectivity ** Phase 4 - Check Reference Counts ** Phase 5 - Check Cyl groups 12129 files, 92127 used, 5744 free (128 frags, 702 blocks, 0.1% fragmentation) NetBSD can even mount that partition: # ls /mnt COPYRIGHT HARDWARE.TXT RELNOTES.TXT docbook.cssmedia rescue usr ERRATA.HTMLREADME.HTMLbinetcmntroot var ERRATA.TXT README.TXT boot libnetsbin HARDWARE.HTML RELNOTES.HTML devlibexecproc tmp
Re: I think I've found why Xen domUs can't mount some file-backed disk images! (vnd(4) hides labels!)
k...@munnari.oz.au (Robert Elz) writes: >Date:Sun, 11 Apr 2021 18:14:44 - (UTC) >From:mlel...@serpens.de (Michael van Elst) >Message-ID: > | + spb = vnd->sc_geom.vng_secsize / DEV_BSIZE; >Do we know for sure here that vng_secsize >= DEV_BSIZE ? >When I first used unix (long long ago) the drives I used had a >sector size of 256 bytes (not DEC hardware.)(Floppies were >128 bytes if I recall correctly). >It would not be good if spb became 0 there. I have also seen winchester disks with 128 byte sectors, ESDI disks with 576 byte sectors and CD-ROM XA media uses 2352 byte sectors. vng_secsize is either initialized to DEV_BSIZE or the value is validated with DK_DEV_BSIZE_OK(): #define DK_DEV_BSIZE_OK(b) \ ((b) >= DEV_BSIZE && ((b) & ((b) - 1)) == 0 && (b) <= MAXPHYS) So dividing by DEV_BSIZE is ok.
Re: I think I've found why Xen domUs can't mount some file-backed disk images! (vnd(4) hides labels!)
wo...@planix.ca ("Greg A. Woods") writes: > } else if (vnd->sc_size >= (32 * 64)) { > /* >- * Size must be at least 2048 DEV_BSIZE blocks >- * (1M) in order to use this geometry. >+ * The file's size must be at least 2048 DEV_BSIZE >+ * blocks (1M) in order to use this (fake) geometry. >+ * >+ * XXX why ever use this arbitrary fake setup instead >of the next A cylinder size of 1 (sector) results in large cylinder numbers that may exceed some limit or make things inefficient. >+ /* >+ * n.b.: this will round the disk's size up to an even cylinder >+ * amount, but (if it is writeable) writing into the partly >+ * empty cylinder, i.e. past current end of the file, will >+ * simply extend the file >+ */ The side effect of resizing the image might a) fail, b) be unexpected. If you really want to write that sector, then size the image accordingly.
CVS commit: src/sys/dev
Module Name:src Committed By: mlelstv Date: Sun Apr 11 18:18:39 UTC 2021 Modified Files: src/sys/dev: vnd.c Log Message: Provide a default preferred I/O size. To generate a diff of this commit: cvs rdiff -u -r1.279 -r1.280 src/sys/dev/vnd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/vnd.c diff -u src/sys/dev/vnd.c:1.279 src/sys/dev/vnd.c:1.280 --- src/sys/dev/vnd.c:1.279 Sun Apr 11 18:17:22 2021 +++ src/sys/dev/vnd.c Sun Apr 11 18:18:39 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: vnd.c,v 1.279 2021/04/11 18:17:22 mlelstv Exp $ */ +/* $NetBSD: vnd.c,v 1.280 2021/04/11 18:18:39 mlelstv Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008, 2020 The NetBSD Foundation, Inc. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.279 2021/04/11 18:17:22 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.280 2021/04/11 18:18:39 mlelstv Exp $"); #if defined(_KERNEL_OPT) #include "opt_vnd.h" @@ -1433,6 +1433,10 @@ vndioctl(dev_t dev, u_long cmd, void *da if (error) vnd->sc_iosize = vnd->sc_vp->v_mount->mnt_stat.f_frsize; + /* Default I/O size to DEV_BSIZE */ + if (vnd->sc_iosize == 0) + vnd->sc_iosize = DEV_BSIZE; + /* * Use pseudo-geometry specified. If none was provided, * use "standard" Adaptec fictitious geometry.
CVS commit: src/sys/dev
Module Name:src Committed By: mlelstv Date: Sun Apr 11 18:18:39 UTC 2021 Modified Files: src/sys/dev: vnd.c Log Message: Provide a default preferred I/O size. To generate a diff of this commit: cvs rdiff -u -r1.279 -r1.280 src/sys/dev/vnd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev
Module Name:src Committed By: mlelstv Date: Sun Apr 11 18:17:22 UTC 2021 Modified Files: src/sys/dev: vnd.c Log Message: Don't truncate disk size to full cylinders. To generate a diff of this commit: cvs rdiff -u -r1.278 -r1.279 src/sys/dev/vnd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev
Module Name:src Committed By: mlelstv Date: Sun Apr 11 18:17:22 UTC 2021 Modified Files: src/sys/dev: vnd.c Log Message: Don't truncate disk size to full cylinders. To generate a diff of this commit: cvs rdiff -u -r1.278 -r1.279 src/sys/dev/vnd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/vnd.c diff -u src/sys/dev/vnd.c:1.278 src/sys/dev/vnd.c:1.279 --- src/sys/dev/vnd.c:1.278 Mon Jan 4 16:17:26 2021 +++ src/sys/dev/vnd.c Sun Apr 11 18:17:22 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: vnd.c,v 1.278 2021/01/04 16:17:26 mlelstv Exp $ */ +/* $NetBSD: vnd.c,v 1.279 2021/04/11 18:17:22 mlelstv Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008, 2020 The NetBSD Foundation, Inc. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.278 2021/01/04 16:17:26 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.279 2021/04/11 18:17:22 mlelstv Exp $"); #if defined(_KERNEL_OPT) #include "opt_vnd.h" @@ -2104,11 +2104,12 @@ static void vnd_set_geometry(struct vnd_softc *vnd) { struct disk_geom *dg = >sc_dkdev.dk_geom; + unsigned spb; memset(dg, 0, sizeof(*dg)); - dg->dg_secperunit = (int64_t)vnd->sc_geom.vng_nsectors * - vnd->sc_geom.vng_ntracks * vnd->sc_geom.vng_ncylinders; + spb = vnd->sc_geom.vng_secsize / DEV_BSIZE; + dg->dg_secperunit = vnd->sc_size / spb; dg->dg_secsize = vnd->sc_geom.vng_secsize; dg->dg_nsectors = vnd->sc_geom.vng_nsectors; dg->dg_ntracks = vnd->sc_geom.vng_ntracks;
Re: I think I've found why Xen domUs can't mount some file-backed disk images! (vnd(4) hides labels!)
wo...@planix.ca ("Greg A. Woods") writes: > dg->dg_secperunit = > ((vnd->sc_size * DEV_BSIZE) + DEV_BSIZE - 1) / > vnd->sc_geom.vng_secsize; @@ -2104,11 +2108,12 @@ static void vnd_set_geometry(struct vnd_softc *vnd) { struct disk_geom *dg = >sc_dkdev.dk_geom; + unsigned spb; memset(dg, 0, sizeof(*dg)); - dg->dg_secperunit = (int64_t)vnd->sc_geom.vng_nsectors * - vnd->sc_geom.vng_ntracks * vnd->sc_geom.vng_ncylinders; + spb = vnd->sc_geom.vng_secsize / DEV_BSIZE; + dg->dg_secperunit = vnd->sc_size / spb; dg->dg_secsize = vnd->sc_geom.vng_secsize; dg->dg_nsectors = vnd->sc_geom.vng_nsectors; dg->dg_ntracks = vnd->sc_geom.vng_ntracks;
Re: I think I've found why Xen domUs can't mount some file-backed disk images! (vnd(4) hides labels!)
jaromir.dole...@gmail.com (=?UTF-8?B?SmFyb23DrXIgRG9sZcSNZWs=?=) writes: >Le dim. 11 avr. 2021 =C3=A0 17:51, Robert Elz a =C3=A9c= >rit : >> >> Date:Sun, 11 Apr 2021 14:25:40 - (UTC) >> From:mlel...@serpens.de (Michael van Elst) >> Message-ID: >> >> | + dg->dg_secperunit =3D vnd->sc_size / DEV_BSIZE; >> >> While it shouldn't make any difference for any properly created image >> file, make it be >> >> (vnd->sc_size + DEV_BSIZE - 1) / DEV_BSIZE; >> >> so that any trailing partial sector remains in the image. >I don't think it's a good idea to include the sector which can't be written= > to. It cannot be read either (in the default strategy mode) and writing to it in file mode would extend the file. Fortunately sc_size is already compute as number of DEV_BSIZE blocks, truncated from the byte length. I also hear people lamenting that the notion of disk sectors was a mistake and we should have never left the sea^Uthat disks should be byte-addressible (but not bit-addressable!).
Re: I think I've found why Xen domUs can't mount some file-backed disk images! (vnd(4) hides labels!)
k...@munnari.oz.au (Robert Elz) writes: >Date:Sun, 11 Apr 2021 14:25:40 - (UTC) >From:mlel...@serpens.de (Michael van Elst) >Message-ID: > | + dg->dg_secperunit = vnd->sc_size / DEV_BSIZE; >While it shouldn't make any difference for any properly created image >file, make it be > (vnd->sc_size + DEV_BSIZE - 1) / DEV_BSIZE; >so that any trailing partial sector remains in the image. The trailing partial sector is already ignored. Fortunately no disk image can even have a partial trailing sector and some magically implicit padding would have unexpected side effects. But the code also needs to be adjusted for different sector sizes.
Re: I think I've found why Xen domUs can't mount some file-backed disk images! (vnd(4) hides labels!)
bou...@antioche.eu.org (Manuel Bouyer) writes: >On Sun, Apr 11, 2021 at 01:28:46PM -0000, Michael van Elst wrote: >> bou...@antioche.eu.org (Manuel Bouyer) writes: >> >> >The size of the disk is indeed 790528 in the xenstore (and the dom0's >> >kernel message) but I don't know where this comes from. >> >> >The file is definitively 791121 sectors long: >> >> vnd computes a fake geometry based on 1MB cylinders. >Why does this trucates the total number of sectors of the vnd ? >there's no reason to do so. Seems to have been introduced with netbsd-7. This should fix it (untested): - dg->dg_secperunit = (int64_t)vnd->sc_geom.vng_nsectors * - vnd->sc_geom.vng_ntracks * vnd->sc_geom.vng_ncylinders; + dg->dg_secperunit = vnd->sc_size / DEV_BSIZE;
Re: I think I've found why Xen domUs can't mount some file-backed disk images! (vnd(4) hides labels!)
bou...@antioche.eu.org (Manuel Bouyer) writes: >The size of the disk is indeed 790528 in the xenstore (and the dom0's >kernel message) but I don't know where this comes from. >The file is definitively 791121 sectors long: vnd computes a fake geometry based on 1MB cylinders. 791121 truncated to full Megabytes is 790528 (772 MB). The easiest is probably to pad the file to 773 MB (791552 sectors).
Re: I think I've found why Xen domUs can't mount some file-backed disk images! (vnd(4) hides labels!)
wo...@planix.ca ("Greg A. Woods") writes: >I'm thinking (esp. given what I see from "od -c < /dev/rvnd0d") that >what's wrong is the vnd(4) driver is (also?) imposing some >mis-interpreted idea about the number of cylinders and heads or >something like that, especially given that "fdisk vnd0" is so totally >confused about what's in there. vnd produces a fake geometry based on 1MB cylinders or 512 byte cylinders if the image is smaller than 1MB. It doesn't handle "partial" cylinders if the image isn't a multiple of the cylinder size. But that doesn't confuse fdisk. You can also specify the exact geometry you want to use.
Re: cmake hang ... again
jo...@bec.de (Joerg Sonnenberger) writes: >On Tue, Apr 06, 2021 at 04:49:58PM -0000, Michael van Elst wrote: >> Otherwise I see several infinite loops, a python deadlock in the samba4 build >> and, new, the kdelibs4 build stalls for kfiltertest_automoc.cpp. >The samba4 thing can be avoided with MAKE_JOBS_SAFE=no. I don't fully >understand what happened with that and run out of steam debugging it. >kdelibs4 stalls sound like the wait list issue. Does gdb attach or >STOP/CONT help? Didn't help for kdelibs4.
Re: cmake hang ... again
bou...@antioche.eu.org (Manuel Bouyer) writes: >I see the same thing in bulk builds, with various kde packages. >When I asked I've been told that this was a known issue, but without fix ... There are several issues that hang builds. The cmake hang usually responds well to a SIGSTOP followed by a SIGCONT. Otherwise I see several infinite loops, a python deadlock in the samba4 build and, new, the kdelibs4 build stalls for kfiltertest_automoc.cpp.
Re: regarding the changes to kernel entropy gathering
h...@netbsd.org (Havard Eidnes) writes: >I also presented a workaround for this problem; if you are reasonably >certain that you actually have mixed in a sufficient number of bits of >sufficient quality into the randomness pool (see "rndctl -l -v"), you >can do Isn't that the same as before? Waiting some time and then assume things are good enough ? The difference is that previously it was done automatically based on some _estimate_ of entropy created by system activity and random physical processes (even based on thermal noise, that you consider worthy). And now someone has to manually do this in an obscure way and has no means to even guess about entropy. We can surely argue about whether this estimate is correct or precise and whether it is safe to use. Some people would decide that it's not good enough and _ignore entropy estimation_ as necessary, just like we ignored entropy estimation for network devices. In the current virtualized world I would even agree that it's necessary to ignore many of the estimates by default. We could also argue about finding other estimators, just like you would replace the PRNG if it doesn't meet some standard. But that's not the point. That choice was deliberately removed based on crystal clear arguments like being "unscientific" or "fabulated" or "a lie" or whatever other mockery words could be found. And that's why the thread ends here.
Re: regarding the changes to kernel entropy gathering
h...@uninett.no (Havard Eidnes) writes: >Well, if I'm not mistaken, the actual implementation was tested, >not just a theoretical study of the design. And, as I said, >thermal noise is one of the well-known physical systems which >provide actual entropy. That's probably why other sources of thermal noise are considered are confabulation.
Re: regarding the changes to kernel entropy gathering
jo...@bec.de (Joerg Sonnenberger) writes: >Part of the problem here is that most of the non-RNG data sources are >easily observable either from the local system (e.g. any malicious user) >or other VMs on the same machine (in case of a hypervisor) or local >machines on the same network (in case of network interrupts). That's the >real reason why their entropy is hard to estimate. It becomes even more >annoying with modern hardware features like interrupt moderation of >nics. They can make the timing of interrupts highly predicable. Must be a thing of the past, as we always ignored that information from NIC devices by default. No need to rip out the code that would allow it.
Re: how do I mount a read-only filesystem from the "root device" prompt?
wo...@planix.ca ("Greg A. Woods") writes: >Given the layers of devices and code involved, perhaps it might be >possible to just honour the original mode requested by the code opening >the first partition to mount a filesystem, and then to upgrade the vnode >to write mode if/when that mount is upgraded to write mode or another rw >mount is attempted on another partition on the same device? Someone would need to write code to "upgrade" vnodes. I doubt that's trivial. Fortunately it is not necessary. If the parent device is read-only, no "upgrade" will help to make it read-write. So you open read-write or fail back to read-only when necessary. An attempt to open a wedge read-write on a read-only opened parent device then has to fail. I'm testing a patch for that...
Re: how do I mount a read-only filesystem from the "root device" prompt?
wo...@planix.ca ("Greg A. Woods") writes: >So with Xen one can export a "disk" (disk, file, LVM partiion, etc.) >with "access=ro", and that is enforced. >However if one tries to mount such a disk in a domU as root, it fails. > root on dk1 > vfs_mountroot: can't open root device, error = 30 > cannot mount root, error = 30 The wedge code always opens the parent device read-write as it is only opened once for all wedges. I suggested to make it open read-only if it gets EROFS and to validate the open mode against what is possible in this state.