git: a9f6a79b2d6a - stable/13 - sddadone: 'error' gets assigned only errno codes, never MMC_ERR codes
The branch stable/13 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=a9f6a79b2d6a8f0ec7e63d8f1ae9876842c8678a commit a9f6a79b2d6a8f0ec7e63d8f1ae9876842c8678a Author: Andriy Gapon AuthorDate: 2021-07-09 14:28:40 + Commit: Andriy Gapon CommitDate: 2021-11-27 08:32:36 + sddadone: 'error' gets assigned only errno codes, never MMC_ERR codes (cherry picked from commit e17b58ecbcb644f76cceda4ca7ff08f7677b5dfd) --- sys/cam/mmc/mmc_da.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/cam/mmc/mmc_da.c b/sys/cam/mmc/mmc_da.c index 62066311aa93..22a467af2f5f 100644 --- a/sys/cam/mmc/mmc_da.c +++ b/sys/cam/mmc/mmc_da.c @@ -1935,7 +1935,7 @@ sddadone(struct cam_periph *periph, union ccb *done_ccb) /*reduction*/0, /*timeout*/0, /*getcount_only*/0); - error = 5; /* EIO */ + error = EIO; } else { if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) panic("REQ_CMP with QFRZN"); @@ -1956,7 +1956,7 @@ sddadone(struct cam_periph *periph, union ccb *done_ccb) softc->outstanding_cmds--; /* Complete partition switch */ softc->state = SDDA_STATE_NORMAL; - if (error != MMC_ERR_NONE) { + if (error != 0) { /* TODO: Unpause retune if accessing RPMB */ xpt_release_ccb(done_ccb); xpt_schedule(periph, CAM_PRIORITY_NORMAL);
git: 83f68b84c234 - stable/13 - ds1307: allow configuration via hints on FDT-based systems
The branch stable/13 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=83f68b84c2347bbe11c5266e98bfd0a44334f004 commit 83f68b84c2347bbe11c5266e98bfd0a44334f004 Author: Andriy Gapon AuthorDate: 2021-11-04 11:55:35 + Commit: Andriy Gapon CommitDate: 2021-11-27 08:44:16 + ds1307: allow configuration via hints on FDT-based systems On-board devices should be configured via the FDT and overlays. Hints are primarily useful for external and temporarily attached devices. Adding hints is much easier and faster than writing and compiling an overlay. (cherry picked from commit 27645265c4e49ad7eaa25847a280307acb138da8) --- sys/dev/iicbus/ds1307.c | 15 +-- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/sys/dev/iicbus/ds1307.c b/sys/dev/iicbus/ds1307.c index 7bab7e78c0d8..47f47bb07f5e 100644 --- a/sys/dev/iicbus/ds1307.c +++ b/sys/dev/iicbus/ds1307.c @@ -216,18 +216,13 @@ ds1307_probe(device_t dev) return (ENXIO); compat = ofw_bus_search_compatible(dev, ds1307_compat_data); - - if (compat->ocd_str == NULL) - return (ENXIO); - - device_set_desc(dev, (const char *)compat->ocd_data); - - return (BUS_PROBE_DEFAULT); -#else + if (compat->ocd_str != NULL) { + device_set_desc(dev, (const char *)compat->ocd_data); + return (BUS_PROBE_DEFAULT); + } +#endif device_set_desc(dev, "Maxim DS1307 RTC"); - return (BUS_PROBE_NOWILDCARD); -#endif } static int
git: f537b3056421 - stable/13 - icee: allow configuration via hints on FDT-based systems
The branch stable/13 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=f537b30564210708cea309de6e2ba54cf18e52b1 commit f537b30564210708cea309de6e2ba54cf18e52b1 Author: Andriy Gapon AuthorDate: 2021-11-04 11:56:22 + Commit: Andriy Gapon CommitDate: 2021-11-27 08:47:25 + icee: allow configuration via hints on FDT-based systems On-board devices should be configured via the FDT and overlays. Hints are primarily useful for external and temporarily attached devices. Adding hints is much easier and faster than writing and compiling an overlay. (cherry picked from commit 01e3492337cb48484e03be38340cc67ac5e30a5b) --- sys/dev/iicbus/icee.c | 64 +-- 1 file changed, 26 insertions(+), 38 deletions(-) diff --git a/sys/dev/iicbus/icee.c b/sys/dev/iicbus/icee.c index 19aff78bf45a..a658d73cb875 100644 --- a/sys/dev/iicbus/icee.c +++ b/sys/dev/iicbus/icee.c @@ -123,10 +123,10 @@ static struct cdevsw icee_cdevsw = .d_write = icee_write }; -#ifdef FDT static int icee_probe(device_t dev) { +#ifdef FDT struct eeprom_desc *d; if (!ofw_bus_status_okay(dev)) @@ -134,49 +134,42 @@ icee_probe(device_t dev) d = (struct eeprom_desc *) ofw_bus_search_compatible(dev, compat_data)->ocd_data; - if (d == NULL) - return (ENXIO); - - device_set_desc(dev, d->name); - return (BUS_PROBE_DEFAULT); -} - -static void -icee_init(struct icee_softc *sc) -{ - struct eeprom_desc *d; - - d = (struct eeprom_desc *) - ofw_bus_search_compatible(sc->dev, compat_data)->ocd_data; - if (d == NULL) - return; /* attach will see sc->size == 0 and return error */ - - sc->size = d->size; - sc->type = d->type; - sc->wr_sz = d->wr_sz; -} -#else /* !FDT */ -static int -icee_probe(device_t dev) -{ - + if (d != NULL) { + device_set_desc(dev, d->name); + return (BUS_PROBE_DEFAULT); + } +#endif device_set_desc(dev, "I2C EEPROM"); return (BUS_PROBE_NOWILDCARD); } -static void +static int icee_init(struct icee_softc *sc) { const char *dname; int dunit; +#ifdef FDT + struct eeprom_desc *d; + d = (struct eeprom_desc *) + ofw_bus_search_compatible(sc->dev, compat_data)->ocd_data; + if (d != NULL) { + sc->size = d->size; + sc->type = d->type; + sc->wr_sz = d->wr_sz; + return (0); + } +#endif dname = device_get_name(sc->dev); dunit = device_get_unit(sc->dev); - resource_int_value(dname, dunit, "size", &sc->size); - resource_int_value(dname, dunit, "type", &sc->type); - resource_int_value(dname, dunit, "wr_sz", &sc->wr_sz); + if (resource_int_value(dname, dunit, "type", &sc->type) != 0) + return (ENOENT); + if (resource_int_value(dname, dunit, "size", &sc->size) != 0) + return (ENOENT); + if (resource_int_value(dname, dunit, "wr_sz", &sc->wr_sz) != 0) + return (ENOENT); + return (0); } -#endif /* FDT */ static int icee_attach(device_t dev) @@ -187,13 +180,8 @@ icee_attach(device_t dev) sc->dev = dev; sc->addr = iicbus_get_addr(dev); - icee_init(sc); - if (sc->size == 0 || sc->type == 0 || sc->wr_sz == 0) { - device_printf(sc->dev, "Missing config data, " - "these cannot be zero: size %d type %d wr_sz %d\n", - sc->size, sc->type, sc->wr_sz); + if (icee_init(sc) != 0) return (EINVAL); - } if (bootverbose) device_printf(dev, "size: %d bytes, addressing: %d-bits\n", sc->size, sc->type);
git: 06f49eaf13bd - stable/12 - sddadone: 'error' gets assigned only errno codes, never MMC_ERR codes
The branch stable/12 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=06f49eaf13bdd9a0e5f4d8e260891dede592db12 commit 06f49eaf13bdd9a0e5f4d8e260891dede592db12 Author: Andriy Gapon AuthorDate: 2021-07-09 14:28:40 + Commit: Andriy Gapon CommitDate: 2021-11-27 08:39:19 + sddadone: 'error' gets assigned only errno codes, never MMC_ERR codes (cherry picked from commit e17b58ecbcb644f76cceda4ca7ff08f7677b5dfd) --- sys/cam/mmc/mmc_da.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/cam/mmc/mmc_da.c b/sys/cam/mmc/mmc_da.c index 2587cda115cc..96898e92cb81 100644 --- a/sys/cam/mmc/mmc_da.c +++ b/sys/cam/mmc/mmc_da.c @@ -1834,7 +1834,7 @@ sddadone(struct cam_periph *periph, union ccb *done_ccb) /*reduction*/0, /*timeout*/0, /*getcount_only*/0); - error = 5; /* EIO */ + error = EIO; } else { if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) panic("REQ_CMP with QFRZN"); @@ -1855,7 +1855,7 @@ sddadone(struct cam_periph *periph, union ccb *done_ccb) softc->outstanding_cmds--; /* Complete partition switch */ softc->state = SDDA_STATE_NORMAL; - if (error != MMC_ERR_NONE) { + if (error != 0) { /* TODO: Unpause retune if accessing RPMB */ xpt_release_ccb(done_ccb); xpt_schedule(periph, CAM_PRIORITY_NORMAL);
git: 45a19f61218b - stable/12 - ds1307: allow configuration via hints on FDT-based systems
The branch stable/12 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=45a19f61218b4072db9a327df5a7f176b6955163 commit 45a19f61218b4072db9a327df5a7f176b6955163 Author: Andriy Gapon AuthorDate: 2021-11-04 11:55:35 + Commit: Andriy Gapon CommitDate: 2021-11-27 08:46:31 + ds1307: allow configuration via hints on FDT-based systems On-board devices should be configured via the FDT and overlays. Hints are primarily useful for external and temporarily attached devices. Adding hints is much easier and faster than writing and compiling an overlay. (cherry picked from commit 27645265c4e49ad7eaa25847a280307acb138da8) --- sys/dev/iicbus/ds1307.c | 15 +-- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/sys/dev/iicbus/ds1307.c b/sys/dev/iicbus/ds1307.c index 7bab7e78c0d8..47f47bb07f5e 100644 --- a/sys/dev/iicbus/ds1307.c +++ b/sys/dev/iicbus/ds1307.c @@ -216,18 +216,13 @@ ds1307_probe(device_t dev) return (ENXIO); compat = ofw_bus_search_compatible(dev, ds1307_compat_data); - - if (compat->ocd_str == NULL) - return (ENXIO); - - device_set_desc(dev, (const char *)compat->ocd_data); - - return (BUS_PROBE_DEFAULT); -#else + if (compat->ocd_str != NULL) { + device_set_desc(dev, (const char *)compat->ocd_data); + return (BUS_PROBE_DEFAULT); + } +#endif device_set_desc(dev, "Maxim DS1307 RTC"); - return (BUS_PROBE_NOWILDCARD); -#endif } static int
git: ad5904ec5913 - stable/12 - icee: allow configuration via hints on FDT-based systems
The branch stable/12 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=ad5904ec59133b0ab47383b0868eca33cf17b61b commit ad5904ec59133b0ab47383b0868eca33cf17b61b Author: Andriy Gapon AuthorDate: 2021-11-04 11:56:22 + Commit: Andriy Gapon CommitDate: 2021-11-27 08:48:59 + icee: allow configuration via hints on FDT-based systems On-board devices should be configured via the FDT and overlays. Hints are primarily useful for external and temporarily attached devices. Adding hints is much easier and faster than writing and compiling an overlay. (cherry picked from commit 01e3492337cb48484e03be38340cc67ac5e30a5b) --- sys/dev/iicbus/icee.c | 64 +-- 1 file changed, 26 insertions(+), 38 deletions(-) diff --git a/sys/dev/iicbus/icee.c b/sys/dev/iicbus/icee.c index 0f6ab4d0700a..bc2bd7338d1a 100644 --- a/sys/dev/iicbus/icee.c +++ b/sys/dev/iicbus/icee.c @@ -128,10 +128,10 @@ static struct cdevsw icee_cdevsw = .d_write = icee_write }; -#ifdef FDT static int icee_probe(device_t dev) { +#ifdef FDT struct eeprom_desc *d; if (!ofw_bus_status_okay(dev)) @@ -139,49 +139,42 @@ icee_probe(device_t dev) d = (struct eeprom_desc *) ofw_bus_search_compatible(dev, compat_data)->ocd_data; - if (d == NULL) - return (ENXIO); - - device_set_desc(dev, d->name); - return (BUS_PROBE_DEFAULT); -} - -static void -icee_init(struct icee_softc *sc) -{ - struct eeprom_desc *d; - - d = (struct eeprom_desc *) - ofw_bus_search_compatible(sc->dev, compat_data)->ocd_data; - if (d == NULL) - return; /* attach will see sc->size == 0 and return error */ - - sc->size = d->size; - sc->type = d->type; - sc->wr_sz = d->wr_sz; -} -#else /* !FDT */ -static int -icee_probe(device_t dev) -{ - + if (d != NULL) { + device_set_desc(dev, d->name); + return (BUS_PROBE_DEFAULT); + } +#endif device_set_desc(dev, "I2C EEPROM"); return (BUS_PROBE_NOWILDCARD); } -static void +static int icee_init(struct icee_softc *sc) { const char *dname; int dunit; +#ifdef FDT + struct eeprom_desc *d; + d = (struct eeprom_desc *) + ofw_bus_search_compatible(sc->dev, compat_data)->ocd_data; + if (d != NULL) { + sc->size = d->size; + sc->type = d->type; + sc->wr_sz = d->wr_sz; + return (0); + } +#endif dname = device_get_name(sc->dev); dunit = device_get_unit(sc->dev); - resource_int_value(dname, dunit, "size", &sc->size); - resource_int_value(dname, dunit, "type", &sc->type); - resource_int_value(dname, dunit, "wr_sz", &sc->wr_sz); + if (resource_int_value(dname, dunit, "type", &sc->type) != 0) + return (ENOENT); + if (resource_int_value(dname, dunit, "size", &sc->size) != 0) + return (ENOENT); + if (resource_int_value(dname, dunit, "wr_sz", &sc->wr_sz) != 0) + return (ENOENT); + return (0); } -#endif /* FDT */ static int icee_attach(device_t dev) @@ -192,13 +185,8 @@ icee_attach(device_t dev) sc->dev = dev; sc->addr = iicbus_get_addr(dev); - icee_init(sc); - if (sc->size == 0 || sc->type == 0 || sc->wr_sz == 0) { - device_printf(sc->dev, "Missing config data, " - "these cannot be zero: size %d type %d wr_sz %d\n", - sc->size, sc->type, sc->wr_sz); + if (icee_init(sc) != 0) return (EINVAL); - } if (bootverbose) device_printf(dev, "size: %d bytes, addressing: %d-bits\n", sc->size, sc->type);
Re: git: 75412a521f60 - main - Hyper-V: vPCI: Prepopulate device bars
On Sat, Nov 27, 2021 at 06:55:54AM +, Wei Hu wrote: > The branch main has been updated by whu: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=75412a521f60d4b0393c730ffb284e7c6ff9d2de > > commit 75412a521f60d4b0393c730ffb284e7c6ff9d2de > Author: Wei Hu > AuthorDate: 2021-11-27 06:42:34 + > Commit: Wei Hu > CommitDate: 2021-11-27 06:42:34 + > > Hyper-V: vPCI: Prepopulate device bars > > In recent Hyper-V releases on Windows Server 2022, vPCI code does not > initialize the last 4 bit of device bar registers. This behavior change > could result weird problems cuasing PCI code failure when configuring > bars. > > Just write all 1's to those bars whose probed values are not the same > as current read ones. This seems to make Hyper-V vPCI and > pci_write_bar() to cooperate correctly on these releases. Could you please elaborate both on the problem and on the solution more? It really makes not a lot of sense to me. Four low bits of BARs are space indicator, and for memory bar, 32/64 bitness and prefetch bit. It is some magic that, following your description, these values are wrong but writing 1's to them validate the value. Were other OSes affected by the bug? Do they use the same workaround? > > Reported by:k...@freebsd.org > Tested by: k...@freebsd.org > MFC after: 2 weeks > Sponsored by: Microsoft > --- > sys/dev/hyperv/pcib/vmbus_pcib.c | 43 > > 1 file changed, 43 insertions(+) > > diff --git a/sys/dev/hyperv/pcib/vmbus_pcib.c > b/sys/dev/hyperv/pcib/vmbus_pcib.c > index 72e430c946db..c7df32044678 100644 > --- a/sys/dev/hyperv/pcib/vmbus_pcib.c > +++ b/sys/dev/hyperv/pcib/vmbus_pcib.c > @@ -1356,6 +1356,47 @@ _hv_pcifront_write_config(struct hv_pci_dev *hpdev, > int where, int size, > } > } > > +/* > + * The vPCI in some Hyper-V releases do not initialize the last 4 > + * bit of BAR registers. This could result weird problems causing PCI > + * code fail to configure BAR correctly. > + * > + * Just write all 1's to those BARs whose probed values are not zero. > + * This seems to make the Hyper-V vPCI and pci_write_bar() to cooperate > + * correctly. > + */ > + > +static void > +vmbus_pcib_prepopulate_bars(struct hv_pcibus *hbus) > +{ > + struct hv_pci_dev *hpdev; > + int i; > + > + mtx_lock(&hbus->device_list_lock); > + TAILQ_FOREACH(hpdev, &hbus->children, link) { > + for (i = 0; i < 6; i++) { > + /* Ignore empty bar */ > + if (hpdev->probed_bar[i] == 0) > + continue; > + > + uint32_t bar_val = 0; > + > + _hv_pcifront_read_config(hpdev, PCIR_BAR(i), > + 4, &bar_val); > + > + if (hpdev->probed_bar[i] != bar_val) { > + if (bootverbose) > + printf("vmbus_pcib: initialize bar %d " > + "by writing all 1s\n", i); > + > + _hv_pcifront_write_config(hpdev, PCIR_BAR(i), > + 4, 0x); > + } > + } > + } > + mtx_unlock(&hbus->device_list_lock); > +} > + > static void > vmbus_pcib_set_detaching(void *arg, int pending __unused) > { > @@ -1479,6 +1520,8 @@ vmbus_pcib_attach(device_t dev) > if (ret) > goto vmbus_close; > > + vmbus_pcib_prepopulate_bars(hbus); > + > hbus->pci_bus = device_add_child(dev, "pci", -1); > if (!hbus->pci_bus) { > device_printf(dev, "failed to create pci bus\n");
git: 7184e8c21107 - main - Keep running fsck_ffs as long as "WAS MODIFIED" is reported
The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=7184e8c211074db57865adabf41a08a50d155582 commit 7184e8c211074db57865adabf41a08a50d155582 Author: Peter Holm AuthorDate: 2021-11-27 10:54:53 + Commit: Peter Holm CommitDate: 2021-11-27 10:54:53 + Keep running fsck_ffs as long as "WAS MODIFIED" is reported --- tools/test/stress2/misc/fsck.sh | 79 - 1 file changed, 46 insertions(+), 33 deletions(-) diff --git a/tools/test/stress2/misc/fsck.sh b/tools/test/stress2/misc/fsck.sh index a007e722988e..826c31f733c3 100755 --- a/tools/test/stress2/misc/fsck.sh +++ b/tools/test/stress2/misc/fsck.sh @@ -27,14 +27,15 @@ # SUCH DAMAGE. # -# fsck_ffs(8) test. +# fsck_ffs(8) disk image fuzz test. + # "UFS /dev/md11 (/mnt11) cylinder checksum failed" seen. # Fixed by r341510. # 'panic: invalid counts on struct mount' seen: # https://people.freebsd.org/~pho/stress/log/fsck-4.txt -[ $DEBUG ] || exit 0 # Still WiP +# "panic: softdep_load_inodeblock: negative i_effnlink" seen. . ../default.cfg @@ -42,11 +43,6 @@ cc -o /tmp/flip -Wall -Wextra -O2 ../tools/flip.c || exit 1 -echo 'int sync(void) { return (0); }' > /tmp/fsck_preload.c -mycc -o /tmp/fsck_preload.so -shared -fpic /tmp/fsck_preload.c || exit 1 -cc -o /tmp/fsck_preload.so -shared -fpic /tmp/fsck_preload.c || exit 1 -rm /tmp/fsck_preload.c - set -e u1=$mdstart u2=$((mdstart + 1)) @@ -69,7 +65,7 @@ set +e mount | grep "on $mp1 " | grep -q /dev/md && umount -f $mp1 [ -c /dev/md$u1 ] && mdconfig -d -u $u1 mdconfig -a -t swap -s 1g -u $u1 -newfs $newfs_flags /dev/md$u1 > /dev/null +newfs $newfs_flags -n /dev/md$u1 > /dev/null mount /dev/md$u1 $mp1 [ -c /dev/md$u2 ] && mdconfig -d -u $u2 @@ -85,15 +81,16 @@ umount $mp2 chk() { local i - LD_PRELOAD=/tmp/fsck_preload.so \ - fsck_ffs -fy $1 > $log 2>&1 + clean=0 + rerun=0 + waccess=0 + fsck_ffs -fy $1 > $log 2>&1 r=$? if grep -qE "Cannot find file system superblock|Superblock check-hash failed" $log; then for b in $backups; do echo "Using alternate SB $b" asbs=$((asbs + 1)) - LD_PRELOAD=/tmp/fsck_preload.so \ - fsck_ffs -b $b -fy $1 > $log 2>&1 + fsck_ffs -b $b -fy $1 > $log 2>&1 r=$? grep -qE "Cannot find file system superblock|Superblock check-hash failed" $log || break @@ -103,47 +100,63 @@ chk() { usedasb=0 fi LANG=C egrep -q "[A-Z][A-Z]" $log && clean=0 - ! grep -Eq "IS CLEAN|MARKED CLEAN" $log; clean=$? - ! grep -q RERUN $log; rerun=$? - ! grep -q "NO WRITE ACCESS" $log; waccess=$? + grep -Eq "IS CLEAN|MARKED CLEAN" $log && clean=1 + # For now regard a "was modified" as a cause for a rerun, + # disregarding "clean" claim. + grep -Eq "WAS MODIFIED" $log && rerun=1 + grep -q RERUN $log && rerun=1 + grep -q "NO WRITE ACCESS" $log && waccess=1 [ $r -ne 0 -a $clean -eq 1 ] && echo "Exit code $r w/ clean == 1" - } -cd /tmp +cd $mp1 s=0 start=`date +%s` while [ $((`date +%s` - start)) -lt 60 ]; do - gzip < $diskimage > $backup - fsync $backup; sync # ; sleep .2; sync; sleep .2; sync mount /dev/md$u2 $mp2 || { s=101; break; } + ls -lR $mp2 > /dev/null || { s=102; echo "ls failed"; break; } touch $mp2/`jot -rc 8 a z | tr -d '\n'` - umount $mp2 - /tmp/flip -n 4 $diskimage + while mount | grep -q "on $mp2 "; do umount $mp2; done + echo * | grep -q core && break + sync + mdconfig -d -u $u2 + /tmp/flip -n 10 $diskimage + + sync + gzip < $diskimage > $backup + fsync $backup + for i in `jot 3`; do - chk /dev/md$u2 - [ $clean -eq 1 ] && { cleans=$((cleans + 1)); break; } + chk $diskimage [ $rerun -eq 1 ] && { reruns=$((reruns + 1)); continue; } + [ $clean -eq 1 ] && { cleans=$((cleans + 1)); break; } + [ -f fsck_ffs.core ] && + { cp $diskimage \ + /tmp/fsck_ffs.core.diskimage.`date +%Y%m%dT%H%M%S`; break 2; } done + [ $clean -ne 1 ] && break + mdconfig -a -t vnode -f $diskimage -u $u2 [ $r -ne 0 -a $clean -eq 1 ] && { echo "CLEAN && non zero exit code"; break; } [ $clean -eq 1 ] && continue - [ $usedasb -eq 1 ] && { echo "Alt. SB failed"; s=103; } - [ $waccess -eq 1 ] && { echo "No write access"; s=555; } + [ $usedasb -eq 1 ] && { echo "Alt. SB failed"; s=104; } + [ $waccess -eq 1 ] && { echo "No write access"; s=105; } break done -[ $DEBUG ] && -echo "$cleans cleans, $reruns reruns, $asbs alternate SBs." && cat $log +mount
git: 228e020a3b61 - main - Correct syscons description in i386 and amd64 configs
The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=228e020a3b6142bef17cfeb86cf06f1fd1f4f1fc commit 228e020a3b6142bef17cfeb86cf06f1fd1f4f1fc Author: Ed Maste AuthorDate: 2021-11-27 21:15:41 + Commit: Ed Maste CommitDate: 2021-11-27 21:22:42 + Correct syscons description in i386 and amd64 configs Commit 2d6f6d63733d switched to vt(4) as the default console. Sponsored by: The FreeBSD Foundation --- sys/amd64/conf/GENERIC | 4 ++-- sys/amd64/conf/MINIMAL | 4 ++-- sys/i386/conf/GENERIC | 4 ++-- sys/i386/conf/MINIMAL | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC index 60d2d0376aac..2732569c461c 100644 --- a/sys/amd64/conf/GENERIC +++ b/sys/amd64/conf/GENERIC @@ -217,11 +217,11 @@ options VESA# Add support for VESA BIOS Extensions (VBE) device splash # Splash screen and screen saver support -# syscons is the default console driver, resembling an SCO console +# syscons is the legacy console driver, resembling an SCO console device sc optionsSC_PIXEL_MODE # add support for the raster text mode -# vt is the new video console driver +# vt is the default video console driver device vt device vt_vga device vt_efifb diff --git a/sys/amd64/conf/MINIMAL b/sys/amd64/conf/MINIMAL index 14c07c0f04b6..decf092661a5 100644 --- a/sys/amd64/conf/MINIMAL +++ b/sys/amd64/conf/MINIMAL @@ -109,11 +109,11 @@ options VESA# Add support for VESA BIOS Extensions (VBE) device splash # Splash screen and screen saver support -# syscons is the default console driver, resembling an SCO console +# syscons is the legacy console driver, resembling an SCO console device sc optionsSC_PIXEL_MODE # add support for the raster text mode -# vt is the new video console driver +# vt is the default video console driver device vt device vt_vga device vt_efifb diff --git a/sys/i386/conf/GENERIC b/sys/i386/conf/GENERIC index b5ed7848f853..e3f1aee8c723 100644 --- a/sys/i386/conf/GENERIC +++ b/sys/i386/conf/GENERIC @@ -186,11 +186,11 @@ options VESA# Add support for VESA BIOS Extensions (VBE) device splash # Splash screen and screen saver support -# syscons is the default console driver, resembling an SCO console +# syscons is the legacy console driver, resembling an SCO console device sc optionsSC_PIXEL_MODE # add support for the raster text mode -# vt is the new video console driver +# vt is the default video console driver device vt device vt_vga device vt_vbefb diff --git a/sys/i386/conf/MINIMAL b/sys/i386/conf/MINIMAL index 0aa6dff54b50..ba9c05bf8265 100644 --- a/sys/i386/conf/MINIMAL +++ b/sys/i386/conf/MINIMAL @@ -120,11 +120,11 @@ options VESA# Add support for VESA BIOS Extensions (VBE) device splash # Splash screen and screen saver support -# syscons is the default console driver, resembling an SCO console +# syscons is the legacy console driver, resembling an SCO console device sc optionsSC_PIXEL_MODE # add support for the raster text mode -# vt is the new video console driver +# vt is the default video console driver device vt device vt_vga device vt_efifb
git: 1c15c8c0e935 - main - nfscl: Sanity check the Sequence slotid in reply
The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=1c15c8c0e935f3f7def7b03e9546f7d6790f465e commit 1c15c8c0e935f3f7def7b03e9546f7d6790f465e Author: Rick Macklem AuthorDate: 2021-11-27 23:02:04 + Commit: Rick Macklem CommitDate: 2021-11-27 23:02:04 + nfscl: Sanity check the Sequence slotid in reply The slotid in the Sequence reply must be the same as in the request. Check that it is the same and log a console message if it is not, plus set it to the correct value. Reported by:r...@lcs.mit.edu Tested by: r...@lcs.mit.edu PR: 260071 MFC after: 2 weeks --- sys/fs/nfs/nfs_commonkrpc.c | 12 1 file changed, 12 insertions(+) diff --git a/sys/fs/nfs/nfs_commonkrpc.c b/sys/fs/nfs/nfs_commonkrpc.c index c1a5fab2a358..4d8db64f419f 100644 --- a/sys/fs/nfs/nfs_commonkrpc.c +++ b/sys/fs/nfs/nfs_commonkrpc.c @@ -1038,6 +1038,18 @@ tryagain: tl += NFSX_V4SESSIONID / NFSX_UNSIGNED; retseq = fxdr_unsigned(uint32_t, *tl++); slot = fxdr_unsigned(int, *tl++); + if ((nd->nd_flag & ND_HASSLOTID) != 0) { + if (slot != nd->nd_slotid) { + printf("newnfs_request:" + " Wrong session " + "slot=%d\n", slot); + slot = nd->nd_slotid; + } + } else if (slot != 0) { + printf("newnfs_request: Bad " + "session slot=%d\n", slot); + slot = 0; + } freeslot = slot; if (retseq != sep->nfsess_slotseq[slot]) printf("retseq diff 0x%x\n",
git: 4dcdf3987c1c - main - vfs: replace the MNTK_TEXT_REFS flag with VIRF_TEXT_REF
The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=4dcdf3987c1cc95d0d344468e8aa15452254691c commit 4dcdf3987c1cc95d0d344468e8aa15452254691c Author: Mateusz Guzik AuthorDate: 2021-05-18 10:47:21 + Commit: Mateusz Guzik CommitDate: 2021-11-27 23:07:25 + vfs: replace the MNTK_TEXT_REFS flag with VIRF_TEXT_REF This allows to stop maintaing the VI_TEXT_REF flag and consequently opens up fully lockless v_writecount adjustment. Reviewed by:kib Differential Revision: https://reviews.freebsd.org/D33127 --- sys/fs/tmpfs/tmpfs_subr.c | 2 +- sys/fs/tmpfs/tmpfs_vfsops.c | 2 +- sys/kern/vfs_default.c | 20 +--- sys/kern/vfs_subr.c | 8 sys/sys/mount.h | 2 +- sys/sys/vnode.h | 3 ++- 6 files changed, 18 insertions(+), 19 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index 9810c1776314..41d9b6d5dcca 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -967,7 +967,7 @@ loop: vp->v_object = object; object->un_pager.swp.swp_tmpfs = vp; vm_object_set_flag(object, OBJ_TMPFS); - vn_irflag_set_locked(vp, VIRF_PGREAD); + vn_irflag_set_locked(vp, VIRF_PGREAD | VIRF_TEXT_REF); VI_UNLOCK(vp); VM_OBJECT_WUNLOCK(object); break; diff --git a/sys/fs/tmpfs/tmpfs_vfsops.c b/sys/fs/tmpfs/tmpfs_vfsops.c index b8ecedbb0348..7bd44decd830 100644 --- a/sys/fs/tmpfs/tmpfs_vfsops.c +++ b/sys/fs/tmpfs/tmpfs_vfsops.c @@ -469,7 +469,7 @@ tmpfs_mount(struct mount *mp) MNT_ILOCK(mp); mp->mnt_flag |= MNT_LOCAL; mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED | - MNTK_TEXT_REFS | MNTK_NOMSYNC; + MNTK_NOMSYNC; if (!nonc && (mp->mnt_flag & MNT_UNION) == 0) mp->mnt_kern_flag |= MNTK_FPLOOKUP; MNT_IUNLOCK(mp); diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index 50829ad3044e..1f5869bd8cf3 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -1300,7 +1300,6 @@ int vop_stdset_text(struct vop_set_text_args *ap) { struct vnode *vp; - struct mount *mp; int error, n; vp = ap->a_vp; @@ -1326,12 +1325,10 @@ vop_stdset_text(struct vop_set_text_args *ap) * If requested by fs, keep a use reference to the * vnode until the last text reference is released. */ - mp = vp->v_mount; - if (mp != NULL && (mp->mnt_kern_flag & MNTK_TEXT_REFS) != 0 && - vp->v_writecount == 0) { - VNPASS((vp->v_iflag & VI_TEXT_REF) == 0, vp); - vp->v_iflag |= VI_TEXT_REF; - vrefl(vp); + if ((vn_irflag_read(vp) & VIRF_TEXT_REF) != 0) { + if (vp->v_writecount == 0) { + vrefl(vp); + } } atomic_subtract_int(&vp->v_writecount, 1); @@ -1366,11 +1363,12 @@ vop_stdunset_text(struct vop_unset_text_args *ap) last = false; VI_LOCK(vp); if (vp->v_writecount < 0) { - if ((vp->v_iflag & VI_TEXT_REF) != 0 && - vp->v_writecount == -1) { - last = true; - vp->v_iflag &= ~VI_TEXT_REF; + if ((vn_irflag_read(vp) & VIRF_TEXT_REF) != 0) { + if (vp->v_writecount == -1) { + last = true; + } } + atomic_add_int(&vp->v_writecount, 1); error = 0; } else { diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 65a9ebf304fe..06ca5dc7d93a 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -4122,7 +4122,9 @@ vn_printf(struct vnode *vp, const char *fmt, ...) strlcat(buf, "|VIRF_PGREAD", sizeof(buf)); if (irflag & VIRF_MOUNTPOINT) strlcat(buf, "|VIRF_MOUNTPOINT", sizeof(buf)); - flags = irflag & ~(VIRF_DOOMED | VIRF_PGREAD | VIRF_MOUNTPOINT); + if (irflag & VIRF_TEXT_REF) + strlcat(buf, "|VIRF_TEXT_REF", sizeof(buf)); + flags = irflag & ~(VIRF_DOOMED | VIRF_PGREAD | VIRF_MOUNTPOINT | VIRF_TEXT_REF); if (flags != 0) { snprintf(buf2, sizeof(buf2), "|VIRF(0x%lx)", flags); strlcat(buf, buf2, sizeof(buf)); @@ -4163,8 +4165,6 @@ vn_printf(struct vnode *vp, const char *fmt, ...) snprintf(buf2, sizeof(buf2), "|VV(0x%lx)", flags); strlcat(buf, buf2, sizeof(buf)); } - if (vp->v_iflag & VI_TEXT_REF) - strlcat(buf, "|VI_TEXT_REF", sizeof(buf)); if (vp->v_iflag & VI_MOUNT) strlcat(buf, "|VI_MOUNT", sizeof(buf)); if (v
git: e511bd1406fa - main - vfs: fully lockless v_writecount adjustment
The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=e511bd1406fa35301e770aad05d1bfdc345c8639 commit e511bd1406fa35301e770aad05d1bfdc345c8639 Author: Mateusz Guzik AuthorDate: 2021-11-26 12:33:28 + Commit: Mateusz Guzik CommitDate: 2021-11-27 23:07:26 + vfs: fully lockless v_writecount adjustment Reviewed by:kib Differential Revision: https://reviews.freebsd.org/D33128 --- sys/kern/vfs_default.c | 125 + 1 file changed, 63 insertions(+), 62 deletions(-) diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index 1f5869bd8cf3..6f304f0f719d 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -1293,91 +1293,86 @@ static int vop_stdis_text(struct vop_is_text_args *ap) { - return (ap->a_vp->v_writecount < 0); + return (atomic_load_int(&ap->a_vp->v_writecount) < 0); } int vop_stdset_text(struct vop_set_text_args *ap) { struct vnode *vp; - int error, n; + int n; + bool gotref; vp = ap->a_vp; - /* -* Avoid the interlock if execs are already present. -*/ n = atomic_load_int(&vp->v_writecount); for (;;) { - if (n > -1) { - break; - } - if (atomic_fcmpset_int(&vp->v_writecount, &n, n - 1)) { - return (0); + if (__predict_false(n > 0)) { + return (ETXTBSY); } - } - VI_LOCK(vp); - if (vp->v_writecount > 0) { - error = ETXTBSY; - } else { /* -* If requested by fs, keep a use reference to the -* vnode until the last text reference is released. +* Transition point, we may need to grab a reference on the vnode. +* +* Take the ref early As a safety measure against bogus calls +* to vop_stdunset_text. */ - if ((vn_irflag_read(vp) & VIRF_TEXT_REF) != 0) { - if (vp->v_writecount == 0) { - vrefl(vp); + if (n == 0) { + gotref = false; + if ((vn_irflag_read(vp) & VIRF_TEXT_REF) != 0) { + vref(vp); + gotref = true; + } + if (atomic_fcmpset_int(&vp->v_writecount, &n, -1)) { + return (0); } + if (gotref) { + vunref(vp); + } + continue; } - atomic_subtract_int(&vp->v_writecount, 1); - error = 0; + MPASS(n < 0); + if (atomic_fcmpset_int(&vp->v_writecount, &n, n - 1)) { + return (0); + } } - VI_UNLOCK(vp); - return (error); + __assert_unreachable(); } static int vop_stdunset_text(struct vop_unset_text_args *ap) { struct vnode *vp; - int error, n; - bool last; + int n; vp = ap->a_vp; - /* -* Avoid the interlock if this is not the last exec. -*/ n = atomic_load_int(&vp->v_writecount); for (;;) { - if (n >= -1) { - break; - } - if (atomic_fcmpset_int(&vp->v_writecount, &n, n + 1)) { - return (0); + if (__predict_false(n >= 0)) { + return (EINVAL); } - } - last = false; - VI_LOCK(vp); - if (vp->v_writecount < 0) { - if ((vn_irflag_read(vp) & VIRF_TEXT_REF) != 0) { - if (vp->v_writecount == -1) { - last = true; + /* +* Transition point, we may need to release a reference on the vnode. +*/ + if (n == -1) { + if (atomic_fcmpset_int(&vp->v_writecount, &n, 0)) { + if ((vn_irflag_read(vp) & VIRF_TEXT_REF) != 0) { + vunref(vp); + } + return (0); } + continue; } - atomic_add_int(&vp->v_writecount, 1); - error = 0; - } else { - error = EINVAL; + MPASS(n < -1); + if (atomic_fcmpset_int(&vp->v_writecount, &n, n + 1)) { + return (0); + } } - VI_UNLOCK(vp); - if (last) - vunref(vp); - return (error); + __assert_unreachable(); } static int __always_inline @@ -1385,7 +13
git: c3134a6af07a - main - nfscl: Disable use of the LookupOpen RPC
The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=c3134a6af07af402b71f0b8587e09cb783c79eda commit c3134a6af07af402b71f0b8587e09cb783c79eda Author: Rick Macklem AuthorDate: 2021-11-27 23:34:45 + Commit: Rick Macklem CommitDate: 2021-11-27 23:34:45 + nfscl: Disable use of the LookupOpen RPC The LookupOpen RPC reduces the number of Open RPCs needed. Unfortunately, it breaks certain software builds over NFS, so disable it until this is fixed. The LookupOpen RPC is only used for NFSv4.1/4.2 mounts when the "oneopenown" mount option is specified, so this should not affect many users. --- sys/fs/nfsclient/nfs_clvnops.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index 920bf2524c01..4a027ea07f26 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -1322,13 +1322,18 @@ nfs_lookup(struct vop_lookup_args *ap) cache_purge_negative(dvp); } + openmode = 0; +#if 0 + /* +* The use of LookupOpen breaks some builds. It is disabled +* until that is fixed. +*/ /* * If this an NFSv4.1/4.2 mount using the "oneopenown" mount * option, it is possible to do the Open operation in the same * compound as Lookup, so long as delegations are not being * issued. This saves doing a separate RPC for Open. */ - openmode = 0; NFSLOCKMNT(nmp); if (NFSHASNFSV4N(nmp) && NFSHASONEOPENOWN(nmp) && (nmp->nm_privflag & NFSMNTP_DELEGISSUED) == 0 && @@ -1340,6 +1345,7 @@ nfs_lookup(struct vop_lookup_args *ap) openmode |= NFSV4OPEN_ACCESSWRITE; } NFSUNLOCKMNT(nmp); +#endif newvp = NULLVP; NFSINCRGLOBAL(nfsstatsv1.lookupcache_misses);
Re: git: b19740f4ce7a - main - swap_pager: lock vnode in swapdev_strategy()
On 2021-Nov-27 01:26:17 +0200, Konstantin Belousov wrote: >commit 9c62295373f728459c19138f5aa03d9cb8422554 >Author: Konstantin Belousov >Date: Sat Nov 27 01:22:27 2021 +0200 > >swapoff_one(): only check free pages count manually turning swap off That didn't work but I don't think the underlying bug is related to your recent work on swap_pager - digging back through my logs, I've found another similar panic in August last year. Nov 28 09:40:17 rock64 syslogd: exiting on signal 15 Waiting (max 60 seconds) for system process `vnlru' to stop... done Waiting (max 60 seconds) for system process `syncer' to stop... Syncing disks, vnodes remaining... 0 0 done Waiting (max 60 seconds) for system thread `bufdaemon' to stop... done Waiting (max 60 seconds) for system thread `bufspacedaemon-0' to stop... done All buffers synced. No strategy for buffer at 0xbf8dc000 vnode 0xa9024a80: type VBAD usecount 2, writecount 0, refcount 33263 seqc users 1 hold count flags () flags (VIRF_DOOMED|VV_VMSIZEVNLOCK) lock type nfs: SHARED (count 1) swap_pager: I/O error - pagein failed; blkno 241400,size 4096, error 45 panic: VOP_STRATEGY failed bp=0xbf8dc000 vp=0 cpuid = 0 time = 1638052821 KDB: stack backtrace: db_trace_self() at db_trace_self db_trace_self_wrapper() at db_trace_self_wrapper+0x30 vpanic() at vpanic+0x178 panic() at panic+0x44 bufstrategy() at bufstrategy+0x80 swapdev_strategy() at swapdev_strategy+0xcc swap_pager_getpages_locked() at swap_pager_getpages_locked+0x460 swapoff_one() at swapoff_one+0x3e4 swapoff_all() at swapoff_all+0x9c bufshutdown() at bufshutdown+0x2ac kern_reboot() at kern_reboot+0x240 sys_reboot() at sys_reboot+0x358 do_el0_sync() at do_el0_sync+0x4a4 handle_el0_sync() at handle_el0_sync+0x9c --- exception, esr 0x5600 KDB: enter: panic [ thread pid 1 tid 12 ] Stopped at kdb_enter+0x48: undefined f900c11f db> This is the same traceback as my previous mail. Looking at the code path, the test whether there's enough RAM to swap in all the data passes in both cases: If swapoff_one() returned ENOMEM then swapoff_all() would report a "Cannot remove swap device" error and keep going (not bother to actually remove the swap device) - and that's not happening. I think the important message is "No strategy for buffer at 0x..." which comes from vop_nostrategy() and causes bufstrategy() to panic: swapdev_strategy() => bstrategy() => BO_STRATEGY() => bufstrategy() => VOP_STRATEGY() => VOP_STRATEGY_APV() => vop_nostrategy() => bufdone() => swp_pager_async_iodone() Presumably, stopping the network means there's no longer any way for swap operations to complete so the swap device has become associated with default_vnodeops, (though I haven't dug into the actual code path that does that). Moving up a level, does it really matter if swapoff_one() is skipped? If it actually returned an error (eg if the free memory test failed), then that's what would happen. By this point in the shutdown, there's no userland left (which makes me wonder why there's anything left in swap in any case) and only the final cleanups remain before the kernel shuts down. What's really needed is a way to detect that the relevant swap I/O provider has gone away and return to swapoff_all() without panicing. -- Peter Jeremy signature.asc Description: PGP signature
Re: git: b19740f4ce7a - main - swap_pager: lock vnode in swapdev_strategy()
On Sun, Nov 28, 2021 at 12:22:46PM +1100, Peter Jeremy wrote: > On 2021-Nov-27 01:26:17 +0200, Konstantin Belousov > wrote: > >commit 9c62295373f728459c19138f5aa03d9cb8422554 > >Author: Konstantin Belousov > >Date: Sat Nov 27 01:22:27 2021 +0200 > > > >swapoff_one(): only check free pages count manually turning swap off > > That didn't work but I don't think the underlying bug is related to > your recent work on swap_pager - digging back through my logs, I've > found another similar panic in August last year. It is definitely not caused by, it is just yet another issue. > > Nov 28 09:40:17 rock64 syslogd: exiting on signal 15 > Waiting (max 60 seconds) for system process `vnlru' to stop... done > Waiting (max 60 seconds) for system process `syncer' to stop... > Syncing disks, vnodes remaining... 0 0 done > Waiting (max 60 seconds) for system thread `bufdaemon' to stop... done > Waiting (max 60 seconds) for system thread `bufspacedaemon-0' to stop... done > All buffers synced. > No strategy for buffer at 0xbf8dc000 > vnode 0xa9024a80: type VBAD > usecount 2, writecount 0, refcount 33263 seqc users 1 > hold count flags () > flags (VIRF_DOOMED|VV_VMSIZEVNLOCK) > lock type nfs: SHARED (count 1) > swap_pager: I/O error - pagein failed; blkno 241400,size 4096, error 45 > panic: VOP_STRATEGY failed bp=0xbf8dc000 vp=0 > cpuid = 0 > time = 1638052821 > KDB: stack backtrace: > db_trace_self() at db_trace_self > db_trace_self_wrapper() at db_trace_self_wrapper+0x30 > vpanic() at vpanic+0x178 > panic() at panic+0x44 > bufstrategy() at bufstrategy+0x80 > swapdev_strategy() at swapdev_strategy+0xcc > swap_pager_getpages_locked() at swap_pager_getpages_locked+0x460 > swapoff_one() at swapoff_one+0x3e4 > swapoff_all() at swapoff_all+0x9c > bufshutdown() at bufshutdown+0x2ac > kern_reboot() at kern_reboot+0x240 > sys_reboot() at sys_reboot+0x358 > do_el0_sync() at do_el0_sync+0x4a4 > handle_el0_sync() at handle_el0_sync+0x9c > --- exception, esr 0x5600 > KDB: enter: panic > [ thread pid 1 tid 12 ] > Stopped at kdb_enter+0x48: undefined f900c11f > db> > > This is the same traceback as my previous mail. Looking at the code > path, the test whether there's enough RAM to swap in all the data > passes in both cases: If swapoff_one() returned ENOMEM then > swapoff_all() would report a "Cannot remove swap device" error and > keep going (not bother to actually remove the swap device) - and > that's not happening. > > I think the important message is "No strategy for buffer at 0x..." > which comes from vop_nostrategy() and causes bufstrategy() to panic: > > swapdev_strategy() > => bstrategy() > => BO_STRATEGY() > => bufstrategy() > => VOP_STRATEGY() > => VOP_STRATEGY_APV() > => vop_nostrategy() > => bufdone() => swp_pager_async_iodone() > > Presumably, stopping the network means there's no longer any way for > swap operations to complete so the swap device has become associated > with default_vnodeops, (though I haven't dug into the actual code > path that does that). > > Moving up a level, does it really matter if swapoff_one() is skipped? > If it actually returned an error (eg if the free memory test failed), > then that's what would happen. By this point in the shutdown, there's > no userland left (which makes me wonder why there's anything left in > swap in any case) and only the final cleanups remain before the kernel > shuts down. What's really needed is a way to detect that the relevant > swap I/O provider has gone away and return to swapoff_all() without > panicing. I think the intent there is to ensure that the system is in as much steady state as possible. I can easily imagine some HBA doing weird things if some io is in flight when the reset comes in. So we want to ensure that no io occurs. The cause for your panic is not the network interface down state (in fact, I think that interface state up), but as you correctly analyzed, the call to vop_nostrategy(). It is there in stack because underlying filesystem was unmounted, and the swap vnode was reclaimed, replacing NFS vop vector with deadfs vop vector, which inherits from the default vop. The bit that I do not understand from your report, is why swapoff_all() did not occured earlier. Your earlier report, where spurious ENOMEM came out from swapoff(2) syscall, and which I fixed by the previous patch, means that there was an attempt to swapoff. Still, the solution is, IMO, to swapoff before unmount. We do not need swapin for flushing buffers. Please try this combined patch. diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 4b746a269171..201afeec9311 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -1452,16 +1452,21 @@ bufshutdown(int show_busybufs) */ printf("Giving up on %d buffers\n", nbusy); DELAY(500); /* 5 seconds */ + swapoff_all(); } else { if (!first_buf_
git: 374f859ec08f - stable/13 - ng_h4: add deprecation notice
The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=374f859ec08fc96a8cdd530eaeeba060c7b41912 commit 374f859ec08fc96a8cdd530eaeeba060c7b41912 Author: Ed Maste AuthorDate: 2021-11-25 16:55:34 + Commit: Ed Maste CommitDate: 2021-11-28 00:26:38 + ng_h4: add deprecation notice It is already gone in FreeBSD 14. Sponsored by: The FreeBSD Foundation --- share/man/man4/ng_h4.4 | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/share/man/man4/ng_h4.4 b/share/man/man4/ng_h4.4 index bb539a230eba..52a9b8158746 100644 --- a/share/man/man4/ng_h4.4 +++ b/share/man/man4/ng_h4.4 @@ -25,7 +25,7 @@ .\" $Id: ng_h4.4,v 1.2 2003/05/21 19:37:35 max Exp $ .\" $FreeBSD$ .\" -.Dd June 14, 2002 +.Dd November 27, 2021 .Dt NG_H4 4 .Os .Sh NAME @@ -34,6 +34,11 @@ .Sh SYNOPSIS .In sys/types.h .In netgraph/bluetooth/include/ng_h4.h +.Sh DEPRECATION NOTICE +The +.Nm +Netgraph node is not present in +.Fx 14.0 . .Sh DESCRIPTION The .Nm h4
git: 2104a8064951 - stable/13 - mkimg: zero entry in vhdx_write_metadata
The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=2104a806495173c399ca2709533ab0ab48b708b3 commit 2104a806495173c399ca2709533ab0ab48b708b3 Author: Ed Maste AuthorDate: 2021-11-21 00:29:11 + Commit: Ed Maste CommitDate: 2021-11-28 00:29:30 + mkimg: zero entry in vhdx_write_metadata Otherwise _reserved might contain uninitialized data. MFC after: 1 week Sponsored by: The FreeBSD Foundation (cherry picked from commit 036af1053acd6cae68c5fb6bed30508f2e40be13) --- usr.bin/mkimg/vhdx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/usr.bin/mkimg/vhdx.c b/usr.bin/mkimg/vhdx.c index 4c97b20f5996..744d6e810ca5 100644 --- a/usr.bin/mkimg/vhdx.c +++ b/usr.bin/mkimg/vhdx.c @@ -331,6 +331,7 @@ vhdx_write_metadata(int fd, uint64_t image_size) memset(metadata, 0, SIZE_1MB); memset(&header, 0, sizeof(header)); + memset(&entry, 0, sizeof(entry)); le64enc(&header.signature, VHDX_METADATA_TABLE_HEADER_SIGNATURE); le16enc(&header.entry_count, 5);
git: ee2e925603e4 - stable/13 - Fix coredump_phnum test with ASLR enabled
The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=ee2e925603e42897fbabe1b24208d27bdcaae786 commit ee2e925603e42897fbabe1b24208d27bdcaae786 Author: Ed Maste AuthorDate: 2021-11-21 17:17:20 + Commit: Ed Maste CommitDate: 2021-11-28 00:27:03 + Fix coredump_phnum test with ASLR enabled coredump_phnum intends to generate a core file with many PT_LOAD segments. Previously it called mmap() in a loop with alternating protections, relying on each mapping following the previous, to produce a core file with many page-sized PT_LOAD segments. With ASLR on we no longer have this property of each mmap() following the previous. Instead, perform a single allocation, and then use mprotect() to set alternating pages to PROT_READ. PR: 259970 Reported by:lwhsu, mw Reviewed by:kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33070 (cherry picked from commit 8ec4c5dae32765701ac70811455084efd1570c32) --- tests/sys/kern/coredump_phnum_helper.c | 21 - 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/tests/sys/kern/coredump_phnum_helper.c b/tests/sys/kern/coredump_phnum_helper.c index da023e691a24..0dff59b918d9 100644 --- a/tests/sys/kern/coredump_phnum_helper.c +++ b/tests/sys/kern/coredump_phnum_helper.c @@ -42,18 +42,21 @@ int main(int argc __unused, char **argv __unused) { void *v; - unsigned i; + size_t i, pages; - for (i = 0; i < UINT16_MAX + 1000; i++) { + pages = UINT16_MAX + 1000; + v = mmap(NULL, pages * PAGE_SIZE, PROT_READ | PROT_WRITE, + MAP_ANON | MAP_PRIVATE, -1, 0); + if (v == NULL) + err(1, "mmap"); + for (i = 0; i < pages; i += 2) { /* -* Alternate protections; otherwise the kernel will just extend -* the adjacent same-protection previous mapping. +* Alternate protections to interleave RW and R PT_LOAD +* segments. */ - v = mmap(NULL, PAGE_SIZE, - (((i % 2) == 0) ? PROT_READ : 0) | PROT_WRITE, - MAP_ANON | MAP_PRIVATE, -1, 0); - if (v == MAP_FAILED) - err(1, "mmap"); + if (mprotect((char *)v + i * PAGE_SIZE, PAGE_SIZE, + PROT_READ) != 0) + err(1, "mprotect"); } /* Dump core. */
git: 2ff40d5e276f - stable/12 - ng_h4: add deprecation notice
The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=2ff40d5e276f0f7b191a3e628897c5a3ca54a19c commit 2ff40d5e276f0f7b191a3e628897c5a3ca54a19c Author: Ed Maste AuthorDate: 2021-11-25 16:55:34 + Commit: Ed Maste CommitDate: 2021-11-28 02:55:46 + ng_h4: add deprecation notice It is already gone in FreeBSD 14. Sponsored by: The FreeBSD Foundation (cherry picked from commit 374f859ec08fc96a8cdd530eaeeba060c7b41912) --- share/man/man4/ng_h4.4 | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/share/man/man4/ng_h4.4 b/share/man/man4/ng_h4.4 index bb539a230eba..52a9b8158746 100644 --- a/share/man/man4/ng_h4.4 +++ b/share/man/man4/ng_h4.4 @@ -25,7 +25,7 @@ .\" $Id: ng_h4.4,v 1.2 2003/05/21 19:37:35 max Exp $ .\" $FreeBSD$ .\" -.Dd June 14, 2002 +.Dd November 27, 2021 .Dt NG_H4 4 .Os .Sh NAME @@ -34,6 +34,11 @@ .Sh SYNOPSIS .In sys/types.h .In netgraph/bluetooth/include/ng_h4.h +.Sh DEPRECATION NOTICE +The +.Nm +Netgraph node is not present in +.Fx 14.0 . .Sh DESCRIPTION The .Nm h4
git: d3a7b75bbcb5 - stable/12 - Fix coredump_phnum test with ASLR enabled
The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=d3a7b75bbcb5171d7eda9d712437efd46bb7605b commit d3a7b75bbcb5171d7eda9d712437efd46bb7605b Author: Ed Maste AuthorDate: 2021-11-21 17:17:20 + Commit: Ed Maste CommitDate: 2021-11-28 02:55:46 + Fix coredump_phnum test with ASLR enabled coredump_phnum intends to generate a core file with many PT_LOAD segments. Previously it called mmap() in a loop with alternating protections, relying on each mapping following the previous, to produce a core file with many page-sized PT_LOAD segments. With ASLR on we no longer have this property of each mmap() following the previous. Instead, perform a single allocation, and then use mprotect() to set alternating pages to PROT_READ. PR: 259970 Reported by:lwhsu, mw Reviewed by:kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33070 (cherry picked from commit 8ec4c5dae32765701ac70811455084efd1570c32) (cherry picked from commit ee2e925603e42897fbabe1b24208d27bdcaae786) --- tests/sys/kern/coredump_phnum_helper.c | 21 - 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/tests/sys/kern/coredump_phnum_helper.c b/tests/sys/kern/coredump_phnum_helper.c index da023e691a24..0dff59b918d9 100644 --- a/tests/sys/kern/coredump_phnum_helper.c +++ b/tests/sys/kern/coredump_phnum_helper.c @@ -42,18 +42,21 @@ int main(int argc __unused, char **argv __unused) { void *v; - unsigned i; + size_t i, pages; - for (i = 0; i < UINT16_MAX + 1000; i++) { + pages = UINT16_MAX + 1000; + v = mmap(NULL, pages * PAGE_SIZE, PROT_READ | PROT_WRITE, + MAP_ANON | MAP_PRIVATE, -1, 0); + if (v == NULL) + err(1, "mmap"); + for (i = 0; i < pages; i += 2) { /* -* Alternate protections; otherwise the kernel will just extend -* the adjacent same-protection previous mapping. +* Alternate protections to interleave RW and R PT_LOAD +* segments. */ - v = mmap(NULL, PAGE_SIZE, - (((i % 2) == 0) ? PROT_READ : 0) | PROT_WRITE, - MAP_ANON | MAP_PRIVATE, -1, 0); - if (v == MAP_FAILED) - err(1, "mmap"); + if (mprotect((char *)v + i * PAGE_SIZE, PAGE_SIZE, + PROT_READ) != 0) + err(1, "mprotect"); } /* Dump core. */
git: 38cb3cac475c - stable/12 - mkimg: zero entry in vhdx_write_metadata
The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=38cb3cac475c70b7c9e71fb13d48fbdce40f52fd commit 38cb3cac475c70b7c9e71fb13d48fbdce40f52fd Author: Ed Maste AuthorDate: 2021-11-21 00:29:11 + Commit: Ed Maste CommitDate: 2021-11-28 02:55:46 + mkimg: zero entry in vhdx_write_metadata Otherwise _reserved might contain uninitialized data. MFC after: 1 week Sponsored by: The FreeBSD Foundation (cherry picked from commit 036af1053acd6cae68c5fb6bed30508f2e40be13) --- usr.bin/mkimg/vhdx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/usr.bin/mkimg/vhdx.c b/usr.bin/mkimg/vhdx.c index 4c97b20f5996..744d6e810ca5 100644 --- a/usr.bin/mkimg/vhdx.c +++ b/usr.bin/mkimg/vhdx.c @@ -331,6 +331,7 @@ vhdx_write_metadata(int fd, uint64_t image_size) memset(metadata, 0, SIZE_1MB); memset(&header, 0, sizeof(header)); + memset(&entry, 0, sizeof(entry)); le64enc(&header.signature, VHDX_METADATA_TABLE_HEADER_SIGNATURE); le16enc(&header.entry_count, 5);
git: dad71022bd7a - main - Disable flaky test lib.libc.sys.setrlimit_test.setrlimit_stack
The branch main has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=dad71022bd7a8f95ab2ba656bec61e2424a1c3c5 commit dad71022bd7a8f95ab2ba656bec61e2424a1c3c5 Author: Li-Wen Hsu AuthorDate: 2021-11-28 06:58:21 + Commit: Li-Wen Hsu CommitDate: 2021-11-28 06:58:21 + Disable flaky test lib.libc.sys.setrlimit_test.setrlimit_stack PR: 259969 Sponsored by: The FreeBSD Foundation --- contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c b/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c index 6b90deab8f3f..d5c50155e6dd 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c @@ -550,6 +550,9 @@ ATF_TC_BODY(setrlimit_stack, tc) { struct rlimit res; + if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) + atf_tc_skip("https://bugs.freebsd.org/259969";); + /* Ensure soft limit is not bigger than hard limit */ res.rlim_cur = res.rlim_max = 4192256; ATF_REQUIRE(setrlimit(RLIMIT_STACK, &res) == 0);
Re: git: b19740f4ce7a - main - swap_pager: lock vnode in swapdev_strategy()
On 2021-Nov-28 04:00:56 +0200, Konstantin Belousov wrote: >On Sun, Nov 28, 2021 at 12:22:46PM +1100, Peter Jeremy wrote: >> On 2021-Nov-27 01:26:17 +0200, Konstantin Belousov >> wrote: >The cause for your panic is not the network interface down state (in fact, >I think that interface state up), but as you correctly analyzed, the >call to vop_nostrategy(). It is there in stack because underlying filesystem >was unmounted, and the swap vnode was reclaimed, replacing NFS vop vector >with deadfs vop vector, which inherits from the default vop. OK. Thanks for that explanation. I saw deadfs was a potential option but hadn't checked. >The bit that I do not understand from your report, is why swapoff_all() did >not occured earlier. Your earlier report, where spurious ENOMEM came out >from swapoff(2) syscall, and which I fixed by the previous patch, means >that there was an attempt to swapoff. The ENOMEM swapoff is before the actual shutdown. I suspect my inclusion of that confused you, sorry. >Still, the solution is, IMO, to swapoff before unmount. We do not need >swapin for flushing buffers. > >Please try this combined patch. I've had a couple of goes at rebooting whilst thrashing with lots of swap in use and it seems happy so I think the patch is good to go. Thanks for the patches. -- Peter Jeremy signature.asc Description: PGP signature