svn commit: r350815 - head/sys/kern

2019-08-08 Thread Jonathan T. Looney
Author: jtl
Date: Fri Aug  9 05:18:59 2019
New Revision: 350815
URL: https://svnweb.freebsd.org/changeset/base/350815

Log:
  In m_pulldown(), before trying to prepend bytes to the subsequent mbuf,
  ensure that the subsequent mbuf contains the remainder of the bytes
  the caller sought. If this is not the case, fall through to the code
  which gathers the bytes in a new mbuf.
  
  This fixes a bug where m_pulldown() could fail to gather all the desired
  bytes into consecutive memory.
  
  PR:   238787
  Reported by:  A reddit user
  Discussed with:   emaste
  Obtained from:NetBSD
  MFC after:3 days

Modified:
  head/sys/kern/uipc_mbuf2.c

Modified: head/sys/kern/uipc_mbuf2.c
==
--- head/sys/kern/uipc_mbuf2.c  Fri Aug  9 02:20:26 2019(r350814)
+++ head/sys/kern/uipc_mbuf2.c  Fri Aug  9 05:18:59 2019(r350815)
@@ -216,7 +216,7 @@ m_pulldown(struct mbuf *m, int off, int len, int *offp
goto ok;
}
if ((off == 0 || offp) && M_LEADINGSPACE(n->m_next) >= hlen
-&& writable) {
+&& writable && n->m_next->m_len >= tlen) {
n->m_next->m_data -= hlen;
n->m_next->m_len += hlen;
bcopy(mtod(n, caddr_t) + off, mtod(n->m_next, caddr_t), hlen);
___
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: r350550 - head/share/mk

2019-08-08 Thread Jamie Landeg-Jones
Glen Barber  wrote:

> after stable/12 branched, I have seen no public complaints about
> enabling REPRODUCIBLE_BUILD by default (and quite honestly, do not see
> the benefit of disabling it by default -- why wouldn't we want
> reproducibility?).

I track stable. I had no need to complain because I could edit
src.conf and add WITHOUT_REPRODUCIBLE_BUILD=YES

Please don't remove this ability thinking no-one minds reproducible builds..
I personally think they are pointless.

Cheers, Jamie
___
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: r350814 - head/usr.sbin/autofs

2019-08-08 Thread Justin Hibbits
Author: jhibbits
Date: Fri Aug  9 02:20:26 2019
New Revision: 350814
URL: https://svnweb.freebsd.org/changeset/base/350814

Log:
  autofs: Fix autounmountd's printing of mount time.
  
  time_t should be printed as intmax_t.  Even though duration should be short, 
the
  correct way to print is intmax_t, not long.
  
  Reported by:  ian,imp

Modified:
  head/usr.sbin/autofs/autounmountd.c

Modified: head/usr.sbin/autofs/autounmountd.c
==
--- head/usr.sbin/autofs/autounmountd.c Fri Aug  9 02:11:47 2019
(r350813)
+++ head/usr.sbin/autofs/autounmountd.c Fri Aug  9 02:20:26 2019
(r350814)
@@ -196,9 +196,9 @@ expire_automounted(time_t expiration_time)
 
if (mounted_for < expiration_time) {
log_debugx("skipping %s (FSID:%d:%d), mounted "
-   "for %ld  seconds", af->af_mountpoint,
+   "for %jd  seconds", af->af_mountpoint,
af->af_fsid.val[0], af->af_fsid.val[1],
-   (long)mounted_for);
+   (intmax_t)mounted_for);
 
if (mounted_for > mounted_max)
mounted_max = mounted_for;
___
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: r350813 - head/tools/tools/crypto

2019-08-08 Thread Conrad Meyer
Author: cem
Date: Fri Aug  9 02:11:47 2019
New Revision: 350813
URL: https://svnweb.freebsd.org/changeset/base/350813

Log:
  tools/tools/crypto: cryptokeytest: Fix build with newer OpenSSL
  
  Also, drag into this decade.

Modified:
  head/tools/tools/crypto/cryptokeytest.c

Modified: head/tools/tools/crypto/cryptokeytest.c
==
--- head/tools/tools/crypto/cryptokeytest.c Fri Aug  9 00:50:02 2019
(r350812)
+++ head/tools/tools/crypto/cryptokeytest.c Fri Aug  9 02:11:47 2019
(r350813)
@@ -7,19 +7,21 @@
  * --Jason L. Wright
  */
 #include 
+#include 
 #include 
-#include 
 #include 
 #include 
-#include 
 
-#include 
-#include 
 #include 
+#include 
+#include 
+#include 
 #include 
 #include 
-#include 
 
+#include 
+#include 
+
 intcrid = CRYPTO_FLAG_HARDWARE;
 intverbose = 0;
 
@@ -63,80 +65,64 @@ crfind(int crid)
 }
 
 /*
- * Convert a little endian byte string in 'p' that
- * is 'plen' bytes long to a BIGNUM. If 'dst' is NULL,
- * a new BIGNUM is allocated.  Returns NULL on failure.
- *
- * XXX there has got to be a more efficient way to do
- * this, but I haven't figured out enough of the OpenSSL
- * magic.
+ * Convert a little endian byte string in 'p' that is 'plen' bytes long to a
+ * BIGNUM.  A new BIGNUM is allocated.  Returns NULL on failure.
  */
-BIGNUM *
-le_to_bignum(BIGNUM *dst, u_int8_t *p, int plen)
+static BIGNUM *
+le_to_bignum(BIGNUM *res, const void *p, int plen)
 {
-   u_int8_t *pd;
-   int i;
 
-   if (plen == 0)
-   return (NULL);
+   res = BN_lebin2bn(p, plen, res);
+   if (res == NULL)
+   ERR_print_errors_fp(stderr);
 
-   if ((pd = (u_int8_t *)malloc(plen)) == NULL)
-   return (NULL);
-
-   for (i = 0; i < plen; i++)
-   pd[i] = p[plen - i - 1];
-
-   dst = BN_bin2bn(pd, plen, dst);
-   free(pd);
-   return (dst);
+   return (res);
 }
 
 /*
- * Convert a BIGNUM to a little endian byte string.
- * If 'rd' is NULL, allocate space for it, otherwise
- * 'rd' is assumed to have room for BN_num_bytes(n)
- * bytes.  Returns NULL on failure.
+ * Convert a BIGNUM to a little endian byte string.  Space for BN_num_bytes(n)
+ * is allocated.
+ * Returns NULL on failure.
  */
