svn commit: r351592 - head/usr.bin/w

2019-08-28 Thread Mike Karels
Author: karels
Date: Thu Aug 29 02:44:18 2019
New Revision: 351592
URL: https://svnweb.freebsd.org/changeset/base/351592

Log:
  Fix address annotation in xml output from w
  
  The libxo xml feature of adding an annotation with the "original"
  address from the utmpx file if it is different than the final "from"
  field was broken by r351379. This was pointed out by the gcc error
  that save_p might be used uninitialized. Save the original address
  as needed in each entry, don't just use the last one from the previous
  loop.
  
  Reviewed by:  marcel@
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D21390

Modified:
  head/usr.bin/w/w.c

Modified: head/usr.bin/w/w.c
==
--- head/usr.bin/w/w.c  Wed Aug 28 23:40:57 2019(r351591)
+++ head/usr.bin/w/w.c  Thu Aug 29 02:44:18 2019(r351592)
@@ -118,6 +118,7 @@ static struct entry {
char*args;  /* arg list of interesting process */
struct  kinfo_proc *dkp;/* debug option proc list */
char*from;  /* "from": name or addr */
+   char*save_from; /* original "from": name or addr */
 } *ep, *ehead = NULL, **nextp = 
 
 #definedebugproc(p) *(&((struct kinfo_proc *)p)->ki_udata)
@@ -209,7 +210,6 @@ main(int argc, char *argv[])
if (*argv)
sel_users = argv;
 
-   save_p = NULL;
setutxent();
for (nusers = 0; (utmp = getutxent()) != NULL;) {
struct addrinfo hints, *res;
@@ -312,6 +312,8 @@ main(int argc, char *argv[])
ep->from = strdup(p);
if ((i = strlen(p)) > fromwidth)
fromwidth = i;
+   if (save_p != p)
+   ep->save_from = strdup(save_p);
}
endutxent();
 
@@ -451,8 +453,8 @@ main(int argc, char *argv[])
 strncmp(ep->utmp.ut_line, "cua", 3) ?
 ep->utmp.ut_line : ep->utmp.ut_line + 3) : "-");
 
-   if (save_p && save_p != p)
-   xo_attr("address", "%s", save_p);
+   if (ep->save_from)
+   xo_attr("address", "%s", ep->save_from);
xo_emit("{:from/%-*.*s/%@**@s} ",
fromwidth, fromwidth, ep->from);
t = ep->utmp.ut_tv.tv_sec;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351591 - in head/sys/amd64/vmm: . amd

2019-08-28 Thread John Baldwin
Author: jhb
Date: Wed Aug 28 23:40:57 2019
New Revision: 351591
URL: https://svnweb.freebsd.org/changeset/base/351591

Log:
  Use get_pcpu() to fetch the current CPU's pcpu pointer.
  
  This avoids encoding knowledge about how pcpu objects are allocated and is
  also a few instructions shorter.
  
  MFC after:2 weeks

Modified:
  head/sys/amd64/vmm/amd/svm.c
  head/sys/amd64/vmm/vmm_host.h

