CVS commit: src
Module Name:src Committed By: ozaki-r Date: Thu Dec 1 04:24:38 UTC 2022 Modified Files: src/distrib/sets/lists/tests: mi src/tests/net/net: Makefile Log Message: tests: fix Makefile and lists for MKRUMP=no Pointed out by Michael Scholz, thanks. To generate a diff of this commit: cvs rdiff -u -r1.1237 -r1.1238 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.28 -r1.29 src/tests/net/net/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.1237 src/distrib/sets/lists/tests/mi:1.1238 --- src/distrib/sets/lists/tests/mi:1.1237 Wed Nov 30 06:07:51 2022 +++ src/distrib/sets/lists/tests/mi Thu Dec 1 04:24:37 2022 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1237 2022/11/30 06:07:51 ozaki-r Exp $ +# $NetBSD: mi,v 1.1238 2022/12/01 04:24:37 ozaki-r Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -4285,7 +4285,7 @@ ./usr/tests/net/net/t_pktinfotests-net-tests compattestfile,atf ./usr/tests/net/net/t_pktinfo_send tests-net-tests atf,rump ./usr/tests/net/net/t_rawtests-net-tests atf,rump -./usr/tests/net/net/t_socket_afinet tests-net-tests compattestfile,atf +./usr/tests/net/net/t_socket_afinet tests-net-tests compattestfile,atf,rump ./usr/tests/net/net/t_tcptests-net-tests compattestfile,atf ./usr/tests/net/net/t_udptests-net-tests compattestfile,atf ./usr/tests/net/net/t_unixtests-net-tests compattestfile,atf Index: src/tests/net/net/Makefile diff -u src/tests/net/net/Makefile:1.28 src/tests/net/net/Makefile:1.29 --- src/tests/net/net/Makefile:1.28 Wed Nov 30 07:48:43 2022 +++ src/tests/net/net/Makefile Thu Dec 1 04:24:37 2022 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.28 2022/11/30 07:48:43 ozaki-r Exp $ +# $NetBSD: Makefile,v 1.29 2022/12/01 04:24:37 ozaki-r Exp $ # .include @@ -11,9 +11,9 @@ TESTS_C+= t_mapped TESTS_C+= t_tcp TESTS_C+= t_udp TESTS_C+= t_pktinfo +.if (${MKRUMP} != "no") && !defined(BSD_MK_COMPAT_FILE) TESTS_C+= t_socket_afinet TESTS_C+= t_ip_reass -.if (${MKRUMP} != "no") && !defined(BSD_MK_COMPAT_FILE) TESTS_C+= t_pktinfo_send TESTS_C+= t_raw
CVS commit: src
Module Name:src Committed By: ozaki-r Date: Thu Dec 1 04:24:38 UTC 2022 Modified Files: src/distrib/sets/lists/tests: mi src/tests/net/net: Makefile Log Message: tests: fix Makefile and lists for MKRUMP=no Pointed out by Michael Scholz, thanks. To generate a diff of this commit: cvs rdiff -u -r1.1237 -r1.1238 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.28 -r1.29 src/tests/net/net/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/tprof
Module Name:src Committed By: ryo Date: Thu Dec 1 03:32:24 UTC 2022 Modified Files: src/usr.sbin/tprof: tprof_top.c Log Message: fix build error of printf format To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/tprof/tprof_top.c 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/tprof/tprof_top.c diff -u src/usr.sbin/tprof/tprof_top.c:1.1 src/usr.sbin/tprof/tprof_top.c:1.2 --- src/usr.sbin/tprof/tprof_top.c:1.1 Thu Dec 1 00:43:27 2022 +++ src/usr.sbin/tprof/tprof_top.c Thu Dec 1 03:32:24 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tprof_top.c,v 1.1 2022/12/01 00:43:27 ryo Exp $ */ +/* $NetBSD: tprof_top.c,v 1.2 2022/12/01 03:32:24 ryo Exp $ */ /*- * Copyright (c) 2022 Ryo Shimizu @@ -28,7 +28,7 @@ #include #ifndef lint -__RCSID("$NetBSD: tprof_top.c,v 1.1 2022/12/01 00:43:27 ryo Exp $"); +__RCSID("$NetBSD: tprof_top.c,v 1.2 2022/12/01 03:32:24 ryo Exp $"); #endif /* not lint */ #include @@ -387,7 +387,7 @@ show_count_per_event(void) printf("%5.2f%%", sample_nsample_per_event[i] * 100.00 / nsample_total); } - printf("%8lu ", sample_nsample_per_event[i]); + printf("%8"PRIu64" ", sample_nsample_per_event[i]); printf("%-32.32s", eventname[i]); for (n = 0; n < ncpu; n++) { @@ -481,10 +481,10 @@ sample_show(void) name = e->name; if (name == NULL) { if (e->flags & SAMPLE_ELM_FLAGS_USER) { -snprintf(namebuf, sizeof(namebuf), "", +snprintf(namebuf, sizeof(namebuf), "", e->addr); } else { -snprintf(namebuf, sizeof(namebuf), "0x%016lx", +snprintf(namebuf, sizeof(namebuf), "0x%016"PRIx64, e->addr); } name = namebuf;
CVS commit: src/usr.sbin/tprof
Module Name:src Committed By: ryo Date: Thu Dec 1 03:32:24 UTC 2022 Modified Files: src/usr.sbin/tprof: tprof_top.c Log Message: fix build error of printf format To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/tprof/tprof_top.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/i2c
Module Name:src Committed By: brad Date: Thu Dec 1 02:29:37 UTC 2022 Modified Files: src/sys/dev/i2c: bmx280.c Log Message: Use a better choice for the print format string. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/i2c/bmx280.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/i2c/bmx280.c diff -u src/sys/dev/i2c/bmx280.c:1.5 src/sys/dev/i2c/bmx280.c:1.6 --- src/sys/dev/i2c/bmx280.c:1.5 Thu Dec 1 00:47:51 2022 +++ src/sys/dev/i2c/bmx280.c Thu Dec 1 02:29:37 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: bmx280.c,v 1.5 2022/12/01 00:47:51 brad Exp $ */ +/* $NetBSD: bmx280.c,v 1.6 2022/12/01 02:29:37 brad Exp $ */ /* * Copyright (c) 2022 Brad Spencer @@ -17,7 +17,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: bmx280.c,v 1.5 2022/12/01 00:47:51 brad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bmx280.c,v 1.6 2022/12/01 02:29:37 brad Exp $"); /* Driver for the Bosch BMP280/BME280 temperature, humidity (sometimes) and @@ -1065,10 +1065,10 @@ bmx280_refresh(struct sysmon_envsys * sm uint64_t q; q = (uint64_t)comp_hum * 100; - DPRINTF(sc, 1, ("%s: Refresh humidity Q 1: %lld\n", __func__, q)); + DPRINTF(sc, 1, ("%s: Refresh humidity Q 1: %jd\n", __func__, (uintmax_t)q)); q = q / 1024; - DPRINTF(sc, 1, ("%s: Refresh humidity Q 2: %lld\n", __func__, q)); + DPRINTF(sc, 1, ("%s: Refresh humidity Q 2: %jd\n", __func__, (uintmax_t)q)); edata->value_cur = (uint32_t) q; edata->state = ENVSYS_SVALID;
CVS commit: src/sys/dev/i2c
Module Name:src Committed By: brad Date: Thu Dec 1 02:29:37 UTC 2022 Modified Files: src/sys/dev/i2c: bmx280.c Log Message: Use a better choice for the print format string. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/i2c/bmx280.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/sys
Module Name:src Committed By: ryo Date: Thu Dec 1 00:48:05 UTC 2022 Modified Files: src/sys/sys: param.h Log Message: tprof module revamped. Welcome to 9.99.108 To generate a diff of this commit: cvs rdiff -u -r1.720 -r1.721 src/sys/sys/param.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/sys/param.h diff -u src/sys/sys/param.h:1.720 src/sys/sys/param.h:1.721 --- src/sys/sys/param.h:1.720 Fri Nov 25 08:40:15 2022 +++ src/sys/sys/param.h Thu Dec 1 00:48:05 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.720 2022/11/25 08:40:15 knakahara Exp $ */ +/* $NetBSD: param.h,v 1.721 2022/12/01 00:48:05 ryo Exp $ */ /*- * Copyright (c) 1982, 1986, 1989, 1993 @@ -67,7 +67,7 @@ * 2.99.9 (299000900) */ -#define __NetBSD_Version__ 999010700 /* NetBSD 9.99.107 */ +#define __NetBSD_Version__ 999010800 /* NetBSD 9.99.108 */ #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \ (m) * 100) + (p) * 100) <= __NetBSD_Version__)
CVS commit: src/sys/sys
Module Name:src Committed By: ryo Date: Thu Dec 1 00:48:05 UTC 2022 Modified Files: src/sys/sys: param.h Log Message: tprof module revamped. Welcome to 9.99.108 To generate a diff of this commit: cvs rdiff -u -r1.720 -r1.721 src/sys/sys/param.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/i2c
Module Name:src Committed By: brad Date: Thu Dec 1 00:47:51 UTC 2022 Modified Files: src/sys/dev/i2c: bmx280.c Log Message: Correct the humidity conversion for the BME280 To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/i2c/bmx280.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/i2c/bmx280.c diff -u src/sys/dev/i2c/bmx280.c:1.4 src/sys/dev/i2c/bmx280.c:1.5 --- src/sys/dev/i2c/bmx280.c:1.4 Thu Nov 24 21:07:05 2022 +++ src/sys/dev/i2c/bmx280.c Thu Dec 1 00:47:51 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: bmx280.c,v 1.4 2022/11/24 21:07:05 brad Exp $ */ +/* $NetBSD: bmx280.c,v 1.5 2022/12/01 00:47:51 brad Exp $ */ /* * Copyright (c) 2022 Brad Spencer @@ -17,7 +17,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: bmx280.c,v 1.4 2022/11/24 21:07:05 brad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bmx280.c,v 1.5 2022/12/01 00:47:51 brad Exp $"); /* Driver for the Bosch BMP280/BME280 temperature, humidity (sometimes) and @@ -277,8 +277,7 @@ bmx280_store_raw_blob_h(struct bmx280_sc sc->sc_cal_blob.dig_H2 = (int16_t)b[2] << 8; sc->sc_cal_blob.dig_H2 = sc->sc_cal_blob.dig_H2 | (int16_t)b[1]; sc->sc_cal_blob.dig_H3 = (uint8_t)b[3]; - sc->sc_cal_blob.dig_H4 = ((int16_t)b[5] & 0x000f) << 8; - sc->sc_cal_blob.dig_H4 = sc->sc_cal_blob.dig_H4 | (int16_t)b[4]; + sc->sc_cal_blob.dig_H4 = ((int16_t)((b[4] << 4) | (b[5] & 0x0F))); sc->sc_cal_blob.dig_H5 = (int16_t)b[6] << 4; sc->sc_cal_blob.dig_H5 = sc->sc_cal_blob.dig_H5 | (((int16_t)b[5] & 0x00f0) >> 4); sc->sc_cal_blob.dig_H6 = (int8_t)b[7]; @@ -566,6 +565,13 @@ bmx280_attach(device_t parent, device_t error); } + if (sc->sc_bmx280debug > 0) { + for(int _d = 0;_d < 24;_d++) { + DPRINTF(sc, 0, ("%s: %d %02x\n", + device_xname(sc->sc_dev), _d, raw_blob_tp[_d])); + } + } + bmx280_store_raw_blob_tp(sc,raw_blob_tp); if (sc->sc_has_humidity) { @@ -585,6 +591,13 @@ bmx280_attach(device_t parent, device_t error); } + if (sc->sc_bmx280debug > 0) { + for(int _d = 0;_d < 8;_d++) { +DPRINTF(sc, 0, ("%s: %d %02x\n", +device_xname(sc->sc_dev), _d, raw_blob_h[_d])); + } + } + bmx280_store_raw_blob_h(sc,raw_blob_h); } @@ -1049,15 +1062,15 @@ bmx280_refresh(struct sysmon_envsys * sm DPRINTF(sc, 2, ("%s: Refresh compensated humidity: %d\n", device_xname(sc->sc_dev), comp_hum)); - uint32_t q; + uint64_t q; - q = comp_hum; + q = (uint64_t)comp_hum * 100; + DPRINTF(sc, 1, ("%s: Refresh humidity Q 1: %lld\n", __func__, q)); q = q / 1024; - q = q * 100; /* XXX - this probably is not correct */ - DPRINTF(sc, 1, ("%s: Refresh humidity Q: %d\n", __func__, q)); + DPRINTF(sc, 1, ("%s: Refresh humidity Q 2: %lld\n", __func__, q)); - edata->value_cur = q; + edata->value_cur = (uint32_t) q; edata->state = ENVSYS_SVALID; } }
CVS commit: src/sys/dev/i2c
Module Name:src Committed By: brad Date: Thu Dec 1 00:47:51 UTC 2022 Modified Files: src/sys/dev/i2c: bmx280.c Log Message: Correct the humidity conversion for the BME280 To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/i2c/bmx280.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/tprof
Module Name:src Committed By: ryo Date: Thu Dec 1 00:43:27 UTC 2022 Modified Files: src/usr.sbin/tprof: Makefile ksyms.c ksyms.h tprof.8 tprof.c tprof.h tprof_analyze.c Added Files: src/usr.sbin/tprof: tprof_top.c Log Message: add "top" subcommand to tprof(8) To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/tprof/Makefile cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/tprof/ksyms.c \ src/usr.sbin/tprof/ksyms.h cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/tprof/tprof.8 cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/tprof/tprof.c cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/tprof/tprof.h cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/tprof/tprof_analyze.c cvs rdiff -u -r0 -r1.1 src/usr.sbin/tprof/tprof_top.c 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/tprof/Makefile diff -u src/usr.sbin/tprof/Makefile:1.11 src/usr.sbin/tprof/Makefile:1.12 --- src/usr.sbin/tprof/Makefile:1.11 Thu Dec 1 00:41:10 2022 +++ src/usr.sbin/tprof/Makefile Thu Dec 1 00:43:27 2022 @@ -1,10 +1,10 @@ -# $NetBSD: Makefile,v 1.11 2022/12/01 00:41:10 ryo Exp $ +# $NetBSD: Makefile,v 1.12 2022/12/01 00:43:27 ryo Exp $ .PATH: ${.CURDIR}/arch PROG= tprof MAN= tprof.8 -SRCS= tprof.c tprof_analyze.c ksyms.c +SRCS= tprof.c tprof_analyze.c tprof_top.c ksyms.c .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64" SRCS+= tprof_x86.c @@ -19,9 +19,11 @@ SRCS+= tprof_noarch.c CPPFLAGS+= -I${NETBSDSRCDIR}/sys/ LDADD+= -lpthread +LDADD+= -lm LDADD+= -lelf LDADD+= -lutil DPADD+= ${LIBPTHREAD} +DPADD+= ${LIBM} DPADD+= ${LIBELF} DPADD+= ${LIBUTIL} Index: src/usr.sbin/tprof/ksyms.c diff -u src/usr.sbin/tprof/ksyms.c:1.1 src/usr.sbin/tprof/ksyms.c:1.2 --- src/usr.sbin/tprof/ksyms.c:1.1 Thu Dec 1 00:41:10 2022 +++ src/usr.sbin/tprof/ksyms.c Thu Dec 1 00:43:27 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: ksyms.c,v 1.1 2022/12/01 00:41:10 ryo Exp $ */ +/* $NetBSD: ksyms.c,v 1.2 2022/12/01 00:43:27 ryo Exp $ */ /* * Copyright (c) 2010,2011,2012 YAMAMOTO Takashi, @@ -28,7 +28,7 @@ #include #ifndef lint -__RCSID("$NetBSD: ksyms.c,v 1.1 2022/12/01 00:41:10 ryo Exp $"); +__RCSID("$NetBSD: ksyms.c,v 1.2 2022/12/01 00:43:27 ryo Exp $"); #endif /* not lint */ #include @@ -43,8 +43,8 @@ __RCSID("$NetBSD: ksyms.c,v 1.1 2022/12/ #include #include "ksyms.h" -struct sym **syms = NULL; -size_t nsyms = 0; +static struct sym **syms = NULL; +static size_t nsyms = 0; static int compare_value(const void *p1, const void *p2) @@ -69,8 +69,8 @@ compare_value(const void *p1, const void return strcmp(s1->name, s2->name); } -void -ksymload(void) +struct sym ** +ksymload(size_t *nsymp) { Elf *e; Elf_Scn *s; @@ -132,13 +132,15 @@ ksymload(void) elf_end(e); close(fd); qsort(syms, nsyms, sizeof(*syms), compare_value); - return; + if (nsymp != NULL) + *nsymp = nsyms; + return syms; elffail: errx(EXIT_FAILURE, "libelf: %s", elf_errmsg(elf_errno())); } const char * -ksymlookup(uint64_t value, uint64_t *offset) +ksymlookup(uint64_t value, uint64_t *offset, size_t *n) { size_t hi; size_t lo; @@ -171,6 +173,8 @@ ksymlookup(uint64_t value, uint64_t *off if (sym->value <= value && (sym->size == 0 || value - sym->value <= sym->size )) { *offset = value - sym->value; + if (n != NULL) +*n = i; return sym->name; } if (sym->size != 0 && sym->value + sym->size < value) { Index: src/usr.sbin/tprof/ksyms.h diff -u src/usr.sbin/tprof/ksyms.h:1.1 src/usr.sbin/tprof/ksyms.h:1.2 --- src/usr.sbin/tprof/ksyms.h:1.1 Thu Dec 1 00:41:10 2022 +++ src/usr.sbin/tprof/ksyms.h Thu Dec 1 00:43:27 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: ksyms.h,v 1.1 2022/12/01 00:41:10 ryo Exp $ */ +/* $NetBSD: ksyms.h,v 1.2 2022/12/01 00:43:27 ryo Exp $ */ /* * Copyright (c) 2010,2011,2012 YAMAMOTO Takashi, @@ -35,10 +35,7 @@ struct sym { uint64_t size; }; -extern struct sym **syms; -extern size_t nsyms; - -void ksymload(void); -const char *ksymlookup(uint64_t, uint64_t *); +struct sym **ksymload(size_t *); +const char *ksymlookup(uint64_t, uint64_t *, size_t *); #endif /* _KSYMS_H_ */ Index: src/usr.sbin/tprof/tprof.8 diff -u src/usr.sbin/tprof/tprof.8:1.18 src/usr.sbin/tprof/tprof.8:1.19 --- src/usr.sbin/tprof/tprof.8:1.18 Thu Dec 1 00:40:05 2022 +++ src/usr.sbin/tprof/tprof.8 Thu Dec 1 00:43:27 2022 @@ -1,4 +1,4 @@ -.\" $NetBSD: tprof.8,v 1.18 2022/12/01 00:40:05 ryo Exp $ +.\" $NetBSD: tprof.8,v 1.19 2022/12/01 00:43:27 ryo Exp $ .\" .\" Copyright (c)2011 YAMAMOTO Takashi, .\" All rights reserved. @@ -130,6 +130,39 @@ and ignore the rest. .It Fl s Per symbol. .El +.It top Xo +.Oo +.Fl e +.Ar name[,value] +.Op Fl e Ar ... +.Oc +.Op Fl i Ar interval +.Op Fl c +.Op Fl u +.Xc +Displays profiling results in real-time. +.Ar name +specifies the name of the event to count. +.Ar value +specifies the ratio of the speed to the cycle counter, or the counter until +overflow.
CVS commit: src/usr.sbin/tprof
Module Name:src Committed By: ryo Date: Thu Dec 1 00:43:27 UTC 2022 Modified Files: src/usr.sbin/tprof: Makefile ksyms.c ksyms.h tprof.8 tprof.c tprof.h tprof_analyze.c Added Files: src/usr.sbin/tprof: tprof_top.c Log Message: add "top" subcommand to tprof(8) To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/tprof/Makefile cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/tprof/ksyms.c \ src/usr.sbin/tprof/ksyms.h cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/tprof/tprof.8 cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/tprof/tprof.c cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/tprof/tprof.h cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/tprof/tprof_analyze.c cvs rdiff -u -r0 -r1.1 src/usr.sbin/tprof/tprof_top.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/tprof
Module Name:src Committed By: ryo Date: Thu Dec 1 00:41:10 UTC 2022 Modified Files: src/usr.sbin/tprof: Makefile tprof_analyze.c Added Files: src/usr.sbin/tprof: ksyms.c ksyms.h Log Message: split ksyms stuff into ksyms.[ch] To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/tprof/Makefile cvs rdiff -u -r0 -r1.1 src/usr.sbin/tprof/ksyms.c src/usr.sbin/tprof/ksyms.h cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/tprof/tprof_analyze.c 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/tprof/Makefile diff -u src/usr.sbin/tprof/Makefile:1.10 src/usr.sbin/tprof/Makefile:1.11 --- src/usr.sbin/tprof/Makefile:1.10 Tue Nov 17 10:47:17 2020 +++ src/usr.sbin/tprof/Makefile Thu Dec 1 00:41:10 2022 @@ -1,10 +1,10 @@ -# $NetBSD: Makefile,v 1.10 2020/11/17 10:47:17 rin Exp $ +# $NetBSD: Makefile,v 1.11 2022/12/01 00:41:10 ryo Exp $ .PATH: ${.CURDIR}/arch PROG= tprof MAN= tprof.8 -SRCS= tprof.c tprof_analyze.c +SRCS= tprof.c tprof_analyze.c ksyms.c .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64" SRCS+= tprof_x86.c Index: src/usr.sbin/tprof/tprof_analyze.c diff -u src/usr.sbin/tprof/tprof_analyze.c:1.6 src/usr.sbin/tprof/tprof_analyze.c:1.7 --- src/usr.sbin/tprof/tprof_analyze.c:1.6 Thu Dec 1 00:32:52 2022 +++ src/usr.sbin/tprof/tprof_analyze.c Thu Dec 1 00:41:10 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tprof_analyze.c,v 1.6 2022/12/01 00:32:52 ryo Exp $ */ +/* $NetBSD: tprof_analyze.c,v 1.7 2022/12/01 00:41:10 ryo Exp $ */ /* * Copyright (c) 2010,2011,2012 YAMAMOTO Takashi, @@ -28,7 +28,7 @@ #include #ifndef lint -__RCSID("$NetBSD: tprof_analyze.c,v 1.6 2022/12/01 00:32:52 ryo Exp $"); +__RCSID("$NetBSD: tprof_analyze.c,v 1.7 2022/12/01 00:41:10 ryo Exp $"); #endif /* not lint */ #include @@ -46,8 +46,7 @@ __RCSID("$NetBSD: tprof_analyze.c,v 1.6 #include #include #include "tprof.h" - -#define _PATH_KSYMS "/dev/ksyms" +#include "ksyms.h" #include @@ -68,147 +67,6 @@ struct addr { static rb_tree_t addrtree; -struct sym { - char *name; - uint64_t value; - uint64_t size; -}; - -static struct sym **syms = NULL; -static size_t nsyms = 0; - -static int -compare_value(const void *p1, const void *p2) -{ - const struct sym *s1 = *(const struct sym * const *)p1; - const struct sym *s2 = *(const struct sym * const *)p2; - - if (s1->value > s2->value) { - return -1; - } else if (s1->value < s2->value) { - return 1; - } - /* - * to produce a stable result, it's better not to return 0 - * even for __strong_alias. - */ - if (s1->size > s2->size) { - return -1; - } else if (s1->size < s2->size) { - return 1; - } - return strcmp(s1->name, s2->name); -} - -static void -ksymload(void) -{ - Elf *e; - Elf_Scn *s; - GElf_Shdr sh_store; - GElf_Shdr *sh; - Elf_Data *d; - int fd; - size_t size, i; - - fd = open(_PATH_KSYMS, O_RDONLY); - if (fd == -1) { - err(EXIT_FAILURE, "open " _PATH_KSYMS); - } - if (elf_version(EV_CURRENT) == EV_NONE) { - goto elffail; - } - e = elf_begin(fd, ELF_C_READ, NULL); - if (e == NULL) { - goto elffail; - } - for (s = elf_nextscn(e, NULL); s != NULL; s = elf_nextscn(e, s)) { - sh = gelf_getshdr(s, _store); - if (sh == NULL) { - goto elffail; - } - if (sh->sh_type == SHT_SYMTAB) { - break; - } - } - if (s == NULL) { - errx(EXIT_FAILURE, "no symtab"); - } - d = elf_getdata(s, NULL); - if (d == NULL) { - goto elffail; - } - assert(sh->sh_size == d->d_size); - size = sh->sh_size / sh->sh_entsize; - for (i = 1; i < size; i++) { - GElf_Sym st_store; - GElf_Sym *st; - struct sym *sym; - - st = gelf_getsym(d, (int)i, _store); - if (st == NULL) { - goto elffail; - } - if (ELF_ST_TYPE(st->st_info) != STT_FUNC) { - continue; - } - sym = emalloc(sizeof(*sym)); - sym->name = estrdup(elf_strptr(e, sh->sh_link, st->st_name)); - sym->value = (uint64_t)st->st_value; - sym->size = st->st_size; - nsyms++; - syms = erealloc(syms, sizeof(*syms) * nsyms); - syms[nsyms - 1] = sym; - } - qsort(syms, nsyms, sizeof(*syms), compare_value); - return; -elffail: - errx(EXIT_FAILURE, "libelf: %s", elf_errmsg(elf_errno())); -} - -static const char * -ksymlookup(uint64_t value, uint64_t *offset) -{ - size_t hi; - size_t lo; - size_t i; - - /* - * try to find the smallest i for which syms[i]->value <= value. - * syms[] is ordered by syms[]->value in the descending order. - */ - - hi = nsyms - 1; - lo = 0; - while (lo < hi) { - const size_t mid = (lo + hi) / 2; - const struct sym *sym = syms[mid]; - - assert(syms[lo]->value >= sym->value); - assert(sym->value >= syms[hi]->value); - if (sym->value <= value) { - hi = mid; - continue; - } - lo = mid + 1; - } - assert(lo == nsyms - 1 || syms[lo]->value <= value); - assert(lo == 0 || syms[lo - 1]->value > value); - for (i = lo; i < nsyms; i++) { - const struct sym *sym = syms[i]; - - if (sym->value <= value && - (sym->size == 0 || value -
CVS commit: src/usr.sbin/tprof
Module Name:src Committed By: ryo Date: Thu Dec 1 00:41:10 UTC 2022 Modified Files: src/usr.sbin/tprof: Makefile tprof_analyze.c Added Files: src/usr.sbin/tprof: ksyms.c ksyms.h Log Message: split ksyms stuff into ksyms.[ch] To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/tprof/Makefile cvs rdiff -u -r0 -r1.1 src/usr.sbin/tprof/ksyms.c src/usr.sbin/tprof/ksyms.h cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/tprof/tprof_analyze.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/tprof
Module Name:src Committed By: ryo Date: Thu Dec 1 00:40:05 UTC 2022 Modified Files: src/usr.sbin/tprof: tprof.8 tprof.c Log Message: Improve tprof(8) - Added "tprof count" subcommand to perform counts only. - Event options (u,k) are now optional. The default value is both userland and kernel. (:uk) - Event counters can be displayed with SIGINFO during `tprof monitor' or `tprof count'. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/tprof/tprof.8 cvs rdiff -u -r1.14 -r1.15 src/usr.sbin/tprof/tprof.c 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/tprof/tprof.8 diff -u src/usr.sbin/tprof/tprof.8:1.17 src/usr.sbin/tprof/tprof.8:1.18 --- src/usr.sbin/tprof/tprof.8:1.17 Thu Dec 1 00:32:52 2022 +++ src/usr.sbin/tprof/tprof.8 Thu Dec 1 00:40:05 2022 @@ -1,4 +1,4 @@ -.\" $NetBSD: tprof.8,v 1.17 2022/12/01 00:32:52 ryo Exp $ +.\" $NetBSD: tprof.8,v 1.18 2022/12/01 00:40:05 ryo Exp $ .\" .\" Copyright (c)2011 YAMAMOTO Takashi, .\" All rights reserved. @@ -66,7 +66,7 @@ Valid actions are: Display a list of performance counter events available on the system. .It monitor Xo .Fl e -.Ar name:option +.Ar name[:option] .Op Fl e Ar ... .Op Fl o Ar outfile .Ar command @@ -81,12 +81,25 @@ specifies the source of the event; it mu .Ar u (userland) and .Ar k -(kernel). +(kernel). If omitted, it is assumed that both are specified. The collected samples are written into the file .Ar outfile if specified. The default is .Dq Pa tprof.out . +.It count Xo +.Fl e +.Ar name[:option] +.Op Fl e Ar ... +.Op Fl i Ar interval +.Ar command +.Xc +Same as +.Ar monitor , +but does not do any profiling, +only outputs counters every +.Ar interval +second. .It analyze Xo .Op Fl CkLPs .Op Fl p Ar pid Index: src/usr.sbin/tprof/tprof.c diff -u src/usr.sbin/tprof/tprof.c:1.14 src/usr.sbin/tprof/tprof.c:1.15 --- src/usr.sbin/tprof/tprof.c:1.14 Thu Dec 1 00:32:52 2022 +++ src/usr.sbin/tprof/tprof.c Thu Dec 1 00:40:05 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tprof.c,v 1.14 2022/12/01 00:32:52 ryo Exp $ */ +/* $NetBSD: tprof.c,v 1.15 2022/12/01 00:40:05 ryo Exp $ */ /* * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -57,10 +57,12 @@ #include #ifndef lint -__RCSID("$NetBSD: tprof.c,v 1.14 2022/12/01 00:32:52 ryo Exp $"); +__RCSID("$NetBSD: tprof.c,v 1.15 2022/12/01 00:40:05 ryo Exp $"); #endif /* not lint */ +#include #include +#include #include #include @@ -69,13 +71,16 @@ __RCSID("$NetBSD: tprof.c,v 1.14 2022/12 #include #include #include +#include #include #include #include #include #include #include +#include #include +#include #include "tprof.h" #define _PATH_TPROF "/dev/tprof" @@ -84,10 +89,17 @@ struct tprof_info tprof_info; u_int ncounters; int devfd; int outfd; +int ncpu; u_int nevent; +double interval = 0x; /* XXX */ +const char *eventname[TPROF_MAXCOUNTERS]; +u_int eventnamewidth[TPROF_MAXCOUNTERS]; +#define COUNTER_COLUMNS_WIDTH 11 static void tprof_list(int, char **); -static void tprof_monitor(int, char **) __dead; +static void tprof_monitor_common(bool, int, char **) __dead; +static void tprof_monitor(int, char **); +static void tprof_count(int, char **); static struct cmdtab { const char *label; @@ -97,6 +109,7 @@ static struct cmdtab { } const tprof_cmdtab[] = { { "list", false, false, tprof_list }, { "monitor", true, false, tprof_monitor }, + { "count", true, false, tprof_count }, { "analyze", true, true, tprof_analyze }, { NULL, false, false, NULL }, }; @@ -109,15 +122,33 @@ usage(void) fprintf(stderr, "\n"); fprintf(stderr, "\tlist\n"); fprintf(stderr, "\t\tList the available events.\n"); - fprintf(stderr, "\tmonitor -e name:option [-e ...] [-o outfile] command\n"); + fprintf(stderr, "\tmonitor -e name[:option] [-e ...] [-o outfile] command\n"); fprintf(stderr, "\t\tMonitor the event 'name' with option 'option'\n" "\t\tcounted during the execution of 'command'.\n"); + fprintf(stderr, "\tcount -e name[:option] [-e ...] [-i interval]" + " command\n"); + fprintf(stderr, "\t\tSame as monitor, but does not profile," + " only outputs a counter.\n"); fprintf(stderr, "\tanalyze [-CkLPs] [-p pid] file\n"); fprintf(stderr, "\t\tAnalyze the samples of the file 'file'.\n"); exit(EXIT_FAILURE); } +static int +getncpu(void) +{ + size_t size; + int mib[2]; + + mib[0] = CTL_HW; + mib[1] = HW_NCPU; + size = sizeof(ncpu); + if (sysctl(mib, 2, , , NULL, 0) == -1) + ncpu = 1; + return ncpu; +} + static void * process_samples(void *dummy) { @@ -150,13 +181,87 @@ process_samples(void *dummy) } static void +show_counters(void) +{ + unsigned int i; + int n, ret; + + fprintf(stderr, " "); + for (i = 0; i < nevent; i++) + fprintf(stderr, " %*s", eventnamewidth[i], eventname[i]); + fprintf(stderr, "\n"); + + for (n = 0; n < ncpu; n++) { + tprof_counts_t
CVS commit: src/usr.sbin/tprof
Module Name:src Committed By: ryo Date: Thu Dec 1 00:40:05 UTC 2022 Modified Files: src/usr.sbin/tprof: tprof.8 tprof.c Log Message: Improve tprof(8) - Added "tprof count" subcommand to perform counts only. - Event options (u,k) are now optional. The default value is both userland and kernel. (:uk) - Event counters can be displayed with SIGINFO during `tprof monitor' or `tprof count'. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/tprof/tprof.8 cvs rdiff -u -r1.14 -r1.15 src/usr.sbin/tprof/tprof.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: ryo Date: Thu Dec 1 00:32:52 UTC 2022 Modified Files: src/sys/arch/aarch64/include: armreg.h src/sys/dev/tprof: tprof.c tprof.h tprof_armv7.c tprof_armv8.c tprof_ioctl.h tprof_types.h tprof_x86.c tprof_x86_amd.c tprof_x86_intel.c src/usr.sbin/tprof: tprof.8 tprof.c tprof_analyze.c Log Message: Improve tprof(4) - Multiple events can now be handled simultaneously. - Counters should be configured with TPROF_IOC_CONFIGURE_EVENT in advance, instead of being configured at TPROF_IOC_START. - The configured counters can be started and stopped repeatedly by PROF_IOC_START/TPROF_IOC_STOP. - The value of the performance counter can be obtained at any timing as a 64bit value with TPROF_IOC_GETCOUNTS. - Backend common parts are handled in tprof.c as much as possible, and functions on the tprof_backend side have been reimplemented to be more primitive. - The reset value of counter overflows for profiling can now be adjusted. It is calculated by default from the CPU clock (speed of cycle counter) and TPROF_HZ, but for some events the value may be too large to be sufficient for profiling. The event counter can be specified as a ratio to the default or as an absolute value when configuring the event counter. - Due to overall changes, API and ABI have been changed. TPROF_VERSION and TPROF_BACKEND_VERSION were updated. To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 src/sys/arch/aarch64/include/armreg.h cvs rdiff -u -r1.18 -r1.19 src/sys/dev/tprof/tprof.c cvs rdiff -u -r1.6 -r1.7 src/sys/dev/tprof/tprof.h cvs rdiff -u -r1.9 -r1.10 src/sys/dev/tprof/tprof_armv7.c cvs rdiff -u -r1.17 -r1.18 src/sys/dev/tprof/tprof_armv8.c cvs rdiff -u -r1.4 -r1.5 src/sys/dev/tprof/tprof_ioctl.h \ src/sys/dev/tprof/tprof_x86_intel.c cvs rdiff -u -r1.5 -r1.6 src/sys/dev/tprof/tprof_types.h \ src/sys/dev/tprof/tprof_x86_amd.c cvs rdiff -u -r1.1 -r1.2 src/sys/dev/tprof/tprof_x86.c cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/tprof/tprof.8 cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/tprof/tprof.c cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/tprof/tprof_analyze.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/arch/aarch64/include/armreg.h diff -u src/sys/arch/aarch64/include/armreg.h:1.62 src/sys/arch/aarch64/include/armreg.h:1.63 --- src/sys/arch/aarch64/include/armreg.h:1.62 Thu Dec 1 00:29:10 2022 +++ src/sys/arch/aarch64/include/armreg.h Thu Dec 1 00:32:52 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: armreg.h,v 1.62 2022/12/01 00:29:10 ryo Exp $ */ +/* $NetBSD: armreg.h,v 1.63 2022/12/01 00:32:52 ryo Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -248,6 +248,10 @@ AARCH64REG_READ_INLINE(id_aa64dfr0_el1) #define ID_AA64DFR0_EL1_PMUVER_NONE 0 #define ID_AA64DFR0_EL1_PMUVER_V3 1 #define ID_AA64DFR0_EL1_PMUVER_NOV3 2 +#define ID_AA64DFR0_EL1_PMUVER_V3P1 4 +#define ID_AA64DFR0_EL1_PMUVER_V3P4 5 +#define ID_AA64DFR0_EL1_PMUVER_V3P5 6 +#define ID_AA64DFR0_EL1_PMUVER_V3P7 7 #define ID_AA64DFR0_EL1_PMUVER_IMPL 15 #define ID_AA64DFR0_EL1_TRACEVER __BITS(4,7) #define ID_AA64DFR0_EL1_TRACEVER_NONE 0 @@ -1221,6 +1225,7 @@ AARCH64REG_WRITE_INLINE(pmcr_el0) #define PMCR_IMP __BITS(31,24) // Implementor code #define PMCR_IDCODE __BITS(23,16) // Identification code #define PMCR_N __BITS(15,11) // Number of event counters +#define PMCR_LP __BIT(7) // Long event counter enable #define PMCR_LC __BIT(6) // Long cycle counter enable #define PMCR_DP __BIT(5) // Disable cycle counter when event // counting is prohibited Index: src/sys/dev/tprof/tprof.c diff -u src/sys/dev/tprof/tprof.c:1.18 src/sys/dev/tprof/tprof.c:1.19 --- src/sys/dev/tprof/tprof.c:1.18 Thu Dec 1 00:27:59 2022 +++ src/sys/dev/tprof/tprof.c Thu Dec 1 00:32:52 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tprof.c,v 1.18 2022/12/01 00:27:59 ryo Exp $ */ +/* $NetBSD: tprof.c,v 1.19 2022/12/01 00:32:52 ryo Exp $ */ /*- * Copyright (c)2008,2009,2010 YAMAMOTO Takashi, @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tprof.c,v 1.18 2022/12/01 00:27:59 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tprof.c,v 1.19 2022/12/01 00:32:52 ryo Exp $"); #include #include @@ -42,12 +42,17 @@ __KERNEL_RCSID(0, "$NetBSD: tprof.c,v 1. #include #include #include +#include #include #include #include "ioconf.h" +#ifndef TPROF_HZ +#define TPROF_HZ 1 +#endif + /* * locking order: * tprof_reader_lock -> tprof_lock @@ -73,7 +78,7 @@ typedef struct tprof_buf { } tprof_buf_t; #define TPROF_BUF_BYTESIZE(sz) \ (sizeof(tprof_buf_t) + (sz) * sizeof(tprof_sample_t)) -#define TPROF_MAX_SAMPLES_PER_BUF 1 +#define TPROF_MAX_SAMPLES_PER_BUF (TPROF_HZ * 2) #define TPROF_MAX_BUF 100 @@ -85,14 +90,20 @@ typedef struct { } __aligned(CACHE_LINE_SIZE) tprof_cpu_t; typedef struct tprof_backend { + /* + *
CVS commit: src
Module Name:src Committed By: ryo Date: Thu Dec 1 00:32:52 UTC 2022 Modified Files: src/sys/arch/aarch64/include: armreg.h src/sys/dev/tprof: tprof.c tprof.h tprof_armv7.c tprof_armv8.c tprof_ioctl.h tprof_types.h tprof_x86.c tprof_x86_amd.c tprof_x86_intel.c src/usr.sbin/tprof: tprof.8 tprof.c tprof_analyze.c Log Message: Improve tprof(4) - Multiple events can now be handled simultaneously. - Counters should be configured with TPROF_IOC_CONFIGURE_EVENT in advance, instead of being configured at TPROF_IOC_START. - The configured counters can be started and stopped repeatedly by PROF_IOC_START/TPROF_IOC_STOP. - The value of the performance counter can be obtained at any timing as a 64bit value with TPROF_IOC_GETCOUNTS. - Backend common parts are handled in tprof.c as much as possible, and functions on the tprof_backend side have been reimplemented to be more primitive. - The reset value of counter overflows for profiling can now be adjusted. It is calculated by default from the CPU clock (speed of cycle counter) and TPROF_HZ, but for some events the value may be too large to be sufficient for profiling. The event counter can be specified as a ratio to the default or as an absolute value when configuring the event counter. - Due to overall changes, API and ABI have been changed. TPROF_VERSION and TPROF_BACKEND_VERSION were updated. To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 src/sys/arch/aarch64/include/armreg.h cvs rdiff -u -r1.18 -r1.19 src/sys/dev/tprof/tprof.c cvs rdiff -u -r1.6 -r1.7 src/sys/dev/tprof/tprof.h cvs rdiff -u -r1.9 -r1.10 src/sys/dev/tprof/tprof_armv7.c cvs rdiff -u -r1.17 -r1.18 src/sys/dev/tprof/tprof_armv8.c cvs rdiff -u -r1.4 -r1.5 src/sys/dev/tprof/tprof_ioctl.h \ src/sys/dev/tprof/tprof_x86_intel.c cvs rdiff -u -r1.5 -r1.6 src/sys/dev/tprof/tprof_types.h \ src/sys/dev/tprof/tprof_x86_amd.c cvs rdiff -u -r1.1 -r1.2 src/sys/dev/tprof/tprof_x86.c cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/tprof/tprof.8 cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/tprof/tprof.c cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/tprof/tprof_analyze.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/tprof
Module Name:src Committed By: ryo Date: Thu Dec 1 00:29:51 UTC 2022 Modified Files: src/sys/dev/tprof: tprof_armv7.c Log Message: tprof_armv7 initializes on each CPUs, like tprof_armv8. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/dev/tprof/tprof_armv7.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/tprof
Module Name:src Committed By: ryo Date: Thu Dec 1 00:29:51 UTC 2022 Modified Files: src/sys/dev/tprof: tprof_armv7.c Log Message: tprof_armv7 initializes on each CPUs, like tprof_armv8. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/dev/tprof/tprof_armv7.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/tprof/tprof_armv7.c diff -u src/sys/dev/tprof/tprof_armv7.c:1.8 src/sys/dev/tprof/tprof_armv7.c:1.9 --- src/sys/dev/tprof/tprof_armv7.c:1.8 Thu Dec 1 00:29:10 2022 +++ src/sys/dev/tprof/tprof_armv7.c Thu Dec 1 00:29:51 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tprof_armv7.c,v 1.8 2022/12/01 00:29:10 ryo Exp $ */ +/* $NetBSD: tprof_armv7.c,v 1.9 2022/12/01 00:29:51 ryo Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tprof_armv7.c,v 1.8 2022/12/01 00:29:10 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tprof_armv7.c,v 1.9 2022/12/01 00:29:51 ryo Exp $"); #include #include @@ -258,8 +258,8 @@ armv7_pmu_intr(void *priv) return 1; } -int -armv7_pmu_init(void) +static void +armv7_pmu_init_cpu(void *arg1, void *arg2) { /* Disable user mode access to performance monitors */ armreg_pmuserenr_write(0); @@ -269,6 +269,13 @@ armv7_pmu_init(void) /* Disable counters */ armreg_pmcntenclr_write(PMCNTEN_P); +} + +int +armv7_pmu_init(void) +{ + uint64_t xc = xc_broadcast(0, armv7_pmu_init_cpu, NULL, NULL); + xc_wait(xc); return tprof_backend_register("tprof_armv7", _armv7_pmu_ops, TPROF_BACKEND_VERSION);
CVS commit: src/sys
Module Name:src Committed By: ryo Date: Thu Dec 1 00:29:10 UTC 2022 Modified Files: src/sys/arch/aarch64/include: armreg.h src/sys/dev/tprof: tprof_armv7.c tprof_armv8.c Log Message: PMCR.E should not be disabled from tprof. PMCR.E controls not only performance event counters but also the cycle counter operation, and the cycle counter may be used for cpu_counter. Similarly, the 31st bit in PMINTENCLR and PMCNTENCLR controls the cycle counter, not performance event counters, and should not be modified. To generate a diff of this commit: cvs rdiff -u -r1.61 -r1.62 src/sys/arch/aarch64/include/armreg.h cvs rdiff -u -r1.7 -r1.8 src/sys/dev/tprof/tprof_armv7.c cvs rdiff -u -r1.16 -r1.17 src/sys/dev/tprof/tprof_armv8.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/arch/aarch64/include/armreg.h diff -u src/sys/arch/aarch64/include/armreg.h:1.61 src/sys/arch/aarch64/include/armreg.h:1.62 --- src/sys/arch/aarch64/include/armreg.h:1.61 Mon May 2 10:13:15 2022 +++ src/sys/arch/aarch64/include/armreg.h Thu Dec 1 00:29:10 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: armreg.h,v 1.61 2022/05/02 10:13:15 skrll Exp $ */ +/* $NetBSD: armreg.h,v 1.62 2022/12/01 00:29:10 ryo Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -1250,10 +1250,16 @@ AARCH64REG_WRITE_INLINE(pmevtyper1_el0) AARCH64REG_WRITE_INLINE(pmintenclr_el1) AARCH64REG_WRITE_INLINE(pmintenset_el1) +#define PMINTEN_C __BIT(31) // for the cycle counter +#define PMINTEN_P __BITS(30,0) // for event counters (0-30) + AARCH64REG_WRITE_INLINE(pmovsclr_el0) AARCH64REG_READ_INLINE(pmovsset_el0) AARCH64REG_WRITE_INLINE(pmovsset_el0) +#define PMOVS_C __BIT(31) // for the cycle counter +#define PMOVS_P __BITS(30,0) // for event counters (0-30) + AARCH64REG_WRITE_INLINE(pmselr_el0) AARCH64REG_WRITE_INLINE(pmswinc_el0) Index: src/sys/dev/tprof/tprof_armv7.c diff -u src/sys/dev/tprof/tprof_armv7.c:1.7 src/sys/dev/tprof/tprof_armv7.c:1.8 --- src/sys/dev/tprof/tprof_armv7.c:1.7 Tue Nov 1 11:03:01 2022 +++ src/sys/dev/tprof/tprof_armv7.c Thu Dec 1 00:29:10 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tprof_armv7.c,v 1.7 2022/11/01 11:03:01 jmcneill Exp $ */ +/* $NetBSD: tprof_armv7.c,v 1.8 2022/12/01 00:29:10 ryo Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tprof_armv7.c,v 1.7 2022/11/01 11:03:01 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tprof_armv7.c,v 1.8 2022/12/01 00:29:10 ryo Exp $"); #include #include @@ -45,6 +45,11 @@ __KERNEL_RCSID(0, "$NetBSD: tprof_armv7. #define PMCR_D __BIT(3) #define PMCR_E __BIT(0) +#define PMINTEN_C __BIT(31) +#define PMINTEN_P __BITS(30,0) +#define PMCNTEN_C __BIT(31) +#define PMCNTEN_P __BITS(30,0) + #define PMEVTYPER_P __BIT(31) #define PMEVTYPER_U __BIT(30) #define PMEVTYPER_EVTCOUNT __BITS(7,0) @@ -161,18 +166,12 @@ static void armv7_pmu_stop_cpu(void *arg1, void *arg2) { const uint32_t counter_mask = __BIT(armv7_pmu_counter); - uint32_t pmcr; /* Disable overflow interrupts */ armreg_pmintenclr_write(counter_mask); /* Disable event counter */ armreg_pmcntenclr_write(counter_mask); - - /* Disable performance monitor */ - pmcr = armreg_pmcr_read(); - pmcr &= ~PMCR_E; - armreg_pmcr_write(pmcr); } static uint64_t @@ -266,13 +265,10 @@ armv7_pmu_init(void) armreg_pmuserenr_write(0); /* Disable interrupts */ - armreg_pmintenclr_write(~0U); + armreg_pmintenclr_write(PMINTEN_P); /* Disable counters */ - armreg_pmcntenclr_write(~0U); - - /* Disable performance monitor */ - armreg_pmcr_write(0); + armreg_pmcntenclr_write(PMCNTEN_P); return tprof_backend_register("tprof_armv7", _armv7_pmu_ops, TPROF_BACKEND_VERSION); Index: src/sys/dev/tprof/tprof_armv8.c diff -u src/sys/dev/tprof/tprof_armv8.c:1.16 src/sys/dev/tprof/tprof_armv8.c:1.17 --- src/sys/dev/tprof/tprof_armv8.c:1.16 Thu Nov 10 07:54:20 2022 +++ src/sys/dev/tprof/tprof_armv8.c Thu Dec 1 00:29:10 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tprof_armv8.c,v 1.16 2022/11/10 07:54:20 ryo Exp $ */ +/* $NetBSD: tprof_armv8.c,v 1.17 2022/12/01 00:29:10 ryo Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tprof_armv8.c,v 1.16 2022/11/10 07:54:20 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tprof_armv8.c,v 1.17 2022/12/01 00:29:10 ryo Exp $"); #include #include @@ -112,7 +112,7 @@ armv8_pmu_start_cpu(void *arg1, void *ar /* Enable event counter */ reg_pmcntenset_el0_write(counter_mask); - reg_pmcr_el0_write(PMCR_E); + reg_pmcr_el0_write(reg_pmcr_el0_read() | PMCR_E); } static void @@ -125,7 +125,6 @@ armv8_pmu_stop_cpu(void *arg1, void *arg /* Disable event counter */ reg_pmcntenclr_el0_write(counter_mask); - reg_pmcr_el0_write(0); } static uint64_t @@ -214,7 +213,7 @@ armv8_pmu_init_cpu(void *arg1, void *arg
CVS commit: src/sys
Module Name:src Committed By: ryo Date: Thu Dec 1 00:29:10 UTC 2022 Modified Files: src/sys/arch/aarch64/include: armreg.h src/sys/dev/tprof: tprof_armv7.c tprof_armv8.c Log Message: PMCR.E should not be disabled from tprof. PMCR.E controls not only performance event counters but also the cycle counter operation, and the cycle counter may be used for cpu_counter. Similarly, the 31st bit in PMINTENCLR and PMCNTENCLR controls the cycle counter, not performance event counters, and should not be modified. To generate a diff of this commit: cvs rdiff -u -r1.61 -r1.62 src/sys/arch/aarch64/include/armreg.h cvs rdiff -u -r1.7 -r1.8 src/sys/dev/tprof/tprof_armv7.c cvs rdiff -u -r1.16 -r1.17 src/sys/dev/tprof/tprof_armv8.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/tprof
Module Name:src Committed By: ryo Date: Thu Dec 1 00:27:59 UTC 2022 Modified Files: src/sys/dev/tprof: tprof.c Log Message: don't call kpreempt_{disable,enable}() from an interrupt handler. Fixed a problem in which the system would freeze if a high load (e.g., build.sh -j20) was applied while running `tprof monitor -e LsNotHaltedCyc ...' on x86. This almost eliminates the problem, but still is not enough. tprof_x86 uses NMI interrupts, which are interrupted even in splhigh(), leaving the possibility of being interrupted in the splhigh section of percpu_cpu_swap(). To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/dev/tprof/tprof.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/tprof/tprof.c diff -u src/sys/dev/tprof/tprof.c:1.17 src/sys/dev/tprof/tprof.c:1.18 --- src/sys/dev/tprof/tprof.c:1.17 Mon Mar 28 12:33:21 2022 +++ src/sys/dev/tprof/tprof.c Thu Dec 1 00:27:59 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tprof.c,v 1.17 2022/03/28 12:33:21 riastradh Exp $ */ +/* $NetBSD: tprof.c,v 1.18 2022/12/01 00:27:59 ryo Exp $ */ /*- * Copyright (c)2008,2009,2010 YAMAMOTO Takashi, @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tprof.c,v 1.17 2022/03/28 12:33:21 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tprof.c,v 1.18 2022/12/01 00:27:59 ryo Exp $"); #include #include @@ -115,9 +115,18 @@ static kcondvar_t tprof_cv; /* L: */ static struct tprof_stat tprof_stat; /* L: */ static tprof_cpu_t * +tprof_cpu_direct(struct cpu_info *ci) +{ + tprof_cpu_t **cp; + + cp = percpu_getptr_remote(tprof_cpus, ci); + return *cp; +} + +static tprof_cpu_t * tprof_cpu(struct cpu_info *ci) { - tprof_cpu_t **cp, *c; + tprof_cpu_t *c; /* * As long as xcalls are blocked -- e.g., by kpreempt_disable @@ -126,8 +135,7 @@ tprof_cpu(struct cpu_info *ci) * moved to a new buffer, but we can safely read from it. */ kpreempt_disable(); - cp = percpu_getptr_remote(tprof_cpus, ci); - c = *cp; + c = tprof_cpu_direct(ci); kpreempt_enable(); return c; @@ -433,7 +441,7 @@ tprof_backend_lookup(const char *name) void tprof_sample(void *unused, const tprof_frame_info_t *tfi) { - tprof_cpu_t * const c = tprof_curcpu(); + tprof_cpu_t * const c = tprof_cpu_direct(curcpu()); tprof_buf_t * const buf = c->c_buf; tprof_sample_t *sp; const uintptr_t pc = tfi->tfi_pc;
CVS commit: src/sys/dev/tprof
Module Name:src Committed By: ryo Date: Thu Dec 1 00:27:59 UTC 2022 Modified Files: src/sys/dev/tprof: tprof.c Log Message: don't call kpreempt_{disable,enable}() from an interrupt handler. Fixed a problem in which the system would freeze if a high load (e.g., build.sh -j20) was applied while running `tprof monitor -e LsNotHaltedCyc ...' on x86. This almost eliminates the problem, but still is not enough. tprof_x86 uses NMI interrupts, which are interrupted even in splhigh(), leaving the possibility of being interrupted in the splhigh section of percpu_cpu_swap(). To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/dev/tprof/tprof.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/lib/libcurses
Hi, r1.125 of refresh.c breaks /usr/bin/vi for me. When scrolling down long file with 'j' key and reaches the bottom line, screen is not scrolled up and new lines are displayed over the previous bottom line. Could you take a look at my problem? Thank you very much. "Brett Lymn" writes: > Module Name: src > Committed By: blymn > Date: Wed Nov 30 06:19:16 UTC 2022 > > Modified Files: > src/lib/libcurses: refresh.c > > Log Message: > When performing a scroll, check the last line of the region is the same > on virtscr and curscr because the indexes past are supposed to be > one *past* the last matching line (they may actually match if the line is > at the bottom of the screen). Iff they don't match reduce the scroll > region size by one so we don't scroll non-matching lines, also check > if the region is then 0 after the decrement and just return if it was. > > > To generate a diff of this commit: > cvs rdiff -u -r1.124 -r1.125 src/lib/libcurses/refresh.c > > Please note that diffs are not public domain; they are subject to the > copyright notices on the relevant files. > > Modified files: > > Index: src/lib/libcurses/refresh.c > diff -u src/lib/libcurses/refresh.c:1.124 src/lib/libcurses/refresh.c:1.125 > --- src/lib/libcurses/refresh.c:1.124 Wed Oct 19 06:09:27 2022 > +++ src/lib/libcurses/refresh.c Wed Nov 30 06:19:15 2022 > @@ -1,4 +1,4 @@ > -/* $NetBSD: refresh.c,v 1.124 2022/10/19 06:09:27 blymn Exp $ */ > +/* $NetBSD: refresh.c,v 1.125 2022/11/30 06:19:15 blymn Exp $ */ > > /* > * Copyright (c) 1981, 1993, 1994 > @@ -34,7 +34,7 @@ > #if 0 > static char sccsid[] = "@(#)refresh.c8.7 (Berkeley) 8/13/94"; > #else > -__RCSID("$NetBSD: refresh.c,v 1.124 2022/10/19 06:09:27 blymn Exp $"); > +__RCSID("$NetBSD: refresh.c,v 1.125 2022/11/30 06:19:15 blymn Exp $"); > #endif > #endif /* not lint */ > > @@ -1852,6 +1852,13 @@ scrolln(int starts, int startw, int curs > ox = curscr->curx; > n = starts - startw; > > + if (!lineeq(__virtscr->alines[startw]->line, > + curscr->alines[starts]->line, (size_t) __virtscr->maxx)) > + n--; > + > + if (n == 0) > + return; > + > /* >* XXX >* The initial tests that set __noqch don't let us reach here unless > -- Ryo ONODERA // r...@tetera.org PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB FD1B F404 27FA C7D1 15F3
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Wed Nov 30 20:59:28 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: tree.c Log Message: lint: add measurement unit to local variable names No binary change, except for line numbers in assertions. To generate a diff of this commit: cvs rdiff -u -r1.483 -r1.484 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/xlint/lint1/tree.c diff -u src/usr.bin/xlint/lint1/tree.c:1.483 src/usr.bin/xlint/lint1/tree.c:1.484 --- src/usr.bin/xlint/lint1/tree.c:1.483 Sat Oct 1 10:07:55 2022 +++ src/usr.bin/xlint/lint1/tree.c Wed Nov 30 20:59:28 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: tree.c,v 1.483 2022/10/01 10:07:55 rillig Exp $ */ +/* $NetBSD: tree.c,v 1.484 2022/11/30 20:59:28 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: tree.c,v 1.483 2022/10/01 10:07:55 rillig Exp $"); +__RCSID("$NetBSD: tree.c,v 1.484 2022/11/30 20:59:28 rillig Exp $"); #endif #include @@ -2893,27 +2893,28 @@ static void convert_constant_check_range(tspec_t ot, const type_t *tp, tspec_t nt, op_t op, int arg, const val_t *v, val_t *nv) { - unsigned int osz, nsz; + unsigned int obitsz, nbitsz; uint64_t xmask, xmsk1; - osz = size_in_bits(ot); - nsz = tp->t_bitfield ? tp->t_flen : size_in_bits(nt); - xmask = value_bits(nsz) ^ value_bits(osz); - xmsk1 = value_bits(nsz) ^ value_bits(osz - 1); + obitsz = size_in_bits(ot); + nbitsz = tp->t_bitfield ? tp->t_flen : size_in_bits(nt); + xmask = value_bits(nbitsz) ^ value_bits(obitsz); + xmsk1 = value_bits(nbitsz) ^ value_bits(obitsz - 1); /* - * For bitwise operations we are not interested in the + * For bitwise operations we are not interested in the arithmetic * value, but in the bits itself. */ if (op == ORASS || op == BITOR || op == BITXOR) { - convert_constant_check_range_bitor(nsz, osz, v, xmask, op); + convert_constant_check_range_bitor( + nbitsz, obitsz, v, xmask, op); } else if (op == ANDASS || op == BITAND) { - convert_constant_check_range_bitand(nsz, osz, xmask, nv, ot, - v, tp, op); + convert_constant_check_range_bitand( + nbitsz, obitsz, xmask, nv, ot, v, tp, op); } else if ((nt != PTR && is_uinteger(nt)) && (ot != PTR && !is_uinteger(ot)) && v->v_quad < 0) { convert_constant_check_range_signed(op, arg); - } else if (nv->v_quad != v->v_quad && nsz <= osz && + } else if (nv->v_quad != v->v_quad && nbitsz <= obitsz && (v->v_quad & xmask) != 0 && (is_uinteger(ot) || (v->v_quad & xmsk1) != xmsk1)) { convert_constant_check_range_truncated(op, arg, tp, ot);
CVS commit: src/usr.bin/xlint/lint1
Module Name:src Committed By: rillig Date: Wed Nov 30 20:59:28 UTC 2022 Modified Files: src/usr.bin/xlint/lint1: tree.c Log Message: lint: add measurement unit to local variable names No binary change, except for line numbers in assertions. To generate a diff of this commit: cvs rdiff -u -r1.483 -r1.484 src/usr.bin/xlint/lint1/tree.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/xlint/common
Module Name:src Committed By: rillig Date: Wed Nov 30 20:50:22 UTC 2022 Modified Files: src/usr.bin/xlint/common: inittyp.c Log Message: lint: make definitions of basic types simpler No binary change. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/usr.bin/xlint/common/inittyp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/xlint/common/inittyp.c diff -u src/usr.bin/xlint/common/inittyp.c:1.32 src/usr.bin/xlint/common/inittyp.c:1.33 --- src/usr.bin/xlint/common/inittyp.c:1.32 Fri Jul 8 21:19:06 2022 +++ src/usr.bin/xlint/common/inittyp.c Wed Nov 30 20:50:22 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: inittyp.c,v 1.32 2022/07/08 21:19:06 rillig Exp $ */ +/* $NetBSD: inittyp.c,v 1.33 2022/11/30 20:50:22 rillig Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -37,7 +37,7 @@ #include #if defined(__RCSID) -__RCSID("$NetBSD: inittyp.c,v 1.32 2022/07/08 21:19:06 rillig Exp $"); +__RCSID("$NetBSD: inittyp.c,v 1.33 2022/11/30 20:50:22 rillig Exp $"); #endif #if defined(IS_LINT1) @@ -52,89 +52,75 @@ __RCSID("$NetBSD: inittyp.c,v 1.32 2022/ #define typeinfo( \ name, signed_type, unsigned_type, \ size_in_bits, portable_size_in_bits, \ - is_integer, is_unsigned, is_floating, is_arithmetic, \ - is_scalar, is_complex) \ - { \ + c) \ + { /*CONSTCOND*/ \ size_in_bits, portable_size_in_bits, \ signed_type, unsigned_type, \ - (is_integer) > 0, (is_unsigned) > 0, (is_floating) > 0, \ - (is_arithmetic) > 0, (is_scalar) > 0, (is_complex) > 0, \ + (c) == 's' || (c) == 'u', \ + (c) == 'u' || (c) == 'p', \ + (c) == 'f' || (c) == 'c', \ + (c) == 's' || (c) == 'u' || (c) == 'f' || \ + (c) == 'c', \ + (c) == 's' || (c) == 'u' || (c) == 'f' || \ + (c) == 'c' || (c) == 'p', \ + (c) == 'c', \ name, \ } #else #define typeinfo( \ name, signed_type, unsigned_type, \ size_in_bits, portable_size_in_bits, \ - is_integer, is_unsigned, is_floating, is_arithmetic, \ - is_scalar, is_complex) \ - { \ + c) \ + { /*CONSTCOND*/ \ signed_type, unsigned_type, \ - (is_integer) > 0, \ + (c) == 's' || (c) == 'u', \ name, \ } #endif /* various type information */ ttab_t ttab[NTSPEC] = { - typeinfo(NULL, NOTSPEC, NOTSPEC, 0, 0, 0, 0, 0, 0, 0, 0), - typeinfo("signed", SIGNED, UNSIGN, 0, 0, 0, 0, 0, 0, 0, 0), - typeinfo("unsigned", SIGNED, UNSIGN, 0, 0, 0, 0, 0, 0, 0, 0), - typeinfo("_Bool", BOOL, BOOL, CHAR_SIZE, - 1, 1, 1, 0, 1, 1, 0), + typeinfo(NULL, NOTSPEC, NOTSPEC, 0, 0, ' '), + typeinfo("signed", SIGNED, UNSIGN, 0, 0, ' '), + typeinfo("unsigned", SIGNED, UNSIGN, 0, 0, ' '), + typeinfo("_Bool", BOOL, BOOL, CHAR_SIZE, 1, 'u'), typeinfo("char", SCHAR, UCHAR, CHAR_SIZE, 8, - 1, /*CONSTCOND*/ TARG_CHAR_MIN == 0 ? 1 : 0, 0, 1, 1, 0), - typeinfo("signed char", SCHAR, UCHAR, CHAR_SIZE, 8, - 1, 0, 0, 1, 1, 0), - typeinfo("unsigned char", SCHAR, UCHAR, CHAR_SIZE, 8, - 1, 1, 0, 1, 1, 0), - typeinfo("short", SHORT, USHORT, SHORT_SIZE, 16, - 1, 0, 0, 1, 1, 0), - typeinfo("unsigned short", SHORT, USHORT, SHORT_SIZE, 16, - 1, 1, 0, 1, 1, 0), - typeinfo("int", INT, UINT, INT_SIZE, INT_RSIZE * 8, - 1, 0, 0, 1, 1, 0), - typeinfo("unsigned int", INT, UINT, INT_SIZE, INT_RSIZE * 8, - 1, 1, 0, 1, 1, 0), - typeinfo("long", LONG, ULONG, LONG_SIZE, 32, - 1, 0, 0, 1, 1, 0), - typeinfo("unsigned long", LONG, ULONG, LONG_SIZE, 32, - 1, 1, 0, 1, 1, 0), - typeinfo("long long", QUAD, UQUAD, QUAD_SIZE, 64, - 1, 0, 0, 1, 1, 0), - typeinfo("unsigned long long", QUAD, UQUAD, QUAD_SIZE, 64, - 1, 1, 0, 1, 1, 0), + TARG_CHAR_MIN == 0 ? 'u' : 's'), + typeinfo("signed char", SCHAR, UCHAR, CHAR_SIZE, 8, 's'), + typeinfo("unsigned char", SCHAR, UCHAR, CHAR_SIZE, 8, 'u'), + typeinfo("short", SHORT, USHORT, SHORT_SIZE, 16, 's'), + typeinfo("unsigned short", SHORT, USHORT, SHORT_SIZE, 16, 'u'), + typeinfo("int", INT, UINT, INT_SIZE, INT_RSIZE * 8, 's'), + typeinfo("unsigned int", INT, UINT, INT_SIZE, INT_RSIZE * 8, 'u'), + typeinfo("long", LONG, ULONG, LONG_SIZE, 32, 's'), + typeinfo("unsigned long", LONG, ULONG, LONG_SIZE, 32, 'u'), + typeinfo("long long", QUAD, UQUAD, QUAD_SIZE, 64, 's'), + typeinfo("unsigned long long", QUAD, UQUAD, QUAD_SIZE, 64, 'u'), #ifdef INT128_SIZE - typeinfo("__int128_t", INT128, UINT128, INT128_SIZE, 128, - 1, 0, 0, 1, 1, 0), - typeinfo("__uint128_t", INT128, UINT128, INT128_SIZE, 128, - 1, 1, 0, 1, 1, 0), -#endif - typeinfo("float", FLOAT, FLOAT, FLOAT_SIZE, 32, - 0, 0, 1, 1, 1, 0), - typeinfo("double", DOUBLE, DOUBLE, DOUBLE_SIZE, 64, - 0, 0, 1, 1, 1, 0), - typeinfo("long double", LDOUBLE, LDOUBLE, LDOUBLE_SIZE, 80, - 0, 0, 1, 1, 1, 0), - typeinfo("void", VOID, VOID, 0, 0, 0, 0, 0, 0, 0, 0), - typeinfo("struct", STRUCT, STRUCT, 0, 0, 0, 0, 0, 0, 0, 0), - typeinfo("union", UNION, UNION, 0, 0, 0, 0, 0, 0, 0, 0), - typeinfo("enum", ENUM,
CVS commit: src/usr.bin/xlint/common
Module Name:src Committed By: rillig Date: Wed Nov 30 20:50:22 UTC 2022 Modified Files: src/usr.bin/xlint/common: inittyp.c Log Message: lint: make definitions of basic types simpler No binary change. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/usr.bin/xlint/common/inittyp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/sysinst
Module Name:src Committed By: martin Date: Wed Nov 30 19:44:06 UTC 2022 Modified Files: src/usr.sbin/sysinst: disks.c Log Message: Fix primary boot selection for FFSv2ea filesystems To generate a diff of this commit: cvs rdiff -u -r1.91 -r1.92 src/usr.sbin/sysinst/disks.c 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/sysinst/disks.c diff -u src/usr.sbin/sysinst/disks.c:1.91 src/usr.sbin/sysinst/disks.c:1.92 --- src/usr.sbin/sysinst/disks.c:1.91 Wed Nov 30 15:53:35 2022 +++ src/usr.sbin/sysinst/disks.c Wed Nov 30 19:44:06 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: disks.c,v 1.91 2022/11/30 15:53:35 martin Exp $ */ +/* $NetBSD: disks.c,v 1.92 2022/11/30 19:44:06 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -2234,7 +2234,7 @@ bootxx_name(struct install_partition_des switch (fstype) { #if defined(BOOTXX_FFSV1) || defined(BOOTXX_FFSV2) case FS_BSDFFS: - if (install->infos[i].fs_version == 2) { + if (install->infos[i].fs_version >= 2) { #ifdef BOOTXX_FFSV2 bootxxname = BOOTXX_FFSV2; #else
CVS commit: src/usr.sbin/sysinst
Module Name:src Committed By: martin Date: Wed Nov 30 19:44:06 UTC 2022 Modified Files: src/usr.sbin/sysinst: disks.c Log Message: Fix primary boot selection for FFSv2ea filesystems To generate a diff of this commit: cvs rdiff -u -r1.91 -r1.92 src/usr.sbin/sysinst/disks.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/hp300/dev
Module Name:src Committed By: tsutsui Date: Wed Nov 30 18:15:32 UTC 2022 Modified Files: src/sys/arch/hp300/dev: rd.c Log Message: Remove more duplicated static function declarations. To generate a diff of this commit: cvs rdiff -u -r1.120 -r1.121 src/sys/arch/hp300/dev/rd.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/arch/hp300/dev/rd.c diff -u src/sys/arch/hp300/dev/rd.c:1.120 src/sys/arch/hp300/dev/rd.c:1.121 --- src/sys/arch/hp300/dev/rd.c:1.120 Wed Nov 30 17:42:20 2022 +++ src/sys/arch/hp300/dev/rd.c Wed Nov 30 18:15:32 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: rd.c,v 1.120 2022/11/30 17:42:20 tsutsui Exp $ */ +/* $NetBSD: rd.c,v 1.121 2022/11/30 18:15:32 tsutsui Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -72,7 +72,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.120 2022/11/30 17:42:20 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.121 2022/11/30 18:15:32 tsutsui Exp $"); #include "opt_useleds.h" @@ -430,8 +430,6 @@ static void rdreset(struct rd_softc *); static void rdreset_unit(int, int, int); static void rd_set_geom(struct rd_softc *); static int rdgetinfo(dev_t); -static void rdrestart(void *); -static struct buf *rdfinish(struct rd_softc *, struct buf *); static void rdgetdefaultlabel(struct rd_softc *, struct disklabel *); static void rdrestart(void *);
CVS commit: src/sys/arch/hp300/dev
Module Name:src Committed By: tsutsui Date: Wed Nov 30 18:15:32 UTC 2022 Modified Files: src/sys/arch/hp300/dev: rd.c Log Message: Remove more duplicated static function declarations. To generate a diff of this commit: cvs rdiff -u -r1.120 -r1.121 src/sys/arch/hp300/dev/rd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests
Module Name:src Committed By: martin Date: Wed Nov 30 17:50:00 UTC 2022 Modified Files: src/tests/dev/fss: t_fss.sh src/tests/fs/tmpfs: t_vnd.sh Log Message: Avoid explicitly naming the raw part device with a partition letter - use the non-partition letter variant instead. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/dev/fss/t_fss.sh cvs rdiff -u -r1.11 -r1.12 src/tests/fs/tmpfs/t_vnd.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/dev/fss/t_fss.sh diff -u src/tests/dev/fss/t_fss.sh:1.4 src/tests/dev/fss/t_fss.sh:1.5 --- src/tests/dev/fss/t_fss.sh:1.4 Thu Jan 14 04:30:40 2021 +++ src/tests/dev/fss/t_fss.sh Wed Nov 30 17:49:59 2022 @@ -1,4 +1,4 @@ -# $NetBSD: t_fss.sh,v 1.4 2021/01/14 04:30:40 simonb Exp $ +# $NetBSD: t_fss.sh,v 1.5 2022/11/30 17:49:59 martin Exp $ # # Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc. # All rights reserved. @@ -29,8 +29,7 @@ # vnddev=vnd0 -rawpart=$( sysctl -n kern.rawpartition | tr '01234' 'abcde' ) -vnd=/dev/${vnddev}${rawpart} +vnd=/dev/${vnddev} orig_data="Original data" repl_data="Replacement data" Index: src/tests/fs/tmpfs/t_vnd.sh diff -u src/tests/fs/tmpfs/t_vnd.sh:1.11 src/tests/fs/tmpfs/t_vnd.sh:1.12 --- src/tests/fs/tmpfs/t_vnd.sh:1.11 Sat Jun 5 06:40:59 2021 +++ src/tests/fs/tmpfs/t_vnd.sh Wed Nov 30 17:50:00 2022 @@ -1,4 +1,4 @@ -# $NetBSD: t_vnd.sh,v 1.11 2021/06/05 06:40:59 gson Exp $ +# $NetBSD: t_vnd.sh,v 1.12 2022/11/30 17:50:00 martin Exp $ # # Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc. # All rights reserved. @@ -29,8 +29,7 @@ # vnddev=vnd3 -rawpart=$( sysctl -n kern.rawpartition | tr '01234' 'abcde' ) -vnd=/dev/${vnddev}${rawpart} +vnd=/dev/${vnddev} atf_test_case basic cleanup basic_head() {
CVS commit: src/tests
Module Name:src Committed By: martin Date: Wed Nov 30 17:50:00 UTC 2022 Modified Files: src/tests/dev/fss: t_fss.sh src/tests/fs/tmpfs: t_vnd.sh Log Message: Avoid explicitly naming the raw part device with a partition letter - use the non-partition letter variant instead. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/dev/fss/t_fss.sh cvs rdiff -u -r1.11 -r1.12 src/tests/fs/tmpfs/t_vnd.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/dev
Module Name:src Committed By: martin Date: Wed Nov 30 17:49:09 UTC 2022 Modified Files: src/tests/dev/cgd: t_cgd.sh src/tests/dev/md: t_md.sh src/tests/dev/raidframe: t_raid.sh Log Message: Unfortunately rump does not provide the same magic as MAKEDEV does for native /dev and create an alias for disk devices w/o partition latter pointing at the raw partition, so for rump based tests we actually have to calculate the concrete device name. Use an idiom suggested by kre for this which also works for ports that have kern.rawpartition > 4. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/tests/dev/cgd/t_cgd.sh cvs rdiff -u -r1.7 -r1.8 src/tests/dev/md/t_md.sh cvs rdiff -u -r1.15 -r1.16 src/tests/dev/raidframe/t_raid.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/dev/cgd/t_cgd.sh diff -u src/tests/dev/cgd/t_cgd.sh:1.13 src/tests/dev/cgd/t_cgd.sh:1.14 --- src/tests/dev/cgd/t_cgd.sh:1.13 Wed Apr 10 06:13:21 2019 +++ src/tests/dev/cgd/t_cgd.sh Wed Nov 30 17:49:09 2022 @@ -1,4 +1,4 @@ -# $NetBSD: t_cgd.sh,v 1.13 2019/04/10 06:13:21 kre Exp $ +# $NetBSD: t_cgd.sh,v 1.14 2022/11/30 17:49:09 martin Exp $ # # Copyright (c) 2010 The NetBSD Foundation, Inc. # All rights reserved. @@ -25,7 +25,8 @@ # POSSIBILITY OF SUCH DAMAGE. # -rawpart=`sysctl -n kern.rawpartition | tr '01234' 'abcde'` +rawpart=$( set -- a b c d e f g h i j k l m n o p q r s t u v w x y z; + shift $( sysctl -n kern.rawpartition ); printf %s "$1" ) rawcgd=/dev/rcgd0${rawpart} cgdserver=\ "rump_server -lrumpvfs -lrumpkern_crypto -lrumpdev -lrumpdev_disk -lrumpdev_cgd" Index: src/tests/dev/md/t_md.sh diff -u src/tests/dev/md/t_md.sh:1.7 src/tests/dev/md/t_md.sh:1.8 --- src/tests/dev/md/t_md.sh:1.7 Sat May 14 17:42:28 2011 +++ src/tests/dev/md/t_md.sh Wed Nov 30 17:49:09 2022 @@ -1,4 +1,4 @@ -# $NetBSD: t_md.sh,v 1.7 2011/05/14 17:42:28 jmmv Exp $ +# $NetBSD: t_md.sh,v 1.8 2022/11/30 17:49:09 martin Exp $ # # Copyright (c) 2010 The NetBSD Foundation, Inc. # All rights reserved. @@ -25,7 +25,8 @@ # POSSIBILITY OF SUCH DAMAGE. # -rawpart=`sysctl -n kern.rawpartition | tr '01234' 'abcde'` +rawpart=$( set -- a b c d e f g h i j k l m n o p q r s t u v w x y z; + shift $( sysctl -n kern.rawpartition ); printf %s "$1" ) rawmd=/dev/rmd0${rawpart} atf_test_case basic cleanup @@ -38,10 +39,6 @@ basic_head() basic_body() { - # Scope out raw part. This is actually the *host* raw partition, - # but just let it slide for now, since they *should* be the same. - rawpart=`sysctl -n kern.rawpartition | tr '01234' 'abcde'` - atf_check -s exit:0 $(atf_get_srcdir)/h_mdserv ${rawmd} export RUMP_SERVER=unix://commsock Index: src/tests/dev/raidframe/t_raid.sh diff -u src/tests/dev/raidframe/t_raid.sh:1.15 src/tests/dev/raidframe/t_raid.sh:1.16 --- src/tests/dev/raidframe/t_raid.sh:1.15 Mon Nov 30 05:33:32 2020 +++ src/tests/dev/raidframe/t_raid.sh Wed Nov 30 17:49:09 2022 @@ -1,5 +1,5 @@ #! /usr/bin/atf-sh -# $NetBSD: t_raid.sh,v 1.15 2020/11/30 05:33:32 msaitoh Exp $ +# $NetBSD: t_raid.sh,v 1.16 2022/11/30 17:49:09 martin Exp $ # # Copyright (c) 2010 The NetBSD Foundation, Inc. # All rights reserved. @@ -26,7 +26,8 @@ # POSSIBILITY OF SUCH DAMAGE. # -rawpart=`sysctl -n kern.rawpartition | tr '01234' 'abcde'` +rawpart=$( set -- a b c d e f g h i j k l m n o p q r s t u v w x y z; + shift $( sysctl -n kern.rawpartition ); printf %s "$1" ) rawraid=/dev/rraid0${rawpart} raidserver="rump_server -lrumpvfs -lrumpdev -lrumpdev_disk -lrumpdev_raidframe"
CVS commit: src/tests/dev
Module Name:src Committed By: martin Date: Wed Nov 30 17:49:09 UTC 2022 Modified Files: src/tests/dev/cgd: t_cgd.sh src/tests/dev/md: t_md.sh src/tests/dev/raidframe: t_raid.sh Log Message: Unfortunately rump does not provide the same magic as MAKEDEV does for native /dev and create an alias for disk devices w/o partition latter pointing at the raw partition, so for rump based tests we actually have to calculate the concrete device name. Use an idiom suggested by kre for this which also works for ports that have kern.rawpartition > 4. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/tests/dev/cgd/t_cgd.sh cvs rdiff -u -r1.7 -r1.8 src/tests/dev/md/t_md.sh cvs rdiff -u -r1.15 -r1.16 src/tests/dev/raidframe/t_raid.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/hp300/dev
Module Name:src Committed By: tsutsui Date: Wed Nov 30 17:42:21 UTC 2022 Modified Files: src/sys/arch/hp300/dev: rd.c Log Message: Use proper RAW_PART macro rather than a magic number. To generate a diff of this commit: cvs rdiff -u -r1.119 -r1.120 src/sys/arch/hp300/dev/rd.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/arch/hp300/dev/rd.c diff -u src/sys/arch/hp300/dev/rd.c:1.119 src/sys/arch/hp300/dev/rd.c:1.120 --- src/sys/arch/hp300/dev/rd.c:1.119 Wed Nov 30 17:39:12 2022 +++ src/sys/arch/hp300/dev/rd.c Wed Nov 30 17:42:20 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: rd.c,v 1.119 2022/11/30 17:39:12 tsutsui Exp $ */ +/* $NetBSD: rd.c,v 1.120 2022/11/30 17:42:20 tsutsui Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -72,7 +72,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.119 2022/11/30 17:39:12 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.120 2022/11/30 17:42:20 tsutsui Exp $"); #include "opt_useleds.h" @@ -790,7 +790,7 @@ rdgetinfo(dev_t dev) pi = lp->d_partitions; printf("%s: WARNING: %s\n", device_xname(sc->sc_dev), msg); - pi[2].p_size = rdidentinfo[sc->sc_type].ri_nblocks; + pi[RAW_PART].p_size = rdidentinfo[sc->sc_type].ri_nblocks; /* XXX reset other info since readdisklabel screws with it */ lp->d_npartitions = 3; pi[0].p_size = 0;
CVS commit: src/sys/arch/hp300/dev
Module Name:src Committed By: tsutsui Date: Wed Nov 30 17:42:21 UTC 2022 Modified Files: src/sys/arch/hp300/dev: rd.c Log Message: Use proper RAW_PART macro rather than a magic number. To generate a diff of this commit: cvs rdiff -u -r1.119 -r1.120 src/sys/arch/hp300/dev/rd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/hp300/dev
Module Name:src Committed By: tsutsui Date: Wed Nov 30 17:39:12 UTC 2022 Modified Files: src/sys/arch/hp300/dev: rd.c Log Message: Set disk_geom parameters required by DIOCGPARTINFO in disk_ioctl(). With this change raid(4) no longer complains before mountroot: > RAIDframe: can't get disk size for dev rd0 (22) Should be pulled up to netbsd-9. To generate a diff of this commit: cvs rdiff -u -r1.118 -r1.119 src/sys/arch/hp300/dev/rd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/hp300/dev
Module Name:src Committed By: tsutsui Date: Wed Nov 30 17:39:12 UTC 2022 Modified Files: src/sys/arch/hp300/dev: rd.c Log Message: Set disk_geom parameters required by DIOCGPARTINFO in disk_ioctl(). With this change raid(4) no longer complains before mountroot: > RAIDframe: can't get disk size for dev rd0 (22) Should be pulled up to netbsd-9. To generate a diff of this commit: cvs rdiff -u -r1.118 -r1.119 src/sys/arch/hp300/dev/rd.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/arch/hp300/dev/rd.c diff -u src/sys/arch/hp300/dev/rd.c:1.118 src/sys/arch/hp300/dev/rd.c:1.119 --- src/sys/arch/hp300/dev/rd.c:1.118 Wed Nov 30 17:07:30 2022 +++ src/sys/arch/hp300/dev/rd.c Wed Nov 30 17:39:12 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: rd.c,v 1.118 2022/11/30 17:07:30 tsutsui Exp $ */ +/* $NetBSD: rd.c,v 1.119 2022/11/30 17:39:12 tsutsui Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -72,7 +72,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.118 2022/11/30 17:07:30 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.119 2022/11/30 17:39:12 tsutsui Exp $"); #include "opt_useleds.h" @@ -428,6 +428,7 @@ static int rdident(device_t, struct rd_s struct hpibbus_attach_args *); static void rdreset(struct rd_softc *); static void rdreset_unit(int, int, int); +static void rd_set_geom(struct rd_softc *); static int rdgetinfo(dev_t); static void rdrestart(void *); static struct buf *rdfinish(struct rd_softc *, struct buf *); @@ -531,6 +532,7 @@ rdattach(device_t parent, device_t self, memset(>sc_dkdev, 0, sizeof(sc->sc_dkdev)); disk_init(>sc_dkdev, device_xname(sc->sc_dev), NULL); disk_attach(>sc_dkdev); + rd_set_geom(sc); sc->sc_slave = ha->ha_slave; sc->sc_punit = ha->ha_punit; @@ -743,6 +745,23 @@ rdreset_unit(int ctlr, int slave, int pu hpibrecv(ctlr, slave, C_QSTAT, , sizeof(stat)); } +static void +rd_set_geom(struct rd_softc *sc) +{ + struct disk_geom *dg = >sc_dkdev.dk_geom; + const struct rdidentinfo *ri = [sc->sc_type]; + + memset(dg, 0, sizeof(*dg)); + + dg->dg_secsize = DEV_BSIZE; + dg->dg_nsectors = ri->ri_nbpt; + dg->dg_ntracks = ri->ri_ntpc; + dg->dg_ncylinders = ri->ri_ncyl; + dg->dg_secperunit = ri->ri_nblocks; + + disk_set_info(sc->sc_dev, >sc_dkdev, ri->ri_desc); +} + /* * Read or construct a disklabel */
CVS commit: src/sys/arch/hp300/dev
Module Name:src Committed By: tsutsui Date: Wed Nov 30 17:07:30 UTC 2022 Modified Files: src/sys/arch/hp300/dev: rd.c Log Message: Remove a duplicated static function declaration. To generate a diff of this commit: cvs rdiff -u -r1.117 -r1.118 src/sys/arch/hp300/dev/rd.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/arch/hp300/dev/rd.c diff -u src/sys/arch/hp300/dev/rd.c:1.117 src/sys/arch/hp300/dev/rd.c:1.118 --- src/sys/arch/hp300/dev/rd.c:1.117 Wed Nov 30 17:01:56 2022 +++ src/sys/arch/hp300/dev/rd.c Wed Nov 30 17:07:30 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: rd.c,v 1.117 2022/11/30 17:01:56 tsutsui Exp $ */ +/* $NetBSD: rd.c,v 1.118 2022/11/30 17:07:30 tsutsui Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -72,7 +72,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.117 2022/11/30 17:01:56 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.118 2022/11/30 17:07:30 tsutsui Exp $"); #include "opt_useleds.h" @@ -428,7 +428,6 @@ static int rdident(device_t, struct rd_s struct hpibbus_attach_args *); static void rdreset(struct rd_softc *); static void rdreset_unit(int, int, int); -static void rdustart(struct rd_softc *); static int rdgetinfo(dev_t); static void rdrestart(void *); static struct buf *rdfinish(struct rd_softc *, struct buf *);
CVS commit: src/sys/arch/hp300/dev
Module Name:src Committed By: tsutsui Date: Wed Nov 30 17:07:30 UTC 2022 Modified Files: src/sys/arch/hp300/dev: rd.c Log Message: Remove a duplicated static function declaration. To generate a diff of this commit: cvs rdiff -u -r1.117 -r1.118 src/sys/arch/hp300/dev/rd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/hp300/dev
Module Name:src Committed By: tsutsui Date: Wed Nov 30 17:01:56 UTC 2022 Modified Files: src/sys/arch/hp300/dev: rd.c Log Message: Pass a correct dev_t arg to disk_ioctl(). Probably harmless. To generate a diff of this commit: cvs rdiff -u -r1.116 -r1.117 src/sys/arch/hp300/dev/rd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/hp300/dev
Module Name:src Committed By: tsutsui Date: Wed Nov 30 17:01:56 UTC 2022 Modified Files: src/sys/arch/hp300/dev: rd.c Log Message: Pass a correct dev_t arg to disk_ioctl(). Probably harmless. To generate a diff of this commit: cvs rdiff -u -r1.116 -r1.117 src/sys/arch/hp300/dev/rd.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/arch/hp300/dev/rd.c diff -u src/sys/arch/hp300/dev/rd.c:1.116 src/sys/arch/hp300/dev/rd.c:1.117 --- src/sys/arch/hp300/dev/rd.c:1.116 Wed Nov 30 16:37:44 2022 +++ src/sys/arch/hp300/dev/rd.c Wed Nov 30 17:01:56 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: rd.c,v 1.116 2022/11/30 16:37:44 tsutsui Exp $ */ +/* $NetBSD: rd.c,v 1.117 2022/11/30 17:01:56 tsutsui Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -72,7 +72,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.116 2022/11/30 16:37:44 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.117 2022/11/30 17:01:56 tsutsui Exp $"); #include "opt_useleds.h" @@ -1305,7 +1305,7 @@ rdioctl(dev_t dev, u_long cmd, void *dat struct disklabel *lp = sc->sc_dkdev.dk_label; int error, flags; - error = disk_ioctl(>sc_dkdev, rdpart(dev), cmd, data, flag, l); + error = disk_ioctl(>sc_dkdev, dev, cmd, data, flag, l); if (error != EPASSTHROUGH) return error;
CVS commit: src/sys/arch/hp300/dev
Module Name:src Committed By: tsutsui Date: Wed Nov 30 16:37:44 UTC 2022 Modified Files: src/sys/arch/hp300/dev: rd.c Log Message: Check bounds of each partition by MI bounds_check_with_label(9). The previous implementation was committed in rev 1.26 about 26 years ago and it looks there is no quirk to use the old MD one. To generate a diff of this commit: cvs rdiff -u -r1.115 -r1.116 src/sys/arch/hp300/dev/rd.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/arch/hp300/dev/rd.c diff -u src/sys/arch/hp300/dev/rd.c:1.115 src/sys/arch/hp300/dev/rd.c:1.116 --- src/sys/arch/hp300/dev/rd.c:1.115 Wed Nov 30 15:59:01 2022 +++ src/sys/arch/hp300/dev/rd.c Wed Nov 30 16:37:44 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: rd.c,v 1.115 2022/11/30 15:59:01 tsutsui Exp $ */ +/* $NetBSD: rd.c,v 1.116 2022/11/30 16:37:44 tsutsui Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -72,7 +72,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.115 2022/11/30 15:59:01 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.116 2022/11/30 16:37:44 tsutsui Exp $"); #include "opt_useleds.h" @@ -877,7 +877,7 @@ rdstrategy(struct buf *bp) struct rd_softc *sc = device_lookup_private(_cd, rdunit(bp->b_dev)); struct partition *pinfo; daddr_t bn; - int sz, s; + int s; int offset; #ifdef DEBUG @@ -887,7 +887,6 @@ rdstrategy(struct buf *bp) (bp->b_flags & B_READ) ? 'R' : 'W'); #endif bn = bp->b_blkno; - sz = howmany(bp->b_bcount, DEV_BSIZE); pinfo = >sc_dkdev.dk_label->d_partitions[rdpart(bp->b_dev)]; /* Don't perform partition translation on RAW_PART. */ @@ -898,34 +897,9 @@ rdstrategy(struct buf *bp) rdidentinfo[sc->sc_type].ri_nblocks) <= 0) goto done; } else { - /* - * XXX This block of code belongs in - * XXX bounds_check_with_label() - */ - - if (bn < 0 || bn + sz > pinfo->p_size) { - sz = pinfo->p_size - bn; - if (sz == 0) { -bp->b_resid = bp->b_bcount; -goto done; - } - if (sz < 0) { -bp->b_error = EINVAL; -goto done; - } - bp->b_bcount = dbtob(sz); - } - /* - * Check for write to write protected label - */ - if (bn + offset <= LABELSECTOR && -#if LABELSECTOR != 0 - bn + offset + sz > LABELSECTOR && -#endif - !(bp->b_flags & B_READ) && !(sc->sc_flags & RDF_WLABEL)) { - bp->b_error = EROFS; + if (bounds_check_with_label(>sc_dkdev, bp, + (sc->sc_flags & RDF_WLABEL) != 0) <= 0) goto done; - } } bp->b_rawblkno = bn + offset; s = splbio();
CVS commit: src/sys/arch/hp300/dev
Module Name:src Committed By: tsutsui Date: Wed Nov 30 16:37:44 UTC 2022 Modified Files: src/sys/arch/hp300/dev: rd.c Log Message: Check bounds of each partition by MI bounds_check_with_label(9). The previous implementation was committed in rev 1.26 about 26 years ago and it looks there is no quirk to use the old MD one. To generate a diff of this commit: cvs rdiff -u -r1.115 -r1.116 src/sys/arch/hp300/dev/rd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/hp300/dev
Module Name:src Committed By: tsutsui Date: Wed Nov 30 15:59:01 UTC 2022 Modified Files: src/sys/arch/hp300/dev: rd.c Log Message: Check bounds of RAW_PART by bounds_check_with_mediasize() as other drivers. With this check, dd(1) without a count value against a raw partition is terminated properly at the end of media. Tested on 425t and HPDisk. Should be pulled up to netbsd-9. To generate a diff of this commit: cvs rdiff -u -r1.114 -r1.115 src/sys/arch/hp300/dev/rd.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/arch/hp300/dev/rd.c diff -u src/sys/arch/hp300/dev/rd.c:1.114 src/sys/arch/hp300/dev/rd.c:1.115 --- src/sys/arch/hp300/dev/rd.c:1.114 Fri Nov 25 16:12:32 2022 +++ src/sys/arch/hp300/dev/rd.c Wed Nov 30 15:59:01 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: rd.c,v 1.114 2022/11/25 16:12:32 tsutsui Exp $ */ +/* $NetBSD: rd.c,v 1.115 2022/11/30 15:59:01 tsutsui Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -72,7 +72,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.114 2022/11/25 16:12:32 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.115 2022/11/30 15:59:01 tsutsui Exp $"); #include "opt_useleds.h" @@ -893,7 +893,11 @@ rdstrategy(struct buf *bp) /* Don't perform partition translation on RAW_PART. */ offset = (rdpart(bp->b_dev) == RAW_PART) ? 0 : pinfo->p_offset; - if (rdpart(bp->b_dev) != RAW_PART) { + if (rdpart(bp->b_dev) == RAW_PART) { + if (bounds_check_with_mediasize(bp, DEV_BSIZE, + rdidentinfo[sc->sc_type].ri_nblocks) <= 0) + goto done; + } else { /* * XXX This block of code belongs in * XXX bounds_check_with_label()
CVS commit: src/sys/arch/hp300/dev
Module Name:src Committed By: tsutsui Date: Wed Nov 30 15:59:01 UTC 2022 Modified Files: src/sys/arch/hp300/dev: rd.c Log Message: Check bounds of RAW_PART by bounds_check_with_mediasize() as other drivers. With this check, dd(1) without a count value against a raw partition is terminated properly at the end of media. Tested on 425t and HPDisk. Should be pulled up to netbsd-9. To generate a diff of this commit: cvs rdiff -u -r1.114 -r1.115 src/sys/arch/hp300/dev/rd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/sysinst
Module Name:src Committed By: martin Date: Wed Nov 30 15:57:54 UTC 2022 Modified Files: src/usr.sbin/sysinst: bsddisklabel.c Log Message: Switch the default FFS type from FFSv2 to FFSv2ea - we want extended attribute support to be exercised and tested. If you want to share a new installed disk with older NetBSD installations or (read only) with other OSes you need to explicitly set the FS type to FFSv2 now. To generate a diff of this commit: cvs rdiff -u -r1.65 -r1.66 src/usr.sbin/sysinst/bsddisklabel.c 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/sysinst/bsddisklabel.c diff -u src/usr.sbin/sysinst/bsddisklabel.c:1.65 src/usr.sbin/sysinst/bsddisklabel.c:1.66 --- src/usr.sbin/sysinst/bsddisklabel.c:1.65 Wed Nov 30 15:53:35 2022 +++ src/usr.sbin/sysinst/bsddisklabel.c Wed Nov 30 15:57:54 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: bsddisklabel.c,v 1.65 2022/11/30 15:53:35 martin Exp $ */ +/* $NetBSD: bsddisklabel.c,v 1.66 2022/11/30 15:57:54 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -144,9 +144,9 @@ default_parts_init[] = .flags = PUIFLG_JUST_MOUNTPOINT }, #endif { .def_size = DEFUSRSIZE*(MEG/512), .mount = "/usr", .type = PT_root, - .fs_type = FS_BSDFFS, .fs_version = 2 }, + .fs_type = FS_BSDFFS, .fs_version = 3 }, { .def_size = DEFVARSIZE*(MEG/512), .mount = "/var", .type = PT_root, - .fs_type = FS_BSDFFS, .fs_version = 2 }, + .fs_type = FS_BSDFFS, .fs_version = 3 }, }; static const char size_separator[] = @@ -366,7 +366,7 @@ add_other_ptn_size(menudesc *menu, void p->cur_part_id = NO_PART; p->type = PT_root; p->fs_type = FS_BSDFFS; - p->fs_version = 2; + p->fs_version = 3; strncpy(p->mount, new_mp, sizeof(p->mount)); menu->cursel = pset->num; @@ -1035,7 +1035,7 @@ fill_defaults(struct partition_usage_set #ifndef HAVE_UFS2_BOOT if (boot < wanted->num || i != root) #endif - wanted->infos[i].fs_version = 2; + wanted->infos[i].fs_version = 3; #endif } }
CVS commit: src/usr.sbin/sysinst
Module Name:src Committed By: martin Date: Wed Nov 30 15:57:54 UTC 2022 Modified Files: src/usr.sbin/sysinst: bsddisklabel.c Log Message: Switch the default FFS type from FFSv2 to FFSv2ea - we want extended attribute support to be exercised and tested. If you want to share a new installed disk with older NetBSD installations or (read only) with other OSes you need to explicitly set the FS type to FFSv2 now. To generate a diff of this commit: cvs rdiff -u -r1.65 -r1.66 src/usr.sbin/sysinst/bsddisklabel.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin/sysinst
Module Name:src Committed By: martin Date: Wed Nov 30 15:53:35 UTC 2022 Modified Files: src/usr.sbin/sysinst: bsddisklabel.c disks.c label.c msg.mi.de msg.mi.en msg.mi.es msg.mi.fr msg.mi.pl Log Message: Add support for FFSv2ea in the partition type menus (internally setting fs version to 3 for this, where 2 is FFSv2 and 1 is FFSv1) To generate a diff of this commit: cvs rdiff -u -r1.64 -r1.65 src/usr.sbin/sysinst/bsddisklabel.c cvs rdiff -u -r1.90 -r1.91 src/usr.sbin/sysinst/disks.c cvs rdiff -u -r1.42 -r1.43 src/usr.sbin/sysinst/label.c \ src/usr.sbin/sysinst/msg.mi.fr cvs rdiff -u -r1.41 -r1.42 src/usr.sbin/sysinst/msg.mi.de cvs rdiff -u -r1.44 -r1.45 src/usr.sbin/sysinst/msg.mi.en cvs rdiff -u -r1.37 -r1.38 src/usr.sbin/sysinst/msg.mi.es cvs rdiff -u -r1.43 -r1.44 src/usr.sbin/sysinst/msg.mi.pl 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/sysinst/bsddisklabel.c diff -u src/usr.sbin/sysinst/bsddisklabel.c:1.64 src/usr.sbin/sysinst/bsddisklabel.c:1.65 --- src/usr.sbin/sysinst/bsddisklabel.c:1.64 Thu Jun 16 16:27:30 2022 +++ src/usr.sbin/sysinst/bsddisklabel.c Wed Nov 30 15:53:35 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: bsddisklabel.c,v 1.64 2022/06/16 16:27:30 tsutsui Exp $ */ +/* $NetBSD: bsddisklabel.c,v 1.65 2022/11/30 15:53:35 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -1993,7 +1993,7 @@ check_partitions(struct install_partitio continue; if (install->infos[i].fs_type != FS_BSDFFS) continue; - if (install->infos[i].fs_version != 2) + if (install->infos[i].fs_version < 2) continue; hit_enter_to_continue(NULL, MSG_cannot_ufs2_root); return false; Index: src/usr.sbin/sysinst/disks.c diff -u src/usr.sbin/sysinst/disks.c:1.90 src/usr.sbin/sysinst/disks.c:1.91 --- src/usr.sbin/sysinst/disks.c:1.90 Tue Aug 30 15:27:37 2022 +++ src/usr.sbin/sysinst/disks.c Wed Nov 30 15:53:35 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: disks.c,v 1.90 2022/08/30 15:27:37 martin Exp $ */ +/* $NetBSD: disks.c,v 1.91 2022/11/30 15:53:35 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -114,10 +114,14 @@ getfslabelname(uint f, uint f_version) return "mfs"; else if (f == FS_EFI_SP) return msg_string(MSG_fs_type_efi_sp); - else if (f == FS_BSDFFS && f_version > 0) - return f_version == 2 ? - msg_string(MSG_fs_type_ffsv2) : msg_string(MSG_fs_type_ffs); - else if (f == FS_EX2FS && f_version == 1) + else if (f == FS_BSDFFS && f_version > 0) { + switch (f_version) { + default: + case 1: return msg_string(MSG_fs_type_ffs); + case 2: return msg_string(MSG_fs_type_ffsv2); + case 3: return msg_string(MSG_fs_type_ffsv2ea); + } + } else if (f == FS_EX2FS && f_version == 1) return msg_string(MSG_fs_type_ext2old); else if (f >= __arraycount(fstypenames) || fstypenames[f] == NULL) return "invalid"; @@ -1278,7 +1282,7 @@ make_filesystems(struct install_partitio if (!ask_noyes(MSG_No_filesystem_newfs)) return EINVAL; error = run_program(RUN_DISPLAY | RUN_PROGRESS, - "/sbin/newfs -V2 -O2 %s", rdev); + "/sbin/newfs -V2 -O2ea %s", rdev); } md_pre_mount(install, 0); @@ -1349,9 +1353,16 @@ make_filesystems(struct install_partitio ptn->fs_opt2); strcat(opts, opt); } + const char *ffs_fmt; + switch (ptn->fs_version) { + case 3: ffs_fmt = "2ea"; break; + case 2: ffs_fmt = "2"; break; + case 1: + default: ffs_fmt = "1"; break; + } asprintf(, - "/sbin/newfs -V2 -O %d %s", - ptn->fs_version == 2 ? 2 : 1, opts); + "/sbin/newfs -V2 -O %s %s", + ffs_fmt, opts); if (ptn->mountflags & PUIMNT_LOG) mnt_opts = "-tffs -o log"; else Index: src/usr.sbin/sysinst/label.c diff -u src/usr.sbin/sysinst/label.c:1.42 src/usr.sbin/sysinst/label.c:1.43 --- src/usr.sbin/sysinst/label.c:1.42 Thu Nov 17 06:40:41 2022 +++ src/usr.sbin/sysinst/label.c Wed Nov 30 15:53:35 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: label.c,v 1.42 2022/11/17 06:40:41 chs Exp $ */ +/* $NetBSD: label.c,v 1.43 2022/11/30 15:53:35 martin Exp $ */ /* * Copyright 1997 Jonathan Stone @@ -36,7 +36,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: label.c,v 1.42 2022/11/17 06:40:41 chs Exp $"); +__RCSID("$NetBSD: label.c,v 1.43 2022/11/30 15:53:35 martin Exp $"); #endif #include @@ -549,17 +549,19 @@ init_fs_type_ext(menudesc *menu, void *a size_t i, ndx, max = menu->numopts; if (t == FS_BSDFFS) { - if (edit->info.fs_sub_type == 2) + if (edit->info.fs_sub_type == 3) menu->cursel = 0; - else + else if (edit->info.fs_sub_type == 2) menu->cursel = 1; + else + menu->cursel = 2; return; } else if (t == FS_EX2FS && edit->info.fs_sub_type == 1) { - menu->cursel = FSMAXTYPES; + menu->cursel = FSMAXTYPES+2; return; } /* skip the two FFS entries, and do not add FFS later again */ - for (ndx = 2, i =
CVS commit: src/usr.sbin/sysinst
Module Name:src Committed By: martin Date: Wed Nov 30 15:53:35 UTC 2022 Modified Files: src/usr.sbin/sysinst: bsddisklabel.c disks.c label.c msg.mi.de msg.mi.en msg.mi.es msg.mi.fr msg.mi.pl Log Message: Add support for FFSv2ea in the partition type menus (internally setting fs version to 3 for this, where 2 is FFSv2 and 1 is FFSv1) To generate a diff of this commit: cvs rdiff -u -r1.64 -r1.65 src/usr.sbin/sysinst/bsddisklabel.c cvs rdiff -u -r1.90 -r1.91 src/usr.sbin/sysinst/disks.c cvs rdiff -u -r1.42 -r1.43 src/usr.sbin/sysinst/label.c \ src/usr.sbin/sysinst/msg.mi.fr cvs rdiff -u -r1.41 -r1.42 src/usr.sbin/sysinst/msg.mi.de cvs rdiff -u -r1.44 -r1.45 src/usr.sbin/sysinst/msg.mi.en cvs rdiff -u -r1.37 -r1.38 src/usr.sbin/sysinst/msg.mi.es cvs rdiff -u -r1.43 -r1.44 src/usr.sbin/sysinst/msg.mi.pl Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/hp300/dev
Module Name:src Committed By: tsutsui Date: Wed Nov 30 11:36:50 UTC 2022 Modified Files: src/sys/arch/hp300/dev: topcat.c Log Message: Fix silent bus error panic on 98543A topcat framebuffer on HP320 and HP360. It looks DELAY(100)s before checking cmap_busy in old pre-wscons grf_tc.c http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/hp300/dev/Attic/grf_tc.c?rev=1.42 are actually necessary on 68020 (HP320) and 68030 (HP360) machines, while it works without them on 68040 (HP380). Should be pulled up to netbsd-9. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/hp300/dev/topcat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/hp300/dev
Module Name:src Committed By: tsutsui Date: Wed Nov 30 11:36:50 UTC 2022 Modified Files: src/sys/arch/hp300/dev: topcat.c Log Message: Fix silent bus error panic on 98543A topcat framebuffer on HP320 and HP360. It looks DELAY(100)s before checking cmap_busy in old pre-wscons grf_tc.c http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/hp300/dev/Attic/grf_tc.c?rev=1.42 are actually necessary on 68020 (HP320) and 68030 (HP360) machines, while it works without them on 68040 (HP380). Should be pulled up to netbsd-9. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/hp300/dev/topcat.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/arch/hp300/dev/topcat.c diff -u src/sys/arch/hp300/dev/topcat.c:1.5 src/sys/arch/hp300/dev/topcat.c:1.6 --- src/sys/arch/hp300/dev/topcat.c:1.5 Thu Apr 15 14:43:19 2021 +++ src/sys/arch/hp300/dev/topcat.c Wed Nov 30 11:36:50 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: topcat.c,v 1.5 2021/04/15 14:43:19 tsutsui Exp $ */ +/* $NetBSD: topcat.c,v 1.6 2022/11/30 11:36:50 tsutsui Exp $ */ /* $OpenBSD: topcat.c,v 1.15 2006/08/11 18:33:13 miod Exp $ */ /* @@ -448,6 +448,8 @@ topcat_setcolor(struct diofb *fb, u_int tc->gdata = fb->cmap.g[index]; tc->bdata = fb->cmap.b[index]; tc->strobe = 0xff; + /* XXX delay required on 68020/30 to avoid bus error */ + DELAY(100); tccm_waitbusy(tc); tc->cindex = 0; @@ -459,6 +461,8 @@ topcat_setcolor(struct diofb *fb, u_int tc->bdata = fb->cmap.b[index]; tc->cindex = ~index; tc->strobe = 0xff; + /* XXX delay required on 68020/30 to avoid bus error */ + DELAY(100); tccm_waitbusy(tc); tc->rdata = 0;