-u_int8_t *
-bignum_to_le(BIGNUM *n, u_int8_t *rd)
+static void *
+bignum_to_le(const BIGNUM *n)
 {
-   int i, j, k;
-   int blen = BN_num_bytes(n);
+   int blen, error;
+   void *rd;
 
+   blen = BN_num_bytes(n);
if (blen == 0)
return (NULL);
+
+   rd = malloc(blen);
if (rd == NULL)
-   rd = (u_int8_t *)malloc(blen);
-   if (rd == NULL)
return (NULL);
 
-   for (i = 0, j = 0; i < n->top; i++) {
-   for (k = 0; k < BN_BITS2 / 8; k++) {
-   if ((j + k) >= blen)
-   goto out;
-   rd[j + k] = n->d[i] >> (k * 8);
-   }
-   j += BN_BITS2 / 8;
+   error = BN_bn2lebinpad(n, rd, blen);
+   if (error < 0) {
+   ERR_print_errors_fp(stderr);
+   free(rd);
+   return (NULL);
}
-out:
+
return (rd);
 }
 
-int
-UB_mod_exp(BIGNUM *res, BIGNUM *a, BIGNUM *b, BIGNUM *c, BN_CTX *ctx)
+static int
+UB_mod_exp(BIGNUM *res, const BIGNUM *a, const BIGNUM *b, const BIGNUM *c)
 {
struct crypt_kop kop;
-   u_int8_t *ale, *ble, *cle;
+   void *ale, *ble, *cle;
static int crypto_fd = -1;
 
if (crypto_fd == -1 && ioctl(devcrypto(), CRIOGET, _fd) == -1)
err(1, "CRIOGET");
 
-   if ((ale = bignum_to_le(a, NULL)) == NULL)
+   if ((ale = bignum_to_le(a)) == NULL)
err(1, "bignum_to_le, a");
-   if ((ble = bignum_to_le(b, NULL)) == NULL)
+   if ((ble = bignum_to_le(b)) == NULL)
err(1, "bignum_to_le, b");
-   if ((cle = bignum_to_le(c, NULL)) == NULL)
+   if ((cle = bignum_to_le(c)) == NULL)
err(1, "bignum_to_le, c");
 
bzero(, sizeof(kop));
@@ -158,19 +144,19 @@ UB_mod_exp(BIGNUM *res, BIGNUM *a, BIGNUM *b, BIGNUM *
if (verbose)
printf("device = %s\n", crfind(kop.crk_crid));
 
-   bzero(ale, BN_num_bytes(a));
+   explicit_bzero(ale, BN_num_bytes(a));
free(ale);
-   bzero(ble, BN_num_bytes(b));
+   explicit_bzero(ble, BN_num_bytes(b));
free(ble);
 
if (kop.crk_status != 0) {
printf("error %d\n", kop.crk_status);
-   bzero(cle, BN_num_bytes(c));
+   explicit_bzero(cle, BN_num_bytes(c));
free(cle);
return (-1);
} else {
res = le_to_bignum(res, cle, BN_num_bytes(c));
-   bzero(cle, BN_num_bytes(c));
+   explicit_bzero(cle, BN_num_bytes(c));
free(cle);
if (res == NULL)
  

Re: svn commit: r350764 - head/sys/arm64/arm64

2019-08-08 Thread Warner Losh
On Thu, Aug 8, 2019, 4:59 PM Gleb Smirnoff  wrote:

>   Hi,
>
> why do we need COMPAT_43 for arm64 at all? I can't imagine an
> application that would require this compatibility.
>
> A more general question is how far in the future are we going
> to carry COMPAT_43 for i386/amd64?
>

COMPAT_43 is a weird option. It's a combo of both sys calls and kernel
behavior modifications. Before we thinned the ABIs we supported, it was
necessary for them as well. The biggest behavior change is around signals.
It is weird to sort out and nobody has done the deep analysis to see what
is truly unused and what is there for compat with Linux and other SysV
systems...

Warner


On Thu, Aug 08, 2019 at 05:48:07PM +, Warner Losh wrote:
> W> Author: imp
> W> Date: Thu Aug  8 17:48:07 2019
> W> New Revision: 350764
> W> URL: https://svnweb.freebsd.org/changeset/base/350764
> W>
> W> Log:
> W>   Make arm64 32-bit mode compile with COMPAT_43
> W>
> W>   The COMPAT_43 option isn't quite like the other compat options, and
> arm64 makes
> W>   attempts to support it in 64-bit mode. In 32-bit compat mode,
> however, two
> W>   syscall implementations that COMPAT_FREEBSD32 assumes will be there
> are
> W>   missing. Provide implementations for these: ofreebsd32_sigreturn
> (which we'll
> W>   never encounter, so implement it as nosys as is done in kern_sig.c)
> and
> W>   ofreebsd32_getpagesize, where we'll always return 4096 since that's
> the only
> W>   PAGE_SIZE we support, similar to how the ia32 implementation does
> things.
> W>
> W>   Reviewed by: manu@
> W>   Differential Revision: https://reviews.freebsd.org/D21192
> W>
> W> Modified:
> W>   head/sys/arm64/arm64/freebsd32_machdep.c
> W>
> W> Modified: head/sys/arm64/arm64/freebsd32_machdep.c
> W>
> ==
> W> --- head/sys/arm64/arm64/freebsd32_machdep.c Thu Aug  8 17:30:51 2019
>   (r350763)
> W> +++ head/sys/arm64/arm64/freebsd32_machdep.c Thu Aug  8 17:48:07 2019
>   (r350764)
> W> @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
> W>  #include 
> W>  #include 
> W>  #include 
> W> +#include 
> W>  #include 
> W>  #ifdef VFP
> W>  #include 
> W> @@ -410,3 +411,30 @@ freebsd32_sendsig(sig_t catcher, ksiginfo_t *ksi,
> sigs
> W>  mtx_lock(>ps_mtx);
> W>
> W>  }
> W> +
> W> +#ifdef COMPAT_43
> W> +/*
> W> + * COMPAT_FREEBSD32 assumes we have this system call when COMPAT_43 is
> defined.
> W> + * FreeBSD/arm provies a similar getpagesize() syscall.
> W> + */
> W> +#define ARM32_PAGE_SIZE 4096
> W> +int
> W> +ofreebsd32_getpagesize(struct thread *td,
> W> +struct ofreebsd32_getpagesize_args *uap)
> W> +{
> W> +
> W> +td->td_retval[0] = ARM32_PAGE_SIZE;
> W> +return (0);
> W> +}
> W> +
> W> +/*
> W> + * Mirror the osigreturn definition in kern_sig.c for !i386 platforms.
> This
> W> + * mirrors what's connected to the FreeBSD/arm syscall.
> W> + */
> W> +int
> W> +ofreebsd32_sigreturn(struct thread *td, struct
> ofreebsd32_sigreturn_args *uap)
> W> +{
> W> +
> W> +return (nosys(td, (struct nosys_args *)uap));
> W> +}
> W> +#endif
> W> ___
> W> svn-src-all@freebsd.org mailing list
> W> https://lists.freebsd.org/mailman/listinfo/svn-src-all
> W> To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
>
> --
> Gleb Smirnoff
>
___
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: r350812 - stable/12/sys/cam/ctl

2019-08-08 Thread Alexander Motin
Author: mav
Date: Fri Aug  9 00:50:02 2019
New Revision: 350812
URL: https://svnweb.freebsd.org/changeset/base/350812

Log:
  MFC r350383: Reenable UNMAP support on ramdisks by default.
  
  For some reason, I guess just mechanical editing, it was disable in r333446.

Modified:
  stable/12/sys/cam/ctl/ctl_backend_ramdisk.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cam/ctl/ctl_backend_ramdisk.c
==
--- stable/12/sys/cam/ctl/ctl_backend_ramdisk.c Fri Aug  9 00:49:31 2019
(r350811)
+++ stable/12/sys/cam/ctl/ctl_backend_ramdisk.c Fri Aug  9 00:50:02 2019
(r350812)
@@ -1073,7 +1073,7 @@ ctl_backend_ramdisk_create(struct ctl_be_ramdisk_softc
params->lun_size_bytes = be_lun->size_bytes;
 
value = dnvlist_get_string(cbe_lun->options, "unmap", NULL);
-   if (value != NULL && strcmp(value, "off") != 0)
+   if (value == NULL || strcmp(value, "off") != 0)
cbe_lun->flags |= CTL_LUN_FLAG_UNMAP;
value = dnvlist_get_string(cbe_lun->options, "readonly", NULL);
if (value != NULL) {
___
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: r350811 - in stable/12/sys/cam: ctl scsi

2019-08-08 Thread Alexander Motin
Author: mav
Date: Fri Aug  9 00:49:31 2019
New Revision: 350811
URL: https://svnweb.freebsd.org/changeset/base/350811

Log:
  MFC r350378: Allow WRITE SAME handle more then 2^^32 blocks.
  
  If not limited by write_same_max_lba option, split operation into several
  2^^31 blocks chunks in a loop.  For large disks it may take a while, so
  setting write_same_max_lba may be useful to avoid timeouts.
  
  While there, fix build with CAM_CTL_DEBUG.

Modified:
  stable/12/sys/cam/ctl/ctl.c
  stable/12/sys/cam/scsi/scsi_all.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cam/ctl/ctl.c
==
--- stable/12/sys/cam/ctl/ctl.c Fri Aug  9 00:49:02 2019(r350810)
+++ stable/12/sys/cam/ctl/ctl.c Fri Aug  9 00:49:31 2019(r350811)
@@ -1438,7 +1438,7 @@ ctl_isc_event_handler(ctl_ha_channel channel, ctl_ha_e
return;
}
 
-   CTL_DEBUG_PRINT(("CTL: msg_type %d\n", msg->msg_type));
+   CTL_DEBUG_PRINT(("CTL: msg_type %d\n", msg->hdr.msg_type));
switch (msg->hdr.msg_type) {
case CTL_MSG_SERIALIZE:
io = ctl_alloc_io(softc->othersc_pool);
@@ -5685,12 +5685,36 @@ ctl_write_buffer(struct ctl_scsiio *ctsio)
return (CTL_RETVAL_COMPLETE);
 }
 
+static int
+ctl_write_same_cont(union ctl_io *io)
+{
+   struct ctl_lun *lun = CTL_LUN(io);
+   struct ctl_scsiio *ctsio;
+   struct ctl_lba_len_flags *lbalen;
+   int retval;
+
+   ctsio = >scsiio;
+   ctsio->io_hdr.status = CTL_STATUS_NONE;
+   lbalen = (struct ctl_lba_len_flags *)
+   >io_hdr.ctl_private[CTL_PRIV_LBA_LEN];
+   lbalen->lba += lbalen->len;
+   if ((lun->be_lun->maxlba + 1) - lbalen->lba <= UINT32_MAX) {
+   ctsio->io_hdr.flags &= ~CTL_FLAG_IO_CONT;
+   lbalen->len = (lun->be_lun->maxlba + 1) - lbalen->lba;
+   }
+
+   CTL_DEBUG_PRINT(("ctl_write_same_cont: calling config_write()\n"));
+   retval = lun->backend->config_write((union ctl_io *)ctsio);
+   return (retval);
+}
+
 int
 ctl_write_same(struct ctl_scsiio *ctsio)
 {
struct ctl_lun *lun = CTL_LUN(ctsio);
struct ctl_lba_len_flags *lbalen;
-   uint64_t lba;
+   const char *val;
+   uint64_t lba, ival;
uint32_t num_blocks;
int len, retval;
uint8_t byte2;
@@ -5754,17 +5778,25 @@ ctl_write_same(struct ctl_scsiio *ctsio)
 
/* Zero number of blocks means "to the last logical block" */
if (num_blocks == 0) {
-   if ((lun->be_lun->maxlba + 1) - lba > UINT32_MAX) {
+   ival = UINT64_MAX;
+   val = dnvlist_get_string(lun->be_lun->options,
+   "write_same_max_lba", NULL);
+   if (val != NULL)
+   ctl_expand_number(val, );
+   if ((lun->be_lun->maxlba + 1) - lba > ival) {
ctl_set_invalid_field(ctsio,
- /*sks_valid*/ 0,
- /*command*/ 1,
- /*field*/ 0,
- /*bit_valid*/ 0,
- /*bit*/ 0);
+   /*sks_valid*/ 1, /*command*/ 1,
+   /*field*/ ctsio->cdb[0] == WRITE_SAME_10 ? 7 : 10,
+   /*bit_valid*/ 0, /*bit*/ 0);
ctl_done((union ctl_io *)ctsio);
return (CTL_RETVAL_COMPLETE);
}
-   num_blocks = (lun->be_lun->maxlba + 1) - lba;
+   if ((lun->be_lun->maxlba + 1) - lba > UINT32_MAX) {
+   ctsio->io_hdr.flags |= CTL_FLAG_IO_CONT;
+   ctsio->io_cont = ctl_write_same_cont;
+   num_blocks = 1 << 31;
+   } else
+   num_blocks = (lun->be_lun->maxlba + 1) - lba;
}
 
len = lun->be_lun->blocksize;
@@ -9876,6 +9908,8 @@ ctl_inquiry_evpd_block_limits(struct ctl_scsiio *ctsio
if (val != NULL)
ctl_expand_number(val, );
scsi_u64to8b(ival, bl_ptr->max_write_same_length);
+   if (lun->be_lun->maxlba + 1 > ival)
+   bl_ptr->flags |= SVPD_BL_WSNZ;
}
 
ctl_set_success(ctsio);
@@ -11322,7 +11356,7 @@ ctl_failover_lun(union ctl_io *rio)
uint32_t targ_lun;
 
targ_lun = rio->io_hdr.nexus.targ_mapped_lun;
-   CTL_DEBUG_PRINT(("FAILOVER for lun %ju\n", targ_lun));
+   CTL_DEBUG_PRINT(("FAILOVER for lun %u\n", targ_lun));
 
/* Find and lock the LUN. */
mtx_lock(>ctl_lock);

Modified: stable/12/sys/cam/scsi/scsi_all.h
==
--- stable/12/sys/cam/scsi/scsi_all.h   Fri Aug 

svn commit: r350810 - in stable/12/sys/cam: ctl scsi

2019-08-08 Thread Alexander Motin
Author: mav
Date: Fri Aug  9 00:49:02 2019
New Revision: 350810
URL: https://svnweb.freebsd.org/changeset/base/350810

Log:
  MFC r350363: Add support for Long LBA mode parameter block descriptor.
  
  It is formally required for SBC Base 2016 feature set.

Modified:
  stable/12/sys/cam/ctl/ctl.c
  stable/12/sys/cam/scsi/scsi_all.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cam/ctl/ctl.c
==
--- stable/12/sys/cam/ctl/ctl.c Fri Aug  9 00:48:31 2019(r350809)
+++ stable/12/sys/cam/ctl/ctl.c Fri Aug  9 00:49:02 2019(r350810)
@@ -6365,13 +6365,12 @@ int
 ctl_mode_sense(struct ctl_scsiio *ctsio)
 {
struct ctl_lun *lun = CTL_LUN(ctsio);
-   int pc, page_code, dbd, subpage;
-   int alloc_len, page_len, header_len, total_len;
-   struct scsi_mode_block_descr *block_desc;
+   int pc, page_code, llba, subpage;
+   int alloc_len, page_len, header_len, bd_len, total_len;
+   void *block_desc;
struct ctl_page_index *page_index;
 
-   dbd = 0;
-   block_desc = NULL;
+   llba = 0;
 
CTL_DEBUG_PRINT(("ctl_mode_sense\n"));
 
@@ -6383,9 +6382,10 @@ ctl_mode_sense(struct ctl_scsiio *ctsio)
 
header_len = sizeof(struct scsi_mode_hdr_6);
if (cdb->byte2 & SMS_DBD)
-   dbd = 1;
+   bd_len = 0;
else
-   header_len += sizeof(struct scsi_mode_block_descr);
+   bd_len = sizeof(struct scsi_mode_block_descr);
+   header_len += bd_len;
 
pc = (cdb->page & SMS_PAGE_CTRL_MASK) >> 6;
page_code = cdb->page & SMS_PAGE_CODE;
@@ -6399,11 +6399,18 @@ ctl_mode_sense(struct ctl_scsiio *ctsio)
cdb = (struct scsi_mode_sense_10 *)ctsio->cdb;
 
header_len = sizeof(struct scsi_mode_hdr_10);
+   if (cdb->byte2 & SMS_DBD) {
+   bd_len = 0;
+   } else if (lun->be_lun->lun_type == T_DIRECT) {
+   if (cdb->byte2 & SMS10_LLBAA) {
+   llba = 1;
+   bd_len = sizeof(struct 
scsi_mode_block_descr_dlong);
+   } else
+   bd_len = sizeof(struct 
scsi_mode_block_descr_dshort);
+   } else
+   bd_len = sizeof(struct scsi_mode_block_descr);
+   header_len += bd_len;
 
-   if (cdb->byte2 & SMS_DBD)
-   dbd = 1;
-   else
-   header_len += sizeof(struct scsi_mode_block_descr);
pc = (cdb->page & SMS_PAGE_CTRL_MASK) >> 6;
page_code = cdb->page & SMS_PAGE_CODE;
subpage = cdb->subpage;
@@ -6536,12 +6543,8 @@ ctl_mode_sense(struct ctl_scsiio *ctsio)
(lun->MODE_CTRL.eca_and_aen & SCP_SWP) != 0)
header->dev_specific |= 0x80; /* WP */
}
-   if (dbd)
-   header->block_descr_len = 0;
-   else
-   header->block_descr_len =
-   sizeof(struct scsi_mode_block_descr);
-   block_desc = (struct scsi_mode_block_descr *)[1];
+   header->block_descr_len = bd_len;
+   block_desc = [1];
break;
}
case MODE_SENSE_10: {
@@ -6558,12 +6561,10 @@ ctl_mode_sense(struct ctl_scsiio *ctsio)
(lun->MODE_CTRL.eca_and_aen & SCP_SWP) != 0)
header->dev_specific |= 0x80; /* WP */
}
-   if (dbd)
-   scsi_ulto2b(0, header->block_descr_len);
-   else
-   scsi_ulto2b(sizeof(struct scsi_mode_block_descr),
-   header->block_descr_len);
-   block_desc = (struct scsi_mode_block_descr *)[1];
+   if (llba)
+   header->flags |= SMH_LONGLBA;
+   scsi_ulto2b(bd_len, header->block_descr_len);
+   block_desc = [1];
break;
}
default:
@@ -6574,12 +6575,27 @@ ctl_mode_sense(struct ctl_scsiio *ctsio)
 * If we've got a disk, use its blocksize in the block
 * descriptor.  Otherwise, just set it to 0.
 */
-   if (dbd == 0) {
-   if (lun->be_lun->lun_type == T_DIRECT)
-   scsi_ulto3b(lun->be_lun->blocksize,
-   block_desc->block_len);
-   else
-   scsi_ulto3b(0, block_desc->block_len);
+   if (bd_len > 0) {
+   if (lun->be_lun->lun_type == T_DIRECT) {
+   if (llba) {
+   struct scsi_mode_block_descr_dlong *bd = 
block_desc;
+

svn commit: r350809 - in stable/12: sys/cam/ctl sys/cam/scsi usr.sbin/ctladm

2019-08-08 Thread Alexander Motin
Author: mav
Date: Fri Aug  9 00:48:31 2019
New Revision: 350809
URL: https://svnweb.freebsd.org/changeset/base/350809

Log:
  MFC r350346: Add device temperature reporting into CTL.
  
  The values to report can be set via LUN options.  It can be useful for
  testing, and also required for Drive Maintenance 2016 feature set.

Modified:
  stable/12/sys/cam/ctl/ctl.c
  stable/12/sys/cam/ctl/ctl.h
  stable/12/sys/cam/ctl/ctl_private.h
  stable/12/sys/cam/scsi/scsi_all.h
  stable/12/usr.sbin/ctladm/ctladm.8
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cam/ctl/ctl.c
==
--- stable/12/sys/cam/ctl/ctl.c Fri Aug  9 00:47:27 2019(r350808)
+++ stable/12/sys/cam/ctl/ctl.c Fri Aug  9 00:48:31 2019(r350809)
@@ -4450,12 +4450,14 @@ ctl_init_log_page_index(struct ctl_lun *lun)
lun->log_pages.index[0].page_len = j;
lun->log_pages.index[1].page_data = >log_pages.subpages_page[0];
lun->log_pages.index[1].page_len = k * 2;
-   lun->log_pages.index[2].page_data = >log_pages.lbp_page[0];
-   lun->log_pages.index[2].page_len = 12*CTL_NUM_LBP_PARAMS;
-   lun->log_pages.index[3].page_data = (uint8_t 
*)>log_pages.stat_page;
-   lun->log_pages.index[3].page_len = sizeof(lun->log_pages.stat_page);
-   lun->log_pages.index[4].page_data = (uint8_t *)>log_pages.ie_page;
-   lun->log_pages.index[4].page_len = sizeof(lun->log_pages.ie_page);
+   lun->log_pages.index[2].page_data = (uint8_t 
*)>log_pages.temp_page;
+   lun->log_pages.index[2].page_len = sizeof(lun->log_pages.temp_page);
+   lun->log_pages.index[3].page_data = >log_pages.lbp_page[0];
+   lun->log_pages.index[3].page_len = 12*CTL_NUM_LBP_PARAMS;
+   lun->log_pages.index[4].page_data = (uint8_t 
*)>log_pages.stat_page;
+   lun->log_pages.index[4].page_len = sizeof(lun->log_pages.stat_page);
+   lun->log_pages.index[5].page_data = (uint8_t *)>log_pages.ie_page;
+   lun->log_pages.index[5].page_len = sizeof(lun->log_pages.ie_page);
 
return (CTL_RETVAL_COMPLETE);
 }
@@ -6679,6 +6681,40 @@ ctl_mode_sense(struct ctl_scsiio *ctsio)
 }
 
 int
+ctl_temp_log_sense_handler(struct ctl_scsiio *ctsio,
+  struct ctl_page_index *page_index,
+  int pc)
+{
+   struct ctl_lun *lun = CTL_LUN(ctsio);
+   struct scsi_log_temperature *data;
+   const char *value;
+
+   data = (struct scsi_log_temperature *)page_index->page_data;
+
+   scsi_ulto2b(SLP_TEMPERATURE, data->hdr.param_code);
+   data->hdr.param_control = SLP_LBIN;
+   data->hdr.param_len = sizeof(struct scsi_log_temperature) -
+   sizeof(struct scsi_log_param_header);
+   if ((value = dnvlist_get_string(lun->be_lun->options, "temperature",
+   NULL)) != NULL)
+   data->temperature = strtol(value, NULL, 0);
+   else
+   data->temperature = 0xff;
+   data++;
+
+   scsi_ulto2b(SLP_REFTEMPERATURE, data->hdr.param_code);
+   data->hdr.param_control = SLP_LBIN;
+   data->hdr.param_len = sizeof(struct scsi_log_temperature) -
+   sizeof(struct scsi_log_param_header);
+   if ((value = dnvlist_get_string(lun->be_lun->options, "reftemperature",
+   NULL)) != NULL)
+   data->temperature = strtol(value, NULL, 0);
+   else
+   data->temperature = 0xff;
+   return (0);
+}
+
+int
 ctl_lbp_log_sense_handler(struct ctl_scsiio *ctsio,
   struct ctl_page_index *page_index,
   int pc)
@@ -6802,6 +6838,7 @@ ctl_ie_log_sense_handler(struct ctl_scsiio *ctsio,
 {
struct ctl_lun *lun = CTL_LUN(ctsio);
struct scsi_log_informational_exceptions *data;
+   const char *value;
 
data = (struct scsi_log_informational_exceptions 
*)page_index->page_data;
 
@@ -6811,7 +6848,11 @@ ctl_ie_log_sense_handler(struct ctl_scsiio *ctsio,
sizeof(struct scsi_log_param_header);
data->ie_asc = lun->ie_asc;
data->ie_ascq = lun->ie_ascq;
-   data->temperature = 0xff;
+   if ((value = dnvlist_get_string(lun->be_lun->options, "temperature",
+   NULL)) != NULL)
+   data->temperature = strtol(value, NULL, 0);
+   else
+   data->temperature = 0xff;
return (0);
 }
 

Modified: stable/12/sys/cam/ctl/ctl.h
==
--- stable/12/sys/cam/ctl/ctl.h Fri Aug  9 00:47:27 2019(r350808)
+++ stable/12/sys/cam/ctl/ctl.h Fri Aug  9 00:48:31 2019(r350809)
@@ -158,6 +158,9 @@ int ctl_default_page_handler(struct ctl_scsiio *ctsio,
 int ctl_ie_page_handler(struct ctl_scsiio *ctsio,
struct ctl_page_index *page_index,
uint8_t *page_ptr);
+int ctl_temp_log_sense_handler(struct ctl_scsiio *ctsio,
+ 

svn commit: r350808 - in stable/12/sys/cam: ctl scsi

2019-08-08 Thread Alexander Motin
Author: mav
Date: Fri Aug  9 00:47:27 2019
New Revision: 350808
URL: https://svnweb.freebsd.org/changeset/base/350808

Log:
  MFC r350343: Add reporting of SCSI Feature Sets VPD page from SPC-5.
  
  CTL implements all defined feature sets except Drive Maintenance 2016,
  which is not very applicable to such a virtual device, and implemented
  only partially now.  But may be it could be fixed later at least for
  completeness.

Modified:
  stable/12/sys/cam/ctl/ctl.c
  stable/12/sys/cam/scsi/scsi_all.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cam/ctl/ctl.c
==
--- stable/12/sys/cam/ctl/ctl.c Thu Aug  8 22:20:15 2019(r350807)
+++ stable/12/sys/cam/ctl/ctl.c Fri Aug  9 00:47:27 2019(r350808)
@@ -448,10 +448,11 @@ SYSCTL_INT(_kern_cam_ctl, OID_AUTO, max_ports, CTLFLAG
 /*
  * Supported pages (0x00), Serial number (0x80), Device ID (0x83),
  * Extended INQUIRY Data (0x86), Mode Page Policy (0x87),
- * SCSI Ports (0x88), Third-party Copy (0x8F), Block limits (0xB0),
- * Block Device Characteristics (0xB1) and Logical Block Provisioning (0xB2)
+ * SCSI Ports (0x88), Third-party Copy (0x8F), SCSI Feature Sets (0x92),
+ * Block limits (0xB0), Block Device Characteristics (0xB1) and
+ * Logical Block Provisioning (0xB2)
  */
-#define SCSI_EVPD_NUM_SUPPORTED_PAGES  10
+#define SCSI_EVPD_NUM_SUPPORTED_PAGES  11
 
 static void ctl_isc_event_handler(ctl_ha_channel chanel, ctl_ha_event event,
  int param);
@@ -489,6 +490,7 @@ static int ctl_inquiry_evpd_eid(struct ctl_scsiio *cts
 static int ctl_inquiry_evpd_mpp(struct ctl_scsiio *ctsio, int alloc_len);
 static int ctl_inquiry_evpd_scsi_ports(struct ctl_scsiio *ctsio,
 int alloc_len);
+static int ctl_inquiry_evpd_sfs(struct ctl_scsiio *ctsio, int alloc_len);
 static int ctl_inquiry_evpd_block_limits(struct ctl_scsiio *ctsio,
 int alloc_len);
 static int ctl_inquiry_evpd_bdc(struct ctl_scsiio *ctsio, int alloc_len);
@@ -9318,6 +9320,8 @@ ctl_inquiry_evpd_supported(struct ctl_scsiio *ctsio, i
pages->page_list[p++] = SVPD_SCSI_PORTS;
/* Third-party Copy */
pages->page_list[p++] = SVPD_SCSI_TPC;
+   /* SCSI Feature Sets */
+   pages->page_list[p++] = SVPD_SCSI_SFS;
if (lun != NULL && lun->be_lun->lun_type == T_DIRECT) {
/* Block limits */
pages->page_list[p++] = SVPD_BLOCK_LIMITS;
@@ -9699,6 +9703,58 @@ ctl_inquiry_evpd_scsi_ports(struct ctl_scsiio *ctsio, 
 }
 
 static int
+ctl_inquiry_evpd_sfs(struct ctl_scsiio *ctsio, int alloc_len)
+{
+   struct ctl_lun *lun = CTL_LUN(ctsio);
+   struct scsi_vpd_sfs *sfs_ptr;
+   int sfs_page_size, n;
+
+   sfs_page_size = sizeof(*sfs_ptr) + 5 * 2;
+   ctsio->kern_data_ptr = malloc(sfs_page_size, M_CTL, M_WAITOK | M_ZERO);
+   sfs_ptr = (struct scsi_vpd_sfs *)ctsio->kern_data_ptr;
+   ctsio->kern_sg_entries = 0;
+   ctsio->kern_rel_offset = 0;
+   ctsio->kern_sg_entries = 0;
+   ctsio->kern_data_len = min(sfs_page_size, alloc_len);
+   ctsio->kern_total_len = ctsio->kern_data_len;
+
+   /*
+* The control device is always connected.  The disk device, on the
+* other hand, may not be online all the time.  Need to change this
+* to figure out whether the disk device is actually online or not.
+*/
+   if (lun != NULL)
+   sfs_ptr->device = (SID_QUAL_LU_CONNECTED << 5) |
+ lun->be_lun->lun_type;
+   else
+   sfs_ptr->device = (SID_QUAL_LU_OFFLINE << 5) | T_DIRECT;
+
+   sfs_ptr->page_code = SVPD_SCSI_SFS;
+   n = 0;
+   /* Discovery 2016 */
+   scsi_ulto2b(0x0001, _ptr->codes[2 * n++]);
+   if (lun != NULL && lun->be_lun->lun_type == T_DIRECT) {
+/* SBC Base 2016 */
+   scsi_ulto2b(0x0101, _ptr->codes[2 * n++]);
+/* SBC Base 2010 */
+   scsi_ulto2b(0x0102, _ptr->codes[2 * n++]);
+   if (lun->be_lun->flags & CTL_LUN_FLAG_UNMAP) {
+   /* Basic Provisioning 2016 */
+   scsi_ulto2b(0x0103, _ptr->codes[2 * n++]);
+   }
+   /* Drive Maintenance 2016 */
+   //scsi_ulto2b(0x0104, _ptr->codes[2 * n++]);
+   }
+   scsi_ulto2b(4 + 2 * n, sfs_ptr->page_length);
+
+   ctl_set_success(ctsio);
+   ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED;
+   ctsio->be_move_done = ctl_config_move_done;
+   ctl_datamove((union ctl_io *)ctsio);
+   return (CTL_RETVAL_COMPLETE);
+}
+
+static int
 ctl_inquiry_evpd_block_limits(struct ctl_scsiio *ctsio, int alloc_len)
 {
struct ctl_lun *lun = CTL_LUN(ctsio);
@@ -9811,7 +9867,7 @@ ctl_inquiry_evpd_bdc(struct ctl_scsiio *ctsio, int all
else
i = 0;

Re: svn commit: r350764 - head/sys/arm64/arm64

2019-08-08 Thread Gleb Smirnoff
  Hi,

why do we need COMPAT_43 for arm64 at all? I can't imagine an
application that would require this compatibility.

A more general question is how far in the future are we going
to carry COMPAT_43 for i386/amd64?

On Thu, Aug 08, 2019 at 05:48:07PM +, Warner Losh wrote:
W> Author: imp
W> Date: Thu Aug  8 17:48:07 2019
W> New Revision: 350764
W> URL: https://svnweb.freebsd.org/changeset/base/350764
W> 
W> Log:
W>   Make arm64 32-bit mode compile with COMPAT_43
W>   
W>   The COMPAT_43 option isn't quite like the other compat options, and arm64 
makes
W>   attempts to support it in 64-bit mode. In 32-bit compat mode, however, two
W>   syscall implementations that COMPAT_FREEBSD32 assumes will be there are
W>   missing. Provide implementations for these: ofreebsd32_sigreturn (which 
we'll
W>   never encounter, so implement it as nosys as is done in kern_sig.c) and
W>   ofreebsd32_getpagesize, where we'll always return 4096 since that's the 
only
W>   PAGE_SIZE we support, similar to how the ia32 implementation does things.
W>   
W>   Reviewed by: manu@
W>   Differential Revision: https://reviews.freebsd.org/D21192
W> 
W> Modified:
W>   head/sys/arm64/arm64/freebsd32_machdep.c
W> 
W> Modified: head/sys/arm64/arm64/freebsd32_machdep.c
W> 
==
W> --- head/sys/arm64/arm64/freebsd32_machdep.c Thu Aug  8 17:30:51 2019
(r350763)
W> +++ head/sys/arm64/arm64/freebsd32_machdep.c Thu Aug  8 17:48:07 2019
(r350764)
W> @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
W>  #include 
W>  #include 
W>  #include 
W> +#include 
W>  #include 
W>  #ifdef VFP
W>  #include 
W> @@ -410,3 +411,30 @@ freebsd32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigs
W>  mtx_lock(>ps_mtx);
W>  
W>  }
W> +
W> +#ifdef COMPAT_43
W> +/*
W> + * COMPAT_FREEBSD32 assumes we have this system call when COMPAT_43 is 
defined.
W> + * FreeBSD/arm provies a similar getpagesize() syscall.
W> + */
W> +#define ARM32_PAGE_SIZE 4096
W> +int
W> +ofreebsd32_getpagesize(struct thread *td,
W> +struct ofreebsd32_getpagesize_args *uap)
W> +{
W> +
W> +td->td_retval[0] = ARM32_PAGE_SIZE;
W> +return (0);
W> +}
W> +
W> +/*
W> + * Mirror the osigreturn definition in kern_sig.c for !i386 platforms. This
W> + * mirrors what's connected to the FreeBSD/arm syscall.
W> + */
W> +int
W> +ofreebsd32_sigreturn(struct thread *td, struct ofreebsd32_sigreturn_args 
*uap)
W> +{
W> +
W> +return (nosys(td, (struct nosys_args *)uap));
W> +}
W> +#endif
W> ___
W> svn-src-all@freebsd.org mailing list
W> https://lists.freebsd.org/mailman/listinfo/svn-src-all
W> To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

-- 
Gleb Smirnoff
___
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: r350807 - in stable/11: sbin/camcontrol sys/cam/ata sys/cam/scsi sys/sys

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 22:20:15 2019
New Revision: 350807
URL: https://svnweb.freebsd.org/changeset/base/350807

Log:
  MFC r350331: Make `camcontrol sanitize` support also ATA devices.
  
  ATA sanitize is functionally identical to SCSI, just uses different
  initiation commands and status reporting mechanism.
  
  While there, make kernel better handle sanitize commands and statuses.

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

Modified: stable/11/sbin/camcontrol/camcontrol.8
==
--- stable/11/sbin/camcontrol/camcontrol.8  Thu Aug  8 22:19:43 2019
(r350806)
+++ stable/11/sbin/camcontrol/camcontrol.8  Thu Aug  8 22:20:15 2019
(r350807)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 22, 2019
+.Dd July 25, 2019
 .Dt CAMCONTROL 8
 .Os
 .Sh NAME
@@ -1276,13 +1276,11 @@ will not be asked about the timeout if a timeout is sp
 command line.
 .El
 .It Ic sanitize
-Issue the
-.Tn SCSI
-SANITIZE command to the named device.
+Issue the SANITIZE command to the named device.
 .Pp
 .Em WARNING! WARNING! WARNING!
 .Pp
-ALL data in the cache and on the disk will be destroyed or made inaccessible.
+ALL data on the disk will be destroyed or made inaccessible.
 Recovery of the data is not possible.
 Use extreme caution when issuing this command.
 .Pp

Modified: stable/11/sbin/camcontrol/camcontrol.c
==
--- stable/11/sbin/camcontrol/camcontrol.c  Thu Aug  8 22:19:43 2019
(r350806)
+++ stable/11/sbin/camcontrol/camcontrol.c  Thu Aug  8 22:20:15 2019
(r350807)
@@ -346,7 +346,7 @@ static int ratecontrol(struct cam_device *device, int 
 static int scsiformat(struct cam_device *device, int argc, char **argv,
  char *combinedopt, int task_attr, int retry_count,
  int timeout);
-static int scsisanitize(struct cam_device *device, int argc, char **argv,
+static int sanitize(struct cam_device *device, int argc, char **argv,
char *combinedopt, int task_attr, int retry_count,
int timeout);
 static int scsireportluns(struct cam_device *device, int argc, char **argv,
@@ -1595,6 +1595,19 @@ atacapprint(struct ata_params *parm)
} else {
printf("no\n");
}
+   printf("Sanitize   ");
+   if (parm->multi & ATA_SUPPORT_SANITIZE) {
+   printf("yes\t\t%s%s%s\n",
+   parm->multi & ATA_SUPPORT_BLOCK_ERASE_EXT ? "block, " : "",
+   parm->multi & ATA_SUPPORT_OVERWRITE_EXT ? "overwrite, " : 
"",
+   parm->multi & ATA_SUPPORT_CRYPTO_SCRAMBLE_EXT ? "crypto" : 
"");
+   printf("Sanitize - commands allowed%s\n",
+   parm->multi & ATA_SUPPORT_SANITIZE_ALLOWED ? "yes" : "no");
+   printf("Sanitize - antifreeze lock %s\n",
+   parm->multi & ATA_SUPPORT_ANTIFREEZE_LOCK_EXT ? "yes" : 
"no");
+   } else {
+   printf("no\n");
+   }
 }
 
 static int
@@ -1841,6 +1854,11 @@ ata_do_cmd(struct cam_device *device, union ccb *ccb, 
res->lba_high_exp = res_pass16->lba_high_exp;
res->sector_count = res_pass16->sector_count;
res->sector_count_exp = res_pass16->sector_count_exp;
+   ccb->ccb_h.status &= ~CAM_STATUS_MASK;
+   if (res->status & ATA_STATUS_ERROR)
+   ccb->ccb_h.status |= CAM_ATA_STATUS_ERROR;
+   else
+   ccb->ccb_h.status |= CAM_REQ_CMP;
}
 
return (error);
@@ -2329,12 +2347,6 @@ ata_do_identify(struct cam_device *device, int retry_c
error = 0;
}
 
-   if (arglist & CAM_ARG_VERBOSE) {
-   fprintf(stdout, "%s%d: Raw identify data:\n",
-   device->device_name, device->dev_unit_num);
-   dump_data(ptr, sizeof(struct ata_params));
-   }
-
/* check for invalid (all zero) response */
if (error != 0) {
warnx("Invalid identify response detected");
@@ -2385,6 +2397,12 @@ ataidentify(struct cam_device *device, int retry_count
return (1);
}
 
+   if (arglist & CAM_ARG_VERBOSE) {
+   printf("%s%d: Raw identify data:\n",
+   device->device_name, device->dev_unit_num);
+   dump_data((void*)ident_buf, sizeof(struct ata_params));
+   }
+
if (ident_buf->support.command1 & ATA_SUPPORT_PROTECTED) {
if (ata_read_native_max(device, retry_count, timeout, ccb,
  

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

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 22:19:43 2019
New Revision: 350806
URL: https://svnweb.freebsd.org/changeset/base/350806

Log:
  MFC r350257: Make `camcontrol hpa` and `camcontrol ama` trigger reprobe.
  
  This makes OS automatically see the disk's new disk size.

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

Modified: stable/11/sbin/camcontrol/camcontrol.c
==
--- stable/11/sbin/camcontrol/camcontrol.c  Thu Aug  8 22:17:41 2019
(r350805)
+++ stable/11/sbin/camcontrol/camcontrol.c  Thu Aug  8 22:19:43 2019
(r350806)
@@ -301,6 +301,7 @@ static int scsiserial(struct cam_device *device, int t
 #endif /* MINIMALISTIC */
 static int parse_btl(char *tstr, path_id_t *bus, target_id_t *target,
 lun_id_t *lun, cam_argmask *arglst);
+static int reprobe(struct cam_device *device);
 static int dorescan_or_reset(int argc, char **argv, int rescan);
 static int rescan_or_reset_bus(path_id_t bus, int rescan);
 static int scanlun_or_reset_dev(path_id_t bus, target_id_t target,
@@ -370,7 +371,6 @@ static int scsiprintopcodes(struct cam_device *device,
 static int scsiopcodes(struct cam_device *device, int argc, char **argv,
   char *combinedopt, int task_attr, int retry_count,
   int timeout, int verbose);
-static int scsireprobe(struct cam_device *device);
 
 #endif /* MINIMALISTIC */
 #ifndef min
@@ -2934,6 +2934,8 @@ atahpa(struct cam_device *device, int retry_count, int
timeout, ccb,
_buf);
atahpa_print(ident_buf, hpasize, 1);
+   /* Hint CAM to reprobe the device. */
+   reprobe(device);
}
}
break;
@@ -3076,6 +3078,8 @@ ataama(struct cam_device *device, int retry_count, int
error = ata_do_identify(device, retry_count,
timeout, ccb, _buf);
ataama_print(ident_buf, nativesize, 1);
+   /* Hint CAM to reprobe the device. */
+   reprobe(device);
}
}
break;
@@ -9313,7 +9317,7 @@ bailout:
 #endif /* MINIMALISTIC */
 
 static int
-scsireprobe(struct cam_device *device)
+reprobe(struct cam_device *device)
 {
union ccb *ccb;
int retval = 0;
@@ -9325,7 +9329,7 @@ scsireprobe(struct cam_device *device)
return (1);
}
 
-   CCB_CLEAR_ALL_EXCEPT_HDR(>csio);
+   CCB_CLEAR_ALL_EXCEPT_HDR(ccb);
 
ccb->ccb_h.func_code = XPT_REPROBE_LUN;
 
@@ -10090,7 +10094,7 @@ main(int argc, char **argv)
arglist & CAM_ARG_VERBOSE);
break;
case CAM_CMD_REPROBE:
-   error = scsireprobe(cam_dev);
+   error = reprobe(cam_dev);
break;
case CAM_CMD_ZONE:
error = zone(cam_dev, argc, argv, combinedopt,
___
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: r350805 - stable/11/sys/cam/ata

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 22:17:41 2019
New Revision: 350805
URL: https://svnweb.freebsd.org/changeset/base/350805

Log:
  MFC r350233: Make CAM ATA stack handle disk resizes.
  
  While for ATA disks resize is even more rare situation than for SCSI, it
  may happen in case of HPA or AMA being used.  Make ATA XPT report minor
  IDENTIFY DATA change to upper layers with AC_GETDEV_CHANGED, and ada(4)
  periph driver handle that event, recalculating all the disk properties and
  signalling resize to GEOM.  Since ATA has no mechanism of UNIT ATTENTIONs,
  like SCSI, it has no way to detect that something has changed.  That is why
  this functionality depends on explicit reprobe via XPT_REPROBE_LUN call.
  
  Relnotes: yes

Modified:
  stable/11/sys/cam/ata/ata_da.c
  stable/11/sys/cam/ata/ata_xpt.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/ata/ata_da.c
==
--- stable/11/sys/cam/ata/ata_da.c  Thu Aug  8 22:16:19 2019
(r350804)
+++ stable/11/sys/cam/ata/ata_da.c  Thu Aug  8 22:17:41 2019
(r350805)
@@ -246,8 +246,9 @@ struct ada_softc {
int  periodic_read_error;
int  periodic_read_count;
 #endif
-   struct   disk_params params;
-   struct   disk *disk;
+   struct ccb_pathinq  cpi;
+   struct disk_params  params;
+   struct disk *disk;
struct task sysctl_task;
struct sysctl_ctx_list  sysctl_ctx;
struct sysctl_oid   *sysctl_tree;
@@ -798,6 +799,8 @@ static  voidadasysctlinit(void *context, 
int pending)
 static int adagetattr(struct bio *bp);
 static voidadasetflags(struct ada_softc *softc,
struct ccb_getdev *cgd);
+static voidadasetgeom(struct ada_softc *softc,
+  struct ccb_getdev *cgd);
 static periph_ctor_t   adaregister;
 static voidada_dsmtrim(struct ada_softc *softc, struct bio *bp,
struct ccb_ataio *ataio);
@@ -813,8 +816,6 @@ static  voidadadone(struct cam_periph 
*periph,
   union ccb *done_ccb);
 static  intadaerror(union ccb *ccb, u_int32_t cam_flags,
u_int32_t sense_flags);
-static voidadagetparams(struct cam_periph *periph,
-   struct ccb_getdev *cgd);
 static timeout_t   adasendorderedtag;
 static voidadashutdown(void *arg, int howto);
 static voidadasuspend(void *arg);
@@ -1317,9 +1318,11 @@ adaasync(void *callback_arg, u_int32_t code,
xpt_action((union ccb *));
 
/*
-* Set/clear support flags based on the new Identify data.
+* Update our information based on the new Identify data.
 */
adasetflags(softc, );
+   adasetgeom(softc, );
+   disk_resize(softc->disk, M_NOWAIT);
 
cam_periph_async(periph, code, path, arg);
break;
@@ -1639,7 +1642,8 @@ adasetflags(struct ada_softc *softc, struct ccb_getdev
softc->flags &= ~ADA_FLAG_CAN_NCQ;
 
if ((cgd->ident_data.support_dsm & ATA_SUPPORT_DSM_TRIM) &&
-   (cgd->inq_flags & SID_DMA)) {
+   (cgd->inq_flags & SID_DMA) &&
+   (softc->quirks & ADA_Q_NO_TRIM) == 0) {
softc->flags |= ADA_FLAG_CAN_TRIM;
softc->trim_max_ranges = TRIM_MAX_RANGES;
if (cgd->ident_data.max_dsm_blocks != 0) {
@@ -1707,12 +1711,10 @@ static cam_status
 adaregister(struct cam_periph *periph, void *arg)
 {
struct ada_softc *softc;
-   struct ccb_pathinq cpi;
struct ccb_getdev *cgd;
char   announce_buf[80];
struct disk_params *dp;
caddr_t match;
-   u_int maxio;
int quirks;
 
cgd = (struct ccb_getdev *)arg;
@@ -1738,6 +1740,7 @@ adaregister(struct cam_periph *periph, void *arg)
}
 
periph->softc = softc;
+   xpt_path_inq(>cpi, periph->path);
 
/*
 * See if this device has any quirks.
@@ -1751,8 +1754,6 @@ adaregister(struct cam_periph *periph, void *arg)
else
softc->quirks = ADA_Q_NONE;
 
-   xpt_path_inq(, periph->path);
-
TASK_INIT(>sysctl_task, 0, adasysctlinit, periph);
 
/*
@@ -1778,6 +1779,8 @@ adaregister(struct cam_periph *periph, void *arg)
 * Set support flags based on the Identify data and quirks.
 */
adasetflags(softc, cgd);
+   if (softc->cpi.hba_misc & PIM_ATA_EXT)
+   softc->flags |= ADA_FLAG_PIM_ATA_EXT;
 
/* Disable queue sorting for non-rotational media by default. */
if (cgd->ident_data.media_rotation_rate == ATA_RATE_NON_ROTATING) {
@@ -1786,14 +1789,13 @@ 

svn commit: r350804 - in stable/11/sys: cam cam/ata cam/nvme cam/scsi dev/hyperv/storvsc

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 22:16:19 2019
New Revision: 350804
URL: https://svnweb.freebsd.org/changeset/base/350804

Log:
  MFC r326645 (by imp): Define xpt_path_inq.
  
  This provides a nice wrarpper around the XPT_PATH_INQ ccb creation and
  calling.

Modified:
  stable/11/sys/cam/ata/ata_da.c
  stable/11/sys/cam/ata/ata_xpt.c
  stable/11/sys/cam/cam_periph.c
  stable/11/sys/cam/cam_xpt.c
  stable/11/sys/cam/cam_xpt.h
  stable/11/sys/cam/nvme/nvme_da.c
  stable/11/sys/cam/nvme/nvme_xpt.c
  stable/11/sys/cam/scsi/scsi_cd.c
  stable/11/sys/cam/scsi/scsi_ch.c
  stable/11/sys/cam/scsi/scsi_da.c
  stable/11/sys/cam/scsi/scsi_pass.c
  stable/11/sys/cam/scsi/scsi_pt.c
  stable/11/sys/cam/scsi/scsi_sa.c
  stable/11/sys/cam/scsi/scsi_sg.c
  stable/11/sys/cam/scsi/scsi_target.c
  stable/11/sys/cam/scsi/scsi_xpt.c
  stable/11/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/ata/ata_da.c
==
--- stable/11/sys/cam/ata/ata_da.c  Thu Aug  8 22:11:01 2019
(r350803)
+++ stable/11/sys/cam/ata/ata_da.c  Thu Aug  8 22:16:19 2019
(r350804)
@@ -1751,10 +1751,7 @@ adaregister(struct cam_periph *periph, void *arg)
else
softc->quirks = ADA_Q_NONE;
 
-   bzero(, sizeof(cpi));
-   xpt_setup_ccb(_h, periph->path, CAM_PRIORITY_NONE);
-   cpi.ccb_h.func_code = XPT_PATH_INQ;
-   xpt_action((union ccb *));
+   xpt_path_inq(, periph->path);
 
TASK_INIT(>sysctl_task, 0, adasysctlinit, periph);
 

Modified: stable/11/sys/cam/ata/ata_xpt.c
==
--- stable/11/sys/cam/ata/ata_xpt.c Thu Aug  8 22:11:01 2019
(r350803)
+++ stable/11/sys/cam/ata/ata_xpt.c Thu Aug  8 22:16:19 2019
(r350804)
@@ -994,10 +994,7 @@ noerror:
if (path->device->mintags != 0 &&
path->bus->sim->max_tagged_dev_openings != 0) {
/* Check if the SIM does not want queued commands. */
-   bzero(, sizeof(cpi));
-   xpt_setup_ccb(_h, path, CAM_PRIORITY_NONE);
-   cpi.ccb_h.func_code = XPT_PATH_INQ;
-   xpt_action((union ccb *));
+   xpt_path_inq(, path);
if (cpi.ccb_h.status == CAM_REQ_CMP &&
(cpi.hba_inquiry & PI_TAG_ABLE)) {
/* Report SIM which tags are allowed. */
@@ -1400,10 +1397,7 @@ ata_scan_bus(struct cam_periph *periph, union ccb *req
xpt_done(request_ccb);
return;
}
-   xpt_setup_ccb(_ccb->ccb_h, request_ccb->ccb_h.path,
- request_ccb->ccb_h.pinfo.priority);
-   work_ccb->ccb_h.func_code = XPT_PATH_INQ;
-   xpt_action(work_ccb);
+   xpt_path_inq(_ccb->cpi, request_ccb->ccb_h.path);
if (work_ccb->ccb_h.status != CAM_REQ_CMP) {
request_ccb->ccb_h.status = work_ccb->ccb_h.status;
xpt_free_ccb(work_ccb);
@@ -1558,10 +1552,7 @@ ata_scan_lun(struct cam_periph *periph, struct cam_pat
 
CAM_DEBUG(path, CAM_DEBUG_TRACE, ("xpt_scan_lun\n"));
 
-   xpt_setup_ccb(_h, path, CAM_PRIORITY_NONE);
-   cpi.ccb_h.func_code = XPT_PATH_INQ;
-   xpt_action((union ccb *));
-
+   xpt_path_inq(, path);
if (cpi.ccb_h.status != CAM_REQ_CMP) {
if (request_ccb != NULL) {
request_ccb->ccb_h.status = cpi.ccb_h.status;
@@ -1670,9 +1661,7 @@ ata_device_transport(struct cam_path *path)
struct ata_params *ident_buf = NULL;
 
/* Get transport information from the SIM */
-   xpt_setup_ccb(_h, path, CAM_PRIORITY_NONE);
-   cpi.ccb_h.func_code = XPT_PATH_INQ;
-   xpt_action((union ccb *));
+   xpt_path_inq(, path);
 
path->device->transport = cpi.transport;
if ((path->device->flags & CAM_DEV_INQUIRY_DATA_VALID) != 0)
@@ -1967,9 +1956,7 @@ ata_set_transfer_settings(struct ccb_trans_settings *c
scsi = >proto_specific.scsi;
else
scsi = NULL;
-   xpt_setup_ccb(_h, path, CAM_PRIORITY_NONE);
-   cpi.ccb_h.func_code = XPT_PATH_INQ;
-   xpt_action((union ccb *));
+   xpt_path_inq(, path);
 
/* Sanity checking */
if ((cpi.hba_inquiry & PI_TAG_ABLE) == 0
@@ -2101,9 +2088,7 @@ ata_announce_periph(struct cam_periph *periph)
if ((cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)
return;
/* Ask the SIM for its base transfer speed */
-   xpt_setup_ccb(_h, path, CAM_PRIORITY_NORMAL);
-   cpi.ccb_h.func_code = XPT_PATH_INQ;
-   xpt_action((union ccb *));
+   xpt_path_inq(, path);
/* Report connection speed */

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

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 22:11:01 2019
New Revision: 350803
URL: https://svnweb.freebsd.org/changeset/base/350803

Log:
  MFC r350214: Unify BTL parsing for `camcontrol debug` and `reset`.
  
  This makes `camcontrol debug` also allow peripheral device specification.
  
  While there, make BTL parser more strict and switch from strtok() to
  strsep().

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

Modified: stable/11/sbin/camcontrol/camcontrol.8
==
--- stable/11/sbin/camcontrol/camcontrol.8  Thu Aug  8 22:09:32 2019
(r350802)
+++ stable/11/sbin/camcontrol/camcontrol.8  Thu Aug  8 22:11:01 2019
(r350803)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 19, 2019
+.Dd July 22, 2019
 .Dt CAMCONTROL 8
 .Os
 .Sh NAME
@@ -185,7 +185,7 @@
 .Op Fl X
 .Op Fl c
 .Op Fl p
-.Aq all|off|bus Ns Op :target Ns Op :lun
+.Aq all | off | device id | bus Ns Op :target Ns Op :lun
 .Nm
 .Ic tags
 .Op device id

Modified: stable/11/sbin/camcontrol/camcontrol.c
==
--- stable/11/sbin/camcontrol/camcontrol.c  Thu Aug  8 22:09:32 2019
(r350802)
+++ stable/11/sbin/camcontrol/camcontrol.c  Thu Aug  8 22:11:01 2019
(r350803)
@@ -3376,6 +3376,66 @@ atasecurity(struct cam_device *device, int retry_count
 #endif /* MINIMALISTIC */
 
 /*
+ * Convert periph name into a bus, target and lun.
+ *
+ * Returns the number of parsed components, or 0.
+ */
+static int
+parse_btl_name(char *tstr, path_id_t *bus, target_id_t *target, lun_id_t *lun,
+cam_argmask *arglst)
+{
+   int fd;
+   union ccb ccb;
+
+   bzero(, sizeof(ccb));
+   ccb.ccb_h.func_code = XPT_GDEVLIST;
+   if (cam_get_device(tstr, ccb.cgdl.periph_name,
+   sizeof(ccb.cgdl.periph_name), _number) == -1) {
+   warnx("%s", cam_errbuf);
+   return (0);
+   }
+
+   /*
+* Attempt to get the passthrough device.  This ioctl will
+* fail if the device name is null, if the device doesn't
+* exist, or if the passthrough driver isn't in the kernel.
+*/
+   if ((fd = open(XPT_DEVICE, O_RDWR)) == -1) {
+   warn("Unable to open %s", XPT_DEVICE);
+   return (0);
+   }
+   if (ioctl(fd, CAMGETPASSTHRU, ) == -1) {
+   warn("Unable to find bus:target:lun for device %s%d",
+   ccb.cgdl.periph_name, ccb.cgdl.unit_number);
+   close(fd);
+   return (0);
+   }
+   close(fd);
+   if ((ccb.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
+   const struct cam_status_entry *entry;
+
+   entry = cam_fetch_status_entry(ccb.ccb_h.status);
+   warnx("Unable to find bus:target_lun for device %s%d, "
+   "CAM status: %s (%#x)",
+   ccb.cgdl.periph_name, ccb.cgdl.unit_number,
+   entry ? entry->status_text : "Unknown",
+   ccb.ccb_h.status);
+   return (0);
+   }
+
+   /*
+* The kernel fills in the bus/target/lun.  We don't
+* need the passthrough device name and unit number since
+* we aren't going to open it.
+*/
+   *bus = ccb.ccb_h.path_id;
+   *target = ccb.ccb_h.target_id;
+   *lun = ccb.ccb_h.target_lun;
+   *arglst |= CAM_ARG_BUS | CAM_ARG_TARGET | CAM_ARG_LUN;
+   return (3);
+}
+
+/*
  * Parse out a bus, or a bus, target and lun in the following
  * format:
  * bus
@@ -3388,25 +3448,43 @@ static int
 parse_btl(char *tstr, path_id_t *bus, target_id_t *target, lun_id_t *lun,
 cam_argmask *arglst)
 {
-   char *tmpstr;
+   char *tmpstr, *end;
int convs = 0;
 
+   *bus = CAM_BUS_WILDCARD;
+   *target = CAM_TARGET_WILDCARD;
+   *lun = CAM_LUN_WILDCARD;
+
while (isspace(*tstr) && (*tstr != '\0'))
tstr++;
 
-   tmpstr = (char *)strtok(tstr, ":");
+   if (strncasecmp(tstr, "all", strlen("all")) == 0) {
+   arglist |= CAM_ARG_BUS;
+   return (1);
+   }
+
+   if (!isdigit(*tstr))
+   return (parse_btl_name(tstr, bus, target, lun, arglst));
+
+   tmpstr = strsep(, ":");
if ((tmpstr != NULL) && (*tmpstr != '\0')) {
-   *bus = strtol(tmpstr, NULL, 0);
+   *bus = strtol(tmpstr, , 0);
+   if (*end != '\0')
+   return (0);
*arglst |= CAM_ARG_BUS;
convs++;
-   tmpstr = (char *)strtok(NULL, ":");
+   tmpstr = strsep(, ":");
if ((tmpstr != NULL) && (*tmpstr != '\0')) {
-   *target = strtol(tmpstr, NULL, 0);
+   *target = strtol(tmpstr, , 0);
+   if (*end != 

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

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 22:09:32 2019
New Revision: 350802
URL: https://svnweb.freebsd.org/changeset/base/350802

Log:
  MFC r350150: Properly report ACS revisions alike to kernel.

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

Modified: stable/11/sbin/camcontrol/camcontrol.c
==
--- stable/11/sbin/camcontrol/camcontrol.c  Thu Aug  8 22:08:54 2019
(r350801)
+++ stable/11/sbin/camcontrol/camcontrol.c  Thu Aug  8 22:09:32 2019
(r350802)
@@ -1330,6 +1330,7 @@ atasata(struct ata_params *parm)
 static void
 atacapprint(struct ata_params *parm)
 {
+   const char *proto;
u_int32_t lbasize = (u_int32_t)parm->lba_size_1 |
((u_int32_t)parm->lba_size_2 << 16);
 
@@ -1340,7 +1341,19 @@ atacapprint(struct ata_params *parm)
 
printf("\n");
printf("protocol  ");
-   printf("ATA/ATAPI-%d", ata_version(parm->version_major));
+   proto = (parm->config == ATA_PROTO_CFA) ? "CFA" :
+   (parm->config & ATA_PROTO_ATAPI) ? "ATAPI" : "ATA";
+   if (ata_version(parm->version_major) == 0) {
+   printf("%s", proto);
+   } else if (ata_version(parm->version_major) <= 7) {
+   printf("%s-%d", proto,
+   ata_version(parm->version_major));
+   } else if (ata_version(parm->version_major) == 8) {
+   printf("%s8-ACS", proto);
+   } else {
+   printf("ACS-%d %s",
+   ata_version(parm->version_major) - 7, proto);
+   }
if (parm->satacapabilities && parm->satacapabilities != 0x) {
if (parm->satacapabilities & ATA_SATA_GEN3)
printf(" SATA 3.x\n");
___
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: r350801 - in stable/11: sbin/camcontrol sys/cam/ata sys/sys

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 22:08:54 2019
New Revision: 350801
URL: https://svnweb.freebsd.org/changeset/base/350801

Log:
  MFC r350149: Add Accessible Max Address Configuration support to camcontrol.
  
  AMA replaced HPA in ACS-3 specification.  It allows to limit size of the
  disk alike to HPA, but declares inaccessible data as indeterminate.  One
  of its practical use cases is to under-provision SATA SSDs for better
  reliability and performance.
  
  While there, fix HPA Security detection/reporting.
  
  Relnotes: yes

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

Modified: stable/11/sbin/camcontrol/camcontrol.8
==
--- stable/11/sbin/camcontrol/camcontrol.8  Thu Aug  8 22:06:40 2019
(r350800)
+++ stable/11/sbin/camcontrol/camcontrol.8  Thu Aug  8 22:08:54 2019
(r350801)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 22, 2019
+.Dd July 19, 2019
 .Dt CAMCONTROL 8
 .Os
 .Sh NAME
@@ -292,6 +292,13 @@
 .Op Fl U Ar pwd
 .Op Fl y
 .Nm
+.Ic ama
+.Op device id
+.Op generic args
+.Op Fl f
+.Op Fl q
+.Op Fl s Ar max_sectors
+.Nm
 .Ic persist
 .Op device id
 .Op generic args
@@ -1599,6 +1606,40 @@ without prompting for confirmation
 .Pp
 The password for all HPA commands is limited to 32 characters, longer passwords
 will fail.
+.It Ic ama
+Update or report Accessible Max Address Configuration.
+By default
+.Nm
+will print out the Accessible Max Address Configuration support and associated
+settings of the device.
+The
+.Ic ama
+command takes several optional arguments:
+.Bl -tag -width 0n
+.It Fl f
+.Pp
+Freeze the Accessible Max Address Configuration of the specified device.
+.Pp
+After command completion any other commands that update the configuration
+shall be command aborted.
+Frozen mode is disabled by power-off.
+.It Fl q
+.Pp
+Be quiet, do not print any status messages.
+.It Fl s Ar max_sectors
+.Pp
+Configures the maximum user accessible sectors of the device.
+This will change the number of sectors the device reports.
+.Pp
+.Em WARNING! WARNING! WARNING!
+.Pp
+Changing the max sectors of a device using this option will make the data on
+the device beyond the specified value indeterminate.
+.Pp
+Only one successful
+.Fl s Ar max_sectors
+call can be made without a power-on reset of the device.
+.El
 .It Ic fwdownload
 Program firmware of the named
 .Tn SCSI

Modified: stable/11/sbin/camcontrol/camcontrol.c
==
--- stable/11/sbin/camcontrol/camcontrol.c  Thu Aug  8 22:06:40 2019
(r350800)
+++ stable/11/sbin/camcontrol/camcontrol.c  Thu Aug  8 22:08:54 2019
(r350801)
@@ -107,6 +107,7 @@ typedef enum {
CAM_CMD_TIMESTAMP   = 0x0028,
CAM_CMD_POWER_MODE  = 0x002a,
CAM_CMD_DEVTYPE = 0x002b,
+   CAM_CMD_AMA = 0x002c,
 } cam_cmdmask;
 
 typedef enum {
@@ -239,6 +240,7 @@ static struct camcontrol_opts option_table[] = {
{"fwdownload", CAM_CMD_DOWNLOAD_FW, CAM_ARG_NONE, "f:qsy"},
{"security", CAM_CMD_SECURITY, CAM_ARG_NONE, "d:e:fh:k:l:qs:T:U:y"},
{"hpa", CAM_CMD_HPA, CAM_ARG_NONE, "Pflp:qs:U:y"},
+   {"ama", CAM_CMD_AMA, CAM_ARG_NONE, "fqs:"},
{"persist", CAM_CMD_PERSIST, CAM_ARG_NONE, "ai:I:k:K:o:ps:ST:U"},
{"attrib", CAM_CMD_ATTRIB, CAM_ARG_NONE, "a:ce:F:p:r:s:T:w:V:"},
{"opcodes", CAM_CMD_OPCODES, CAM_ARG_NONE, "No:s:T"},
@@ -358,6 +360,8 @@ static int atasecurity(struct cam_device *device, int 
   int argc, char **argv, char *combinedopt);
 static int atahpa(struct cam_device *device, int retry_count, int timeout,
  int argc, char **argv, char *combinedopt);
+static int ataama(struct cam_device *device, int retry_count, int timeout,
+ int argc, char **argv, char *combinedopt);
 static int scsiprintoneopcode(struct cam_device *device, int req_opcode,
  int sa_set, int req_sa, uint8_t *buf,
  uint32_t valid_len);
@@ -1275,8 +1279,9 @@ atahpa_print(struct ata_params *parm, u_int64_t hpasiz
lba, hpasize);
 
printf("HPA - Security ");
-   if (parm->support.command1 & ATA_SUPPORT_MAXSECURITY)
-   printf("yes\n");
+   if (parm->support.command2 & ATA_SUPPORT_MAXSECURITY)
+   printf("yes  %s\n", (parm->enabled.command2 &
+   ATA_SUPPORT_MAXSECURITY) ? "yes" : "no ");
else
printf("no\n");
} else {
@@ -1284,6 +1289,32 @@ atahpa_print(struct ata_params *parm, u_int64_t hpasiz
}
 }
 
+static void
+ataama_print(struct ata_params 

svn commit: r350800 - stable/11/sys/sys

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 22:06:40 2019
New Revision: 350800
URL: https://svnweb.freebsd.org/changeset/base/350800

Log:
  MFC r348376 (by rpokala):
  Add bits related to SANITIZE, SED, and form-factor to (struct ata_params)
  
  Based on ATA-ACS-4, recognize several bit-fields related to the ATA SANITIZE
  feature-set, Self-Encrypting Drives, and form-factor identification.
  
  As part of this change, the name of word 48 of (struct ata_params) is being
  changed. The previous name, "usedmovsd" does not appear to be related to the
  previous definition of the word ("double-word IO supported"). The word was
  defined that way in ATA-1 (1994), but it was marked "Reserved" (meaning
  "unused, but might be used in the future") in ATA-2 (1996). It stayed that
  way until ATA-8 (2008), which re-defined it as implemented in this change.
  The field is not used in-tree.

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

Modified: stable/11/sys/sys/ata.h
==
--- stable/11/sys/sys/ata.h Thu Aug  8 22:05:39 2019(r350799)
+++ stable/11/sys/sys/ata.h Thu Aug  8 22:06:40 2019(r350800)
@@ -64,7 +64,8 @@ struct ata_params {
 /*023*/ u_int8_trevision[8];/* firmware revision */
 /*027*/ u_int8_tmodel[40];  /* model name */
 /*047*/ u_int16_t   sectors_intr;   /* sectors per interrupt */
-/*048*/ u_int16_t   usedmovsd;  /* double word read/write? */
+/*048*/ u_int16_t   tcg;/* Trusted Computing Group */
+#define ATA_SUPPORT_TCG 0x0001
 /*049*/ u_int16_t   capabilities1;
 #define ATA_SUPPORT_DMA 0x0100
 #define ATA_SUPPORT_LBA 0x0200
@@ -90,6 +91,10 @@ struct ata_params {
 /*057*/ u_int16_t   current_size_1;
 /*058*/ u_int16_t   current_size_2;
 /*059*/ u_int16_t   multi;
+#define ATA_SUPPORT_BLOCK_ERASE_EXT 0x8000
+#define ATA_SUPPORT_OVERWRITE_EXT   0x4000
+#define ATA_SUPPORT_CRYPTO_SCRAMBLE_EXT 0x2000
+#define ATA_SUPPORT_SANITIZE0x1000
 #define ATA_MULTI_VALID 0x0100
 
 /*060*/ u_int16_t   lba_size_1;
@@ -105,6 +110,7 @@ struct ata_params {
 /*069*/ u_int16_t   support3;
 #define ATA_SUPPORT_RZAT0x0020
 #define ATA_SUPPORT_DRAT0x4000
+#define ATA_ENCRYPTS_ALL_USER_DATA  0x0010  /* Self-encrypting drive */
 #defineATA_SUPPORT_ZONE_MASK   0x0003
 #defineATA_SUPPORT_ZONE_NR 0x
 #defineATA_SUPPORT_ZONE_HOST_AWARE 0x0001
@@ -257,7 +263,19 @@ struct ata_params {
 /*162*/ u_int16_t   cfa_kms_support;
 /*163*/ u_int16_t   cfa_trueide_modes;
 /*164*/ u_int16_t   cfa_memory_modes;
-   u_int16_t   reserved165[4];
+   u_int16_t   reserved165[3];
+/*168*/ u_int16_t   form_factor;
+#define ATA_FORM_FACTOR_MASK   0x000f
+#define ATA_FORM_FACTOR_NOT_REPORTED   0x
+#define ATA_FORM_FACTOR_5_25   0x0001
+#define ATA_FORM_FACTOR_3_50x0002
+#define ATA_FORM_FACTOR_2_50x0003
+#define ATA_FORM_FACTOR_1_80x0004
+#define ATA_FORM_FACTOR_SUB_1_80x0005
+#define ATA_FORM_FACTOR_MSATA  0x0006
+#define ATA_FORM_FACTOR_M_20x0007
+#define ATA_FORM_FACTOR_MICRO_SSD  0x0008
+#define ATA_FORM_FACTOR_C_FAST 0x0009
 /*169*/u_int16_t   support_dsm;
 #define ATA_SUPPORT_DSM_TRIM   0x0001
u_int16_t   reserved170[6];
___
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: r350799 - stable/11/sys/sys

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 22:05:39 2019
New Revision: 350799
URL: https://svnweb.freebsd.org/changeset/base/350799

Log:
  MFC r312212 (by cem): Fix a minor typo (Seiral)

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

Modified: stable/11/sys/sys/ata.h
==
--- stable/11/sys/sys/ata.h Thu Aug  8 22:03:36 2019(r350798)
+++ stable/11/sys/sys/ata.h Thu Aug  8 22:05:39 2019(r350799)
@@ -693,7 +693,7 @@ struct atapi_sense {
 #defineATA_IDL_ATA_STRINGS 0x05/* ATA Strings */
 #defineATA_IDL_SECURITY0x06/* Security */
 #defineATA_IDL_PARALLEL_ATA0x07/* Parallel ATA */
-#defineATA_IDL_SERIAL_ATA  0x08/* Seiral ATA */
+#defineATA_IDL_SERIAL_ATA  0x08/* Serial ATA */
 #defineATA_IDL_ZDI 0x09/* Zoned Device Information */
 
 struct ata_gp_log_dir {
___
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: r350798 - stable/11/sbin/camcontrol

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 22:03:36 2019
New Revision: 350798
URL: https://svnweb.freebsd.org/changeset/base/350798

Log:
  MFC r350020 (by imp): Use a different approach to range check.
  
  gcc hates dt < CC_DT_NONE since it can never be true when dt is an unsigned
  type. Since that's a compiler choice and may be affected by weird stuff, 
instead
  use (unsigned)dt > CC_DT_UNKNOWN to test for bounds error since that will work
  regardless of the signedness of dt.

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

Modified: stable/11/sbin/camcontrol/camcontrol.c
==
--- stable/11/sbin/camcontrol/camcontrol.c  Thu Aug  8 22:03:01 2019
(r350797)
+++ stable/11/sbin/camcontrol/camcontrol.c  Thu Aug  8 22:03:36 2019
(r350798)
@@ -691,7 +691,7 @@ getdevtype(struct cam_device *cam_dev)
 * Get the device type and report it, request no I/O be done to do this.
 */
error = get_device_type(cam_dev, -1, 0, 0, );
-   if (error != 0 || dt < CC_DT_NONE || dt > CC_DT_UNKNOWN) {
+   if (error != 0 || (unsigned)dt > CC_DT_UNKNOWN) {
fprintf(stdout, "illegal\n");
return (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: r350797 - stable/11/sbin/camcontrol

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 22:03:01 2019
New Revision: 350797
URL: https://svnweb.freebsd.org/changeset/base/350797

Log:
  MFC r350018 (by imp): Implement a devtype command.
  
  List the device's protocol. The returned value is one of the following:
  ata direct attach ATA or SATA device
  satla SATA device attached via SAS
  scsiA parallel SCSI or SAS
  nvmeA direct attached NVMe device
  mmcsd   A MMC or SD attached device

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

Modified: stable/11/sbin/camcontrol/camcontrol.8
==
--- stable/11/sbin/camcontrol/camcontrol.8  Thu Aug  8 21:55:49 2019
(r350796)
+++ stable/11/sbin/camcontrol/camcontrol.8  Thu Aug  8 22:03:01 2019
(r350797)
@@ -353,6 +353,9 @@
 .Op generic args
 .Ao Fl r Oo Ns Fl f Ar format | Fl m | Fl U Oc | Fl s Ao Fl f Ar format Fl T 
Ar time | Fl U Ac Ac
 .Nm
+.Ic devtype
+.Op device id
+.Nm
 .Ic help
 .Sh DESCRIPTION
 The
@@ -2515,6 +2518,26 @@ option.
 .It Fl U
 Set the timestamp to the host system's time in UTC.
 .El
+.El
+.It Ic devtype
+Print out the device type for specified device.
+.Bl -tag -width 10n
+.It ata
+An ATA device attached directly to an ATA controller
+.It satl
+An SATA device attached behind a SAS controller via SCSI-ATA Translation Layer 
(SATL)
+.It scsi
+A SCSI device
+.It nvme
+An directly attached NVMe device
+.It mmcsd
+An MMC or SD device attached via a mmcsd bus
+.It none
+No device type reported
+.It unknown
+Device type is unknown
+.It illegal
+A programming error occurred
 .El
 .It Ic help
 Print out verbose usage information.

Modified: stable/11/sbin/camcontrol/camcontrol.c
==
--- stable/11/sbin/camcontrol/camcontrol.c  Thu Aug  8 21:55:49 2019
(r350796)
+++ stable/11/sbin/camcontrol/camcontrol.c  Thu Aug  8 22:03:01 2019
(r350797)
@@ -106,6 +106,7 @@ typedef enum {
CAM_CMD_EPC = 0x0027,
CAM_CMD_TIMESTAMP   = 0x0028,
CAM_CMD_POWER_MODE  = 0x002a,
+   CAM_CMD_DEVTYPE = 0x002b,
 } cam_cmdmask;
 
 typedef enum {
@@ -219,6 +220,7 @@ static struct camcontrol_opts option_table[] = {
{"defectlist", CAM_CMD_READ_DEFECTS, CAM_ARG_NONE, readdefect_opts},
 #endif /* MINIMALISTIC */
{"devlist", CAM_CMD_DEVTREE, CAM_ARG_NONE, "-b"},
+   {"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:"},
@@ -267,6 +269,16 @@ struct cam_devlist {
 static cam_cmdmask cmdlist;
 static cam_argmask arglist;
 
+static const char *devtype_names[] = {
+   "none",
+   "scsi",
+   "satl",
+   "ata",
+   "nvme",
+   "mmcsd",
+   "unknown",
+};
+
 camcontrol_optret getoption(struct camcontrol_opts *table, char *arg,
uint32_t *cmdnum, cam_argmask *argnum,
const char **subopt);
@@ -274,6 +286,7 @@ camcontrol_optret getoption(struct camcontrol_opts *ta
 static int getdevlist(struct cam_device *device);
 #endif /* MINIMALISTIC */
 static int getdevtree(int argc, char **argv, char *combinedopt);
+static int getdevtype(struct cam_device *device);
 #ifndef MINIMALISTIC
 static int testunitready(struct cam_device *device, int task_attr,
 int retry_count, int timeout, int quiet);
@@ -668,6 +681,24 @@ getdevtree(int argc, char **argv, char *combinedopt)
return (error);
 }
 
+static int
+getdevtype(struct cam_device *cam_dev)
+{
+   camcontrol_devtype dt;
+   int error;
+
+   /*
+* Get the device type and report it, request no I/O be done to do this.
+*/
+   error = get_device_type(cam_dev, -1, 0, 0, );
+   if (error != 0 || dt < CC_DT_NONE || dt > CC_DT_UNKNOWN) {
+   fprintf(stdout, "illegal\n");
+   return (1);
+   }
+   fprintf(stdout, "%s\n", devtype_names[dt]);
+   return (0);
+}
+
 #ifndef MINIMALISTIC
 static int
 testunitready(struct cam_device *device, int task_attr, int retry_count,
@@ -5178,7 +5209,7 @@ get_device_type(struct cam_device *dev, int retry_coun
int verbosemode, camcontrol_devtype *devtype)
 {
struct ccb_getdev cgd;
-   int retval = 0;
+   int retval;
 
retval = get_cgd(dev, );
if (retval != 0)
@@ -5203,21 +5234,34 @@ get_device_type(struct cam_device *dev, int retry_coun
break; /*NOTREACHED*/
}
 
-   /*
-* Check for the ATA Information VPD page (0x89).  If this is an
-* ATA device behind a SCSI to ATA translation layer, this VPD page
-* should be present.
-*
-  

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

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 21:55:49 2019
New Revision: 350796
URL: https://svnweb.freebsd.org/changeset/base/350796

Log:
  MFC r350008 (by imp):
  Use the more proper term of SATL instead of ATA_BEHIND_SCSI.
  
  Most people know SAS attached SATA devices by the name SAT or SATL
  (with the latter being a little more common). Change the device type
  ATA_BEHIND_SCSI to SATL since it's more specific and meaningful.

Modified:
  stable/11/sbin/camcontrol/camcontrol.c
  stable/11/sbin/camcontrol/camcontrol.h
  stable/11/sbin/camcontrol/epc.c
  stable/11/sbin/camcontrol/fwdownload.c
  stable/11/sbin/camcontrol/zone.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/camcontrol/camcontrol.c
==
--- stable/11/sbin/camcontrol/camcontrol.c  Thu Aug  8 21:54:31 2019
(r350795)
+++ stable/11/sbin/camcontrol/camcontrol.c  Thu Aug  8 21:55:49 2019
(r350796)
@@ -5214,7 +5214,7 @@ get_device_type(struct cam_device *dev, int retry_coun
retval = dev_has_vpd_page(dev, SVPD_ATA_INFORMATION, retry_count,
  timeout, verbosemode);
if (retval == 1)
-   *devtype = CC_DT_ATA_BEHIND_SCSI;
+   *devtype = CC_DT_SATL;
else
*devtype = CC_DT_SCSI;
 

Modified: stable/11/sbin/camcontrol/camcontrol.h
==
--- stable/11/sbin/camcontrol/camcontrol.h  Thu Aug  8 21:54:31 2019
(r350795)
+++ stable/11/sbin/camcontrol/camcontrol.h  Thu Aug  8 21:55:49 2019
(r350796)
@@ -42,7 +42,7 @@ typedef enum {
 typedef enum {
CC_DT_NONE,
CC_DT_SCSI,
-   CC_DT_ATA_BEHIND_SCSI,
+   CC_DT_SATL,
CC_DT_ATA,
CC_DT_NVME,
CC_DT_MMCSD,

Modified: stable/11/sbin/camcontrol/epc.c
==
--- stable/11/sbin/camcontrol/epc.c Thu Aug  8 21:54:31 2019
(r350795)
+++ stable/11/sbin/camcontrol/epc.c Thu Aug  8 21:55:49 2019
(r350796)
@@ -767,7 +767,7 @@ epc(struct cam_device *device, int argc, char **argv, 
 
switch (devtype) {
case CC_DT_ATA:
-   case CC_DT_ATA_BEHIND_SCSI:
+   case CC_DT_SATL:
break;
default:
warnx("The epc subcommand only works with ATA protocol "

Modified: stable/11/sbin/camcontrol/fwdownload.c
==
--- stable/11/sbin/camcontrol/fwdownload.c  Thu Aug  8 21:54:31 2019
(r350795)
+++ stable/11/sbin/camcontrol/fwdownload.c  Thu Aug  8 21:55:49 2019
(r350796)
@@ -694,7 +694,7 @@ fw_check_device_ready(struct cam_device *dev, camcontr
 /*sense_len*/ SSD_FULL_SIZE,
 /*timeout*/ 5000);
break;
-   case CC_DT_ATA_BEHIND_SCSI:
+   case CC_DT_SATL:
case CC_DT_ATA: {
retval = build_ata_cmd(ccb,
 /*retries*/ 1,
@@ -853,7 +853,7 @@ fw_download_img(struct cam_device *cam_dev, struct fw_
timeout ? timeout : WB_TIMEOUT);/* timeout*/
break;
case CC_DT_ATA:
-   case CC_DT_ATA_BEHIND_SCSI: {
+   case CC_DT_SATL: {
uint32_toff;
 
off = (uint32_t)(pkt_ptr - buf);
@@ -969,7 +969,7 @@ fwdownload(struct cam_device *device, int argc, char *
errx(1, "Unable to determine device type");
 
if ((devtype == CC_DT_ATA)
-|| (devtype == CC_DT_ATA_BEHIND_SCSI)) {
+|| (devtype == CC_DT_SATL)) {
ccb = cam_getccb(device);
if (ccb == NULL) {
warnx("couldn't allocate CCB");

Modified: stable/11/sbin/camcontrol/zone.c
==
--- stable/11/sbin/camcontrol/zone.cThu Aug  8 21:54:31 2019
(r350795)
+++ stable/11/sbin/camcontrol/zone.cThu Aug  8 21:55:49 2019
(r350796)
@@ -466,7 +466,7 @@ restart_report:
/*timeout*/ timeout ? timeout : 6);
break;
case CC_DT_ATA:
-   case CC_DT_ATA_BEHIND_SCSI: {
+   case CC_DT_SATL: {
uint8_t command = 0;
uint8_t protocol = 0;
uint16_t features = 0, sector_count = 0;
@@ -558,7 +558,7 @@ restart_report:
/*timeout*/ timeout ? timeout : 6);
break;
case CC_DT_ATA:
-   case CC_DT_ATA_BEHIND_SCSI: {
+   case CC_DT_SATL: {
uint8_t command = 0;
uint8_t protocol = 0;
  

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

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 21:54:31 2019
New Revision: 350795
URL: https://svnweb.freebsd.org/changeset/base/350795

Log:
  MFC r349964 (by imp):
  Add device type NVME and device type MMCSD to get_device_type
  
  For completeness, add nvme and mmc/sd devices to the list of device
  types we know.

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

Modified: stable/11/sbin/camcontrol/camcontrol.c
==
--- stable/11/sbin/camcontrol/camcontrol.c  Thu Aug  8 21:47:40 2019
(r350794)
+++ stable/11/sbin/camcontrol/camcontrol.c  Thu Aug  8 21:54:31 2019
(r350795)
@@ -5193,6 +5193,10 @@ get_device_type(struct cam_device *dev, int retry_coun
*devtype = CC_DT_ATA;
goto bailout;
break; /*NOTREACHED*/
+   case PROTO_NVME:
+   *devtype = CC_DT_NVME;
+   goto bailout;
+   break; /*NOTREACHED*/
default:
*devtype = CC_DT_UNKNOWN;
goto bailout;

Modified: stable/11/sbin/camcontrol/camcontrol.h
==
--- stable/11/sbin/camcontrol/camcontrol.h  Thu Aug  8 21:47:40 2019
(r350794)
+++ stable/11/sbin/camcontrol/camcontrol.h  Thu Aug  8 21:54:31 2019
(r350795)
@@ -44,6 +44,8 @@ typedef enum {
CC_DT_SCSI,
CC_DT_ATA_BEHIND_SCSI,
CC_DT_ATA,
+   CC_DT_NVME,
+   CC_DT_MMCSD,
CC_DT_UNKNOWN
 } camcontrol_devtype;
 
___
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: r350794 - stable/11/sys/cam/ata

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 21:47:40 2019
New Revision: 350794
URL: https://svnweb.freebsd.org/changeset/base/350794

Log:
  MFC r349339 (by imp):
  Go ahead and completely fix the ata_params before calling the veto
  function. This breaks nothing that uses it in the tree since
  ata_params is ignored in storvsc_ada_probe_veto which is the only
  in-tree consumer.

Modified:
  stable/11/sys/cam/ata/ata_xpt.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/ata/ata_xpt.c
==
--- stable/11/sys/cam/ata/ata_xpt.c Thu Aug  8 21:46:36 2019
(r350793)
+++ stable/11/sys/cam/ata/ata_xpt.c Thu Aug  8 21:47:40 2019
(r350794)
@@ -884,22 +884,14 @@ noerror:
int16_t *ptr;
int veto = 0;
 
+   /*
+* Convert to host byte order, and fix the strings.
+*/
ident_buf = >ident_data;
for (ptr = (int16_t *)ident_buf;
 ptr < (int16_t *)ident_buf + sizeof(struct ata_params)/2; 
ptr++) {
*ptr = le16toh(*ptr);
}
-
-   /*
-* Allow others to veto this ATA disk attachment.  This
-* is mainly used by VMs, whose disk controllers may
-* share the disks with the simulated ATA controllers.
-*/
-   EVENTHANDLER_INVOKE(ada_probe_veto, path, ident_buf, );
-   if (veto) {
-   goto device_fail;
-   }
-
if (strncmp(ident_buf->model, "FX", 2) &&
strncmp(ident_buf->model, "NEC", 3) &&
strncmp(ident_buf->model, "Pioneer", 7) &&
@@ -914,6 +906,17 @@ noerror:
ata_bpack(ident_buf->revision, ident_buf->revision, 
sizeof(ident_buf->revision));
ata_btrim(ident_buf->serial, sizeof(ident_buf->serial));
ata_bpack(ident_buf->serial, ident_buf->serial, 
sizeof(ident_buf->serial));
+
+   /*
+* Allow others to veto this ATA disk attachment.  This
+* is mainly used by VMs, whose disk controllers may
+* share the disks with the simulated ATA controllers.
+*/
+   EVENTHANDLER_INVOKE(ada_probe_veto, path, ident_buf, );
+   if (veto) {
+   goto device_fail;
+   }
+
/* Device may need spin-up before IDENTIFY become valid. */
if ((ident_buf->specconf == 0x37c8 ||
 ident_buf->specconf == 0x738c) &&
___
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: r350793 - in stable/11/sys: cam/scsi dev/ahci

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 21:46:36 2019
New Revision: 350793
URL: https://svnweb.freebsd.org/changeset/base/350793

Log:
  MFC r349321: Improve AHCI Enclosure Management and SES interoperation.
  
  Since SES specs do not define mechanism to map enclosure slots to SATA
  disks, AHCI EM code I written many years ago appeared quite useless,
  that always bugged me.  I was thinking whether it was a good idea, but
  if LSI HBAs do that, why I shouldn't?
  
  This change introduces simple non-standard mechanism for the mapping
  into both AHCI EM and SES code, that makes AHCI EM on capable controllers
  (most of Intel's) a first-class SES citizen, allowing it to report disk
  physical path to GEOM, show devices inserted into each enclosure slot in
  `sesutil map` and `getencstat`, control locate and fault LEDs for specific
  devices with `sesutil locate adaX on` and `sesutil fault adaX on`, etc.
  
  I've successfully tested this on Supermicro X10DRH-i motherboard connected
  with sideband cable of its S-SATA Mini-SAS connector to SAS815TQ backplane.
  It can indicate with LEDs Locate, Fault and Rebuild/Remap SES statuses for
  each disk identical to real SES of Supermicro SAS2 backplanes.

Modified:
  stable/11/sys/cam/scsi/scsi_all.c
  stable/11/sys/cam/scsi/scsi_enc.c
  stable/11/sys/cam/scsi/scsi_enc.h
  stable/11/sys/cam/scsi/scsi_enc_internal.h
  stable/11/sys/cam/scsi/scsi_enc_safte.c
  stable/11/sys/cam/scsi/scsi_enc_ses.c
  stable/11/sys/cam/scsi/scsi_ses.h
  stable/11/sys/dev/ahci/ahci.c
  stable/11/sys/dev/ahci/ahci.h
  stable/11/sys/dev/ahci/ahciem.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/scsi/scsi_all.c
==
--- stable/11/sys/cam/scsi/scsi_all.c   Thu Aug  8 21:44:37 2019
(r350792)
+++ stable/11/sys/cam/scsi/scsi_all.c   Thu Aug  8 21:46:36 2019
(r350793)
@@ -5559,6 +5559,7 @@ scsi_devid_is_naa_ieee_reg(uint8_t *bufp)
 {
struct scsi_vpd_id_descriptor *descr;
struct scsi_vpd_id_naa_basic *naa;
+   int n;
 
descr = (struct scsi_vpd_id_descriptor *)bufp;
naa = (struct scsi_vpd_id_naa_basic *)descr->identifier;
@@ -5566,7 +5567,8 @@ scsi_devid_is_naa_ieee_reg(uint8_t *bufp)
return 0;
if (descr->length < sizeof(struct scsi_vpd_id_naa_ieee_reg))
return 0;
-   if ((naa->naa >> SVPD_ID_NAA_NAA_SHIFT) != SVPD_ID_NAA_IEEE_REG)
+   n = naa->naa >> SVPD_ID_NAA_NAA_SHIFT;
+   if (n != SVPD_ID_NAA_LOCAL_REG && n != SVPD_ID_NAA_IEEE_REG)
return 0;
return 1;
 }

Modified: stable/11/sys/cam/scsi/scsi_enc.c
==
--- stable/11/sys/cam/scsi/scsi_enc.c   Thu Aug  8 21:44:37 2019
(r350792)
+++ stable/11/sys/cam/scsi/scsi_enc.c   Thu Aug  8 21:46:36 2019
(r350793)
@@ -88,6 +88,9 @@ int enc_verbose = 0;
 SYSCTL_INT(_kern_cam_enc, OID_AUTO, verbose, CTLFLAG_RWTUN,
_verbose, 0, "Enable verbose logging");
 
+const char *elm_type_names[] = ELM_TYPE_NAMES;
+CTASSERT(nitems(elm_type_names) - 1 == ELMTYP_LAST);
+
 static struct periph_driver encdriver = {
enc_init, "ses",
TAILQ_HEAD_INITIALIZER(encdriver.units), /* generation */ 0
@@ -239,13 +242,19 @@ enc_async(void *callback_arg, uint32_t code, struct ca
struct enc_softc *softc;
 
softc = (struct enc_softc *)periph->softc;
-   if (xpt_path_path_id(periph->path) != path_id
-|| softc == NULL
-|| (softc->enc_flags & ENC_FLAG_INITIALIZED)
- == 0
-|| softc->enc_vec.device_found == NULL)
+
+   /* Check this SEP is ready. */
+   if (softc == NULL || (softc->enc_flags &
+ENC_FLAG_INITIALIZED) == 0 ||
+   softc->enc_vec.device_found == NULL)
continue;
 
+   /* Check this SEP may manage this device. */
+   if (xpt_path_path_id(periph->path) != path_id &&
+   (softc->enc_type != ENC_SEMB_SES ||
+cgd->protocol != PROTO_ATA))
+   continue;
+
softc->enc_vec.device_found(softc);
}
xpt_unlock_buses();
@@ -439,7 +448,7 @@ enc_ioctl(struct cdev *dev, u_long cmd, caddr_t arg_ad
encioc_element_t kelm;
kelm.elm_idx = i;
kelm.elm_subenc_id = cache->elm_map[i].subenclosure;
-   kelm.elm_type = cache->elm_map[i].enctype;
+ 

svn commit: r350792 - stable/11/sys/dev/ahci

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 21:44:37 2019
New Revision: 350792
URL: https://svnweb.freebsd.org/changeset/base/350792

Log:
  MFC r340092 (by imp): Implement ability to turn on/off PHYs for AHCI devices.
  
  As part of Chuck's work on fixing kernel crashes caused by disk I/O
  errors, it is useful to be able to trigger various kinds of
  errors. This patch allows causing an AHCI-attached disk to disappear,
  by having the driver keep the PHY disabled when the driver would
  otherwise enable the PHY. It also allows making the disk reappear by
  having the driver go back to setting the PHY enable/disable state as
  it normal would and simulating the hardware event that causes a bus
  rescan.

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

Modified: stable/11/sys/dev/ahci/ahci.c
==
--- stable/11/sys/dev/ahci/ahci.c   Thu Aug  8 21:43:00 2019
(r350791)
+++ stable/11/sys/dev/ahci/ahci.c   Thu Aug  8 21:44:37 2019
(r350792)
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -78,6 +79,8 @@ static void ahci_stop(struct ahci_channel *ch);
 static void ahci_clo(struct ahci_channel *ch);
 static void ahci_start_fr(struct ahci_channel *ch);
 static void ahci_stop_fr(struct ahci_channel *ch);
+static int ahci_phy_check_events(struct ahci_channel *ch, u_int32_t serr);
+static uint32_t ahci_ch_detval(struct ahci_channel *ch, uint32_t val);
 
 static int ahci_sata_connect(struct ahci_channel *ch);
 static int ahci_sata_phy_reset(struct ahci_channel *ch);
@@ -98,6 +101,13 @@ static MALLOC_DEFINE(M_AHCI, "AHCI driver", "AHCI driv
 #define RECOVERY_REQUEST_SENSE 2
 #define recovery_slot  spriv_field1
 
+static uint32_t
+ahci_ch_detval(struct ahci_channel *ch, uint32_t val)
+{
+
+   return ch->disablephy ? ATA_SC_DET_DISABLE : val;
+}
+
 int
 ahci_ctlr_setup(device_t dev)
 {
@@ -662,11 +672,38 @@ ahci_ch_probe(device_t dev)
 }
 
 static int
+ahci_ch_disablephy_proc(SYSCTL_HANDLER_ARGS)
+{
+   struct ahci_channel *ch;
+   int error, value;
+
+   ch = arg1;
+   value = ch->disablephy;
+   error = sysctl_handle_int(oidp, , 0, req);
+   if (error != 0 || req->newptr == NULL || (value != 0 && value != 1))
+   return (error);
+
+   mtx_lock(>mtx);
+   ch->disablephy = value;
+   if (value) {
+   ahci_ch_deinit(ch->dev);
+   } else {
+   ahci_ch_init(ch->dev);
+   ahci_phy_check_events(ch, ATA_SE_PHY_CHANGED | 
ATA_SE_EXCHANGED);
+   }
+   mtx_unlock(>mtx);
+
+   return (0);
+}
+
+static int
 ahci_ch_attach(device_t dev)
 {
struct ahci_controller *ctlr = device_get_softc(device_get_parent(dev));
struct ahci_channel *ch = device_get_softc(dev);
struct cam_devq *devq;
+   struct sysctl_ctx_list *ctx;
+   struct sysctl_oid *tree;
int rid, error, i, sata_rev = 0;
u_int32_t version;
 
@@ -784,6 +821,11 @@ ahci_ch_attach(device_t dev)
ahci_ch_pm, ch);
}
mtx_unlock(>mtx);
+   ctx = device_get_sysctl_ctx(dev);
+   tree = device_get_sysctl_tree(dev);
+   SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "disable_phy",
+   CTLFLAG_RW | CTLTYPE_UINT, ch, 0, ahci_ch_disablephy_proc, "IU",
+   "Disable PHY");
return (0);
 
 err3:
@@ -2494,7 +2536,7 @@ static int
 ahci_sata_phy_reset(struct ahci_channel *ch)
 {
int sata_rev;
-   uint32_t val;
+   uint32_t val, detval;
 
if (ch->listening) {
val = ATA_INL(ch->r_mem, AHCI_P_CMD);
@@ -2511,12 +2553,14 @@ ahci_sata_phy_reset(struct ahci_channel *ch)
val = ATA_SC_SPD_SPEED_GEN3;
else
val = 0;
+   detval = ahci_ch_detval(ch, ATA_SC_DET_RESET);
ATA_OUTL(ch->r_mem, AHCI_P_SCTL,
-   ATA_SC_DET_RESET | val |
+   detval | val |
ATA_SC_IPM_DIS_PARTIAL | ATA_SC_IPM_DIS_SLUMBER);
DELAY(1000);
+   detval = ahci_ch_detval(ch, ATA_SC_DET_IDLE);
ATA_OUTL(ch->r_mem, AHCI_P_SCTL,
-   ATA_SC_DET_IDLE | val | ((ch->pm_level > 0) ? 0 :
+   detval | val | ((ch->pm_level > 0) ? 0 :
(ATA_SC_IPM_DIS_PARTIAL | ATA_SC_IPM_DIS_SLUMBER)));
if (!ahci_sata_connect(ch)) {
if (ch->caps & AHCI_CAP_SSS) {

Modified: stable/11/sys/dev/ahci/ahci.h
==
--- stable/11/sys/dev/ahci/ahci.h   Thu Aug  8 21:43:00 2019
(r350791)
+++ stable/11/sys/dev/ahci/ahci.h   Thu Aug  8 21:44:37 2019
(r350792)
@@ -459,6 +459,8 @@ struct ahci_channel {
struct mtx_padalign mtx;/* state lock */
STAILQ_HEAD(, ccb_hdr)  doneq;  /* queue of completed CCBs 

svn commit: r350791 - stable/11/sys/dev/ahci

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 21:43:00 2019
New Revision: 350791
URL: https://svnweb.freebsd.org/changeset/base/350791

Log:
  MFC r336760 (by luporl): Fixed endianess issue in AHCI driver
  
  There were some bits that were being set in cmd_flags (a field of AHCI's
  command list structure) after cmd_flags was converted to little endian.
  On a big endian host, such as PowerPC, this would set the wrong bits.
  This was preventing AHCI driver from working on these hosts.

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

Modified: stable/11/sys/dev/ahci/ahci.c
==
--- stable/11/sys/dev/ahci/ahci.c   Thu Aug  8 21:38:53 2019
(r350790)
+++ stable/11/sys/dev/ahci/ahci.c   Thu Aug  8 21:43:00 2019
(r350791)
@@ -1528,6 +1528,7 @@ ahci_execute_transaction(struct ahci_slot *slot)
int fis_size, i, softreset;
uint8_t *fis = ch->dma.rfis + 0x40;
uint8_t val;
+   uint16_t cmd_flags;
 
/* Get a piece of the workspace for this request */
ctp = (struct ahci_cmd_tab *)
@@ -1541,12 +1542,12 @@ ahci_execute_transaction(struct ahci_slot *slot)
/* Setup the command list entry */
clp = (struct ahci_cmd_list *)
(ch->dma.work + AHCI_CL_OFFSET + (AHCI_CL_SIZE * slot->slot));
-   clp->cmd_flags = htole16(
+   cmd_flags =
(ccb->ccb_h.flags & CAM_DIR_OUT ? AHCI_CMD_WRITE : 0) |
(ccb->ccb_h.func_code == XPT_SCSI_IO ?
 (AHCI_CMD_ATAPI | AHCI_CMD_PREFETCH) : 0) |
(fis_size / sizeof(u_int32_t)) |
-   (port << 12));
+   (port << 12);
clp->prd_length = htole16(slot->dma.nsegs);
/* Special handling for Soft Reset command. */
if ((ccb->ccb_h.func_code == XPT_ATA_IO) &&
@@ -1557,7 +1558,7 @@ ahci_execute_transaction(struct ahci_slot *slot)
ahci_stop(ch);
ahci_clo(ch);
ahci_start(ch, 0);
-   clp->cmd_flags |= AHCI_CMD_RESET | AHCI_CMD_CLR_BUSY;
+   cmd_flags |= AHCI_CMD_RESET | AHCI_CMD_CLR_BUSY;
} else {
softreset = 2;
/* Prepare FIS receive area for check. */
@@ -1567,6 +1568,7 @@ ahci_execute_transaction(struct ahci_slot *slot)
} else
softreset = 0;
clp->bytecount = 0;
+   clp->cmd_flags = htole16(cmd_flags);
clp->cmd_table_phys = htole64(ch->dma.work_bus + AHCI_CT_OFFSET +
  (AHCI_CT_SIZE * slot->slot));
bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map,
___
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: r350790 - stable/11/sys/cam/scsi

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 21:38:53 2019
New Revision: 350790
URL: https://svnweb.freebsd.org/changeset/base/350790

Log:
  MFC r349292: Decouple enc/ses verbosity from bootverbose.
  
  I don't want to be regularly notified that my enclosure violates standards
  until there is some real problem I want to debug.

Modified:
  stable/11/sys/cam/scsi/scsi_enc.c
  stable/11/sys/cam/scsi/scsi_enc_internal.h
  stable/11/sys/cam/scsi/scsi_enc_safte.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/scsi/scsi_enc.c
==
--- stable/11/sys/cam/scsi/scsi_enc.c   Thu Aug  8 21:38:13 2019
(r350789)
+++ stable/11/sys/cam/scsi/scsi_enc.c   Thu Aug  8 21:38:53 2019
(r350790)
@@ -80,6 +80,14 @@ static enctyp enc_type(struct ccb_getdev *);
 SYSCTL_NODE(_kern_cam, OID_AUTO, enc, CTLFLAG_RD, 0,
 "CAM Enclosure Services driver");
 
+#if defined(DEBUG) || defined(ENC_DEBUG)
+int enc_verbose = 1;
+#else
+int enc_verbose = 0;
+#endif
+SYSCTL_INT(_kern_cam_enc, OID_AUTO, verbose, CTLFLAG_RWTUN,
+   _verbose, 0, "Enable verbose logging");
+
 static struct periph_driver encdriver = {
enc_init, "ses",
TAILQ_HEAD_INITIALIZER(encdriver.units), /* generation */ 0

Modified: stable/11/sys/cam/scsi/scsi_enc_internal.h
==
--- stable/11/sys/cam/scsi/scsi_enc_internal.h  Thu Aug  8 21:38:13 2019
(r350789)
+++ stable/11/sys/cam/scsi/scsi_enc_internal.h  Thu Aug  8 21:38:53 2019
(r350790)
@@ -34,6 +34,8 @@
 #ifndef__SCSI_ENC_INTERNAL_H__
 #define__SCSI_ENC_INTERNAL_H__
 
+#include 
+
 typedef struct enc_element {
uint32_t
 enctype: 8,/* enclosure type */
@@ -199,6 +201,9 @@ enc_softc_init_tses_softc_init;
 /* SAF-TE interface */
 enc_softc_init_t   safte_softc_init;
 
+SYSCTL_DECL(_kern_cam_enc);
+extern int enc_verbose;
+
 /* Helper macros */
 MALLOC_DECLARE(M_SCSIENC);
 #defineENC_CFLAGS  CAM_RETRY_SELTO
@@ -211,7 +216,7 @@ MALLOC_DECLARE(M_SCSIENC);
 #else
 #defineENC_DLOGif (0) enc_log
 #endif
-#defineENC_VLOGif (bootverbose) enc_log
+#defineENC_VLOGif (enc_verbose) enc_log
 #defineENC_MALLOC(amt) malloc(amt, M_SCSIENC, M_NOWAIT)
 #defineENC_MALLOCZ(amt)malloc(amt, M_SCSIENC, M_ZERO|M_NOWAIT)
 /* Cast away const avoiding GCC warnings. */

Modified: stable/11/sys/cam/scsi/scsi_enc_safte.c
==
--- stable/11/sys/cam/scsi/scsi_enc_safte.c Thu Aug  8 21:38:13 2019
(r350789)
+++ stable/11/sys/cam/scsi/scsi_enc_safte.c Thu Aug  8 21:38:53 2019
(r350790)
@@ -225,7 +225,6 @@ static char *safte_2little = "Too Little Data Returned
}
 
 int emulate_array_devices = 1;
-SYSCTL_DECL(_kern_cam_enc);
 SYSCTL_INT(_kern_cam_enc, OID_AUTO, emulate_array_devices, CTLFLAG_RWTUN,
_array_devices, 0, "Emulate Array Devices for SAF-TE");
 
___
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: r350789 - stable/11/sys/cam/scsi

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 21:38:13 2019
New Revision: 350789
URL: https://svnweb.freebsd.org/changeset/base/350789

Log:
  MFC r349287: Remove ancient SCSI-2/3 mentioning.

Modified:
  stable/11/sys/cam/scsi/scsi_enc.c
  stable/11/sys/cam/scsi/scsi_enc_internal.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/scsi/scsi_enc.c
==
--- stable/11/sys/cam/scsi/scsi_enc.c   Thu Aug  8 21:37:26 2019
(r350788)
+++ stable/11/sys/cam/scsi/scsi_enc.c   Thu Aug  8 21:38:13 2019
(r350789)
@@ -683,14 +683,8 @@ enc_type(struct ccb_getdev *cgd)
buflen = min(sizeof(cgd->inq_data),
SID_ADDITIONAL_LENGTH(>inq_data));
 
-   if ((iqd[0] & 0x1f) == T_ENCLOSURE) {
-   if ((iqd[2] & 0x7) > 2) {
-   return (ENC_SES);
-   } else {
-   return (ENC_SES_SCSI2);
-   }
-   return (ENC_NONE);
-   }
+   if ((iqd[0] & 0x1f) == T_ENCLOSURE)
+   return (ENC_SES);
 
 #ifdef SES_ENABLE_PASSTHROUGH
if ((iqd[6] & 0x40) && (iqd[2] & 0x7) >= 2) {
@@ -926,7 +920,6 @@ enc_ctor(struct cam_periph *periph, void *arg)
 
switch (enc->enc_type) {
case ENC_SES:
-   case ENC_SES_SCSI2:
case ENC_SES_PASSTHROUGH:
case ENC_SEMB_SES:
err = ses_softc_init(enc);
@@ -1015,17 +1008,14 @@ enc_ctor(struct cam_periph *periph, void *arg)
case ENC_NONE:
tname = "No ENC device";
break;
-   case ENC_SES_SCSI2:
-   tname = "SCSI-2 ENC Device";
-   break;
case ENC_SES:
-   tname = "SCSI-3 ENC Device";
+   tname = "SES Device";
break;
 case ENC_SES_PASSTHROUGH:
-   tname = "ENC Passthrough Device";
+   tname = "SES Passthrough Device";
break;
 case ENC_SAFT:
-   tname = "SAF-TE Compliant Device";
+   tname = "SAF-TE Device";
break;
case ENC_SEMB_SES:
tname = "SEMB SES Device";

Modified: stable/11/sys/cam/scsi/scsi_enc_internal.h
==
--- stable/11/sys/cam/scsi/scsi_enc_internal.h  Thu Aug  8 21:37:26 2019
(r350788)
+++ stable/11/sys/cam/scsi/scsi_enc_internal.h  Thu Aug  8 21:38:13 2019
(r350789)
@@ -53,10 +53,8 @@ typedef struct enc_element {
 
 typedef enum {
ENC_NONE,
-   ENC_SES_SCSI2,
ENC_SES,
ENC_SES_PASSTHROUGH,
-   ENC_SEN,
ENC_SAFT,
ENC_SEMB_SES,
ENC_SEMB_SAFT
___
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: r350788 - stable/11/sys/cam/scsi

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 21:37:26 2019
New Revision: 350788
URL: https://svnweb.freebsd.org/changeset/base/350788

Log:
  MFC r349284: Make ELEMENT INDEX validation more strict.
  
  SES specifications tell: "The Additional Element Status descriptors shall
  be in the same order as the status elements in the Enclosure Status
  diagnostic page".  It allows us to question ELEMENT INDEX that is lower
  then values we already processed.  There are many SAS2 enclosures with
  this kind of problem.
  
  While there, add more specific error messages for cases when ELEMENT INDEX
  is obviously wrong.  Also skip elements with INVALID bit set.

Modified:
  stable/11/sys/cam/scsi/scsi_enc_ses.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/scsi/scsi_enc_ses.c
==
--- stable/11/sys/cam/scsi/scsi_enc_ses.c   Thu Aug  8 21:33:50 2019
(r350787)
+++ stable/11/sys/cam/scsi/scsi_enc_ses.c   Thu Aug  8 21:37:26 2019
(r350788)
@@ -1679,7 +1679,6 @@ ses_process_elm_addlstatus(enc_softc_t *enc, struct en
struct ses_iterator iter, titer;
int eip;
int err;
-   int ignore_index = 0;
int length;
int offset;
enc_cache_t *enc_cache;
@@ -1750,7 +1749,7 @@ ses_process_elm_addlstatus(enc_softc_t *enc, struct en
 
elm_hdr = (struct ses_elm_addlstatus_base_hdr *)[offset];
eip = ses_elm_addlstatus_eip(elm_hdr);
-   if (eip && !ignore_index) {
+   if (eip) {
struct ses_elm_addlstatus_eip_hdr *eip_hdr;
int expected_index, index;
ses_elem_index_type_t index_type;
@@ -1763,17 +1762,44 @@ ses_process_elm_addlstatus(enc_softc_t *enc, struct en
index_type = SES_ELEM_INDEX_INDIVIDUAL;
expected_index = iter.individual_element_index;
}
+   if (eip_hdr->element_index < expected_index) {
+   ENC_VLOG(enc, "%s: provided %selement index "
+   "%d is lower then expected %d\n",
+   __func__, (eip_hdr->byte2 &
+   SES_ADDL_EIP_EIIOE) ? "global " : "",
+   eip_hdr->element_index, expected_index);
+   goto badindex;
+   }
titer = iter;
telement = ses_iter_seek_to(,
eip_hdr->element_index, index_type);
-   if (telement != NULL &&
-   (ses_typehasaddlstatus(enc, titer.type_index) !=
-TYPE_ADDLSTATUS_NONE ||
-titer.type_index > ELMTYP_SAS_CONN)) {
+   if (telement == NULL) {
+   ENC_VLOG(enc, "%s: provided %selement index "
+   "%d does not exist\n", __func__,
+   (eip_hdr->byte2 & SES_ADDL_EIP_EIIOE) ?
+   "global " : "", eip_hdr->element_index);
+   goto badindex;
+   }
+   if (ses_typehasaddlstatus(enc, titer.type_index) ==
+   TYPE_ADDLSTATUS_NONE) {
+   ENC_VLOG(enc, "%s: provided %selement index "
+   "%d can't have additional status\n",
+   __func__,
+   (eip_hdr->byte2 & SES_ADDL_EIP_EIIOE) ?
+   "global " : "", eip_hdr->element_index);
+badindex:
+   /*
+* If we expected mandatory element, we may
+* guess it was just a wrong index and we may
+* use the status.  If element was optional,
+* then we have no idea where status belongs.
+*/
+   if (status_type == TYPE_ADDLSTATUS_OPTIONAL)
+   break;
+   } else {
iter = titer;
element = telement;
-   } else
-   ignore_index = 1;
+   }
 
if (eip_hdr->byte2 & SES_ADDL_EIP_EIIOE)
index = iter.global_element_index;
@@ -1795,35 +1821,41 @@ ses_process_elm_addlstatus(enc_softc_t *enc, struct en
"type element index=%d, offset=0x%x, "
"byte0=0x%x, length=0x%x\n", __func__,
iter.global_element_index, iter.type_index,
-  

svn commit: r350787 - stable/11/sys/cam/ctl

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 21:33:50 2019
New Revision: 350787
URL: https://svnweb.freebsd.org/changeset/base/350787

Log:
  MFC r349246: SPC-3 and up require some UAs to be returned as fixed.

Modified:
  stable/11/sys/cam/ctl/ctl_error.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/ctl/ctl_error.c
==
--- stable/11/sys/cam/ctl/ctl_error.c   Thu Aug  8 21:33:14 2019
(r350786)
+++ stable/11/sys/cam/ctl/ctl_error.c   Thu Aug  8 21:33:50 2019
(r350787)
@@ -79,6 +79,12 @@ ctl_set_sense_data_va(struct scsi_sense_data *sense_da
 */
if (sense_format == SSD_TYPE_NONE) {
/*
+* SPC-3 and up require some UAs to be returned as fixed.
+*/
+   if (asc == 0x29 || (asc == 0x2A && ascq == 0x01))
+   sense_format = SSD_TYPE_FIXED;
+   else
+   /*
 * If the format isn't specified, we only return descriptor
 * sense if the LUN exists and descriptor sense is turned
 * on for that LUN.
___
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: r350786 - stable/11/sys/cam

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 21:33:14 2019
New Revision: 350786
URL: https://svnweb.freebsd.org/changeset/base/350786

Log:
  MFC r349283 (by scottl):
  Refactor xpt_getattr() to make it more readable.  No outwardly
  visible functional changes, though code flow was modified a bit
  internally to lessen the need for goto jumps and chained if
  conditionals.

Modified:
  stable/11/sys/cam/cam_xpt.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/cam_xpt.c
==
--- stable/11/sys/cam/cam_xpt.c Thu Aug  8 21:32:26 2019(r350785)
+++ stable/11/sys/cam/cam_xpt.c Thu Aug  8 21:33:14 2019(r350786)
@@ -,6 +,7 @@ xpt_getattr(char *buf, size_t len, const char *attr, s
 {
int ret = -1, l, o;
struct ccb_dev_advinfo cdai;
+   struct scsi_vpd_device_id *did;
struct scsi_vpd_id_descriptor *idd;
 
xpt_path_assert(path, MA_OWNED);
@@ -1143,31 +1144,36 @@ xpt_getattr(char *buf, size_t len, const char *attr, s
cam_release_devq(cdai.ccb_h.path, 0, 0, 0, FALSE);
if (cdai.provsiz == 0)
goto out;
-   if (cdai.buftype == CDAI_TYPE_SCSI_DEVID) {
+   switch(cdai.buftype) {
+   case CDAI_TYPE_SCSI_DEVID:
+   did = (struct scsi_vpd_device_id *)cdai.buf;
if (strcmp(attr, "GEOM::lunid") == 0) {
-   idd = scsi_get_devid((struct scsi_vpd_device_id 
*)cdai.buf,
-   cdai.provsiz, scsi_devid_is_lun_naa);
+   idd = scsi_get_devid(did, cdai.provsiz,
+   scsi_devid_is_lun_naa);
if (idd == NULL)
-   idd = scsi_get_devid((struct scsi_vpd_device_id 
*)cdai.buf,
-   cdai.provsiz, scsi_devid_is_lun_eui64);
+   idd = scsi_get_devid(did, cdai.provsiz,
+   scsi_devid_is_lun_eui64);
if (idd == NULL)
-   idd = scsi_get_devid((struct scsi_vpd_device_id 
*)cdai.buf,
-   cdai.provsiz, scsi_devid_is_lun_uuid);
+   idd = scsi_get_devid(did, cdai.provsiz,
+   scsi_devid_is_lun_uuid);
if (idd == NULL)
-   idd = scsi_get_devid((struct scsi_vpd_device_id 
*)cdai.buf,
-   cdai.provsiz, scsi_devid_is_lun_md5);
+   idd = scsi_get_devid(did, cdai.provsiz,
+   scsi_devid_is_lun_md5);
} else
idd = NULL;
+
if (idd == NULL)
-   idd = scsi_get_devid((struct scsi_vpd_device_id 
*)cdai.buf,
-   cdai.provsiz, scsi_devid_is_lun_t10);
+   idd = scsi_get_devid(did, cdai.provsiz,
+   scsi_devid_is_lun_t10);
if (idd == NULL)
-   idd = scsi_get_devid((struct scsi_vpd_device_id 
*)cdai.buf,
-   cdai.provsiz, scsi_devid_is_lun_name);
+   idd = scsi_get_devid(did, cdai.provsiz,
+   scsi_devid_is_lun_name);
if (idd == NULL)
-   goto out;
+   break;
+
ret = 0;
-   if ((idd->proto_codeset & SVPD_ID_CODESET_MASK) == 
SVPD_ID_CODESET_ASCII) {
+   if ((idd->proto_codeset & SVPD_ID_CODESET_MASK) ==
+   SVPD_ID_CODESET_ASCII) {
if (idd->length < len) {
for (l = 0; l < idd->length; l++)
buf[l] = idd->identifier[l] ?
@@ -1175,38 +1181,46 @@ xpt_getattr(char *buf, size_t len, const char *attr, s
buf[l] = 0;
} else
ret = EFAULT;
-   } else if ((idd->proto_codeset & SVPD_ID_CODESET_MASK) == 
SVPD_ID_CODESET_UTF8) {
+   break;
+   }
+   if ((idd->proto_codeset & SVPD_ID_CODESET_MASK) ==
+   SVPD_ID_CODESET_UTF8) {
l = strnlen(idd->identifier, idd->length);
if (l < len) {
bcopy(idd->identifier, buf, l);
buf[l] = 0;
} else
ret = EFAULT;
-   } else if ((idd->id_type & SVPD_ID_TYPE_MASK) == 
SVPD_ID_TYPE_UUID
-   && idd->identifier[0] == 0x10) {
-   if ((idd->length - 2) * 2 + 4 < len) {
-   for (l = 2, o = 0; l < idd->length; l++) {
-   if (l == 6 || l == 8 || l == 10 

svn commit: r350785 - stable/11/sys/cam

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 21:32:26 2019
New Revision: 350785
URL: https://svnweb.freebsd.org/changeset/base/350785

Log:
  MFC r349243: Optimize xpt_getattr().
  
  Do not allocate temporary buffer for attributes we are going to return
  as-is, just make sure to NUL-terminate them.  Do not zero temporary 64KB
  buffer for CDAI_TYPE_SCSI_DEVID, XPT tells us how much data it filled
  and there are also length fields inside the returned data also.

Modified:
  stable/11/sys/cam/cam_xpt.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/cam_xpt.c
==
--- stable/11/sys/cam/cam_xpt.c Thu Aug  8 21:31:23 2019(r350784)
+++ stable/11/sys/cam/cam_xpt.c Thu Aug  8 21:32:26 2019(r350785)
@@ -1120,6 +1120,7 @@ xpt_getattr(char *buf, size_t len, const char *attr, s
cdai.ccb_h.func_code = XPT_DEV_ADVINFO;
cdai.flags = CDAI_FLAG_NONE;
cdai.bufsiz = len;
+   cdai.buf = buf;
 
if (!strcmp(attr, "GEOM::ident"))
cdai.buftype = CDAI_TYPE_SERIAL_NUM;
@@ -1129,14 +1130,14 @@ xpt_getattr(char *buf, size_t len, const char *attr, s
 strcmp(attr, "GEOM::lunname") == 0) {
cdai.buftype = CDAI_TYPE_SCSI_DEVID;
cdai.bufsiz = CAM_SCSI_DEVID_MAXLEN;
+   cdai.buf = malloc(cdai.bufsiz, M_CAMXPT, M_NOWAIT);
+   if (cdai.buf == NULL) {
+   ret = ENOMEM;
+   goto out;
+   }
} else
goto out;
 
-   cdai.buf = malloc(cdai.bufsiz, M_CAMXPT, M_NOWAIT|M_ZERO);
-   if (cdai.buf == NULL) {
-   ret = ENOMEM;
-   goto out;
-   }
xpt_action((union ccb *)); /* can only be synchronous */
if ((cdai.ccb_h.status & CAM_DEV_QFRZN) != 0)
cam_release_devq(cdai.ccb_h.path, 0, 0, 0, FALSE);
@@ -1201,13 +1202,15 @@ xpt_getattr(char *buf, size_t len, const char *attr, s
ret = EFAULT;
}
} else {
-   ret = 0;
-   if (strlcpy(buf, cdai.buf, len) >= len)
+   if (cdai.provsiz < len) {
+   cdai.buf[cdai.provsiz] = 0;
+   ret = 0;
+   } else
ret = EFAULT;
}
 
 out:
-   if (cdai.buf != NULL)
+   if ((char *)cdai.buf != buf)
free(cdai.buf, M_CAMXPT);
return ret;
 }
___
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: r350784 - stable/11/sbin/camcontrol

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 21:31:23 2019
New Revision: 350784
URL: https://svnweb.freebsd.org/changeset/base/350784

Log:
  MFC r349010 (by imp): Increase the timeout for READ NATIVE MAX
  
  READ NATIVE MAX can take longer than a second if the queued NCQ I/Os
  take longer than a second to drain.

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

Modified: stable/11/sbin/camcontrol/camcontrol.c
==
--- stable/11/sbin/camcontrol/camcontrol.c  Thu Aug  8 21:30:44 2019
(r350783)
+++ stable/11/sbin/camcontrol/camcontrol.c  Thu Aug  8 21:31:23 2019
(r350784)
@@ -1892,7 +1892,7 @@ ata_read_native_max(struct cam_device *device, int ret
   /*sector_count*/0,
   /*data_ptr*/NULL,
   /*dxfer_len*/0,
-  timeout ? timeout : 1000,
+  timeout ? timeout : 5000,
   is48bit);
 
if (error)
___
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: r350783 - stable/11/sys/cam/scsi

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 21:30:44 2019
New Revision: 350783
URL: https://svnweb.freebsd.org/changeset/base/350783

Log:
  MFC r348963 (by imp): Minor white space changes.
  
  Remove trailing white space that's crept into this file.

Modified:
  stable/11/sys/cam/scsi/scsi_xpt.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/scsi/scsi_xpt.c
==
--- stable/11/sys/cam/scsi/scsi_xpt.c   Thu Aug  8 21:16:15 2019
(r350782)
+++ stable/11/sys/cam/scsi/scsi_xpt.c   Thu Aug  8 21:30:44 2019
(r350783)
@@ -1601,7 +1601,7 @@ probe_device_check:
start = strspn(serial_buf->serial_num, " ");
slen = serial_buf->length - start;
if (slen <= 0) {
-   /* 
+   /*
 * SPC5r05 says that an all-space serial
 * number means no product serial number
 * is available
@@ -2115,7 +2115,7 @@ scsi_scan_bus(struct cam_periph *periph, union ccb *re
CAM_GET_LUN(target->luns, 0, first);
if (first == 0 && scan_info->lunindex[target_id] == 0) {
scan_info->lunindex[target_id]++;
-   } 
+   }
 
/*
 * Skip any LUNs that the HBA can't deal with.
@@ -2600,7 +2600,7 @@ scsi_dev_advinfo(union ccb *start_ccb)
 * We fetch extended inquiry data during probe, if
 * available.  We don't allow changing it.
 */
-   if (cdai->flags & CDAI_FLAG_STORE) 
+   if (cdai->flags & CDAI_FLAG_STORE)
return;
cdai->provsiz = device->ext_inq_len;
if (device->ext_inq_len == 0)
@@ -2992,7 +2992,7 @@ scsi_dev_async(u_int32_t async_code, struct cam_eb *bu
 */
if (async_code == AC_SENT_BDR
 || async_code == AC_BUS_RESET) {
-   cam_freeze_devq(); 
+   cam_freeze_devq();
cam_release_devq(,
RELSIM_RELEASE_AFTER_TIMEOUT,
/*reduction*/0,
@@ -3052,7 +3052,7 @@ scsi_announce_periph(struct cam_periph *periph)
xpt_setup_ccb(_h, path, CAM_PRIORITY_NORMAL);
cpi.ccb_h.func_code = XPT_PATH_INQ;
xpt_action((union ccb *));
-   /* Report connection speed */ 
+   /* Report connection speed */
speed = cpi.base_transfer_speed;
freq = 0;
if (cts.ccb_h.status == CAM_REQ_CMP && cts.transport == XPORT_SPI) {
___
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: r350778 - head/sys/contrib/zstd/lib/common

2019-08-08 Thread Warner Losh
Thanks Conrad for upstreaming...

Warner

On Thu, Aug 8, 2019 at 3:29 PM Conrad Meyer  wrote:

> Thanks Warner for noticing and fixing this.
>
> I've sent the patch upstream to hopefully be addressed there as well:
>
> https://github.com/facebook/zstd/pull/1713
>
> Best,
> Conrad
>
> On Thu, Aug 8, 2019 at 1:09 PM Warner Losh  wrote:
> >
> > Author: imp
> > Date: Thu Aug  8 20:09:36 2019
> > New Revision: 350778
> > URL: https://svnweb.freebsd.org/changeset/base/350778
> >
> > Log:
> >   Stopgap fix for gcc platforms.
> >
> >   Our in-tree gcc doesn't have a no-tree-vectorize optimization knob, so
> we get a
> >   warning that it's unused. This causes the build to fail on all our gcc
> platforms.
> >   Add a quick version check as a stop-gap measure to get CI building
> again.
> >
> > Modified:
> >   head/sys/contrib/zstd/lib/common/compiler.h
> >
> > Modified: head/sys/contrib/zstd/lib/common/compiler.h
> >
> ==
> > --- head/sys/contrib/zstd/lib/common/compiler.h Thu Aug  8 20:07:38
> 2019(r350777)
> > +++ head/sys/contrib/zstd/lib/common/compiler.h Thu Aug  8 20:09:36
> 2019(r350778)
> > @@ -128,7 +128,7 @@
> >  }
> >
> >  /* vectorization */
> > -#if !defined(__clang__) && defined(__GNUC__)
> > +#if !defined(__clang__) && defined(__GNUC__) && __GNUC__ > 5
> >  #  define DONT_VECTORIZE __attribute__((optimize("no-tree-vectorize")))
> >  #else
> >  #  define DONT_VECTORIZE
> >
>
___
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: r350778 - head/sys/contrib/zstd/lib/common

2019-08-08 Thread Conrad Meyer
Thanks Warner for noticing and fixing this.

I've sent the patch upstream to hopefully be addressed there as well:

https://github.com/facebook/zstd/pull/1713

Best,
Conrad

On Thu, Aug 8, 2019 at 1:09 PM Warner Losh  wrote:
>
> Author: imp
> Date: Thu Aug  8 20:09:36 2019
> New Revision: 350778
> URL: https://svnweb.freebsd.org/changeset/base/350778
>
> Log:
>   Stopgap fix for gcc platforms.
>
>   Our in-tree gcc doesn't have a no-tree-vectorize optimization knob, so we 
> get a
>   warning that it's unused. This causes the build to fail on all our gcc 
> platforms.
>   Add a quick version check as a stop-gap measure to get CI building again.
>
> Modified:
>   head/sys/contrib/zstd/lib/common/compiler.h
>
> Modified: head/sys/contrib/zstd/lib/common/compiler.h
> ==
> --- head/sys/contrib/zstd/lib/common/compiler.h Thu Aug  8 20:07:38 2019  
>   (r350777)
> +++ head/sys/contrib/zstd/lib/common/compiler.h Thu Aug  8 20:09:36 2019  
>   (r350778)
> @@ -128,7 +128,7 @@
>  }
>
>  /* vectorization */
> -#if !defined(__clang__) && defined(__GNUC__)
> +#if !defined(__clang__) && defined(__GNUC__) && __GNUC__ > 5
>  #  define DONT_VECTORIZE __attribute__((optimize("no-tree-vectorize")))
>  #else
>  #  define DONT_VECTORIZE
>
___
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: r350782 - head/usr.bin/du

2019-08-08 Thread Mark Johnston
Author: markj
Date: Thu Aug  8 21:16:15 2019
New Revision: 350782
URL: https://svnweb.freebsd.org/changeset/base/350782

Log:
  Flesh out the STANDARDS and AUTHORS sections in the du(1) man page.
  
  PR:   239722
  Submitted by: Gordon Bergling 
  MFC after:3 days

Modified:
  head/usr.bin/du/du.1

Modified: head/usr.bin/du/du.1
==
--- head/usr.bin/du/du.1Thu Aug  8 21:15:02 2019(r350781)
+++ head/usr.bin/du/du.1Thu Aug  8 21:16:15 2019(r350782)
@@ -28,7 +28,7 @@
 .\"@(#)du.18.2 (Berkeley) 4/1/94
 .\" $FreeBSD$
 .\"
-.Dd August 8, 2017
+.Dd August 1, 2019
 .Dt DU 1
 .Os
 .Sh NAME
@@ -221,8 +221,78 @@ Also display a grand total at the end:
 .Xr fts 3 ,
 .Xr symlink 7 ,
 .Xr quot 8
+.Sh STANDARDS
+The
+.Nm
+utility is compliant with the
+.St -p1003.1-2008
+specification.
+.Pp
+The flags
+.Op Fl cdhP ,
+as well as the
+.Ev BLOCKSIZE
+environment variable,
+are extensions to that specification.
+.Pp
+The flag
+.Op Fl r
+is accepted but ignored, for compatibility with systems implementing
+the obsolete
+.St -xcu5
+standard.
 .Sh HISTORY
-A
+The
 .Nm
-command appeared in
+utility and its
+.Fl a
+and
+.Fl s
+options first appeared in
 .At v1 .
+.Pp
+The
+.Fl r
+option first appeared in
+.At III
+and is available since
+.Fx 3.5 .
+The
+.Fl k
+and
+.Fl x
+options first appeared in
+.Bx 4.3 Reno
+and
+.Fl H
+in
+.Bx 4.4 .
+The
+.Fl c
+and
+.Fl L
+options first appeared in the GNU fileutils;
+.Fl L
+and
+.Fl P
+are available since
+.Bx 4.4 Lite1 ,
+.Fl c
+since
+.Fx 2.2.6 .
+The
+.Fl d
+option first appeared in
+.Fx 2.2 ,
+.Fl h
+first appeared in
+.Fx 4.0 .
+.Sh AUTHORS
+.An -nosplit
+This version of
+.Nm
+was written by
+.An Chris Newcomb
+for
+.Bx 4.3 Reno
+in 1989.
___
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: r350781 - head/usr.bin/whois

2019-08-08 Thread Mark Johnston
Author: markj
Date: Thu Aug  8 21:15:02 2019
New Revision: 350781
URL: https://svnweb.freebsd.org/changeset/base/350781

Log:
  Update RFC references in the whois(1) man page.
  
  PR:   239720
  Submitted by: Gordon Bergling 
  MFC after:3 days

Modified:
  head/usr.bin/whois/whois.1

Modified: head/usr.bin/whois/whois.1
==
--- head/usr.bin/whois/whois.1  Thu Aug  8 21:08:13 2019(r350780)
+++ head/usr.bin/whois/whois.1  Thu Aug  8 21:15:02 2019(r350781)
@@ -28,7 +28,7 @@
 .\" From: @(#)whois.1  8.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd April 25, 2016
+.Dd August 1, 2019
 .Dt WHOIS 1
 .Os
 .Sh NAME
@@ -272,13 +272,21 @@ to return a brief description of its
 object type:
 .Pp
 .Dl Ic whois -r -- '-t domain'
-.Sh SEE ALSO
+.Sh STANDARDS
 .Rs
-.%A Ken Harrenstien
-.%A Vic White
+.%A K. Harrenstien
+.%A M. Stahl
+.%A E. Feinler
+.%D October 1985
+.%R RFC 954
 .%T NICNAME/WHOIS
-.%D 1 March 1982
-.%O RFC 812
+.Re
+.Pp
+.Rs
+.%A L. Daigle
+.%D September 2004
+.%R RFC 3912
+.%T WHOIS Protocol Specification
 .Re
 .Sh HISTORY
 The
___
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: r350678 - head/share/mk

2019-08-08 Thread Warner Losh
On Thu, Aug 8, 2019 at 1:49 PM Ed Maste  wrote:

> On Wed, 7 Aug 2019 at 12:19, Warner Losh  wrote:
> >
> > Author: imp
> > Date: Wed Aug  7 16:19:06 2019
> > New Revision: 350678
> > URL: https://svnweb.freebsd.org/changeset/base/350678
> >
> > Log:
> >   Enable nvme on aarch64
> >
> >   Don't mark nvme as broken on aarch64. It compiles, at least, and
> people are
> >   testing it out. This only enables the userland parts of the nvme stack.
>
> For BROKEN_OPTIONS we should probably list the archs where it is known
> to be broken instead?
>

Generally. At first, this was known working only on x86 due to how the
driver was written, so it made sense to whitelist. We're likely getting
close to black-listing in this case.

Warner
___
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: r350780 - head/usr.sbin/mountd

2019-08-08 Thread Mark Johnston
Author: markj
Date: Thu Aug  8 21:08:13 2019
New Revision: 350780
URL: https://svnweb.freebsd.org/changeset/base/350780

Log:
  Add a reference to the NFSv3 RFC.
  
  PR:   239721
  Submitted by: Gordon Bergling 
  MFC after:3 days

Modified:
  head/usr.sbin/mountd/mountd.8

Modified: head/usr.sbin/mountd/mountd.8
==
--- head/usr.sbin/mountd/mountd.8   Thu Aug  8 20:56:52 2019
(r350779)
+++ head/usr.sbin/mountd/mountd.8   Thu Aug  8 21:08:13 2019
(r350780)
@@ -28,7 +28,7 @@
 .\" @(#)mountd.8   8.4 (Berkeley) 4/28/95
 .\" $FreeBSD$
 .\"
-.Dd October 24, 2016
+.Dd August 1, 2019
 .Dt MOUNTD 8
 .Os
 .Sh NAME
@@ -54,7 +54,7 @@ server specification; see
 .%T "Network File System Protocol Specification" ,
 RFC1094, Appendix A and
 .%T "NFS: Network File System Version 3 Protocol Specification" ,
-Appendix I.
+RFC1813, Appendix I.
 .Pp
 The following options are available:
 .Bl -tag -width indent
___
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: r350779 - head/sbin/iscontrol

2019-08-08 Thread Mark Johnston
Author: markj
Date: Thu Aug  8 20:56:52 2019
New Revision: 350779
URL: https://svnweb.freebsd.org/changeset/base/350779

Log:
  Fix formatting.
  
  PR:   239726
  Submitted by: Gordon Bergling 
  MFC after:3 days

Modified:
  head/sbin/iscontrol/iscontrol.8

Modified: head/sbin/iscontrol/iscontrol.8
==
--- head/sbin/iscontrol/iscontrol.8 Thu Aug  8 20:09:36 2019
(r350778)
+++ head/sbin/iscontrol/iscontrol.8 Thu Aug  8 20:56:52 2019
(r350779)
@@ -129,7 +129,7 @@ RFC 3720
 The
 .Nm
 utility appeared in
-Fx 7.0 .
+.Fx 7.0 .
 .Sh BUGS
 .Nm
 should probably load the iscsi_initiator module if needed.
___
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: r350778 - head/sys/contrib/zstd/lib/common

2019-08-08 Thread Warner Losh
Author: imp
Date: Thu Aug  8 20:09:36 2019
New Revision: 350778
URL: https://svnweb.freebsd.org/changeset/base/350778

Log:
  Stopgap fix for gcc platforms.
  
  Our in-tree gcc doesn't have a no-tree-vectorize optimization knob, so we get 
a
  warning that it's unused. This causes the build to fail on all our gcc 
platforms.
  Add a quick version check as a stop-gap measure to get CI building again.

Modified:
  head/sys/contrib/zstd/lib/common/compiler.h

Modified: head/sys/contrib/zstd/lib/common/compiler.h
==
--- head/sys/contrib/zstd/lib/common/compiler.h Thu Aug  8 20:07:38 2019
(r350777)
+++ head/sys/contrib/zstd/lib/common/compiler.h Thu Aug  8 20:09:36 2019
(r350778)
@@ -128,7 +128,7 @@
 }
 
 /* vectorization */
-#if !defined(__clang__) && defined(__GNUC__)
+#if !defined(__clang__) && defined(__GNUC__) && __GNUC__ > 5
 #  define DONT_VECTORIZE __attribute__((optimize("no-tree-vectorize")))
 #else
 #  define DONT_VECTORIZE
___
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: r350777 - head/sys/kern

2019-08-08 Thread Rick Macklem
Author: rmacklem
Date: Thu Aug  8 20:07:38 2019
New Revision: 350777
URL: https://svnweb.freebsd.org/changeset/base/350777

Log:
  Remove some harmless cruft from vn_generic_copy_file_range().
  
  An earlier version of the patch had code that set "error" between
  line#s 2797-2799. When that code was moved, the second check for "error != 0"
  could never be true and the check became harmless cruft.
  This patch removes the cruft, mainly to make Coverity happy.
  
  Reported by:  asomers, cem

Modified:
  head/sys/kern/vfs_vnops.c

Modified: head/sys/kern/vfs_vnops.c
==
--- head/sys/kern/vfs_vnops.c   Thu Aug  8 19:53:07 2019(r350776)
+++ head/sys/kern/vfs_vnops.c   Thu Aug  8 20:07:38 2019(r350777)
@@ -2798,8 +2798,6 @@ vn_generic_copy_file_range(struct vnode *invp, off_t *
if (VOP_PATHCONF(invp, _PC_MIN_HOLE_SIZE, ) != 0)
holein = 0;
VOP_UNLOCK(invp, 0);
-   if (error != 0)
-   goto out;
 
mp = NULL;
error = vn_start_write(outvp, , V_WAIT);
___
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: r350776 - head/sys/kern

2019-08-08 Thread Rick Macklem
Author: rmacklem
Date: Thu Aug  8 19:53:07 2019
New Revision: 350776
URL: https://svnweb.freebsd.org/changeset/base/350776

Log:
  Fix copy_file_range(2) for an unlikely race during hole finding.
  
  Since the VOP_IOCTL(FIOSEEKDATA/FIOSEEKHOLE) calls are done with the
  vnode unlocked, it is possible for another thread to do:
  - truncate(), lseek(), write()
  between the two calls and create a hole where FIOSEEKDATA returned the
  start of data.
  For this case, VOP_IOCTL(FIOSEEKHOLE) will return the same offset for
  the hole location. This could result in an infinite loop in the copy
  code, since copylen is set to 0 and the copy doesn't advance.
  Usually, this race is avoided because of the use of rangelocks, but the
  NFS server does not do range locking and could do a sequence like the
  above to create the hole.
  
  This patch checks for this case and makes the hole search fail, to avoid
  the infinite loop.
  
  At this time, it is an open question as to whether or not the NFS server
  should do range locking to avoid this race.

Modified:
  head/sys/kern/vfs_vnops.c

Modified: head/sys/kern/vfs_vnops.c
==
--- head/sys/kern/vfs_vnops.c   Thu Aug  8 18:52:53 2019(r350775)
+++ head/sys/kern/vfs_vnops.c   Thu Aug  8 19:53:07 2019(r350776)
@@ -2895,6 +2895,17 @@ vn_generic_copy_file_range(struct vnode *invp, off_t *
endoff = startoff;
error = VOP_IOCTL(invp, FIOSEEKHOLE, , 0,
incred, curthread);
+   /*
+* Since invp is unlocked, it may be possible for
+* another thread to do a truncate(), lseek(), write()
+* creating a hole at startoff between the above
+* VOP_IOCTL() calls, if the other thread does not do
+* rangelocking.
+* If that happens, startoff == endoff and finding
+* the hole has failed, so set an error.
+*/
+   if (error == 0 && startoff == endoff)
+   error = EINVAL; /* Any error. Reset to 0. */
}
if (error == 0) {
if (startoff > *inoffp) {
___
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: r350678 - head/share/mk

2019-08-08 Thread Ed Maste
On Wed, 7 Aug 2019 at 12:19, Warner Losh  wrote:
>
> Author: imp
> Date: Wed Aug  7 16:19:06 2019
> New Revision: 350678
> URL: https://svnweb.freebsd.org/changeset/base/350678
>
> Log:
>   Enable nvme on aarch64
>
>   Don't mark nvme as broken on aarch64. It compiles, at least, and people are
>   testing it out. This only enables the userland parts of the nvme stack.

For BROKEN_OPTIONS we should probably list the archs where it is known
to be broken instead?
___
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: r350775 - stable/11/sys/cam/scsi

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 18:52:53 2019
New Revision: 350775
URL: https://svnweb.freebsd.org/changeset/base/350775

Log:
  MFC r348111: Simplify math added in r310524.
  
  Should be no functional change.

Modified:
  stable/11/sys/cam/scsi/scsi_all.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/scsi/scsi_all.c
==
--- stable/11/sys/cam/scsi/scsi_all.c   Thu Aug  8 18:48:48 2019
(r350774)
+++ stable/11/sys/cam/scsi/scsi_all.c   Thu Aug  8 18:52:53 2019
(r350775)
@@ -3941,7 +3941,7 @@ scsi_set_sense_data_fixed_va(struct scsi_sense_data *s
}
if (len > sizeof(sense->cmd_spec_info)) {
data += len - sizeof(sense->cmd_spec_info);
-   len -= len - sizeof(sense->cmd_spec_info);
+   len = sizeof(sense->cmd_spec_info);
}
bcopy(data, >cmd_spec_info[
sizeof(sense->cmd_spec_info) - len], len);
___
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: r350774 - stable/11/sbin/camcontrol

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 18:48:48 2019
New Revision: 350774
URL: https://svnweb.freebsd.org/changeset/base/350774

Log:
  MFC r346594 (by smh): Add ATA power mode support to camcontrol
  
  Add the ability to report ATA device power mode with the cmmand 'powermode'
  to compliment the existing ability to set it using idle, standby and sleep
  commands.

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

Modified: stable/11/sbin/camcontrol/camcontrol.8
==
--- stable/11/sbin/camcontrol/camcontrol.8  Thu Aug  8 18:42:39 2019
(r350773)
+++ stable/11/sbin/camcontrol/camcontrol.8  Thu Aug  8 18:48:48 2019
(r350774)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 12, 2019
+.Dd April 22, 2019
 .Dt CAMCONTROL 8
 .Os
 .Sh NAME
@@ -243,6 +243,10 @@
 .Op device id
 .Op generic args
 .Nm
+.Ic powermode
+.Op device id
+.Op generic args
+.Nm
 .Ic apm
 .Op device id
 .Op generic args
@@ -1388,6 +1392,8 @@ Value 0 disables timer.
 Put ATA device into SLEEP state.
 Note that the only way get device out of
 this state may be reset.
+.It Ic powermode
+Report ATA device power mode.
 .It Ic apm
 It optional parameter
 .Pq Fl l

Modified: stable/11/sbin/camcontrol/camcontrol.c
==
--- stable/11/sbin/camcontrol/camcontrol.c  Thu Aug  8 18:42:39 2019
(r350773)
+++ stable/11/sbin/camcontrol/camcontrol.c  Thu Aug  8 18:48:48 2019
(r350774)
@@ -104,7 +104,8 @@ typedef enum {
CAM_CMD_REPROBE = 0x0025,
CAM_CMD_ZONE= 0x0026,
CAM_CMD_EPC = 0x0027,
-   CAM_CMD_TIMESTAMP   = 0x0028
+   CAM_CMD_TIMESTAMP   = 0x0028,
+   CAM_CMD_POWER_MODE  = 0x002a,
 } cam_cmdmask;
 
 typedef enum {
@@ -230,6 +231,7 @@ static struct camcontrol_opts option_table[] = {
{"idle", CAM_CMD_IDLE, CAM_ARG_NONE, "t:"},
{"standby", CAM_CMD_STANDBY, CAM_ARG_NONE, "t:"},
{"sleep", CAM_CMD_SLEEP, CAM_ARG_NONE, ""},
+   {"powermode", CAM_CMD_POWER_MODE, CAM_ARG_NONE, ""},
{"apm", CAM_CMD_APM, CAM_ARG_NONE, "l:"},
{"aam", CAM_CMD_AAM, CAM_ARG_NONE, "l:"},
{"fwdownload", CAM_CMD_DOWNLOAD_FW, CAM_ARG_NONE, "f:qsy"},
@@ -8384,6 +8386,61 @@ bailout:
 }
 
 static int
+atapm_proc_resp(struct cam_device *device, union ccb *ccb)
+{
+struct ata_res *res;
+
+res = >ataio.res;
+if (res->status & ATA_STATUS_ERROR) {
+if (arglist & CAM_ARG_VERBOSE) {
+cam_error_print(device, ccb, CAM_ESF_ALL,
+CAM_EPF_ALL, stderr);
+printf("error = 0x%02x, sector_count = 0x%04x, "
+   "device = 0x%02x, status = 0x%02x\n",
+   res->error, res->sector_count,
+   res->device, res->status);
+}
+
+return (1);
+}
+
+if (arglist & CAM_ARG_VERBOSE) {
+fprintf(stdout, "%s%d: Raw native check power data:\n",
+device->device_name, device->dev_unit_num);
+/* res is 4 byte aligned */
+dump_data((uint16_t*)(uintptr_t)res, sizeof(struct ata_res));
+
+printf("error = 0x%02x, sector_count = 0x%04x, device = 0x%02x, "
+   "status = 0x%02x\n", res->error, res->sector_count,
+   res->device, res->status);
+}
+
+printf("%s%d: ", device->device_name, device->dev_unit_num);
+switch (res->sector_count) {
+case 0x00:
+   printf("Standby mode\n");
+   break;
+case 0x40:
+   printf("NV Cache Power Mode and the spindle is spun down or spinning 
down\n");
+   break;
+case 0x41:
+   printf("NV Cache Power Mode and the spindle is spun up or spinning 
up\n");
+   break;
+case 0x80:
+   printf("Idle mode\n");
+   break;
+case 0xff:
+   printf("Active or Idle mode\n");
+   break;
+default:
+   printf("Unknown mode 0x%02x\n", res->sector_count);
+   break;
+}
+
+return (0);
+}
+
+static int
 atapm(struct cam_device *device, int argc, char **argv,
 char *combinedopt, int retry_count, int timeout)
 {
@@ -8391,6 +8448,7 @@ atapm(struct cam_device *device, int argc, char **argv
int retval = 0;
int t = -1;
int c;
+   u_int8_t ata_flags = 0;
u_char cmd, sc;
 
ccb = cam_getccb(device);
@@ -8419,6 +8477,10 @@ atapm(struct cam_device *device, int argc, char **argv
cmd = ATA_STANDBY_IMMEDIATE;
else
cmd = ATA_STANDBY_CMD;
+   } else if (strcmp(argv[1], "powermode") == 0) {
+   cmd = ATA_CHECK_POWER_MODE;
+   ata_flags = AP_FLAG_CHK_COND;
+   t = -1;
} else {
cmd = ATA_SLEEP;
t = -1;
@@ -8436,11 +8498,12 

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

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 18:42:39 2019
New Revision: 350773
URL: https://svnweb.freebsd.org/changeset/base/350773

Log:
  MFC r320861 (by ngie): Fix whitespace bugs
  
  - Delete trailing whitespace.
  - Replace 8 single column spaces with hard tabs.
  - Delete lines with consisting purely of blank space.
  - Add space between `return` and `(`, per style(9).
  
  Special care was taken to not blindly replace 8 single column spaces
  with tabs; doing so could break tools that do strict string comparisons
  with camcontrol output.

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

Modified: stable/11/sbin/camcontrol/camcontrol.c
==
--- stable/11/sbin/camcontrol/camcontrol.c  Thu Aug  8 18:08:13 2019
(r350772)
+++ stable/11/sbin/camcontrol/camcontrol.c  Thu Aug  8 18:42:39 2019
(r350773)
@@ -375,14 +375,14 @@ getoption(struct camcontrol_opts *table, char *arg, ui
*argnum = opts->argnum;
*subopt = opts->subopt;
if (++num_matches > 1)
-   return(CC_OR_AMBIGUOUS);
+   return (CC_OR_AMBIGUOUS);
}
}
 
if (num_matches > 0)
-   return(CC_OR_FOUND);
+   return (CC_OR_FOUND);
else
-   return(CC_OR_NOT_FOUND);
+   return (CC_OR_NOT_FOUND);
 }
 
 #ifndef MINIMALISTIC
@@ -404,7 +404,7 @@ getdevlist(struct cam_device *device)
if (cam_send_ccb(device, ccb) < 0) {
perror("error getting device list");
cam_freeccb(ccb);
-   return(1);
+   return (1);
}
 
status[0] = '\0';
@@ -442,7 +442,7 @@ getdevlist(struct cam_device *device)
 
cam_freeccb(ccb);
 
-   return(error);
+   return (error);
 }
 #endif /* MINIMALISTIC */
 
@@ -471,7 +471,7 @@ getdevtree(int argc, char **argv, char *combinedopt)
 
if ((fd = open(XPT_DEVICE, O_RDWR)) == -1) {
warn("couldn't open %s", XPT_DEVICE);
-   return(1);
+   return (1);
}
 
bzero(, sizeof(union ccb));
@@ -487,7 +487,7 @@ getdevtree(int argc, char **argv, char *combinedopt)
if (ccb.cdm.matches == NULL) {
warnx("can't malloc memory for matches");
close(fd);
-   return(1);
+   return (1);
}
ccb.cdm.num_matches = 0;
 
@@ -663,7 +663,7 @@ getdevtree(int argc, char **argv, char *combinedopt)
 
close(fd);
 
-   return(error);
+   return (error);
 }
 
 #ifndef MINIMALISTIC
@@ -699,7 +699,7 @@ testunitready(struct cam_device *device, int task_attr
}
 
cam_freeccb(ccb);
-   return(1);
+   return (1);
}
 
if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) {
@@ -718,7 +718,7 @@ testunitready(struct cam_device *device, int task_attr
 
cam_freeccb(ccb);
 
-   return(error);
+   return (error);
 }
 
 static int
@@ -768,7 +768,7 @@ scsistart(struct cam_device *device, int startstop, in
}
 
cam_freeccb(ccb);
-   return(1);
+   return (1);
}
 
if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP)
@@ -802,7 +802,7 @@ scsistart(struct cam_device *device, int startstop, in
 
cam_freeccb(ccb);
 
-   return(error);
+   return (error);
 }
 
 int
@@ -839,7 +839,7 @@ scsidoinquiry(struct cam_device *device, int argc, cha
error = scsiinquiry(device, task_attr, retry_count, timeout);
 
if (error != 0)
-   return(error);
+   return (error);
 
if (arglist & CAM_ARG_GET_SERIAL)
scsiserial(device, task_attr, retry_count, timeout);
@@ -847,7 +847,7 @@ scsidoinquiry(struct cam_device *device, int argc, cha
if (arglist & CAM_ARG_GET_XFERRATE)
error = camxferrate(device);
 
-   return(error);
+   return (error);
 }
 
 static int
@@ -862,7 +862,7 @@ scsiinquiry(struct cam_device *device, int task_attr, 
 
if (ccb == NULL) {
warnx("couldn't allocate CCB");
-   return(1);
+   return (1);
}
 
/* cam_getccb cleans up the header, caller has to zero the payload */
@@ -874,7 +874,7 @@ scsiinquiry(struct cam_device *device, int task_attr, 
if (inq_buf == NULL) {
cam_freeccb(ccb);
warnx("can't malloc memory for inquiry\n");
-   return(1);
+   return (1);
}
bzero(inq_buf, sizeof(*inq_buf));
 
@@ -937,7 +937,7 @@ scsiinquiry(struct cam_device *device, int task_attr, 
}
 
cam_freeccb(ccb);
-   

svn commit: r350772 - in head: cddl/contrib/opensolaris/lib/libzfs/common stand/efi/boot1 stand/i386/gptzfsboot stand/i386/zfsboot stand/libsa/zfs sys/cddl/boot/zfs sys/cddl/contrib/opensolaris/uts...

2019-08-08 Thread Toomas Soome
Author: tsoome
Date: Thu Aug  8 18:08:13 2019
New Revision: 350772
URL: https://svnweb.freebsd.org/changeset/base/350772

Log:
  loader: support com.delphix:removing
  
  We should support removing vdev from boot pool. Update loader zfs reader
  to support com.delphix:removing.
  
  Reviewed by:  allanjude
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D18901

Modified:
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
  head/stand/efi/boot1/Makefile
  head/stand/i386/gptzfsboot/Makefile
  head/stand/i386/zfsboot/Makefile
  head/stand/libsa/zfs/Makefile.inc
  head/stand/libsa/zfs/zfsimpl.c
  head/sys/cddl/boot/zfs/zfsimpl.h
  head/sys/cddl/contrib/opensolaris/uts/common/os/list.c
  head/sys/cddl/contrib/opensolaris/uts/common/sys/list.h
  head/sys/cddl/contrib/opensolaris/uts/common/sys/list_impl.h
  head/sys/cddl/contrib/opensolaris/uts/common/sys/note.h
  head/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
==
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c   Thu Aug 
 8 18:00:37 2019(r350771)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c   Thu Aug 
 8 18:08:13 2019(r350772)
@@ -3300,13 +3300,6 @@ zpool_vdev_remove(zpool_handle_t *zhp, const char *pat
return (zfs_error(hdl, EZFS_BADVERSION, msg));
}
 
-   if (!islog && !avail_spare && !l2cache && zpool_is_bootable(zhp)) {
-   zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
-   "root pool can not have removed devices, "
-   "because GRUB does not understand them"));
-   return (zfs_error(hdl, EINVAL, msg));
-   }
-
zc.zc_guid = fnvlist_lookup_uint64(tgt, ZPOOL_CONFIG_GUID);
 
if (zfs_ioctl(hdl, ZFS_IOC_VDEV_REMOVE, ) == 0)

Modified: head/stand/efi/boot1/Makefile
==
--- head/stand/efi/boot1/Makefile   Thu Aug  8 18:00:37 2019
(r350771)
+++ head/stand/efi/boot1/Makefile   Thu Aug  8 18:08:13 2019
(r350772)
@@ -36,6 +36,8 @@ SRCS+=zfs_module.c
 CFLAGS.zfs_module.c+=  -I${ZFSSRC}
 CFLAGS.zfs_module.c+=  -I${SYSDIR}/cddl/boot/zfs
 CFLAGS.zfs_module.c+=  -I${SYSDIR}/crypto/skein
+CFLAGS.zfs_module.c+=  -I${SYSDIR}/cddl/contrib/opensolaris/uts/common
+
 CFLAGS+=   -DEFI_ZFS_BOOT
 .endif
 

Modified: head/stand/i386/gptzfsboot/Makefile
==
--- head/stand/i386/gptzfsboot/Makefile Thu Aug  8 18:00:37 2019
(r350771)
+++ head/stand/i386/gptzfsboot/Makefile Thu Aug  8 18:08:13 2019
(r350772)
@@ -28,6 +28,7 @@ CFLAGS+=-DBOOTPROG=\"gptzfsboot\" \
-I${ZFSSRC} \
-I${SYSDIR}/crypto/skein \
-I${SYSDIR}/cddl/boot/zfs \
+   -I${SYSDIR}/cddl/contrib/opensolaris/uts/common \
-I${BOOTSRC}/i386/btx/lib \
-I${BOOTSRC}/i386/boot2 \
-Wall -Waggregate-return -Wbad-function-cast \

Modified: head/stand/i386/zfsboot/Makefile
==
--- head/stand/i386/zfsboot/MakefileThu Aug  8 18:00:37 2019
(r350771)
+++ head/stand/i386/zfsboot/MakefileThu Aug  8 18:08:13 2019
(r350772)
@@ -27,6 +27,7 @@ CFLAGS+=-DBOOTPROG=\"zfsboot\" \
-I${ZFSSRC} \
-I${SYSDIR}/crypto/skein \
-I${SYSDIR}/cddl/boot/zfs \
+   -I${SYSDIR}/cddl/contrib/opensolaris/uts/common \
-I${BOOTSRC}/i386/boot2 \
-Wall -Waggregate-return -Wbad-function-cast -Wno-cast-align \
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs \

Modified: head/stand/libsa/zfs/Makefile.inc
==
--- head/stand/libsa/zfs/Makefile.inc   Thu Aug  8 18:00:37 2019
(r350771)
+++ head/stand/libsa/zfs/Makefile.inc   Thu Aug  8 18:08:13 2019
(r350772)
@@ -1,13 +1,15 @@
 # $FreeBSD$
 
 .PATH: ${ZFSSRC}
-SRCS+= zfs.c skein.c skein_block.c
+SRCS+= zfs.c skein.c skein_block.c list.c
 # Do not unroll skein loops, reduce code size
 CFLAGS+=   -DSKEIN_LOOP=111
 .PATH: ${SYSDIR}/crypto/skein
+.PATH: ${SYSDIR}/cddl/contrib/opensolaris/uts/common/os
 
 CFLAGS+=   -I${LDRSRC}
 CFLAGS+=   -I${SYSDIR}/cddl/boot/zfs
+CFLAGS+=   -I${SYSDIR}/cddl/contrib/opensolaris/uts/common
 CFLAGS+=   -I${SYSDIR}/crypto/skein
 
 CFLAGS+=   -Wformat -Wall

Modified: head/stand/libsa/zfs/zfsimpl.c
==
--- head/stand/libsa/zfs/zfsimpl.c  Thu Aug  8 18:00:37 2019
(r350771)
+++ head/stand/libsa/zfs/zfsimpl.c  Thu Aug  8 18:08:13 2019
(r350772)
@@ -34,6 +34,7 @@ 

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

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 18:00:37 2019
New Revision: 350771
URL: https://svnweb.freebsd.org/changeset/base/350771

Log:
  MFC r345363 (by imp): Make WD and WDC aliases for HGST.
  
  HGST was bought by WDC. Over the years, it has sold different drives
  branded as HGST, WD or WDC. All of them need the HGST workaround of
  sending 4k-sized packets (or multiples of 4k). And the ones that don't
  really need this aren't broken by this change. Submitter is the vendor
  who has tested these changes on a number of drives. I've simplified it
  slightly, since we don't need additional vendors for this at this
  time.

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

Modified: stable/11/sbin/camcontrol/fwdownload.c
==
--- stable/11/sbin/camcontrol/fwdownload.c  Thu Aug  8 18:00:00 2019
(r350770)
+++ stable/11/sbin/camcontrol/fwdownload.c  Thu Aug  8 18:00:37 2019
(r350771)
@@ -212,6 +212,10 @@ static struct fw_vendor vendors_list[] = {
0x8000, 0x07, 0x07, 0, 1, FW_TUR_READY, WB_TIMEOUT, FW_TIMEOUT_DEFAULT},
{VENDOR_SMART,  "SmrtStor", T_DIRECT,
0x8000, 0x07, 0x07, 0, 1, FW_TUR_READY, WB_TIMEOUT, FW_TIMEOUT_DEFAULT},
+   {VENDOR_HGST,   "WD",   T_DIRECT,
+   0x1000, 0x07, 0x07, 1, 0, FW_TUR_READY, WB_TIMEOUT, FW_TIMEOUT_DEFAULT},
+   {VENDOR_HGST,   "WDC",  T_DIRECT,
+   0x1000, 0x07, 0x07, 1, 0, FW_TUR_READY, WB_TIMEOUT, FW_TIMEOUT_DEFAULT},
 
/*
 * We match any ATA device.  This is really just a placeholder,
___
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: r350770 - stable/11/sbin/camcontrol

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 18:00:00 2019
New Revision: 350770
URL: https://svnweb.freebsd.org/changeset/base/350770

Log:
  MFC r345060 (by 0mp): camcontrol.8: Bump date after r345051

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

Modified: stable/11/sbin/camcontrol/camcontrol.8
==
--- stable/11/sbin/camcontrol/camcontrol.8  Thu Aug  8 17:59:03 2019
(r350769)
+++ stable/11/sbin/camcontrol/camcontrol.8  Thu Aug  8 18:00:00 2019
(r350770)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 1, 2017
+.Dd March 12, 2019
 .Dt CAMCONTROL 8
 .Os
 .Sh NAME
___
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: r350769 - stable/11/sbin/camcontrol

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 17:59:03 2019
New Revision: 350769
URL: https://svnweb.freebsd.org/changeset/base/350769

Log:
  MFC r345051 (by imp): Add -l to camcontrol readcap.
  
  The -l flag sends only the READ CAPACITY (16) sevice action. Normally
  we send the READ CAPACITY (10) command, and only send RC16 when the
  capacity is larger than 2TB (since that's the max RC10 can
  report). However, some badly programmed drives report different
  numbers for RC10 and RC16. This can be hard to diagnose, but generally
  there's a "Logical block address out of range" error when RC16 reports
  a larger number than RC10 and the RC10 number is the correct one. By
  comparing the output of readcap with and without the -l argmuent, one
  can determine if there's a mismatch and if the DA_Q_NO_RC16 quirk is
  needed.

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

Modified: stable/11/sbin/camcontrol/camcontrol.8
==
--- stable/11/sbin/camcontrol/camcontrol.8  Thu Aug  8 17:58:14 2019
(r350768)
+++ stable/11/sbin/camcontrol/camcontrol.8  Thu Aug  8 17:59:03 2019
(r350769)
@@ -78,6 +78,7 @@
 .Op Fl b
 .Op Fl h
 .Op Fl H
+.Op Fl l
 .Op Fl N
 .Op Fl q
 .Op Fl s
@@ -544,6 +545,11 @@ or
 .Fl b .
 .It Fl H
 Print out the device size in human readable (base 10, 1K == 1000) format.
+.It Fl l
+Skip sending the SCSI READ CAPACITY (10) command.
+Send only the SCSI READ CAPACITY (16) service action and report
+its results.
+When the two do not match, a quirk is needed to resolve the ambiguity.
 .It Fl N
 Print out the number of blocks in the device instead of the last logical
 block.

Modified: stable/11/sbin/camcontrol/camcontrol.c
==
--- stable/11/sbin/camcontrol/camcontrol.c  Thu Aug  8 17:58:14 2019
(r350768)
+++ stable/11/sbin/camcontrol/camcontrol.c  Thu Aug  8 17:59:03 2019
(r350769)
@@ -198,7 +198,7 @@ static struct camcontrol_opts option_table[] = {
{"load", CAM_CMD_STARTSTOP, CAM_ARG_START_UNIT | CAM_ARG_EJECT, NULL},
{"eject", CAM_CMD_STARTSTOP, CAM_ARG_EJECT, NULL},
{"reportluns", CAM_CMD_REPORTLUNS, CAM_ARG_NONE, "clr:"},
-   {"readcapacity", CAM_CMD_READCAP, CAM_ARG_NONE, "bhHNqs"},
+   {"readcapacity", CAM_CMD_READCAP, CAM_ARG_NONE, "bhHlNqs"},
{"reprobe", CAM_CMD_REPROBE, CAM_ARG_NONE, NULL},
 #endif /* MINIMALISTIC */
{"rescan", CAM_CMD_RESCAN, CAM_ARG_NONE, NULL},
@@ -6947,7 +6947,7 @@ scsireadcapacity(struct cam_device *device, int argc, 
 char *combinedopt, int task_attr, int retry_count, int timeout)
 {
union ccb *ccb;
-   int blocksizeonly, humanize, numblocks, quiet, sizeonly, baseten;
+   int blocksizeonly, humanize, numblocks, quiet, sizeonly, baseten, 
longonly;
struct scsi_read_capacity_data rcap;
struct scsi_read_capacity_data_long rcaplong;
uint64_t maxsector;
@@ -6957,6 +6957,7 @@ scsireadcapacity(struct cam_device *device, int argc, 
 
blocksizeonly = 0;
humanize = 0;
+   longonly = 0;
numblocks = 0;
quiet = 0;
sizeonly = 0;
@@ -6985,6 +6986,9 @@ scsireadcapacity(struct cam_device *device, int argc, 
humanize++;
baseten++;
break;
+   case 'l':
+   longonly++;
+   break;
case 'N':
numblocks++;
break;
@@ -7027,6 +7031,9 @@ scsireadcapacity(struct cam_device *device, int argc, 
goto bailout;
}
 
+   if (longonly != 0)
+   goto long_only;
+
scsi_read_capacity(>csio,
   /*retries*/ retry_count,
   /*cbfcnp*/ NULL,
@@ -7069,6 +7076,7 @@ scsireadcapacity(struct cam_device *device, int argc, 
if (maxsector != 0x)
goto do_print;
 
+long_only:
scsi_read_capacity_16(>csio,
  /*retries*/ retry_count,
  /*cbfcnp*/ NULL,
@@ -9017,7 +9025,7 @@ usage(int printlong)
 "camcontrol identify   [dev_id][generic args] [-v]\n"
 "camcontrol reportluns [dev_id][generic args] [-c] [-l] [-r report]\n"
 "camcontrol readcap[dev_id][generic args] [-b] [-h] [-H] [-N]\n"
-"  [-q] [-s]\n"
+"  [-q] [-s] [-l]\n"
 "camcontrol start  [dev_id][generic args]\n"
 "camcontrol stop   [dev_id][generic args]\n"
 "camcontrol load   [dev_id][generic args]\n"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, 

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

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 17:58:14 2019
New Revision: 350768
URL: https://svnweb.freebsd.org/changeset/base/350768

Log:
  MFC r344701 (by smh): Fix incorrect / unused sector_count for identify 
requests
  
  Fix incorrect / unused sector_count for identify requests from camcontrol.

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

Modified: stable/11/sbin/camcontrol/camcontrol.c
==
--- stable/11/sbin/camcontrol/camcontrol.c  Thu Aug  8 17:56:17 2019
(r350767)
+++ stable/11/sbin/camcontrol/camcontrol.c  Thu Aug  8 17:58:14 2019
(r350768)
@@ -2125,7 +2125,7 @@ ata_do_identify(struct cam_device *device, int retry_c
 /*command*/command,
 /*features*/0,
 /*lba*/0,
-/*sector_count*/(u_int8_t)sizeof(struct 
ata_params),
+/*sector_count*/0,
 /*data_ptr*/(u_int8_t *)ptr,
 /*dxfer_len*/sizeof(struct ata_params),
 /*timeout*/timeout ? timeout : 30 * 1000,
@@ -2145,8 +2145,7 @@ ata_do_identify(struct cam_device *device, int retry_c
 /*command*/retry_command,
 /*features*/0,
 /*lba*/0,
-/*sector_count*/(u_int8_t)
-sizeof(struct ata_params),
+/*sector_count*/0,
 /*data_ptr*/(u_int8_t *)ptr,
 /*dxfer_len*/sizeof(struct ata_params),
 /*timeout*/timeout ? timeout : 30 * 
1000,
___
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: r350767 - in stable/11/sys/cam: ata scsi

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 17:56:17 2019
New Revision: 350767
URL: https://svnweb.freebsd.org/changeset/base/350767

Log:
  MFC r343814 (by imp): Add quirk for Sansisk X400 drives
  
  Certain versions of Sandisk x400 firmware can hang under extremely
  heavly load of large I/Os for prolonged periods of time. Newer /
  current versions work fine, and should be used where possible. Where
  not possible, this quirk ensures that I/O requests are limited to 128k
  to avoids the bug, even under extreme load. Since MAXPHYS is 128k,
  only users with custom kernels are at risk on the older firmware.
  Once all known users of the older firmware have upgraded, this quirk
  will be removed.

Modified:
  stable/11/sys/cam/ata/ata_da.c
  stable/11/sys/cam/scsi/scsi_da.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/ata/ata_da.c
==
--- stable/11/sys/cam/ata/ata_da.c  Thu Aug  8 17:55:19 2019
(r350766)
+++ stable/11/sys/cam/ata/ata_da.c  Thu Aug  8 17:56:17 2019
(r350767)
@@ -117,7 +117,8 @@ typedef enum {
ADA_Q_NCQ_TRIM_BROKEN   = 0x02,
ADA_Q_LOG_BROKEN= 0x04,
ADA_Q_SMR_DM= 0x08,
-   ADA_Q_NO_TRIM   = 0x10
+   ADA_Q_NO_TRIM   = 0x10,
+   ADA_Q_128KB = 0x20
 } ada_quirks;
 
 #define ADA_Q_BIT_STRING   \
@@ -126,7 +127,8 @@ typedef enum {
"\002NCQ_TRIM_BROKEN"   \
"\003LOG_BROKEN"\
"\004SMR_DM"\
-   "\005NO_TRIM"
+   "\005NO_TRIM"   \
+   "\006128KB"
 
 typedef enum {
ADA_CCB_RAHEAD  = 0x01,
@@ -268,6 +270,11 @@ struct ada_quirk_entry {
 static struct ada_quirk_entry ada_quirk_table[] =
 {
{
+   /* Sandisk X400 */
+   { T_DIRECT, SIP_MEDIA_FIXED, "*", "SanDisk?SD8SB8U1T00*", 
"X4162000*" },
+   /*quirks*/ADA_Q_128KB
+   },
+   {
/* Hitachi Advanced Format (4k) drives */
{ T_DIRECT, SIP_MEDIA_FIXED, "*", "Hitachi H??E3*", "*" 
},
/*quirks*/ADA_Q_4K
@@ -1808,6 +1815,8 @@ adaregister(struct cam_periph *periph, void *arg)
maxio = min(maxio, 65536 * softc->params.secsize);
else/* 28bit ATA command limit */
maxio = min(maxio, 256 * softc->params.secsize);
+   if (softc->quirks & ADA_Q_128KB)
+   maxio = min(maxio, 128 * 1024);
softc->disk->d_maxsize = maxio;
softc->disk->d_unit = periph->unit_number;
softc->disk->d_flags = DISKFLAG_DIRECT_COMPLETION | DISKFLAG_CANZONE;

Modified: stable/11/sys/cam/scsi/scsi_da.c
==
--- stable/11/sys/cam/scsi/scsi_da.cThu Aug  8 17:55:19 2019
(r350766)
+++ stable/11/sys/cam/scsi/scsi_da.cThu Aug  8 17:56:17 2019
(r350767)
@@ -125,7 +125,8 @@ typedef enum {
DA_Q_NO_UNMAP   = 0x20,
DA_Q_RETRY_BUSY = 0x40,
DA_Q_SMR_DM = 0x80,
-   DA_Q_STRICT_UNMAP   = 0x100
+   DA_Q_STRICT_UNMAP   = 0x100,
+   DA_Q_128KB  = 0x200
 } da_quirks;
 
 #define DA_Q_BIT_STRING\
@@ -138,7 +139,8 @@ typedef enum {
"\006NO_UNMAP"  \
"\007RETRY_BUSY"\
"\010SMR_DM"\
-   "\011STRICT_UNMAP"
+   "\011STRICT_UNMAP"  \
+   "\012128KB"
 
 typedef enum {
DA_CCB_PROBE_RC = 0x01,
@@ -847,6 +849,11 @@ static struct da_quirk_entry da_quirk_table[] =
},
/* ATA/SATA devices over SAS/USB/... */
{
+   /* Sandisk X400 */
+   { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "SanDisk SD8SB8U1*", "*" },
+   /*quirks*/DA_Q_128KB
+   },
+   {
/* Hitachi Advanced Format (4k) drives */
{ T_DIRECT, SIP_MEDIA_FIXED, "Hitachi", "H??E3*", "*" },
/*quirks*/DA_Q_4K
@@ -2612,6 +2619,8 @@ daregister(struct cam_periph *periph, void *arg)
softc->maxio = MAXPHYS; /* for safety */
else
softc->maxio = cpi.maxio;
+   if (softc->quirks & DA_Q_128KB)
+   softc->maxio = min(softc->maxio, 128 * 1024);
softc->disk->d_maxsize = softc->maxio;
softc->disk->d_unit = periph->unit_number;
softc->disk->d_flags = DISKFLAG_DIRECT_COMPLETION | DISKFLAG_CANZONE;
___
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: r350766 - head/sys/arm64/conf

2019-08-08 Thread Warner Losh
Author: imp
Date: Thu Aug  8 17:55:19 2019
New Revision: 350766
URL: https://svnweb.freebsd.org/changeset/base/350766

Log:
  First pass at a LINT for arm64.
  
  Create a rough and ready NOTES file from GENERIC, remove the duplication from
  sys/conf/NOTES and add relevant no* directives to make this compile.
  
  Reviewed by: jhb, manu (earlier versions that differed only in comments)
  Differential Revision: https://reviews.freebsd.org/D21184

Added:
  head/sys/arm64/conf/Makefile   (contents, props changed)
  head/sys/arm64/conf/NOTES   (contents, props changed)

Added: head/sys/arm64/conf/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm64/conf/MakefileThu Aug  8 17:55:19 2019
(r350766)
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+TARGET=arm64
+
+.include "${.CURDIR}/../../conf/makeLINT.mk"

Added: head/sys/arm64/conf/NOTES
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm64/conf/NOTES   Thu Aug  8 17:55:19 2019(r350766)
@@ -0,0 +1,245 @@
+#
+# NOTES -- Lines that can be cut/pasted into kernel and hints configs.
+#
+# This file contains machine dependent kernel configuration notes.  For
+# machine independent notes, look in /sys/conf/NOTES.
+#
+# $FreeBSD$
+#
+
+#
+# We want LINT to cover profiling as well.
+# Except it's broken.
+#profile 2
+
+#
+# Enable the kernel DTrace hooks which are required to load the DTrace
+# kernel modules.
+#
+optionsKDTRACE_HOOKS
+
+#
+# Most of the following is copied from ARM64 GENERIC.
+cpuARM64
+
+makeoptionsDEBUG=-g# Build kernel with gdb(1) debug symbols
+makeoptionsWITH_CTF=1  # Run ctfconvert(1) for DTrace support
+
+optionsPRINTF_BUFR_SIZE=128# Prevent printf output being 
interspersed.
+optionsKDTRACE_FRAME   # Ensure frames are compiled in
+optionsVFP # Floating-point support
+optionsRACCT_DEFAULT_TO_DISABLED # Set kern.racct.enable=0 by default
+optionsINTRNG
+
+nooptions  GDB # Support remote GDB -- not supported
+
+# SoC support
+optionsSOC_ALLWINNER_A64
+optionsSOC_ALLWINNER_H5
+optionsSOC_CAVM_THUNDERX
+optionsSOC_HISI_HI6220
+optionsSOC_BRCM_BCM2837
+optionsSOC_MARVELL_8K
+optionsSOC_ROCKCHIP_RK3328
+optionsSOC_ROCKCHIP_RK3399
+optionsSOC_XILINX_ZYNQ
+
+# Timer drivers
+device a10_timer
+
+# Annapurna Alpine drivers
+device al_ccu  # Alpine Cache Coherency Unit
+device al_nb_service   # Alpine North Bridge Service
+device al_iofic# I/O Fabric Interrupt Controller
+device al_serdes   # Serializer/Deserializer
+device al_udma # Universal DMA
+
+# Qualcomm Snapdragon drivers
+device qcom_gcc# Global Clock Controller
+
+# VirtIO support
+device virtio
+device virtio_pci
+device virtio_mmio
+device virtio_blk
+device vtnet
+
+# CPU frequency control
+device cpufreq
+
+# Bus drivers
+device al_pci  # Annapurna Alpine PCI-E
+optionsPCI_HP  # PCI-Express native HotPlug
+optionsPCI_IOV # PCI SR-IOV support
+
+# Ethernet NICs
+device mdio
+device awg # Allwinner EMAC Gigabit Ethernet
+device axgbe   # AMD Opteron A1100 integrated NIC
+device neta# Marvell Armada 370/38x/XP/3700 NIC
+device smc # SMSC LAN91C111
+device vnic# Cavium ThunderX NIC
+device al_eth  # Annapurna Alpine Ethernet NIC
+device dwc_rk  # Rockchip Designware
+device dwc_socfpga # Altera SOCFPGA Ethernet MAC
+
+# Etherswitch devices
+device e6000sw # Marvell mv88e6085 based switches
+
+# NVM Express (NVMe) support
+device nvme# base NVMe driver
+optionsNVME_USE_NVD=0  # prefer the cam(4) based nda(4) driver
+device nvd # expose NVMe namespaces as disks, depends on 
nvme
+
+# MMC/SD/SDIO Card slot support
+device sdhci_xenon # Marvell Xenon SD/MMC controller
+device aw_mmc  # Allwinner SD/MMC controller
+device dwmmc
+device dwmmc_altera
+device rk_emmcphy
+
+# Serial (COM) ports
+device uart_msm# Qualcomm MSM UART driver
+device uart_mu # RPI3 aux port
+device uart_mvebu  # Armada 3700 UART driver
+device uart_ns8250 # ns8250-type UART driver
+device uart_snps
+device pl011
+
+# USB support
+device aw_ehci # 

svn commit: r350765 - stable/11/sys/cam/ata

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 17:55:17 2019
New Revision: 350765
URL: https://svnweb.freebsd.org/changeset/base/350765

Log:
  MFC r343129 (by gonzo):
  [ata] Add workaround for KingDian S200 SSD crash on receiving TRIM command
  
  - Add ADA_Q_NO_TRIM quirk to be used with the device that falsely advertise 
TRIM support
  - Add ADA_Q_NO_TRIM entry for KingDian S200 SSD
  
  PR: 222802

Modified:
  stable/11/sys/cam/ata/ata_da.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/ata/ata_da.c
==
--- stable/11/sys/cam/ata/ata_da.c  Thu Aug  8 17:48:07 2019
(r350764)
+++ stable/11/sys/cam/ata/ata_da.c  Thu Aug  8 17:55:17 2019
(r350765)
@@ -116,7 +116,8 @@ typedef enum {
ADA_Q_4K= 0x01,
ADA_Q_NCQ_TRIM_BROKEN   = 0x02,
ADA_Q_LOG_BROKEN= 0x04,
-   ADA_Q_SMR_DM= 0x08
+   ADA_Q_SMR_DM= 0x08,
+   ADA_Q_NO_TRIM   = 0x10
 } ada_quirks;
 
 #define ADA_Q_BIT_STRING   \
@@ -124,7 +125,8 @@ typedef enum {
"\0014K"\
"\002NCQ_TRIM_BROKEN"   \
"\003LOG_BROKEN"\
-   "\004SMR_DM"
+   "\004SMR_DM"\
+   "\005NO_TRIM"
 
 typedef enum {
ADA_CCB_RAHEAD  = 0x01,
@@ -534,6 +536,14 @@ static struct ada_quirk_entry ada_quirk_table[] =
},
{
/*
+* KingDian S200 60GB P0921B
+* Trimming crash the SSD
+*/
+   { T_DIRECT, SIP_MEDIA_FIXED, "*", "KingDian S200 *", "*" },
+   /*quirks*/ADA_Q_NO_TRIM
+   },
+   {
+   /*
 * Kingston E100 Series SSDs
 * 4k optimised & trim only works in 4k requests + 4k aligned
 */
@@ -1803,6 +1813,10 @@ adaregister(struct cam_periph *periph, void *arg)
softc->disk->d_flags = DISKFLAG_DIRECT_COMPLETION | DISKFLAG_CANZONE;
if (softc->flags & ADA_FLAG_CAN_FLUSHCACHE)
softc->disk->d_flags |= DISKFLAG_CANFLUSHCACHE;
+   /* Device lies about TRIM capability. */
+   if ((softc->quirks & ADA_Q_NO_TRIM) &&
+   (softc->flags & ADA_FLAG_CAN_TRIM))
+   softc->flags &= ~ADA_FLAG_CAN_TRIM;
if (softc->flags & ADA_FLAG_CAN_TRIM) {
softc->disk->d_flags |= DISKFLAG_CANDELETE;
softc->disk->d_delmaxsize = softc->params.secsize *
___
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: r350764 - head/sys/arm64/arm64

2019-08-08 Thread Warner Losh
Author: imp
Date: Thu Aug  8 17:48:07 2019
New Revision: 350764
URL: https://svnweb.freebsd.org/changeset/base/350764

Log:
  Make arm64 32-bit mode compile with COMPAT_43
  
  The COMPAT_43 option isn't quite like the other compat options, and arm64 
makes
  attempts to support it in 64-bit mode. In 32-bit compat mode, however, two
  syscall implementations that COMPAT_FREEBSD32 assumes will be there are
  missing. Provide implementations for these: ofreebsd32_sigreturn (which we'll
  never encounter, so implement it as nosys as is done in kern_sig.c) and
  ofreebsd32_getpagesize, where we'll always return 4096 since that's the only
  PAGE_SIZE we support, similar to how the ia32 implementation does things.
  
  Reviewed by: manu@
  Differential Revision: https://reviews.freebsd.org/D21192

Modified:
  head/sys/arm64/arm64/freebsd32_machdep.c

Modified: head/sys/arm64/arm64/freebsd32_machdep.c
==
--- head/sys/arm64/arm64/freebsd32_machdep.cThu Aug  8 17:30:51 2019
(r350763)
+++ head/sys/arm64/arm64/freebsd32_machdep.cThu Aug  8 17:48:07 2019
(r350764)
@@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #ifdef VFP
 #include 
@@ -410,3 +411,30 @@ freebsd32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigs
mtx_lock(>ps_mtx);
 
 }
+
+#ifdef COMPAT_43
+/*
+ * COMPAT_FREEBSD32 assumes we have this system call when COMPAT_43 is defined.
+ * FreeBSD/arm provies a similar getpagesize() syscall.
+ */
+#define ARM32_PAGE_SIZE 4096
+int
+ofreebsd32_getpagesize(struct thread *td,
+struct ofreebsd32_getpagesize_args *uap)
+{
+
+   td->td_retval[0] = ARM32_PAGE_SIZE;
+   return (0);
+}
+
+/*
+ * Mirror the osigreturn definition in kern_sig.c for !i386 platforms. This
+ * mirrors what's connected to the FreeBSD/arm syscall.
+ */
+int
+ofreebsd32_sigreturn(struct thread *td, struct ofreebsd32_sigreturn_args *uap)
+{
+
+   return (nosys(td, (struct nosys_args *)uap));
+}
+#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: r350763 - stable/11/sys/cam/ata

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 17:30:51 2019
New Revision: 350763
URL: https://svnweb.freebsd.org/changeset/base/350763

Log:
  MFC r327577 (by eadler):
  cam/da: QUIRK: Add 4K quirks for WD Red and Black MHDDs
  
  PR: 188685

Modified:
  stable/11/sys/cam/ata/ata_da.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/ata/ata_da.c
==
--- stable/11/sys/cam/ata/ata_da.c  Thu Aug  8 17:28:55 2019
(r350762)
+++ stable/11/sys/cam/ata/ata_da.c  Thu Aug  8 17:30:51 2019
(r350763)
@@ -357,7 +357,12 @@ static struct ada_quirk_entry ada_quirk_table[] =
},
{
/* WDC Caviar Black Advanced Format (4k) drives */
-   { T_DIRECT, SIP_MEDIA_FIXED, "*", "WDC WD??EX*", "*" },
+   { T_DIRECT, SIP_MEDIA_FIXED, "*", "WDC WDAZEX*", "*" },
+   /*quirks*/ADA_Q_4K
+   },
+   {
+   /* WDC Caviar Black Advanced Format (4k) drives */
+   { T_DIRECT, SIP_MEDIA_FIXED, "*", "WDC WDFZEX*", "*" },
/*quirks*/ADA_Q_4K
},
{
___
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: r350762 - stable/11/sys/cam/ctl

2019-08-08 Thread Alexander Motin
Author: mav
Date: Thu Aug  8 17:28:55 2019
New Revision: 350762
URL: https://svnweb.freebsd.org/changeset/base/350762

Log:
  MFC r327239 (by manu): ctl: Correct comment in ctl_worker_thread
  
  The incoming queue is handled before the RtR one.
  No functional change.

Modified:
  stable/11/sys/cam/ctl/ctl.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/ctl/ctl.c
==
--- stable/11/sys/cam/ctl/ctl.c Thu Aug  8 17:03:30 2019(r350761)
+++ stable/11/sys/cam/ctl/ctl.c Thu Aug  8 17:28:55 2019(r350762)
@@ -13249,8 +13249,8 @@ ctl_work_thread(void *arg)
 * We handle the queues in this order:
 * - ISC
 * - done queue (to free up resources, unblock other commands)
-* - RtR queue
 * - incoming queue
+* - RtR queue
 *
 * If those queues are empty, we break out of the loop and
 * go to sleep.
___
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: r350761 - in head/stand: efi/loader i386/loader

2019-08-08 Thread Marcin Wojtas
Author: mw
Date: Thu Aug  8 17:03:30 2019
New Revision: 350761
URL: https://svnweb.freebsd.org/changeset/base/350761

Log:
  Verify files loaded in chain command.
  
  The chain command can be used to chain load another binary.
  If veriexec is enabled we should verify it first.
  Note that on EFI systems the verification was already done
  through firmware, assuming that Secure Boot was enabled there.
  
  Submitted by: Kornel Duleba 
  Reviewed by: sjg
  MFC after: 1 week
  Obtained from: Semihalf
  Differential Revision: https://reviews.freebsd.org/D20952

Modified:
  head/stand/efi/loader/main.c
  head/stand/i386/loader/chain.c

Modified: head/stand/efi/loader/main.c
==
--- head/stand/efi/loader/main.cThu Aug  8 16:54:22 2019
(r350760)
+++ head/stand/efi/loader/main.cThu Aug  8 17:03:30 2019
(r350761)
@@ -1440,6 +1440,14 @@ command_chain(int argc, char *argv[])
return (CMD_ERROR);
}
 
+#ifdef LOADER_VERIEXEC
+   if (verify_file(fd, name, 0, VE_MUST) < 0) {
+   sprintf(command_errbuf, "can't verify: %s", name);
+   close(fd);
+   return (CMD_ERROR);
+   }
+#endif
+
if (fstat(fd, ) < -1) {
command_errmsg = "stat failed";
close(fd);

Modified: head/stand/i386/loader/chain.c
==
--- head/stand/i386/loader/chain.c  Thu Aug  8 16:54:22 2019
(r350760)
+++ head/stand/i386/loader/chain.c  Thu Aug  8 17:03:30 2019
(r350761)
@@ -75,6 +75,14 @@ command_chain(int argc, char *argv[])
return (CMD_ERROR);
}
 
+#ifdef LOADER_VERIEXEC
+   if (verify_file(fd, argv[1], 0, VE_MUST) < 0) {
+   sprintf(command_errbuf, "can't verify: %s", argv[1]);
+   close(fd);
+   return (CMD_ERROR);
+   }
+#endif
+
len = strlen(argv[1]);
if (argv[1][len-1] != ':') {
if (fstat(fd, ) == -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: r350760 - in head: lib/libzstd sys/conf sys/contrib/zstd sys/contrib/zstd/contrib/largeNbDicts sys/contrib/zstd/contrib/seekable_format sys/contrib/zstd/contrib/seekable_format/examples...

2019-08-08 Thread Conrad Meyer
Author: cem
Date: Thu Aug  8 16:54:22 2019
New Revision: 350760
URL: https://svnweb.freebsd.org/changeset/base/350760

Log:
  Update to Zstandard 1.4.2
  
  The full release notes for 1.4.1 (skipped) and 1.4.2 can be found on Github:
  
https://github.com/facebook/zstd/releases/tag/v1.4.1
https://github.com/facebook/zstd/releases/tag/v1.4.2
  
  These are mostly minor updates; 1.4.1 purportedly brings something like 7%
  faster decompression speed.
  
  Relnotes: yes

Added:
  
head/sys/contrib/zstd/contrib/seekable_format/examples/seekable_decompression_mem.c
 - copied unchanged from r350755, 
vendor/zstd/dist/contrib/seekable_format/examples/seekable_decompression_mem.c
  head/sys/contrib/zstd/lib/compress/zstd_compress_literals.c
 - copied unchanged from r350755, 
vendor/zstd/dist/lib/compress/zstd_compress_literals.c
  head/sys/contrib/zstd/lib/compress/zstd_compress_literals.h
 - copied unchanged from r350755, 
vendor/zstd/dist/lib/compress/zstd_compress_literals.h
  head/sys/contrib/zstd/lib/compress/zstd_compress_sequences.c
 - copied unchanged from r350755, 
vendor/zstd/dist/lib/compress/zstd_compress_sequences.c
  head/sys/contrib/zstd/lib/compress/zstd_compress_sequences.h
 - copied unchanged from r350755, 
vendor/zstd/dist/lib/compress/zstd_compress_sequences.h
  head/sys/contrib/zstd/tests/bigdict.c
 - copied unchanged from r350755, vendor/zstd/dist/tests/bigdict.c
  head/sys/contrib/zstd/tests/fuzz/simple_compress.c
 - copied unchanged from r350755, 
vendor/zstd/dist/tests/fuzz/simple_compress.c
  head/sys/contrib/zstd/tests/fuzz/zstd_frame_info.c
 - copied unchanged from r350755, 
vendor/zstd/dist/tests/fuzz/zstd_frame_info.c
Deleted:
  head/sys/contrib/zstd/tests/fuzz/default.options
Modified:
  head/lib/libzstd/Makefile
  head/sys/conf/files
  head/sys/conf/kern.pre.mk
  head/sys/contrib/zstd/CHANGELOG
  head/sys/contrib/zstd/contrib/largeNbDicts/largeNbDicts.c
  head/sys/contrib/zstd/contrib/seekable_format/examples/.gitignore
  head/sys/contrib/zstd/contrib/seekable_format/examples/Makefile
  head/sys/contrib/zstd/contrib/seekable_format/zstdseek_decompress.c
  head/sys/contrib/zstd/doc/zstd_compression_format.md
  head/sys/contrib/zstd/doc/zstd_manual.html
  head/sys/contrib/zstd/examples/Makefile
  head/sys/contrib/zstd/lib/Makefile
  head/sys/contrib/zstd/lib/common/compiler.h
  head/sys/contrib/zstd/lib/common/zstd_internal.h
  head/sys/contrib/zstd/lib/compress/zstd_compress.c
  head/sys/contrib/zstd/lib/compress/zstd_compress_internal.h
  head/sys/contrib/zstd/lib/compress/zstd_double_fast.c
  head/sys/contrib/zstd/lib/compress/zstd_fast.c
  head/sys/contrib/zstd/lib/compress/zstd_lazy.c
  head/sys/contrib/zstd/lib/compress/zstd_ldm.c
  head/sys/contrib/zstd/lib/compress/zstd_opt.c
  head/sys/contrib/zstd/lib/compress/zstdmt_compress.c
  head/sys/contrib/zstd/lib/compress/zstdmt_compress.h
  head/sys/contrib/zstd/lib/decompress/zstd_decompress.c
  head/sys/contrib/zstd/lib/decompress/zstd_decompress_block.c
  head/sys/contrib/zstd/lib/dictBuilder/cover.c
  head/sys/contrib/zstd/lib/dictBuilder/cover.h
  head/sys/contrib/zstd/lib/dictBuilder/fastcover.c
  head/sys/contrib/zstd/lib/dictBuilder/zdict.c
  head/sys/contrib/zstd/lib/dictBuilder/zdict.h
  head/sys/contrib/zstd/lib/legacy/zstd_legacy.h
  head/sys/contrib/zstd/lib/legacy/zstd_v01.c
  head/sys/contrib/zstd/lib/legacy/zstd_v02.c
  head/sys/contrib/zstd/lib/legacy/zstd_v03.c
  head/sys/contrib/zstd/lib/legacy/zstd_v04.c
  head/sys/contrib/zstd/lib/legacy/zstd_v05.c
  head/sys/contrib/zstd/lib/legacy/zstd_v06.c
  head/sys/contrib/zstd/lib/legacy/zstd_v07.c
  head/sys/contrib/zstd/lib/zstd.h
  head/sys/contrib/zstd/programs/.gitignore
  head/sys/contrib/zstd/programs/README.md
  head/sys/contrib/zstd/programs/benchfn.c
  head/sys/contrib/zstd/programs/fileio.c
  head/sys/contrib/zstd/programs/fileio.h
  head/sys/contrib/zstd/programs/util.c
  head/sys/contrib/zstd/programs/zstd.1
  head/sys/contrib/zstd/programs/zstd.1.md
  head/sys/contrib/zstd/programs/zstdcli.c
  head/sys/contrib/zstd/programs/zstdgrep
  head/sys/contrib/zstd/programs/zstdgrep.1
  head/sys/contrib/zstd/programs/zstdless.1
  head/sys/contrib/zstd/tests/.gitignore
  head/sys/contrib/zstd/tests/Makefile
  head/sys/contrib/zstd/tests/decodecorpus.c
  head/sys/contrib/zstd/tests/fullbench.c
  head/sys/contrib/zstd/tests/fuzz/Makefile
  head/sys/contrib/zstd/tests/fuzz/dictionary_decompress.c
  head/sys/contrib/zstd/tests/fuzz/fuzz.py
  head/sys/contrib/zstd/tests/fuzz/simple_decompress.c
  head/sys/contrib/zstd/tests/fuzzer.c
  head/sys/contrib/zstd/tests/paramgrill.c
  head/sys/contrib/zstd/tests/playTests.sh
  head/sys/contrib/zstd/tests/poolTests.c
  head/sys/contrib/zstd/tests/regression/results.csv
  head/sys/contrib/zstd/tests/zstreamtest.c
  head/sys/contrib/zstd/zlibWrapper/.gitignore
Directory Properties:
  head/sys/contrib/zstd/   (props changed)

Modified: head/lib/libzstd/Makefile

svn commit: r350759 - head/sys/security/mac_veriexec_parser

2019-08-08 Thread Marcin Wojtas
Author: mw
Date: Thu Aug  8 16:51:49 2019
New Revision: 350759
URL: https://svnweb.freebsd.org/changeset/base/350759

Log:
  Fix mac_veriexec_parser build after r347938
  
  In r347938 the definition of mac_veriexec_metadata_add_file
  so adjust the argument list accordingly.
  
  Submitted by: Kornel Duleba 

Modified:
  head/sys/security/mac_veriexec_parser/mac_veriexec_parser.c

Modified: head/sys/security/mac_veriexec_parser/mac_veriexec_parser.c
==
--- head/sys/security/mac_veriexec_parser/mac_veriexec_parser.c Thu Aug  8 
16:48:19 2019(r350758)
+++ head/sys/security/mac_veriexec_parser/mac_veriexec_parser.c Thu Aug  8 
16:51:49 2019(r350759)
@@ -364,7 +364,9 @@ parse_entry(char *entry, char *prefix)
rc = mac_veriexec_metadata_add_file(
is_exec == 0,
va.va_fsid, va.va_fileid, va.va_gen,
-   digest, flags, fp_type, 1);
+   digest,
+   NULL, 0,
+   flags, fp_type, 1);
mtx_unlock(_mutex);
 
 out:
___
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: r350758 - head/sys/vm

2019-08-08 Thread Konstantin Belousov
Author: kib
Date: Thu Aug  8 16:48:19 2019
New Revision: 350758
URL: https://svnweb.freebsd.org/changeset/base/350758

Log:
  Fix stack grow for init.
  
  During early stages of kern_exec(), including strings copyout,
  p_textvp for init is NULL.  This prevented stack grow from working for
  init execution.
  
  Without stack gap enabled, initial stack segment size is enough for
  strings passed by kernel to init.  With the gap enabled, the used
  address might fall out of the initial segment, which kills init.
  
  Exclude initproc from the check for contexts which should not cause
  stack grow in the target map.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/vm/vm_map.c

Modified: head/sys/vm/vm_map.c
==
--- head/sys/vm/vm_map.cThu Aug  8 16:42:53 2019(r350757)
+++ head/sys/vm/vm_map.cThu Aug  8 16:48:19 2019(r350758)
@@ -4217,7 +4217,8 @@ vm_map_growstack(vm_map_t map, vm_offset_t addr, vm_ma
 * debugger or AIO daemon.  The reason is that the wrong
 * resource limits are applied.
 */
-   if (map != >p_vmspace->vm_map || p->p_textvp == NULL)
+   if (p != initproc && (map != >p_vmspace->vm_map ||
+   p->p_textvp == NULL))
return (KERN_FAILURE);
 
MPASS(!map->system_map);
___
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: r350757 - head/sys/kern

2019-08-08 Thread Konstantin Belousov
Author: kib
Date: Thu Aug  8 16:42:53 2019
New Revision: 350757
URL: https://svnweb.freebsd.org/changeset/base/350757

Log:
  Update comment explaining create_init().
  
  Sponsored by: The FreeBSD Foundation
  MFC after:3 days

Modified:
  head/sys/kern/init_main.c

Modified: head/sys/kern/init_main.c
==
--- head/sys/kern/init_main.c   Thu Aug  8 16:37:32 2019(r350756)
+++ head/sys/kern/init_main.c   Thu Aug  8 16:42:53 2019(r350757)
@@ -797,11 +797,9 @@ start_init(void *dummy)
 }
 
 /*
- * Like kproc_create(), but runs in its own address space.
- * We do this early to reserve pid 1.
- *
- * Note special case - do not make it runnable yet.  Other work
- * in progress will change this more.
+ * Like kproc_create(), but runs in its own address space.  We do this
+ * early to reserve pid 1.  Note special case - do not make it
+ * runnable yet, init execution is started when userspace can be served.
  */
 static void
 create_init(const void *udata __unused)
___
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: r350756 - head/lib/libproc

2019-08-08 Thread Justin Hibbits
On Thu, 8 Aug 2019 16:37:32 + (UTC)
Justin Hibbits  wrote:

> Author: jhibbits
> Date: Thu Aug  8 16:37:32 2019
> New Revision: 350756
> URL: https://svnweb.freebsd.org/changeset/base/350756
> 
> Log:
>   mips: Fix register target for SP setting in libproc
>   
>   Copy-paste-o from r233042
>   Reviewed by:imp

Sponsored by: Juniper Networks

>   Differential Revision:  https://reviews.freebsd.org/D21188
> 
> Modified:
>   head/lib/libproc/proc_regs.c
> 
> Modified: head/lib/libproc/proc_regs.c
> ==
> --- head/lib/libproc/proc_regs.c  Thu Aug  8 15:38:57
> 2019  (r350755) +++ head/lib/libproc/proc_regs.c  Thu Aug
>  8 16:37:32 2019  (r350756) @@ -138,7 +138,7 @@
> proc_regset(struct proc_handle *phdl, proc_reg_t reg, #elif
> defined(__i386__) regs.r_esp = regvalue;
>  #elif defined(__mips__)
> - regs.r_regs[PC] = regvalue;
> + regs.r_regs[SP] = regvalue;
>  #elif defined(__powerpc__)
>   regs.fixreg[1] = regvalue;
>  #elif defined(__riscv)
> 

___
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: r350756 - head/lib/libproc

2019-08-08 Thread Justin Hibbits
Author: jhibbits
Date: Thu Aug  8 16:37:32 2019
New Revision: 350756
URL: https://svnweb.freebsd.org/changeset/base/350756

Log:
  mips: Fix register target for SP setting in libproc
  
  Copy-paste-o from r233042
  Reviewed by:  imp
  Differential Revision:https://reviews.freebsd.org/D21188

Modified:
  head/lib/libproc/proc_regs.c

Modified: head/lib/libproc/proc_regs.c
==
--- head/lib/libproc/proc_regs.cThu Aug  8 15:38:57 2019
(r350755)
+++ head/lib/libproc/proc_regs.cThu Aug  8 16:37:32 2019
(r350756)
@@ -138,7 +138,7 @@ proc_regset(struct proc_handle *phdl, proc_reg_t reg, 
 #elif defined(__i386__)
regs.r_esp = regvalue;
 #elif defined(__mips__)
-   regs.r_regs[PC] = regvalue;
+   regs.r_regs[SP] = regvalue;
 #elif defined(__powerpc__)
regs.fixreg[1] = regvalue;
 #elif defined(__riscv)
___
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: r350737 - head/usr.sbin/autofs

2019-08-08 Thread Justin Hibbits
On Thu, 08 Aug 2019 08:00:16 -0600
Ian Lepore  wrote:

> On Thu, 2019-08-08 at 03:16 +, Justin Hibbits wrote:
> > Author: jhibbits
> > Date: Thu Aug  8 03:16:32 2019
> > New Revision: 350737
> > URL: https://svnweb.freebsd.org/changeset/base/350737
> > 
> > Log:
> >   Change autounmountd(8) to use time_t for duration instead of
> > double 
> >   Summary:
> >   autounmountd(8) uses doubles to handle mount time durations.
> > However, it must convert to integer types, time_t in particular, to
> > do anything meaningful.  Additionally, even though it's a
> > floating-point value in seconds, the sub-seconds component is never
> > used, so it's unnecessary. 
> >   Switching type to time_t fixes an assertion on powerpc64, which
> > checks that a sleep value that's not -1.0 is greater than 0.  On
> > powerpc64, it happens that the value of -1.0 gets loaded as a float
> > (perhaps a bug in gcc), but gets compared to a double.  This
> > compares as false, so follows through the 'sleep != -1.0' path, and
> > fails the assert.  Since the sub-second component isn't used in the
> > double, just drop it and deal with whole-integer seconds.
> >   
> >   Reviewed by:  trasz
> >   Differential Revision: https://reviews.freebsd.org/D21109
> > 
> > Modified:
> >   head/usr.sbin/autofs/autounmountd.c
> > 
> > Modified: head/usr.sbin/autofs/autounmountd.c
> > ==
> > --- head/usr.sbin/autofs/autounmountd.c Thu Aug  8 03:01:35
> > 2019(r350736) +++
> > head/usr.sbin/autofs/autounmountd.c Thu Aug  8 03:16:32
> > 2019(r350737) @@ -179,12 +179,12 @@ unmount_by_fsid(const
> > fsid_t fsid, const char *mountpo return (error); }
> >  
> > -static double
> > -expire_automounted(double expiration_time)
> > +static time_t
> > +expire_automounted(time_t expiration_time)
> >  {
> > struct automounted_fs *af, *tmpaf;
> > time_t now;
> > -   double mounted_for, mounted_max = -1.0;
> > +   time_t mounted_for, mounted_max = -1;
> > int error;
> >  
> > now = time(NULL);
> > @@ -196,9 +196,9 @@ expire_automounted(double expiration_time)
> >  
> > if (mounted_for < expiration_time) {
> > log_debugx("skipping %s (FSID:%d:%d),
> > mounted "
> > -   "for %.0f seconds", af->af_mountpoint,
> > +   "for %ld  seconds", af->af_mountpoint,
> >  
> 
> You can't print a time_t with %ld, it'll fail on 32-bit arches with
> 64- bit time_t.  The usual incantation is %j and cast to intmax_t.
> 
> -- Ian
> 
> 

I cast it to a long already, so it prints as a long for all archs.  I
guess intmax_t might be better, but I figured nobody would hold a mount
for more than 2**31 seconds (the argument is for duration, not absolute
time).

- Justin
___
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: r350755 - vendor/zstd/1.4.2

2019-08-08 Thread Conrad Meyer
Author: cem
Date: Thu Aug  8 15:38:57 2019
New Revision: 350755
URL: https://svnweb.freebsd.org/changeset/base/350755

Log:
  tag zstd 1.4.2

Added:
  vendor/zstd/1.4.2/
 - copied from r350754, vendor/zstd/dist/
___
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: r350754 - in vendor/zstd/dist: . contrib/largeNbDicts contrib/seekable_format contrib/seekable_format/examples doc lib lib/compress lib/decompress lib/legacy programs tests

2019-08-08 Thread Conrad Meyer
Author: cem
Date: Thu Aug  8 15:37:56 2019
New Revision: 350754
URL: https://svnweb.freebsd.org/changeset/base/350754

Log:
  import zstd 1.4.2

Added:
  
vendor/zstd/dist/contrib/seekable_format/examples/seekable_decompression_mem.c  
 (contents, props changed)
  vendor/zstd/dist/lib/compress/zstd_compress_literals.c   (contents, props 
changed)
  vendor/zstd/dist/lib/compress/zstd_compress_literals.h   (contents, props 
changed)
  vendor/zstd/dist/lib/compress/zstd_compress_sequences.c   (contents, props 
changed)
  vendor/zstd/dist/lib/compress/zstd_compress_sequences.h   (contents, props 
changed)
Modified:
  vendor/zstd/dist/CHANGELOG
  vendor/zstd/dist/contrib/largeNbDicts/largeNbDicts.c
  vendor/zstd/dist/contrib/seekable_format/examples/.gitignore
  vendor/zstd/dist/contrib/seekable_format/examples/Makefile
  vendor/zstd/dist/contrib/seekable_format/zstdseek_decompress.c
  vendor/zstd/dist/doc/zstd_manual.html
  vendor/zstd/dist/lib/compress/zstd_compress.c
  vendor/zstd/dist/lib/compress/zstd_compress_internal.h
  vendor/zstd/dist/lib/decompress/zstd_decompress.c
  vendor/zstd/dist/lib/legacy/zstd_v05.c
  vendor/zstd/dist/lib/zstd.h
  vendor/zstd/dist/programs/README.md
  vendor/zstd/dist/programs/util.c
  vendor/zstd/dist/programs/zstd.1
  vendor/zstd/dist/programs/zstd.1.md
  vendor/zstd/dist/programs/zstdcli.c
  vendor/zstd/dist/programs/zstdgrep.1
  vendor/zstd/dist/programs/zstdless.1
  vendor/zstd/dist/tests/decodecorpus.c

Modified: vendor/zstd/dist/CHANGELOG
==
--- vendor/zstd/dist/CHANGELOG  Thu Aug  8 15:32:53 2019(r350753)
+++ vendor/zstd/dist/CHANGELOG  Thu Aug  8 15:37:56 2019(r350754)
@@ -1,3 +1,9 @@
+v1.4.2
+bug: Fix bug in zstd-0.5 decoder by @terrelln (#1696)
+bug: Fix seekable decompression in-memory API by @iburinoc (#1695)
+misc: Validate blocks are smaller than size limit by @vivekmg (#1685)
+misc: Restructure source files by @ephiepark (#1679)
+
 v1.4.1
 bug: Fix data corruption in niche use cases by @terrelln (#1659)
 bug: Fuzz legacy modes, fix uncovered bugs by @terrelln (#1593, #1594, #1595)

Modified: vendor/zstd/dist/contrib/largeNbDicts/largeNbDicts.c
==
--- vendor/zstd/dist/contrib/largeNbDicts/largeNbDicts.cThu Aug  8 
15:32:53 2019(r350753)
+++ vendor/zstd/dist/contrib/largeNbDicts/largeNbDicts.cThu Aug  8 
15:37:56 2019(r350754)
@@ -559,7 +559,7 @@ static int benchMem(slice_collection_t dstBlocks,
 CONTROL(BMK_isSuccessful_runOutcome(outcome));
 
 BMK_runTime_t const result = BMK_extract_runTime(outcome);
-U64 const dTime_ns = result.nanoSecPerRun;
+double const dTime_ns = result.nanoSecPerRun;
 double const dTime_sec = (double)dTime_ns / 10;
 size_t const srcSize = result.sumOfReturn;
 double const dSpeed_MBps = (double)srcSize / dTime_sec / (1 MB);

Modified: vendor/zstd/dist/contrib/seekable_format/examples/.gitignore
==
--- vendor/zstd/dist/contrib/seekable_format/examples/.gitignoreThu Aug 
 8 15:32:53 2019(r350753)
+++ vendor/zstd/dist/contrib/seekable_format/examples/.gitignoreThu Aug 
 8 15:37:56 2019(r350754)
@@ -1,4 +1,5 @@
 seekable_compression
 seekable_decompression
+seekable_decompression_mem
 parallel_processing
 parallel_compression

Modified: vendor/zstd/dist/contrib/seekable_format/examples/Makefile
==
--- vendor/zstd/dist/contrib/seekable_format/examples/Makefile  Thu Aug  8 
15:32:53 2019(r350753)
+++ vendor/zstd/dist/contrib/seekable_format/examples/Makefile  Thu Aug  8 
15:37:56 2019(r350754)
@@ -24,7 +24,8 @@ SEEKABLE_OBJS = ../zstdseek_compress.c ../zstdseek_dec
 
 default: all
 
-all: seekable_compression seekable_decompression parallel_processing
+all: seekable_compression seekable_decompression seekable_decompression_mem \
+   parallel_processing
 
 $(ZSTDLIB):
make -C $(ZSTDLIB_PATH) $(ZSTDLIB_NAME)
@@ -35,6 +36,9 @@ seekable_compression : seekable_compression.c $(SEEKAB
 seekable_decompression : seekable_decompression.c $(SEEKABLE_OBJS)
$(CC) $(CPPFLAGS) $(CFLAGS) $^ $(LDFLAGS) -o $@
 
+seekable_decompression_mem : seekable_decompression_mem.c $(SEEKABLE_OBJS)
+   $(CC) $(CPPFLAGS) $(CFLAGS) $^ $(LDFLAGS) -o $@
+
 parallel_processing : parallel_processing.c $(SEEKABLE_OBJS)
$(CC) $(CPPFLAGS) $(CFLAGS) $^ $(LDFLAGS) -o $@ -pthread
 
@@ -44,5 +48,6 @@ parallel_compression : parallel_compression.c $(SEEKAB
 clean:
@rm -f core *.o tmp* result* *.zst \
seekable_compression seekable_decompression \
+   seekable_decompression_mem \
parallel_processing parallel_compression
@echo Cleaning completed


svn commit: r350753 - vendor/zstd/1.4.1

2019-08-08 Thread Conrad Meyer
Author: cem
Date: Thu Aug  8 15:32:53 2019
New Revision: 350753
URL: https://svnweb.freebsd.org/changeset/base/350753

Log:
  tag zstd 1.4.1

Added:
  vendor/zstd/1.4.1/
 - copied from r350752, vendor/zstd/dist/
___
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: r350752 - in vendor/zstd/dist: . doc examples lib lib/common lib/compress lib/decompress lib/dictBuilder lib/legacy programs tests tests/fuzz tests/regression zlibWrapper

2019-08-08 Thread Conrad Meyer
Author: cem
Date: Thu Aug  8 15:30:49 2019
New Revision: 350752
URL: https://svnweb.freebsd.org/changeset/base/350752

Log:
  import zstd 1.4.1

Added:
  vendor/zstd/dist/tests/bigdict.c   (contents, props changed)
  vendor/zstd/dist/tests/fuzz/simple_compress.c   (contents, props changed)
  vendor/zstd/dist/tests/fuzz/zstd_frame_info.c   (contents, props changed)
Deleted:
  vendor/zstd/dist/tests/fuzz/default.options
Modified:
  vendor/zstd/dist/CHANGELOG
  vendor/zstd/dist/doc/zstd_compression_format.md
  vendor/zstd/dist/doc/zstd_manual.html
  vendor/zstd/dist/examples/Makefile
  vendor/zstd/dist/lib/Makefile
  vendor/zstd/dist/lib/common/compiler.h
  vendor/zstd/dist/lib/common/zstd_internal.h
  vendor/zstd/dist/lib/compress/zstd_compress.c
  vendor/zstd/dist/lib/compress/zstd_compress_internal.h
  vendor/zstd/dist/lib/compress/zstd_double_fast.c
  vendor/zstd/dist/lib/compress/zstd_fast.c
  vendor/zstd/dist/lib/compress/zstd_lazy.c
  vendor/zstd/dist/lib/compress/zstd_ldm.c
  vendor/zstd/dist/lib/compress/zstd_opt.c
  vendor/zstd/dist/lib/compress/zstdmt_compress.c
  vendor/zstd/dist/lib/compress/zstdmt_compress.h
  vendor/zstd/dist/lib/decompress/zstd_decompress.c
  vendor/zstd/dist/lib/decompress/zstd_decompress_block.c
  vendor/zstd/dist/lib/dictBuilder/cover.c
  vendor/zstd/dist/lib/dictBuilder/cover.h
  vendor/zstd/dist/lib/dictBuilder/fastcover.c
  vendor/zstd/dist/lib/dictBuilder/zdict.c
  vendor/zstd/dist/lib/dictBuilder/zdict.h
  vendor/zstd/dist/lib/legacy/zstd_legacy.h
  vendor/zstd/dist/lib/legacy/zstd_v01.c
  vendor/zstd/dist/lib/legacy/zstd_v02.c
  vendor/zstd/dist/lib/legacy/zstd_v03.c
  vendor/zstd/dist/lib/legacy/zstd_v04.c
  vendor/zstd/dist/lib/legacy/zstd_v05.c
  vendor/zstd/dist/lib/legacy/zstd_v06.c
  vendor/zstd/dist/lib/legacy/zstd_v07.c
  vendor/zstd/dist/lib/zstd.h
  vendor/zstd/dist/programs/.gitignore
  vendor/zstd/dist/programs/README.md
  vendor/zstd/dist/programs/benchfn.c
  vendor/zstd/dist/programs/fileio.c
  vendor/zstd/dist/programs/fileio.h
  vendor/zstd/dist/programs/util.c
  vendor/zstd/dist/programs/zstd.1
  vendor/zstd/dist/programs/zstdcli.c
  vendor/zstd/dist/programs/zstdgrep
  vendor/zstd/dist/programs/zstdgrep.1
  vendor/zstd/dist/programs/zstdless.1
  vendor/zstd/dist/tests/.gitignore
  vendor/zstd/dist/tests/Makefile
  vendor/zstd/dist/tests/decodecorpus.c
  vendor/zstd/dist/tests/fullbench.c
  vendor/zstd/dist/tests/fuzz/Makefile
  vendor/zstd/dist/tests/fuzz/dictionary_decompress.c
  vendor/zstd/dist/tests/fuzz/fuzz.py
  vendor/zstd/dist/tests/fuzz/simple_decompress.c
  vendor/zstd/dist/tests/fuzzer.c
  vendor/zstd/dist/tests/paramgrill.c
  vendor/zstd/dist/tests/playTests.sh
  vendor/zstd/dist/tests/poolTests.c
  vendor/zstd/dist/tests/regression/results.csv
  vendor/zstd/dist/tests/zstreamtest.c
  vendor/zstd/dist/zlibWrapper/.gitignore

Modified: vendor/zstd/dist/CHANGELOG
==
--- vendor/zstd/dist/CHANGELOG  Thu Aug  8 15:11:37 2019(r350751)
+++ vendor/zstd/dist/CHANGELOG  Thu Aug  8 15:30:49 2019(r350752)
@@ -1,3 +1,33 @@
+v1.4.1
+bug: Fix data corruption in niche use cases by @terrelln (#1659)
+bug: Fuzz legacy modes, fix uncovered bugs by @terrelln (#1593, #1594, #1595)
+bug: Fix out of bounds read by @terrelln (#1590)
+perf: Improve decode speed by ~7% @mgrice (#1668)
+perf: Slightly improved compression ratio of level 3 and 4 (ZSTD_dfast) by 
@cyan4973 (#1681)
+perf: Slightly faster compression speed when re-using a context by @cyan4973 
(#1658)
+perf: Improve compression ratio for small windowLog by @cyan4973 (#1624)
+perf: Faster compression speed in high compression mode for repetitive data by 
@terrelln (#1635)
+api: Add parameter to generate smaller dictionaries by @tyler-tran (#1656)
+cli: Recognize symlinks when built in C99 mode by @felixhandte (#1640)
+cli: Expose cpu load indicator for each file on -vv mode by @ephiepark (#1631)
+cli: Restrict read permissions on destination files by @chungy (#1644)
+cli: zstdgrep: handle -f flag by @felixhandte (#1618)
+cli: zstdcat: follow symlinks by @vejnar (#1604)
+doc: Remove extra size limit on compressed blocks by @felixhandte (#1689)
+doc: Fix typo by @yk-tanigawa (#1633)
+doc: Improve documentation on streaming buffer sizes by @cyan4973 (#1629)
+build: CMake: support building with LZ4 @leeyoung624 (#1626)
+build: CMake: install zstdless and zstdgrep by @leeyoung624 (#1647)
+build: CMake: respect existing uninstall target by @j301scott (#1619)
+build: Make: skip multithread tests when built without support by 
@michaelforney (#1620)
+build: Make: Fix examples/ test target by @sjnam (#1603)
+build: Meson: rename options out of deprecated namespace by @lzutao (#1665)
+build: Meson: fix build by @lzutao (#1602)
+build: Visual Studio: don't export symbols in static lib by @scharan (#1650)
+build: Visual Studio: fix linking by @absotively (#1639)
+build: Fix MinGW-W64 build by @myzhang1029 (#1600)
+misc: 

svn commit: r350751 - head/sys/conf

2019-08-08 Thread Warner Losh
Author: imp
Date: Thu Aug  8 15:11:37 2019
New Revision: 350751
URL: https://svnweb.freebsd.org/changeset/base/350751

Log:
  Add TCP_RFC7413
  
  We should be linting this This isn't enabled on all platforms, but compiles on
  them all.
  
  Noticed by: jhb in another review

Modified:
  head/sys/conf/NOTES

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Thu Aug  8 14:34:53 2019(r350750)
+++ head/sys/conf/NOTES Thu Aug  8 15:11:37 2019(r350751)
@@ -655,6 +655,7 @@ options ROUTETABLES=2   # allocated fibs up to 
65536. 
# but that would be a bad idea as they 
are large.
 
 optionsTCP_OFFLOAD # TCP offload support.
+optionsTCP_RFC7413 # TCP Fast Open
 
 optionsTCPHPTS
 
___
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: r350750 - head/sys/crypto/armv8

2019-08-08 Thread Ed Maste
Author: emaste
Date: Thu Aug  8 14:34:53 2019
New Revision: 350750
URL: https://svnweb.freebsd.org/changeset/base/350750

Log:
  armv8crypto: add missing unlock for session (after r336439)
  
  Attempts to use cryptodev (e.g. tests at /usr/src/tests/sys/opencrypto
  with armv8crypto added to the module lists) were causing a panic.
  
  Submitted by: Greg V 
  Differential Revision:https://reviews.freebsd.org/D21012

Modified:
  head/sys/crypto/armv8/armv8_crypto.c

Modified: head/sys/crypto/armv8/armv8_crypto.c
==
--- head/sys/crypto/armv8/armv8_crypto.cThu Aug  8 11:43:09 2019
(r350749)
+++ head/sys/crypto/armv8/armv8_crypto.cThu Aug  8 14:34:53 2019
(r350750)
@@ -274,9 +274,11 @@ armv8_crypto_newsession(device_t dev, crypto_session_t
error = armv8_crypto_cipher_setup(ses, encini);
if (error != 0) {
CRYPTDEB("setup failed");
+   rw_wunlock(>lock);
return (error);
}
 
+   rw_wunlock(>lock);
return (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"


Re: svn commit: r350737 - head/usr.sbin/autofs

2019-08-08 Thread Ian Lepore
On Thu, 2019-08-08 at 03:16 +, Justin Hibbits wrote:
> Author: jhibbits
> Date: Thu Aug  8 03:16:32 2019
> New Revision: 350737
> URL: https://svnweb.freebsd.org/changeset/base/350737
> 
> Log:
>   Change autounmountd(8) to use time_t for duration instead of double
>   
>   Summary:
>   autounmountd(8) uses doubles to handle mount time durations.  However,
>   it must convert to integer types, time_t in particular, to do anything
>   meaningful.  Additionally, even though it's a floating-point value in
>   seconds, the sub-seconds component is never used, so it's unnecessary.
>   
>   Switching type to time_t fixes an assertion on powerpc64, which checks
>   that a sleep value that's not -1.0 is greater than 0.  On powerpc64, it
>   happens that the value of -1.0 gets loaded as a float (perhaps a bug in
>   gcc), but gets compared to a double.  This compares as false, so follows
>   through the 'sleep != -1.0' path, and fails the assert.  Since the
>   sub-second component isn't used in the double, just drop it and deal
>   with whole-integer seconds.
>   
>   Reviewed by:trasz
>   Differential Revision: https://reviews.freebsd.org/D21109
> 
> Modified:
>   head/usr.sbin/autofs/autounmountd.c
> 
> Modified: head/usr.sbin/autofs/autounmountd.c
> ==
> --- head/usr.sbin/autofs/autounmountd.c   Thu Aug  8 03:01:35 2019
> (r350736)
> +++ head/usr.sbin/autofs/autounmountd.c   Thu Aug  8 03:16:32 2019
> (r350737)
> @@ -179,12 +179,12 @@ unmount_by_fsid(const fsid_t fsid, const char *mountpo
>   return (error);
>  }
>  
> -static double
> -expire_automounted(double expiration_time)
> +static time_t
> +expire_automounted(time_t expiration_time)
>  {
>   struct automounted_fs *af, *tmpaf;
>   time_t now;
> - double mounted_for, mounted_max = -1.0;
> + time_t mounted_for, mounted_max = -1;
>   int error;
>  
>   now = time(NULL);
> @@ -196,9 +196,9 @@ expire_automounted(double expiration_time)
>  
>   if (mounted_for < expiration_time) {
>   log_debugx("skipping %s (FSID:%d:%d), mounted "
> - "for %.0f seconds", af->af_mountpoint,
> + "for %ld  seconds", af->af_mountpoint,

You can't print a time_t with %ld, it'll fail on 32-bit arches with 64-
bit time_t.  The usual incantation is %j and cast to intmax_t.

-- Ian


___
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: r350749 - head/sys/netinet

2019-08-08 Thread Tom Jones
Author: thj
Date: Thu Aug  8 11:43:09 2019
New Revision: 350749
URL: https://svnweb.freebsd.org/changeset/base/350749

Log:
  Rename IPPROTO 33 from SEP to DCCP
  
  IPPROTO 33 is DCCP in the IANA Registry:
  https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml
  
  IPPROTO_SEP was added about 20 years ago in r33804. The entries were added
  straight from RFC1700, without regard to whether they were used.
  
  The reference in RFC1700 for SEP is '[JC120] ', this is an
  indication that the protocol number was probably in use in a private network.
  
  As RFC1700 is no longer the authoritative list of internet numbers and that
  IANA assinged 33 to DCCP in RFC4340, change the header to the actual
  authoritative source.
  
  Reviewed by:  Richard Scheffenegger, bz
  Approved by:  bz (mentor)
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D21178

Modified:
  head/sys/netinet/in.h

Modified: head/sys/netinet/in.h
==
--- head/sys/netinet/in.h   Thu Aug  8 10:59:54 2019(r350748)
+++ head/sys/netinet/in.h   Thu Aug  8 11:43:09 2019(r350749)
@@ -169,7 +169,7 @@ __END_DECLS
 #defineIPPROTO_BLT 30  /* Bulk Data Transfer */
 #defineIPPROTO_NSP 31  /* Network Services */
 #defineIPPROTO_INP 32  /* Merit Internodal */
-#defineIPPROTO_SEP 33  /* Sequential Exchange 
*/
+#defineIPPROTO_DCCP33  /* Datagram Congestion 
Control Protocol */
 #defineIPPROTO_3PC 34  /* Third Party Connect 
*/
 #defineIPPROTO_IDPR35  /* InterDomain Policy 
Routing */
 #defineIPPROTO_XTP 36  /* XTP */
___
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: r350748 - head/sys/netinet6

2019-08-08 Thread Bjoern A. Zeeb
Author: bz
Date: Thu Aug  8 10:59:54 2019
New Revision: 350748
URL: https://svnweb.freebsd.org/changeset/base/350748

Log:
  frag6: move public structure into file local space.
  
  Move ip6asfrag and the accompanying IP6_REASS_MBUF macro from
  ip6_var.h into frag6.c as they are not used outside frag6.c.
  Sadly struct ip6q is all over the mac framework so we have to
  leave it public.
  
  This reduces the public KPI space.
  
  MFC after:3 months
  X-MFC:possibly MFC the #define only to stable branches
  Sponsored by: Netflix

Modified:
  head/sys/netinet6/frag6.c
  head/sys/netinet6/ip6_var.h

Modified: head/sys/netinet6/frag6.c
==
--- head/sys/netinet6/frag6.c   Thu Aug  8 10:15:47 2019(r350747)
+++ head/sys/netinet6/frag6.c   Thu Aug  8 10:59:54 2019(r350748)
@@ -86,6 +86,18 @@ struct ip6qbucket {
int count;
 };
 
+struct ip6asfrag {
+   struct ip6asfrag *ip6af_down;
+   struct ip6asfrag *ip6af_up;
+   struct mbuf *ip6af_m;
+   int ip6af_offset;   /* offset in ip6af_m to next header */
+   int ip6af_frglen;   /* fragmentable part length */
+   int ip6af_off;  /* fragment offset */
+   u_int16_t   ip6af_mff;  /* more fragment bit in frag off */
+};
+
+#define IP6_REASS_MBUF(ip6af) (*(struct mbuf **)&((ip6af)->ip6af_m))
+
 static MALLOC_DEFINE(M_FRAG6, "frag6", "IPv6 fragment reassembly header");
 
 /* System wide (global) maximum and count of packets in reassembly queues. */ 

Modified: head/sys/netinet6/ip6_var.h
==
--- head/sys/netinet6/ip6_var.h Thu Aug  8 10:15:47 2019(r350747)
+++ head/sys/netinet6/ip6_var.h Thu Aug  8 10:59:54 2019(r350748)
@@ -68,6 +68,7 @@
 
 #include 
 
+struct ip6asfrag;
 /*
  * IP6 reassembly queue structure.  Each fragment
  * being reassembled is attached to one of these structures.
@@ -83,24 +84,9 @@ struct   ip6q {
struct ip6q *ip6q_next;
struct ip6q *ip6q_prev;
int ip6q_unfrglen;  /* len of unfragmentable part */
-#ifdef notyet
-   u_char  *ip6q_nxtp;
-#endif
int ip6q_nfrag; /* # of fragments */
struct label*ip6q_label;
 };
-
-struct ip6asfrag {
-   struct ip6asfrag *ip6af_down;
-   struct ip6asfrag *ip6af_up;
-   struct mbuf *ip6af_m;
-   int ip6af_offset;   /* offset in ip6af_m to next header */
-   int ip6af_frglen;   /* fragmentable part length */
-   int ip6af_off;  /* fragment offset */
-   u_int16_t   ip6af_mff;  /* more fragment bit in frag off */
-};
-
-#define IP6_REASS_MBUF(ip6af) (*(struct mbuf **)&((ip6af)->ip6af_m))
 
 /*
  * IP6 reinjecting structure.
___
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: r350713 - head/sys/kern

2019-08-08 Thread Bruce Evans

On Thu, 8 Aug 2019, Conrad Meyer wrote:


Log:
 ddb(4): Add 'sysctl' command

 Implement `sysctl` in `ddb` by overriding `SYSCTL_OUT`.  When handling the
 req, we install custom ddb in/out handlers.  The out handler prints straight
 to the debugger, while the in handler ignores all input.  This is intended
 to allow us to print just about any sysctl.

 There is a known issue when used from ddb(4) entered via 'sysctl
 debug.kdb.enter=1'.  The DDB mode does not quite prevent all lock
 interactions, and it is possible for the recursive Giant lock to be unlocked
 when the ddb(4) 'sysctl' command is used.  This may result in a panic on
 return from ddb(4) via 'c' (continue).  Obviously, this is not a problem
 when debugging already-paniced systems.


Locking for kdb was grossly broken in r339917, by setting and unsetting
the SCHEDULER_STOPPED() flag on entry and exit to kdb.  This flag is only
usable during panic() since when it is set all mutex operations potentially
corrupt their mutex, and unsetting the flag doesn't undo the corruption.

Many different types of corruption are possible, but my simplest example
if like the one here for Giant, but for a spinlock.  kdb runs happily while
SCHEDULER_STOPPED() is set, but if it corrupts a mutex then the corruption
is fatal later when SCHEDULER_STOPPED() is clear (setting SCHEDULER_STOPPED()
breaks early detection of the corruption in most cases).

kern_sysctl.c does only 1 pair of mutex calls.  In
sysctl_root_handle_locked(), it locks and unlocks Giant for the !MPSAFE case.
If that is the only mutex call, then the problem is easy to fix by not
making these calls if kdb_active.

One of my versions of kdb asserts that no mutex calls are made if
kdb_active.  This makes it easy to find buggy mutex calls.
Unfortunately, low-quality low level console drivers like vt make such
calls unconditionally.  I used this to avoid all the buggy calls in
syscons (a typical error there was for to wander into wakeup or timeout
code which uses mutexes.  This was "fixed" by removing things like
beeping for errors.  The keyboard driver uses Giant fundamentally.
This was "fixed" using the usual hack of not doing the mutex call if
kdb_active).


...
Modified: head/sys/kern/kern_sysctl.c
==
--- head/sys/kern/kern_sysctl.c Thu Aug  8 00:33:23 2019(r350712)
+++ head/sys/kern/kern_sysctl.c Thu Aug  8 00:42:29 2019(r350713)
...
+/*
+ * Run a sysctl handler with the DDB oldfunc and newfunc attached.
+ * Instead of copying any output to a buffer we'll dump it right to
+ * the console.
+ */
+static int
+db_sysctl(struct sysctl_oid *oidp, int *name, u_int namelen,
+void *old, size_t *oldlenp, size_t *retval, int flags)
+{
+   struct sysctl_req req;
+   int error;
+
+   /* Setup the request */
+   bzero(, sizeof req);
+   req.td = kdb_thread;
+   req.oldfunc = sysctl_old_ddb;
+   req.newfunc = sysctl_new_ddb;
+   req.lock = REQ_UNWIRED;
+   if (oldlenp) {
+   req.oldlen = *oldlenp;
+   }
+   req.validlen = req.oldlen;
+   if (old) {
+   req.oldptr = old;
+   }
+
+   /* Setup our globals for sysctl_old_ddb */
+   g_ddb_oid = oidp;
+   g_ddb_sysctl_flags = flags;
+   g_ddb_sysctl_printed = 0;


This has many style bugs.  So does the rest of the file.


+
+   error = sysctl_root(0, name, namelen, );


This makes invalid mutex calls for all !MPSAFE sysctls.

Setting SCHEDULER_STOPPED() for kdb is only very broken for spin mutexes.
Then for a contested mutex, mtx_lock_spin() ends up doing nothing except
invalid lock and/or kdtrace profiling when it finds SCHEDULER_STOPPED()
set. but mtx_unlock_spin() never checks SCHEDULER_STOPPED(), so it ends
up corrupting the mutex and the spinlock state by attempting to unlock
a mutex whose corresponding locking was not done.  INVARIANTS causes
similar bugs for recursed-on spin mutexes.  Without INVARIANTS, everything
is done inline without checking SCHEDULER_STOPPED(), so it works well enough
in practice in uncontested non-recursive cases.  With INVARIANTS, the null
locking gives no increment of the recursion counter and no call to
spinlock_enter(), but the non-null unlocking decrements the recursion
counter and calls spinlock_exit().

For sleep mutexes, unlocking checks SCHEDULER_STOPPED() consistently with
locking, so the bugs are smaller.  The easiest way to demonstrate them is
to configure INVARIANTS and WITNESS.  Starting with Giant unheld,
mtx_lock() does nothing with the mutex except invalid lock and/or
kdtrace profiling.  mtx_unlock) calls __mtx_unlock_flags()
which calls __mtx_assert(m, MA_OWNED), but this check is subverted by not
doing it when SCHEDULER_STOPPED().  But before that, __mtx_unlock_flags()
calls WITNESS_UNLOCK() and witness_unlock() is not similarly subverted.
Also, WITNESS uses a critical spin mutex w_mtx, and this is corrupted as
above.

Bruce

svn commit: r350747 - head/sys/netinet6

2019-08-08 Thread Bjoern A. Zeeb
Author: bz
Date: Thu Aug  8 10:15:47 2019
New Revision: 350747
URL: https://svnweb.freebsd.org/changeset/base/350747

Log:
  frag6.c: cleanup varaibles and return statements.
  
  Consitently put () around return values.
  Do not assign variables at the time of variable declaration.
  Sort variables.  Rename ia to ia6, remove/reuse some variables used only
  once or twice for temporary calculations.
  
  No functional changes intended.
  
  MFC after:3 months
  Sponsored by: Netflix

Modified:
  head/sys/netinet6/frag6.c

Modified: head/sys/netinet6/frag6.c
==
--- head/sys/netinet6/frag6.c   Thu Aug  8 09:42:57 2019(r350746)
+++ head/sys/netinet6/frag6.c   Thu Aug  8 10:15:47 2019(r350747)
@@ -186,17 +186,20 @@ SYSCTL_INT(_net_inet6_ip6, IPV6CTL_MAXFRAGBUCKETSIZE, 
 int
 ip6_deletefraghdr(struct mbuf *m, int offset, int wait)
 {
-   struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
+   struct ip6_hdr *ip6;
struct mbuf *t;
 
/* Delete frag6 header. */
if (m->m_len >= offset + sizeof(struct ip6_frag)) {
+
/* This is the only possible case with !PULLDOWN_TEST. */
+   ip6  = mtod(m, struct ip6_hdr *);
bcopy(ip6, (char *)ip6 + sizeof(struct ip6_frag),
offset);
m->m_data += sizeof(struct ip6_frag);
m->m_len -= sizeof(struct ip6_frag);
} else {
+
/* This comes with no copy if the boundary is on cluster. */
if ((t = m_split(m, offset, wait)) == NULL)
return (ENOMEM);
@@ -214,14 +217,16 @@ ip6_deletefraghdr(struct mbuf *m, int offset, int wait
 static void
 frag6_freef(struct ip6q *q6, uint32_t bucket)
 {
+   struct ip6_hdr *ip6;
struct ip6asfrag *af6, *down6;
+   struct mbuf *m;
 
IP6QB_LOCK_ASSERT(bucket);
 
for (af6 = q6->ip6q_down; af6 != (struct ip6asfrag *)q6;
 af6 = down6) {
-   struct mbuf *m = IP6_REASS_MBUF(af6);
 
+   m = IP6_REASS_MBUF(af6);
down6 = af6->ip6af_down;
frag6_deq(af6, bucket);
 
@@ -230,7 +235,6 @@ frag6_freef(struct ip6q *q6, uint32_t bucket)
 * Just free other fragments.
 */
if (af6->ip6af_off == 0) {
-   struct ip6_hdr *ip6;
 
/* Adjust pointer. */
ip6 = mtod(m, struct ip6_hdr *);
@@ -290,25 +294,28 @@ frag6_freef(struct ip6q *q6, uint32_t bucket)
 int
 frag6_input(struct mbuf **mp, int *offp, int proto)
 {
-   struct mbuf *m = *mp, *t;
+   struct ifnet *dstifp;
+   struct in6_ifaddr *ia6;
struct ip6_hdr *ip6;
struct ip6_frag *ip6f;
struct ip6q *head, *q6;
-   struct ip6asfrag *af6, *ip6af, *af6dwn;
-   struct in6_ifaddr *ia;
-   int offset = *offp, nxt, i, next;
-   int first_frag = 0;
-   int fragoff, frgpartlen;/* must be larger than u_int16_t */
+   struct ip6asfrag *af6, *af6dwn, *ip6af;
+   struct mbuf *m, *t;
uint32_t hashkey[(sizeof(struct in6_addr) * 2 +
sizeof(ip6f->ip6f_ident)) / sizeof(uint32_t)];
uint32_t bucket, *hashkeyp;
-   struct ifnet *dstifp;
-   u_int8_t ecn, ecn0;
+   int fragoff, frgpartlen;/* Must be larger than uint16_t. */
+   int nxt, offset, plen;
+   uint8_t ecn, ecn0;
+   bool only_frag;
 #ifdef RSS
-   struct m_tag *mtag;
struct ip6_direct_ctx *ip6dc;
+   struct m_tag *mtag;
 #endif
 
+   m = *mp;
+   offset = *offp;
+
ip6 = mtod(m, struct ip6_hdr *);
 #ifndef PULLDOWN_TEST
IP6_EXTHDR_CHECK(m, offset, sizeof(struct ip6_frag), IPPROTO_DONE);
@@ -321,17 +328,17 @@ frag6_input(struct mbuf **mp, int *offp, int proto)
 
dstifp = NULL;
/* Find the destination interface of the packet. */
-   ia = in6ifa_ifwithaddr(>ip6_dst, 0 /* XXX */);
-   if (ia != NULL) {
-   dstifp = ia->ia_ifp;
-   ifa_free(>ia_ifa);
+   ia6 = in6ifa_ifwithaddr(>ip6_dst, 0 /* XXX */);
+   if (ia6 != NULL) {
+   dstifp = ia6->ia_ifp;
+   ifa_free(>ia_ifa);
}
 
/* Jumbo payload cannot contain a fragment header. */
if (ip6->ip6_plen == 0) {
icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, 
offset);
in6_ifstat_inc(dstifp, ifs6_reass_fail);
-   return IPPROTO_DONE;
+   return (IPPROTO_DONE);
}
 
/*
@@ -345,7 +352,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto)
icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER,
offsetof(struct ip6_hdr, ip6_plen));
in6_ifstat_inc(dstifp, ifs6_reass_fail);
-   return IPPROTO_DONE;
+   return (IPPROTO_DONE);
   

Re: svn commit: r350512 - head/tests/sys/kern

2019-08-08 Thread Enji Cooper


> On Aug 7, 2019, at 2:04 PM, Li-Wen Hsu  wrote:
> 
> On Thu, Aug 8, 2019 at 4:27 AM Mark Johnston  > wrote:
>> 
>> On Thu, Aug 01, 2019 at 06:19:16PM +, Li-Wen Hsu wrote:
>>> Author: lwhsu
>>> Date: Thu Aug  1 18:19:16 2019
>>> New Revision: 350512
>>> URL: https://svnweb.freebsd.org/changeset/base/350512
>>> 
>>> Log:
>>>  Only skip test cases sometimes failing in CI when they are running in CI
>>> 
>>>  Suggested by:   jhb
>>>  Sponsored by:   The FreeBSD Foundation
>> 
>> This seems to break running the tests manually; atf dies because the
>> "ci" variable is not defined.  I have to use an invocation like this to
>> avoid that:
>> 
>> $ kyua -v test_suites.FreeBSD.ci=false test ptrace_test
>> 
>> I suspect that share/mk/suite.test.mk needs to be augmented somehow to
>> set this variable to "false" by default, so that the CI infrastructure
>> can override that.
> 
> Thanks for catching this!  I feel that the better approach is using
> function that gets this variable with default value, for keeping
> things simple.

This is the right API to use:

 atf_tc_get_config_var_as_bool_wd(tc, variable_name, default_value);

Just set the default to `false`.

HTH,
-Enji
___
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: r350746 - head/sys/netinet6

2019-08-08 Thread Bjoern A. Zeeb
Author: bz
Date: Thu Aug  8 09:42:57 2019
New Revision: 350746
URL: https://svnweb.freebsd.org/changeset/base/350746

Log:
  frag6.c: initial comment and whitespace cleanup.
  
  Cleanup some comments (start with upper case, ends in punctuation,
  use width and do not consume vertical space).  Update comments to
  RFC8200.  Some whitespace changes.
  
  No functional changes.
  
  MFC after:3 months
  Sponsored by: Netflix

Modified:
  head/sys/netinet6/frag6.c

Modified: head/sys/netinet6/frag6.c
==
--- head/sys/netinet6/frag6.c   Thu Aug  8 08:23:27 2019(r350745)
+++ head/sys/netinet6/frag6.c   Thu Aug  8 09:42:57 2019(r350746)
@@ -60,16 +60,14 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include   /* for ECN definitions */
-#include /* for ECN definitions */
+#include   /* For ECN definitions. */
+#include /* For ECN definitions. */
 
 #ifdef MAC
 #include 
 #endif
 
-/*
- * Reassembly headers are stored in hash buckets.
- */
+/* Reassembly headers are stored in hash buckets. */
 #defineIP6REASS_NHASH_LOG2 10
 #defineIP6REASS_NHASH  (1 << IP6REASS_NHASH_LOG2)
 #defineIP6REASS_HMASK  (IP6REASS_NHASH - 1)
@@ -211,8 +209,7 @@ ip6_deletefraghdr(struct mbuf *m, int offset, int wait
 }
 
 /*
- * Free a fragment reassembly header and all
- * associated datagrams.
+ * Free a fragment reassembly header and all associated datagrams.
  */
 static void
 frag6_freef(struct ip6q *q6, uint32_t bucket)
@@ -235,17 +232,18 @@ frag6_freef(struct ip6q *q6, uint32_t bucket)
if (af6->ip6af_off == 0) {
struct ip6_hdr *ip6;
 
-   /* adjust pointer */
+   /* Adjust pointer. */
ip6 = mtod(m, struct ip6_hdr *);
 
-   /* restore source and destination addresses */
+   /* Restore source and destination addresses. */
ip6->ip6_src = q6->ip6q_src;
ip6->ip6_dst = q6->ip6q_dst;
 
icmp6_error(m, ICMP6_TIME_EXCEEDED,
-   ICMP6_TIME_EXCEED_REASSEMBLY, 0);
+   ICMP6_TIME_EXCEED_REASSEMBLY, 0);
} else
m_freem(m);
+
free(af6, M_FRAG6);
}
frag6_remque(q6, bucket);
@@ -258,27 +256,27 @@ frag6_freef(struct ip6q *q6, uint32_t bucket)
 }
 
 /*
- * In RFC2460, fragment and reassembly rule do not agree with each other,
- * in terms of next header field handling in fragment header.
+ * Like in RFC2460, in RFC8200, fragment and reassembly rules do not agree with
+ * each other, in terms of next header field handling in fragment header.
  * While the sender will use the same value for all of the fragmented packets,
- * receiver is suggested not to check the consistency.
+ * receiver is suggested not to check for consistency.
  *
- * fragment rule (p20):
- * (2) A Fragment header containing:
- * The Next Header value that identifies the first header of
- * the Fragmentable Part of the original packet.
+ * Fragment rules (p18,p19):
+ * (2)  A Fragment header containing:
+ * The Next Header value that identifies the first header
+ * after the Per-Fragment headers of the original packet.
  * -> next header field is same for all fragments
  *
- * reassembly rule (p21):
- * The Next Header field of the last header of the Unfragmentable
- * Part is obtained from the Next Header field of the first
+ * Reassembly rule (p20):
+ * The Next Header field of the last header of the Per-Fragment
+ * headers is obtained from the Next Header field of the first
  * fragment's Fragment header.
  * -> should grab it from the first fragment only
  *
  * The following note also contradicts with fragment rule - no one is going to
  * send different fragment with different next header field.
  *
- * additional note (p22):
+ * Additional note (p22) [not an error]:
  * The Next Header values in the Fragment headers of different
  * fragments of the same original packet may differ.  Only the value
  * from the Offset zero fragment packet is used for reassembly.
@@ -287,7 +285,7 @@ frag6_freef(struct ip6q *q6, uint32_t bucket)
  * There is no explicit reason given in the RFC.  Historical reason maybe?
  */
 /*
- * Fragment input
+ * Fragment input.
  */
 int
 frag6_input(struct mbuf **mp, int *offp, int proto)
@@ -322,13 +320,14 @@ frag6_input(struct mbuf **mp, int *offp, int proto)
 #endif
 
dstifp = NULL;
-   /* find the destination interface of the packet. */
+   /* Find the destination interface of the packet. */
ia = in6ifa_ifwithaddr(>ip6_dst, 0 /* XXX */);
if (ia != NULL) {
dstifp = ia->ia_ifp;

svn commit: r350745 - head/sys/netinet

2019-08-08 Thread Michael Tuexen
Author: tuexen
Date: Thu Aug  8 08:23:27 2019
New Revision: 350745
URL: https://svnweb.freebsd.org/changeset/base/350745

Log:
  Fix a typo.
  
  Submitted by: Thomas Dreibholz
  MFC after:1 week

Modified:
  head/sys/netinet/sctp_asconf.c

Modified: head/sys/netinet/sctp_asconf.c
==
--- head/sys/netinet/sctp_asconf.c  Thu Aug  8 07:27:49 2019
(r350744)
+++ head/sys/netinet/sctp_asconf.c  Thu Aug  8 08:23:27 2019
(r350745)
@@ -1366,7 +1366,7 @@ sctp_asconf_queue_add(struct sctp_tcb *stcb, struct sc
if (sctp_asconf_queue_mgmt(stcb,
stcb->asoc.asconf_addr_del_pending,
SCTP_DEL_IP_ADDRESS) == 0) {
-   SCTPDBG(SCTP_DEBUG_ASCONF2, "asconf_queue_add: queing 
pending delete\n");
+   SCTPDBG(SCTP_DEBUG_ASCONF2, "asconf_queue_add: queuing 
pending delete\n");
pending_delete_queued = 1;
/* clear out the pending delete info */
stcb->asoc.asconf_del_pending = 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: r350744 - head/sys/kern

2019-08-08 Thread Xin LI
Author: delphij
Date: Thu Aug  8 07:27:49 2019
New Revision: 350744
URL: https://svnweb.freebsd.org/changeset/base/350744

Log:
  Convert DDB_CTF to use newer version of ZLIB.
  
  PR:   229763
  Submitted by: Yoshihiro Ota 
  Differential Revision:https://reviews.freebsd.org/D21176

Modified:
  head/sys/kern/kern_ctf.c
  head/sys/kern/link_elf.c
  head/sys/kern/link_elf_obj.c

Modified: head/sys/kern/kern_ctf.c
==
--- head/sys/kern/kern_ctf.cThu Aug  8 06:30:12 2019(r350743)
+++ head/sys/kern/kern_ctf.cThu Aug  8 07:27:49 2019(r350744)
@@ -40,21 +40,7 @@
 #define CTF_HDR_STRLEN_U32 8
 
 #ifdef DDB_CTF
-static void *
-z_alloc(void *nil, u_int items, u_int size)
-{
-   void *ptr;
-
-   ptr = malloc(items * size, M_TEMP, M_NOWAIT);
-   return ptr;
-}
-
-static void
-z_free(void *nil, void *ptr)
-{
-   free(ptr, M_TEMP);
-}
-
+#include 
 #endif
 
 static int
@@ -269,8 +255,6 @@ link_elf_ctf_get(linker_file_t lf, linker_ctf_t *lc)
 
/* Initialise the zlib structure. */
bzero(, sizeof(zs));
-   zs.zalloc = z_alloc;
-   zs.zfree = z_free;
 
if (inflateInit() != Z_OK) {
error = EIO;

Modified: head/sys/kern/link_elf.c
==
--- head/sys/kern/link_elf.cThu Aug  8 06:30:12 2019(r350743)
+++ head/sys/kern/link_elf.cThu Aug  8 07:27:49 2019(r350744)
@@ -67,10 +67,6 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-#ifdef DDB_CTF
-#include 
-#endif
-
 #include "linker_if.h"
 
 #define MAXSEGS 4

Modified: head/sys/kern/link_elf_obj.c
==
--- head/sys/kern/link_elf_obj.cThu Aug  8 06:30:12 2019
(r350743)
+++ head/sys/kern/link_elf_obj.cThu Aug  8 07:27:49 2019
(r350744)
@@ -62,7 +62,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #ifdef DDB_CTF
-#include 
+#include 
 #endif
 
 #include "linker_if.h"
___
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: r350743 - head/sys/dev/bxe

2019-08-08 Thread Xin LI
Author: delphij
Date: Thu Aug  8 06:30:12 2019
New Revision: 350743
URL: https://svnweb.freebsd.org/changeset/base/350743

Log:
  Update bxe(4) to use new zlib.
  
  PR:   229763
  Submitted by: Yoshihiro Ota 
  Differential Revision:https://reviews.freebsd.org/D21175

Modified:
  head/sys/dev/bxe/bxe.h

Modified: head/sys/dev/bxe/bxe.h
==
--- head/sys/dev/bxe/bxe.h  Thu Aug  8 06:27:39 2019(r350742)
+++ head/sys/dev/bxe/bxe.h  Thu Aug  8 06:30:12 2019(r350743)
@@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #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: r350742 - in head/sys: geom/uzip modules/geom/geom_uzip

2019-08-08 Thread Xin LI
Author: delphij
Date: Thu Aug  8 06:27:39 2019
New Revision: 350742
URL: https://svnweb.freebsd.org/changeset/base/350742

Log:
  Update geom_uzip to use new zlib:
  
   - Use new zlib headers;
   - Removed z_alloc and z_free to use the common sys/dev/zlib version.
   - Replace z_compressBound with compressBound from zlib.
  
  While there, limit LZMA CFLAGS to apply only for g_uzip_lzma.c.
  
  PR:   229763
  Submitted by: Yoshihiro Ota  (with changes,
bugs are mine)
  Differential Revision:https://reviews.freebsd.org/D20271

Modified:
  head/sys/geom/uzip/g_uzip_zlib.c
  head/sys/modules/geom/geom_uzip/Makefile

Modified: head/sys/geom/uzip/g_uzip_zlib.c
==
--- head/sys/geom/uzip/g_uzip_zlib.cThu Aug  8 06:26:34 2019
(r350741)
+++ head/sys/geom/uzip/g_uzip_zlib.cThu Aug  8 06:27:39 2019
(r350742)
@@ -33,7 +33,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
+#include 
+#include 
 
 #include 
 #include 
@@ -46,8 +47,6 @@ struct g_uzip_zlib {
z_stream zs;
 };
 
-static void *z_alloc(void *, u_int, u_int);
-static void z_free(void *, void *);
 static int g_uzip_zlib_rewind(struct g_uzip_dapi *, const char *);
 
 static void
@@ -97,26 +96,17 @@ g_uzip_zlib_rewind(struct g_uzip_dapi *zpp, const char
return (err);
 }
 
-static int
-z_compressBound(int len)
-{
-
-   return (len + (len >> 12) + (len >> 14) + 11);
-}
-
 struct g_uzip_dapi *
 g_uzip_zlib_ctor(uint32_t blksz)
 {
struct g_uzip_zlib *zp;
 
-   zp = malloc(sizeof(struct g_uzip_zlib), M_GEOM_UZIP, M_WAITOK);
-   zp->zs.zalloc = z_alloc;
-   zp->zs.zfree = z_free;
+   zp = malloc(sizeof(struct g_uzip_zlib), M_GEOM_UZIP, M_WAITOK | M_ZERO);
if (inflateInit(>zs) != Z_OK) {
goto e1;
}
zp->blksz = blksz;
-   zp->pub.max_blen = z_compressBound(blksz);
+   zp->pub.max_blen = compressBound(blksz);
zp->pub.decompress = _uzip_zlib_decompress;
zp->pub.free = _uzip_zlib_free;
zp->pub.rewind = _uzip_zlib_rewind;
@@ -125,21 +115,4 @@ g_uzip_zlib_ctor(uint32_t blksz)
 e1:
free(zp, M_GEOM_UZIP);
return (NULL);
-}
-
-static void *
-z_alloc(void *nil, u_int type, u_int size)
-{
-void *ptr;
-
-ptr = malloc(type * size, M_GEOM_UZIP, M_NOWAIT);
-
-return (ptr);
-}
-
-static void
-z_free(void *nil, void *ptr)
-{
-
-free(ptr, M_GEOM_UZIP);
 }

Modified: head/sys/modules/geom/geom_uzip/Makefile
==
--- head/sys/modules/geom/geom_uzip/MakefileThu Aug  8 06:26:34 2019
(r350741)
+++ head/sys/modules/geom/geom_uzip/MakefileThu Aug  8 06:27:39 2019
(r350742)
@@ -10,7 +10,7 @@ SRCS+=g_uzip.h g_uzip_dapi.h g_uzip_lzma.h g_uzip_zli
 
 .PATH: ${SRCTOP}/sys/net
 
-CFLAGS+= -I${SRCTOP}/sys/contrib/xz-embedded/freebsd \
+CFLAGS.g_uzip_lzma.c+= -I${SRCTOP}/sys/contrib/xz-embedded/freebsd \
-I${SRCTOP}/sys/contrib/xz-embedded/linux/lib/xz/
 SRCS+= opt_geom.h
 
___
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: r350741 - in head/sys/arm64: arm64 include

2019-08-08 Thread Alan Cox
Author: alc
Date: Thu Aug  8 06:26:34 2019
New Revision: 350741
URL: https://svnweb.freebsd.org/changeset/base/350741

Log:
  Ordinarily, during a superpage promotion or demotion within a pmap, the
  pmap's lock ensures that other operations on the pmap don't observe the
  old mapping being broken before the new mapping is established.  However,
  pmap_kextract() doesn't acquire the kernel pmap's lock, so it may observe
  the broken mapping.  And, if it does, it returns an incorrect result.
  
  This revision implements a lock-free solution to this problem in
  pmap_update_entry() and pmap_kextract() because pmap_kextract() can't
  acquire the kernel pmap's lock.
  
  Reported by:  andrew, greg_unrelenting.technology
  Reviewed by:  andrew, markj
  Tested by:greg_unrelenting.technology
  X-MFC with:   r350579
  Differential Revision:https://reviews.freebsd.org/D21169

Modified:
  head/sys/arm64/arm64/pmap.c
  head/sys/arm64/include/pte.h

Modified: head/sys/arm64/arm64/pmap.c
==
--- head/sys/arm64/arm64/pmap.c Thu Aug  8 04:29:46 2019(r350740)
+++ head/sys/arm64/arm64/pmap.c Thu Aug  8 06:26:34 2019(r350741)
@@ -1128,40 +1128,35 @@ vm_paddr_t
 pmap_kextract(vm_offset_t va)
 {
pt_entry_t *pte, tpte;
-   vm_paddr_t pa;
-   int lvl;
 
-   if (va >= DMAP_MIN_ADDRESS && va < DMAP_MAX_ADDRESS) {
-   pa = DMAP_TO_PHYS(va);
-   } else {
-   pa = 0;
-   pte = pmap_pte(kernel_pmap, va, );
-   if (pte != NULL) {
-   tpte = pmap_load(pte);
-   pa = tpte & ~ATTR_MASK;
-   switch(lvl) {
-   case 1:
-   KASSERT((tpte & ATTR_DESCR_MASK) == L1_BLOCK,
-   ("pmap_kextract: Invalid L1 pte found: %lx",
-   tpte & ATTR_DESCR_MASK));
-   pa |= (va & L1_OFFSET);
-   break;
-   case 2:
-   KASSERT((tpte & ATTR_DESCR_MASK) == L2_BLOCK,
-   ("pmap_kextract: Invalid L2 pte found: %lx",
-   tpte & ATTR_DESCR_MASK));
-   pa |= (va & L2_OFFSET);
-   break;
-   case 3:
-   KASSERT((tpte & ATTR_DESCR_MASK) == L3_PAGE,
-   ("pmap_kextract: Invalid L3 pte found: %lx",
-   tpte & ATTR_DESCR_MASK));
-   pa |= (va & L3_OFFSET);
-   break;
-   }
-   }
-   }
-   return (pa);
+   if (va >= DMAP_MIN_ADDRESS && va < DMAP_MAX_ADDRESS)
+   return (DMAP_TO_PHYS(va));
+   pte = pmap_l1(kernel_pmap, va);
+   if (pte == NULL)
+   return (0);
+
+   /*
+* A concurrent pmap_update_entry() will clear the entry's valid bit
+* but leave the rest of the entry unchanged.  Therefore, we treat a
+* non-zero entry as being valid, and we ignore the valid bit when
+* determining whether the entry maps a block, page, or table.
+*/
+   tpte = pmap_load(pte);
+   if (tpte == 0)
+   return (0);
+   if ((tpte & ATTR_DESCR_TYPE_MASK) == ATTR_DESCR_TYPE_BLOCK)
+   return ((tpte & ~ATTR_MASK) | (va & L1_OFFSET));
+   pte = pmap_l1_to_l2(, va);
+   tpte = pmap_load(pte);
+   if (tpte == 0)
+   return (0);
+   if ((tpte & ATTR_DESCR_TYPE_MASK) == ATTR_DESCR_TYPE_BLOCK)
+   return ((tpte & ~ATTR_MASK) | (va & L2_OFFSET));
+   pte = pmap_l2_to_l3(, va);
+   tpte = pmap_load(pte);
+   if (tpte == 0)
+   return (0);
+   return ((tpte & ~ATTR_MASK) | (va & L3_OFFSET));
 }
 
 /***
@@ -3021,8 +3016,12 @@ pmap_update_entry(pmap_t pmap, pd_entry_t *pte, pd_ent
intr = intr_disable();
critical_enter();
 
-   /* Clear the old mapping */
-   pmap_clear(pte);
+   /*
+* Clear the old mapping's valid bit, but leave the rest of the entry
+* unchanged, so that a lockless, concurrent pmap_kextract() can still
+* lookup the physical address.
+*/
+   pmap_clear_bits(pte, ATTR_DESCR_VALID);
pmap_invalidate_range_nopin(pmap, va, va + size);
 
/* Create the new mapping */

Modified: head/sys/arm64/include/pte.h
==
--- head/sys/arm64/include/pte.hThu Aug  8 04:29:46 2019
(r350740)
+++ head/sys/arm64/include/pte.hThu Aug  8 06:26:34 2019
(r350741)
@@ -71,7 +71,12 @@ typedef  uint64_tpt_entry_t; /*