Modified: head/sys/amd64/vmm/amd/svm.c
==
--- head/sys/amd64/vmm/amd/svm.cWed Aug 28 23:31:58 2019
(r351590)
+++ head/sys/amd64/vmm/amd/svm.cWed Aug 28 23:40:57 2019
(r351591)
@@ -102,9 +102,6 @@ SYSCTL_INT(_hw_vmm_svm, OID_AUTO, vmcb_clean, CTLFLAG_
 static MALLOC_DEFINE(M_SVM, "svm", "svm");
 static MALLOC_DEFINE(M_SVM_VLAPIC, "svm-vlapic", "svm-vlapic");
 
-/* Per-CPU context area. */
-extern struct pcpu __pcpu[];
-
 static uint32_t svm_feature = ~0U; /* AMD SVM features. */
 SYSCTL_UINT(_hw_vmm_svm, OID_AUTO, features, CTLFLAG_RDTUN, _feature, 0,
 "SVM features advertised by CPUID.800AH:EDX");
@@ -2054,7 +2051,7 @@ svm_vmrun(void *arg, int vcpu, register_t rip, pmap_t 
/* Launch Virtual Machine. */
VCPU_CTR1(vm, vcpu, "Resume execution at %#lx", state->rip);
svm_dr_enter_guest(gctx);
-   svm_launch(vmcb_pa, gctx, &__pcpu[curcpu]);
+   svm_launch(vmcb_pa, gctx, get_pcpu());
svm_dr_leave_guest(gctx);
 
CPU_CLR_ATOMIC(curcpu, >pm_active);

Modified: head/sys/amd64/vmm/vmm_host.h
==
--- head/sys/amd64/vmm/vmm_host.h   Wed Aug 28 23:31:58 2019
(r351590)
+++ head/sys/amd64/vmm/vmm_host.h   Wed Aug 28 23:40:57 2019
(r351591)
@@ -72,14 +72,11 @@ vmm_get_host_gdtrbase(void)
return ((uint64_t)[NGDT * curcpu]);
 }
 
-struct pcpu;
-extern struct pcpu __pcpu[];
-
 static __inline uint64_t
 vmm_get_host_gsbase(void)
 {
 
-   return ((uint64_t)&__pcpu[curcpu]);
+   return ((uint64_t)get_pcpu());
 }
 
 #endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351590 - head/sys/dev/cxgbe/tom

2019-08-28 Thread Navdeep Parhar
Author: np
Date: Wed Aug 28 23:31:58 2019
New Revision: 351590
URL: https://svnweb.freebsd.org/changeset/base/351590

Log:
  cxgbe/t4_tom: Use the correct value of sndbuf in AIO Tx.
  
  This should have been part of r351540.
  
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/tom/t4_cpl_io.c

Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c
==
--- head/sys/dev/cxgbe/tom/t4_cpl_io.c  Wed Aug 28 22:04:04 2019
(r351589)
+++ head/sys/dev/cxgbe/tom/t4_cpl_io.c  Wed Aug 28 23:31:58 2019
(r351590)
@@ -2023,7 +2023,6 @@ alloc_aiotx_mbuf(struct kaiocb *job, int len)
 static void
 t4_aiotx_process_job(struct toepcb *toep, struct socket *so, struct kaiocb 
*job)
 {
-   struct adapter *sc;
struct sockbuf *sb;
struct file *fp;
struct inpcb *inp;
@@ -2032,7 +2031,6 @@ t4_aiotx_process_job(struct toepcb *toep, struct socke
int error, len;
bool moretocome, sendmore;
 
-   sc = td_adapter(toep->td);
sb = >so_snd;
SOCKBUF_UNLOCK(sb);
fp = job->fd_file;
@@ -2104,8 +2102,8 @@ sendanother:
moretocome = false;
} else
moretocome = true;
-   if (len > sc->tt.sndbuf) {
-   len = sc->tt.sndbuf;
+   if (len > toep->params.sndbuf) {
+   len = toep->params.sndbuf;
sendmore = true;
} else
sendmore = false;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351589 - head/sys/dev/ahci

2019-08-28 Thread Alexander Motin
Author: mav
Date: Wed Aug 28 22:04:04 2019
New Revision: 351589
URL: https://svnweb.freebsd.org/changeset/base/351589

Log:
  Fix AHCI Enclosure Management, broken by r351356.
  
  ivars value of -1 was used to distinguish EM device, and r351356 left some
  wrong checks for it.  Give EM device separate flag there instead.

Modified:
  head/sys/dev/ahci/ahci.c
  head/sys/dev/ahci/ahci.h

Modified: head/sys/dev/ahci/ahci.c
==
--- head/sys/dev/ahci/ahci.cWed Aug 28 21:13:28 2019(r351588)
+++ head/sys/dev/ahci/ahci.cWed Aug 28 22:04:04 2019(r351589)
@@ -362,7 +362,7 @@ ahci_attach(device_t dev)
if (child == NULL)
device_printf(dev, "failed to add enclosure device\n");
else
-   device_set_ivars(child, (void *)(intptr_t)-1);
+   device_set_ivars(child, (void *)(intptr_t)AHCI_EM_UNIT);
}
bus_generic_attach(dev);
return (0);
@@ -562,23 +562,25 @@ ahci_alloc_resource(device_t dev, device_t child, int 
struct resource *res;
rman_res_t st;
int offset, size, unit;
-   bool is_remapped;
+   bool is_em, is_remapped;
 
unit = (intptr_t)device_get_ivars(child);
+   is_em = is_remapped = false;
if (unit & AHCI_REMAPPED_UNIT) {
-   unit &= ~AHCI_REMAPPED_UNIT;
+   unit &= AHCI_UNIT;
unit -= ctlr->channels;
is_remapped = true;
-   } else
-   is_remapped = false;
+   } else if (unit & AHCI_EM_UNIT) {
+   unit &= AHCI_UNIT;
+   is_em = true;
+   }
res = NULL;
switch (type) {
case SYS_RES_MEMORY:
if (is_remapped) {
offset = ctlr->remap_offset + unit * ctlr->remap_size;
size = ctlr->remap_size;
-   }
-   else if (unit >= 0) {
+   } else if (!is_em) {
offset = AHCI_OFFSET + (unit << 7);
size = 128;
} else if (*rid == 0) {
@@ -639,7 +641,7 @@ ahci_setup_intr(device_t dev, device_t child, struct r
 void *argument, void **cookiep)
 {
struct ahci_controller *ctlr = device_get_softc(dev);
-   int unit = (intptr_t)device_get_ivars(child) & ~AHCI_REMAPPED_UNIT;
+   int unit = (intptr_t)device_get_ivars(child) & AHCI_UNIT;
 
if (filter != NULL) {
printf("ahci.c: we cannot use a filter here\n");
@@ -655,7 +657,7 @@ ahci_teardown_intr(device_t dev, device_t child, struc
 void *cookie)
 {
struct ahci_controller *ctlr = device_get_softc(dev);
-   int unit = (intptr_t)device_get_ivars(child) & ~AHCI_REMAPPED_UNIT;
+   int unit = (intptr_t)device_get_ivars(child) & AHCI_UNIT;
 
ctlr->interrupt[unit].function = NULL;
ctlr->interrupt[unit].argument = NULL;
@@ -665,12 +667,13 @@ ahci_teardown_intr(device_t dev, device_t child, struc
 int
 ahci_print_child(device_t dev, device_t child)
 {
-   int retval, channel;
+   intptr_t ivars;
+   int retval;
 
retval = bus_print_child_header(dev, child);
-   channel = (int)(intptr_t)device_get_ivars(child) & ~AHCI_REMAPPED_UNIT;
-   if (channel >= 0)
-   retval += printf(" at channel %d", channel);
+   ivars = (intptr_t)device_get_ivars(child);
+   if ((ivars & AHCI_EM_UNIT) == 0)
+   retval += printf(" at channel %d", (int)ivars & AHCI_UNIT);
retval += bus_print_child_footer(dev, child);
return (retval);
 }
@@ -679,11 +682,11 @@ int
 ahci_child_location_str(device_t dev, device_t child, char *buf,
 size_t buflen)
 {
-   int channel;
+   intptr_t ivars;
 
-   channel = (int)(intptr_t)device_get_ivars(child) & ~AHCI_REMAPPED_UNIT;
-   if (channel >= 0)
-   snprintf(buf, buflen, "channel=%d", channel);
+   ivars = (intptr_t)device_get_ivars(child);
+   if ((ivars & AHCI_EM_UNIT) == 0)
+   snprintf(buf, buflen, "channel=%d", (int)ivars & AHCI_UNIT);
return (0);
 }
 

Modified: head/sys/dev/ahci/ahci.h
==
--- head/sys/dev/ahci/ahci.hWed Aug 28 21:13:28 2019(r351588)
+++ head/sys/dev/ahci/ahci.hWed Aug 28 22:04:04 2019(r351589)
@@ -319,9 +319,10 @@
 /* Total main work area. */
 #define AHCI_WORK_SIZE  (AHCI_CT_OFFSET + AHCI_CT_SIZE * 
ch->numslots)
 
-
-/* NVMe remapped device */
-#define AHCI_REMAPPED_UNIT (1 << 31)
+/* ivars value fields */
+#define AHCI_REMAPPED_UNIT (1 << 31)   /* NVMe remapped device. */
+#define AHCI_EM_UNIT   (1 << 30)   /* Enclosure Mgmt device. */
+#define AHCI_UNIT  0xff/* Channel number. */
 
 struct ahci_dma_prd {
 u_int64_t   dba;

svn commit: r351588 - stable/11/sys/dev/nvme

2019-08-28 Thread Alexander Motin
Author: mav
Date: Wed Aug 28 21:13:28 2019
New Revision: 351588
URL: https://svnweb.freebsd.org/changeset/base/351588

Log:
  MFC r351352: Improve NVMe hot unplug handling.
  
  If device is unplugged from the system (CSTS register reads return
  0x), it makes no sense to send any more recovery requests or
  expect any responses back.  If there is a detach call in such state,
  just stop all activity and free resources.  If there is no detach
  call (hot-plug is not supported), rely on normal timeout handling,
  but when it trigger controller reset, do not wait for impossible and
  quickly report failure.
  
  Sponsored by: iXsystems, Inc.

Modified:
  stable/11/sys/dev/nvme/nvme_ctrlr.c
  stable/11/sys/dev/nvme/nvme_qpair.c

Modified: stable/11/sys/dev/nvme/nvme_ctrlr.c
==
--- stable/11/sys/dev/nvme/nvme_ctrlr.c Wed Aug 28 21:01:51 2019
(r351587)
+++ stable/11/sys/dev/nvme/nvme_ctrlr.c Wed Aug 28 21:13:28 2019
(r351588)
@@ -202,10 +202,13 @@ nvme_ctrlr_fail(struct nvme_controller *ctrlr)
int i;
 
ctrlr->is_failed = TRUE;
+   nvme_admin_qpair_disable(>adminq);
nvme_qpair_fail(>adminq);
if (ctrlr->ioq != NULL) {
-   for (i = 0; i < ctrlr->num_io_queues; i++)
+   for (i = 0; i < ctrlr->num_io_queues; i++) {
+   nvme_io_qpair_disable(>ioq[i]);
nvme_qpair_fail(>ioq[i]);
+   }
}
nvme_notify_fail_consumers(ctrlr);
 }
@@ -244,17 +247,19 @@ nvme_ctrlr_wait_for_ready(struct nvme_controller *ctrl
int ms_waited;
union csts_register csts;
 
-   csts.raw = nvme_mmio_read_4(ctrlr, csts);
-
ms_waited = 0;
-   while (csts.bits.rdy != desired_val) {
+   while (1) {
+   csts.raw = nvme_mmio_read_4(ctrlr, csts);
+   if (csts.raw == 0x) /* Hot unplug. */
+   return (ENXIO);
+   if (csts.bits.rdy == desired_val)
+   break;
if (ms_waited++ > ctrlr->ready_timeout_in_ms) {
nvme_printf(ctrlr, "controller ready did not become %d "
"within %d ms\n", desired_val, 
ctrlr->ready_timeout_in_ms);
return (ENXIO);
}
DELAY(1000);
-   csts.raw = nvme_mmio_read_4(ctrlr, csts);
}
 
return (0);
@@ -1229,12 +1234,20 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, de
 void
 nvme_ctrlr_destruct(struct nvme_controller *ctrlr, device_t dev)
 {
-   int i;
+   int gone, i;
 
if (ctrlr->resource == NULL)
goto nores;
 
-   nvme_notify_fail_consumers(ctrlr);
+   /*
+* Check whether it is a hot unplug or a clean driver detach.
+* If device is not there any more, skip any shutdown commands.
+*/
+   gone = (nvme_mmio_read_4(ctrlr, csts) == 0x);
+   if (gone)
+   nvme_ctrlr_fail(ctrlr);
+   else
+   nvme_notify_fail_consumers(ctrlr);
 
for (i = 0; i < NVME_MAX_NAMESPACES; i++)
nvme_ns_destruct(>ns[i]);
@@ -1243,11 +1256,11 @@ nvme_ctrlr_destruct(struct nvme_controller *ctrlr, dev
destroy_dev(ctrlr->cdev);
 
for (i = 0; i < ctrlr->num_io_queues; i++) {
-   nvme_ctrlr_destroy_qpair(ctrlr, >ioq[i]);
+   if (!gone)
+   nvme_ctrlr_destroy_qpair(ctrlr, >ioq[i]);
nvme_io_qpair_destroy(>ioq[i]);
}
free(ctrlr->ioq, M_NVME);
-
nvme_admin_qpair_destroy(>adminq);
 
/*
@@ -1257,9 +1270,11 @@ nvme_ctrlr_destruct(struct nvme_controller *ctrlr, dev
 *   shutdown notification in case the system is shutdown before
 *   reloading the driver.
 */
-   nvme_ctrlr_shutdown(ctrlr);
+   if (!gone)
+   nvme_ctrlr_shutdown(ctrlr);
 
-   nvme_ctrlr_disable(ctrlr);
+   if (!gone)
+   nvme_ctrlr_disable(ctrlr);
 
if (ctrlr->taskqueue)
taskqueue_free(ctrlr->taskqueue);
@@ -1296,14 +1311,19 @@ nvme_ctrlr_shutdown(struct nvme_controller *ctrlr)
cc.raw = nvme_mmio_read_4(ctrlr, cc);
cc.bits.shn = NVME_SHN_NORMAL;
nvme_mmio_write_4(ctrlr, cc, cc.raw);
-   csts.raw = nvme_mmio_read_4(ctrlr, csts);
-   while ((csts.bits.shst != NVME_SHST_COMPLETE) && (ticks++ < 5*hz)) {
-   pause("nvme shn", 1);
+   while (1) {
csts.raw = nvme_mmio_read_4(ctrlr, csts);
+   if (csts.raw == 0x) /* Hot unplug. */
+   break;
+   if (csts.bits.shst == NVME_SHST_COMPLETE)
+   break;
+   if (ticks++ > 5*hz) {
+   nvme_printf(ctrlr, "did not complete shutdown within"

Re: svn commit: r350544 - head/usr.bin/bzip2recover

2019-08-28 Thread Mark Johnston
On Wed, Aug 28, 2019 at 10:54:13PM +0200, Antoine Brodin wrote:
> On Sat, Aug 3, 2019 at 12:10 AM Mark Johnston  wrote:
> >
> > Author: markj
> > Date: Fri Aug  2 22:09:56 2019
> > New Revision: 350544
> > URL: https://svnweb.freebsd.org/changeset/base/350544
> >
> > Log:
> >   Add bzip2recover.1.
> >
> >   MFC after:3 days
> >   Sponsored by: The FreeBSD Foundation
> >
> > Modified:
> >   head/usr.bin/bzip2recover/Makefile
> 
> Hi,
> 
> It seems that this breaks parrallel installworld.
> 
> Cheers,
> 
> Antoine

This should be fixed by r351587, thanks.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351587 - in head/usr.bin: bzip2 bzip2recover

2019-08-28 Thread Mark Johnston
Author: markj
Date: Wed Aug 28 21:01:51 2019
New Revision: 351587
URL: https://svnweb.freebsd.org/changeset/base/351587

Log:
  Install all bzip2.1 MLINKs from the same place.
  
  Reported by:  antoine
  MFC after:3 days
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.bin/bzip2/Makefile
  head/usr.bin/bzip2recover/Makefile

Modified: head/usr.bin/bzip2/Makefile
==
--- head/usr.bin/bzip2/Makefile Wed Aug 28 20:58:24 2019(r351586)
+++ head/usr.bin/bzip2/Makefile Wed Aug 28 21:01:51 2019(r351587)
@@ -12,7 +12,9 @@ LIBADD=   bz2
 
 LINKS= ${BINDIR}/bzip2 ${BINDIR}/bunzip2
 LINKS+=${BINDIR}/bzip2 ${BINDIR}/bzcat
-MLINKS= bzip2.1 bunzip2.1 bzip2.1 bzcat.1
+MLINKS=bzip2.1 bunzip2.1 \
+   bzip2.1 bzcat.1 \
+   bzip2.1 bzip2recover.1
 
 REFFILES=  sample1.ref sample2.ref sample3.ref 
 DREFFILES= sample1.bz2 sample2.bz2 sample3.bz2 

Modified: head/usr.bin/bzip2recover/Makefile
==
--- head/usr.bin/bzip2recover/Makefile  Wed Aug 28 20:58:24 2019
(r351586)
+++ head/usr.bin/bzip2recover/Makefile  Wed Aug 28 21:01:51 2019
(r351587)
@@ -6,8 +6,6 @@ BZ2DIR= ${SRCTOP}/contrib/bzip2
 PROG=  bzip2recover
 MAN=
 
-MLINKS+=bzip2.1 bzip2recover.1
-
 NO_WMISSING_VARIABLE_DECLARATIONS=
 
 .include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351586 - stable/11/sys/dev/nvme

2019-08-28 Thread Alexander Motin
Author: mav
Date: Wed Aug 28 20:58:24 2019
New Revision: 351586
URL: https://svnweb.freebsd.org/changeset/base/351586

Log:
  MFC r351320: Formalize NVMe controller consumer life cycle.
  
  This fixes possible double call of fail_fn, for example on hot removal.
  It also allows ctrlr_fn to safely return NULL cookie in case of failure
  and not get useless ns_fn or fail_fn call with NULL cookie later.

Modified:
  stable/11/sys/dev/nvme/nvme.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/nvme/nvme.c
==
--- stable/11/sys/dev/nvme/nvme.c   Wed Aug 28 20:35:23 2019
(r351585)
+++ stable/11/sys/dev/nvme/nvme.c   Wed Aug 28 20:58:24 2019
(r351586)
@@ -316,16 +316,21 @@ nvme_notify(struct nvme_consumer *cons,
return;
 
cmpset = atomic_cmpset_32(>notification_sent, 0, 1);
-
if (cmpset == 0)
return;
 
if (cons->ctrlr_fn != NULL)
ctrlr_cookie = (*cons->ctrlr_fn)(ctrlr);
else
-   ctrlr_cookie = NULL;
+   ctrlr_cookie = (void *)(uintptr_t)0xdeadc0dedeadc0de;
ctrlr->cons_cookie[cons->id] = ctrlr_cookie;
+
+   /* ctrlr_fn has failed.  Nothing to notify here any more. */
+   if (ctrlr_cookie == NULL)
+   return;
+
if (ctrlr->is_failed) {
+   ctrlr->cons_cookie[cons->id] = NULL;
if (cons->fail_fn != NULL)
(*cons->fail_fn)(ctrlr_cookie);
/*
@@ -381,13 +386,16 @@ nvme_notify_async_consumers(struct nvme_controller *ct
uint32_t log_page_size)
 {
struct nvme_consumer*cons;
+   void*ctrlr_cookie;
uint32_ti;
 
for (i = 0; i < NVME_MAX_CONSUMERS; i++) {
cons = _consumer[i];
-   if (cons->id != INVALID_CONSUMER_ID && cons->async_fn != NULL)
-   (*cons->async_fn)(ctrlr->cons_cookie[i], async_cpl,
+   if (cons->id != INVALID_CONSUMER_ID && cons->async_fn != NULL &&
+   (ctrlr_cookie = ctrlr->cons_cookie[i]) != NULL) {
+   (*cons->async_fn)(ctrlr_cookie, async_cpl,
log_page_id, log_page_buffer, log_page_size);
+   }
}
 }
 
@@ -395,6 +403,7 @@ void
 nvme_notify_fail_consumers(struct nvme_controller *ctrlr)
 {
struct nvme_consumer*cons;
+   void*ctrlr_cookie;
uint32_ti;
 
/*
@@ -408,8 +417,12 @@ nvme_notify_fail_consumers(struct nvme_controller *ctr
 
for (i = 0; i < NVME_MAX_CONSUMERS; i++) {
cons = _consumer[i];
-   if (cons->id != INVALID_CONSUMER_ID && cons->fail_fn != NULL)
-   cons->fail_fn(ctrlr->cons_cookie[i]);
+   if (cons->id != INVALID_CONSUMER_ID &&
+   (ctrlr_cookie = ctrlr->cons_cookie[i]) != NULL) {
+   ctrlr->cons_cookie[i] = NULL;
+   if (cons->fail_fn != NULL)
+   cons->fail_fn(ctrlr_cookie);
+   }
}
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r350544 - head/usr.bin/bzip2recover

2019-08-28 Thread Antoine Brodin
On Sat, Aug 3, 2019 at 12:10 AM Mark Johnston  wrote:
>
> Author: markj
> Date: Fri Aug  2 22:09:56 2019
> New Revision: 350544
> URL: https://svnweb.freebsd.org/changeset/base/350544
>
> Log:
>   Add bzip2recover.1.
>
>   MFC after:3 days
>   Sponsored by: The FreeBSD Foundation
>
> Modified:
>   head/usr.bin/bzip2recover/Makefile

Hi,

It seems that this breaks parrallel installworld.

Cheers,

Antoine
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r351584 - in head/sys: fs/nullfs fs/unionfs kern sys

2019-08-28 Thread Mateusz Guzik
On 8/28/19, Mateusz Guzik  wrote:
> Author: mjg
> Date: Wed Aug 28 20:34:24 2019
> New Revision: 351584
> URL: https://svnweb.freebsd.org/changeset/base/351584
>
> Log:
>   vfs: add VOP_NEED_INACTIVE
>
>   vnode usecount drops to 0 all the time (e.g. for directories during path
> lookup).
>   When that happens the kernel would always lock the exclusive lock for the
> vnode
>   in order to call vinactive(). This blocks other threads who want to use
> the vnode
>   for looukp.
>
>   vinactive is very rarely needed and can be tested for without the vnode
> lock held.
>
>   This patch gives filesytems an opportunity to do it, sample total wait
> time for
>   tmpfs over 500 minutes of poudriere -j 104:
>
>   before: 557563641706 (lockmgr:tmpfs)
>   after:   46309603301 (lockmgr:tmpfs)
>
>   Sponsored by:   The FreeBSD Foundation
>   Differential Revision:  https://reviews.freebsd.org/D21371
>

Reviewed by: kib
Tested by: pho

> Modified:
>   head/sys/fs/nullfs/null_vnops.c
>   head/sys/fs/unionfs/union_vnops.c
>   head/sys/kern/vfs_default.c
>   head/sys/kern/vfs_subr.c
>   head/sys/kern/vnode_if.src
>   head/sys/sys/vnode.h
>
> Modified: head/sys/fs/nullfs/null_vnops.c
> ==
> --- head/sys/fs/nullfs/null_vnops.c   Wed Aug 28 20:23:49 2019
> (r351583)
> +++ head/sys/fs/nullfs/null_vnops.c   Wed Aug 28 20:34:24 2019
> (r351584)
> @@ -907,6 +907,7 @@ struct vop_vector null_vnodeops = {
>   .vop_getattr =  null_getattr,
>   .vop_getwritemount =null_getwritemount,
>   .vop_inactive = null_inactive,
> + .vop_need_inactive =vop_stdneed_inactive,
>   .vop_islocked = vop_stdislocked,
>   .vop_lock1 =null_lock,
>   .vop_lookup =   null_lookup,
>
> Modified: head/sys/fs/unionfs/union_vnops.c
> ==
> --- head/sys/fs/unionfs/union_vnops.c Wed Aug 28 20:23:49 2019
> (r351583)
> +++ head/sys/fs/unionfs/union_vnops.c Wed Aug 28 20:34:24 2019
> (r351584)
> @@ -2523,6 +2523,7 @@ struct vop_vector unionfs_vnodeops = {
>   .vop_getextattr =   unionfs_getextattr,
>   .vop_getwritemount =unionfs_getwritemount,
>   .vop_inactive = unionfs_inactive,
> + .vop_need_inactive =vop_stdneed_inactive,
>   .vop_islocked = unionfs_islocked,
>   .vop_ioctl =unionfs_ioctl,
>   .vop_link = unionfs_link,
>
> Modified: head/sys/kern/vfs_default.c
> ==
> --- head/sys/kern/vfs_default.c   Wed Aug 28 20:23:49 2019
> (r351583)
> +++ head/sys/kern/vfs_default.c   Wed Aug 28 20:34:24 2019
> (r351584)
> @@ -120,6 +120,7 @@ struct vop_vector default_vnodeops = {
>   .vop_getpages_async =   vop_stdgetpages_async,
>   .vop_getwritemount =vop_stdgetwritemount,
>   .vop_inactive = VOP_NULL,
> + .vop_need_inactive =vop_stdneed_inactive,
>   .vop_ioctl =vop_stdioctl,
>   .vop_kqfilter = vop_stdkqfilter,
>   .vop_islocked = vop_stdislocked,
> @@ -1155,6 +1156,13 @@ vop_stdadd_writecount(struct vop_add_writecount_args
> *
>   }
>   VI_UNLOCK(vp);
>   return (error);
> +}
> +
> +int
> +vop_stdneed_inactive(struct vop_need_inactive_args *ap)
> +{
> +
> + return (1);
>  }
>
>  static int
>
> Modified: head/sys/kern/vfs_subr.c
> ==
> --- head/sys/kern/vfs_subr.c  Wed Aug 28 20:23:49 2019(r351583)
> +++ head/sys/kern/vfs_subr.c  Wed Aug 28 20:34:24 2019(r351584)
> @@ -2891,6 +2891,21 @@ vputx(struct vnode *vp, int func)
>   CTR2(KTR_VFS, "%s: return vnode %p to the freelist", __func__, vp);
>
>   /*
> +  * Check if the fs wants to perform inactive processing. Note we
> +  * may be only holding the interlock, in which case it is possible
> +  * someone else called vgone on the vnode and ->v_data is now NULL.
> +  * Since vgone performs inactive on its own there is nothing to do
> +  * here but to drop our hold count.
> +  */
> + if (__predict_false(vp->v_iflag & VI_DOOMED) ||
> + VOP_NEED_INACTIVE(vp) == 0) {
> + if (func == VPUTX_VPUT)
> + VOP_UNLOCK(vp, 0);
> + vdropl(vp);
> + return;
> + }
> +
> + /*
>* We must call VOP_INACTIVE with the node locked. Mark
>* as VI_DOINGINACT to avoid recursion.
>*/
> @@ -4353,6 +4368,7 @@ static struct vop_vector sync_vnodeops = {
>   .vop_close =sync_close, /* close */
>   .vop_fsync =sync_fsync, /* fsync */
>   .vop_inactive = sync_inactive,  /* inactive */
> + .vop_need_inactive = vop_stdneed_inactive, /* need_inactive */
>   

svn commit: r351585 - head/sys/fs/tmpfs

2019-08-28 Thread Mateusz Guzik
Author: mjg
Date: Wed Aug 28 20:35:23 2019
New Revision: 351585
URL: https://svnweb.freebsd.org/changeset/base/351585

Log:
  tmpfs: use VOP_NEED_INACTIVE
  
  Reviewed by:  kib
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D21371

Modified:
  head/sys/fs/tmpfs/tmpfs_vnops.c

Modified: head/sys/fs/tmpfs/tmpfs_vnops.c
==
--- head/sys/fs/tmpfs/tmpfs_vnops.c Wed Aug 28 20:34:24 2019
(r351584)
+++ head/sys/fs/tmpfs/tmpfs_vnops.c Wed Aug 28 20:35:23 2019
(r351585)
@@ -1283,6 +1283,27 @@ tmpfs_inactive(struct vop_inactive_args *v)
return (0);
 }
 
+static int
+tmpfs_need_inactive(struct vop_need_inactive_args *ap)
+{
+   struct vnode *vp;
+   struct tmpfs_node *node;
+   struct vm_object *obj;
+
+   vp = ap->a_vp;
+   node = VP_TO_TMPFS_NODE(vp);
+   if (node->tn_links == 0)
+   goto need;
+   if (vp->v_type == VREG) {
+   obj = vp->v_object;
+   if ((obj->flags & OBJ_TMPFS_DIRTY) != 0)
+   goto need;
+   }
+   return (0);
+need:
+   return (1);
+}
+
 int
 tmpfs_reclaim(struct vop_reclaim_args *v)
 {
@@ -1584,6 +1605,7 @@ struct vop_vector tmpfs_vnodeop_entries = {
.vop_readdir =  tmpfs_readdir,
.vop_readlink = tmpfs_readlink,
.vop_inactive = tmpfs_inactive,
+   .vop_need_inactive =tmpfs_need_inactive,
.vop_reclaim =  tmpfs_reclaim,
.vop_print =tmpfs_print,
.vop_pathconf = tmpfs_pathconf,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351584 - in head/sys: fs/nullfs fs/unionfs kern sys

2019-08-28 Thread Mateusz Guzik
Author: mjg
Date: Wed Aug 28 20:34:24 2019
New Revision: 351584
URL: https://svnweb.freebsd.org/changeset/base/351584

Log:
  vfs: add VOP_NEED_INACTIVE
  
  vnode usecount drops to 0 all the time (e.g. for directories during path 
lookup).
  When that happens the kernel would always lock the exclusive lock for the 
vnode
  in order to call vinactive(). This blocks other threads who want to use the 
vnode
  for looukp.
  
  vinactive is very rarely needed and can be tested for without the vnode lock 
held.
  
  This patch gives filesytems an opportunity to do it, sample total wait time 
for
  tmpfs over 500 minutes of poudriere -j 104:
  
  before: 557563641706 (lockmgr:tmpfs)
  after:   46309603301 (lockmgr:tmpfs)
  
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D21371

Modified:
  head/sys/fs/nullfs/null_vnops.c
  head/sys/fs/unionfs/union_vnops.c
  head/sys/kern/vfs_default.c
  head/sys/kern/vfs_subr.c
  head/sys/kern/vnode_if.src
  head/sys/sys/vnode.h

Modified: head/sys/fs/nullfs/null_vnops.c
==
--- head/sys/fs/nullfs/null_vnops.c Wed Aug 28 20:23:49 2019
(r351583)
+++ head/sys/fs/nullfs/null_vnops.c Wed Aug 28 20:34:24 2019
(r351584)
@@ -907,6 +907,7 @@ struct vop_vector null_vnodeops = {
.vop_getattr =  null_getattr,
.vop_getwritemount =null_getwritemount,
.vop_inactive = null_inactive,
+   .vop_need_inactive =vop_stdneed_inactive,
.vop_islocked = vop_stdislocked,
.vop_lock1 =null_lock,
.vop_lookup =   null_lookup,

Modified: head/sys/fs/unionfs/union_vnops.c
==
--- head/sys/fs/unionfs/union_vnops.c   Wed Aug 28 20:23:49 2019
(r351583)
+++ head/sys/fs/unionfs/union_vnops.c   Wed Aug 28 20:34:24 2019
(r351584)
@@ -2523,6 +2523,7 @@ struct vop_vector unionfs_vnodeops = {
.vop_getextattr =   unionfs_getextattr,
.vop_getwritemount =unionfs_getwritemount,
.vop_inactive = unionfs_inactive,
+   .vop_need_inactive =vop_stdneed_inactive,
.vop_islocked = unionfs_islocked,
.vop_ioctl =unionfs_ioctl,
.vop_link = unionfs_link,

Modified: head/sys/kern/vfs_default.c
==
--- head/sys/kern/vfs_default.c Wed Aug 28 20:23:49 2019(r351583)
+++ head/sys/kern/vfs_default.c Wed Aug 28 20:34:24 2019(r351584)
@@ -120,6 +120,7 @@ struct vop_vector default_vnodeops = {
.vop_getpages_async =   vop_stdgetpages_async,
.vop_getwritemount =vop_stdgetwritemount,
.vop_inactive = VOP_NULL,
+   .vop_need_inactive =vop_stdneed_inactive,
.vop_ioctl =vop_stdioctl,
.vop_kqfilter = vop_stdkqfilter,
.vop_islocked = vop_stdislocked,
@@ -1155,6 +1156,13 @@ vop_stdadd_writecount(struct vop_add_writecount_args *
}
VI_UNLOCK(vp);
return (error);
+}
+
+int
+vop_stdneed_inactive(struct vop_need_inactive_args *ap)
+{
+
+   return (1);
 }
 
 static int

Modified: head/sys/kern/vfs_subr.c
==
--- head/sys/kern/vfs_subr.cWed Aug 28 20:23:49 2019(r351583)
+++ head/sys/kern/vfs_subr.cWed Aug 28 20:34:24 2019(r351584)
@@ -2891,6 +2891,21 @@ vputx(struct vnode *vp, int func)
CTR2(KTR_VFS, "%s: return vnode %p to the freelist", __func__, vp);
 
/*
+* Check if the fs wants to perform inactive processing. Note we
+* may be only holding the interlock, in which case it is possible
+* someone else called vgone on the vnode and ->v_data is now NULL.
+* Since vgone performs inactive on its own there is nothing to do
+* here but to drop our hold count.
+*/
+   if (__predict_false(vp->v_iflag & VI_DOOMED) ||
+   VOP_NEED_INACTIVE(vp) == 0) {
+   if (func == VPUTX_VPUT)
+   VOP_UNLOCK(vp, 0);
+   vdropl(vp);
+   return;
+   }
+
+   /*
 * We must call VOP_INACTIVE with the node locked. Mark
 * as VI_DOINGINACT to avoid recursion.
 */
@@ -4353,6 +4368,7 @@ static struct vop_vector sync_vnodeops = {
.vop_close =sync_close, /* close */
.vop_fsync =sync_fsync, /* fsync */
.vop_inactive = sync_inactive,  /* inactive */
+   .vop_need_inactive = vop_stdneed_inactive, /* need_inactive */
.vop_reclaim =  sync_reclaim,   /* reclaim */
.vop_lock1 =vop_stdlock,/* lock */
.vop_unlock =   vop_stdunlock,  /* unlock */
@@ -4514,6 +4530,20 @@ sync_reclaim(struct 

svn commit: r351583 - stable/11/sbin/camcontrol

2019-08-28 Thread Alexander Motin
Author: mav
Date: Wed Aug 28 20:23:49 2019
New Revision: 351583
URL: https://svnweb.freebsd.org/changeset/base/351583

Log:
  MFC r350677: Make GCC happy about math in r350676.

Modified:
  stable/11/sbin/camcontrol/modeedit.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/camcontrol/modeedit.c
==
--- stable/11/sbin/camcontrol/modeedit.cWed Aug 28 20:23:08 2019
(r351582)
+++ stable/11/sbin/camcontrol/modeedit.cWed Aug 28 20:23:49 2019
(r351583)
@@ -295,11 +295,8 @@ editentry_set(char *name, char *newvalue, int editonly
 /*
  * Macro to determine the maximum value of the given size for the current
  * resolution.
- * XXX Lovely x86's optimize out the case of shifting by 32 and gcc doesn't
- * currently workaround it (even for int64's), so we have to kludge it.
  */
-#defineRESOLUTION_MAX(size) ((resolution * (size) == 32)?  
\
-   UINT_MAX: (1 << (resolution * (size))) - 1)
+#defineRESOLUTION_MAX(size)((1LL << (resolution * (size))) - 1)
 
assert(newvalue != NULL);
if (*newvalue == '\0')
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351582 - in stable/11: sbin/camcontrol sys/cam/scsi

2019-08-28 Thread Alexander Motin
Author: mav
Date: Wed Aug 28 20:23:08 2019
New Revision: 351582
URL: https://svnweb.freebsd.org/changeset/base/351582

Log:
  MFC r350676: Make `camcontrol modepage` support block descriptors.
  
  It allows to read and write block descriptors alike to mode page parameters.
  It allows to change block size or short-stroke HDDs or overprovision SSDs.
  Depenting on -P parameter the change can be either persistent or till reset.
  In case of block size change device may need reformat after the setting.
  In case of SSD overprovisioning format or sanitize may be needed to really
  free the flash.
  
  During implementation appeared that csio_encode_visit() can not handle
  integers of more then 4 bytes, that makes 8-byte LBA handling awkward.
  I had to split it into two 4-byte halves now.
  
  Relnotes: yes
  Sponsored by: iXsystems, Inc.

Modified:
  stable/11/sbin/camcontrol/camcontrol.8
  stable/11/sbin/camcontrol/camcontrol.c
  stable/11/sbin/camcontrol/camcontrol.h
  stable/11/sbin/camcontrol/modeedit.c
  stable/11/sys/cam/scsi/scsi_all.c
  stable/11/sys/cam/scsi/scsi_all.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/camcontrol/camcontrol.8
==
--- stable/11/sbin/camcontrol/camcontrol.8  Wed Aug 28 20:22:14 2019
(r351581)
+++ stable/11/sbin/camcontrol/camcontrol.8  Wed Aug 28 20:23:08 2019
(r351582)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 30, 2019
+.Dd August 6, 2019
 .Dt CAMCONTROL 8
 .Os
 .Sh NAME
@@ -125,6 +125,8 @@
 .Op Fl 6
 .Aq Fl m Ar page[,subpage] | Fl l
 .Op Fl P Ar pgctl
+.Op Fl D
+.Op Fl L
 .Op Fl b | Fl e
 .Op Fl d
 .Nm
@@ -733,6 +735,11 @@ If not specified,
 starts with 10 byte commands and falls back to 6 byte on error.
 .It Fl d
 Disable block descriptors for mode sense.
+.It Fl D
+Display/edit block descriptors instead of mode page.
+.It Fl L
+Use long LBA block descriptors.
+Allows number of LBAs bigger then 2^^32.
 .It Fl b
 Displays mode page data in binary format.
 .It Fl e

Modified: stable/11/sbin/camcontrol/camcontrol.c
==
--- stable/11/sbin/camcontrol/camcontrol.c  Wed Aug 28 20:22:14 2019
(r351581)
+++ stable/11/sbin/camcontrol/camcontrol.c  Wed Aug 28 20:23:08 2019
(r351582)
@@ -224,7 +224,7 @@ static struct camcontrol_opts option_table[] = {
{"devtype", CAM_CMD_DEVTYPE, CAM_ARG_NONE, ""},
 #ifndef MINIMALISTIC
{"periphlist", CAM_CMD_DEVLIST, CAM_ARG_NONE, NULL},
-   {"modepage", CAM_CMD_MODE_PAGE, CAM_ARG_NONE, "6bdelm:P:"},
+   {"modepage", CAM_CMD_MODE_PAGE, CAM_ARG_NONE, "6bdelm:DLP:"},
{"tags", CAM_CMD_TAG, CAM_ARG_NONE, "N:q"},
{"negotiate", CAM_CMD_RATE, CAM_ARG_NONE, negotiate_opts},
{"rate", CAM_CMD_RATE, CAM_ARG_NONE, negotiate_opts},
@@ -4430,9 +4430,9 @@ reassignblocks(struct cam_device *device, u_int32_t *b
 
 #ifndef MINIMALISTIC
 void
-mode_sense(struct cam_device *device, int *cdb_len, int dbd, int pc, int page,
-int subpage, int task_attr, int retry_count, int timeout, u_int8_t *data,
-int datalen)
+mode_sense(struct cam_device *device, int *cdb_len, int dbd, int llbaa, int pc,
+int page, int subpage, int task_attr, int retry_count, int timeout,
+u_int8_t *data, int datalen)
 {
union ccb *ccb;
int error_code, sense_key, asc, ascq;
@@ -4464,6 +4464,11 @@ retry:
/* minimum_cmd_size */ *cdb_len,
/* sense_len */ SSD_FULL_SIZE,
/* timeout */ timeout ? timeout : 5000);
+   if (llbaa && ccb->csio.cdb_len == 10) {
+   struct scsi_mode_sense_10 *cdb =
+   (struct scsi_mode_sense_10 *)ccb->csio.cdb_io.cdb_bytes;
+   cdb->byte2 |= SMS10_LLBAA;
+   }
 
/* Record what CDB size the above function really set. */
*cdb_len = ccb->csio.cdb_len;
@@ -4555,8 +4560,8 @@ modepage(struct cam_device *device, int argc, char **a
 int task_attr, int retry_count, int timeout)
 {
char *str_subpage;
-   int c, page = -1, subpage = -1, pc = 0;
-   int binary = 0, cdb_len = 10, dbd = 0, edit = 0, list = 0;
+   int c, page = -1, subpage = -1, pc = 0, llbaa = 0;
+   int binary = 0, cdb_len = 10, dbd = 0, desc = 0, edit = 0, list = 0;
 
while ((c = getopt(argc, argv, combinedopt)) != -1) {
switch(c) {
@@ -4588,6 +4593,12 @@ modepage(struct cam_device *device, int argc, char **a
if (subpage < 0)
errx(1, "invalid mode subpage %d", subpage);
break;
+   case 'D':
+   desc = 1;
+   break;
+   case 'L':
+   llbaa = 1;
+   break;
case 'P':
pc = strtol(optarg, NULL, 0);

svn commit: r351581 - stable/11/sbin/camcontrol

2019-08-28 Thread Alexander Motin
Author: mav
Date: Wed Aug 28 20:22:14 2019
New Revision: 351581
URL: https://svnweb.freebsd.org/changeset/base/351581

Log:
  MFC r350457: Make `camcontrol modepage` to use 10 byte commands.
  
  While old devices may not support 10 byte MODE SENSE/MODE SELECT commands,
  new ones may not be able to report all mode pages with 6 byte commands.
  
  This patch makes camcontrol by default start with 10 byte commands and
  fall back to 6 byte on ILLEGAL REQUEST error, or 6 byte can be forced.

Modified:
  stable/11/sbin/camcontrol/camcontrol.8
  stable/11/sbin/camcontrol/camcontrol.c
  stable/11/sbin/camcontrol/camcontrol.h
  stable/11/sbin/camcontrol/modeedit.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/camcontrol/camcontrol.8
==
--- stable/11/sbin/camcontrol/camcontrol.8  Wed Aug 28 20:21:34 2019
(r351580)
+++ stable/11/sbin/camcontrol/camcontrol.8  Wed Aug 28 20:22:14 2019
(r351581)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 25, 2019
+.Dd July 30, 2019
 .Dt CAMCONTROL 8
 .Os
 .Sh NAME
@@ -122,6 +122,7 @@
 .Ic modepage
 .Op device id
 .Op generic args
+.Op Fl 6
 .Aq Fl m Ar page[,subpage] | Fl l
 .Op Fl P Ar pgctl
 .Op Fl b | Fl e
@@ -723,6 +724,13 @@ The
 .Ic modepage
 command takes several arguments:
 .Bl -tag -width 12n
+.It Fl 6
+Use 6 byte MODE commands instead of default 10 byte.
+Old devices may not support 10 byte MODE commands, while new devices may
+not be able to report all mode pages with 6 byte commands.
+If not specified,
+.Nm
+starts with 10 byte commands and falls back to 6 byte on error.
 .It Fl d
 Disable block descriptors for mode sense.
 .It Fl b

Modified: stable/11/sbin/camcontrol/camcontrol.c
==
--- stable/11/sbin/camcontrol/camcontrol.c  Wed Aug 28 20:21:34 2019
(r351580)
+++ stable/11/sbin/camcontrol/camcontrol.c  Wed Aug 28 20:22:14 2019
(r351581)
@@ -224,7 +224,7 @@ static struct camcontrol_opts option_table[] = {
{"devtype", CAM_CMD_DEVTYPE, CAM_ARG_NONE, ""},
 #ifndef MINIMALISTIC
{"periphlist", CAM_CMD_DEVLIST, CAM_ARG_NONE, NULL},
-   {"modepage", CAM_CMD_MODE_PAGE, CAM_ARG_NONE, "bdelm:P:"},
+   {"modepage", CAM_CMD_MODE_PAGE, CAM_ARG_NONE, "6bdelm:P:"},
{"tags", CAM_CMD_TAG, CAM_ARG_NONE, "N:q"},
{"negotiate", CAM_CMD_RATE, CAM_ARG_NONE, negotiate_opts},
{"rate", CAM_CMD_RATE, CAM_ARG_NONE, negotiate_opts},
@@ -4430,18 +4430,25 @@ reassignblocks(struct cam_device *device, u_int32_t *b
 
 #ifndef MINIMALISTIC
 void
-mode_sense(struct cam_device *device, int dbd, int pc, int page, int subpage,
-  int task_attr, int retry_count, int timeout, u_int8_t *data,
-  int datalen)
+mode_sense(struct cam_device *device, int *cdb_len, int dbd, int pc, int page,
+int subpage, int task_attr, int retry_count, int timeout, u_int8_t *data,
+int datalen)
 {
union ccb *ccb;
-   int retval;
+   int error_code, sense_key, asc, ascq;
 
ccb = cam_getccb(device);
-
if (ccb == NULL)
errx(1, "mode_sense: couldn't allocate CCB");
 
+retry:
+   /*
+* MODE SENSE(6) can't handle more then 255 bytes.  If there are more,
+* device must return error, so we should not get trucated data.
+*/
+   if (*cdb_len == 6 && datalen > 255)
+   datalen = 255;
+
CCB_CLEAR_ALL_EXCEPT_HDR(>csio);
 
scsi_mode_sense_subpage(>csio,
@@ -4454,36 +4461,47 @@ mode_sense(struct cam_device *device, int dbd, int pc,
/* subpage */ subpage,
/* param_buf */ data,
/* param_len */ datalen,
-   /* minimum_cmd_size */ 0,
+   /* minimum_cmd_size */ *cdb_len,
/* sense_len */ SSD_FULL_SIZE,
/* timeout */ timeout ? timeout : 5000);
 
+   /* Record what CDB size the above function really set. */
+   *cdb_len = ccb->csio.cdb_len;
+
if (arglist & CAM_ARG_ERR_RECOVER)
ccb->ccb_h.flags |= CAM_PASS_ERR_RECOVER;
 
/* Disable freezing the device queue */
ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
 
-   if (((retval = cam_send_ccb(device, ccb)) < 0)
-|| ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)) {
+   if (cam_send_ccb(device, ccb) < 0)
+   err(1, "error sending mode sense command");
+
+   /* In case of ILLEGEL REQUEST try to fall back to 6-byte command. */
+   if (*cdb_len != 6 &&
+   ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INVALID ||
+(scsi_extract_sense_ccb(ccb, _code, _key, , )
+ && sense_key == SSD_KEY_ILLEGAL_REQUEST))) {
+   *cdb_len = 6;
+   goto retry;
+   }
+
+   if ((ccb->ccb_h.status & CAM_STATUS_MASK) != 

svn commit: r351580 - stable/11/sbin/camcontrol

2019-08-28 Thread Alexander Motin
Author: mav
Date: Wed Aug 28 20:21:34 2019
New Revision: 351580
URL: https://svnweb.freebsd.org/changeset/base/351580

Log:
  MFC r350424: Use present now scsi_mode_sense_subpage().

Modified:
  stable/11/sbin/camcontrol/timestamp.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/camcontrol/timestamp.c
==
--- stable/11/sbin/camcontrol/timestamp.c   Wed Aug 28 20:20:38 2019
(r351579)
+++ stable/11/sbin/camcontrol/timestamp.c   Wed Aug 28 20:21:34 2019
(r351580)
@@ -79,7 +79,6 @@ set_restore_flags(struct cam_device *device, uint8_t *
int error = 0;
struct scsi_control_ext_page *control_page = NULL;
struct scsi_mode_header_10 *mode_hdr = NULL;
-   struct scsi_mode_sense_10 *cdb = NULL;
union ccb *ccb = NULL;
unsigned long mode_buf_size = sizeof(struct scsi_mode_header_10) +
sizeof(struct scsi_mode_blk_desc) +
@@ -96,25 +95,19 @@ set_restore_flags(struct cam_device *device, uint8_t *
 * Get the control extension subpage, we'll send it back modified to
 * enable SCSI control over the tape drive's timestamp
 */
-   scsi_mode_sense_len(>csio,
+   scsi_mode_sense_subpage(>csio,
/*retries*/ retry_count,
/*cbfcnp*/ NULL,
/*tag_action*/ task_attr,
/*dbd*/ 0,
/*page_control*/ SMS_PAGE_CTRL_CURRENT,
/*page*/ SCEP_PAGE_CODE,
+   /*subpage*/ SCEP_SUBPAGE_CODE,
/*param_buf*/ _buf[0],
/*param_len*/ mode_buf_size,
/*minimum_cmd_size*/ 10,
/*sense_len*/ SSD_FULL_SIZE,
/*timeout*/ timeout ? timeout : 5000);
-   /*
-* scsi_mode_sense_len does not have a subpage argument at the moment,
-* so we have to manually set the subpage code before calling
-* cam_send_ccb().
-*/
-   cdb = (struct scsi_mode_sense_10 *)ccb->csio.cdb_io.cdb_bytes;
-   cdb->subpage = SCEP_SUBPAGE_CODE;
 
ccb->ccb_h.flags |= CAM_DEV_QFRZDIS;
if (retry_count > 0)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351579 - in stable/11: sbin/camcontrol sys/sys

2019-08-28 Thread Alexander Motin
Author: mav
Date: Wed Aug 28 20:20:38 2019
New Revision: 351579
URL: https://svnweb.freebsd.org/changeset/base/351579

Log:
  MFC r350393: Decode some more IDENTIFY DEVICE bits.

Modified:
  stable/11/sbin/camcontrol/camcontrol.c
  stable/11/sys/sys/ata.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/camcontrol/camcontrol.c
==
--- stable/11/sbin/camcontrol/camcontrol.c  Wed Aug 28 20:05:55 2019
(r351578)
+++ stable/11/sbin/camcontrol/camcontrol.c  Wed Aug 28 20:20:38 2019
(r351579)
@@ -1373,6 +1373,7 @@ atacapprint(struct ata_params *parm)
printf("WWN   %04x%04x%04x%04x\n",
parm->wwn[0], parm->wwn[1], parm->wwn[2], parm->wwn[3]);
}
+   printf("additional product id %.8s\n", parm->product_id);
if (parm->enabled.extension & ATA_SUPPORT_MEDIASN) {
printf("media serial number   %.30s\n",
parm->media_serial);
@@ -1502,35 +1503,39 @@ atacapprint(struct ata_params *parm)
} else
printf("\n");
printf("Native Command Queuing (NCQ)   ");
-   if (parm->satacapabilities != 0x &&
-   (parm->satacapabilities & ATA_SUPPORT_NCQ)) {
+   if (atasata(parm) && (parm->satacapabilities & ATA_SUPPORT_NCQ)) {
printf("yes %d tags\n",
ATA_QUEUE_LEN(parm->queue) + 1);
+   printf("NCQ Priority Information   %s\n",
+   parm->satacapabilities & ATA_SUPPORT_NCQ_PRIO ?
+   "yes" : "no");
+   printf("NCQ Non-Data Command   %s\n",
+   parm->satacapabilities2 & ATA_SUPPORT_NCQ_NON_DATA ?
+   "yes" : "no");
+   printf("NCQ Streaming  %s\n",
+   parm->satacapabilities2 & ATA_SUPPORT_NCQ_STREAM ?
+   "yes" : "no");
+   printf("Receive & Send FPDMA Queued%s\n",
+   parm->satacapabilities2 & ATA_SUPPORT_RCVSND_FPDMA_QUEUED ?
+   "yes" : "no");
+   printf("NCQ Autosense  %s\n",
+   parm->satasupport & ATA_SUPPORT_NCQ_AUTOSENSE ?
+   "yes" : "no");
} else
printf("no\n");
 
-   printf("NCQ Queue Management   %s\n", atasata(parm) &&
-   parm->satacapabilities2 & ATA_SUPPORT_NCQ_QMANAGEMENT ?
-   "yes" : "no");
-   printf("NCQ Streaming  %s\n", atasata(parm) &&
-   parm->satacapabilities2 & ATA_SUPPORT_NCQ_STREAM ?
-   "yes" : "no");
-   printf("Receive & Send FPDMA Queued%s\n", atasata(parm) &&
-   parm->satacapabilities2 & ATA_SUPPORT_RCVSND_FPDMA_QUEUED ?
-   "yes" : "no");
-
printf("SMART  %s   %s\n",
parm->support.command1 & ATA_SUPPORT_SMART ? "yes" : "no",
parm->enabled.command1 & ATA_SUPPORT_SMART ? "yes" : "no");
-   printf("microcode download %s   %s\n",
-   parm->support.command2 & ATA_SUPPORT_MICROCODE ? "yes" : "no",
-   parm->enabled.command2 & ATA_SUPPORT_MICROCODE ? "yes" : "no");
printf("security   %s   %s\n",
parm->support.command1 & ATA_SUPPORT_SECURITY ? "yes" : "no",
parm->enabled.command1 & ATA_SUPPORT_SECURITY ? "yes" : "no");
printf("power management   %s   %s\n",
parm->support.command1 & ATA_SUPPORT_POWERMGT ? "yes" : "no",
parm->enabled.command1 & ATA_SUPPORT_POWERMGT ? "yes" : "no");
+   printf("microcode download %s   %s\n",
+   parm->support.command2 & ATA_SUPPORT_MICROCODE ? "yes" : "no",
+   parm->enabled.command2 & ATA_SUPPORT_MICROCODE ? "yes" : "no");
printf("advanced power management  %s   %s",
parm->support.command2 & ATA_SUPPORT_APM ? "yes" : "no",
parm->enabled.command2 & ATA_SUPPORT_APM ? "yes" : "no");
@@ -1573,6 +1578,15 @@ atacapprint(struct ata_params *parm)
printf("free-fall  %s   %s\n",
parm->support2 & ATA_SUPPORT_FREEFALL ? "yes" : "no",
parm->enabled2 & ATA_SUPPORT_FREEFALL ? "yes" : "no");
+   printf("sense data reporting   %s   %s\n",
+   parm->support2 & ATA_SUPPORT_SENSE_REPORT ? "yes" : "no",
+   parm->enabled2 & ATA_SUPPORT_SENSE_REPORT ? "yes" : "no");
+   printf("extended power conditions  %s   %s\n",
+   parm->support2 & ATA_SUPPORT_EPC ? "yes" : "no",
+   parm->enabled2 & ATA_SUPPORT_EPC ? "yes" : "no");
+   printf("device statistics notification %s   %s\n",
+   

svn commit: r351577 - head/sys/amd64/amd64

2019-08-28 Thread Mateusz Guzik
Author: mjg
Date: Wed Aug 28 19:40:57 2019
New Revision: 351577
URL: https://svnweb.freebsd.org/changeset/base/351577

Log:
  amd64: clean up cpu_switch.S
  
  - LK macro (conditional on SMP for the lock prefix) is unused
  - SETLK unnecessarily performs xchg. obtained value is never used and the
implicit lock prefix adds avoidable cost. Barrier provided by it does
not appear to be of any use.
  - the lock waited for is almost never blocked, yet the loop starts with
a pause. Move it out of the common case.
  
  Reviewed by:  kib
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D19563

Modified:
  head/sys/amd64/amd64/cpu_switch.S

Modified: head/sys/amd64/amd64/cpu_switch.S
==
--- head/sys/amd64/amd64/cpu_switch.S   Wed Aug 28 19:28:27 2019
(r351576)
+++ head/sys/amd64/amd64/cpu_switch.S   Wed Aug 28 19:40:57 2019
(r351577)
@@ -45,18 +45,6 @@
 
.text
 
-#ifdef SMP
-#define LK lock ;
-#else
-#define LK
-#endif
-
-#if defined(SCHED_ULE) && defined(SMP)
-#defineSETLK   xchgq
-#else
-#defineSETLK   movq
-#endif
-
 /*
  * cpu_throw()
  *
@@ -150,17 +138,15 @@ ctx_switch_xsave:
movq%rdx,%r15
movq%rsi,%rdi
callq   pmap_activate_sw
-   SETLK   %r15,TD_LOCK(%r13)  /* Release the old thread */
+   movq%r15,TD_LOCK(%r13)  /* Release the old thread */
 sw1:
movqTD_PCB(%r12),%r8
 #if defined(SCHED_ULE) && defined(SMP)
-   /* Wait for the new thread to become unblocked */
movq$blocked_lock, %rdx
-1:
movqTD_LOCK(%r12),%rcx
cmpq%rcx, %rdx
-   pause
-   je  1b
+   je  sw1wait
+sw1cont:
 #endif
/*
 * At this point, we've switched address spaces and are ready
@@ -496,3 +482,14 @@ ENTRY(resumectx)
xorl%eax,%eax
ret
 END(resumectx)
+
+/* Wait for the new thread to become unblocked */
+#if defined(SCHED_ULE) && defined(SMP)
+sw1wait:
+1:
+   pause
+   movqTD_LOCK(%r12),%rcx
+   cmpq%rcx, %rdx
+   je  1b
+   jmp sw1cont
+#endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351576 - head/sys/vm

2019-08-28 Thread Mateusz Guzik
Author: mjg
Date: Wed Aug 28 19:28:27 2019
New Revision: 351576
URL: https://svnweb.freebsd.org/changeset/base/351576

Log:
  vm: only lock tmpfs vnode shared in vm_object_deallocate
  
  Reviewed by:  kib
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D21455

Modified:
  head/sys/vm/vm_object.c

Modified: head/sys/vm/vm_object.c
==
--- head/sys/vm/vm_object.c Wed Aug 28 18:01:54 2019(r351575)
+++ head/sys/vm/vm_object.c Wed Aug 28 19:28:27 2019(r351576)
@@ -536,7 +536,7 @@ vm_object_deallocate(vm_object_t object)
vp = object->un_pager.swp.swp_tmpfs;
vhold(vp);
VM_OBJECT_WUNLOCK(object);
-   vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+   vn_lock(vp, LK_SHARED | LK_RETRY);
VM_OBJECT_WLOCK(object);
if (object->type == OBJT_DEAD ||
object->ref_count != 1) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351575 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs kern

2019-08-28 Thread Mark Johnston
Author: markj
Date: Wed Aug 28 18:01:54 2019
New Revision: 351575
URL: https://svnweb.freebsd.org/changeset/base/351575

Log:
  Avoid direct accesses of the vm_page wire_count field.
  
  No functional change intended.
  
  Sponsored by: Netflix

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  head/sys/kern/vfs_bio.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Aug 
28 17:39:46 2019(r351574)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Aug 
28 18:01:54 2019(r351575)
@@ -593,7 +593,7 @@ mappedread_sf(vnode_t *vp, int nbytes, uio_t *uio)
vm_page_sunbusy(pp);
vm_page_lock(pp);
if (error) {
-   if (pp->wire_count == 0 && pp->valid == 0 &&
+   if (!vm_page_wired(pp) && pp->valid == 0 &&
!vm_page_busied(pp))
vm_page_free(pp);
} else {

Modified: head/sys/kern/vfs_bio.c
==
--- head/sys/kern/vfs_bio.c Wed Aug 28 17:39:46 2019(r351574)
+++ head/sys/kern/vfs_bio.c Wed Aug 28 18:01:54 2019(r351575)
@@ -4881,10 +4881,9 @@ vm_hold_free_pages(struct buf *bp, int newbsize)
for (index = newnpages; index < bp->b_npages; index++) {
p = bp->b_pages[index];
bp->b_pages[index] = NULL;
-   p->wire_count--;
+   vm_page_unwire_noq(p);
vm_page_free(p);
}
-   vm_wire_sub(bp->b_npages - newnpages);
bp->b_npages = newnpages;
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351574 - head/cddl/contrib/opensolaris/lib/libzfs/common

2019-08-28 Thread Alexander Motin
Author: mav
Date: Wed Aug 28 17:39:46 2019
New Revision: 351574
URL: https://svnweb.freebsd.org/changeset/base/351574

Log:
  MFV/ZoL: Fix wrong assertion in libzfs diff error handling
  
  In compare(), all error cases set the error code to EPIPE, so when an
  error is set, the correct assertion to make is that the error is EPIPE,
  not EINVAL.
  
  Reviewed-by: Richard Elling 
  Reviewed-by: Brian Behlendorf 
  Signed-off-by: Ryan Moeller 
  Closes #8743
  zfsonlinux/zfs@9dc41a769df164875d974c2431b2453e70e16c41
  
  Submitted by: Ryan Moeller 
  MFC after:1 week
  Sponsored by: iXsystems, Inc.
  Differential Revision:https://reviews.freebsd.org/D20118

Modified:
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c
==
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c   Wed Aug 
28 17:01:28 2019(r351573)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c   Wed Aug 
28 17:39:46 2019(r351574)
@@ -472,7 +472,7 @@ differ(void *arg)
if (err)
return ((void *)-1);
if (di->zerr) {
-   ASSERT(di->zerr == EINVAL);
+   ASSERT(di->zerr == EPIPE);
(void) snprintf(di->errbuf, sizeof (di->errbuf),
dgettext(TEXT_DOMAIN,
"Internal error: bad data from diff IOCTL"));
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351573 - head/lib/libfetch

2019-08-28 Thread Mark Johnston
Author: markj
Date: Wed Aug 28 17:01:28 2019
New Revision: 351573
URL: https://svnweb.freebsd.org/changeset/base/351573

Log:
  Document fetchReqHTTP().
  
  Submitted by: Farhan Khan 
  Reviewed by:  0mp
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D18788

Modified:
  head/lib/libfetch/Makefile
  head/lib/libfetch/fetch.3
  head/lib/libfetch/http.c

Modified: head/lib/libfetch/Makefile
==
--- head/lib/libfetch/Makefile  Wed Aug 28 16:18:23 2019(r351572)
+++ head/lib/libfetch/Makefile  Wed Aug 28 17:01:28 2019(r351573)
@@ -68,6 +68,7 @@ MLINKS+= fetch.3 fetchPutFTP.3
 MLINKS+= fetch.3 fetchPutFile.3
 MLINKS+= fetch.3 fetchPutHTTP.3
 MLINKS+= fetch.3 fetchPutURL.3
+MLINKS+= fetch.3 fetchReqHTTP.3
 MLINKS+= fetch.3 fetchStat.3
 MLINKS+= fetch.3 fetchStatFTP.3
 MLINKS+= fetch.3 fetchStatFile.3

Modified: head/lib/libfetch/fetch.3
==
--- head/lib/libfetch/fetch.3   Wed Aug 28 16:18:23 2019(r351572)
+++ head/lib/libfetch/fetch.3   Wed Aug 28 17:01:28 2019(r351573)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 18, 2016
+.Dd August 28, 2019
 .Dt FETCH 3
 .Os
 .Sh NAME
@@ -53,6 +53,7 @@
 .Nm fetchPutHTTP ,
 .Nm fetchStatHTTP ,
 .Nm fetchListHTTP ,
+.Nm fetchReqHTTP ,
 .Nm fetchXGetFTP ,
 .Nm fetchGetFTP ,
 .Nm fetchPutFTP ,
@@ -112,6 +113,8 @@
 .Ft struct url_ent *
 .Fn fetchListHTTP "struct url *u" "const char *flags"
 .Ft FILE *
+.Fn fetchReqHTTP "struct url *u" "const char *method" "const char *flags" 
"const char *content_type" "const char *body"
+.Ft FILE *
 .Fn fetchXGetFTP "struct url *u" "struct url_stat *us" "const char *flags"
 .Ft FILE *
 .Fn fetchGetFTP "struct url *u" "const char *flags"
@@ -355,9 +358,10 @@ and password "anonymous@".
 .Sh HTTP SCHEME
 The
 .Fn fetchXGetHTTP ,
-.Fn fetchGetHTTP
-and
+.Fn fetchGetHTTP ,
 .Fn fetchPutHTTP
+and
+.Fn fetchReqHTTP
 functions implement the HTTP/1.1 protocol.
 With a little luck, there is
 even a chance that they comply with RFC2616 and RFC2617.
@@ -386,6 +390,18 @@ will send a conditional
 .Li If-Modified-Since
 HTTP header to only fetch the content if it is newer than
 .Va ims_time .
+.Pp
+The function
+.Fn fetchReqHTTP
+can be used to make requests with an arbitrary HTTP verb,
+including POST, DELETE, CONNECT, OPTIONS, TRACE or PATCH.
+This can be done by setting the argument
+.Fa method
+to the intended verb, such as
+.Ql POST ,
+and
+.Fa body
+to the content.
 .Pp
 Since there seems to be no good way of implementing the HTTP PUT
 method in a manner consistent with the rest of the

Modified: head/lib/libfetch/http.c
==
--- head/lib/libfetch/http.cWed Aug 28 16:18:23 2019(r351572)
+++ head/lib/libfetch/http.cWed Aug 28 17:01:28 2019(r351573)
@@ -2093,6 +2093,9 @@ fetchListHTTP(struct url *url __unused, const char *fl
return (NULL);
 }
 
+/*
+ * Arbitrary HTTP verb and content requests
+ */
 FILE *
 fetchReqHTTP(struct url *URL, const char *method, const char *flags,
const char *content_type, const char *body)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351572 - in head/sys: ddb kern sys

2019-08-28 Thread Mateusz Guzik
Author: mjg
Date: Wed Aug 28 16:18:23 2019
New Revision: 351572
URL: https://svnweb.freebsd.org/changeset/base/351572

Log:
  proc: eliminate the zombproc list
  
  It is not needed by anything in the kernel and it slightly drives up 
contention
  on both proctree and allproc locks.
  
  Reviewed by:  kib
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D21447

Modified:
  head/sys/ddb/db_ps.c
  head/sys/ddb/db_thread.c
  head/sys/kern/kern_exit.c
  head/sys/kern/kern_proc.c
  head/sys/kern/kern_racct.c
  head/sys/sys/proc.h

Modified: head/sys/ddb/db_ps.c
==
--- head/sys/ddb/db_ps.cWed Aug 28 16:16:35 2019(r351571)
+++ head/sys/ddb/db_ps.cWed Aug 28 16:18:23 2019(r351572)
@@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
 
 static voiddumpthread(volatile struct proc *p, volatile struct thread *td,
int all);
+static voiddb_ps_proc(struct proc *p);
 static int ps_mode;
 
 /*
@@ -105,146 +106,157 @@ dump_args(volatile struct proc *p)
 void
 db_ps(db_expr_t addr, bool hasaddr, db_expr_t count, char *modif)
 {
-   volatile struct proc *p, *pp;
-   volatile struct thread *td;
-   struct ucred *cred;
-   struct pgrp *pgrp;
-   char state[9];
-   int np, rflag, sflag, dflag, lflag, wflag;
+   struct proc *p;
+   int i, j;
 
ps_mode = modif[0] == 'a' ? PRINT_ARGS : PRINT_NONE;
-   np = nprocs;
 
-   if (!LIST_EMPTY())
-   p = LIST_FIRST();
-   else
-   p = 
-
 #ifdef __LP64__
db_printf("  pid  ppid  pgrp   uid  state   wmesg   wchan   
cmd\n");
 #else
db_printf("  pid  ppid  pgrp   uid  state   wmesg   wchan   cmd\n");
 #endif
-   while (--np >= 0 && !db_pager_quit) {
-   if (p == NULL) {
-   db_printf("oops, ran out of processes early!\n");
-   break;
+
+   if (!LIST_EMPTY())
+   p = LIST_FIRST();
+   else
+   p = 
+   for (; p != NULL && !db_pager_quit; p = LIST_NEXT(p, p_list))
+   db_ps_proc(p);
+
+   /*
+* Do zombies.
+*/
+   for (i = 0; i < pidhashlock + 1 && !db_pager_quit; i++) {
+   for (j = i; j <= pidhash && !db_pager_quit; j += pidhashlock + 
1) {
+   LIST_FOREACH(p, [j], p_hash) {
+   if (p->p_state == PRS_ZOMBIE)
+   db_ps_proc(p);
+   }
}
-   pp = p->p_pptr;
-   if (pp == NULL)
-   pp = p;
+   }
+}
 
-   cred = p->p_ucred;
-   pgrp = p->p_pgrp;
-   db_printf("%5d %5d %5d %5d ", p->p_pid, pp->p_pid,
-   pgrp != NULL ? pgrp->pg_id : 0,
-   cred != NULL ? cred->cr_ruid : 0);
+static void
+db_ps_proc(struct proc *p)
+{
+   volatile struct proc *pp;
+   volatile struct thread *td;
+   struct ucred *cred;
+   struct pgrp *pgrp;
+   char state[9];
+   int rflag, sflag, dflag, lflag, wflag;
 
-   /* Determine our primary process state. */
-   switch (p->p_state) {
-   case PRS_NORMAL:
-   if (P_SHOULDSTOP(p))
-   state[0] = 'T';
-   else {
-   /*
-* One of D, L, R, S, W.  For a
-* multithreaded process we will use
-* the state of the thread with the
-* highest precedence.  The
-* precendence order from high to low
-* is R, L, D, S, W.  If no thread is
-* in a sane state we use '?' for our
-* primary state.
-*/
-   rflag = sflag = dflag = lflag = wflag = 0;
-   FOREACH_THREAD_IN_PROC(p, td) {
-   if (td->td_state == TDS_RUNNING ||
-   td->td_state == TDS_RUNQ ||
-   td->td_state == TDS_CAN_RUN)
-   rflag++;
-   if (TD_ON_LOCK(td))
-   lflag++;
-   if (TD_IS_SLEEPING(td)) {
-   if (!(td->td_flags & TDF_SINTR))
-   dflag++;
-   else
-   sflag++;
-   }
- 

svn commit: r351571 - stable/12/sys/vm

2019-08-28 Thread Mark Johnston
Author: markj
Date: Wed Aug 28 16:16:35 2019
New Revision: 351571
URL: https://svnweb.freebsd.org/changeset/base/351571

Log:
  MFC r351331:
  Don't requeue active pages in vm_swapout_object_deactivate_pages().

Modified:
  stable/12/sys/vm/vm_swapout.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/vm/vm_swapout.c
==
--- stable/12/sys/vm/vm_swapout.c   Wed Aug 28 16:16:14 2019
(r351570)
+++ stable/12/sys/vm/vm_swapout.c   Wed Aug 28 16:16:35 2019
(r351571)
@@ -227,20 +227,22 @@ vm_swapout_object_deactivate_pages(pmap_t pmap, vm_obj
vm_page_activate(p);
p->act_count += act_delta;
} else if (vm_page_active(p)) {
+   /*
+* The page daemon does not requeue pages
+* after modifying their activation count.
+*/
if (act_delta == 0) {
p->act_count -= min(p->act_count,
ACT_DECLINE);
if (!remove_mode && p->act_count == 0) {
pmap_remove_all(p);
vm_page_deactivate(p);
-   } else
-   vm_page_requeue(p);
+   }
} else {
vm_page_activate(p);
if (p->act_count < ACT_MAX -
ACT_ADVANCE)
p->act_count += ACT_ADVANCE;
-   vm_page_requeue(p);
}
} else if (vm_page_inactive(p))
pmap_remove_all(p);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351570 - stable/12/sys/vm

2019-08-28 Thread Mark Johnston
Author: markj
Date: Wed Aug 28 16:16:14 2019
New Revision: 351570
URL: https://svnweb.freebsd.org/changeset/base/351570

Log:
  MFC r351333:
  Simplify vm_page_dequeue() and fix an assertion.

Modified:
  stable/12/sys/vm/vm_page.c
  stable/12/sys/vm/vm_page.h
  stable/12/sys/vm/vm_pagequeue.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/vm/vm_page.c
==
--- stable/12/sys/vm/vm_page.c  Wed Aug 28 16:08:06 2019(r351569)
+++ stable/12/sys/vm/vm_page.c  Wed Aug 28 16:16:14 2019(r351570)
@@ -3079,21 +3079,15 @@ vm_waitpfault(struct domainset *dset)
mtx_unlock(_domainset_lock);
 }
 
-struct vm_pagequeue *
+static struct vm_pagequeue *
 vm_page_pagequeue(vm_page_t m)
 {
 
-   return (_pagequeue_domain(m)->vmd_pagequeues[m->queue]);
-}
-
-static struct mtx *
-vm_page_pagequeue_lockptr(vm_page_t m)
-{
uint8_t queue;
 
if ((queue = atomic_load_8(>queue)) == PQ_NONE)
return (NULL);
-   return (_pagequeue_domain(m)->vmd_pagequeues[queue].pq_mutex);
+   return (_pagequeue_domain(m)->vmd_pagequeues[queue]);
 }
 
 static inline void
@@ -3116,10 +3110,8 @@ vm_pqbatch_process_page(struct vm_pagequeue *pq, vm_pa
m, pq, qflags));
 
if ((qflags & PGA_DEQUEUE) != 0) {
-   if (__predict_true((qflags & PGA_ENQUEUED) != 0)) {
-   TAILQ_REMOVE(>pq_pl, m, plinks.q);
-   vm_pagequeue_cnt_dec(pq);
-   }
+   if (__predict_true((qflags & PGA_ENQUEUED) != 0))
+   vm_pagequeue_remove(pq, m);
vm_page_dequeue_complete(m);
} else if ((qflags & (PGA_REQUEUE | PGA_REQUEUE_HEAD)) != 0) {
if ((qflags & PGA_ENQUEUED) != 0)
@@ -3293,16 +3285,14 @@ vm_page_dequeue_deferred(vm_page_t m)
 void
 vm_page_dequeue(vm_page_t m)
 {
-   struct mtx *lock, *lock1;
-   struct vm_pagequeue *pq;
+   struct vm_pagequeue *pq, *pq1;
uint8_t aflags;
 
-   KASSERT(mtx_owned(vm_page_lockptr(m)) || m->order == VM_NFREEORDER,
+   KASSERT(mtx_owned(vm_page_lockptr(m)) || m->object == NULL,
("page %p is allocated and unlocked", m));
 
-   for (;;) {
-   lock = vm_page_pagequeue_lockptr(m);
-   if (lock == NULL) {
+   for (pq = vm_page_pagequeue(m);; pq = pq1) {
+   if (pq == NULL) {
/*
 * A thread may be concurrently executing
 * vm_page_dequeue_complete().  Ensure that all queue
@@ -3321,27 +3311,24 @@ vm_page_dequeue(vm_page_t m)
 * critical section.
 */
cpu_spinwait();
+   pq1 = vm_page_pagequeue(m);
continue;
}
-   mtx_lock(lock);
-   if ((lock1 = vm_page_pagequeue_lockptr(m)) == lock)
+   vm_pagequeue_lock(pq);
+   if ((pq1 = vm_page_pagequeue(m)) == pq)
break;
-   mtx_unlock(lock);
-   lock = lock1;
+   vm_pagequeue_unlock(pq);
}
-   KASSERT(lock == vm_page_pagequeue_lockptr(m),
+   KASSERT(pq == vm_page_pagequeue(m),
("%s: page %p migrated directly between queues", __func__, m));
KASSERT((m->aflags & PGA_DEQUEUE) != 0 ||
mtx_owned(vm_page_lockptr(m)),
("%s: queued unlocked page %p", __func__, m));
 
-   if ((m->aflags & PGA_ENQUEUED) != 0) {
-   pq = vm_page_pagequeue(m);
-   TAILQ_REMOVE(>pq_pl, m, plinks.q);
-   vm_pagequeue_cnt_dec(pq);
-   }
+   if ((m->aflags & PGA_ENQUEUED) != 0)
+   vm_pagequeue_remove(pq, m);
vm_page_dequeue_complete(m);
-   mtx_unlock(lock);
+   vm_pagequeue_unlock(pq);
 }
 
 /*

Modified: stable/12/sys/vm/vm_page.h
==
--- stable/12/sys/vm/vm_page.h  Wed Aug 28 16:08:06 2019(r351569)
+++ stable/12/sys/vm/vm_page.h  Wed Aug 28 16:16:14 2019(r351570)
@@ -554,7 +554,6 @@ void vm_page_launder(vm_page_t m);
 vm_page_t vm_page_lookup (vm_object_t, vm_pindex_t);
 vm_page_t vm_page_next(vm_page_t m);
 int vm_page_pa_tryrelock(pmap_t, vm_paddr_t, vm_paddr_t *);
-struct vm_pagequeue *vm_page_pagequeue(vm_page_t m);
 vm_page_t vm_page_prev(vm_page_t m);
 bool vm_page_ps_test(vm_page_t m, int flags, vm_page_t skip_m);
 void vm_page_putfake(vm_page_t m);

Modified: stable/12/sys/vm/vm_pagequeue.h
==
--- stable/12/sys/vm/vm_pagequeue.h Wed Aug 28 16:08:06 2019
(r351569)
+++ stable/12/sys/vm/vm_pagequeue.h Wed Aug 28 16:16:14 2019
(r351570)
@@ -199,6 +199,14 @@ vm_pagequeue_cnt_add(struct vm_pagequeue *pq, 

svn commit: r351569 - in head/sys: kern vm

2019-08-28 Thread Mark Johnston
Author: markj
Date: Wed Aug 28 16:08:06 2019
New Revision: 351569
URL: https://svnweb.freebsd.org/changeset/base/351569

Log:
  Wire pages in vm_page_grab() when appropriate.
  
  uiomove_object_page() and exec_map_first_page() would previously wire a
  page after having grabbed it.  Ask vm_page_grab() to perform the wiring
  instead: this removes some redundant code, and is cheaper in the case
  where the requested page is not resident since the page allocator can be
  asked to initialize the page as wired, whereas a separate vm_page_wire()
  call requires the page lock.
  
  In vm_imgact_hold_page(), use vm_page_unwire_noq() instead of
  vm_page_unwire(PQ_NONE).  The latter ensures that the page is dequeued
  before returning, but this is unnecessary since vm_page_free() will
  trigger a batched dequeue of the page.
  
  Reviewed by:  alc, kib
  Tested by:pho (part of a larger patch)
  MFC after:1 week
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D21440

Modified:
  head/sys/kern/kern_exec.c
  head/sys/kern/uipc_shm.c
  head/sys/vm/vm_glue.c

Modified: head/sys/kern/kern_exec.c
==
--- head/sys/kern/kern_exec.c   Wed Aug 28 08:09:10 2019(r351568)
+++ head/sys/kern/kern_exec.c   Wed Aug 28 16:08:06 2019(r351569)
@@ -972,11 +972,13 @@ exec_map_first_page(struct image_params *imgp)
 #if VM_NRESERVLEVEL > 0
vm_object_color(object, 0);
 #endif
-   ma[0] = vm_page_grab(object, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY);
+   ma[0] = vm_page_grab(object, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY |
+   VM_ALLOC_WIRED);
if (ma[0]->valid != VM_PAGE_BITS_ALL) {
vm_page_xbusy(ma[0]);
if (!vm_pager_has_page(object, 0, NULL, )) {
vm_page_lock(ma[0]);
+   vm_page_unwire_noq(ma[0]);
vm_page_free(ma[0]);
vm_page_unlock(ma[0]);
VM_OBJECT_WUNLOCK(object);
@@ -1004,6 +1006,8 @@ exec_map_first_page(struct image_params *imgp)
if (rv != VM_PAGER_OK) {
for (i = 0; i < initial_pagein; i++) {
vm_page_lock(ma[i]);
+   if (i == 0)
+   vm_page_unwire_noq(ma[i]);
vm_page_free(ma[i]);
vm_page_unlock(ma[i]);
}
@@ -1014,9 +1018,6 @@ exec_map_first_page(struct image_params *imgp)
for (i = 1; i < initial_pagein; i++)
vm_page_readahead_finish(ma[i]);
}
-   vm_page_lock(ma[0]);
-   vm_page_wire(ma[0]);
-   vm_page_unlock(ma[0]);
VM_OBJECT_WUNLOCK(object);
 
imgp->firstpage = sf_buf_alloc(ma[0], 0);

Modified: head/sys/kern/uipc_shm.c
==
--- head/sys/kern/uipc_shm.cWed Aug 28 08:09:10 2019(r351568)
+++ head/sys/kern/uipc_shm.cWed Aug 28 16:08:06 2019(r351569)
@@ -188,7 +188,8 @@ uiomove_object_page(vm_object_t obj, size_t len, struc
 * lock to page out tobj's pages because tobj is a OBJT_SWAP
 * type object.
 */
-   m = vm_page_grab(obj, idx, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY);
+   m = vm_page_grab(obj, idx, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY |
+   VM_ALLOC_WIRED);
if (m->valid != VM_PAGE_BITS_ALL) {
vm_page_xbusy(m);
if (vm_pager_has_page(obj, idx, NULL, NULL)) {
@@ -198,6 +199,7 @@ uiomove_object_page(vm_object_t obj, size_t len, struc
"uiomove_object: vm_obj %p idx %jd valid %x pager error %d\n",
obj, idx, m->valid, rv);
vm_page_lock(m);
+   vm_page_unwire_noq(m);
vm_page_free(m);
vm_page_unlock(m);
VM_OBJECT_WUNLOCK(obj);
@@ -207,9 +209,6 @@ uiomove_object_page(vm_object_t obj, size_t len, struc
vm_page_zero_invalid(m, TRUE);
vm_page_xunbusy(m);
}
-   vm_page_lock(m);
-   vm_page_wire(m);
-   vm_page_unlock(m);
VM_OBJECT_WUNLOCK(obj);
error = uiomove_fromphys(, offset, tlen, uio);
if (uio->uio_rw == UIO_WRITE && error == 0) {

Modified: head/sys/vm/vm_glue.c
==
--- head/sys/vm/vm_glue.c   Wed Aug 28 08:09:10 2019(r351568)
+++ head/sys/vm/vm_glue.c   Wed Aug 28 16:08:06 2019(r351569)
@@ -230,7 +230,7 @@ vm_imgact_hold_page(vm_object_t object, vm_ooffset_t o
rv = vm_pager_get_pages(object, , 1, NULL, NULL);
if (rv != VM_PAGER_OK) {

svn commit: r351568 - stable/12/sys/kern

2019-08-28 Thread Brooks Davis
Author: brooks
Date: Wed Aug 28 08:09:10 2019
New Revision: 351568
URL: https://svnweb.freebsd.org/changeset/base/351568

Log:
  MFC r351389:
  
  Reorganise conditionals to reduce duplication.
  
  No functional change.
  
  Obtained from:CheriBSD
  Sponsored by: DARPA, AFRL

Modified:
  stable/12/sys/kern/makesyscalls.sh
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/makesyscalls.sh
==
--- stable/12/sys/kern/makesyscalls.sh  Wed Aug 28 08:05:16 2019
(r351567)
+++ stable/12/sys/kern/makesyscalls.sh  Wed Aug 28 08:09:10 2019
(r351568)
@@ -503,20 +503,20 @@ sed -e '
}
printf("\t\t*n_args = %d;\n\t\tbreak;\n\t}\n", argc) > systrace
printf("\t\tbreak;\n") > systracetmp
-   if (argc != 0 && !flag("NOARGS") && !flag("NOPROTO") && \
-   !flag("NODEF")) {
-   printf("struct %s {\n", argalias) > sysarg
-   for (i = 1; i <= argc; i++)
-   printf("\tchar %s_l_[PADL_(%s)]; " \
-   "%s %s; char %s_r_[PADR_(%s)];\n",
-   argname[i], argtype[i],
-   argtype[i], argname[i],
-   argname[i], argtype[i]) > sysarg
-   printf("};\n") > sysarg
+   if (!flag("NOARGS") && !flag("NOPROTO") && !flag("NODEF")) {
+   if (argc != 0) {
+   printf("struct %s {\n", argalias) > sysarg
+   for (i = 1; i <= argc; i++)
+   printf("\tchar %s_l_[PADL_(%s)]; " \
+   "%s %s; char %s_r_[PADR_(%s)];\n",
+   argname[i], argtype[i],
+   argtype[i], argname[i],
+   argname[i], argtype[i]) > sysarg
+   printf("};\n") > sysarg
+   } else
+   printf("struct %s {\n\tregister_t dummy;\n};\n",
+   argalias) > sysarg
}
-   else if (!flag("NOARGS") && !flag("NOPROTO") && !flag("NODEF"))
-   printf("struct %s {\n\tregister_t dummy;\n};\n",
-   argalias) > sysarg
if (!flag("NOPROTO") && !flag("NODEF")) {
if (funcname == "nosys" || funcname == "lkmnosys" ||
funcname == "sysarch" || funcname ~ /^freebsd/ || 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351567 - in stable/12/sys: amd64/linux amd64/linux32 arm64/linux compat/cloudabi32 compat/cloudabi64 compat/freebsd32 i386/linux kern

2019-08-28 Thread Brooks Davis
Author: brooks
Date: Wed Aug 28 08:05:16 2019
New Revision: 351567
URL: https://svnweb.freebsd.org/changeset/base/351567

Log:
  MFC r348446:
  
  makesyscalls.sh: always use absolute path for syscalls.conf
  
  syscalls.conf is included using "." which per the Open Group:
  
   If file does not contain a , the shell shall use the search
   path specified by PATH to find the directory containing file.
  
  POSIX shells don't fall back to the current working directory.
  
  Submitted by: Nathaniel Wesley Filardo 
  Reviewed by:  bdrewery
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D20476

Modified:
  stable/12/sys/amd64/linux/Makefile
  stable/12/sys/amd64/linux32/Makefile
  stable/12/sys/arm64/linux/Makefile
  stable/12/sys/compat/cloudabi32/Makefile
  stable/12/sys/compat/cloudabi64/Makefile
  stable/12/sys/compat/freebsd32/Makefile
  stable/12/sys/i386/linux/Makefile
  stable/12/sys/kern/makesyscalls.sh
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/amd64/linux/Makefile
==
--- stable/12/sys/amd64/linux/Makefile  Wed Aug 28 07:53:10 2019
(r351566)
+++ stable/12/sys/amd64/linux/Makefile  Wed Aug 28 08:05:16 2019
(r351567)
@@ -11,5 +11,5 @@ all:
 sysent:  linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c 
linux_systrace_args.c
 
 linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c 
linux_systrace_args.c: \
-   ../../kern/makesyscalls.sh syscalls.master syscalls.conf
-   sh ../../kern/makesyscalls.sh syscalls.master syscalls.conf
+   ../../kern/makesyscalls.sh syscalls.master 
${.CURDIR}/syscalls.conf
+   sh ../../kern/makesyscalls.sh syscalls.master ${.CURDIR}/syscalls.conf

Modified: stable/12/sys/amd64/linux32/Makefile
==
--- stable/12/sys/amd64/linux32/MakefileWed Aug 28 07:53:10 2019
(r351566)
+++ stable/12/sys/amd64/linux32/MakefileWed Aug 28 08:05:16 2019
(r351567)
@@ -11,5 +11,5 @@ all:
 sysent:  linux32_sysent.c linux32_syscall.h linux32_proto.h linux32_syscalls.c 
linux32_systrace_args.c
 
 linux32_sysent.c linux32_syscall.h linux32_proto.h linux32_syscalls.c 
linux32_systrace_args.c: ../../kern/makesyscalls.sh \
-   syscalls.master syscalls.conf
-   sh ../../kern/makesyscalls.sh syscalls.master syscalls.conf
+   syscalls.master ${.CURDIR}/syscalls.conf
+   sh ../../kern/makesyscalls.sh syscalls.master ${.CURDIR}/syscalls.conf

Modified: stable/12/sys/arm64/linux/Makefile
==
--- stable/12/sys/arm64/linux/Makefile  Wed Aug 28 07:53:10 2019
(r351566)
+++ stable/12/sys/arm64/linux/Makefile  Wed Aug 28 08:05:16 2019
(r351567)
@@ -11,5 +11,5 @@ all:
 sysent:  linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c 
linux_systrace_args.c
 
 linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c 
linux_systrace_args.c: \
-   ../../kern/makesyscalls.sh syscalls.master syscalls.conf
-   sh ../../kern/makesyscalls.sh syscalls.master syscalls.conf
+   ../../kern/makesyscalls.sh syscalls.master 
${.CURDIR}/syscalls.conf
+   sh ../../kern/makesyscalls.sh syscalls.master ${.CURDIR}/syscalls.conf

Modified: stable/12/sys/compat/cloudabi32/Makefile
==
--- stable/12/sys/compat/cloudabi32/MakefileWed Aug 28 07:53:10 2019
(r351566)
+++ stable/12/sys/compat/cloudabi32/MakefileWed Aug 28 08:05:16 2019
(r351567)
@@ -12,6 +12,6 @@ sysent: cloudabi32_sysent.c cloudabi32_syscall.h cloud
 cloudabi32_sysent.c cloudabi32_syscall.h cloudabi32_proto.h \
 cloudabi32_syscalls.c cloudabi32_systrace_args.c: \
 ../../kern/makesyscalls.sh ../../contrib/cloudabi/syscalls32.master \
-syscalls.conf
+${.CURDIR}/syscalls.conf
sh ../../kern/makesyscalls.sh ../../contrib/cloudabi/syscalls32.master \
-   syscalls.conf
+   ${.CURDIR}/syscalls.conf

Modified: stable/12/sys/compat/cloudabi64/Makefile
==
--- stable/12/sys/compat/cloudabi64/MakefileWed Aug 28 07:53:10 2019
(r351566)
+++ stable/12/sys/compat/cloudabi64/MakefileWed Aug 28 08:05:16 2019
(r351567)
@@ -12,6 +12,6 @@ sysent: cloudabi64_sysent.c cloudabi64_syscall.h cloud
 cloudabi64_sysent.c cloudabi64_syscall.h cloudabi64_proto.h \
 cloudabi64_syscalls.c cloudabi64_systrace_args.c: \
 ../../kern/makesyscalls.sh ../../contrib/cloudabi/syscalls64.master \
-syscalls.conf
+${.CURDIR}/syscalls.conf
sh ../../kern/makesyscalls.sh ../../contrib/cloudabi/syscalls64.master \
-   syscalls.conf
+   ${.CURDIR}/syscalls.conf


svn commit: r351566 - in stable/12/sys: compat/freebsd32 kern

2019-08-28 Thread Brooks Davis
Author: brooks
Date: Wed Aug 28 07:53:10 2019
New Revision: 351566
URL: https://svnweb.freebsd.org/changeset/base/351566

Log:
  MFC r340424:
  
  Use the main capabilities.conf for freebsd32.
  
  Allow the location of capabilities.conf to be configured.
  
  Also allow a per-abi syscall prefix to be configured with the
  abi_func_prefix syscalls.conf variable and check syscalls against
  entries in capabilities.conf with and without the prefix amended.
  
  Take advantage of these two features to allow use shared
  capabilities.conf
  between the default syscall vector and the freebsd32 compatability
  layer.  We've been inconsistent about keeping the two in sync as
  evidenced by the bugs fixed in r340294.  This eliminates that problem
  going forward.
  
  Reviewed by:  kib
  Obtained from:CheriBSD
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D17932

Deleted:
  stable/12/sys/compat/freebsd32/capabilities.conf
Modified:
  stable/12/sys/compat/freebsd32/Makefile
  stable/12/sys/compat/freebsd32/syscalls.conf
  stable/12/sys/kern/makesyscalls.sh
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/compat/freebsd32/Makefile
==
--- stable/12/sys/compat/freebsd32/Makefile Wed Aug 28 07:43:31 2019
(r351565)
+++ stable/12/sys/compat/freebsd32/Makefile Wed Aug 28 07:53:10 2019
(r351566)
@@ -11,7 +11,7 @@ all:
 sysent:  freebsd32_sysent.c freebsd32_syscall.h freebsd32_proto.h 
freebsd32_systrace_args.c
 
 freebsd32_sysent.c freebsd32_syscalls.c freebsd32_syscall.h freebsd32_proto.h 
freebsd32_systrace_args.c : \
-   ../../kern/makesyscalls.sh syscalls.master syscalls.conf 
capabilities.conf
+   ../../kern/makesyscalls.sh syscalls.master syscalls.conf 
../../kern/capabilities.conf
sh ../../kern/makesyscalls.sh syscalls.master syscalls.conf
 
 clean:

Modified: stable/12/sys/compat/freebsd32/syscalls.conf
==
--- stable/12/sys/compat/freebsd32/syscalls.confWed Aug 28 07:43:31 
2019(r351565)
+++ stable/12/sys/compat/freebsd32/syscalls.confWed Aug 28 07:53:10 
2019(r351566)
@@ -9,3 +9,5 @@ syscallprefix="FREEBSD32_SYS_"
 switchname="freebsd32_sysent"
 namesname="freebsd32_syscallnames"
 systrace="freebsd32_systrace_args.c"
+abi_func_prefix="freebsd32_"
+capabilities_conf="../../kern/capabilities.conf"

Modified: stable/12/sys/kern/makesyscalls.sh
==
--- stable/12/sys/kern/makesyscalls.sh  Wed Aug 28 07:43:31 2019
(r351565)
+++ stable/12/sys/kern/makesyscalls.sh  Wed Aug 28 07:53:10 2019
(r351566)
@@ -45,14 +45,8 @@ sysarg="sysarg.switch.$$"
 sysprotoend="sysprotoend.$$"
 systracetmp="systrace.$$"
 systraceret="systraceret.$$"
+capabilities_conf="capabilities.conf"
 
-if [ -r capabilities.conf ]; then
-   capenabled=`egrep -v '^#|^$' capabilities.conf`
-   capenabled=`echo $capenabled | sed 's/ /,/g'`
-else
-   capenabled=""
-fi
-
 trap "rm $sysaue $sysdcl $syscompat $syscompatdcl $syscompat4 $syscompat4dcl 
$syscompat6 $syscompat6dcl $syscompat7 $syscompat7dcl $syscompat10 
$syscompat10dcl $syscompat11 $syscompat11dcl $sysent $sysinc $sysarg 
$sysprotoend $systracetmp $systraceret" 0
 
 touch $sysaue $sysdcl $syscompat $syscompatdcl $syscompat4 $syscompat4dcl 
$syscompat6 $syscompat6dcl $syscompat7 $syscompat7dcl $syscompat10 
$syscompat10dcl $syscompat11 $syscompat11dcl $sysent $sysinc $sysarg 
$sysprotoend $systracetmp $systraceret
@@ -67,6 +61,13 @@ if [ -n "$2" ]; then
. $2
 fi
 
+if [ -r $capabilities_conf ]; then
+   capenabled=`egrep -v '^#|^$' $capabilities_conf`
+   capenabled=`echo $capenabled | sed 's/ /,/g'`
+else
+   capenabled=""
+fi
+
 sed -e '
# FreeBSD ID, includes, comments, and blank lines
/.*\$FreeBSD/b done_joining
@@ -137,6 +138,7 @@ sed -e '
switchname = \"$switchname\"
namesname = \"$namesname\"
infile = \"$1\"
+   abi_func_prefix = \"$abi_func_prefix\"
capenabled_string = \"$capenabled\"
"'
 
@@ -375,7 +377,8 @@ sed -e '
# from it.
#
for (cap in capenabled) {
-   if (funcname == capenabled[cap]) {
+   if (funcname == capenabled[cap] ||
+   funcname == abi_func_prefix capenabled[cap]) {
flags = "SYF_CAPENABLED";
break;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351565 - in stable/12/sys: amd64/linux amd64/linux32 arm64/linux compat/freebsd32 i386/ibcs2 i386/linux kern sys

2019-08-28 Thread Brooks Davis
Author: brooks
Date: Wed Aug 28 07:43:31 2019
New Revision: 351565
URL: https://svnweb.freebsd.org/changeset/base/351565

Log:
  Regenerate to add @generated tag in generated files.
  
  This is a manual merge of r347230.

Modified:
  stable/12/sys/amd64/linux/linux_proto.h
  stable/12/sys/amd64/linux/linux_syscall.h
  stable/12/sys/amd64/linux/linux_syscalls.c
  stable/12/sys/amd64/linux/linux_sysent.c
  stable/12/sys/amd64/linux/linux_systrace_args.c
  stable/12/sys/amd64/linux32/linux32_proto.h
  stable/12/sys/amd64/linux32/linux32_syscall.h
  stable/12/sys/amd64/linux32/linux32_syscalls.c
  stable/12/sys/amd64/linux32/linux32_sysent.c
  stable/12/sys/amd64/linux32/linux32_systrace_args.c
  stable/12/sys/arm64/linux/linux_proto.h
  stable/12/sys/arm64/linux/linux_syscall.h
  stable/12/sys/arm64/linux/linux_syscalls.c
  stable/12/sys/arm64/linux/linux_sysent.c
  stable/12/sys/arm64/linux/linux_systrace_args.c
  stable/12/sys/compat/freebsd32/freebsd32_proto.h
  stable/12/sys/compat/freebsd32/freebsd32_syscall.h
  stable/12/sys/compat/freebsd32/freebsd32_syscalls.c
  stable/12/sys/compat/freebsd32/freebsd32_sysent.c
  stable/12/sys/compat/freebsd32/freebsd32_systrace_args.c
  stable/12/sys/i386/ibcs2/ibcs2_proto.h
  stable/12/sys/i386/ibcs2/ibcs2_syscall.h
  stable/12/sys/i386/ibcs2/ibcs2_sysent.c
  stable/12/sys/i386/linux/linux_proto.h
  stable/12/sys/i386/linux/linux_syscall.h
  stable/12/sys/i386/linux/linux_syscalls.c
  stable/12/sys/i386/linux/linux_sysent.c
  stable/12/sys/i386/linux/linux_systrace_args.c
  stable/12/sys/kern/init_sysent.c
  stable/12/sys/kern/syscalls.c
  stable/12/sys/kern/systrace_args.c
  stable/12/sys/sys/syscall.h
  stable/12/sys/sys/syscall.mk
  stable/12/sys/sys/sysproto.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/amd64/linux/linux_proto.h
==
--- stable/12/sys/amd64/linux/linux_proto.h Wed Aug 28 07:37:34 2019
(r351564)
+++ stable/12/sys/amd64/linux/linux_proto.h Wed Aug 28 07:43:31 2019
(r351565)
@@ -1,7 +1,7 @@
 /*
  * System call prototypes.
  *
- * DO NOT EDIT-- this file is automatically generated.
+ * DO NOT EDIT-- this file is automatically @generated.
  * $FreeBSD$
  */
 

Modified: stable/12/sys/amd64/linux/linux_syscall.h
==
--- stable/12/sys/amd64/linux/linux_syscall.h   Wed Aug 28 07:37:34 2019
(r351564)
+++ stable/12/sys/amd64/linux/linux_syscall.h   Wed Aug 28 07:43:31 2019
(r351565)
@@ -1,7 +1,7 @@
 /*
  * System call numbers.
  *
- * DO NOT EDIT-- this file is automatically generated.
+ * DO NOT EDIT-- this file is automatically @generated.
  * $FreeBSD$
  */
 

Modified: stable/12/sys/amd64/linux/linux_syscalls.c
==
--- stable/12/sys/amd64/linux/linux_syscalls.c  Wed Aug 28 07:37:34 2019
(r351564)
+++ stable/12/sys/amd64/linux/linux_syscalls.c  Wed Aug 28 07:43:31 2019
(r351565)
@@ -1,7 +1,7 @@
 /*
  * System call names.
  *
- * DO NOT EDIT-- this file is automatically generated.
+ * DO NOT EDIT-- this file is automatically @generated.
  * $FreeBSD$
  */
 

Modified: stable/12/sys/amd64/linux/linux_sysent.c
==
--- stable/12/sys/amd64/linux/linux_sysent.cWed Aug 28 07:37:34 2019
(r351564)
+++ stable/12/sys/amd64/linux/linux_sysent.cWed Aug 28 07:43:31 2019
(r351565)
@@ -1,7 +1,7 @@
 /*
  * System call switch table.
  *
- * DO NOT EDIT-- this file is automatically generated.
+ * DO NOT EDIT-- this file is automatically @generated.
  * $FreeBSD$
  */
 

Modified: stable/12/sys/amd64/linux/linux_systrace_args.c
==
--- stable/12/sys/amd64/linux/linux_systrace_args.c Wed Aug 28 07:37:34 
2019(r351564)
+++ stable/12/sys/amd64/linux/linux_systrace_args.c Wed Aug 28 07:43:31 
2019(r351565)
@@ -1,7 +1,7 @@
 /*
  * System call argument to DTrace register array converstion.
  *
- * DO NOT EDIT-- this file is automatically generated.
+ * DO NOT EDIT-- this file is automatically @generated.
  * $FreeBSD$
  * This file is part of the DTrace syscall provider.
  */

Modified: stable/12/sys/amd64/linux32/linux32_proto.h
==
--- stable/12/sys/amd64/linux32/linux32_proto.h Wed Aug 28 07:37:34 2019
(r351564)
+++ stable/12/sys/amd64/linux32/linux32_proto.h Wed Aug 28 07:43:31 2019
(r351565)
@@ -1,7 +1,7 @@
 /*
  * System call prototypes.
  *
- * DO NOT EDIT-- this file is automatically generated.
+ * DO NOT EDIT-- this file is automatically @generated.
  * $FreeBSD$
  */
 

Modified: stable/12/sys/amd64/linux32/linux32_syscall.h

svn commit: r351564 - stable/12/sys/kern

2019-08-28 Thread Brooks Davis
Author: brooks
Date: Wed Aug 28 07:37:34 2019
New Revision: 351564
URL: https://svnweb.freebsd.org/changeset/base/351564

Log:
  MFC r339624:
  
  Remove the need for backslashes in syscalls.master.
  
  Join non-special lines together until we hit a line containing a '}'
  character. This allows the function declaration body to be split
  across multiple lines without backslash continuation characters.
  
  Continue to join lines ending with backslashes to allow gradual
  migration and to support out-of-tree syscall vectors
  
  Reviewed by:  emaste, kib
  Obtained from:CheriBSD
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D17488

Modified:
  stable/12/sys/kern/makesyscalls.sh
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/makesyscalls.sh
==
--- stable/12/sys/kern/makesyscalls.sh  Wed Aug 28 04:55:17 2019
(r351563)
+++ stable/12/sys/kern/makesyscalls.sh  Wed Aug 28 07:37:34 2019
(r351564)
@@ -68,13 +68,33 @@ if [ -n "$2" ]; then
 fi
 
 sed -e '
-:join
+   # FreeBSD ID, includes, comments, and blank lines
+   /.*\$FreeBSD/b done_joining
+   /^[#;]/b done_joining
+   /^$/b done_joining
+
+   # Join lines ending in backslash
+:joining
/\\$/{a\
 
N
s/\\\n//
-   b join
+   b joining
}
+
+   # OBSOL, etc lines without function signatures
+   /^[0-9][^{]*$/b done_joining
+
+   # Join incomplete signatures.  The { must appear on the first line
+   # and the } must appear on the last line (modulo lines joined by
+   # backslashes).
+   /^[^}]*$/{a\
+
+   N
+   s/\n//
+   b joining
+   }
+:done_joining
 2,${
/^#/!s/\([{}()*,]\)/ \1 /g
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"