svn commit: r362770 - head/share/ctypedef
Author: hrs Date: Mon Jun 29 03:23:13 2020 New Revision: 362770 URL: https://svnweb.freebsd.org/changeset/base/362770 Log: Fix CTYPE for ja_JP.eucJP and ja_JP.SJIS. PR: 163168 MFC after:3 days Modified: head/share/ctypedef/ja_JP.eucJP.src Modified: head/share/ctypedef/ja_JP.eucJP.src == --- head/share/ctypedef/ja_JP.eucJP.src Mon Jun 29 03:09:14 2020 (r362769) +++ head/share/ctypedef/ja_JP.eucJP.src Mon Jun 29 03:23:13 2020 (r362770) @@ -49,7 +49,6 @@ upper ;/ ;/ ;/ ;/ - ;/ ;/ ;/ ;/ @@ -73,7 +72,6 @@ upper ;/ ;/ ;/ ;/ - ;/ ;/ ;/ ;/ @@ -85,7 +83,6 @@ upper ;/ ;/ ;/ ;/ - ;/ ;/ ;/ ;/ @@ -101,7 +98,6 @@ upper;/ ;/ ;/ ;/ - ;/ ;/ ;/ ;/ @@ -126,45 +122,6 @@ upper ;/ ;/ ;/ ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ ;/ ;/ ;/ @@ -173,293 +130,86 @@ upper;/ ;/ ;/ ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ -
svn commit: r362769 - in head/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux
Author: kevans Date: Mon Jun 29 03:09:14 2020 New Revision: 362769 URL: https://svnweb.freebsd.org/changeset/base/362769 Log: linuxolator: implement memfd_create syscall This effectively mirrors our libc implementation, but with minor fudging -- name needs to be copied in from userspace, so we just copy it straight into stack-allocated memfd_name into the correct position rather than allocating memory that needs to be cleaned up. The sealing-related fcntl(2) commands, F_GET_SEALS and F_ADD_SEALS, have also been implemented now that we support them. Note that this implementation is still not quite at feature parity w.r.t. the actual Linux version; some caveats, from my foggy memory: - Need to implement SHM_GROW_ON_WRITE, default for memfd (in progress) - LTP wants the memfd name exposed to fdescfs - Linux allows open() of an fdescfs fd with O_TRUNC to truncate after dup. (?) Interested parties can install and run LTP from ports (devel/linux-ltp) to confirm any fixes. PR: 240874 Reviewed by: kib, trasz Differential Revision:https://reviews.freebsd.org/D21845 Modified: head/sys/amd64/linux/linux_dummy.c head/sys/amd64/linux32/linux32_dummy.c head/sys/arm64/linux/linux_dummy.c head/sys/compat/linux/linux.c head/sys/compat/linux/linux.h head/sys/compat/linux/linux_file.c head/sys/compat/linux/linux_file.h head/sys/i386/linux/linux_dummy.c Modified: head/sys/amd64/linux/linux_dummy.c == --- head/sys/amd64/linux/linux_dummy.c Mon Jun 29 02:32:07 2020 (r362768) +++ head/sys/amd64/linux/linux_dummy.c Mon Jun 29 03:09:14 2020 (r362769) @@ -138,7 +138,6 @@ DUMMY(sched_getattr); /* Linux 3.15: */ DUMMY(kexec_file_load); /* Linux 3.17: */ -DUMMY(memfd_create); DUMMY(seccomp); /* Linux 3.18: */ DUMMY(bpf); Modified: head/sys/amd64/linux32/linux32_dummy.c == --- head/sys/amd64/linux32/linux32_dummy.c Mon Jun 29 02:32:07 2020 (r362768) +++ head/sys/amd64/linux32/linux32_dummy.c Mon Jun 29 03:09:14 2020 (r362769) @@ -133,7 +133,6 @@ DUMMY(finit_module); DUMMY(sched_setattr); DUMMY(sched_getattr); /* Linux 3.17: */ -DUMMY(memfd_create); DUMMY(seccomp); /* Linux 3.18: */ DUMMY(bpf); Modified: head/sys/arm64/linux/linux_dummy.c == --- head/sys/arm64/linux/linux_dummy.c Mon Jun 29 02:32:07 2020 (r362768) +++ head/sys/arm64/linux/linux_dummy.c Mon Jun 29 03:09:14 2020 (r362769) @@ -127,7 +127,6 @@ DUMMY(finit_module); DUMMY(sched_setattr); DUMMY(sched_getattr); /* Linux 3.17: */ -DUMMY(memfd_create); DUMMY(seccomp); /* Linux 3.18: */ DUMMY(bpf); Modified: head/sys/compat/linux/linux.c == --- head/sys/compat/linux/linux.c Mon Jun 29 02:32:07 2020 (r362768) +++ head/sys/compat/linux/linux.c Mon Jun 29 03:09:14 2020 (r362769) @@ -551,3 +551,79 @@ linux_dev_shm_destroy(void) destroy_dev(dev_shm_cdev); } + +int +bsd_to_linux_bits_(int value, struct bsd_to_linux_bitmap *bitmap, +size_t mapcnt, int no_value) +{ + int bsd_mask, bsd_value, linux_mask, linux_value; + int linux_ret; + size_t i; + bool applied; + + applied = false; + linux_ret = 0; + for (i = 0; i < mapcnt; ++i) { + bsd_mask = bitmap[i].bsd_mask; + bsd_value = bitmap[i].bsd_value; + if (bsd_mask == 0) + bsd_mask = bsd_value; + + linux_mask = bitmap[i].linux_mask; + linux_value = bitmap[i].linux_value; + if (linux_mask == 0) + linux_mask = linux_value; + + /* +* If a mask larger than just the value is set, we explicitly +* want to make sure that only this bit we mapped within that +* mask is set. +*/ + if ((value & bsd_mask) == bsd_value) { + linux_ret = (linux_ret & ~linux_mask) | linux_value; + applied = true; + } + } + + if (!applied) + return (no_value); + return (linux_ret); +} + +int +linux_to_bsd_bits_(int value, struct bsd_to_linux_bitmap *bitmap, +size_t mapcnt, int no_value) +{ + int bsd_mask, bsd_value, linux_mask, linux_value; + int bsd_ret; + size_t i; + bool applied; + + applied = false; + bsd_ret = 0; + for (i = 0; i < mapcnt; ++i) { + bsd_mask = bitmap[i].bsd_mask; + bsd_value = bitmap[i].bsd_value; + if (bsd_mask == 0) + bsd_mask = bsd_value; + + linux_mask =
Re: svn commit: r342699 - head/sbin/savecore
On Sun, Jun 28, 2020 at 06:40:59PM -0600, Alan Somers wrote: > On Wed, Jan 2, 2019 at 10:09 AM Mark Johnston wrote: > > > Author: markj > > Date: Wed Jan 2 17:09:35 2019 > > New Revision: 342699 > > URL: https://svnweb.freebsd.org/changeset/base/342699 > > > > Log: > > Capsicumize savecore(8). > > > > - Use cap_fileargs(3) to open dump devices after entering capability > > mode, and use cap_syslog(3) to log messages. > > - Use a relative directory fd to open output files. > > - Use zdopen(3) to compress kernel dumps in capability mode. > > > > Reviewed by: cem, oshogbo > > MFC after:2 months > > Sponsored by: The FreeBSD Foundation > > Differential Revision:https://reviews.freebsd.org/D18458 > > > > Modified: > > head/sbin/savecore/Makefile > > head/sbin/savecore/savecore.c > > > > Modified: head/sbin/savecore/savecore.c > > > > == > > --- head/sbin/savecore/savecore.c Wed Jan 2 16:42:07 2019 > > (r342698) > > +++ head/sbin/savecore/savecore.c Wed Jan 2 17:09:35 2019 > > (r342699) > > > > +static char ** > > +enum_dumpdevs(int *argcp) > > +{ > > + struct fstab *fsp; > > + char **argv; > > + int argc, n; > > + > > + /* > > +* We cannot use getfsent(3) in capability mode, so we must > > +* scan /etc/fstab and build up a list of candidate devices > > +* before proceeding. > > +*/ > > + argc = 0; > > + n = 8; > > + argv = malloc(n * sizeof(*argv)); > > > > It looks like the memory allocated here > > > > + if (argv == NULL) { > > + logmsg(LOG_ERR, "malloc(): %m"); > > + exit(1); > > + } > > + for (;;) { > > + fsp = getfsent(); > > + if (fsp == NULL) > > + break; > > + if (strcmp(fsp->fs_vfstype, "swap") != 0 && > > + strcmp(fsp->fs_vfstype, "dump") != 0) > > + continue; > > + if (argc >= n) { > > + n *= 2; > > + argv = realloc(argv, n * sizeof(*argv)); > > > > and here > > > > + if (argv == NULL) { > > + logmsg(LOG_ERR, "realloc(): %m"); > > + exit(1); > > + } > > + } > > + argv[argc] = strdup(fsp->fs_spec); > > > > and here is leaked. I can't find any corresponding free. However, neither > Valgrind nor Coverity complains. What am I missing? Does this memory > sneakily get freed by a subroutine somewhere, or does Capsicum confuse our > tools? I'm not sure why Capsicum would change anything. It would be worth testing devel/valgrind-devel with https://reviews.freebsd.org/D25452 applied, to see if it's able to detect that bug. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r342699 - head/sbin/savecore
On Sun, Jun 28, 2020 at 6:46 PM Warner Losh wrote: > > > On Sun, Jun 28, 2020, 6:41 PM Alan Somers wrote: > >> On Wed, Jan 2, 2019 at 10:09 AM Mark Johnston wrote: >> >>> Author: markj >>> Date: Wed Jan 2 17:09:35 2019 >>> New Revision: 342699 >>> URL: https://svnweb.freebsd.org/changeset/base/342699 >>> >>> Log: >>> Capsicumize savecore(8). >>> >>> - Use cap_fileargs(3) to open dump devices after entering capability >>> mode, and use cap_syslog(3) to log messages. >>> - Use a relative directory fd to open output files. >>> - Use zdopen(3) to compress kernel dumps in capability mode. >>> >>> Reviewed by: cem, oshogbo >>> MFC after:2 months >>> Sponsored by: The FreeBSD Foundation >>> Differential Revision:https://reviews.freebsd.org/D18458 >>> >>> Modified: >>> head/sbin/savecore/Makefile >>> head/sbin/savecore/savecore.c >>> >>> Modified: head/sbin/savecore/savecore.c >>> >>> == >>> --- head/sbin/savecore/savecore.c Wed Jan 2 16:42:07 2019 >>> (r342698) >>> +++ head/sbin/savecore/savecore.c Wed Jan 2 17:09:35 2019 >>> (r342699) >>> >>> +static char ** >>> +enum_dumpdevs(int *argcp) >>> +{ >>> + struct fstab *fsp; >>> + char **argv; >>> + int argc, n; >>> + >>> + /* >>> +* We cannot use getfsent(3) in capability mode, so we must >>> +* scan /etc/fstab and build up a list of candidate devices >>> +* before proceeding. >>> +*/ >>> + argc = 0; >>> + n = 8; >>> + argv = malloc(n * sizeof(*argv)); >>> >> >> It looks like the memory allocated here >> >> >>> + if (argv == NULL) { >>> + logmsg(LOG_ERR, "malloc(): %m"); >>> + exit(1); >>> + } >>> + for (;;) { >>> + fsp = getfsent(); >>> + if (fsp == NULL) >>> + break; >>> + if (strcmp(fsp->fs_vfstype, "swap") != 0 && >>> + strcmp(fsp->fs_vfstype, "dump") != 0) >>> + continue; >>> + if (argc >= n) { >>> + n *= 2; >>> + argv = realloc(argv, n * sizeof(*argv)); >>> >> >> and here >> >> >>> + if (argv == NULL) { >>> + logmsg(LOG_ERR, "realloc(): %m"); >>> + exit(1); >>> + } >>> + } >>> + argv[argc] = strdup(fsp->fs_spec); >>> >> >> and here is leaked. I can't find any corresponding free. However, >> neither Valgrind nor Coverity complains. What am I missing? Does this >> memory sneakily get freed by a subroutine somewhere, or does Capsicum >> confuse our tools? >> > > So the other spots adjusted large, but this one sets one of its elements. > Help me understand how that is a leak? I'm sure I'm just confused. > Because strdup itself allocates new memory. strdup's return value is always supposed to be freed. -Alan ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r342699 - head/sbin/savecore
On Sun, Jun 28, 2020, 6:41 PM Alan Somers wrote: > On Wed, Jan 2, 2019 at 10:09 AM Mark Johnston wrote: > >> Author: markj >> Date: Wed Jan 2 17:09:35 2019 >> New Revision: 342699 >> URL: https://svnweb.freebsd.org/changeset/base/342699 >> >> Log: >> Capsicumize savecore(8). >> >> - Use cap_fileargs(3) to open dump devices after entering capability >> mode, and use cap_syslog(3) to log messages. >> - Use a relative directory fd to open output files. >> - Use zdopen(3) to compress kernel dumps in capability mode. >> >> Reviewed by: cem, oshogbo >> MFC after:2 months >> Sponsored by: The FreeBSD Foundation >> Differential Revision:https://reviews.freebsd.org/D18458 >> >> Modified: >> head/sbin/savecore/Makefile >> head/sbin/savecore/savecore.c >> >> Modified: head/sbin/savecore/savecore.c >> >> == >> --- head/sbin/savecore/savecore.c Wed Jan 2 16:42:07 2019 >> (r342698) >> +++ head/sbin/savecore/savecore.c Wed Jan 2 17:09:35 2019 >> (r342699) >> >> +static char ** >> +enum_dumpdevs(int *argcp) >> +{ >> + struct fstab *fsp; >> + char **argv; >> + int argc, n; >> + >> + /* >> +* We cannot use getfsent(3) in capability mode, so we must >> +* scan /etc/fstab and build up a list of candidate devices >> +* before proceeding. >> +*/ >> + argc = 0; >> + n = 8; >> + argv = malloc(n * sizeof(*argv)); >> > > It looks like the memory allocated here > > >> + if (argv == NULL) { >> + logmsg(LOG_ERR, "malloc(): %m"); >> + exit(1); >> + } >> + for (;;) { >> + fsp = getfsent(); >> + if (fsp == NULL) >> + break; >> + if (strcmp(fsp->fs_vfstype, "swap") != 0 && >> + strcmp(fsp->fs_vfstype, "dump") != 0) >> + continue; >> + if (argc >= n) { >> + n *= 2; >> + argv = realloc(argv, n * sizeof(*argv)); >> > > and here > > >> + if (argv == NULL) { >> + logmsg(LOG_ERR, "realloc(): %m"); >> + exit(1); >> + } >> + } >> + argv[argc] = strdup(fsp->fs_spec); >> > > and here is leaked. I can't find any corresponding free. However, > neither Valgrind nor Coverity complains. What am I missing? Does this > memory sneakily get freed by a subroutine somewhere, or does Capsicum > confuse our tools? > So the other spots adjusted large, but this one sets one of its elements. Help me understand how that is a leak? I'm sure I'm just confused. Warner > ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r342699 - head/sbin/savecore
On Wed, Jan 2, 2019 at 10:09 AM Mark Johnston wrote: > Author: markj > Date: Wed Jan 2 17:09:35 2019 > New Revision: 342699 > URL: https://svnweb.freebsd.org/changeset/base/342699 > > Log: > Capsicumize savecore(8). > > - Use cap_fileargs(3) to open dump devices after entering capability > mode, and use cap_syslog(3) to log messages. > - Use a relative directory fd to open output files. > - Use zdopen(3) to compress kernel dumps in capability mode. > > Reviewed by: cem, oshogbo > MFC after:2 months > Sponsored by: The FreeBSD Foundation > Differential Revision:https://reviews.freebsd.org/D18458 > > Modified: > head/sbin/savecore/Makefile > head/sbin/savecore/savecore.c > > Modified: head/sbin/savecore/savecore.c > > == > --- head/sbin/savecore/savecore.c Wed Jan 2 16:42:07 2019 > (r342698) > +++ head/sbin/savecore/savecore.c Wed Jan 2 17:09:35 2019 > (r342699) > > +static char ** > +enum_dumpdevs(int *argcp) > +{ > + struct fstab *fsp; > + char **argv; > + int argc, n; > + > + /* > +* We cannot use getfsent(3) in capability mode, so we must > +* scan /etc/fstab and build up a list of candidate devices > +* before proceeding. > +*/ > + argc = 0; > + n = 8; > + argv = malloc(n * sizeof(*argv)); > It looks like the memory allocated here > + if (argv == NULL) { > + logmsg(LOG_ERR, "malloc(): %m"); > + exit(1); > + } > + for (;;) { > + fsp = getfsent(); > + if (fsp == NULL) > + break; > + if (strcmp(fsp->fs_vfstype, "swap") != 0 && > + strcmp(fsp->fs_vfstype, "dump") != 0) > + continue; > + if (argc >= n) { > + n *= 2; > + argv = realloc(argv, n * sizeof(*argv)); > and here > + if (argv == NULL) { > + logmsg(LOG_ERR, "realloc(): %m"); > + exit(1); > + } > + } > + argv[argc] = strdup(fsp->fs_spec); > and here is leaked. I can't find any corresponding free. However, neither Valgrind nor Coverity complains. What am I missing? Does this memory sneakily get freed by a subroutine somewhere, or does Capsicum confuse our tools? -Alan ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362748 - head/usr.sbin/bhyve
Author: chuck Date: Mon Jun 29 00:31:24 2020 New Revision: 362748 URL: https://svnweb.freebsd.org/changeset/base/362748 Log: bhyve: add locks around NVMe queue accesses The NVMe code attempted to ensure thread safety through a combination of using atomics and a "busy" flag. But this approach leads to unavoidable race conditions. Fix is to use per-queue mutex locks to ensure thread safety within the queue processing code. While in the neighborhood, move all the queue initialization code to a common function. Tested by:Jason Tubnor MFC after:2 weeks Differential Revision: https://reviews.freebsd.org/D19841 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c == --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:20 2020 (r362747) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:24 2020 (r362748) @@ -153,21 +153,21 @@ enum nvme_copy_dir { struct nvme_completion_queue { struct nvme_completion *qbase; + pthread_mutex_t mtx; uint32_tsize; uint16_ttail; /* nvme progress */ uint16_thead; /* guest progress */ uint16_tintr_vec; uint32_tintr_en; - pthread_mutex_t mtx; }; struct nvme_submission_queue { struct nvme_command *qbase; + pthread_mutex_t mtx; uint32_tsize; uint16_thead; /* nvme progress */ uint16_ttail; /* guest progress */ uint16_tcqid; /* completion queue id */ - int busy; /* queue is being processed */ int qpriority; }; @@ -339,7 +339,63 @@ pci_nvme_toggle_phase(uint16_t *status, int prev) *status |= NVME_STATUS_P; } +/* + * Initialize the requested number or IO Submission and Completion Queues. + * Admin queues are allocated implicitly. + */ static void +pci_nvme_init_queues(struct pci_nvme_softc *sc, uint32_t nsq, uint32_t ncq) +{ + uint32_t i; + + /* +* Allocate and initialize the Submission Queues +*/ + if (nsq > NVME_QUEUES) { + WPRINTF("%s: clamping number of SQ from %u to %u", + __func__, nsq, NVME_QUEUES); + nsq = NVME_QUEUES; + } + + sc->num_squeues = nsq; + + sc->submit_queues = calloc(sc->num_squeues + 1, + sizeof(struct nvme_submission_queue)); + if (sc->submit_queues == NULL) { + WPRINTF("%s: SQ allocation failed", __func__); + sc->num_squeues = 0; + } else { + struct nvme_submission_queue *sq = sc->submit_queues; + + for (i = 0; i < sc->num_squeues; i++) + pthread_mutex_init([i].mtx, NULL); + } + + /* +* Allocate and initialize the Completion Queues +*/ + if (ncq > NVME_QUEUES) { + WPRINTF("%s: clamping number of CQ from %u to %u", + __func__, ncq, NVME_QUEUES); + ncq = NVME_QUEUES; + } + + sc->num_cqueues = ncq; + + sc->compl_queues = calloc(sc->num_cqueues + 1, + sizeof(struct nvme_completion_queue)); + if (sc->compl_queues == NULL) { + WPRINTF("%s: CQ allocation failed", __func__); + sc->num_cqueues = 0; + } else { + struct nvme_completion_queue *cq = sc->compl_queues; + + for (i = 0; i < sc->num_cqueues; i++) + pthread_mutex_init([i].mtx, NULL); + } +} + +static void pci_nvme_init_ctrldata(struct pci_nvme_softc *sc) { struct nvme_controller_data *cd = >ctrldata; @@ -498,6 +554,8 @@ pci_nvme_init_logpages(struct pci_nvme_softc *sc) static void pci_nvme_reset_locked(struct pci_nvme_softc *sc) { + uint32_t i; + DPRINTF("%s", __func__); sc->regs.cap_lo = (ZERO_BASED(sc->max_qentries) & NVME_CAP_LO_REG_MQES_MASK) | @@ -511,44 +569,23 @@ pci_nvme_reset_locked(struct pci_nvme_softc *sc) sc->regs.cc = 0; sc->regs.csts = 0; - sc->num_cqueues = sc->num_squeues = sc->max_queues; - if (sc->submit_queues != NULL) { - for (int i = 0; i < sc->num_squeues + 1; i++) { - /* -* The Admin Submission Queue is at index 0. -* It must not be changed at reset otherwise the -* emulation will be out of sync with the guest. -*/ - if (i != 0) { - sc->submit_queues[i].qbase = NULL; - sc->submit_queues[i].size = 0; - sc->submit_queues[i].cqid = 0; - } - sc->submit_queues[i].tail =
svn commit: r362761 - head/usr.sbin/bhyve
Author: chuck Date: Mon Jun 29 00:32:08 2020 New Revision: 362761 URL: https://svnweb.freebsd.org/changeset/base/362761 Log: bhyve: Add AER support to NVMe emulation This adds support to bhyve's NVMe device emulation for processing Async Event Requests but not returning them (i.e. Async Event Notifications). Fixes UNH Test 5.5.2 Tested by:Jason Tubnor MFC after:2 weeks Differential Revision: https://reviews.freebsd.org/D24896 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c == --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:32:04 2020 (r362760) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:32:08 2020 (r362761) @@ -251,6 +251,11 @@ struct nvme_feature_obj { #define NVME_FID_MAX (NVME_FEAT_ENDURANCE_GROUP_EVENT_CONFIGURATION + 1) +struct pci_nvme_aer { + STAILQ_ENTRY(pci_nvme_aer) link; + uint16_tcid;/* Command ID of the submitted AER */ +}; + struct pci_nvme_softc { struct pci_devinst *nsc_pi; @@ -296,6 +301,9 @@ struct pci_nvme_softc { __uint128_t write_commands; uint32_tread_dunits_remainder; uint32_twrite_dunits_remainder; + + STAILQ_HEAD(, pci_nvme_aer) aer_list; + uint32_taer_count; }; @@ -604,6 +612,93 @@ pci_nvme_init_features(struct pci_nvme_softc *sc) } static void +pci_nvme_aer_init(struct pci_nvme_softc *sc) +{ + + STAILQ_INIT(>aer_list); + sc->aer_count = 0; +} + +static void +pci_nvme_aer_destroy(struct pci_nvme_softc *sc) +{ + struct pci_nvme_aer *aer = NULL; + + while (!STAILQ_EMPTY(>aer_list)) { + aer = STAILQ_FIRST(>aer_list); + STAILQ_REMOVE_HEAD(>aer_list, link); + free(aer); + } + + pci_nvme_aer_init(sc); +} + +static bool +pci_nvme_aer_available(struct pci_nvme_softc *sc) +{ + + return (!STAILQ_EMPTY(>aer_list)); +} + +static bool +pci_nvme_aer_limit_reached(struct pci_nvme_softc *sc) +{ + struct nvme_controller_data *cd = >ctrldata; + + /* AERL is a zero based value while aer_count is one's based */ + return (sc->aer_count == (cd->aerl + 1)); +} + +/* + * Add an Async Event Request + * + * Stores an AER to be returned later if the Controller needs to notify the + * host of an event. + * Note that while the NVMe spec doesn't require Controllers to return AER's + * in order, this implementation does preserve the order. + */ +static int +pci_nvme_aer_add(struct pci_nvme_softc *sc, uint16_t cid) +{ + struct pci_nvme_aer *aer = NULL; + + if (pci_nvme_aer_limit_reached(sc)) + return (-1); + + aer = calloc(1, sizeof(struct pci_nvme_aer)); + if (aer == NULL) + return (-1); + + sc->aer_count++; + + /* Save the Command ID for use in the completion message */ + aer->cid = cid; + STAILQ_INSERT_TAIL(>aer_list, aer, link); + + return (0); +} + +/* + * Get an Async Event Request structure + * + * Returns a pointer to an AER previously submitted by the host or NULL if + * no AER's exist. Caller is responsible for freeing the returned struct. + */ +static struct pci_nvme_aer * +pci_nvme_aer_get(struct pci_nvme_softc *sc) +{ + struct pci_nvme_aer *aer = NULL; + + aer = STAILQ_FIRST(>aer_list); + if (aer != NULL) { + STAILQ_REMOVE_HEAD(>aer_list, link); + sc->aer_count--; + } + + return (aer); +} + +static void pci_nvme_reset_locked(struct pci_nvme_softc *sc) { uint32_t i; @@ -641,6 +736,8 @@ pci_nvme_reset_locked(struct pci_nvme_softc *sc) } sc->num_q_is_set = false; + + pci_nvme_aer_destroy(sc); } static void @@ -1376,13 +1473,26 @@ nvme_opc_async_event_req(struct pci_nvme_softc* sc, { DPRINTF("%s async event request 0x%x", __func__, command->cdw11); + /* Don't exceed the Async Event Request Limit (AERL). */ + if (pci_nvme_aer_limit_reached(sc)) { + pci_nvme_status_tc(>status, NVME_SCT_COMMAND_SPECIFIC, + NVME_SC_ASYNC_EVENT_REQUEST_LIMIT_EXCEEDED); + return (1); + } + + if (pci_nvme_aer_add(sc, command->cid)) { + pci_nvme_status_tc(>status, NVME_SCT_GENERIC, + NVME_SC_INTERNAL_DEVICE_ERROR); + return (1); + } + /* -* TODO: raise events when they happen based on the Set Features cmd. +* Raise events when they happen based on the Set Features cmd. * These events happen async, so only set completion successful if * there is an event reflective of the request to get event. */ - pci_nvme_status_tc(>status, NVME_SCT_COMMAND_SPECIFIC, - NVME_SC_ASYNC_EVENT_REQUEST_LIMIT_EXCEEDED); + compl->status =
svn commit: r362762 - head/usr.sbin/bhyve
Author: chuck Date: Mon Jun 29 00:32:11 2020 New Revision: 362762 URL: https://svnweb.freebsd.org/changeset/base/362762 Log: bhyve: add basic NVMe Firmware Commit support This commit updates the Identify Controller data to advertise the Controller supports a single firmware slot and that firmware slot 1 is read-only. Additionally, it returns an "Invalid Firmware Slot" error when the host issues any Firmware Commit command (a.k.a. Firmware Activate). Fixes UNH Test 5.5.3 Tested by:Jason Tubnor MFC after:2 weeks Differential Revision: https://reviews.freebsd.org/D24897 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c == --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:32:08 2020 (r362761) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:32:11 2020 (r362762) @@ -468,6 +468,9 @@ pci_nvme_init_ctrldata(struct pci_nvme_softc *sc) cd->acl = 2; cd->aerl = 4; + /* Advertise 1, Read-only firmware slot */ + cd->frmw = NVME_CTRLR_DATA_FRMW_SLOT1_RO_MASK | + (1 << NVME_CTRLR_DATA_FRMW_NUM_SLOTS_SHIFT); cd->lpa = 0;/* TODO: support some simple things like SMART */ cd->elpe = 0; /* max error log page entries */ cd->npss = 1; /* number of power states support */ @@ -1556,6 +1559,12 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, u case NVME_OPC_GET_FEATURES: DPRINTF("%s command GET_FEATURES", __func__); nvme_opc_get_features(sc, cmd, ); + break; + case NVME_OPC_FIRMWARE_ACTIVATE: + DPRINTF("%s command FIRMWARE_ACTIVATE", __func__); + pci_nvme_status_tc(, + NVME_SCT_COMMAND_SPECIFIC, + NVME_SC_INVALID_FIRMWARE_SLOT); break; case NVME_OPC_ASYNC_EVENT_REQUEST: DPRINTF("%s command ASYNC_EVENT_REQ", __func__); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362759 - head/usr.sbin/bhyve
Author: chuck Date: Mon Jun 29 00:32:01 2020 New Revision: 362759 URL: https://svnweb.freebsd.org/changeset/base/362759 Log: bhyve: implement NVMe SMART data I/O statistics SMART data in NVMe includes statistics for number of read and write commands issued as well as the number of "data units" read and written. NVMe defines "data unit" as thousands of 512 byte blocks (e.g. 1 data unit is 1-1,000 512 byte blocks, 3 data units are 2,001-3,000 512 byte blocks). This patch implements counters for: - Data Units Read - Data Units Written - Host Read Commands - Host Write Commands and exposes the values when the guest reads the SMART/Health Log Page. Fixes UNH Test 1.3.8 Tested by:Jason Tubnor MFC after:2 weeks Differential Revision: https://reviews.freebsd.org/D24894 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c == --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:58 2020 (r362758) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:32:01 2020 (r362759) @@ -218,6 +218,7 @@ struct pci_nvme_ioreq { uint64_tprev_gpaddr; size_t prev_size; + size_t bytes; struct blockif_req io_req; @@ -287,6 +288,14 @@ struct pci_nvme_softc { struct nvme_feature_obj feat[NVME_FID_MAX]; enum nvme_dsm_type dataset_management; + + /* Accounting for SMART data */ + __uint128_t read_data_units; + __uint128_t write_data_units; + __uint128_t read_commands; + __uint128_t write_commands; + uint32_tread_dunits_remainder; + uint32_twrite_dunits_remainder; }; @@ -576,6 +585,10 @@ pci_nvme_init_logpages(struct pci_nvme_softc *sc) memset(>err_log, 0, sizeof(sc->err_log)); memset(>health_log, 0, sizeof(sc->health_log)); memset(>fw_log, 0, sizeof(sc->fw_log)); + + /* Set read/write remainder to round up according to spec */ + sc->read_dunits_remainder = 999; + sc->write_dunits_remainder = 999; } static void @@ -961,7 +974,17 @@ nvme_opc_get_log_page(struct pci_nvme_softc* sc, struc NVME_COPY_TO_PRP); break; case NVME_LOG_HEALTH_INFORMATION: - /* TODO: present some smart info */ + pthread_mutex_lock(>mtx); + memcpy(>health_log.data_units_read, >read_data_units, + sizeof(sc->health_log.data_units_read)); + memcpy(>health_log.data_units_written, >write_data_units, + sizeof(sc->health_log.data_units_written)); + memcpy(>health_log.host_read_commands, >read_commands, + sizeof(sc->health_log.host_read_commands)); + memcpy(>health_log.host_write_commands, >write_commands, + sizeof(sc->health_log.host_write_commands)); + pthread_mutex_unlock(>mtx); + nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, command->prp1, command->prp2, (uint8_t *)>health_log, MIN(logsize, sizeof(sc->health_log)), @@ -1465,6 +1488,47 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, u pthread_mutex_unlock(>mtx); } +/* + * Update the Write and Read statistics reported in SMART data + * + * NVMe defines "data unit" as thousand's of 512 byte blocks and is rounded up. + * E.g. 1 data unit is 1 - 1,000 512 byte blocks. 3 data units are 2,001 - 3,000 + * 512 byte blocks. Rounding up is acheived by initializing the remainder to 999. + */ +static void +pci_nvme_stats_write_read_update(struct pci_nvme_softc *sc, uint8_t opc, +size_t bytes, uint16_t status) +{ + + pthread_mutex_lock(>mtx); + switch (opc) { + case NVME_OPC_WRITE: + sc->write_commands++; + if (status != NVME_SC_SUCCESS) + break; + sc->write_dunits_remainder += (bytes / 512); + while (sc->write_dunits_remainder >= 1000) { + sc->write_data_units++; + sc->write_dunits_remainder -= 1000; + } + break; + case NVME_OPC_READ: + sc->read_commands++; + if (status != NVME_SC_SUCCESS) + break; + sc->read_dunits_remainder += (bytes / 512); + while (sc->read_dunits_remainder >= 1000) { + sc->read_data_units++; + sc->read_dunits_remainder -= 1000; + } + break; + default: + DPRINTF("%s: Invalid OPC 0x%02x for stats", __func__, opc); + break; + } + pthread_mutex_unlock(>mtx); +} + static int pci_nvme_append_iov_req(struct pci_nvme_softc *sc, struct pci_nvme_ioreq *req, uint64_t gpaddr, size_t size,
svn commit: r362764 - head/usr.sbin/bhyve
Author: chuck Date: Mon Jun 29 00:32:18 2020 New Revision: 362764 URL: https://svnweb.freebsd.org/changeset/base/362764 Log: bhyve: fix NVMe Get Features, Predictable Latency If the Predictable Latency Mode is not supported, NVMe Controllers must return Invalid Field in Command status for the Get Features command with IDs: - Predictable Latency Mode Config - Predictable Latency Mode Window Fixes UNH Tests 3.6 Tested by:Jason Tubnor MFC after:2 weeks Differential Revision: https://reviews.freebsd.org/D24899 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c == --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:32:15 2020 (r362763) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:32:18 2020 (r362764) @@ -618,6 +618,10 @@ pci_nvme_init_features(struct pci_nvme_softc *sc) sc->feat[NVME_FEAT_NUMBER_OF_QUEUES].set = nvme_feature_num_queues; sc->feat[NVME_FEAT_INTERRUPT_VECTOR_CONFIGURATION].set = nvme_feature_iv_config; + sc->feat[NVME_FEAT_PREDICTABLE_LATENCY_MODE_CONFIG].get = + nvme_feature_invalid_cb; + sc->feat[NVME_FEAT_PREDICTABLE_LATENCY_MODE_WINDOW].get = + nvme_feature_invalid_cb; } static void ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362755 - head/usr.sbin/bhyve
Author: chuck Date: Mon Jun 29 00:31:47 2020 New Revision: 362755 URL: https://svnweb.freebsd.org/changeset/base/362755 Log: bhyve: implement NVMe Format NVM command The Format NVM command mainly allows the host to specify the block size and protection information used for the Namespace. As the bhyve implementation simply maps the capabilities of the backing storage through to the guest, there isn't anything to implement. But a side effect of the format is the NVMe Controller shall not return any data previously written (i.e. erase previously written data). This patch implements this later behavior to provide a compliant implementation. Fixes UNH Test 1.6 Tested by:Jason Tubnor MFC after:2 weeks Differential Revision: https://reviews.freebsd.org/D24889 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c == --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:44 2020 (r362754) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:47 2020 (r362755) @@ -280,6 +280,9 @@ struct pci_nvme_softc { static void pci_nvme_io_partial(struct blockif_req *br, int err); +static struct pci_nvme_ioreq *pci_nvme_get_ioreq(struct pci_nvme_softc *); +static void pci_nvme_release_ioreq(struct pci_nvme_softc *, struct pci_nvme_ioreq *); +static void pci_nvme_io_done(struct blockif_req *, int); /* Controller Configuration utils */ #defineNVME_CC_GET_EN(cc) \ @@ -645,6 +648,7 @@ pci_nvme_init_controller(struct vmctx *ctx, struct pci sc->compl_queues[0].size = acqs; sc->compl_queues[0].qbase = vm_map_gpa(ctx, sc->regs.acq, sizeof(struct nvme_completion) * acqs); + sc->compl_queues[0].intr_en = NVME_CQ_INTEN; DPRINTF("%s mapping Admin-CQ guest 0x%lx, host: %p", __func__, sc->regs.acq, sc->compl_queues[0].qbase); @@ -1255,6 +1259,71 @@ nvme_opc_get_features(struct pci_nvme_softc* sc, struc } static int +nvme_opc_format_nvm(struct pci_nvme_softc* sc, struct nvme_command* command, + struct nvme_completion* compl) +{ + uint8_t ses, lbaf, pi; + + /* Only supports Secure Erase Setting - User Data Erase */ + ses = (command->cdw10 >> 9) & 0x7; + if (ses > 0x1) { + pci_nvme_status_genc(>status, NVME_SC_INVALID_FIELD); + return (1); + } + + /* Only supports a single LBA Format */ + lbaf = command->cdw10 & 0xf; + if (lbaf != 0) { + pci_nvme_status_tc(>status, NVME_SCT_COMMAND_SPECIFIC, + NVME_SC_INVALID_FORMAT); + return (1); + } + + /* Doesn't support Protection Infomation */ + pi = (command->cdw10 >> 5) & 0x7; + if (pi != 0) { + pci_nvme_status_genc(>status, NVME_SC_INVALID_FIELD); + return (1); + } + + if (sc->nvstore.type == NVME_STOR_RAM) { + if (sc->nvstore.ctx) + free(sc->nvstore.ctx); + sc->nvstore.ctx = calloc(1, sc->nvstore.size); + pci_nvme_status_genc(>status, NVME_SC_SUCCESS); + } else { + struct pci_nvme_ioreq *req; + int err; + + req = pci_nvme_get_ioreq(sc); + if (req == NULL) { + pci_nvme_status_genc(>status, + NVME_SC_INTERNAL_DEVICE_ERROR); + WPRINTF("%s: unable to allocate IO req", __func__); + return (1); + } + req->nvme_sq = >submit_queues[0]; + req->sqid = 0; + req->opc = command->opc; + req->cid = command->cid; + req->nsid = command->nsid; + + req->io_req.br_offset = 0; + req->io_req.br_resid = sc->nvstore.size; + req->io_req.br_callback = pci_nvme_io_done; + + err = blockif_delete(sc->nvstore.ctx, >io_req); + if (err) { + pci_nvme_status_genc(>status, + NVME_SC_INTERNAL_DEVICE_ERROR); + pci_nvme_release_ioreq(sc, req); + } + } + + return (1); +} + +static int nvme_opc_abort(struct pci_nvme_softc* sc, struct nvme_command* command, struct nvme_completion* compl) { @@ -1351,6 +1420,15 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, u nvme_opc_async_event_req(sc, cmd, ); */ compl.status = NVME_NO_STATUS; + break; + case NVME_OPC_FORMAT_NVM: + DPRINTF("%s command FORMAT_NVM", __func__); + if ((sc->ctrldata.oacs & + (1 << NVME_CTRLR_DATA_OACS_FORMAT_SHIFT)) == 0) { + pci_nvme_status_genc(,
svn commit: r362763 - head/usr.sbin/bhyve
Author: chuck Date: Mon Jun 29 00:32:15 2020 New Revision: 362763 URL: https://svnweb.freebsd.org/changeset/base/362763 Log: bhyve: add NVMe Feature Interrupt Vector Config This adds support for NVMe Get Features, Interrupt Vector Config parameter error checking done by the UNH compliance tests. Fixes UNH Tests 1.6.8 and 5.5.6 Tested by:Jason Tubnor MFC after:2 weeks Differential Revision: https://reviews.freebsd.org/D24898 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c == --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:32:11 2020 (r362762) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:32:15 2020 (r362763) @@ -356,6 +356,10 @@ static void nvme_feature_num_queues(struct pci_nvme_so struct nvme_feature_obj *, struct nvme_command *, struct nvme_completion *); +static void nvme_feature_iv_config(struct pci_nvme_softc *, +struct nvme_feature_obj *, +struct nvme_command *, +struct nvme_completion *); static __inline void cpywithpad(char *dst, size_t dst_size, const char *src, char pad) @@ -612,6 +616,8 @@ pci_nvme_init_features(struct pci_nvme_softc *sc) sc->feat[NVME_FEAT_LBA_RANGE_TYPE].namespace_specific = true; sc->feat[NVME_FEAT_ERROR_RECOVERY].namespace_specific = true; sc->feat[NVME_FEAT_NUMBER_OF_QUEUES].set = nvme_feature_num_queues; + sc->feat[NVME_FEAT_INTERRUPT_VECTOR_CONFIGURATION].set = + nvme_feature_iv_config; } static void @@ -1273,6 +1279,39 @@ nvme_feature_invalid_cb(struct pci_nvme_softc *sc, { pci_nvme_status_genc(>status, NVME_SC_INVALID_FIELD); +} + +static void +nvme_feature_iv_config(struct pci_nvme_softc *sc, +struct nvme_feature_obj *feat, +struct nvme_command *command, +struct nvme_completion *compl) +{ + uint32_t i; + uint32_t cdw11 = command->cdw11; + uint16_t iv; + bool cd; + + pci_nvme_status_genc(>status, NVME_SC_INVALID_FIELD); + + iv = cdw11 & 0x; + cd = cdw11 & (1 << 16); + + if (iv > (sc->max_queues + 1)) { + return; + } + + /* No Interrupt Coalescing (i.e. not Coalescing Disable) for Admin Q */ + if ((iv == 0) && !cd) + return; + + /* Requested Interrupt Vector must be used by a CQ */ + for (i = 0; i < sc->num_cqueues + 1; i++) { + if (sc->compl_queues[i].intr_vec == iv) { + pci_nvme_status_genc(>status, NVME_SC_SUCCESS); + } + } + } static void ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362757 - head/usr.sbin/bhyve
Author: chuck Date: Mon Jun 29 00:31:54 2020 New Revision: 362757 URL: https://svnweb.freebsd.org/changeset/base/362757 Log: bhyve: base pci_nvme_ioreq size on advertised MDTS NVMe controllers advertise their Max Data Transfer Size (MDTS) to limit the number of page descriptors in an I/O request. Take advantage of this and size the struct pci_nvme_ioreq accordingly. Ensuring these values match both future-proofs the code and allows removing some complexity which only exists to handle this possibility. Tested by:Jason Tubnor MFC after:2 weeks Differential Revision: https://reviews.freebsd.org/D24891 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c == --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:51 2020 (r362756) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:54 2020 (r362757) @@ -99,9 +99,16 @@ static int nvme_debug = 0; #defineNVME_QUEUES 16 #defineNVME_MAX_QENTRIES 2048 +/* Memory Page size Minimum reported in CAP register */ +#defineNVME_MPSMIN 0 +/* MPSMIN converted to bytes */ +#defineNVME_MPSMIN_BYTES (1 << (12 + NVME_MPSMIN)) #defineNVME_PRP2_ITEMS (PAGE_SIZE/sizeof(uint64_t)) -#defineNVME_MAX_BLOCKIOVS 512 +#defineNVME_MDTS 9 +/* Note the + 1 allows for the initial descriptor to not be page aligned */ +#defineNVME_MAX_IOVEC ((1 << NVME_MDTS) + 1) +#defineNVME_MAX_DATA_SIZE ((1 << NVME_MDTS) * NVME_MPSMIN_BYTES) /* This is a synthetic status code to indicate there is no status */ #define NVME_NO_STATUS 0x @@ -186,6 +193,18 @@ struct pci_nvme_blockstore { uint32_tdeallocate:1; }; +/* + * Calculate the number of additional page descriptors for guest IO requests + * based on the advertised Max Data Transfer (MDTS) and given the number of + * default iovec's in a struct blockif_req. + * + * Note the + 1 allows for the initial descriptor to not be page aligned. + */ +#define MDTS_PAD_SIZE \ + NVME_MAX_IOVEC > BLOCKIF_IOV_MAX ? \ + NVME_MAX_IOVEC - BLOCKIF_IOV_MAX : \ + 0 + struct pci_nvme_ioreq { struct pci_nvme_softc *sc; STAILQ_ENTRY(pci_nvme_ioreq) link; @@ -200,17 +219,9 @@ struct pci_nvme_ioreq { uint64_tprev_gpaddr; size_t prev_size; - /* -* lock if all iovs consumed (big IO); -* complete transaction before continuing -*/ - pthread_mutex_t mtx; - pthread_cond_t cv; - struct blockif_req io_req; - /* pad to fit up to 512 page descriptors from guest IO request */ - struct ioveciovpadding[NVME_MAX_BLOCKIOVS-BLOCKIF_IOV_MAX]; + struct ioveciovpadding[MDTS_PAD_SIZE]; }; enum nvme_dsm_type { @@ -279,7 +290,6 @@ struct pci_nvme_softc { }; -static void pci_nvme_io_partial(struct blockif_req *br, int err); static struct pci_nvme_ioreq *pci_nvme_get_ioreq(struct pci_nvme_softc *); static void pci_nvme_release_ioreq(struct pci_nvme_softc *, struct pci_nvme_ioreq *); static void pci_nvme_io_done(struct blockif_req *, int); @@ -433,7 +443,7 @@ pci_nvme_init_ctrldata(struct pci_nvme_softc *sc) cd->mic = 0; - cd->mdts = 9; /* max data transfer size (2^mdts * CAP.MPSMIN) */ + cd->mdts = NVME_MDTS; /* max data transfer size (2^mdts * CAP.MPSMIN) */ cd->ver = 0x00010300; @@ -1461,81 +1471,46 @@ pci_nvme_append_iov_req(struct pci_nvme_softc *sc, str { int iovidx; - if (req != NULL) { - /* concatenate contig block-iovs to minimize number of iovs */ - if ((req->prev_gpaddr + req->prev_size) == gpaddr) { - iovidx = req->io_req.br_iovcnt - 1; + if (req == NULL) + return (-1); - req->io_req.br_iov[iovidx].iov_base = - paddr_guest2host(req->sc->nsc_pi->pi_vmctx, -req->prev_gpaddr, size); + if (req->io_req.br_iovcnt == NVME_MAX_IOVEC) { + return (-1); + } - req->prev_size += size; - req->io_req.br_resid += size; + /* concatenate contig block-iovs to minimize number of iovs */ + if ((req->prev_gpaddr + req->prev_size) == gpaddr) { + iovidx = req->io_req.br_iovcnt - 1; - req->io_req.br_iov[iovidx].iov_len = req->prev_size; - } else { - pthread_mutex_lock(>mtx); + req->io_req.br_iov[iovidx].iov_base = + paddr_guest2host(req->sc->nsc_pi->pi_vmctx, +req->prev_gpaddr, size); - iovidx = req->io_req.br_iovcnt; - if
svn commit: r362765 - head/usr.sbin/bhyve
Author: chuck Date: Mon Jun 29 00:32:21 2020 New Revision: 362765 URL: https://svnweb.freebsd.org/changeset/base/362765 Log: bhyve: NVMe handle zero length DSM ranges Dataset Management range specifications may have a zero length (a.k.a. an empty range definition). Handle the case of all ranges being empty by completing with Success (DSM commands are advisory only). For Deallocate, skip empty range definitions when sending TRIM's to the backing storage. Fixes UNH Test 2.2.4 Reviewed by: imp Tested by:Jason Tubnor MFC after:2 weeks Differential Revision: https://reviews.freebsd.org/D24900 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c == --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:32:18 2020 (r362764) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:32:21 2020 (r362765) @@ -2098,6 +2098,8 @@ nvme_opc_dataset_mgmt(struct pci_nvme_softc *sc, struct pci_nvme_ioreq *req, uint16_t *status) { + struct nvme_dsm_range *range; + uint32_t nr, r, non_zero, dr; int err; bool pending = false; @@ -2106,10 +2108,31 @@ nvme_opc_dataset_mgmt(struct pci_nvme_softc *sc, goto out; } + nr = cmd->cdw10 & 0xff; + + /* copy locally because a range entry could straddle PRPs */ + range = calloc(1, NVME_MAX_DSM_TRIM); + if (range == NULL) { + pci_nvme_status_genc(status, NVME_SC_INTERNAL_DEVICE_ERROR); + goto out; + } + nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, cmd->prp1, cmd->prp2, + (uint8_t *)range, NVME_MAX_DSM_TRIM, NVME_COPY_FROM_PRP); + + /* Check for invalid ranges and the number of non-zero lengths */ + non_zero = 0; + for (r = 0; r <= nr; r++) { + if (pci_nvme_out_of_range(nvstore, + range[r].starting_lba, range[r].length)) { + pci_nvme_status_genc(status, NVME_SC_LBA_OUT_OF_RANGE); + goto out; + } + if (range[r].length != 0) + non_zero++; + } + if (cmd->cdw11 & NVME_DSM_ATTR_DEALLOCATE) { - struct nvme_dsm_range *range; size_t offset, bytes; - uint32_t nr, r; int sectsz_bits = sc->nvstore.sectsz_bits; /* @@ -2121,25 +2144,17 @@ nvme_opc_dataset_mgmt(struct pci_nvme_softc *sc, goto out; } - if (req == NULL) { - pci_nvme_status_genc(status, NVME_SC_INTERNAL_DEVICE_ERROR); + /* If all ranges have a zero length, return Success */ + if (non_zero == 0) { + pci_nvme_status_genc(status, NVME_SC_SUCCESS); goto out; } - /* copy locally because a range entry could straddle PRPs */ - range = calloc(1, NVME_MAX_DSM_TRIM); - if (range == NULL) { + if (req == NULL) { pci_nvme_status_genc(status, NVME_SC_INTERNAL_DEVICE_ERROR); goto out; } - nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, cmd->prp1, cmd->prp2, - (uint8_t *)range, NVME_MAX_DSM_TRIM, NVME_COPY_FROM_PRP); - if (pci_nvme_out_of_range(nvstore, range[0].starting_lba, - range[0].length)) { - pci_nvme_status_genc(status, NVME_SC_LBA_OUT_OF_RANGE); - goto out; - } offset = range[0].starting_lba << sectsz_bits; bytes = range[0].length << sectsz_bits; @@ -2150,8 +2165,6 @@ nvme_opc_dataset_mgmt(struct pci_nvme_softc *sc, * * Note that NVMe Number of Ranges is a zero based value */ - nr = cmd->cdw10 & 0xff; - req->io_req.br_iovcnt = 0; req->io_req.br_offset = offset; req->io_req.br_resid = bytes; @@ -2161,20 +2174,20 @@ nvme_opc_dataset_mgmt(struct pci_nvme_softc *sc, } else { struct iovec *iov = req->io_req.br_iov; - for (r = 0; r <= nr; r++) { - if (pci_nvme_out_of_range(nvstore, range[r].starting_lba, - range[r].length)) { - pci_nvme_status_genc(status, NVME_SC_LBA_OUT_OF_RANGE); - goto out; - } + for (r = 0, dr = 0; r <= nr; r++) { offset = range[r].starting_lba << sectsz_bits; bytes = range[r].length << sectsz_bits; + if (bytes == 0) +
svn commit: r362756 - head/usr.sbin/bhyve
Author: chuck Date: Mon Jun 29 00:31:51 2020 New Revision: 362756 URL: https://svnweb.freebsd.org/changeset/base/362756 Log: bhyve: refactor NVMe I/O read/write Split the NVM I/O function (i.e. nvme_opc_write_read) into separate functions - one for RAM based backing-store and another for disk based backing-store for easier maintenance. No functional changes. Tested by:Jason Tubnor MFC after:2 weeks Differential Revision: https://reviews.freebsd.org/D24890 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c == --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:47 2020 (r362755) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:51 2020 (r362756) @@ -1683,6 +1683,108 @@ nvme_opc_flush(struct pci_nvme_softc *sc, return (pending); } +static uint16_t +nvme_write_read_ram(struct pci_nvme_softc *sc, +struct pci_nvme_blockstore *nvstore, +uint64_t prp1, uint64_t prp2, +size_t offset, uint64_t bytes, +bool is_write) +{ + uint8_t *buf = nvstore->ctx; + enum nvme_copy_dir dir; + uint16_t status; + + if (is_write) + dir = NVME_COPY_TO_PRP; + else + dir = NVME_COPY_FROM_PRP; + + if (nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, prp1, prp2, + buf + offset, bytes, dir)) + pci_nvme_status_genc(, + NVME_SC_DATA_TRANSFER_ERROR); + else + pci_nvme_status_genc(, NVME_SC_SUCCESS); + + return (status); +} + +static uint16_t +nvme_write_read_blockif(struct pci_nvme_softc *sc, +struct pci_nvme_blockstore *nvstore, +struct pci_nvme_ioreq *req, +uint64_t prp1, uint64_t prp2, +size_t offset, uint64_t bytes, +bool is_write) +{ + uint64_t size; + int err; + uint16_t status = NVME_NO_STATUS; + + size = MIN(PAGE_SIZE - (prp1 % PAGE_SIZE), bytes); + if (pci_nvme_append_iov_req(sc, req, prp1, + size, is_write, offset)) { + pci_nvme_status_genc(, + NVME_SC_DATA_TRANSFER_ERROR); + goto out; + } + + offset += size; + bytes -= size; + + if (bytes == 0) { + ; + } else if (bytes <= PAGE_SIZE) { + size = bytes; + if (pci_nvme_append_iov_req(sc, req, prp2, + size, is_write, offset)) { + pci_nvme_status_genc(, + NVME_SC_DATA_TRANSFER_ERROR); + goto out; + } + } else { + void *vmctx = sc->nsc_pi->pi_vmctx; + uint64_t *prp_list = + uint64_t *last = prp_list; + + /* PRP2 is pointer to a physical region page list */ + while (bytes) { + /* Last entry in list points to the next list */ + if (prp_list == last) { + uint64_t prp = *prp_list; + + prp_list = paddr_guest2host(vmctx, prp, + PAGE_SIZE - (prp % PAGE_SIZE)); + last = prp_list + (NVME_PRP2_ITEMS - 1); + } + + size = MIN(bytes, PAGE_SIZE); + + if (pci_nvme_append_iov_req(sc, req, *prp_list, + size, is_write, offset)) { + pci_nvme_status_genc(, + NVME_SC_DATA_TRANSFER_ERROR); + goto out; + } + + offset += size; + bytes -= size; + + prp_list++; + } + } + req->io_req.br_callback = pci_nvme_io_done; + if (is_write) + err = blockif_write(nvstore->ctx, >io_req); + else + err = blockif_read(nvstore->ctx, >io_req); + + if (err) + pci_nvme_status_genc(, NVME_SC_DATA_TRANSFER_ERROR); +out: + return (status); +} + static bool nvme_opc_write_read(struct pci_nvme_softc *sc, struct nvme_command *cmd, @@ -1714,85 +1816,13 @@ nvme_opc_write_read(struct pci_nvme_softc *sc, cmd->prp2 &= ~0x3UL; if (nvstore->type == NVME_STOR_RAM) { - uint8_t *buf = nvstore->ctx; - enum nvme_copy_dir dir; - - if (is_write) - dir = NVME_COPY_TO_PRP; - else - dir = NVME_COPY_FROM_PRP; - - if (nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, cmd->prp1, cmd->prp2, - buf + offset, bytes, dir)) - pci_nvme_status_genc(status, - NVME_SC_DATA_TRANSFER_ERROR); - else - pci_nvme_status_genc(status, NVME_SC_SUCCESS); +
svn commit: r362766 - head/usr.sbin/bhyve
Author: chuck Date: Mon Jun 29 00:32:24 2020 New Revision: 362766 URL: https://svnweb.freebsd.org/changeset/base/362766 Log: bhyve: fix NVMe Active Namespace list The NVMe specification requires unused entries in the Identify, Active Namespace ID data to be zero. Fix is bzero the provided page, similar to what is done for the Namespace Descriptors list. Fixes UNH Tests 2.6 and 2.9 Tested by:Jason Tubnor MFC after:2 weeks Differential Revision: https://reviews.freebsd.org/D24901 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c == --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:32:21 2020 (r362765) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:32:24 2020 (r362766) @@ -1144,8 +1144,9 @@ nvme_opc_identify(struct pci_nvme_softc* sc, struct nv case 0x02: /* list of 1024 active NSIDs > CDW1.NSID */ dest = vm_map_gpa(sc->nsc_pi->pi_vmctx, command->prp1, sizeof(uint32_t) * 1024); + /* All unused entries shall be zero */ + bzero(dest, sizeof(uint32_t) * 1024); ((uint32_t *)dest)[0] = 1; - ((uint32_t *)dest)[1] = 0; break; case 0x03: /* list of NSID structures in CDW1.NSID, 4096 bytes */ if (command->nsid != 1) { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362760 - head/usr.sbin/bhyve
Author: chuck Date: Mon Jun 29 00:32:04 2020 New Revision: 362760 URL: https://svnweb.freebsd.org/changeset/base/362760 Log: bhyve: validate the NVMe LBA start and count Add checks that the combination of Starting LBA and Number of Logical Blocks in a command will not exceed the range of the underlying storage. Note that because NVMe specifices the Starting LBA as a uint64_t, care must be taken when converting it and the block count to avoid an integer overflow. Fixes UNH Tests 2.2.3, 2.3.2, and 2.4.2 Tested by:Jason Tubnor MFC after:2 weeks Differential Revision: https://reviews.freebsd.org/D24895 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c == --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:32:01 2020 (r362759) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:32:04 2020 (r362760) @@ -1529,6 +1529,34 @@ pci_nvme_stats_write_read_update(struct pci_nvme_softc pthread_mutex_unlock(>mtx); } +/* + * Check if the combination of Starting LBA (slba) and Number of Logical + * Blocks (nlb) exceeds the range of the underlying storage. + * + * Because NVMe specifies the SLBA in blocks as a uint64_t and blockif stores + * the capacity in bytes as a uint64_t, care must be taken to avoid integer + * overflow. + */ +static bool +pci_nvme_out_of_range(struct pci_nvme_blockstore *nvstore, uint64_t slba, +uint32_t nlb) +{ + size_t offset, bytes; + + /* Overflow check of multiplying Starting LBA by the sector size */ + if (slba >> (64 - nvstore->sectsz_bits)) + return (true); + + offset = slba << nvstore->sectsz_bits; + bytes = nlb << nvstore->sectsz_bits; + + /* Overflow check of Number of Logical Blocks */ + if ((nvstore->size - offset) < bytes) + return (true); + + return (false); +} + static int pci_nvme_append_iov_req(struct pci_nvme_softc *sc, struct pci_nvme_ioreq *req, uint64_t gpaddr, size_t size, int do_write, uint64_t lba) @@ -1830,20 +1858,20 @@ nvme_opc_write_read(struct pci_nvme_softc *sc, lba = ((uint64_t)cmd->cdw11 << 32) | cmd->cdw10; nblocks = (cmd->cdw12 & 0x) + 1; + if (pci_nvme_out_of_range(nvstore, lba, nblocks)) { + WPRINTF("%s command would exceed LBA range", __func__); + pci_nvme_status_genc(status, NVME_SC_LBA_OUT_OF_RANGE); + goto out; + } - bytes = nblocks * nvstore->sectsz; + bytes = nblocks << nvstore->sectsz_bits; if (bytes > NVME_MAX_DATA_SIZE) { WPRINTF("%s command would exceed MDTS", __func__); pci_nvme_status_genc(status, NVME_SC_INVALID_FIELD); goto out; } - offset = lba * nvstore->sectsz; - if ((offset + bytes) > nvstore->size) { - WPRINTF("%s command would exceed LBA range", __func__); - pci_nvme_status_genc(status, NVME_SC_LBA_OUT_OF_RANGE); - goto out; - } + offset = lba << nvstore->sectsz_bits; req->bytes = bytes; req->io_req.br_offset = lba; @@ -1921,8 +1949,9 @@ nvme_opc_dataset_mgmt(struct pci_nvme_softc *sc, if (cmd->cdw11 & NVME_DSM_ATTR_DEALLOCATE) { struct nvme_dsm_range *range; + size_t offset, bytes; uint32_t nr, r; - int sectsz = sc->nvstore.sectsz; + int sectsz_bits = sc->nvstore.sectsz_bits; /* * DSM calls are advisory only, and compliant controllers @@ -1947,10 +1976,13 @@ nvme_opc_dataset_mgmt(struct pci_nvme_softc *sc, nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, cmd->prp1, cmd->prp2, (uint8_t *)range, NVME_MAX_DSM_TRIM, NVME_COPY_FROM_PRP); - if ((range[0].starting_lba * sectsz) > nvstore->size) { + if (pci_nvme_out_of_range(nvstore, range[0].starting_lba, + range[0].length)) { pci_nvme_status_genc(status, NVME_SC_LBA_OUT_OF_RANGE); goto out; } + offset = range[0].starting_lba << sectsz_bits; + bytes = range[0].length << sectsz_bits; /* * If the request is for more than a single range, store @@ -1962,8 +1994,8 @@ nvme_opc_dataset_mgmt(struct pci_nvme_softc *sc, nr = cmd->cdw10 & 0xff; req->io_req.br_iovcnt = 0; - req->io_req.br_offset = range[0].starting_lba * sectsz; - req->io_req.br_resid = range[0].length * sectsz; + req->io_req.br_offset = offset; + req->io_req.br_resid = bytes; if (nr == 0) { req->io_req.br_callback = pci_nvme_io_done; @@ -1971,12 +2003,19 @@ nvme_opc_dataset_mgmt(struct
svn commit: r362752 - head/usr.sbin/bhyve
Author: chuck Date: Mon Jun 29 00:31:37 2020 New Revision: 362752 URL: https://svnweb.freebsd.org/changeset/base/362752 Log: bhyve: fix NVMe queue creation and deletion Add checks for various types of invalid I/O Queue Create and Delete command parameters, including: - QID=0 - QID>MAX - QID already in use - Delete an Active CQ - Invalid QSIZE - Invalid CQID (SQ creation) - Invalid interrupt vector (CQ creation) Fixes UNH Tests 1.4.2-5,7-8 Tested by:Jason Tubnor MFC after:2 weeks Differential Revision: https://reviews.freebsd.org/D24886 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c == --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:34 2020 (r362751) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:37 2020 (r362752) @@ -705,7 +705,8 @@ nvme_opc_delete_io_sq(struct pci_nvme_softc* sc, struc uint16_t qid = command->cdw10 & 0x; DPRINTF("%s DELETE_IO_SQ %u", __func__, qid); - if (qid == 0 || qid > sc->num_squeues) { + if (qid == 0 || qid > sc->num_squeues || + (sc->submit_queues[qid].qbase == NULL)) { WPRINTF("%s NOT PERMITTED queue id %u / num_squeues %u", __func__, qid, sc->num_squeues); pci_nvme_status_tc(>status, NVME_SCT_COMMAND_SPECIFIC, @@ -714,6 +715,7 @@ nvme_opc_delete_io_sq(struct pci_nvme_softc* sc, struc } sc->submit_queues[qid].qbase = NULL; + sc->submit_queues[qid].cqid = 0; pci_nvme_status_genc(>status, NVME_SC_SUCCESS); return (1); } @@ -726,7 +728,8 @@ nvme_opc_create_io_sq(struct pci_nvme_softc* sc, struc uint16_t qid = command->cdw10 & 0x; struct nvme_submission_queue *nsq; - if ((qid == 0) || (qid > sc->num_squeues)) { + if ((qid == 0) || (qid > sc->num_squeues) || + (sc->submit_queues[qid].qbase != NULL)) { WPRINTF("%s queue index %u > num_squeues %u", __func__, qid, sc->num_squeues); pci_nvme_status_tc(>status, @@ -737,12 +740,39 @@ nvme_opc_create_io_sq(struct pci_nvme_softc* sc, struc nsq = >submit_queues[qid]; nsq->size = ONE_BASED((command->cdw10 >> 16) & 0x); + DPRINTF("%s size=%u (max=%u)", __func__, nsq->size, sc->max_qentries); + if ((nsq->size < 2) || (nsq->size > sc->max_qentries)) { + /* +* Queues must specify at least two entries +* NOTE: "MAXIMUM QUEUE SIZE EXCEEDED" was renamed to +* "INVALID QUEUE SIZE" in the NVM Express 1.3 Spec +*/ + pci_nvme_status_tc(>status, + NVME_SCT_COMMAND_SPECIFIC, + NVME_SC_MAXIMUM_QUEUE_SIZE_EXCEEDED); + return (1); + } - nsq->qbase = vm_map_gpa(sc->nsc_pi->pi_vmctx, command->prp1, - sizeof(struct nvme_command) * (size_t)nsq->size); nsq->cqid = (command->cdw11 >> 16) & 0x; + if ((nsq->cqid == 0) || (nsq->cqid > sc->num_cqueues)) { + pci_nvme_status_tc(>status, + NVME_SCT_COMMAND_SPECIFIC, + NVME_SC_INVALID_QUEUE_IDENTIFIER); + return (1); + } + + if (sc->compl_queues[nsq->cqid].qbase == NULL) { + pci_nvme_status_tc(>status, + NVME_SCT_COMMAND_SPECIFIC, + NVME_SC_COMPLETION_QUEUE_INVALID); + return (1); + } + nsq->qpriority = (command->cdw11 >> 1) & 0x03; + nsq->qbase = vm_map_gpa(sc->nsc_pi->pi_vmctx, command->prp1, + sizeof(struct nvme_command) * (size_t)nsq->size); + DPRINTF("%s sq %u size %u gaddr %p cqid %u", __func__, qid, nsq->size, nsq->qbase, nsq->cqid); @@ -768,9 +798,11 @@ nvme_opc_delete_io_cq(struct pci_nvme_softc* sc, struc struct nvme_completion* compl) { uint16_t qid = command->cdw10 & 0x; + uint16_t sqid; DPRINTF("%s DELETE_IO_CQ %u", __func__, qid); - if (qid == 0 || qid > sc->num_cqueues) { + if (qid == 0 || qid > sc->num_cqueues || + (sc->compl_queues[qid].qbase == NULL)) { WPRINTF("%s queue index %u / num_cqueues %u", __func__, qid, sc->num_cqueues); pci_nvme_status_tc(>status, NVME_SCT_COMMAND_SPECIFIC, @@ -778,6 +810,15 @@ nvme_opc_delete_io_cq(struct pci_nvme_softc* sc, struc return (1); } +
svn commit: r362758 - head/usr.sbin/bhyve
Author: chuck Date: Mon Jun 29 00:31:58 2020 New Revision: 362758 URL: https://svnweb.freebsd.org/changeset/base/362758 Log: bhyve: validate NVMe deallocate range values For NVMe emulation, validate the Data Set Management LBA ranges do not exceed the capacity of the backing storage. If they do, return an "LBA Out of Range" error. Fixes UNH Test 2.2.3 Tested by:Jason Tubnor MFC after:2 weeks Differential Revision: https://reviews.freebsd.org/D24893 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c == --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:54 2020 (r362757) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:58 2020 (r362758) @@ -1877,6 +1877,11 @@ nvme_opc_dataset_mgmt(struct pci_nvme_softc *sc, nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, cmd->prp1, cmd->prp2, (uint8_t *)range, NVME_MAX_DSM_TRIM, NVME_COPY_FROM_PRP); + if ((range[0].starting_lba * sectsz) > nvstore->size) { + pci_nvme_status_genc(status, NVME_SC_LBA_OUT_OF_RANGE); + goto out; + } + /* * If the request is for more than a single range, store * the ranges in the br_iov. Optimize for the common case @@ -1896,6 +1901,10 @@ nvme_opc_dataset_mgmt(struct pci_nvme_softc *sc, struct iovec *iov = req->io_req.br_iov; for (r = 0; r <= nr; r++) { + if ((range[r].starting_lba * sectsz) > nvstore->size) { + pci_nvme_status_genc(status, NVME_SC_LBA_OUT_OF_RANGE); + goto out; + } iov[r].iov_base = (void *)(range[r].starting_lba * sectsz); iov[r].iov_len = range[r].length * sectsz; } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362754 - head/usr.sbin/bhyve
Author: chuck Date: Mon Jun 29 00:31:44 2020 New Revision: 362754 URL: https://svnweb.freebsd.org/changeset/base/362754 Log: bhyve: make unsupported NVMe commands a debug message Tested by:Jason Tubnor MFC after:2 weeks Differential Revision: https://reviews.freebsd.org/D24888 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c == --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:41 2020 (r362753) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:44 2020 (r362754) @@ -1353,7 +1353,7 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, u compl.status = NVME_NO_STATUS; break; default: - WPRINTF("0x%x command is not implemented", + DPRINTF("0x%x command is not implemented", cmd->opc); pci_nvme_status_genc(, NVME_SC_INVALID_OPCODE); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362749 - head/usr.sbin/bhyve
Author: chuck Date: Mon Jun 29 00:31:27 2020 New Revision: 362749 URL: https://svnweb.freebsd.org/changeset/base/362749 Log: bhyve: Consolidate NVMe CQ update Consolidate the code which writes Completion Queue entries and updates the CQ doorbell value. While in the neighborhood, convert the "toggle CQ phase bit" code to use an XOR operation instead of an "if/else" branch. Tested by:Jason Tubnor MFC after:2 weeks Differential Revision: https://reviews.freebsd.org/D24882 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c == --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:24 2020 (r362748) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:27 2020 (r362749) @@ -329,16 +329,6 @@ pci_nvme_status_genc(uint16_t *status, uint16_t code) pci_nvme_status_tc(status, NVME_SCT_GENERIC, code); } -static __inline void -pci_nvme_toggle_phase(uint16_t *status, int prev) -{ - - if (prev) - *status &= ~NVME_STATUS_P; - else - *status |= NVME_STATUS_P; -} - /* * Initialize the requested number or IO Submission and Completion Queues. * Admin queues are allocated implicitly. @@ -617,6 +607,7 @@ pci_nvme_init_controller(struct vmctx *ctx, struct pci sc->compl_queues[0].size = acqs; sc->compl_queues[0].qbase = vm_map_gpa(ctx, sc->regs.acq, sizeof(struct nvme_completion) * acqs); + DPRINTF("%s mapping Admin-CQ guest 0x%lx, host: %p", __func__, sc->regs.acq, sc->compl_queues[0].qbase); } @@ -668,6 +659,45 @@ nvme_prp_memcpy(struct vmctx *ctx, uint64_t prp1, uint return (0); } +/* + * Write a Completion Queue Entry update + * + * Write the completion and update the doorbell value + */ +static void +pci_nvme_cq_update(struct pci_nvme_softc *sc, + struct nvme_completion_queue *cq, + uint32_t cdw0, + uint16_t cid, + uint16_t sqid, + uint16_t status) +{ + struct nvme_submission_queue *sq = >submit_queues[sqid]; + struct nvme_completion *cqe; + + assert(cq->qbase != NULL); + + pthread_mutex_lock(>mtx); + + cqe = >qbase[cq->tail]; + + /* Flip the phase bit */ + status |= (cqe->status ^ NVME_STATUS_P) & NVME_STATUS_P_MASK; + + cqe->cdw0 = cdw0; + cqe->sqhd = sq->head; + cqe->sqid = sqid; + cqe->cid = cid; + cqe->status = status; + + cq->tail++; + if (cq->tail >= cq->size) { + cq->tail = 0; + } + + pthread_mutex_unlock(>mtx); +} + static int nvme_opc_delete_io_sq(struct pci_nvme_softc* sc, struct nvme_command* command, struct nvme_completion* compl) @@ -757,6 +787,7 @@ static int nvme_opc_create_io_cq(struct pci_nvme_softc* sc, struct nvme_command* command, struct nvme_completion* compl) { + if (command->cdw11 & NVME_CMD_CDW11_PC) { uint16_t qid = command->cdw10 & 0x; struct nvme_completion_queue *ncq; @@ -1191,24 +1222,11 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, u sqhead = (sqhead + 1) % sq->size; if (NVME_COMPLETION_VALID(compl)) { - struct nvme_completion *cp; - int phase; - - pthread_mutex_lock(>mtx); - - cp = &(cq->qbase)[cq->tail]; - cp->cdw0 = compl.cdw0; - cp->sqid = 0; - cp->sqhd = sqhead; - cp->cid = cmd->cid; - - phase = NVME_STATUS_GET_P(cp->status); - cp->status = compl.status; - pci_nvme_toggle_phase(>status, phase); - - cq->tail = (cq->tail + 1) % cq->size; - - pthread_mutex_unlock(>mtx); + pci_nvme_cq_update(sc, >compl_queues[0], + compl.cdw0, + cmd->cid, + 0, /* SQID */ + compl.status); } } @@ -1311,32 +1329,16 @@ pci_nvme_set_completion(struct pci_nvme_softc *sc, uint32_t cdw0, uint16_t status) { struct nvme_completion_queue *cq = >compl_queues[sq->cqid]; - struct nvme_completion *compl; - int phase; DPRINTF("%s sqid %d cqid %u cid %u status: 0x%x 0x%x", __func__, sqid, sq->cqid, cid, NVME_STATUS_GET_SCT(status), NVME_STATUS_GET_SC(status)); - pthread_mutex_lock(>mtx); - - assert(cq->qbase != NULL); - - compl = >qbase[cq->tail]; - - compl->cdw0 = cdw0; - compl->sqid = sqid; - compl->sqhd = sq->head; - compl->cid = cid; - - // toggle phase - phase =
svn commit: r362753 - head/usr.sbin/bhyve
Author: chuck Date: Mon Jun 29 00:31:41 2020 New Revision: 362753 URL: https://svnweb.freebsd.org/changeset/base/362753 Log: bhyve: add more compliant NVMe Get/Set Features Create a generic Get/Set Features by saving off the contents of CDW11 from the Set command and returning the saved value in the completion of the Get command. Implementation allows providing optional implementation for both Set and Get. Add infrastructure to determine which feature ID's are namespace specific and flag violations of this category of error. Also adds the feature specific behavior of Set Features, Number of Queues to only allow this command once per Controller reset. Fixes UNH Tests 1.2, 5.4, and 5.5.6 Tested by:Jason Tubnor MFC after:2 weeks Differential Revision: https://reviews.freebsd.org/D24887 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c == --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:37 2020 (r362752) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:41 2020 (r362753) @@ -222,6 +222,23 @@ enum nvme_dsm_type { NVME_DATASET_MANAGEMENT_DISABLE, }; +struct pci_nvme_softc; +struct nvme_feature_obj; + +typedef void (*nvme_feature_cb)(struct pci_nvme_softc *, +struct nvme_feature_obj *, +struct nvme_command *, +struct nvme_completion *); + +struct nvme_feature_obj { + uint32_tcdw11; + nvme_feature_cb set; + nvme_feature_cb get; + bool namespace_specific; +}; + +#define NVME_FID_MAX (NVME_FEAT_ENDURANCE_GROUP_EVENT_CONFIGURATION + 1) + struct pci_nvme_softc { struct pci_devinst *nsc_pi; @@ -241,6 +258,7 @@ struct pci_nvme_softc { uint32_tmax_queues; /* max number of IO SQ's or CQ's */ uint32_tnum_cqueues; uint32_tnum_squeues; + boolnum_q_is_set; /* Has host set Number of Queues */ struct pci_nvme_ioreq *ioreqs; STAILQ_HEAD(, pci_nvme_ioreq) ioreqs_free; /* free list of ioreqs */ @@ -255,10 +273,7 @@ struct pci_nvme_softc { struct nvme_completion_queue *compl_queues; struct nvme_submission_queue *submit_queues; - /* controller features */ - uint32_tintr_coales_aggr_time; /* 0x08: uS to delay intr */ - uint32_tintr_coales_aggr_thresh; /* 0x08: compl-Q entries */ - uint32_tasync_ev_config; /* 0x0B: async event config */ + struct nvme_feature_obj feat[NVME_FID_MAX]; enum nvme_dsm_type dataset_management; }; @@ -303,6 +318,15 @@ static void pci_nvme_io_partial(struct blockif_req *br #define NVME_ONCS_DSM (NVME_CTRLR_DATA_ONCS_DSM_MASK << \ NVME_CTRLR_DATA_ONCS_DSM_SHIFT) +static void nvme_feature_invalid_cb(struct pci_nvme_softc *, +struct nvme_feature_obj *, +struct nvme_command *, +struct nvme_completion *); +static void nvme_feature_num_queues(struct pci_nvme_softc *, +struct nvme_feature_obj *, +struct nvme_command *, +struct nvme_completion *); + static __inline void cpywithpad(char *dst, size_t dst_size, const char *src, char pad) { @@ -542,6 +566,18 @@ pci_nvme_init_logpages(struct pci_nvme_softc *sc) } static void +pci_nvme_init_features(struct pci_nvme_softc *sc) +{ + + sc->feat[0].set = nvme_feature_invalid_cb; + sc->feat[0].get = nvme_feature_invalid_cb; + + sc->feat[NVME_FEAT_LBA_RANGE_TYPE].namespace_specific = true; + sc->feat[NVME_FEAT_ERROR_RECOVERY].namespace_specific = true; + sc->feat[NVME_FEAT_NUMBER_OF_QUEUES].set = nvme_feature_num_queues; +} + +static void pci_nvme_reset_locked(struct pci_nvme_softc *sc) { uint32_t i; @@ -577,6 +613,8 @@ pci_nvme_reset_locked(struct pci_nvme_softc *sc) sc->compl_queues[i].tail = 0; sc->compl_queues[i].head = 0; } + + sc->num_q_is_set = false; } static void @@ -982,24 +1020,144 @@ nvme_opc_identify(struct pci_nvme_softc* sc, struct nv DPRINTF("%s unsupported identify command requested 0x%x", __func__, command->cdw10 & 0xFF); pci_nvme_status_genc(, NVME_SC_INVALID_FIELD); - return (1); + break; } compl->status = status; return (1); } -static int -nvme_set_feature_queues(struct pci_nvme_softc* sc, struct nvme_command* command, - struct nvme_completion* compl) +static const char * +nvme_fid_to_name(uint8_t fid) { + const char *name; + + switch (fid) { + case NVME_FEAT_ARBITRATION: + name = "Arbitration"; + break; + case NVME_FEAT_POWER_MANAGEMENT: + name = "Power Management"; + break; + case NVME_FEAT_LBA_RANGE_TYPE: + name = "LBA Range Type"; + break; +
svn commit: r362751 - head/usr.sbin/bhyve
Author: chuck Date: Mon Jun 29 00:31:34 2020 New Revision: 362751 URL: https://svnweb.freebsd.org/changeset/base/362751 Log: bhyve: fix NVMe Get Log Page command Fix the logic in nvme_opc_get_log_page to calculate the number of DWORDS (uint32_t) instead of WORDS (uint16_t) for the byte length. And only return the allowed number of Log Page bytes as determined by the user request and actual size of the requested log page. Fixes UNH Test 1.3 Tested by:Jason Tubnor MFC after:2 weeks Differential Revision: https://reviews.freebsd.org/D24885 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c == --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:30 2020 (r362750) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:34 2020 (r362751) @@ -830,32 +830,42 @@ static int nvme_opc_get_log_page(struct pci_nvme_softc* sc, struct nvme_command* command, struct nvme_completion* compl) { - uint32_t logsize = (1 + ((command->cdw10 >> 16) & 0xFFF)) * 2; + uint32_t logsize; uint8_t logpage = command->cdw10 & 0xFF; DPRINTF("%s log page %u len %u", __func__, logpage, logsize); pci_nvme_status_genc(>status, NVME_SC_SUCCESS); + /* +* Command specifies the number of dwords to return in fields NUMDU +* and NUMDL. This is a zero-based value. +*/ + logsize = ((command->cdw11 << 16) | (command->cdw10 >> 16)) + 1; + logsize *= sizeof(uint32_t); + switch (logpage) { case NVME_LOG_ERROR: nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, command->prp1, - command->prp2, (uint8_t *)>err_log, logsize, + command->prp2, (uint8_t *)>err_log, + MIN(logsize, sizeof(sc->err_log)), NVME_COPY_TO_PRP); break; case NVME_LOG_HEALTH_INFORMATION: /* TODO: present some smart info */ nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, command->prp1, - command->prp2, (uint8_t *)>health_log, logsize, + command->prp2, (uint8_t *)>health_log, + MIN(logsize, sizeof(sc->health_log)), NVME_COPY_TO_PRP); break; case NVME_LOG_FIRMWARE_SLOT: nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, command->prp1, - command->prp2, (uint8_t *)>fw_log, logsize, + command->prp2, (uint8_t *)>fw_log, + MIN(logsize, sizeof(sc->fw_log)), NVME_COPY_TO_PRP); break; default: - WPRINTF("%s get log page %x command not supported", + DPRINTF("%s get log page %x command not supported", __func__, logpage); pci_nvme_status_tc(>status, NVME_SCT_COMMAND_SPECIFIC, ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362750 - head/usr.sbin/bhyve
Author: chuck Date: Mon Jun 29 00:31:30 2020 New Revision: 362750 URL: https://svnweb.freebsd.org/changeset/base/362750 Log: bhyve: implement NVMe Namespace Identification Descriptor NVMe 1.3 compliant controllers must implement the Namespace Identification Descriptor structure (i.e. CNS=3). Previously this was unimplemented. Fixes UNH Test 1.1.4-0 Tested by:Jason Tubnor MFC after:2 weeks Differential Revision: https://reviews.freebsd.org/D24884 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c == --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:27 2020 (r362749) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:30 2020 (r362750) @@ -870,10 +870,13 @@ nvme_opc_identify(struct pci_nvme_softc* sc, struct nv struct nvme_completion* compl) { void *dest; + uint16_t status; DPRINTF("%s identify 0x%x nsid 0x%x", __func__, command->cdw10 & 0xFF, command->nsid); + pci_nvme_status_genc(, NVME_SC_SUCCESS); + switch (command->cdw10 & 0xFF) { case 0x00: /* return Identify Namespace data structure */ nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, command->prp1, @@ -892,24 +895,30 @@ nvme_opc_identify(struct pci_nvme_softc* sc, struct nv ((uint32_t *)dest)[0] = 1; ((uint32_t *)dest)[1] = 0; break; - case 0x11: - pci_nvme_status_genc(>status, - NVME_SC_INVALID_NAMESPACE_OR_FORMAT); - return (1); case 0x03: /* list of NSID structures in CDW1.NSID, 4096 bytes */ - case 0x10: - case 0x12: - case 0x13: - case 0x14: - case 0x15: + if (command->nsid != 1) { + pci_nvme_status_genc(, + NVME_SC_INVALID_NAMESPACE_OR_FORMAT); + break; + } + dest = vm_map_gpa(sc->nsc_pi->pi_vmctx, command->prp1, + sizeof(uint32_t) * 1024); + /* All bytes after the descriptor shall be zero */ + bzero(dest, sizeof(uint32_t) * 1024); + + /* Return NIDT=1 (i.e. EUI64) descriptor */ + ((uint8_t *)dest)[0] = 1; + ((uint8_t *)dest)[1] = sizeof(uint64_t); + bcopy(sc->nsdata.eui64, ((uint8_t *)dest) + 4, sizeof(uint64_t)); + break; default: DPRINTF("%s unsupported identify command requested 0x%x", __func__, command->cdw10 & 0xFF); - pci_nvme_status_genc(>status, NVME_SC_INVALID_FIELD); + pci_nvme_status_genc(, NVME_SC_INVALID_FIELD); return (1); } - pci_nvme_status_genc(>status, NVME_SC_SUCCESS); + compl->status = status; return (1); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362747 - head/usr.sbin/bhyve
Author: chuck Date: Mon Jun 29 00:31:20 2020 New Revision: 362747 URL: https://svnweb.freebsd.org/changeset/base/362747 Log: bhyve: add a comment explaining NVME dsm option Tested by:Jason Tubnor MFC after:2 weeks Differential Revision: https://reviews.freebsd.org/D24881 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c == --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:17 2020 (r362746) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:20 2020 (r362747) @@ -34,7 +34,7 @@ * bhyve PCIe-NVMe device emulation. * * options: - * -s ,nvme,devpath,maxq=#,qsz=#,ioslots=#,sectsz=#,ser=A-Z,eui64=# + * -s ,nvme,devpath,maxq=#,qsz=#,ioslots=#,sectsz=#,ser=A-Z,eui64=#,dsm= * * accepted devpath: */dev/blockdev @@ -47,6 +47,7 @@ * sectsz = sector size (defaults to blockif sector size) * ser = serial number (20-chars max) * eui64 = IEEE Extended Unique Identifier (8 byte value) + * dsm = DataSet Management support. Option is one of auto, enable,disable * */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362746 - head/usr.sbin/bhyve
Author: chuck Date: Mon Jun 29 00:31:17 2020 New Revision: 362746 URL: https://svnweb.freebsd.org/changeset/base/362746 Log: bhyve: implement NVMe Flush command This adds support for the NVMe I/O command Flush. For block-based devices, submit a DIOCGFLUSH to the backing storage. Otherwise, command is treated like a NOP and completes with a Successful status. Tested by:Jason Tubnor MFC after:2 weeks Differential Revision: https://reviews.freebsd.org/D24880 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c == --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:14 2020 (r362745) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:17 2020 (r362746) @@ -58,6 +58,7 @@ #include __FBSDID("$FreeBSD$"); +#include #include #include @@ -1387,7 +1388,47 @@ pci_nvme_io_partial(struct blockif_req *br, int err) pthread_cond_signal(>cv); } +/* + * Implements the Flush command. The specification states: + *If a volatile write cache is not present, Flush commands complete + *successfully and have no effect + * in the description of the Volatile Write Cache (VWC) field of the Identify + * Controller data. Therefore, set status to Success if the command is + * not supported (i.e. RAM or as indicated by the blockif). + */ static bool +nvme_opc_flush(struct pci_nvme_softc *sc, +struct nvme_command *cmd, +struct pci_nvme_blockstore *nvstore, +struct pci_nvme_ioreq *req, +uint16_t *status) +{ + bool pending = false; + + if (nvstore->type == NVME_STOR_RAM) { + pci_nvme_status_genc(status, NVME_SC_SUCCESS); + } else { + int err; + + req->io_req.br_callback = pci_nvme_io_done; + + err = blockif_flush(nvstore->ctx, >io_req); + switch (err) { + case 0: + pending = true; + break; + case EOPNOTSUPP: + pci_nvme_status_genc(status, NVME_SC_SUCCESS); + break; + default: + pci_nvme_status_genc(status, NVME_SC_INTERNAL_DEVICE_ERROR); + } + } + + return (pending); +} + +static bool nvme_opc_write_read(struct pci_nvme_softc *sc, struct nvme_command *cmd, struct pci_nvme_blockstore *nvstore, @@ -1682,7 +1723,8 @@ pci_nvme_handle_io_cmd(struct pci_nvme_softc* sc, uint switch (cmd->opc) { case NVME_OPC_FLUSH: - pci_nvme_status_genc(, NVME_SC_SUCCESS); + pending = nvme_opc_flush(sc, cmd, >nvstore, + req, ); break; case NVME_OPC_WRITE: case NVME_OPC_READ: ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362744 - head/usr.sbin/bhyve
Author: chuck Date: Mon Jun 29 00:31:11 2020 New Revision: 362744 URL: https://svnweb.freebsd.org/changeset/base/362744 Log: bhyve: convert NVMe logging statements Convert the debug and warning logging macros to be parameterized and correctly use bhyve's PRINTLN macro. Reviewed by: imp Tested by:Jason Tubnor MFC after:2 weeks Differential Revision: https://reviews.freebsd.org/D24878 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c == --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:28:11 2020 (r362743) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:11 2020 (r362744) @@ -83,8 +83,8 @@ __FBSDID("$FreeBSD$"); static int nvme_debug = 0; -#defineDPRINTF(params) if (nvme_debug) PRINTLN params -#defineWPRINTF(params) PRINTLN params +#defineDPRINTF(fmt, args...) if (nvme_debug) PRINTLN(fmt, ##args) +#defineWPRINTF(fmt, args...) PRINTLN(fmt, ##args) /* defaults; can be overridden */ #defineNVME_MSIX_BAR 4 @@ -495,7 +495,7 @@ pci_nvme_init_logpages(struct pci_nvme_softc *sc) static void pci_nvme_reset_locked(struct pci_nvme_softc *sc) { - DPRINTF(("%s", __func__)); + DPRINTF("%s", __func__); sc->regs.cap_lo = (ZERO_BASED(sc->max_qentries) & NVME_CAP_LO_REG_MQES_MASK) | (1 << NVME_CAP_LO_REG_CQR_SHIFT) | @@ -562,23 +562,23 @@ pci_nvme_init_controller(struct vmctx *ctx, struct pci { uint16_t acqs, asqs; - DPRINTF(("%s", __func__)); + DPRINTF("%s", __func__); asqs = (sc->regs.aqa & NVME_AQA_REG_ASQS_MASK) + 1; sc->submit_queues[0].size = asqs; sc->submit_queues[0].qbase = vm_map_gpa(ctx, sc->regs.asq, sizeof(struct nvme_command) * asqs); - DPRINTF(("%s mapping Admin-SQ guest 0x%lx, host: %p", - __func__, sc->regs.asq, sc->submit_queues[0].qbase)); + DPRINTF("%s mapping Admin-SQ guest 0x%lx, host: %p", + __func__, sc->regs.asq, sc->submit_queues[0].qbase); acqs = ((sc->regs.aqa >> NVME_AQA_REG_ACQS_SHIFT) & NVME_AQA_REG_ACQS_MASK) + 1; sc->compl_queues[0].size = acqs; sc->compl_queues[0].qbase = vm_map_gpa(ctx, sc->regs.acq, sizeof(struct nvme_completion) * acqs); - DPRINTF(("%s mapping Admin-CQ guest 0x%lx, host: %p", - __func__, sc->regs.acq, sc->compl_queues[0].qbase)); + DPRINTF("%s mapping Admin-CQ guest 0x%lx, host: %p", + __func__, sc->regs.acq, sc->compl_queues[0].qbase); } static int @@ -634,10 +634,10 @@ nvme_opc_delete_io_sq(struct pci_nvme_softc* sc, struc { uint16_t qid = command->cdw10 & 0x; - DPRINTF(("%s DELETE_IO_SQ %u", __func__, qid)); + DPRINTF("%s DELETE_IO_SQ %u", __func__, qid); if (qid == 0 || qid > sc->num_squeues) { - WPRINTF(("%s NOT PERMITTED queue id %u / num_squeues %u", - __func__, qid, sc->num_squeues)); + WPRINTF("%s NOT PERMITTED queue id %u / num_squeues %u", + __func__, qid, sc->num_squeues); pci_nvme_status_tc(>status, NVME_SCT_COMMAND_SPECIFIC, NVME_SC_INVALID_QUEUE_IDENTIFIER); return (1); @@ -657,8 +657,8 @@ nvme_opc_create_io_sq(struct pci_nvme_softc* sc, struc struct nvme_submission_queue *nsq; if ((qid == 0) || (qid > sc->num_squeues)) { - WPRINTF(("%s queue index %u > num_squeues %u", - __func__, qid, sc->num_squeues)); + WPRINTF("%s queue index %u > num_squeues %u", + __func__, qid, sc->num_squeues); pci_nvme_status_tc(>status, NVME_SCT_COMMAND_SPECIFIC, NVME_SC_INVALID_QUEUE_IDENTIFIER); @@ -673,20 +673,20 @@ nvme_opc_create_io_sq(struct pci_nvme_softc* sc, struc nsq->cqid = (command->cdw11 >> 16) & 0x; nsq->qpriority = (command->cdw11 >> 1) & 0x03; - DPRINTF(("%s sq %u size %u gaddr %p cqid %u", __func__, - qid, nsq->size, nsq->qbase, nsq->cqid)); + DPRINTF("%s sq %u size %u gaddr %p cqid %u", __func__, + qid, nsq->size, nsq->qbase, nsq->cqid); pci_nvme_status_genc(>status, NVME_SC_SUCCESS); - DPRINTF(("%s completed creating IOSQ qid %u", -__func__, qid)); + DPRINTF("%s completed creating IOSQ qid %u", +__func__, qid); } else { /* * Guest sent non-cont submission queue request. * This setting is unsupported by this emulation. */ -
svn commit: r362745 - head/usr.sbin/bhyve
Author: chuck Date: Mon Jun 29 00:31:14 2020 New Revision: 362745 URL: https://svnweb.freebsd.org/changeset/base/362745 Log: bhyve: refactor NVMe IO command handling This refactors the NVMe I/O command processing function to make adding new commands easier. The main change is to move command specific processing (i.e. Read/Write) to separate functions for each NVMe I/O command and leave the common per-command processing in the existing pci_nvme_handle_io_cmd() function. While here, add checks for some common errors (invalid Namespace ID, invalid opcode, LBA out of range). Add myself to the Copyright holders Reviewed by: imp Tested by:Jason Tubnor MFC after:2 weeks Differential Revision: https://reviews.freebsd.org/D24879 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c == --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:11 2020 (r362744) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:14 2020 (r362745) @@ -3,6 +3,7 @@ * * Copyright (c) 2017 Shunsuke Mie * Copyright (c) 2018 Leon Dang + * Copyright (c) 2020 Chuck Tuffli * * Function crc16 Copyright (c) 2017, Fedor Uporov * Obtained from function ext2_crc16() in sys/fs/ext2fs/ext2_csum.c @@ -1386,6 +1387,122 @@ pci_nvme_io_partial(struct blockif_req *br, int err) pthread_cond_signal(>cv); } +static bool +nvme_opc_write_read(struct pci_nvme_softc *sc, +struct nvme_command *cmd, +struct pci_nvme_blockstore *nvstore, +struct pci_nvme_ioreq *req, +uint16_t *status) +{ + uint64_t lba, nblocks, bytes; + size_t offset; + bool is_write = cmd->opc == NVME_OPC_WRITE; + bool pending = false; + + lba = ((uint64_t)cmd->cdw11 << 32) | cmd->cdw10; + nblocks = (cmd->cdw12 & 0x) + 1; + + offset = lba * nvstore->sectsz; + bytes = nblocks * nvstore->sectsz; + + if ((offset + bytes) > nvstore->size) { + WPRINTF("%s command would exceed LBA range", __func__); + pci_nvme_status_genc(status, NVME_SC_LBA_OUT_OF_RANGE); + goto out; + } + + req->io_req.br_offset = lba; + + /* PRP bits 1:0 must be zero */ + cmd->prp1 &= ~0x3UL; + cmd->prp2 &= ~0x3UL; + + if (nvstore->type == NVME_STOR_RAM) { + uint8_t *buf = nvstore->ctx; + enum nvme_copy_dir dir; + + if (is_write) + dir = NVME_COPY_TO_PRP; + else + dir = NVME_COPY_FROM_PRP; + + if (nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, cmd->prp1, cmd->prp2, + buf + offset, bytes, dir)) + pci_nvme_status_genc(status, + NVME_SC_DATA_TRANSFER_ERROR); + else + pci_nvme_status_genc(status, NVME_SC_SUCCESS); + } else { + uint64_t size; + int err; + + size = MIN(PAGE_SIZE - (cmd->prp1 % PAGE_SIZE), bytes); + if (pci_nvme_append_iov_req(sc, req, cmd->prp1, + size, is_write, offset)) { + pci_nvme_status_genc(status, + NVME_SC_DATA_TRANSFER_ERROR); + goto out; + } + + offset += size; + bytes -= size; + + if (bytes == 0) { + ; + } else if (bytes <= PAGE_SIZE) { + size = bytes; + if (pci_nvme_append_iov_req(sc, req, cmd->prp2, + size, is_write, offset)) { + pci_nvme_status_genc(status, + NVME_SC_DATA_TRANSFER_ERROR); + goto out; + } + } else { + void *vmctx = sc->nsc_pi->pi_vmctx; + uint64_t *prp_list = >prp2; + uint64_t *last = prp_list; + + /* PRP2 is pointer to a physical region page list */ + while (bytes) { + /* Last entry in list points to the next list */ + if (prp_list == last) { + uint64_t prp = *prp_list; + + prp_list = paddr_guest2host(vmctx, prp, + PAGE_SIZE - (prp % PAGE_SIZE)); + last = prp_list + (NVME_PRP2_ITEMS - 1); + } + + size = MIN(bytes, PAGE_SIZE); + + if (pci_nvme_append_iov_req(sc, req, *prp_list, + size, is_write, offset)) { +
svn commit: r362742 - head/usr.sbin/config
Author: 0mp (doc,ports committer) Date: Sun Jun 28 22:04:52 2020 New Revision: 362742 URL: https://svnweb.freebsd.org/changeset/base/362742 Log: Do not use macros in the argument to -width This patch improves the presentation of the FILES section dramatically. MFC after:2 weeks Modified: head/usr.sbin/config/config.8 Modified: head/usr.sbin/config/config.8 == --- head/usr.sbin/config/config.8 Sun Jun 28 21:48:56 2020 (r362741) +++ head/usr.sbin/config/config.8 Sun Jun 28 22:04:52 2020 (r362742) @@ -28,7 +28,7 @@ .\" @(#)config.8 8.2 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd May 8, 2007 +.Dd June 29, 2020 .Dt CONFIG 8 .Os .Sh NAME @@ -61,7 +61,7 @@ that give alternate files for a specific machine section below). .Pp Available options and operands: -.Bl -tag -width ".Ar SYSTEM_NAME" +.Bl -tag -width "SYSTEM_NAME" .It Fl V Print the .Nm @@ -235,7 +235,7 @@ installs in the root file system. .El .Sh FILES -.Bl -tag -width ".Pa /sys/ Ns Va ARCH Ns Pa /compile/ Ns Ar SYSTEM_NAME" -compact +.Bl -tag -width "/sys/ARCH/compile/SYSTEM_NAME" -compact .It Pa /sys/conf/files list of common files system is built from .It Pa /sys/conf/Makefile. Ns Va ARCH ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362741 - head/share/man/man4
Author: 0mp (doc,ports committer) Date: Sun Jun 28 21:48:56 2020 New Revision: 362741 URL: https://svnweb.freebsd.org/changeset/base/362741 Log: Document that Intel Dual Band Wireless AC 8265 is supported by iwm(4) MFC after:2 weeks Modified: head/share/man/man4/iwm.4 head/share/man/man4/iwmfw.4 Modified: head/share/man/man4/iwm.4 == --- head/share/man/man4/iwm.4 Sun Jun 28 21:35:04 2020(r362740) +++ head/share/man/man4/iwm.4 Sun Jun 28 21:48:56 2020(r362741) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 7, 2019 +.Dd June 28, 2020 .Dt IWM 4 .Os .Sh NAME @@ -88,6 +88,7 @@ driver provides support for: .It Intel Dual Band Wireless AC 7260 .It Intel Dual Band Wireless AC 7265 .It Intel Dual Band Wireless AC 8260 +.It Intel Dual Band Wireless AC 8265 .It Intel Dual Band Wireless AC 9260 .It Intel Dual Band Wireless AC 9270 .It Intel Dual Band Wireless AC 946X Modified: head/share/man/man4/iwmfw.4 == --- head/share/man/man4/iwmfw.4 Sun Jun 28 21:35:04 2020(r362740) +++ head/share/man/man4/iwmfw.4 Sun Jun 28 21:48:56 2020(r362741) @@ -22,7 +22,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 7, 2019 +.Dd June 28, 2020 .Dt IWMFW 4 .Os .Sh NAME @@ -68,7 +68,7 @@ iwm9260fw_load="YES" .Ed .Sh DESCRIPTION This module provides access to firmware sets for the -Intel Dual Band Wireless WiFi 3160, 3165, 3168, 7260, 7265, 8000, 8260, +Intel Dual Band Wireless WiFi 3160, 3165, 3168, 7260, 7265, 8000, 8260, 8265, 9000 and 9260 series of IEEE 802.11n/11ac adapters. It may be statically linked into the kernel, or loaded as a module. .Sh SEE ALSO ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362740 - head/sys/vm
Author: markj Date: Sun Jun 28 21:35:04 2020 New Revision: 362740 URL: https://svnweb.freebsd.org/changeset/base/362740 Log: Fix UMA's first-touch policy on systems with empty domains. Suppose a thread is running on a CPU in a NUMA domain with no physical RAM. When an item is freed to a first-touch zone, it ends up in the cross-domain bucket. When the bucket is full, it gets placed in another domain's bucket queue. However, when allocating an item, UMA will always go to the keg upon a per-CPU cache miss because the empty domain's bucket queue will always be empty. This means that a non-empty domain's bucket queues can grow very rapidly on such systems. For example, it can easily cause mbuf allocation failures when the zone limit is reached. Change cache_alloc() to follow a round-robin policy when running on an empty domain. Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D25355 Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c == --- head/sys/vm/uma_core.c Sun Jun 28 21:34:38 2020(r362739) +++ head/sys/vm/uma_core.c Sun Jun 28 21:35:04 2020(r362740) @@ -3398,7 +3398,7 @@ static __noinline bool cache_alloc(uma_zone_t zone, uma_cache_t cache, void *udata, int flags) { uma_bucket_t bucket; - int domain; + int curdomain, domain; bool new; CRITICAL_ASSERT(curthread); @@ -3445,7 +3445,8 @@ cache_alloc(uma_zone_t zone, uma_cache_t cache, void * * the critical section. */ domain = PCPU_GET(domain); - if ((cache_uz_flags(cache) & UMA_ZONE_ROUNDROBIN) != 0) + if ((cache_uz_flags(cache) & UMA_ZONE_ROUNDROBIN) != 0 || + VM_DOMAIN_EMPTY(domain)) domain = zone_domain_highest(zone, domain); bucket = cache_fetch_bucket(zone, cache, domain); if (bucket == NULL) { @@ -3470,7 +3471,8 @@ cache_alloc(uma_zone_t zone, uma_cache_t cache, void * cache = >uz_cpu[curcpu]; if (cache->uc_allocbucket.ucb_bucket == NULL && ((cache_uz_flags(cache) & UMA_ZONE_FIRSTTOUCH) == 0 || - domain == PCPU_GET(domain))) { + (curdomain = PCPU_GET(domain)) == domain || + VM_DOMAIN_EMPTY(curdomain))) { if (new) atomic_add_long(_GET(zone, domain)->uzd_imax, bucket->ub_cnt); @@ -3877,7 +3879,7 @@ zone_alloc_bucket(uma_zone_t zone, void *udata, int do /* Avoid allocs targeting empty domains. */ if (domain != UMA_ANYDOMAIN && VM_DOMAIN_EMPTY(domain)) domain = UMA_ANYDOMAIN; - if ((zone->uz_flags & UMA_ZONE_ROUNDROBIN) != 0) + else if ((zone->uz_flags & UMA_ZONE_ROUNDROBIN) != 0) domain = UMA_ANYDOMAIN; if (zone->uz_max_items > 0) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362739 - in head/sys: compat/linuxkpi/common/src dev/md
Author: markj Date: Sun Jun 28 21:34:38 2020 New Revision: 362739 URL: https://svnweb.freebsd.org/changeset/base/362739 Log: Remove some redundant assignments and computations. Reported by: alc Reviewed by: alc, kib Sponsored by: The FreeBSD Foundation MFC after:1 week Differential Revision:https://reviews.freebsd.org/D25400 Modified: head/sys/compat/linuxkpi/common/src/linux_page.c head/sys/dev/md/md.c Modified: head/sys/compat/linuxkpi/common/src/linux_page.c == --- head/sys/compat/linuxkpi/common/src/linux_page.cSun Jun 28 21:33:08 2020(r362738) +++ head/sys/compat/linuxkpi/common/src/linux_page.cSun Jun 28 21:34:38 2020(r362739) @@ -199,7 +199,7 @@ linux_get_user_pages_internal(vm_map_t map, unsigned l int count; prot = write ? (VM_PROT_READ | VM_PROT_WRITE) : VM_PROT_READ; - len = ((size_t)nr_pages) << PAGE_SHIFT; + len = ptoa((vm_offset_t)nr_pages); count = vm_fault_quick_hold_pages(map, start, len, prot, pages, nr_pages); return (count == -1 ? -EFAULT : nr_pages); } @@ -219,9 +219,8 @@ __get_user_pages_fast(unsigned long start, int nr_page return (0); MPASS(pages != NULL); - va = start; map = >td_proc->p_vmspace->vm_map; - end = start + (((size_t)nr_pages) << PAGE_SHIFT); + end = start + ptoa((vm_offset_t)nr_pages); if (!vm_map_range_valid(map, start, end)) return (-EINVAL); prot = write ? (VM_PROT_READ | VM_PROT_WRITE) : VM_PROT_READ; Modified: head/sys/dev/md/md.c == --- head/sys/dev/md/md.cSun Jun 28 21:33:08 2020(r362738) +++ head/sys/dev/md/md.cSun Jun 28 21:34:38 2020(r362739) @@ -1561,8 +1561,8 @@ mdresize(struct md_s *sc, struct md_req *mdr) if (mdr->md_mediasize <= 0 || (mdr->md_mediasize % PAGE_SIZE) != 0) return (EDOM); - oldpages = OFF_TO_IDX(round_page(sc->mediasize)); - newpages = OFF_TO_IDX(round_page(mdr->md_mediasize)); + oldpages = OFF_TO_IDX(sc->mediasize); + newpages = OFF_TO_IDX(mdr->md_mediasize); if (newpages < oldpages) { VM_OBJECT_WLOCK(sc->object); vm_object_page_remove(sc->object, newpages, 0, 0); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362738 - head/bin/sh/tests
Author: jilles Date: Sun Jun 28 21:33:08 2020 New Revision: 362738 URL: https://svnweb.freebsd.org/changeset/base/362738 Log: sh/tests: Re-enable bin.sh.execution.functional_test.bg12.0 This reverts r362646. PR: 247559 MFC after:1 week Modified: head/bin/sh/tests/functional_test.sh Modified: head/bin/sh/tests/functional_test.sh == --- head/bin/sh/tests/functional_test.shSun Jun 28 21:15:29 2020 (r362737) +++ head/bin/sh/tests/functional_test.shSun Jun 28 21:33:08 2020 (r362738) @@ -27,7 +27,6 @@ # $FreeBSD$ SRCDIR=$(atf_get_srcdir) -CATEGORY=$(basename ${SRCDIR}) check() { @@ -61,20 +60,7 @@ add_testcase() esac atf_test_case ${tc_escaped} - - if [ "$(atf_config_get ci false)" = "true" ]; then - case "${CATEGORY}/${tc}" in - execution/bg12.0) - eval "${tc_escaped}_body() { atf_skip 'https://bugs.freebsd.org/247559'; }" - ;; - *) - eval "${tc_escaped}_body() { check ${tc}; }" - ;; - esac - else - eval "${tc_escaped}_body() { check ${tc}; }" - fi - + eval "${tc_escaped}_body() { check ${tc}; }" atf_add_test_case ${tc_escaped} } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362737 - head/bin/sh/tests/execution
Author: jilles Date: Sun Jun 28 21:15:29 2020 New Revision: 362737 URL: https://svnweb.freebsd.org/changeset/base/362737 Log: sh/tests: Fix flaky execution/bg12.0 When job control is not enabled, the shell ignores SIGINT while waiting for a foreground process unless that process exits on SIGINT. In this case, the foreground process is sleep and it does not exit on SIGINT because the signal is only sent to the shell. Depending on order of events, this could cause the SIGINT to be unexpectedly ignored. On lightly loaded bare metal, the chance of this happening tends to be less than 0.01% but with higher loads and/or virtualization it becomes more likely. Starting the sleep in background and using the wait builtin ensures SIGINT will not be ignored. PR: 247559 Reported by: lwhsu MFC after:1 week Modified: head/bin/sh/tests/execution/bg12.0 Modified: head/bin/sh/tests/execution/bg12.0 == --- head/bin/sh/tests/execution/bg12.0 Sun Jun 28 21:11:10 2020 (r362736) +++ head/bin/sh/tests/execution/bg12.0 Sun Jun 28 21:15:29 2020 (r362737) @@ -4,7 +4,7 @@ T=`mktemp -d ${TMPDIR:-/tmp}/sh-test.` trap 'rm -rf $T' 0 cd $T || exit 3 mkfifo fifo1 -{ trap - INT; : >fifo1; sleep 5; exit 4; } & +{ trap - INT; : >fifo1; sleep 5 & wait; exit 4; } & : https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362736 - head/sys/arm64/rockchip
Author: gonzo Date: Sun Jun 28 21:11:10 2020 New Revision: 362736 URL: https://svnweb.freebsd.org/changeset/base/362736 Log: Configure rx_delay/tx_delay values for RK3399/RK3328 GMAC For 1000Mb mode to work reliably TX/RX delays need to be configured between the TX/RX clock and the respective signals on the PHY to compensate for differing trace lengths on the PCB. Reviewed by: manu MFC after:1 week Modified: head/sys/arm64/rockchip/if_dwc_rk.c Modified: head/sys/arm64/rockchip/if_dwc_rk.c == --- head/sys/arm64/rockchip/if_dwc_rk.c Sun Jun 28 18:56:32 2020 (r362735) +++ head/sys/arm64/rockchip/if_dwc_rk.c Sun Jun 28 21:11:10 2020 (r362736) @@ -57,6 +57,8 @@ __FBSDID("$FreeBSD$"); #define RK3328_GRF_MAC_CON0_RX_SHIFT 7 #defineRK3328_GRF_MAC_CON1 0x0904 +#define RK3328_GRF_MAC_CON1_RX_ENA (1 << 1) +#define RK3328_GRF_MAC_CON1_TX_ENA (1 << 0) #defineRK3328_GRF_MAC_CON2 0x0908 #defineRK3328_GRF_MACPHY_CON0 0x0B00 #defineRK3328_GRF_MACPHY_CON1 0x0B04 @@ -71,7 +73,6 @@ static struct ofw_compat_data compat_data[] = { {NULL, 0} }; -#ifdef notyet static void rk3328_set_delays(struct syscon *grf, phandle_t node) { @@ -82,22 +83,26 @@ rk3328_set_delays(struct syscon *grf, phandle_t node) if (OF_getencprop(node, "rx_delay", , sizeof(rx)) <= 0) rx = 0x10; + if (bootverbose) + printf("setting RK3328 RX/TX delays: %d/%d\n", rx, tx); tx = ((tx & RK3328_GRF_MAC_CON0_TX_MASK) << RK3328_GRF_MAC_CON0_TX_SHIFT); rx = ((rx & RK3328_GRF_MAC_CON0_TX_MASK) << RK3328_GRF_MAC_CON0_RX_SHIFT); SYSCON_WRITE_4(grf, RK3328_GRF_MAC_CON0, tx | rx | 0x); + SYSCON_WRITE_4(grf, RK3328_GRF_MAC_CON1, RK3328_GRF_MAC_CON1_TX_ENA | RK3328_GRF_MAC_CON1_RX_ENA | + ((RK3328_GRF_MAC_CON1_TX_ENA | RK3328_GRF_MAC_CON1_RX_ENA) << 16)); } -#endif #defineRK3399_GRF_SOC_CON6 0xc218 +#define RK3399_GRF_SOC_CON6_TX_ENA (1 << 7) #define RK3399_GRF_SOC_CON6_TX_MASK0x7F #define RK3399_GRF_SOC_CON6_TX_SHIFT 0 #define RK3399_GRF_SOC_CON6_RX_MASK0x7F +#define RK3399_GRF_SOC_CON6_RX_ENA (1 << 15) #define RK3399_GRF_SOC_CON6_RX_SHIFT 8 -#ifdef notyet static void rk3399_set_delays(struct syscon *grf, phandle_t node) { @@ -108,14 +113,15 @@ rk3399_set_delays(struct syscon *grf, phandle_t node) if (OF_getencprop(node, "rx_delay", , sizeof(rx)) <= 0) rx = 0x10; + if (bootverbose) + printf("setting RK3399 RX/TX delays: %d/%d\n", rx, tx); tx = ((tx & RK3399_GRF_SOC_CON6_TX_MASK) << - RK3399_GRF_SOC_CON6_TX_SHIFT); + RK3399_GRF_SOC_CON6_TX_SHIFT) | RK3399_GRF_SOC_CON6_TX_ENA; rx = ((rx & RK3399_GRF_SOC_CON6_TX_MASK) << - RK3399_GRF_SOC_CON6_RX_SHIFT); + RK3399_GRF_SOC_CON6_RX_SHIFT) | RK3399_GRF_SOC_CON6_RX_ENA; SYSCON_WRITE_4(grf, RK3399_GRF_SOC_CON6, tx | rx | 0x); } -#endif static int if_dwc_rk_probe(device_t dev) @@ -144,12 +150,10 @@ if_dwc_rk_init(device_t dev) return (ENXIO); } -#ifdef notyet if (ofw_bus_is_compatible(dev, "rockchip,rk3399-gmac")) rk3399_set_delays(grf, node); else if (ofw_bus_is_compatible(dev, "rockchip,rk3328-gmac")) rk3328_set_delays(grf, node); -#endif /* Mode should be set according to dtb property */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362735 - head/sys/compat/linux
Author: trasz Date: Sun Jun 28 18:56:32 2020 New Revision: 362735 URL: https://svnweb.freebsd.org/changeset/base/362735 Log: Make linux(4) support SO_PROTOCOL. Running Python test suite with python3.8 from Focal triggers those. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D25491 Modified: head/sys/compat/linux/linux_socket.c head/sys/compat/linux/linux_socket.h Modified: head/sys/compat/linux/linux_socket.c == --- head/sys/compat/linux/linux_socket.cSun Jun 28 18:02:51 2020 (r362734) +++ head/sys/compat/linux/linux_socket.cSun Jun 28 18:56:32 2020 (r362735) @@ -236,6 +236,8 @@ linux_to_bsd_so_sockopt(int opt) return (SO_TIMESTAMP); case LINUX_SO_ACCEPTCONN: return (SO_ACCEPTCONN); + case LINUX_SO_PROTOCOL: + return (SO_PROTOCOL); } return (-1); } Modified: head/sys/compat/linux/linux_socket.h == --- head/sys/compat/linux/linux_socket.hSun Jun 28 18:02:51 2020 (r362734) +++ head/sys/compat/linux/linux_socket.hSun Jun 28 18:56:32 2020 (r362735) @@ -197,6 +197,7 @@ int linux_accept(struct thread *td, struct linux_accep #defineLINUX_SO_ACCEPTCONN 30 #defineLINUX_SO_SNDBUFFORCE32 #defineLINUX_SO_RCVBUFFORCE33 +#defineLINUX_SO_PROTOCOL 38 /* Socket options */ #defineLINUX_IP_TOS1 ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362733 - head
Author: dim Date: Sun Jun 28 18:02:12 2020 New Revision: 362733 URL: https://svnweb.freebsd.org/changeset/base/362733 Log: Remove older llvm-ranlib.1 entry from ObsoleteFiles.inc, as it has gotten its own manpage now, and should be no longer be removed by "make delete-old". MFC after:3 weeks Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc == --- head/ObsoleteFiles.inc Sun Jun 28 17:51:17 2020(r362732) +++ head/ObsoleteFiles.inc Sun Jun 28 18:02:12 2020(r362733) @@ -6763,7 +6763,6 @@ OLD_FILES+=usr/include/clang/3.3/x86intrin.h OLD_FILES+=usr/include/clang/3.3/xmmintrin.h OLD_FILES+=usr/include/clang/3.3/xopintrin.h OLD_FILES+=usr/share/man/man1/llvm-prof.1.gz -OLD_FILES+=usr/share/man/man1/llvm-ranlib.1.gz OLD_DIRS+=usr/include/clang/3.3 # 20140216: nve(4) removed OLD_FILES+=usr/share/man/man4/if_nve.4.gz ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362734 - head/usr.bin/clang/llvm-strings
Author: dim Date: Sun Jun 28 18:02:51 2020 New Revision: 362734 URL: https://svnweb.freebsd.org/changeset/base/362734 Log: Fix llvm-strings.1 not installing, this was a copy/paste error. MFC after:3 weeks Modified: head/usr.bin/clang/llvm-strings/Makefile Modified: head/usr.bin/clang/llvm-strings/Makefile == --- head/usr.bin/clang/llvm-strings/MakefileSun Jun 28 18:02:12 2020 (r362733) +++ head/usr.bin/clang/llvm-strings/MakefileSun Jun 28 18:02:51 2020 (r362734) @@ -1,7 +1,6 @@ # $FreeBSD$ PROG_CXX= llvm-strings -MAN= SRCDIR=llvm/tools/llvm-strings SRCS+= llvm-strings.cpp ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362727 - head/share/man/man4
Author: grembo (ports committer) Date: Sun Jun 28 17:28:11 2020 New Revision: 362727 URL: https://svnweb.freebsd.org/changeset/base/362727 Log: Adapt documentation of kern.tty_info_kstacks. s/stack/kernel stack/, as this feature only shows kernel stacks. Reported by: jhb Reviewed by: jhb Differential Revision:https://reviews.freebsd.org/D25488 Modified: head/share/man/man4/termios.4 Modified: head/share/man/man4/termios.4 == --- head/share/man/man4/termios.4 Sun Jun 28 15:03:07 2020 (r362726) +++ head/share/man/man4/termios.4 Sun Jun 28 17:28:11 2020 (r362727) @@ -28,7 +28,7 @@ .\"@(#)termios.4 8.4 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd June 27, 2020 +.Dd June 28, 2020 .Dt TERMIOS 4 .Os .Sh NAME @@ -766,7 +766,7 @@ In case the .Xr sysctl 8 variable .Va kern.tty_info_kstacks -is set to a non-zero value, the running thread's stack is +is set to a non-zero value, the running thread's kernel stack is written to the terminal (e.g., for debugging purposes). .El .Pp ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362726 - in head/sys/arm64: arm64 include
Author: andrew Date: Sun Jun 28 15:03:07 2020 New Revision: 362726 URL: https://svnweb.freebsd.org/changeset/base/362726 Log: Use EFI memory map to determine attributes for Acpi mappings on arm64. AcpiOsMapMemory is used for device memory when e.g. an _INI method wants to access physical memory, however, aarch64 pmap_mapbios is hardcoded to writeback. Search for the correct memory type to use in pmap_mapbios. Submitted by: Greg V Differential Revision:https://reviews.freebsd.org/D25201 Modified: head/sys/arm64/arm64/machdep.c head/sys/arm64/arm64/pmap.c head/sys/arm64/include/machdep.h Modified: head/sys/arm64/arm64/machdep.c == --- head/sys/arm64/arm64/machdep.c Sun Jun 28 14:40:48 2020 (r362725) +++ head/sys/arm64/arm64/machdep.c Sun Jun 28 15:03:07 2020 (r362726) @@ -120,6 +120,7 @@ int has_pan; * passed into the kernel and used by the EFI code to call runtime services. */ vm_paddr_t efi_systbl_phys; +static struct efi_map_header *efihdr; /* pagezero_* implementations are provided in support.S */ void pagezero_simple(void *); @@ -1071,11 +1072,52 @@ cache_setup(void) } } +int +memory_mapping_mode(vm_paddr_t pa) +{ + struct efi_md *map, *p; + size_t efisz; + int ndesc, i; + + if (efihdr == NULL) + return (VM_MEMATTR_WRITE_BACK); + + /* +* Memory map data provided by UEFI via the GetMemoryMap +* Boot Services API. +*/ + efisz = (sizeof(struct efi_map_header) + 0xf) & ~0xf; + map = (struct efi_md *)((uint8_t *)efihdr + efisz); + + if (efihdr->descriptor_size == 0) + return (VM_MEMATTR_WRITE_BACK); + ndesc = efihdr->memory_size / efihdr->descriptor_size; + + for (i = 0, p = map; i < ndesc; i++, + p = efi_next_descriptor(p, efihdr->descriptor_size)) { + if (pa < p->md_phys || + pa >= p->md_phys + p->md_pages * EFI_PAGE_SIZE) + continue; + if (p->md_type == EFI_MD_TYPE_IOMEM || + p->md_type == EFI_MD_TYPE_IOPORT) + return (VM_MEMATTR_DEVICE); + else if ((p->md_attr & EFI_MD_ATTR_WB) != 0 || + p->md_type == EFI_MD_TYPE_RECLAIM) + return (VM_MEMATTR_WRITE_BACK); + else if ((p->md_attr & EFI_MD_ATTR_WT) != 0) + return (VM_MEMATTR_WRITE_THROUGH); + else if ((p->md_attr & EFI_MD_ATTR_WC) != 0) + return (VM_MEMATTR_WRITE_COMBINING); + break; + } + + return (VM_MEMATTR_DEVICE); +} + void initarm(struct arm64_bootparams *abp) { struct efi_fb *efifb; - struct efi_map_header *efihdr; struct pcpu *pcpup; char *env; #ifdef FDT Modified: head/sys/arm64/arm64/pmap.c == --- head/sys/arm64/arm64/pmap.c Sun Jun 28 14:40:48 2020(r362725) +++ head/sys/arm64/arm64/pmap.c Sun Jun 28 15:03:07 2020(r362726) @@ -5449,7 +5449,7 @@ pmap_mapbios(vm_paddr_t pa, vm_size_t size) /* L3 table is linked */ va = trunc_page(va); pa = trunc_page(pa); - pmap_kenter(va, size, pa, VM_MEMATTR_WRITE_BACK); + pmap_kenter(va, size, pa, memory_mapping_mode(pa)); } return ((void *)(va + offset)); Modified: head/sys/arm64/include/machdep.h == --- head/sys/arm64/include/machdep.hSun Jun 28 14:40:48 2020 (r362725) +++ head/sys/arm64/include/machdep.hSun Jun 28 15:03:07 2020 (r362726) @@ -56,6 +56,7 @@ vm_offset_t parse_boot_param(struct arm64_bootparams * #ifdef FDT void parse_fdt_bootargs(void); #endif +int memory_mapping_mode(vm_paddr_t pa); extern void (*pagezero)(void *); #endif /* _KERNEL */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362722 - head/sys/netinet
Author: tuexen Date: Sun Jun 28 14:11:36 2020 New Revision: 362722 URL: https://svnweb.freebsd.org/changeset/base/362722 Log: Don't send packets containing ERROR chunks in response to unknown chunks when being in a state where the verification tag to be used is not known yet. MFC after:1 week Modified: head/sys/netinet/sctp_input.c Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Sun Jun 28 14:02:49 2020 (r362721) +++ head/sys/netinet/sctp_input.c Sun Jun 28 14:11:36 2020 (r362722) @@ -5178,7 +5178,11 @@ process_control_chunks: default: unknown_chunk: /* it's an unknown chunk! */ - if ((ch->chunk_type & 0x40) && (stcb != NULL)) { + if ((ch->chunk_type & 0x40) && + (stcb != NULL) && + (SCTP_GET_STATE(stcb) != SCTP_STATE_EMPTY) && + (SCTP_GET_STATE(stcb) != SCTP_STATE_INUSE) && + (SCTP_GET_STATE(stcb) != SCTP_STATE_COOKIE_WAIT)) { struct sctp_gen_error_cause *cause; int len; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362720 - head/sys/netinet
Author: tuexen Date: Sun Jun 28 11:12:03 2020 New Revision: 362720 URL: https://svnweb.freebsd.org/changeset/base/362720 Log: Don't check ch for not being NULL, since that is true. MFC after:1 week Modified: head/sys/netinet/sctp_input.c Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Sun Jun 28 07:43:43 2020 (r362719) +++ head/sys/netinet/sctp_input.c Sun Jun 28 11:12:03 2020 (r362720) @@ -5106,7 +5106,7 @@ process_control_chunks: break; case SCTP_STREAM_RESET: SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_STREAM_RESET\n"); - if (((stcb == NULL) || (ch == NULL) || (chk_length < sizeof(struct sctp_stream_reset_tsn_req { + if ((stcb == NULL) || (chk_length < sizeof(struct sctp_stream_reset_tsn_req))) { /* Its not ours */ *offset = length; return (stcb); @@ -5129,7 +5129,7 @@ process_control_chunks: return (stcb); } - if ((ch != NULL) && (stcb != NULL) && (netp != NULL) && (*netp != NULL)) { + if ((stcb != NULL) && (netp != NULL) && (*netp != NULL)) { if (stcb->asoc.pktdrop_supported == 0) { goto unknown_chunk; } @@ -5165,8 +5165,7 @@ process_control_chunks: goto next_chunk; } got_auth = 1; - if ((ch == NULL) || sctp_handle_auth(stcb, (struct sctp_auth_chunk *)ch, - m, *offset)) { + if (sctp_handle_auth(stcb, (struct sctp_auth_chunk *)ch, m, *offset)) { /* auth HMAC failed so dump the packet */ *offset = length; return (stcb); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r362681 - in head: contrib/bc contrib/bc/gen contrib/bc/include contrib/bc/locales contrib/bc/manuals contrib/bc/src contrib/bc/src/bc contrib/bc/src/dc contrib/bc/src/history contrib/
Am 27.06.20 um 23:52 schrieb Eric van Gyzen: > On 6/27/20 8:11 AM, John Baldwin wrote: >> On 6/27/20 5:02 AM, Stefan Eßer wrote: >>> Author: se >>> Date: Sat Jun 27 12:02:01 2020 >>> New Revision: 362681 >>> URL: https://svnweb.freebsd.org/changeset/base/362681 >>> >>> Log: >>> Import new 2-clause BSD licenced implementation of the bc and dc >>> commands >> >> Hmm, I didn't see a commit to add the vendor sources into ^/vendor >> first via our >> standard process for contrib sources, nor any discussion about that in >> the review. > > When you add this to the vendor area, please include the tests, to > remove a barrier to integration. Hi Eric, I have already imported the full sources into the vendor area, including the tests. These tests compare the output of this bc and dc with that of GNU bc/dc and are run as regression tests by the author before a release is tagged (and have been extended over time for each area where an issue has been found). Extensive fuzzing is also performed to verify that the low level math functions give correct results (again using another bc/dc as reference), but we do not want to include those particular tests. I'd like to make the tests available as regression tests in FreeBSD, but have not looked at the best way to integrate them, yet. (The tests are meant to be run within the source directory after building from sources in place, for example, which is not at all what we do in FreeBSD.) Independently of the issue of tests, I'm not sure about the best way to proceed from the current situation with regard to what's in contrib/bc now, and I have decided to leave the incomplete import untouched in contrib/bc until I understand the best way forward. I could delete what's currently in contrib/bc and use svn copy to make the whole contents of vendor/bc/dist available in contrib/bc. The tests require 1112 KB of space, while the rest of the sources takes up less than 900 KB. I could revert the full import to contrib/bc, but that would also revert changes to e.g. usr.bin/Makefile and I'd rather remove just what's now in contrib/bc and then use svn copy to make vendor/bc/dist available there. The sources from the dist directory can be used unmodified, the reason for cherry-picking was just that I did not want to import more than is used at this time ... I'd appreciate any advice given about what causes the least repo churn and extra effort for the Git conversion. Regards, STefan ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362719 - in head: contrib/llvm-project contrib/llvm-project/clang/lib/CodeGen contrib/llvm-project/compiler-rt/lib/builtins/riscv contrib/llvm-project/libcxx/include contrib/llvm-proje...
Author: dim Date: Sun Jun 28 07:43:43 2020 New Revision: 362719 URL: https://svnweb.freebsd.org/changeset/base/362719 Log: Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp llvmorg-10.0.1-rc2-0-g77d76b71d7d. Also add a few more llvm utilities under WITH_CLANG_EXTRAS: * llvm-dwp, a utility for merging DWARF 5 Split DWARF .dwo files into .dwp (DWARF package files) * llvm-size, a size(1) replacement * llvm-strings, a strings(1) replacement MFC after:3 weeks Added: head/contrib/llvm-project/compiler-rt/lib/builtins/riscv/int_mul_impl.inc - copied unchanged from r362704, vendor/llvm-project/release-10.x/compiler-rt/lib/builtins/riscv/int_mul_impl.inc head/contrib/llvm-project/compiler-rt/lib/builtins/riscv/muldi3.S - copied unchanged from r362704, vendor/llvm-project/release-10.x/compiler-rt/lib/builtins/riscv/muldi3.S head/contrib/llvm-project/llvm/tools/llvm-dwp/ - copied from r362704, vendor/llvm-project/release-10.x/llvm/tools/llvm-dwp/ head/contrib/llvm-project/llvm/tools/llvm-size/ - copied from r362704, vendor/llvm-project/release-10.x/llvm/tools/llvm-size/ head/contrib/llvm-project/llvm/tools/llvm-strings/ - copied from r362704, vendor/llvm-project/release-10.x/llvm/tools/llvm-strings/ head/usr.bin/clang/llvm-dwp/ head/usr.bin/clang/llvm-dwp/Makefile (contents, props changed) head/usr.bin/clang/llvm-size/ head/usr.bin/clang/llvm-size/Makefile (contents, props changed) head/usr.bin/clang/llvm-size/llvm-size.1 (contents, props changed) head/usr.bin/clang/llvm-strings/ head/usr.bin/clang/llvm-strings/Makefile (contents, props changed) head/usr.bin/clang/llvm-strings/llvm-strings.1 (contents, props changed) Modified: head/contrib/llvm-project/FREEBSD-Xlist head/contrib/llvm-project/clang/lib/CodeGen/TargetInfo.cpp head/contrib/llvm-project/compiler-rt/lib/builtins/riscv/mulsi3.S head/contrib/llvm-project/libcxx/include/array head/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp head/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp head/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp head/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp head/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVISelLowering.cpp head/lib/clang/include/VCSVersion.inc head/lib/clang/include/llvm/Support/VCSRevision.h head/tools/build/mk/OptionalObsoleteFiles.inc head/usr.bin/clang/Makefile Directory Properties: head/contrib/llvm-project/ (props changed) head/contrib/llvm-project/clang/ (props changed) head/contrib/llvm-project/compiler-rt/ (props changed) head/contrib/llvm-project/libcxx/ (props changed) head/contrib/llvm-project/llvm/ (props changed) Modified: head/contrib/llvm-project/FREEBSD-Xlist == --- head/contrib/llvm-project/FREEBSD-Xlist Sun Jun 28 06:52:39 2020 (r362718) +++ head/contrib/llvm-project/FREEBSD-Xlist Sun Jun 28 07:43:43 2020 (r362719) @@ -864,7 +864,8 @@ llvm/tools/llvm-dis/LLVMBuild.txt llvm/tools/llvm-dwarfdump/CMakeLists.txt llvm/tools/llvm-dwarfdump/LLVMBuild.txt llvm/tools/llvm-dwarfdump/fuzzer/ -llvm/tools/llvm-dwp/ +llvm/tools/llvm-dwp/CMakeLists.txt +llvm/tools/llvm-dwp/LLVMBuild.txt llvm/tools/llvm-elfabi/ llvm/tools/llvm-exegesis/ llvm/tools/llvm-extract/CMakeLists.txt @@ -911,12 +912,14 @@ llvm/tools/llvm-reduce/ llvm/tools/llvm-rtdyld/CMakeLists.txt llvm/tools/llvm-rtdyld/LLVMBuild.txt llvm/tools/llvm-shlib/ -llvm/tools/llvm-size/ +llvm/tools/llvm-size/CMakeLists.txt +llvm/tools/llvm-size/LLVMBuild.txt llvm/tools/llvm-special-case-list-fuzzer/ llvm/tools/llvm-split/ llvm/tools/llvm-stress/CMakeLists.txt llvm/tools/llvm-stress/LLVMBuild.txt -llvm/tools/llvm-strings/ +llvm/tools/llvm-strings/CMakeLists.txt +llvm/tools/llvm-strings/LLVMBuild.txt llvm/tools/llvm-symbolizer/CMakeLists.txt llvm/tools/llvm-undname/ llvm/tools/llvm-xray/CMakeLists.txt Modified: head/contrib/llvm-project/clang/lib/CodeGen/TargetInfo.cpp == --- head/contrib/llvm-project/clang/lib/CodeGen/TargetInfo.cpp Sun Jun 28 06:52:39 2020(r362718) +++ head/contrib/llvm-project/clang/lib/CodeGen/TargetInfo.cpp Sun Jun 28 07:43:43 2020(r362719) @@ -9677,7 +9677,8 @@ ABIArgInfo RISCVABIInfo::classifyArgumentType(QualType uint64_t Size = getContext().getTypeSize(Ty); // Pass floating point values via FPRs if possible. - if (IsFixed && Ty->isFloatingType() && FLen >= Size && ArgFPRsLeft) { + if (IsFixed && Ty->isFloatingType() && !Ty->isComplexType() && + FLen >= Size && ArgFPRsLeft) { ArgFPRsLeft--; return ABIArgInfo::getDirect(); } Copied:
svn commit: r362718 - head/usr.sbin/fifolog/lib
Author: adrian Date: Sun Jun 28 06:52:39 2020 New Revision: 362718 URL: https://svnweb.freebsd.org/changeset/base/362718 Log: [fifolog] wrap the recno when we hit the end of the provided file size. Without this the log just keeps growing to infinity. Reviewed by: phk Differential Revision:https://reviews.freebsd.org/D25478 Modified: head/usr.sbin/fifolog/lib/fifolog_write_poll.c Modified: head/usr.sbin/fifolog/lib/fifolog_write_poll.c == --- head/usr.sbin/fifolog/lib/fifolog_write_poll.c Sun Jun 28 04:08:42 2020(r362717) +++ head/usr.sbin/fifolog/lib/fifolog_write_poll.c Sun Jun 28 06:52:39 2020(r362718) @@ -239,6 +239,14 @@ fifolog_write_output(struct fifolog_writer *f, int fl, */ f->seq++; f->recno++; + + /* +* Ensure we wrap recno once we hit the file size (in records.) +*/ + if (f->recno >= f->ff->logsize) + /* recno 0 is header; skip */ + f->recno = 1; + f->flag = 0; memset(f->obuf, 0, f->obufsize); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"