svn commit: r330970 - in head/stand/efi: include libefi

2018-03-14 Thread Toomas Soome
Author: tsoome
Date: Thu Mar 15 05:58:35 2018
New Revision: 330970
URL: https://svnweb.freebsd.org/changeset/base/330970

Log:
  libefi: UEFI_BOOT_VAR_GUID duplicates EFI_GLOBAL_VARIABLE
  
  Drop UEFI_BOOT_VAR_GUID and use EFI_GLOBAL_VARIABLE.
  
  Reviewed by:  imp
  Differential Revision:https://reviews.freebsd.org/D14696

Modified:
  head/stand/efi/include/efi.h
  head/stand/efi/libefi/efienv.c

Modified: head/stand/efi/include/efi.h
==
--- head/stand/efi/include/efi.hThu Mar 15 05:13:29 2018
(r330969)
+++ head/stand/efi/include/efi.hThu Mar 15 05:58:35 2018
(r330970)
@@ -59,7 +59,5 @@ Revision History
  */
 #define FREEBSD_BOOT_VAR_GUID \
{ 0xCFEE69AD, 0xA0DE, 0x47A9, {0x93, 0xA8, 0xF6, 0x31, 0x06, 0xF8, 
0xAE, 0x99} }
-#define UEFI_BOOT_VAR_GUID \
-   { 0x8be4df61, 0x93ca, 0x11d2, {0xaa, 0x0d, 0x00, 0xe0, 0x98, 0x03, 
0x2b, 0x8c} }
 
 #endif

Modified: head/stand/efi/libefi/efienv.c
==
--- head/stand/efi/libefi/efienv.c  Thu Mar 15 05:13:29 2018
(r330969)
+++ head/stand/efi/libefi/efienv.c  Thu Mar 15 05:58:35 2018
(r330970)
@@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 static EFI_GUID FreeBSDBootVarGUID = FREEBSD_BOOT_VAR_GUID;
-static EFI_GUID GlobalBootVarGUID = UEFI_BOOT_VAR_GUID;
+static EFI_GUID GlobalBootVarGUID = EFI_GLOBAL_VARIABLE;
 
 EFI_STATUS
 efi_getenv(EFI_GUID *g, const char *v, void *data, size_t *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: r330969 - stable/11/usr.bin/mail

2018-03-14 Thread Eitan Adler
Author: eadler
Date: Thu Mar 15 05:13:29 2018
New Revision: 330969
URL: https://svnweb.freebsd.org/changeset/base/330969

Log:
  MFC r302533:
  
  mail(1): Fix a comment.

Modified:
  stable/11/usr.bin/mail/collect.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/mail/collect.c
==
--- stable/11/usr.bin/mail/collect.cThu Mar 15 05:04:46 2018
(r330968)
+++ stable/11/usr.bin/mail/collect.cThu Mar 15 05:13:29 2018
(r330969)
@@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$");
 #include "extern.h"
 
 /*
- * Read a message from standard output and return a read file to it
+ * Read a message from standard input and return a read file to it
  * or NULL on 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: r330968 - in stable/11/usr.sbin: ifmcstat pciconf

2018-03-14 Thread Eitan Adler
Author: eadler
Date: Thu Mar 15 05:04:46 2018
New Revision: 330968
URL: https://svnweb.freebsd.org/changeset/base/330968

Log:
  MFC r327580,r327581:
  
  bits is never null when we call ot. Add an assert to that effect and
  remove test for NULL.
  
  Remove dead code (comma is either 0 or 1 for sure, no need to test).
  Close /dev/pci when we're done with it.

Modified:
  stable/11/usr.sbin/ifmcstat/printb.c
  stable/11/usr.sbin/pciconf/cap.c
  stable/11/usr.sbin/pciconf/pciconf.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/ifmcstat/printb.c
==
--- stable/11/usr.sbin/ifmcstat/printb.cThu Mar 15 04:59:47 2018
(r330967)
+++ stable/11/usr.sbin/ifmcstat/printb.cThu Mar 15 05:04:46 2018
(r330968)
@@ -32,6 +32,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include 
 #include 
 
 /*
@@ -43,7 +44,8 @@ printb(const char *s, unsigned int v, const char *bits
int i, any = 0;
char c;
 
-   if (bits && *bits == 8)
+   assert(bits != NULL);
+   if (*bits == 8)
printf("%s=%o", s, v);
else
printf("%s=%x", s, v);

Modified: stable/11/usr.sbin/pciconf/cap.c
==
--- stable/11/usr.sbin/pciconf/cap.cThu Mar 15 04:59:47 2018
(r330967)
+++ stable/11/usr.sbin/pciconf/cap.cThu Mar 15 05:04:46 2018
(r330968)
@@ -161,7 +161,7 @@ cap_pcix(int fd, struct pci_conf *p, uint8_t ptr)
printf("supports");
comma = 0;
if (status & PCIXM_STATUS_133CAP) {
-   printf("%s 133MHz", comma ? "," : "");
+   printf(" 133MHz");
comma = 1;
}
if (status & PCIXM_STATUS_266CAP) {
@@ -351,10 +351,8 @@ cap_vendor(int fd, struct pci_conf *p, uint8_t ptr)
printf("%s SATA RAID-0/1/10", comma ? "," : "");
comma = 1;
}
-   if (fvec & (1 << 3)) {
-   printf("%s SATA AHCI", comma ? "," : "");
-   comma = 1;
-   }
+   if (fvec & (1 << 3))
+   printf(", SATA AHCI");
}
}
 }

Modified: stable/11/usr.sbin/pciconf/pciconf.c
==
--- stable/11/usr.sbin/pciconf/pciconf.cThu Mar 15 04:59:47 2018
(r330967)
+++ stable/11/usr.sbin/pciconf/pciconf.cThu Mar 15 05:04:46 2018
(r330968)
@@ -1001,6 +1001,7 @@ writeit(const char *name, const char *reg, const char 
 
if (ioctl(fd, PCIOCWRITE, ) < 0)
err(1, "ioctl(PCIOCWRITE)");
+   close(fd);
 }
 
 static void
@@ -1020,4 +1021,5 @@ chkattached(const char *name)
 
exitstatus = pi.pi_data ? 0 : 2; /* exit(2), if NOT attached */
printf("%s: %s%s\n", name, pi.pi_data == 0 ? "not " : "", "attached");
+   close(fd);
 }
___
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: r330967 - stable/11/usr.sbin/fwcontrol

2018-03-14 Thread Eitan Adler
Author: eadler
Date: Thu Mar 15 04:59:47 2018
New Revision: 330967
URL: https://svnweb.freebsd.org/changeset/base/330967

Log:
  MFC r327279,r327571:
  
  Close fd when we're done dv-sending the file.

Modified:
  stable/11/usr.sbin/fwcontrol/fwdv.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/fwcontrol/fwdv.c
==
--- stable/11/usr.sbin/fwcontrol/fwdv.c Thu Mar 15 02:32:22 2018
(r330966)
+++ stable/11/usr.sbin/fwcontrol/fwdv.c Thu Mar 15 04:59:47 2018
(r330967)
@@ -409,7 +409,6 @@ again:
err(1, "write failed");
}
}
-   close(fd);
fprintf(stderr, "\n");
 send_end:
gettimeofday(, NULL);
@@ -417,4 +416,5 @@ send_end:
+ (end.tv_usec - start.tv_usec) * 1e-6;
fprintf(stderr, "%d frames, %.2f secs, %.2f frames/sec\n",
frames, rtime, frames/rtime);
+   close(fd);
 }
___
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: r330966 - stable/11/lib/libcompat/4.3

2018-03-14 Thread Eitan Adler
Author: eadler
Date: Thu Mar 15 02:32:22 2018
New Revision: 330966
URL: https://svnweb.freebsd.org/changeset/base/330966

Log:
  MFC r329102:
  
  libcompat: Use %hu for unsigned shorts.

Modified:
  stable/11/lib/libcompat/4.3/rexec.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libcompat/4.3/rexec.c
==
--- stable/11/lib/libcompat/4.3/rexec.c Thu Mar 15 02:25:28 2018
(r330965)
+++ stable/11/lib/libcompat/4.3/rexec.c Thu Mar 15 02:32:22 2018
(r330966)
@@ -356,7 +356,7 @@ retry:
goto bad;
}
port = ntohs((u_short)sin2.sin_port);
-   (void) sprintf(num, "%u", port);
+   (void) sprintf(num, "%hu", port);
(void) write(s, num, strlen(num)+1);
{ int len = sizeof (from);
  s3 = accept(s2, (struct sockaddr *), );
___
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: r330964 - in stable/11/sys: kern sys

2018-03-14 Thread Eitan Adler
Author: eadler
Date: Thu Mar 15 02:20:06 2018
New Revision: 330964
URL: https://svnweb.freebsd.org/changeset/base/330964

Log:
  MFC r302525,r302526:
  
  Do allow auditing of read(2) and write(2) system calls, by assigning
  those system calls audit event identifiers AUE_READ and AUE_WRITE.
  While auditing file-descriptor I/O is not required by the Common
  Criteria, in practice this proves useful for both live and forensic
  analysis.
  
  NB: freebsd32 already assigns AUE_READ and AUE_WRITE to read(2) and
  write(2).
  
  In process-descriptor close(2) and fstat(2), audit target process
  information.  pgkill(2) already audits target process ID.

Modified:
  stable/11/sys/kern/init_sysent.c
  stable/11/sys/kern/sys_procdesc.c
  stable/11/sys/kern/syscalls.master
  stable/11/sys/sys/sysproto.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/init_sysent.c
==
--- stable/11/sys/kern/init_sysent.cThu Mar 15 01:07:21 2018
(r330963)
+++ stable/11/sys/kern/init_sysent.cThu Mar 15 02:20:06 2018
(r330964)
@@ -48,8 +48,8 @@ struct sysent sysent[] = {
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },  
/* 0 = syscall */
{ AS(sys_exit_args), (sy_call_t *)sys_sys_exit, AUE_EXIT, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_STATIC },  /* 1 = exit */
{ 0, (sy_call_t *)sys_fork, AUE_FORK, NULL, 0, 0, SYF_CAPENABLED, 
SY_THR_STATIC },  /* 2 = fork */
-   { AS(read_args), (sy_call_t *)sys_read, AUE_NULL, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_STATIC },  /* 3 = read */
-   { AS(write_args), (sy_call_t *)sys_write, AUE_NULL, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_STATIC },/* 4 = write */
+   { AS(read_args), (sy_call_t *)sys_read, AUE_READ, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_STATIC },  /* 3 = read */
+   { AS(write_args), (sy_call_t *)sys_write, AUE_WRITE, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_STATIC },   /* 4 = write */
{ AS(open_args), (sy_call_t *)sys_open, AUE_OPEN_RWTC, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_STATIC }, /* 5 = open */
{ AS(close_args), (sy_call_t *)sys_close, AUE_CLOSE, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_STATIC },   /* 6 = close */
{ AS(wait4_args), (sy_call_t *)sys_wait4, AUE_WAIT4, NULL, 0, 0, 0, 
SY_THR_STATIC },/* 7 = wait4 */

Modified: stable/11/sys/kern/sys_procdesc.c
==
--- stable/11/sys/kern/sys_procdesc.c   Thu Mar 15 01:07:21 2018
(r330963)
+++ stable/11/sys/kern/sys_procdesc.c   Thu Mar 15 02:20:06 2018
(r330964)
@@ -1,10 +1,15 @@
 /*-
- * Copyright (c) 2009 Robert N. M. Watson
+ * Copyright (c) 2009, 2016 Robert N. M. Watson
  * All rights reserved.
  *
  * This software was developed at the University of Cambridge Computer
  * Laboratory with support from a grant from Google, Inc.
  *
+ * Portions of this software were developed by BAE Systems, the University of
+ * Cambridge Computer Laboratory, and Memorial University under DARPA/AFRL
+ * contract FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent
+ * Computing (TC) research program.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -383,6 +388,7 @@ procdesc_close(struct file *fp, struct thread *td)
sx_xunlock(_lock);
} else {
PROC_LOCK(p);
+   AUDIT_ARG_PROCESS(p);
if (p->p_state == PRS_ZOMBIE) {
/*
 * If the process is already dead and just awaiting
@@ -529,6 +535,7 @@ procdesc_stat(struct file *fp, struct stat *sb, struct
sx_slock(_lock);
if (pd->pd_proc != NULL) {
PROC_LOCK(pd->pd_proc);
+   AUDIT_ARG_PROCESS(pd->pd_proc);
 
/* Set birth and [acm] times to process start time. */
pstart = pd->pd_proc->p_stats->p_start;

Modified: stable/11/sys/kern/syscalls.master
==
--- stable/11/sys/kern/syscalls.master  Thu Mar 15 01:07:21 2018
(r330963)
+++ stable/11/sys/kern/syscalls.master  Thu Mar 15 02:20:06 2018
(r330964)
@@ -62,9 +62,9 @@
 1  AUE_EXITSTD { void sys_exit(int rval); } exit \
sys_exit_args void
 2  AUE_FORKSTD { int fork(void); }
-3  AUE_NULLSTD { ssize_t read(int fd, void *buf, \
+3  AUE_READSTD { ssize_t read(int fd, void *buf, \
size_t nbyte); }
-4  AUE_NULLSTD { ssize_t write(int fd, const void *buf, \
+4  AUE_WRITE   STD { ssize_t write(int fd, const void *buf, \
size_t nbyte); }
 5  AUE_OPEN_RWTC   

svn commit: r330965 - stable/11/usr.sbin/ypldap

2018-03-14 Thread Eitan Adler
Author: eadler
Date: Thu Mar 15 02:25:28 2018
New Revision: 330965
URL: https://svnweb.freebsd.org/changeset/base/330965

Log:
  MFC r302535:
  
  Do not allow whitespace in macro names.

Modified:
  stable/11/usr.sbin/ypldap/parse.y
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/ypldap/parse.y
==
--- stable/11/usr.sbin/ypldap/parse.y   Thu Mar 15 02:20:06 2018
(r330964)
+++ stable/11/usr.sbin/ypldap/parse.y   Thu Mar 15 02:25:28 2018
(r330965)
@@ -144,6 +144,14 @@ include: INCLUDE STRING
{
;
 
 varset : STRING '=' STRING {
+   char *s = $1;
+   while (*s++) {
+   if (isspace((unsigned char) *s)) {
+   yyerror("macro name cannot contain "
+ "whitespace");
+   YYERROR;
+   }
+   }
if (symset($1, $3, 0) == -1)
fatal("cannot store variable");
free($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: r330963 - head/sys/dev/isp

2018-03-14 Thread Alexander Motin
Author: mav
Date: Thu Mar 15 01:07:21 2018
New Revision: 330963
URL: https://svnweb.freebsd.org/changeset/base/330963

Log:
  Increase ABOUT FIRMWARE command timeout to 5s.
  
  It seems default timeout of 100ms is not enough for my 2694L card,
  while it was perfectly fine for others, even for full-height 2694.
  
  MFC after:1 week
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/dev/isp/isp.c

Modified: head/sys/dev/isp/isp.c
==
--- head/sys/dev/isp/isp.c  Thu Mar 15 00:57:57 2018(r330962)
+++ head/sys/dev/isp/isp.c  Thu Mar 15 01:07:21 2018(r330963)
@@ -876,6 +876,7 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults)
}
}
} else if (IS_26XX(isp)) {
+   isp_prt(isp, ISP_LOGDEBUG1, "loading firmware from flash");
MBSINIT(, MBOX_LOAD_FLASH_FIRMWARE, MBLOGALL, 500);
mbs.ibitm = 0x01;
mbs.obitm = 0x07;
@@ -913,9 +914,12 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults)
 * we still need to (re)start it.
 */
MBSINIT(, MBOX_EXEC_FIRMWARE, MBLOGALL, 500);
-   if (IS_24XX(isp)) {
+   if (IS_26XX(isp)) {
mbs.param[1] = code_org >> 16;
mbs.param[2] = code_org;
+   } else if (IS_24XX(isp)) {
+   mbs.param[1] = code_org >> 16;
+   mbs.param[2] = code_org;
if (isp->isp_loaded_fw) {
mbs.param[3] = 0;
} else {
@@ -954,7 +958,7 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults)
 * Ask the chip for the current firmware version.
 * This should prove that the new firmware is working.
 */
-   MBSINIT(, MBOX_ABOUT_FIRMWARE, MBLOGALL, 0);
+   MBSINIT(, MBOX_ABOUT_FIRMWARE, MBLOGALL, 500);
isp_mboxcmd(isp, );
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
return;
@@ -6739,7 +6743,7 @@ static const char *scsi_mbcmd_names[] = {
 static const uint32_t mbpfc[] = {
ISP_FC_OPMAP(0x01, 0x01),   /* 0x00: MBOX_NO_OP */
ISP_FC_OPMAP(0x1f, 0x01),   /* 0x01: MBOX_LOAD_RAM */
-   ISP_FC_OPMAP_HALF(0x07, 0xff, 0x00, 0x03),  /* 0x02: 
MBOX_EXEC_FIRMWARE */
+   ISP_FC_OPMAP_HALF(0x07, 0xff, 0x00, 0x1f),  /* 0x02: 
MBOX_EXEC_FIRMWARE */
ISP_FC_OPMAP(0xdf, 0x01),   /* 0x03: MBOX_DUMP_RAM */
ISP_FC_OPMAP(0x07, 0x07),   /* 0x04: MBOX_WRITE_RAM_WORD */
ISP_FC_OPMAP(0x03, 0x07),   /* 0x05: MBOX_READ_RAM_WORD */
___
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: r330962 - head/sys/conf

2018-03-14 Thread Ed Maste
Author: emaste
Date: Thu Mar 15 00:57:57 2018
New Revision: 330962
URL: https://svnweb.freebsd.org/changeset/base/330962

Log:
  Remove KERNEL_RETPOLINE from BROKEN_OPTIONS on i386
  
  Clang will compile both amd64 and i386 with retpoline.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/conf/kern.opts.mk

Modified: head/sys/conf/kern.opts.mk
==
--- head/sys/conf/kern.opts.mk  Thu Mar 15 00:44:34 2018(r330961)
+++ head/sys/conf/kern.opts.mk  Thu Mar 15 00:57:57 2018(r330962)
@@ -87,7 +87,7 @@ BROKEN_OPTIONS+= OFED
 .endif
 
 # Things that don't work based on toolchain support.
-.if ${MACHINE} != "amd64"
+.if ${MACHINE} != "i386" && ${MACHINE} != "amd64"
 BROKEN_OPTIONS+= KERNEL_RETPOLINE
 .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: r330961 - stable/10/sys/dev/asmc

2018-03-14 Thread Ed Maste
Author: emaste
Date: Thu Mar 15 00:44:34 2018
New Revision: 330961
URL: https://svnweb.freebsd.org/changeset/base/330961

Log:
  MFC r330667: asmc: update temperature sensor name/description
  
  PR:   225911
  Submitted by: Trev

Modified:
  stable/10/sys/dev/asmc/asmcvar.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/asmc/asmcvar.h
==
--- stable/10/sys/dev/asmc/asmcvar.hThu Mar 15 00:43:25 2018
(r330960)
+++ stable/10/sys/dev/asmc/asmcvar.hThu Mar 15 00:44:34 2018
(r330961)
@@ -241,7 +241,7 @@ struct asmc_softc {
  "cpu0_proximity", "hdd_bay", \
  "northbridge_die", \
  "northbridge_proximity", \
- "wireless_module", }
+ "wireless_proximity", }
 
 #define ASMC_MM31_TEMPDESCS{ "CPU0 Die Core Temperature", \
  "CPU0 Heatsink Temperature", \
@@ -249,7 +249,7 @@ struct asmc_softc {
  "HDD Bay Temperature", \
  "Northbridge Die Core Temperature", \
  "Northbridge Proximity Temperature", \
- "Wireless Module Temperature", }
+ "Wireless Module Proximity Temperature", }
 
 #define ASMC_MP_TEMPS  { "TA0P", "TCAG", "TCAH", "TCBG", "TCBH", \
  "TC0C", "TC0D", "TC0P", "TC1C", "TC1D", \
___
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: r330960 - stable/11/sys/dev/asmc

2018-03-14 Thread Ed Maste
Author: emaste
Date: Thu Mar 15 00:43:25 2018
New Revision: 330960
URL: https://svnweb.freebsd.org/changeset/base/330960

Log:
  MFC r330667: asmc: update temperature sensor name/description
  
  PR:   225911
  Submitted by: Trev 

Modified:
  stable/11/sys/dev/asmc/asmcvar.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/asmc/asmcvar.h
==
--- stable/11/sys/dev/asmc/asmcvar.hWed Mar 14 23:59:52 2018
(r330959)
+++ stable/11/sys/dev/asmc/asmcvar.hThu Mar 15 00:43:25 2018
(r330960)
@@ -311,7 +311,7 @@ struct asmc_softc {
  "cpu0_proximity", "hdd_bay", \
  "northbridge_die", \
  "northbridge_proximity", \
- "wireless_module", }
+ "wireless_proximity", }
 
 #define ASMC_MM31_TEMPDESCS{ "CPU0 Die Core Temperature", \
  "CPU0 Heatsink Temperature", \
@@ -319,7 +319,7 @@ struct asmc_softc {
  "HDD Bay Temperature", \
  "Northbridge Die Core Temperature", \
  "Northbridge Proximity Temperature", \
- "Wireless Module Temperature", }
+ "Wireless Module Proximity Temperature", }
 
 #define ASMC_MP_TEMPS  { "TA0P", "TCAG", "TCAH", "TCBG", "TCBH", \
  "TC0C", "TC0D", "TC0P", "TC1C", "TC1D", \
___
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: r330959 - stable/10/sys/x86/x86

2018-03-14 Thread Marius Strobl
Author: marius
Date: Wed Mar 14 23:59:52 2018
New Revision: 330959
URL: https://svnweb.freebsd.org/changeset/base/330959

Log:
  MFC: 327314
  
  With the advent of interrupt remapping, Intel has repurposed bit 11
  (now: Interrupt_Index[15]) and assigned the previously reserved bits
  55:48 (Interrupt_Index[14:0] goes into 63:49 while Destination Field
  used 63:56 and bit 48 now is Interrupt_Format) in the IO redirection
  tables (see the VT-d specification, "5.1.5.1 I/OxAPIC Programming").
  Thus, when not using interrupt remapping, ensure that all previously
  reserved bits in the high part of the RTEs are zero instead of doing
  a read-modify-write for their Destination Field bits only.
  Otherwise, on machines based on Apollo Lake and its derivatives such
  as Denverton, typically some of the previously preserved bits remain
  set after boot when not employing interrupt remapping. The result is
  that INTx interrupts are not getting delivered.
  Note: With an AMD IOMMU, interrupt remapping apparently bypasses the
  IO APIC altogether.
  
  Submitted by: loos (modulo comment)
  Reviewed by:  jhb (modulo comment)

Modified:
  stable/10/sys/x86/x86/io_apic.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/x86/x86/io_apic.c
==
--- stable/10/sys/x86/x86/io_apic.c Wed Mar 14 23:59:50 2018
(r330958)
+++ stable/10/sys/x86/x86/io_apic.c Wed Mar 14 23:59:52 2018
(r330959)
@@ -252,7 +252,7 @@ static void
 ioapic_program_intpin(struct ioapic_intsrc *intpin)
 {
struct ioapic *io = (struct ioapic *)intpin->io_intsrc.is_pic;
-   uint32_t low, high, value;
+   uint32_t low, high;
 
/*
 * If a pin is completely invalid or if it is valid but hasn't
@@ -270,7 +270,11 @@ ioapic_program_intpin(struct ioapic_intsrc *intpin)
return;
}
 
-   /* Set the destination. */
+   /*
+* Set the destination.  Note that with Intel interrupt remapping,
+* the previously reserved bits 55:48 now have a purpose so ensure
+* these are zero.
+*/
low = IOART_DESTPHY;
high = intpin->io_cpu << APIC_ID_SHIFT;
 
@@ -308,10 +312,7 @@ ioapic_program_intpin(struct ioapic_intsrc *intpin)
}
 
/* Write the values to the APIC. */
-   value = ioapic_read(io->io_addr, IOAPIC_REDTBL_HI(intpin->io_intpin));
-   value &= ~IOART_DEST;
-   value |= high;
-   ioapic_write(io->io_addr, IOAPIC_REDTBL_HI(intpin->io_intpin), value);
+   ioapic_write(io->io_addr, IOAPIC_REDTBL_HI(intpin->io_intpin), high);
intpin->io_lowreg = low;
ioapic_write(io->io_addr, IOAPIC_REDTBL_LO(intpin->io_intpin), low);
 }
___
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: r330958 - stable/11/sys/x86/x86

2018-03-14 Thread Marius Strobl
Author: marius
Date: Wed Mar 14 23:59:50 2018
New Revision: 330958
URL: https://svnweb.freebsd.org/changeset/base/330958

Log:
  MFC: 327314
  
  With the advent of interrupt remapping, Intel has repurposed bit 11
  (now: Interrupt_Index[15]) and assigned the previously reserved bits
  55:48 (Interrupt_Index[14:0] goes into 63:49 while Destination Field
  used 63:56 and bit 48 now is Interrupt_Format) in the IO redirection
  tables (see the VT-d specification, "5.1.5.1 I/OxAPIC Programming").
  Thus, when not using interrupt remapping, ensure that all previously
  reserved bits in the high part of the RTEs are zero instead of doing
  a read-modify-write for their Destination Field bits only.
  Otherwise, on machines based on Apollo Lake and its derivatives such
  as Denverton, typically some of the previously preserved bits remain
  set after boot when not employing interrupt remapping. The result is
  that INTx interrupts are not getting delivered.
  Note: With an AMD IOMMU, interrupt remapping apparently bypasses the
  IO APIC altogether.
  
  Submitted by: loos (modulo comment)
  Reviewed by:  jhb (modulo comment)

Modified:
  stable/11/sys/x86/x86/io_apic.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/x86/x86/io_apic.c
==
--- stable/11/sys/x86/x86/io_apic.c Wed Mar 14 23:45:48 2018
(r330957)
+++ stable/11/sys/x86/x86/io_apic.c Wed Mar 14 23:59:50 2018
(r330958)
@@ -306,7 +306,7 @@ static void
 ioapic_program_intpin(struct ioapic_intsrc *intpin)
 {
struct ioapic *io = (struct ioapic *)intpin->io_intsrc.is_pic;
-   uint32_t low, high, value;
+   uint32_t low, high;
 #ifdef ACPI_DMAR
int error;
 #endif
@@ -352,7 +352,11 @@ ioapic_program_intpin(struct ioapic_intsrc *intpin)
}
 #endif
 
-   /* Set the destination. */
+   /*
+* Set the destination.  Note that with Intel interrupt remapping,
+* the previously reserved bits 55:48 now have a purpose so ensure
+* these are zero.
+*/
low = IOART_DESTPHY;
high = intpin->io_cpu << APIC_ID_SHIFT;
 
@@ -390,10 +394,7 @@ ioapic_program_intpin(struct ioapic_intsrc *intpin)
}
 
/* Write the values to the APIC. */
-   value = ioapic_read(io->io_addr, IOAPIC_REDTBL_HI(intpin->io_intpin));
-   value &= ~IOART_DEST;
-   value |= high;
-   ioapic_write(io->io_addr, IOAPIC_REDTBL_HI(intpin->io_intpin), value);
+   ioapic_write(io->io_addr, IOAPIC_REDTBL_HI(intpin->io_intpin), high);
intpin->io_lowreg = low;
ioapic_write(io->io_addr, IOAPIC_REDTBL_LO(intpin->io_intpin), low);
 }
___
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: r327314 - head/sys/x86/x86

2018-03-14 Thread Marius Strobl
On Wed, Mar 14, 2018 at 07:18:41PM -0400, Ed Maste wrote:
> On 28 December 2017 at 16:46, Marius Strobl  wrote:
> > Author: marius
> > Date: Thu Dec 28 21:46:09 2017
> > New Revision: 327314
> > URL: https://svnweb.freebsd.org/changeset/base/327314
> >
> > Log:
> >   With the advent of interrupt remapping, Intel has repurposed bit 11
> >   (now: Interrupt_Index[15]) and assigned the previously reserved bits
> >   ...
> 
> Will you MFC this to stable/11 so it can arrive in 11.2?

Yes, in fact I was working on the MFCs when your e-mail arrived but
am struggling with some unrelated build fuck-ups.

Marius

___
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: r330957 - in head/sys: contrib/dev/acpica contrib/dev/acpica/components/debugger contrib/dev/acpica/components/dispatcher contrib/dev/acpica/components/events contrib/dev/acpica/compone...

2018-03-14 Thread Jung-uk Kim
Author: jkim
Date: Wed Mar 14 23:45:48 2018
New Revision: 330957
URL: https://svnweb.freebsd.org/changeset/base/330957

Log:
  Merge ACPICA 20180313.

Modified:
  head/sys/contrib/dev/acpica/changes.txt
  head/sys/contrib/dev/acpica/components/debugger/dbdisply.c
  head/sys/contrib/dev/acpica/components/dispatcher/dspkginit.c
  head/sys/contrib/dev/acpica/components/events/evevent.c
  head/sys/contrib/dev/acpica/components/events/evgpe.c
  head/sys/contrib/dev/acpica/components/events/evgpeblk.c
  head/sys/contrib/dev/acpica/components/events/evrgnini.c
  head/sys/contrib/dev/acpica/components/events/evxface.c
  head/sys/contrib/dev/acpica/components/events/evxfgpe.c
  head/sys/contrib/dev/acpica/components/executer/exdebug.c
  head/sys/contrib/dev/acpica/components/hardware/hwgpe.c
  head/sys/contrib/dev/acpica/components/hardware/hwsleep.c
  head/sys/contrib/dev/acpica/components/hardware/hwxfsleep.c
  head/sys/contrib/dev/acpica/components/namespace/nsdumpdv.c
  head/sys/contrib/dev/acpica/components/namespace/nseval.c
  head/sys/contrib/dev/acpica/components/namespace/nsload.c
  head/sys/contrib/dev/acpica/components/namespace/nsparse.c
  head/sys/contrib/dev/acpica/components/namespace/nsxfname.c
  head/sys/contrib/dev/acpica/components/parser/psargs.c
  head/sys/contrib/dev/acpica/components/parser/psloop.c
  head/sys/contrib/dev/acpica/components/parser/psobject.c
  head/sys/contrib/dev/acpica/components/tables/tbdata.c
  head/sys/contrib/dev/acpica/components/tables/tbinstal.c
  head/sys/contrib/dev/acpica/components/tables/tbxfload.c
  head/sys/contrib/dev/acpica/components/utilities/utosi.c
  head/sys/contrib/dev/acpica/components/utilities/utxfinit.c
  head/sys/contrib/dev/acpica/include/acevents.h
  head/sys/contrib/dev/acpica/include/acmacros.h
  head/sys/contrib/dev/acpica/include/acpixf.h
  head/sys/contrib/dev/acpica/include/actypes.h
  head/sys/dev/acpica/acpi.c
Directory Properties:
  head/sys/contrib/dev/acpica/   (props changed)

Modified: head/sys/contrib/dev/acpica/changes.txt
==
--- head/sys/contrib/dev/acpica/changes.txt Wed Mar 14 23:42:28 2018
(r330956)
+++ head/sys/contrib/dev/acpica/changes.txt Wed Mar 14 23:45:48 2018
(r330957)
@@ -1,4 +1,50 @@
 
+13 March 2018. Summary of changes for version 20180313:
+
+
+1) ACPICA kernel-resident subsystem:
+
+Implemented various improvements to the GPE support:
+
+1) Dispatch all active GPEs at initialization time so that no GPEs are 
+lost.
+2) Enable runtime GPEs earlier. Some systems expect GPEs to be enabled 
+before devices are enumerated.
+3) Don't unconditionally clear ACPI IRQs during suspend/resume, so that 
+IRQs are not lost.
+4) Add parallel GPE handling to eliminate the possibility of dispatching 
+the same GPE twice.
+5) Dispatch any pending GPEs after enabling for the first time.
+
+AcpiGetObjectInfo - removed support for the _STA method. This was causing 
+problems on some platforms.
+
+Added a new _OSI string, "Windows 2017.2".
+
+Cleaned up and simplified the module-level code support. These changes 
+are in preparation for the eventual removal of the legacy MLC support 
+(deferred execution), replaced by the new MLC architecture which executes 
+the MLC as a table is loaded (DSDT/SSDTs).
+
+Changed a compile-time option to a runtime option. Changes the option to 
+ignore ACPI table load-time package resolution errors into a runtime 
+option. Used only for platforms that generate many AE_NOT_FOUND errors 
+during boot. AcpiGbl_IgnorePackageResolutionErrors.
+
+Fixed the ACPI_ERROR_NAMESPACE macro. This change involves putting some 
+ACPI_ERROR_NAMESPACE parameters inside macros. By doing so, we avoid 
+compilation errors from unused variables (seen with some compilers).
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+ASLTS: parallelized execution in order to achieve an (approximately) 2X 
+performance increase.
+
+ASLTS: Updated to use the iASL __LINE__ and __METHOD__ macros. Improves 
+error reporting.
+
+
 09 February 2018. Summary of changes for version 20180209:
 
 

Modified: head/sys/contrib/dev/acpica/components/debugger/dbdisply.c
==
--- head/sys/contrib/dev/acpica/components/debugger/dbdisply.c  Wed Mar 14 
23:42:28 2018(r330956)
+++ head/sys/contrib/dev/acpica/components/debugger/dbdisply.c  Wed Mar 14 
23:45:48 2018(r330957)
@@ -820,9 +820,8 @@ AcpiDbDisplayObjectType (
 return;
 }
 
-AcpiOsPrintf ("ADR: %8.8X%8.8X, STA: %8.8X, Flags: %X\n",
-ACPI_FORMAT_UINT64 (Info->Address),
-Info->CurrentStatus, Info->Flags);
+AcpiOsPrintf ("ADR: %8.8X%8.8X, Flags: %X\n",
+ACPI_FORMAT_UINT64 (Info->Address), Info->Flags);
 
 AcpiOsPrintf ("S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X\n",
 

svn commit: r330956 - head/sys/dev/acpica

2018-03-14 Thread Jung-uk Kim
Author: jkim
Date: Wed Mar 14 23:42:28 2018
New Revision: 330956
URL: https://svnweb.freebsd.org/changeset/base/330956

Log:
  Remove local definitions for _STA method in favor of ACPICA.
  
  These macros were added in ACPICA 20051216, more than a decade ago.

Modified:
  head/sys/dev/acpica/acpivar.h

Modified: head/sys/dev/acpica/acpivar.h
==
--- head/sys/dev/acpica/acpivar.h   Wed Mar 14 23:28:28 2018
(r330955)
+++ head/sys/dev/acpica/acpivar.h   Wed Mar 14 23:42:28 2018
(r330956)
@@ -320,20 +320,14 @@ void  acpi_EnterDebugger(void);
 #defineACPI_OSC_BAD_REVISION   (1 << 3)
 #defineACPI_OSC_CAPS_MASKED(1 << 4)
 
-/* Values for the device _STA (status) method. */
-#define ACPI_STA_PRESENT   (1 << 0)
-#define ACPI_STA_ENABLED   (1 << 1)
-#define ACPI_STA_SHOW_IN_UI(1 << 2)
-#define ACPI_STA_FUNCTIONAL(1 << 3)
-#define ACPI_STA_BATT_PRESENT  (1 << 4)
-
 #define ACPI_DEVINFO_PRESENT(x, flags) \
(((x) & (flags)) == (flags))
 #define ACPI_DEVICE_PRESENT(x) \
-   ACPI_DEVINFO_PRESENT(x, ACPI_STA_PRESENT | ACPI_STA_FUNCTIONAL)
+   ACPI_DEVINFO_PRESENT(x, ACPI_STA_DEVICE_PRESENT |   \
+   ACPI_STA_DEVICE_FUNCTIONING)
 #define ACPI_BATTERY_PRESENT(x)
\
-   ACPI_DEVINFO_PRESENT(x, ACPI_STA_PRESENT | ACPI_STA_FUNCTIONAL | \
-   ACPI_STA_BATT_PRESENT)
+   ACPI_DEVINFO_PRESENT(x, ACPI_STA_DEVICE_PRESENT |   \
+   ACPI_STA_DEVICE_FUNCTIONING | ACPI_STA_BATTERY_PRESENT)
 
 /* Callback function type for walking subtables within a table. */
 typedef void acpi_subtable_handler(ACPI_SUBTABLE_HEADER *, void *);
___
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: r330955 - head/sys/dev/nvme

2018-03-14 Thread Warner Losh
Author: imp
Date: Wed Mar 14 23:28:28 2018
New Revision: 330955
URL: https://svnweb.freebsd.org/changeset/base/330955

Log:
  Fix error messages in cut and pasted code.
  
  Also, fix an unnecessary deref to get ctrlr.
  
  Noticed by: rpokala@
  Sponsored by: Netflix

Modified:
  head/sys/dev/nvme/nvme_ctrlr.c

Modified: head/sys/dev/nvme/nvme_ctrlr.c
==
--- head/sys/dev/nvme/nvme_ctrlr.c  Wed Mar 14 23:01:18 2018
(r330954)
+++ head/sys/dev/nvme/nvme_ctrlr.c  Wed Mar 14 23:28:28 2018
(r330955)
@@ -519,12 +519,12 @@ nvme_ctrlr_destroy_qpair(struct nvme_controller *ctrlr
struct nvme_completion_poll_status  status;
 
status.done = 0;
-   nvme_ctrlr_cmd_delete_io_sq(qpair->ctrlr, qpair,
+   nvme_ctrlr_cmd_delete_io_sq(ctrlr, qpair,
nvme_completion_poll_cb, );
while (!atomic_load_acq_int())
pause("nvme", 1);
if (nvme_completion_is_error()) {
-   nvme_printf(ctrlr, "nvme_create_io_sq failed!\n");
+   nvme_printf(ctrlr, "nvme_destroy_io_sq failed!\n");
return (ENXIO);
}
 
@@ -534,7 +534,7 @@ nvme_ctrlr_destroy_qpair(struct nvme_controller *ctrlr
while (!atomic_load_acq_int())
pause("nvme", 1);
if (nvme_completion_is_error()) {
-   nvme_printf(ctrlr, "nvme_create_io_cq failed!\n");
+   nvme_printf(ctrlr, "nvme_destroy_io_cq failed!\n");
return (ENXIO);
}
 
___
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: r329984 - in head: cddl/contrib/opensolaris/lib/libzpool/common sys/cddl/compat/opensolaris/sys

2018-03-14 Thread Shawn Webb
On Wed, Mar 14, 2018 at 05:20:00PM -0600, Alan Somers wrote:
> On Wed, Mar 14, 2018 at 5:11 PM, Shawn Webb 
> wrote:
> 
> > On Wed, Mar 14, 2018 at 05:06:09PM -0600, Alan Somers wrote:
> > > On Wed, Mar 14, 2018 at 4:56 PM, Shawn Webb 
> > > wrote:
> > >
> > > > On Wed, Mar 14, 2018 at 04:51:27PM -0600, Alan Somers wrote:
> > > > > On Wed, Mar 14, 2018 at 4:50 PM, Shawn Webb <
> > shawn.w...@hardenedbsd.org>
> > > > > wrote:
> > > > >
> > > > > > On Sun, Feb 25, 2018 at 02:29:43PM +, Alan Somers wrote:
> > > > > > > Author: asomers
> > > > > > > Date: Sun Feb 25 14:29:43 2018
> > > > > > > New Revision: 329984
> > > > > > > URL: https://svnweb.freebsd.org/changeset/base/329984
> > > > > > >
> > > > > > > Log:
> > > > > > >   Don't declare __assfail as static
> > > > > > >
> > > > > > >   It gets called by dmu_buf_init_user, which is inline but not
> > > > static.
> > > > > > So it
> > > > > > >   needs global linkage itself.
> > > > > > >
> > > > > > >   Reported by:GCC-6
> > > > > > >   MFC after:  17 days
> > > > > > >   X-MFC-With: 329722
> > > > > > >
> > > > > >
> > > > > > Hey Alan,
> > > > > >
> > > > > > This commit breaks compiling world with ASAN.
> > > > > >
> > > > > > Some applications, like zfs, will fail with this error:
> > > > > >
> > > > > > /lib/libuutil.so.2: Undefined symbol "__assfail"
> > > > > >
> > > > > > Thanks,
> > > > > >
> > > > >
> > > > > How does one build world with ASAN ?
> > > >
> > > > HardenedBSD has a feature branch in its playground repo for ASAN-ified
> > > > world.
> > > >
> > > > We introduced two new MK_* toggles: MK_ASAN and MK_ASAN_RECOVER.
> > > > MK_ASAN is self-explanitory. MK_ASAN_RECOVER tells the sanitizer
> > > > framework to let the application continue running instead of abort
> > > > execution.
> > > >
> > > > Here's where the magic gets set:
> > > >
> > > > https://github.com/HardenedBSD/hardenedBSD-playground/blob/hardened/
> > > > current/asan/share/mk/bsd.prog.mk#L125-L134
> > > >
> > > > Thanks,
> > > >
> > >
> > > I don't use HardenedBSD.  Can you provide an invocation that will
> > > demonstrate the breakage on FreeBSD head?  I tried a few things, and they
> > > all either worked, or failed with errors other than the one you showed.
> >
> > No worries. I've just reverted the commit in that feature branch. If I
> > have time, I'll see about porting the ASAN work to vanilla FreeBSD.
> > But my time is extremely limited these days.
> >
> > Thanks,
> >
> 
> Ok.  BTW, that commit is due for MFC as of today.  Unless I hear from you
> otherwise, I'll go ahead and MFC it.

That's totally fine. The ASAN-ified work is done in a feature branch
that will only track HEAD. Given that I'm abusing ASAN in this
particular case, the ASAN-ified world should never land in any
production build. I don't plan to test 11-STABLE with ASAN.

Thanks for letting me know, though.

-- 
Shawn Webb
Cofounder and Security Engineer
HardenedBSD

Tor-ified Signal:+1 443-546-8752
GPG Key ID:  0x6A84658F52456EEE
GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE


signature.asc
Description: PGP signature


Re: svn commit: r329984 - in head: cddl/contrib/opensolaris/lib/libzpool/common sys/cddl/compat/opensolaris/sys

2018-03-14 Thread Alan Somers
On Wed, Mar 14, 2018 at 5:11 PM, Shawn Webb 
wrote:

> On Wed, Mar 14, 2018 at 05:06:09PM -0600, Alan Somers wrote:
> > On Wed, Mar 14, 2018 at 4:56 PM, Shawn Webb 
> > wrote:
> >
> > > On Wed, Mar 14, 2018 at 04:51:27PM -0600, Alan Somers wrote:
> > > > On Wed, Mar 14, 2018 at 4:50 PM, Shawn Webb <
> shawn.w...@hardenedbsd.org>
> > > > wrote:
> > > >
> > > > > On Sun, Feb 25, 2018 at 02:29:43PM +, Alan Somers wrote:
> > > > > > Author: asomers
> > > > > > Date: Sun Feb 25 14:29:43 2018
> > > > > > New Revision: 329984
> > > > > > URL: https://svnweb.freebsd.org/changeset/base/329984
> > > > > >
> > > > > > Log:
> > > > > >   Don't declare __assfail as static
> > > > > >
> > > > > >   It gets called by dmu_buf_init_user, which is inline but not
> > > static.
> > > > > So it
> > > > > >   needs global linkage itself.
> > > > > >
> > > > > >   Reported by:GCC-6
> > > > > >   MFC after:  17 days
> > > > > >   X-MFC-With: 329722
> > > > > >
> > > > >
> > > > > Hey Alan,
> > > > >
> > > > > This commit breaks compiling world with ASAN.
> > > > >
> > > > > Some applications, like zfs, will fail with this error:
> > > > >
> > > > > /lib/libuutil.so.2: Undefined symbol "__assfail"
> > > > >
> > > > > Thanks,
> > > > >
> > > >
> > > > How does one build world with ASAN ?
> > >
> > > HardenedBSD has a feature branch in its playground repo for ASAN-ified
> > > world.
> > >
> > > We introduced two new MK_* toggles: MK_ASAN and MK_ASAN_RECOVER.
> > > MK_ASAN is self-explanitory. MK_ASAN_RECOVER tells the sanitizer
> > > framework to let the application continue running instead of abort
> > > execution.
> > >
> > > Here's where the magic gets set:
> > >
> > > https://github.com/HardenedBSD/hardenedBSD-playground/blob/hardened/
> > > current/asan/share/mk/bsd.prog.mk#L125-L134
> > >
> > > Thanks,
> > >
> >
> > I don't use HardenedBSD.  Can you provide an invocation that will
> > demonstrate the breakage on FreeBSD head?  I tried a few things, and they
> > all either worked, or failed with errors other than the one you showed.
>
> No worries. I've just reverted the commit in that feature branch. If I
> have time, I'll see about porting the ASAN work to vanilla FreeBSD.
> But my time is extremely limited these days.
>
> Thanks,
>

Ok.  BTW, that commit is due for MFC as of today.  Unless I hear from you
otherwise, I'll go ahead and MFC it.
___
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: r327314 - head/sys/x86/x86

2018-03-14 Thread Ed Maste
On 28 December 2017 at 16:46, Marius Strobl  wrote:
> Author: marius
> Date: Thu Dec 28 21:46:09 2017
> New Revision: 327314
> URL: https://svnweb.freebsd.org/changeset/base/327314
>
> Log:
>   With the advent of interrupt remapping, Intel has repurposed bit 11
>   (now: Interrupt_Index[15]) and assigned the previously reserved bits
>   ...

Will you MFC this to stable/11 so it can arrive in 11.2?
___
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: r329984 - in head: cddl/contrib/opensolaris/lib/libzpool/common sys/cddl/compat/opensolaris/sys

2018-03-14 Thread Shawn Webb
On Wed, Mar 14, 2018 at 05:06:09PM -0600, Alan Somers wrote:
> On Wed, Mar 14, 2018 at 4:56 PM, Shawn Webb 
> wrote:
> 
> > On Wed, Mar 14, 2018 at 04:51:27PM -0600, Alan Somers wrote:
> > > On Wed, Mar 14, 2018 at 4:50 PM, Shawn Webb 
> > > wrote:
> > >
> > > > On Sun, Feb 25, 2018 at 02:29:43PM +, Alan Somers wrote:
> > > > > Author: asomers
> > > > > Date: Sun Feb 25 14:29:43 2018
> > > > > New Revision: 329984
> > > > > URL: https://svnweb.freebsd.org/changeset/base/329984
> > > > >
> > > > > Log:
> > > > >   Don't declare __assfail as static
> > > > >
> > > > >   It gets called by dmu_buf_init_user, which is inline but not
> > static.
> > > > So it
> > > > >   needs global linkage itself.
> > > > >
> > > > >   Reported by:GCC-6
> > > > >   MFC after:  17 days
> > > > >   X-MFC-With: 329722
> > > > >
> > > >
> > > > Hey Alan,
> > > >
> > > > This commit breaks compiling world with ASAN.
> > > >
> > > > Some applications, like zfs, will fail with this error:
> > > >
> > > > /lib/libuutil.so.2: Undefined symbol "__assfail"
> > > >
> > > > Thanks,
> > > >
> > >
> > > How does one build world with ASAN ?
> >
> > HardenedBSD has a feature branch in its playground repo for ASAN-ified
> > world.
> >
> > We introduced two new MK_* toggles: MK_ASAN and MK_ASAN_RECOVER.
> > MK_ASAN is self-explanitory. MK_ASAN_RECOVER tells the sanitizer
> > framework to let the application continue running instead of abort
> > execution.
> >
> > Here's where the magic gets set:
> >
> > https://github.com/HardenedBSD/hardenedBSD-playground/blob/hardened/
> > current/asan/share/mk/bsd.prog.mk#L125-L134
> >
> > Thanks,
> >
> 
> I don't use HardenedBSD.  Can you provide an invocation that will
> demonstrate the breakage on FreeBSD head?  I tried a few things, and they
> all either worked, or failed with errors other than the one you showed.

No worries. I've just reverted the commit in that feature branch. If I
have time, I'll see about porting the ASAN work to vanilla FreeBSD.
But my time is extremely limited these days.

Thanks,

-- 
Shawn Webb
Cofounder and Security Engineer
HardenedBSD

Tor-ified Signal:+1 443-546-8752
GPG Key ID:  0x6A84658F52456EEE
GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE


signature.asc
Description: PGP signature


Re: svn commit: r329984 - in head: cddl/contrib/opensolaris/lib/libzpool/common sys/cddl/compat/opensolaris/sys

2018-03-14 Thread Alan Somers
On Wed, Mar 14, 2018 at 4:56 PM, Shawn Webb 
wrote:

> On Wed, Mar 14, 2018 at 04:51:27PM -0600, Alan Somers wrote:
> > On Wed, Mar 14, 2018 at 4:50 PM, Shawn Webb 
> > wrote:
> >
> > > On Sun, Feb 25, 2018 at 02:29:43PM +, Alan Somers wrote:
> > > > Author: asomers
> > > > Date: Sun Feb 25 14:29:43 2018
> > > > New Revision: 329984
> > > > URL: https://svnweb.freebsd.org/changeset/base/329984
> > > >
> > > > Log:
> > > >   Don't declare __assfail as static
> > > >
> > > >   It gets called by dmu_buf_init_user, which is inline but not
> static.
> > > So it
> > > >   needs global linkage itself.
> > > >
> > > >   Reported by:GCC-6
> > > >   MFC after:  17 days
> > > >   X-MFC-With: 329722
> > > >
> > >
> > > Hey Alan,
> > >
> > > This commit breaks compiling world with ASAN.
> > >
> > > Some applications, like zfs, will fail with this error:
> > >
> > > /lib/libuutil.so.2: Undefined symbol "__assfail"
> > >
> > > Thanks,
> > >
> >
> > How does one build world with ASAN ?
>
> HardenedBSD has a feature branch in its playground repo for ASAN-ified
> world.
>
> We introduced two new MK_* toggles: MK_ASAN and MK_ASAN_RECOVER.
> MK_ASAN is self-explanitory. MK_ASAN_RECOVER tells the sanitizer
> framework to let the application continue running instead of abort
> execution.
>
> Here's where the magic gets set:
>
> https://github.com/HardenedBSD/hardenedBSD-playground/blob/hardened/
> current/asan/share/mk/bsd.prog.mk#L125-L134
>
> Thanks,
>

I don't use HardenedBSD.  Can you provide an invocation that will
demonstrate the breakage on FreeBSD head?  I tried a few things, and they
all either worked, or failed with errors other than the one you showed.
___
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: r330954 - head/sys/dev/nvme

2018-03-14 Thread Warner Losh
Author: imp
Date: Wed Mar 14 23:01:18 2018
New Revision: 330954
URL: https://svnweb.freebsd.org/changeset/base/330954

Log:
  When tearing down a queue pair, also delete the queue entries.
  
  The NVME standard has required in section 7.2.6, since at least 1.1,
  that a clean shutdown is signalled by deleting the subission and the
  completion queues before setting the shutdown bit in CC. The 1.0
  standard, apparently, did not and many of the early Intel cards didn't
  care. Some newer cards care, at least one whose beta firmware can
  scramble the card on an unclean shutdown. Linux has done this for some
  time. To make it possible to move forward with an evaluation of this
  pre-release card with wonky firmware, delete the queues on the card
  when we delete the qpair structures.
  
  Sponsored by: Netflix

Modified:
  head/sys/dev/nvme/nvme_ctrlr.c

Modified: head/sys/dev/nvme/nvme_ctrlr.c
==
--- head/sys/dev/nvme/nvme_ctrlr.c  Wed Mar 14 23:01:04 2018
(r330953)
+++ head/sys/dev/nvme/nvme_ctrlr.c  Wed Mar 14 23:01:18 2018
(r330954)
@@ -514,6 +514,34 @@ nvme_ctrlr_create_qpairs(struct nvme_controller *ctrlr
 }
 
 static int
+nvme_ctrlr_destroy_qpair(struct nvme_controller *ctrlr, struct nvme_qpair 
*qpair)
+{
+   struct nvme_completion_poll_status  status;
+
+   status.done = 0;
+   nvme_ctrlr_cmd_delete_io_sq(qpair->ctrlr, qpair,
+   nvme_completion_poll_cb, );
+   while (!atomic_load_acq_int())
+   pause("nvme", 1);
+   if (nvme_completion_is_error()) {
+   nvme_printf(ctrlr, "nvme_create_io_sq failed!\n");
+   return (ENXIO);
+   }
+
+   status.done = 0;
+   nvme_ctrlr_cmd_delete_io_cq(ctrlr, qpair,
+   nvme_completion_poll_cb, );
+   while (!atomic_load_acq_int())
+   pause("nvme", 1);
+   if (nvme_completion_is_error()) {
+   nvme_printf(ctrlr, "nvme_create_io_cq failed!\n");
+   return (ENXIO);
+   }
+
+   return (0);
+}
+
+static int
 nvme_ctrlr_construct_namespaces(struct nvme_controller *ctrlr)
 {
struct nvme_namespace   *ns;
@@ -1274,6 +1302,7 @@ nvme_ctrlr_destruct(struct nvme_controller *ctrlr, dev
destroy_dev(ctrlr->cdev);
 
for (i = 0; i < ctrlr->num_io_queues; i++) {
+   nvme_ctrlr_destroy_qpair(ctrlr, >ioq[i]);
nvme_io_qpair_destroy(>ioq[i]);
}
 
___
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: r330953 - head/sys/dev/nvme

2018-03-14 Thread Warner Losh
Author: imp
Date: Wed Mar 14 23:01:04 2018
New Revision: 330953
URL: https://svnweb.freebsd.org/changeset/base/330953

Log:
  Don't make the namespace devices eternal.
  
  We'll need to delete namespaces soon, so go ahead and stop making
  these devices eternal. It doesn't help much, and will be getting in
  the way soon.
  
  Sponsored by: Netflix

Modified:
  head/sys/dev/nvme/nvme_ns.c

Modified: head/sys/dev/nvme/nvme_ns.c
==
--- head/sys/dev/nvme/nvme_ns.c Wed Mar 14 22:11:45 2018(r330952)
+++ head/sys/dev/nvme/nvme_ns.c Wed Mar 14 23:01:04 2018(r330953)
@@ -577,21 +577,9 @@ nvme_ns_construct(struct nvme_namespace *ns, uint32_t 
 */
unit = device_get_unit(ctrlr->dev) * NVME_MAX_NAMESPACES + ns->id - 1;
 
-/*
- * MAKEDEV_ETERNAL was added in r210923, for cdevs that will never
- *  be destroyed.  This avoids refcounting on the cdev object.
- *  That should be OK case here, as long as we're not supporting PCIe
- *  surprise removal nor namespace deletion.
- */
-#ifdef MAKEDEV_ETERNAL_KLD
-   ns->cdev = make_dev_credf(MAKEDEV_ETERNAL_KLD, _ns_cdevsw, unit,
-   NULL, UID_ROOT, GID_WHEEL, 0600, "nvme%dns%d",
-   device_get_unit(ctrlr->dev), ns->id);
-#else
ns->cdev = make_dev_credf(0, _ns_cdevsw, unit,
NULL, UID_ROOT, GID_WHEEL, 0600, "nvme%dns%d",
device_get_unit(ctrlr->dev), ns->id);
-#endif
 #ifdef NVME_UNMAPPED_BIO_SUPPORT
ns->cdev->si_flags |= SI_UNMAPPED;
 #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"


Re: svn commit: r329984 - in head: cddl/contrib/opensolaris/lib/libzpool/common sys/cddl/compat/opensolaris/sys

2018-03-14 Thread Shawn Webb
On Wed, Mar 14, 2018 at 04:51:27PM -0600, Alan Somers wrote:
> On Wed, Mar 14, 2018 at 4:50 PM, Shawn Webb 
> wrote:
> 
> > On Sun, Feb 25, 2018 at 02:29:43PM +, Alan Somers wrote:
> > > Author: asomers
> > > Date: Sun Feb 25 14:29:43 2018
> > > New Revision: 329984
> > > URL: https://svnweb.freebsd.org/changeset/base/329984
> > >
> > > Log:
> > >   Don't declare __assfail as static
> > >
> > >   It gets called by dmu_buf_init_user, which is inline but not static.
> > So it
> > >   needs global linkage itself.
> > >
> > >   Reported by:GCC-6
> > >   MFC after:  17 days
> > >   X-MFC-With: 329722
> > >
> >
> > Hey Alan,
> >
> > This commit breaks compiling world with ASAN.
> >
> > Some applications, like zfs, will fail with this error:
> >
> > /lib/libuutil.so.2: Undefined symbol "__assfail"
> >
> > Thanks,
> >
> 
> How does one build world with ASAN ?

HardenedBSD has a feature branch in its playground repo for ASAN-ified
world.

We introduced two new MK_* toggles: MK_ASAN and MK_ASAN_RECOVER.
MK_ASAN is self-explanitory. MK_ASAN_RECOVER tells the sanitizer
framework to let the application continue running instead of abort
execution.

Here's where the magic gets set:

https://github.com/HardenedBSD/hardenedBSD-playground/blob/hardened/current/asan/share/mk/bsd.prog.mk#L125-L134

Thanks,

-- 
Shawn Webb
Cofounder and Security Engineer
HardenedBSD

Tor-ified Signal:+1 443-546-8752
GPG Key ID:  0x6A84658F52456EEE
GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE


signature.asc
Description: PGP signature


Re: svn commit: r330952 - head/sys/kern

2018-03-14 Thread Alan Somers
Well, you _would_ be able to, except the public instance has been down for
3 weeks :(
https://scan.coverity.com/

On Wed, Mar 14, 2018 at 4:46 PM, Conrad Meyer  wrote:

> I believe they didn't come from the public FreeBSD Coverity instance,
> and I don't think ID numbers are portable between instances.  You
> might be able to look up similar issues in the public instance,
> though.
>
> Best,
> Conrad
>
> On Wed, Mar 14, 2018 at 3:20 PM, Ravi Pokala  wrote:
> > -Original Message-
> > From:  on behalf of Conrad Meyer
> 
> > Date: 2018-03-14, Wednesday at 15:11
> > To: , , <
> svn-src-h...@freebsd.org>
> > Subject: svn commit: r330952 - head/sys/kern
> >
> >> Author: cem
> >> Date: Wed Mar 14 22:11:45 2018
> >> New Revision: 330952
> >> URL: https://svnweb.freebsd.org/changeset/base/330952
> >>
> >> Log:
> >>   vfs_bio.c: Apply cleanups motivated by Coverity analysis
> >
> > What's the Coverity ID?
> >
> > Thanks,
> >
> > Ravi (rpokala@)
> >
> >
> >
>
>
___
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: r330952 - head/sys/kern

2018-03-14 Thread Conrad Meyer
I believe they didn't come from the public FreeBSD Coverity instance,
and I don't think ID numbers are portable between instances.  You
might be able to look up similar issues in the public instance,
though.

Best,
Conrad

On Wed, Mar 14, 2018 at 3:20 PM, Ravi Pokala  wrote:
> -Original Message-
> From:  on behalf of Conrad Meyer 
> 
> Date: 2018-03-14, Wednesday at 15:11
> To: , , 
> 
> Subject: svn commit: r330952 - head/sys/kern
>
>> Author: cem
>> Date: Wed Mar 14 22:11:45 2018
>> New Revision: 330952
>> URL: https://svnweb.freebsd.org/changeset/base/330952
>>
>> Log:
>>   vfs_bio.c: Apply cleanups motivated by Coverity analysis
>
> What's the Coverity ID?
>
> Thanks,
>
> Ravi (rpokala@)
>
>
>
___
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: r329984 - in head: cddl/contrib/opensolaris/lib/libzpool/common sys/cddl/compat/opensolaris/sys

2018-03-14 Thread Alan Somers
On Wed, Mar 14, 2018 at 4:50 PM, Shawn Webb 
wrote:

> On Sun, Feb 25, 2018 at 02:29:43PM +, Alan Somers wrote:
> > Author: asomers
> > Date: Sun Feb 25 14:29:43 2018
> > New Revision: 329984
> > URL: https://svnweb.freebsd.org/changeset/base/329984
> >
> > Log:
> >   Don't declare __assfail as static
> >
> >   It gets called by dmu_buf_init_user, which is inline but not static.
> So it
> >   needs global linkage itself.
> >
> >   Reported by:GCC-6
> >   MFC after:  17 days
> >   X-MFC-With: 329722
> >
>
> Hey Alan,
>
> This commit breaks compiling world with ASAN.
>
> Some applications, like zfs, will fail with this error:
>
> /lib/libuutil.so.2: Undefined symbol "__assfail"
>
> Thanks,
>

How does one build world with ASAN ?
___
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: r329984 - in head: cddl/contrib/opensolaris/lib/libzpool/common sys/cddl/compat/opensolaris/sys

2018-03-14 Thread Shawn Webb
On Sun, Feb 25, 2018 at 02:29:43PM +, Alan Somers wrote:
> Author: asomers
> Date: Sun Feb 25 14:29:43 2018
> New Revision: 329984
> URL: https://svnweb.freebsd.org/changeset/base/329984
> 
> Log:
>   Don't declare __assfail as static
>   
>   It gets called by dmu_buf_init_user, which is inline but not static.  So it
>   needs global linkage itself.
>   
>   Reported by:GCC-6
>   MFC after:  17 days
>   X-MFC-With: 329722
> 

Hey Alan,

This commit breaks compiling world with ASAN.

Some applications, like zfs, will fail with this error:

/lib/libuutil.so.2: Undefined symbol "__assfail"

Thanks,

-- 
Shawn Webb
Cofounder and Security Engineer
HardenedBSD

Tor-ified Signal:+1 443-546-8752
GPG Key ID:  0x6A84658F52456EEE
GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE


signature.asc
Description: PGP signature


Re: svn commit: r330952 - head/sys/kern

2018-03-14 Thread Ravi Pokala
-Original Message-
From:  on behalf of Conrad Meyer 

Date: 2018-03-14, Wednesday at 15:11
To: , , 

Subject: svn commit: r330952 - head/sys/kern

> Author: cem
> Date: Wed Mar 14 22:11:45 2018
> New Revision: 330952
> URL: https://svnweb.freebsd.org/changeset/base/330952
> 
> Log:
>   vfs_bio.c: Apply cleanups motivated by Coverity analysis
  
What's the Coverity ID?

Thanks,

Ravi (rpokala@)



___
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: r330952 - head/sys/kern

2018-03-14 Thread Conrad Meyer
Author: cem
Date: Wed Mar 14 22:11:45 2018
New Revision: 330952
URL: https://svnweb.freebsd.org/changeset/base/330952

Log:
  vfs_bio.c: Apply cleanups motivated by Coverity analysis
  
  It is believed that the conditions Coverity indicated were actually
  impossible to hit.  So this patch just adds a cleanup to only compute
  v_mount once in brelse(), and in vfs_bio_getpages() always initializes error
  to zero to appease the static analyzer.
  
  No functional change intended.
  
  Submitted by: Darrick Lew 
  Reviewed by:  kib
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D14613

Modified:
  head/sys/kern/vfs_bio.c

Modified: head/sys/kern/vfs_bio.c
==
--- head/sys/kern/vfs_bio.c Wed Mar 14 21:32:23 2018(r330951)
+++ head/sys/kern/vfs_bio.c Wed Mar 14 22:11:45 2018(r330952)
@@ -2450,6 +2450,7 @@ buf_dirty_count_severe(void)
 void
 brelse(struct buf *bp)
 {
+   struct mount *v_mnt;
int qindex;
 
/*
@@ -2560,11 +2561,13 @@ brelse(struct buf *bp)
 * around to prevent it from being reconstituted and starting a second
 * background write.
 */
+
+   v_mnt = bp->b_vp != NULL ? bp->b_vp->v_mount : NULL;
+
if ((bp->b_flags & B_VMIO) && (bp->b_flags & B_NOCACHE ||
(bp->b_ioflags & BIO_ERROR && bp->b_iocmd == BIO_READ)) &&
-   !(bp->b_vp->v_mount != NULL &&
-   (bp->b_vp->v_mount->mnt_vfc->vfc_flags & VFCF_NETWORK) != 0 &&
-   !vn_isdisk(bp->b_vp, NULL) && (bp->b_flags & B_DELWRI))) {
+   (v_mnt == NULL || (v_mnt->mnt_vfc->vfc_flags & VFCF_NETWORK) == 0 ||
+   vn_isdisk(bp->b_vp, NULL) || (bp->b_flags & B_DELWRI) == 0)) {
vfs_vmio_invalidate(bp);
allocbuf(bp, 0);
}
@@ -4977,6 +4980,7 @@ vfs_bio_getpages(struct vnode *vp, vm_page_t *ma, int 
 
object = vp->v_object;
mp = vp->v_mount;
+   error = 0;
la = IDX_TO_OFF(ma[count - 1]->pindex);
if (la >= object->un_pager.vnp.vnp_size)
return (VM_PAGER_BAD);
___
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: r330951 - head/sys/dev/mps

2018-03-14 Thread Steven Hartland
Author: smh
Date: Wed Mar 14 21:32:23 2018
New Revision: 330951
URL: https://svnweb.freebsd.org/changeset/base/330951

Log:
  Fix mps deadlock when handling panic
  
  During shutdown mps waits for its SSU requests to complete however when
  performing a reboot after handling a panic the scheduler is stopped so
  getmicrotime which is used can be non-functional.
  
  Switch to using the same method as shutdown_panic to ensure we actually
  complete.
  
  In addition reduce the timeout when RB_NOSYNC is set in howto as we expect
  this to fail.
  
  Reviewed by:  slm
  MFC after:1 week
  Sponsored by: Multiplay
  Differential Revision:https://reviews.freebsd.org/D12776

Modified:
  head/sys/dev/mps/mps_sas_lsi.c
  head/sys/dev/mps/mpsvar.h

Modified: head/sys/dev/mps/mps_sas_lsi.c
==
--- head/sys/dev/mps/mps_sas_lsi.c  Wed Mar 14 21:21:03 2018
(r330950)
+++ head/sys/dev/mps/mps_sas_lsi.c  Wed Mar 14 21:32:23 2018
(r330951)
@@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -126,7 +127,7 @@ int mpssas_get_sas_address_for_sata_disk(struct mps_so
 u64 *sas_address, u16 handle, u32 device_info, u8 *is_SATA_SSD);
 static int mpssas_volume_add(struct mps_softc *sc,
 u16 handle);
-static void mpssas_SSU_to_SATA_devices(struct mps_softc *sc);
+static void mpssas_SSU_to_SATA_devices(struct mps_softc *sc, int howto);
 static void mpssas_stop_unit_done(struct cam_periph *periph,
 union ccb *done_ccb);
 
@@ -1122,7 +1123,7 @@ out:
  * Return nothing.
  */
 static void
-mpssas_SSU_to_SATA_devices(struct mps_softc *sc)
+mpssas_SSU_to_SATA_devices(struct mps_softc *sc, int howto)
 {
struct mpssas_softc *sassc = sc->sassc;
union ccb *ccb;
@@ -1130,7 +1131,7 @@ mpssas_SSU_to_SATA_devices(struct mps_softc *sc)
target_id_t targetid;
struct mpssas_target *target;
char path_str[64];
-   struct timeval cur_time, start_time;
+   int timeout;
 
/*
 * For each target, issue a StartStopUnit command to stop the device.
@@ -1193,17 +1194,23 @@ mpssas_SSU_to_SATA_devices(struct mps_softc *sc)
}
 
/*
-* Wait until all of the SSU commands have completed or time has
-* expired (60 seconds).  Pause for 100ms each time through.  If any
-* command times out, the target will be reset in the SCSI command
-* timeout routine.
+* Timeout after 60 seconds by default or 10 seconds if howto has
+* RB_NOSYNC set which indicates we're likely handling a panic.
 */
-   getmicrotime(_time);
-   while (sc->SSU_refcount) {
+   timeout = 600;
+   if (howto & RB_NOSYNC)
+   timeout = 100;
+
+   /*
+* Wait until all of the SSU commands have completed or timeout has
+* expired.  Pause for 100ms each time through.  If any command
+* times out, the target will be reset in the SCSI command timeout
+* routine.
+*/
+   while (sc->SSU_refcount > 0) {
pause("mpswait", hz/10);

-   getmicrotime(_time);
-   if ((cur_time.tv_sec - start_time.tv_sec) > 60) {
+   if (--timeout == 0) {
mps_dprint(sc, MPS_FAULT, "Time has expired waiting "
"for SSU commands to complete.\n");
break;
@@ -1245,7 +1252,7 @@ mpssas_stop_unit_done(struct cam_periph *periph, union
  * Return nothing.
  */
 void
-mpssas_ir_shutdown(struct mps_softc *sc)
+mpssas_ir_shutdown(struct mps_softc *sc, int howto)
 {
u16 volume_mapping_flags;
u16 ioc_pg8_flags = le16toh(sc->ioc_pg8.Flags);
@@ -1350,5 +1357,5 @@ out:
}
}
}
-   mpssas_SSU_to_SATA_devices(sc);
+   mpssas_SSU_to_SATA_devices(sc, howto);
 }

Modified: head/sys/dev/mps/mpsvar.h
==
--- head/sys/dev/mps/mpsvar.h   Wed Mar 14 21:21:03 2018(r330950)
+++ head/sys/dev/mps/mpsvar.h   Wed Mar 14 21:32:23 2018(r330951)
@@ -772,7 +772,7 @@ int mps_config_get_volume_wwid(struct mps_softc *sc, u
 int mps_config_get_raid_pd_pg0(struct mps_softc *sc,
 Mpi2ConfigReply_t *mpi_reply, Mpi2RaidPhysDiskPage0_t *config_page,
 u32 page_address);
-void mpssas_ir_shutdown(struct mps_softc *sc);
+void mpssas_ir_shutdown(struct mps_softc *sc, int howto);
 
 int mps_reinit(struct mps_softc *sc);
 void mpssas_handle_reinit(struct mps_softc *sc);
___
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: r330950 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2018-03-14 Thread Steven Hartland

Missed the differential review: https://reviews.freebsd.org/D14695

On 14/03/2018 21:21, Steven Hartland wrote:

Author: smh
Date: Wed Mar 14 21:21:03 2018
New Revision: 330950
URL: https://svnweb.freebsd.org/changeset/base/330950

Log:
   Prevent ZFS TRIM breaking VTOC8 partitions
   
   Update the ZFS TRIM code to ensure it respects VTOC8 partition headers as

   documented by the ZFS On-Disk Specification section 1.3
   
   Before this a zpool create on a VTOC8 partitioned device would overwrite the

   partition metadata.
   
   Reported by:	marius

   Reviewed by: marius agv
   MFC after:   1 week
   Sponsored by:Multiplay

Modified:
   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.cWed Mar 
14 21:11:41 2018(r330949)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.cWed Mar 
14 21:21:03 2018(r330950)
@@ -802,7 +802,9 @@ vdev_label_init(vdev_t *vd, uint64_t crtxg, vdev_label
}
  
  	/*

-* TRIM the whole thing so that we start with a clean slate.
+* TRIM the whole thing, excluding the blank space and boot header
+* as specified by ZFS On-Disk Specification (section 1.3), so that
+* we start with a clean slate.
 * It's just an optimization, so we don't care if it fails.
 * Don't TRIM if removing so that we don't interfere with zpool
 * disaster recovery.
@@ -810,7 +812,8 @@ vdev_label_init(vdev_t *vd, uint64_t crtxg, vdev_label
if (zfs_trim_enabled && vdev_trim_on_init && !vd->vdev_notrim &&
(reason == VDEV_LABEL_CREATE || reason == VDEV_LABEL_SPARE ||
reason == VDEV_LABEL_L2CACHE))
-   zio_wait(zio_trim(NULL, spa, vd, 0, vd->vdev_psize));
+   zio_wait(zio_trim(NULL, spa, vd, VDEV_SKIP_SIZE,
+   vd->vdev_psize - VDEV_SKIP_SIZE));
  
  	/*

 * Initialize its label.



___
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: r330950 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2018-03-14 Thread Steven Hartland
Author: smh
Date: Wed Mar 14 21:21:03 2018
New Revision: 330950
URL: https://svnweb.freebsd.org/changeset/base/330950

Log:
  Prevent ZFS TRIM breaking VTOC8 partitions
  
  Update the ZFS TRIM code to ensure it respects VTOC8 partition headers as
  documented by the ZFS On-Disk Specification section 1.3
  
  Before this a zpool create on a VTOC8 partitioned device would overwrite the
  partition metadata.
  
  Reported by:  marius
  Reviewed by:  marius agv
  MFC after:1 week
  Sponsored by: Multiplay

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.cWed Mar 
14 21:11:41 2018(r330949)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.cWed Mar 
14 21:21:03 2018(r330950)
@@ -802,7 +802,9 @@ vdev_label_init(vdev_t *vd, uint64_t crtxg, vdev_label
}
 
/*
-* TRIM the whole thing so that we start with a clean slate.
+* TRIM the whole thing, excluding the blank space and boot header
+* as specified by ZFS On-Disk Specification (section 1.3), so that
+* we start with a clean slate.
 * It's just an optimization, so we don't care if it fails.
 * Don't TRIM if removing so that we don't interfere with zpool
 * disaster recovery.
@@ -810,7 +812,8 @@ vdev_label_init(vdev_t *vd, uint64_t crtxg, vdev_label
if (zfs_trim_enabled && vdev_trim_on_init && !vd->vdev_notrim && 
(reason == VDEV_LABEL_CREATE || reason == VDEV_LABEL_SPARE ||
reason == VDEV_LABEL_L2CACHE))
-   zio_wait(zio_trim(NULL, spa, vd, 0, vd->vdev_psize));
+   zio_wait(zio_trim(NULL, spa, vd, VDEV_SKIP_SIZE,
+   vd->vdev_psize - VDEV_SKIP_SIZE));
 
/*
 * Initialize its label.
___
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: r330949 - in head/sys: dev/aac dev/aacraid modules/aac modules/aacraid sys

2018-03-14 Thread Brooks Davis
Author: brooks
Date: Wed Mar 14 21:11:41 2018
New Revision: 330949
URL: https://svnweb.freebsd.org/changeset/base/330949

Log:
  Fix FSACTL_GET_NEXT_ADAPTER_FIB under 32-bit compat.
  
  This includes FSACTL_LNX_GET_NEXT_ADAPTER_FIB.
  
  Reviewed by:  cem
  Obtained from:CheriBSD
  MFC after:1 week
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D14672

Modified:
  head/sys/dev/aac/aac.c
  head/sys/dev/aacraid/aacraid.c
  head/sys/modules/aac/Makefile
  head/sys/modules/aacraid/Makefile
  head/sys/sys/aac_ioctl.h

Modified: head/sys/dev/aac/aac.c
==
--- head/sys/dev/aac/aac.c  Wed Mar 14 20:55:28 2018(r330948)
+++ head/sys/dev/aac/aac.c  Wed Mar 14 21:11:41 2018(r330949)
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
 #define AAC_DRIVERNAME "aac"
 
 #include "opt_aac.h"
+#include "opt_compat.h"
 
 /* #include  */
 #include 
@@ -45,7 +46,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 #include 
 #include 
 
@@ -3521,7 +3524,19 @@ aac_getnext_aif(struct aac_softc *sc, caddr_t arg)
 
fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
-   if ((error = copyin(arg, , sizeof(agf))) == 0) {
+#ifdef COMPAT_FREEBSD32
+   if (SV_CURPROC_FLAG(SV_ILP32)) {
+   struct get_adapter_fib_ioctl32 agf32;
+   error = copyin(arg, , sizeof(agf32));
+   if (error == 0) {
+   agf.AdapterFibContext = agf32.AdapterFibContext;
+   agf.Wait = agf32.Wait;
+   agf.AifFib = (caddr_t)(uintptr_t)agf32.AifFib;
+   }
+   } else
+#endif
+   error = copyin(arg, , sizeof(agf));
+   if (error == 0) {
for (ctx = sc->fibctx; ctx; ctx = ctx->next) {
if (agf.AdapterFibContext == ctx->unique)
break;

Modified: head/sys/dev/aacraid/aacraid.c
==
--- head/sys/dev/aacraid/aacraid.c  Wed Mar 14 20:55:28 2018
(r330948)
+++ head/sys/dev/aacraid/aacraid.c  Wed Mar 14 21:11:41 2018
(r330949)
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
 #define AAC_DRIVERNAME "aacraid"
 
 #include "opt_aacraid.h"
+#include "opt_compat.h"
 
 /* #include  */
 #include 
@@ -46,7 +47,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 #include 
 #include 
 
@@ -3381,7 +3384,19 @@ aac_getnext_aif(struct aac_softc *sc, caddr_t arg)
fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
mtx_lock(>aac_io_lock);
-   if ((error = copyin(arg, , sizeof(agf))) == 0) {
+#ifdef COMPAT_FREEBSD32
+   if (SV_CURPROC_FLAG(SV_ILP32)) {
+   struct get_adapter_fib_ioctl32 agf32;
+   error = copyin(arg, , sizeof(agf32));
+   if (error == 0) {
+   agf.AdapterFibContext = agf32.AdapterFibContext;
+   agf.Wait = agf32.Wait;
+   agf.AifFib = (caddr_t)(uintptr_t)agf32.AifFib;
+   }
+   } else
+#endif
+   error = copyin(arg, , sizeof(agf));
+   if (error == 0) {
for (ctx = sc->fibctx; ctx; ctx = ctx->next) {
if (agf.AdapterFibContext == ctx->unique)
break;

Modified: head/sys/modules/aac/Makefile
==
--- head/sys/modules/aac/Makefile   Wed Mar 14 20:55:28 2018
(r330948)
+++ head/sys/modules/aac/Makefile   Wed Mar 14 21:11:41 2018
(r330949)
@@ -8,7 +8,7 @@ SUBDIR= aac_linux
 
 KMOD=  aac
 SRCS=  aac.c aac_pci.c aac_disk.c aac_cam.c
-SRCS+= opt_scsi.h opt_cam.h opt_aac.h
+SRCS+= opt_scsi.h opt_cam.h opt_compat.h opt_aac.h
 SRCS+= device_if.h bus_if.h pci_if.h
 
 # To enable debug output from the driver, uncomment these two lines.

Modified: head/sys/modules/aacraid/Makefile
==
--- head/sys/modules/aacraid/Makefile   Wed Mar 14 20:55:28 2018
(r330948)
+++ head/sys/modules/aacraid/Makefile   Wed Mar 14 21:11:41 2018
(r330949)
@@ -8,7 +8,7 @@ SUBDIR= aacraid_linux
 
 KMOD=  aacraid
 SRCS=  aacraid.c aacraid_pci.c aacraid_cam.c
-SRCS+= opt_scsi.h opt_cam.h opt_aacraid.h
+SRCS+= opt_scsi.h opt_cam.h opt_compat.h opt_aacraid.h
 SRCS+= device_if.h bus_if.h pci_if.h
 
 # To enable debug output from the driver, uncomment these two lines.

Modified: head/sys/sys/aac_ioctl.h
==
--- head/sys/sys/aac_ioctl.hWed Mar 14 20:55:28 2018(r330948)
+++ head/sys/sys/aac_ioctl.hWed Mar 14 21:11:41 2018(r330949)
@@ -175,6 +175,14 @@ struct 

svn commit: r330948 - in head/lib: libdpv libfigpar

2018-03-14 Thread Devin Teske
Author: dteske
Date: Wed Mar 14 20:55:28 2018
New Revision: 330948
URL: https://svnweb.freebsd.org/changeset/base/330948

Log:
  Bump copyright following recent changes

Modified:
  head/lib/libdpv/dpv.3
  head/lib/libfigpar/figpar.3

Modified: head/lib/libdpv/dpv.3
==
--- head/lib/libdpv/dpv.3   Wed Mar 14 20:49:51 2018(r330947)
+++ head/lib/libdpv/dpv.3   Wed Mar 14 20:55:28 2018(r330948)
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2013-2016 Devin Teske
+.\" Copyright (c) 2013-2018 Devin Teske
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without

Modified: head/lib/libfigpar/figpar.3
==
--- head/lib/libfigpar/figpar.3 Wed Mar 14 20:49:51 2018(r330947)
+++ head/lib/libfigpar/figpar.3 Wed Mar 14 20:55:28 2018(r330948)
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2013-2015 Devin Teske 
+.\" Copyright (c) 2013-2018 Devin Teske 
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
___
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: r330947 - head/sys/dev/cxgbe/tom

2018-03-14 Thread John Baldwin
Author: jhb
Date: Wed Mar 14 20:49:51 2018
New Revision: 330947
URL: https://svnweb.freebsd.org/changeset/base/330947

Log:
  Fix the check for an empty send socket buffer on a TOE TLS socket.
  
  Compare sbavail() with the cached sb_off of already-sent data instead of
  always comparing with zero.  This will correctly close the connection and
  send the FIN if the socket buffer contains some previously-sent data but
  no unsent data.
  
  Reported by:  Harsh Jain @ Chelsio
  Sponsored by: Chelsio Communications

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

Modified: head/sys/dev/cxgbe/tom/t4_tls.c
==
--- head/sys/dev/cxgbe/tom/t4_tls.c Wed Mar 14 20:46:25 2018
(r330946)
+++ head/sys/dev/cxgbe/tom/t4_tls.c Wed Mar 14 20:49:51 2018
(r330947)
@@ -1175,7 +1175,8 @@ t4_push_tls_records(struct adapter *sc, struct toepcb 
 * Send a FIN if requested, but only if there's no
 * more data to send.
 */
-   if (sbavail(sb) == 0 && toep->flags & TPF_SEND_FIN) {
+   if (sbavail(sb) == tls_ofld->sb_off &&
+   toep->flags & TPF_SEND_FIN) {
if (sowwakeup)
sowwakeup_locked(so);
else
___
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: r330946 - head/sys/dev/cxgbe/tom

2018-03-14 Thread John Baldwin
Author: jhb
Date: Wed Mar 14 20:46:25 2018
New Revision: 330946
URL: https://svnweb.freebsd.org/changeset/base/330946

Log:
  Remove TLS-related inlines from t4_tom.h to fix iw_cxgbe(4) build.
  
  - Remove the one use of is_tls_offload() and the function.  AIO special
handling only needs to be disabled when a TOE socket is actively doing
TLS offload on transmit.  The TOE socket's mode (which affects receive
operation) doesn't matter, so remove the check for the socket's mode and
only check if a TOE socket has TLS transmit keys configured to determine
if an AIO write request should fall back to the normal socket handling
instead of the TOE fast path.
  - Move can_tls_offload() into t4_tls.c.  It is not used in critical paths,
so inlining isn't that important.  Change return type to bool while here.
  
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/tom/t4_cpl_io.c
  head/sys/dev/cxgbe/tom/t4_tls.c
  head/sys/dev/cxgbe/tom/t4_tom.h

Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c
==
--- head/sys/dev/cxgbe/tom/t4_cpl_io.c  Wed Mar 14 20:07:52 2018
(r330945)
+++ head/sys/dev/cxgbe/tom/t4_cpl_io.c  Wed Mar 14 20:46:25 2018
(r330946)
@@ -2357,7 +2357,7 @@ t4_aio_queue_aiotx(struct socket *so, struct kaiocb *j
if (!sc->tt.tx_zcopy)
return (EOPNOTSUPP);
 
-   if (is_tls_offload(toep) || tls_tx_key(toep))
+   if (tls_tx_key(toep))
return (EOPNOTSUPP);
 
SOCKBUF_LOCK(>so_snd);

Modified: head/sys/dev/cxgbe/tom/t4_tls.c
==
--- head/sys/dev/cxgbe/tom/t4_tls.c Wed Mar 14 20:07:52 2018
(r330945)
+++ head/sys/dev/cxgbe/tom/t4_tls.c Wed Mar 14 20:46:25 2018
(r330946)
@@ -73,6 +73,13 @@ t4_set_tls_tcb_field(struct toepcb *toep, uint16_t wor
 }
 
 /* TLS and DTLS common routines */
+bool
+can_tls_offload(struct adapter *sc)
+{
+
+   return (sc->tt.tls && sc->cryptocaps & FW_CAPS_CONFIG_TLSKEYS);
+}
+
 int
 tls_tx_key(struct toepcb *toep)
 {

Modified: head/sys/dev/cxgbe/tom/t4_tom.h
==
--- head/sys/dev/cxgbe/tom/t4_tom.h Wed Mar 14 20:07:52 2018
(r330945)
+++ head/sys/dev/cxgbe/tom/t4_tom.h Wed Mar 14 20:46:25 2018
(r330946)
@@ -321,18 +321,6 @@ mbuf_ulp_submode(struct mbuf *m)
return (m->m_pkthdr.PH_per.eight[0]);
 }
 
-static inline int
-is_tls_offload(struct toepcb *toep)
-{
-   return (toep->ulp_mode == ULP_MODE_TLS);
-}
-
-static inline int
-can_tls_offload(struct adapter *sc)
-{
-   return (sc->tt.tls && sc->cryptocaps & FW_CAPS_CONFIG_TLSKEYS);
-}
-
 /* t4_tom.c */
 struct toepcb *alloc_toepcb(struct vi_info *, int, int, int);
 struct toepcb *hold_toepcb(struct toepcb *);
@@ -430,6 +418,7 @@ void handle_ddp_tcb_rpl(struct toepcb *, const struct 
 void insert_ddp_data(struct toepcb *, uint32_t);
 
 /* t4_tls.c */
+bool can_tls_offload(struct adapter *);
 int t4_ctloutput_tls(struct socket *, struct sockopt *);
 void t4_push_tls_records(struct adapter *, struct toepcb *, int);
 void t4_tls_mod_load(void);
___
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: r330945 - head/sys/modules/isp

2018-03-14 Thread Brooks Davis
Author: brooks
Date: Wed Mar 14 20:07:52 2018
New Revision: 330945
URL: https://svnweb.freebsd.org/changeset/base/330945

Log:
  Add opt_compat.h to isp(4) as required by r330876.
  
  MFC with: r330876

Modified:
  head/sys/modules/isp/Makefile

Modified: head/sys/modules/isp/Makefile
==
--- head/sys/modules/isp/Makefile   Wed Mar 14 19:51:28 2018
(r330944)
+++ head/sys/modules/isp/Makefile   Wed Mar 14 20:07:52 2018
(r330945)
@@ -4,7 +4,7 @@
 
 KMOD=  isp
 SRCS=  bus_if.h device_if.h pci_if.h \
-   opt_cam.h opt_ddb.h opt_isp.h \
+   opt_cam.h opt_compat.h opt_ddb.h opt_isp.h \
isp.c isp_library.c isp_target.c isp_freebsd.c isp_pci.c
 
 .if ${MACHINE} == sparc64
___
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: r330944 - head/sys/compat/linuxkpi/common/include/linux

2018-03-14 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Mar 14 19:51:28 2018
New Revision: 330944
URL: https://svnweb.freebsd.org/changeset/base/330944

Log:
  Fix compliancy of the kstrtoXXX() functions in the LinuxKPI, by skipping
  one newline character at the end, if any.
  
  Found by: greg@unrelenting.technology
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/kernel.h

Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h
==
--- head/sys/compat/linuxkpi/common/include/linux/kernel.h  Wed Mar 14 
19:23:17 2018(r330943)
+++ head/sys/compat/linuxkpi/common/include/linux/kernel.h  Wed Mar 14 
19:51:28 2018(r330944)
@@ -295,6 +295,9 @@ kstrtoul(const char *cp, unsigned int base, unsigned l
 
*res = strtoul(cp, , base);
 
+   /* skip newline character, if any */
+   if (*end == '\n')
+   end++;
if (*cp == 0 || *end != 0)
return (-EINVAL);
return (0);
@@ -307,6 +310,9 @@ kstrtol(const char *cp, unsigned int base, long *res)
 
*res = strtol(cp, , base);
 
+   /* skip newline character, if any */
+   if (*end == '\n')
+   end++;
if (*cp == 0 || *end != 0)
return (-EINVAL);
return (0);
@@ -320,6 +326,9 @@ kstrtoint(const char *cp, unsigned int base, int *res)
 
*res = temp = strtol(cp, , base);
 
+   /* skip newline character, if any */
+   if (*end == '\n')
+   end++;
if (*cp == 0 || *end != 0)
return (-EINVAL);
if (temp != (int)temp)
@@ -335,6 +344,9 @@ kstrtouint(const char *cp, unsigned int base, unsigned
 
*res = temp = strtoul(cp, , base);
 
+   /* skip newline character, if any */
+   if (*end == '\n')
+   end++;
if (*cp == 0 || *end != 0)
return (-EINVAL);
if (temp != (unsigned int)temp)
@@ -350,6 +362,9 @@ kstrtou32(const char *cp, unsigned int base, u32 *res)
 
*res = temp = strtoul(cp, , base);
 
+   /* skip newline character, if any */
+   if (*end == '\n')
+   end++;
if (*cp == 0 || *end != 0)
return (-EINVAL);
if (temp != (u32)temp)
___
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: r330943 - head/lib/libdpv

2018-03-14 Thread Devin Teske
Author: dteske
Date: Wed Mar 14 19:23:17 2018
New Revision: 330943
URL: https://svnweb.freebsd.org/changeset/base/330943

Log:
  Fix bad error messages from dpv(3)
  
  Before = dpv: <__func__>: posix_spawnp(3): No such file or directory
   After = dpv: : No such file or directory
  
  Most notably, show the 2nd argument being passed to posix_spawnp(3)
  so we know what path/cmd failed.
  
  Also, we don't need to have "posix_spawnp(3)" in the error message
  nor the function because that can [a] change and [b] traversed using
  a debugger if necessary.

Modified:
  head/lib/libdpv/dialog_util.c
  head/lib/libdpv/util.c

Modified: head/lib/libdpv/dialog_util.c
==
--- head/lib/libdpv/dialog_util.c   Wed Mar 14 19:18:35 2018
(r330942)
+++ head/lib/libdpv/dialog_util.c   Wed Mar 14 19:23:17 2018
(r330943)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2013-2014 Devin Teske 
+ * Copyright (c) 2013-2018 Devin Teske 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -328,8 +328,7 @@ dialog_spawn_gauge(char *init_prompt, pid_t *pid)
posix_spawn_file_actions_addclose(, stdin_pipe[1]);
error = posix_spawnp(pid, dialog, ,
(const posix_spawnattr_t *)NULL, dargv, environ);
-   if (error != 0)
-   err(EXIT_FAILURE, "%s: posix_spawnp(3)", __func__);
+   if (error != 0) err(EXIT_FAILURE, "%s", dialog);
 
/* NB: Do not free(3) *dargv[], else SIGSEGV */
 

Modified: head/lib/libdpv/util.c
==
--- head/lib/libdpv/util.c  Wed Mar 14 19:18:35 2018(r330942)
+++ head/lib/libdpv/util.c  Wed Mar 14 19:23:17 2018(r330943)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2013-2014 Devin Teske 
+ * Copyright (c) 2013-2018 Devin Teske 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -100,8 +100,7 @@ shell_spawn_pipecmd(const char *cmd, const char *label
posix_spawn_file_actions_addclose(, stdin_pipe[1]);
error = posix_spawnp(pid, shellcmd, ,
(const posix_spawnattr_t *)NULL, shellcmd_argv, environ);
-   if (error != 0)
-   err(EXIT_FAILURE, "%s: posix_spawnp(3)", __func__);
+   if (error != 0) err(EXIT_FAILURE, "%s", shellcmd);
 
return stdin_pipe[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: r330942 - vendor-sys/acpica/20180313

2018-03-14 Thread Jung-uk Kim
Author: jkim
Date: Wed Mar 14 19:18:35 2018
New Revision: 330942
URL: https://svnweb.freebsd.org/changeset/base/330942

Log:
  Tag ACPICA 20180313.

Added:
  vendor-sys/acpica/20180313/
 - copied from r330941, vendor-sys/acpica/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: r330941 - in vendor-sys/acpica/dist: . source/components/debugger source/components/dispatcher source/components/events source/components/executer source/components/hardware source/comp...

2018-03-14 Thread Jung-uk Kim
Author: jkim
Date: Wed Mar 14 19:17:38 2018
New Revision: 330941
URL: https://svnweb.freebsd.org/changeset/base/330941

Log:
  Import ACPICA 20180313.

Modified:
  vendor-sys/acpica/dist/changes.txt
  vendor-sys/acpica/dist/source/components/debugger/dbdisply.c
  vendor-sys/acpica/dist/source/components/dispatcher/dspkginit.c
  vendor-sys/acpica/dist/source/components/events/evevent.c
  vendor-sys/acpica/dist/source/components/events/evgpe.c
  vendor-sys/acpica/dist/source/components/events/evgpeblk.c
  vendor-sys/acpica/dist/source/components/events/evrgnini.c
  vendor-sys/acpica/dist/source/components/events/evxface.c
  vendor-sys/acpica/dist/source/components/events/evxfgpe.c
  vendor-sys/acpica/dist/source/components/executer/exdebug.c
  vendor-sys/acpica/dist/source/components/hardware/hwgpe.c
  vendor-sys/acpica/dist/source/components/hardware/hwsleep.c
  vendor-sys/acpica/dist/source/components/hardware/hwxfsleep.c
  vendor-sys/acpica/dist/source/components/namespace/nsdumpdv.c
  vendor-sys/acpica/dist/source/components/namespace/nseval.c
  vendor-sys/acpica/dist/source/components/namespace/nsload.c
  vendor-sys/acpica/dist/source/components/namespace/nsparse.c
  vendor-sys/acpica/dist/source/components/namespace/nsxfname.c
  vendor-sys/acpica/dist/source/components/parser/psargs.c
  vendor-sys/acpica/dist/source/components/parser/psloop.c
  vendor-sys/acpica/dist/source/components/parser/psobject.c
  vendor-sys/acpica/dist/source/components/tables/tbdata.c
  vendor-sys/acpica/dist/source/components/tables/tbinstal.c
  vendor-sys/acpica/dist/source/components/tables/tbxfload.c
  vendor-sys/acpica/dist/source/components/utilities/utosi.c
  vendor-sys/acpica/dist/source/components/utilities/utxfinit.c
  vendor-sys/acpica/dist/source/include/acevents.h
  vendor-sys/acpica/dist/source/include/acmacros.h
  vendor-sys/acpica/dist/source/include/acpixf.h
  vendor-sys/acpica/dist/source/include/actypes.h
  vendor-sys/acpica/dist/source/include/platform/aclinux.h
  vendor-sys/acpica/dist/source/tools/acpiexec/aemain.c
  vendor-sys/acpica/dist/source/tools/acpiexec/aetables.c
  vendor-sys/acpica/dist/source/tools/acpinames/anmain.c
  vendor-sys/acpica/dist/source/tools/acpinames/anstubs.c
  vendor-sys/acpica/dist/source/tools/acpinames/antables.c
  vendor-sys/acpica/dist/source/tools/acpisrc/acpisrc.h
  vendor-sys/acpica/dist/source/tools/acpisrc/asconvrt.c
  vendor-sys/acpica/dist/source/tools/acpisrc/asfile.c
  vendor-sys/acpica/dist/source/tools/acpisrc/astable.c
  vendor-sys/acpica/dist/source/tools/acpisrc/asutils.c

Modified: vendor-sys/acpica/dist/changes.txt
==
--- vendor-sys/acpica/dist/changes.txt  Wed Mar 14 19:09:58 2018
(r330940)
+++ vendor-sys/acpica/dist/changes.txt  Wed Mar 14 19:17:38 2018
(r330941)
@@ -1,4 +1,50 @@
 
+13 March 2018. Summary of changes for version 20180313:
+
+
+1) ACPICA kernel-resident subsystem:
+
+Implemented various improvements to the GPE support:
+
+1) Dispatch all active GPEs at initialization time so that no GPEs are 
+lost.
+2) Enable runtime GPEs earlier. Some systems expect GPEs to be enabled 
+before devices are enumerated.
+3) Don't unconditionally clear ACPI IRQs during suspend/resume, so that 
+IRQs are not lost.
+4) Add parallel GPE handling to eliminate the possibility of dispatching 
+the same GPE twice.
+5) Dispatch any pending GPEs after enabling for the first time.
+
+AcpiGetObjectInfo - removed support for the _STA method. This was causing 
+problems on some platforms.
+
+Added a new _OSI string, "Windows 2017.2".
+
+Cleaned up and simplified the module-level code support. These changes 
+are in preparation for the eventual removal of the legacy MLC support 
+(deferred execution), replaced by the new MLC architecture which executes 
+the MLC as a table is loaded (DSDT/SSDTs).
+
+Changed a compile-time option to a runtime option. Changes the option to 
+ignore ACPI table load-time package resolution errors into a runtime 
+option. Used only for platforms that generate many AE_NOT_FOUND errors 
+during boot. AcpiGbl_IgnorePackageResolutionErrors.
+
+Fixed the ACPI_ERROR_NAMESPACE macro. This change involves putting some 
+ACPI_ERROR_NAMESPACE parameters inside macros. By doing so, we avoid 
+compilation errors from unused variables (seen with some compilers).
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+ASLTS: parallelized execution in order to achieve an (approximately) 2X 
+performance increase.
+
+ASLTS: Updated to use the iASL __LINE__ and __METHOD__ macros. Improves 
+error reporting.
+
+
 09 February 2018. Summary of changes for version 20180209:
 
 

Modified: vendor-sys/acpica/dist/source/components/debugger/dbdisply.c
==
--- vendor-sys/acpica/dist/source/components/debugger/dbdisply.cWed 

svn commit: r330940 - head/share/misc

2018-03-14 Thread Baptiste Daroussin
Author: bapt
Date: Wed Mar 14 19:09:58 2018
New Revision: 330940
URL: https://svnweb.freebsd.org/changeset/base/330940

Log:
  Update to 2018-03-06
  
  MFC after:3 days

Modified:
  head/share/misc/pci_vendors

Modified: head/share/misc/pci_vendors
==
--- head/share/misc/pci_vendors Wed Mar 14 19:09:06 2018(r330939)
+++ head/share/misc/pci_vendors Wed Mar 14 19:09:58 2018(r330940)
@@ -1,9 +1,10 @@
 # $FreeBSD$
 
+#
 #  List of PCI ID's
 #
-#  Version: 2018.02.15
-#  Date:2018-02-15 03:15:01
+#  Version: 2018.03.06
+#  Date:2018-03-06 03:15:02
 #
 #  Maintained by Albert Pool, Martin Mares, and other volunteers from
 #  the PCI ID Project at http://pci-ids.ucw.cz/.
@@ -26,6 +27,17 @@
 0010  Allied Telesis, Inc (Wrong ID)
 # This is a relabelled RTL-8139
8139  AT-2500TX V3 Ethernet
+0014  Loongson Technology LLC
+   7a02  APB (Advanced Peripheral Bus) Controller
+   7a03  Gigabit Ethernet Controller
+   7a04  OTG USB Controller
+   7a05  Vivante GPU (Graphics Processing Unit)
+   7a06  DC (Display Controller)
+   7a07  HDA (High Definition Audio) Controller
+   7a08  SATA AHCI Controller
+   7a0f  DMA (Direct Memory Access) Controller
+   7a14  EHCI USB Controller
+   7a24  OHCI USB Controller
 001c  PEAK-System Technik GmbH
0001  PCAN-PCI CAN-Bus controller
001c 0004  2 Channel CAN Bus SJC1000
@@ -753,7 +765,9 @@
131b  Kaveri [Radeon R4 Graphics]
131c  Kaveri [Radeon R7 Graphics]
131d  Kaveri [Radeon R6 Graphics]
-   15dd  Vega [Radeon Vega 8 Mobile]
+   15dd  Raven Ridge [Radeon Vega Series / Radeon Vega Mobile Series]
+   103c 83c6  Radeon Vega 8 Mobile
+   1458 d000  Radeon RX Vega 11
15ff  Vega [Radeon Vega 28 Mobile]
1714  BeaverCreek HDMI Audio [Radeon HD 6500D and 6400G-6600G series]
103c 168b  ProBook 4535s
@@ -1601,10 +1615,12 @@
103c 2100  FirePro M4100
6602  Mars
6603  Mars
-   6604  Opal XT [Radeon R7 M265]
+   6604  Opal XT [Radeon R7 M265/M365X/M465]
103c 8006  FirePro M4170
+   103c 814f  Litho XT [Radeon R7 M365X]
+   103c 82aa  Litho XT [Radeon R7 M465]
17aa 3643  Radeon R7 A360
-   6605  Opal PRO [Radeon R7 M260]
+   6605  Opal PRO [Radeon R7 M260X]
103c 2259  FirePro M4150
6606  Mars XTX [Radeon HD 8790M]
1028 0684  FirePro W4170M
@@ -1679,6 +1695,7 @@
103c 80be  Radeon R5 M330
103c 8136  Radeon R5 M330
103c 8329  Radeon R7 M520
+   17aa 3633  Radeon R5 A330
17aa 3804  Radeon R5 M330
17aa 3809  Radeon R5 M330
17aa 381a  Radeon R5 M430
@@ -2298,8 +2315,11 @@
1043 04fb  Radeon RX 480
1043 04fd  Radeon RX 480 8GB
1458 22f0  Radeon RX 570
+   1458 22f7  Radeon RX 570 Gaming 4G
1462 3411  Radeon RX 470
1462 3413  Radeon RX 480
+   1462 3416  Radeon RX 570
+   1462 3418  Radeon RX 580 Armor 4G OC
148c 2372  Radeon RX 480
148c 2373  Radeon RX 470
1682 9470  Radeon RX 470
@@ -2334,7 +2354,14 @@
106b 0179  Radeon Pro 560
1642 1727  Polaris 21 XL [Radeon RX 560D]
1682 956d  Polaris 21 XL [Radeon RX 560D]
-   67ff  Baffin [Radeon RX 560]
+   67ff  Baffin [Radeon RX 550 640SP / RX 560]
+   1002 0b04  Radeon RX 560
+   1043 04bc  Radeon RX 560
+   1458 22ed  Radeon RX 560
+   148c 2381  Radeon RX 560
+   1682 9560  Radeon RX 560
+   1da2 e348  Radeon RX 560
+   1da2 e367  Radeon RX 550 640SP
6800  Wimbledon XT [Radeon HD 7970M]
1002 0124  Radeon HD 7970M
8086 2110  Radeon HD 7970M
@@ -2349,7 +2376,9 @@
6808  Pitcairn XT GL [FirePro W7000]
1002 0310  FirePro S7000
1002 0420  Radeon Sky 500
+   103c 030c  MED-X7000
13cc 3d25  MXRT-7500
+   15c3 030c  MED-X7000
6809  Pitcairn LE GL [FirePro W5000]
13cc 3d23  MXRT-5500
13cc 3d24  MXRT-5550
@@ -2411,8 +2440,6 @@
682d  Chelsea XT GL [FirePro M4000]
682f  Chelsea LP [Radeon HD 7730M]
103c 1851  Radeon HD 7750M
-   6830  Cape Verde [Radeon HD 7800M Series]
-   6831  Cape Verde [AMD Radeon HD 7700M Series]
6835  Cape Verde PRX [Radeon R9 255 OEM]
6837  Cape Verde LE [Radeon HD 7730/8730]
1462 2796  Radeon HD 8730
@@ -3026,6 +3053,7 @@
103c 2269  Radeon R7 M260
103c 

svn commit: r330939 - in head: lib/libdpv lib/libfigpar usr.bin/dpv usr.sbin/bsdconfig

2018-03-14 Thread Devin Teske
Author: dteske
Date: Wed Mar 14 19:09:06 2018
New Revision: 330939
URL: https://svnweb.freebsd.org/changeset/base/330939

Log:
  Use full month in dpv(3), figpar(3), and bsdconfig(8) manuals
  
  Reported by:  maxim

Modified:
  head/lib/libdpv/dpv.3
  head/lib/libfigpar/figpar.3
  head/usr.bin/dpv/dpv.1
  head/usr.sbin/bsdconfig/bsdconfig.8

Modified: head/lib/libdpv/dpv.3
==
--- head/lib/libdpv/dpv.3   Wed Mar 14 19:04:40 2018(r330938)
+++ head/lib/libdpv/dpv.3   Wed Mar 14 19:09:06 2018(r330939)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd Mar 13, 2018
+.Dd March 13, 2018
 .Dt DPV 3
 .Os
 .Sh NAME

Modified: head/lib/libfigpar/figpar.3
==
--- head/lib/libfigpar/figpar.3 Wed Mar 14 19:04:40 2018(r330938)
+++ head/lib/libfigpar/figpar.3 Wed Mar 14 19:09:06 2018(r330939)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd Mar 13, 2018
+.Dd March 13, 2018
 .Dt FIGPAR 3
 .Os
 .Sh NAME

Modified: head/usr.bin/dpv/dpv.1
==
--- head/usr.bin/dpv/dpv.1  Wed Mar 14 19:04:40 2018(r330938)
+++ head/usr.bin/dpv/dpv.1  Wed Mar 14 19:09:06 2018(r330939)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd Jan 26, 2016
+.Dd January 26, 2016
 .Dt DPV 1
 .Os
 .Sh NAME

Modified: head/usr.sbin/bsdconfig/bsdconfig.8
==
--- head/usr.sbin/bsdconfig/bsdconfig.8 Wed Mar 14 19:04:40 2018
(r330938)
+++ head/usr.sbin/bsdconfig/bsdconfig.8 Wed Mar 14 19:09:06 2018
(r330939)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd Jun 5, 2013
+.Dd June 5, 2013
 .Dt BSDCONFIG 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: r330938 - in stable/10/sys: dev/acpica dev/cardbus dev/pci powerpc/ofw sparc64/pci

2018-03-14 Thread John Baldwin
Author: jhb
Date: Wed Mar 14 19:04:40 2018
New Revision: 330938
URL: https://svnweb.freebsd.org/changeset/base/330938

Log:
  Convert pci_delete_child() to a bus_child_deleted() method.
  
  Instead of providing a wrapper around device_delete_child() that the PCI
  bus and child bus drivers must call explicitly, move the bulk of the logic
  from pci_delete_child() into a bus_child_deleted() method
  (pci_child_deleted()).  This allows PCI devices to be safely deleted via
  device_delete_child().
  - Add a bus_child_deleted method to the ACPI PCI bus which clears the
device_t associated with the corresponding ACPI handle in addition to
the normal PCI bus cleanup.
  - Change cardbus_detach_card to call device_delete_children() and move
CardBus-specific delete logic into a new cardbus_child_deleted() method.
  - Use device_delete_child() instead of pci_delete_child() in the SRIOV code.
  - Add a bus_child_deleted method to the OpenFirmware PCI bus drivers which
frees the OpenFirmware device info for each PCI device.
  
  To preserve KBI, a pci_delete_child() function is left in place that
  just calls device_delete_child().
  
  PR:   226562
  Requested by: dexuan

Modified:
  stable/10/sys/dev/acpica/acpi_pci.c
  stable/10/sys/dev/cardbus/cardbus.c
  stable/10/sys/dev/pci/pci.c
  stable/10/sys/dev/pci/pci_private.h
  stable/10/sys/powerpc/ofw/ofw_pcibus.c
  stable/10/sys/sparc64/pci/ofw_pcibus.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/acpica/acpi_pci.c
==
--- stable/10/sys/dev/acpica/acpi_pci.c Wed Mar 14 18:27:06 2018
(r330937)
+++ stable/10/sys/dev/acpica/acpi_pci.c Wed Mar 14 19:04:40 2018
(r330938)
@@ -70,6 +70,7 @@ CTASSERT(ACPI_STATE_D2 == PCI_POWERSTATE_D2);
 CTASSERT(ACPI_STATE_D3 == PCI_POWERSTATE_D3);
 
 static int acpi_pci_attach(device_t dev);
+static voidacpi_pci_child_deleted(device_t dev, device_t child);
 static int acpi_pci_child_location_str_method(device_t cbdev,
device_t child, char *buf, size_t buflen);
 static int acpi_pci_probe(device_t dev);
@@ -92,6 +93,7 @@ static device_method_t acpi_pci_methods[] = {
/* Bus interface */
DEVMETHOD(bus_read_ivar,acpi_pci_read_ivar),
DEVMETHOD(bus_write_ivar,   acpi_pci_write_ivar),
+   DEVMETHOD(bus_child_deleted,acpi_pci_child_deleted),
DEVMETHOD(bus_child_location_str, acpi_pci_child_location_str_method),
DEVMETHOD(bus_get_dma_tag,  acpi_pci_get_dma_tag),
DEVMETHOD(bus_get_domain,   acpi_get_domain),
@@ -143,6 +145,16 @@ acpi_pci_write_ivar(device_t dev, device_t child, int 
return (0);
 }
 return (pci_write_ivar(dev, child, which, value));
+}
+
+static void
+acpi_pci_child_deleted(device_t dev, device_t child)
+{
+   struct acpi_pci_devinfo *dinfo = device_get_ivars(child);
+
+   if (acpi_get_device(dinfo->ap_handle) == child)
+   AcpiDetachData(dinfo->ap_handle, acpi_fake_objhandler);
+   pci_child_deleted(dev, child);
 }
 
 static int

Modified: stable/10/sys/dev/cardbus/cardbus.c
==
--- stable/10/sys/dev/cardbus/cardbus.c Wed Mar 14 18:27:06 2018
(r330937)
+++ stable/10/sys/dev/cardbus/cardbus.c Wed Mar 14 19:04:40 2018
(r330938)
@@ -226,31 +226,30 @@ cardbus_attach_card(device_t cbdev)
return (ENOENT);
 }
 
+static void
+cardbus_child_deleted(device_t cbdev, device_t child)
+{
+   struct cardbus_devinfo *dinfo = device_get_ivars(child);
+
+   if (dinfo->pci.cfg.dev != child)
+   device_printf(cbdev, "devinfo dev mismatch\n");
+   cardbus_device_destroy(dinfo);
+   pci_child_deleted(cbdev, child);
+}
+
 static int
 cardbus_detach_card(device_t cbdev)
 {
-   int numdevs;
-   device_t *devlist;
-   int tmp;
int err = 0;
 
-   if (device_get_children(cbdev, , ) != 0)
-   return (ENOENT);
-   if (numdevs == 0) {
-   free(devlist, M_TEMP);
-   return (ENOENT);
-   }
+   err = bus_generic_detach(cbdev);
+   if (err)
+   return (err);
+   err = device_delete_children(cbdev);
+   if (err)
+   return (err);
 
-   for (tmp = 0; tmp < numdevs; tmp++) {
-   struct cardbus_devinfo *dinfo = device_get_ivars(devlist[tmp]);
-
-   if (dinfo->pci.cfg.dev != devlist[tmp])
-   device_printf(cbdev, "devinfo dev mismatch\n");
-   cardbus_device_destroy(dinfo);
-   pci_delete_child(cbdev, devlist[tmp]);
-   }
POWER_DISABLE_SOCKET(device_get_parent(cbdev), cbdev);
-   free(devlist, M_TEMP);
return (err);
 }
 
@@ -335,6 +334,7 @@ static device_method_t cardbus_methods[] = {
DEVMETHOD(device_resume,cardbus_resume),
 
  

svn commit: r330937 - head/sys/dev/iscsi

2018-03-14 Thread Edward Tomasz Napierala
Author: trasz
Date: Wed Mar 14 18:27:06 2018
New Revision: 330937
URL: https://svnweb.freebsd.org/changeset/base/330937

Log:
  Fix typo in a warning message.
  
  MFC after:2 weeks

Modified:
  head/sys/dev/iscsi/iscsi.c

Modified: head/sys/dev/iscsi/iscsi.c
==
--- head/sys/dev/iscsi/iscsi.c  Wed Mar 14 18:07:40 2018(r330936)
+++ head/sys/dev/iscsi/iscsi.c  Wed Mar 14 18:27:06 2018(r330937)
@@ -1281,10 +1281,10 @@ iscsi_pdu_handle_async_message(struct icl_pdu *respons
iscsi_session_terminate(is);
break;
case BHSAM_EVENT_TARGET_TERMINATES_CONNECTION:
-   ISCSI_SESSION_WARN(is, "target indicates it will drop drop the 
connection");
+   ISCSI_SESSION_WARN(is, "target indicates it will drop the 
connection");
break;
case BHSAM_EVENT_TARGET_TERMINATES_SESSION:
-   ISCSI_SESSION_WARN(is, "target indicates it will drop drop the 
session");
+   ISCSI_SESSION_WARN(is, "target indicates it will drop the 
session");
break;
default:
/*
___
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: r330930 - head/sys/conf

2018-03-14 Thread Nathan Whitehorn



On 03/14/18 10:59, Justin Hibbits wrote:

On Wed, Mar 14, 2018 at 12:53 PM, Nathan Whitehorn
 wrote:


On 03/14/18 09:19, Justin Hibbits wrote:

On Wed, Mar 14, 2018 at 11:16 AM, Nathan Whitehorn
 wrote:

Author: nwhitehorn
Date: Wed Mar 14 16:16:25 2018
New Revision: 330930
URL: https://svnweb.freebsd.org/changeset/base/330930

Log:
The expression (aim | fdt) is always true on PowerPC. The last PowerPC
platform that can run without a device tree (PS3) still uses the
OF_*()
functions to check if one exists and OF_* is used unconditionally in
core parts of the system like powerpc/machdep.c. Reflect this reality
in files.powerpc, for example by changing occurrences of aim | fdt to
standard.

Modified:
head/sys/conf/files.powerpc

Modified: head/sys/conf/files.powerpc

==
--- head/sys/conf/files.powerpc Wed Mar 14 14:45:57 2018(r330929)
+++ head/sys/conf/files.powerpc Wed Mar 14 16:16:25 2018(r330930)
@@ -32,7 +32,7 @@ dev/adb/adb_buttons.c optionaladb
   dev/agp/agp_apple.coptionalagp powermac
   dev/fb/fb.coptionalsc
   # ofwbus depends on simplebus.
-dev/fdt/simplebus.coptionalaim | fdt
+dev/fdt/simplebus.coptionalstandard
   dev/hwpmc/hwpmc_e500.c optionalhwpmc
   dev/hwpmc/hwpmc_mpc7xxx.c  optionalhwpmc
   dev/hwpmc/hwpmc_powerpc.c  optionalhwpmc
@@ -55,7 +55,7 @@ dev/ofw/ofw_if.m  optionalaim
   dev/ofw/ofw_bus_subr.c optionalaim
   dev/ofw/ofw_console.c  optionalaim
   dev/ofw/ofw_disk.c optionalofwd aim
-dev/ofw/ofwbus.c   optionalaim | fdt
+dev/ofw/ofwbus.c   optionalaim

ofwbus is used by Book-E too, not just AIM.  And 'aim' is not defined
for Book-E platforms.  Maybe it should be 'standard' instead?

- Justin


See the comment above this line (which isn't in the diff): ofwbus.c can also
be brought in by conf/files through the definition of options FDT. This
block is just a safety valve for (AIM && !FDT) to make sure we always get
it. We could also mark all of these standard; config is smart enough to
deduplicate things. Would you prefer that?
-Nathan


Just mark them standard, since they are really standard.

- Justin



Done in r330936.
-Nathan
___
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: r330936 - head/sys/conf

2018-03-14 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Wed Mar 14 18:07:40 2018
New Revision: 330936
URL: https://svnweb.freebsd.org/changeset/base/330936

Log:
  Fix fat-fingering ("optional standard") and move all the OF code to
  being marked "standard", which is less confusing than having it conditional
  on AIM CPUs here, and then picked up through options FDT from conf/files
  on Book-E.
  
  Request by:   jhibbits

Modified:
  head/sys/conf/files.powerpc

Modified: head/sys/conf/files.powerpc
==
--- head/sys/conf/files.powerpc Wed Mar 14 17:53:37 2018(r330935)
+++ head/sys/conf/files.powerpc Wed Mar 14 18:07:40 2018(r330936)
@@ -31,8 +31,6 @@ dev/adb/adb_if.m  optionaladb
 dev/adb/adb_buttons.c  optionaladb
 dev/agp/agp_apple.coptionalagp powermac
 dev/fb/fb.coptionalsc
-# ofwbus depends on simplebus.
-dev/fdt/simplebus.coptionalstandard
 dev/hwpmc/hwpmc_e500.c optionalhwpmc
 dev/hwpmc/hwpmc_mpc7xxx.c  optionalhwpmc
 dev/hwpmc/hwpmc_powerpc.c  optionalhwpmc
@@ -46,19 +44,21 @@ dev/iicbus/max6690.coptionalmax6690 
powermac
 dev/iicbus/ofw_iicbus.coptionaliicbus aim
 dev/nand/nfc_fsl.c optionalnand mpc85xx
 dev/nand/nfc_rb.c  optionalnand mpc85xx
-# ofw can be either aim or fdt: fdt case handled in files. aim only powerpc 
specific.
-dev/ofw/openfirm.c optionalaim
-dev/ofw/openfirmio.c   optionalaim
-dev/ofw/ofw_bus_if.m   optionalaim
-dev/ofw/ofw_cpu.c  optionalaim
-dev/ofw/ofw_if.m   optionalaim
-dev/ofw/ofw_bus_subr.c optionalaim
+# Most ofw stuff below is brought in by conf/files for options FDT, but
+# we always want it, even on non-FDT platforms.
+dev/fdt/simplebus.cstandard
+dev/ofw/openfirm.c standard
+dev/ofw/openfirmio.c   standard
+dev/ofw/ofw_bus_if.m   standard
+dev/ofw/ofw_cpu.c  standard
+dev/ofw/ofw_if.m   standard
+dev/ofw/ofw_bus_subr.c standard
 dev/ofw/ofw_console.c  optionalaim
 dev/ofw/ofw_disk.c optionalofwd aim
-dev/ofw/ofwbus.c   optionalaim
+dev/ofw/ofwbus.c   standard
 dev/ofw/ofwpci.c   optionalpci
 dev/ofw/ofw_standard.c optionalaim powerpc
-dev/ofw/ofw_subr.c optionalaim powerpc
+dev/ofw/ofw_subr.c standard
 dev/powermac_nvram/powermac_nvram.c optional   powermac_nvram powermac
 dev/quicc/quicc_bfe_fdt.c  optionalquicc mpc85xx
 dev/scc/scc_bfe_macio.coptionalscc powermac
___
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: r330930 - head/sys/conf

2018-03-14 Thread Justin Hibbits
On Wed, Mar 14, 2018 at 12:53 PM, Nathan Whitehorn
 wrote:
>
>
> On 03/14/18 09:19, Justin Hibbits wrote:
>>
>> On Wed, Mar 14, 2018 at 11:16 AM, Nathan Whitehorn
>>  wrote:
>>>
>>> Author: nwhitehorn
>>> Date: Wed Mar 14 16:16:25 2018
>>> New Revision: 330930
>>> URL: https://svnweb.freebsd.org/changeset/base/330930
>>>
>>> Log:
>>>The expression (aim | fdt) is always true on PowerPC. The last PowerPC
>>>platform that can run without a device tree (PS3) still uses the
>>> OF_*()
>>>functions to check if one exists and OF_* is used unconditionally in
>>>core parts of the system like powerpc/machdep.c. Reflect this reality
>>>in files.powerpc, for example by changing occurrences of aim | fdt to
>>>standard.
>>>
>>> Modified:
>>>head/sys/conf/files.powerpc
>>>
>>> Modified: head/sys/conf/files.powerpc
>>>
>>> ==
>>> --- head/sys/conf/files.powerpc Wed Mar 14 14:45:57 2018(r330929)
>>> +++ head/sys/conf/files.powerpc Wed Mar 14 16:16:25 2018(r330930)
>>> @@ -32,7 +32,7 @@ dev/adb/adb_buttons.c optionaladb
>>>   dev/agp/agp_apple.coptionalagp powermac
>>>   dev/fb/fb.coptionalsc
>>>   # ofwbus depends on simplebus.
>>> -dev/fdt/simplebus.coptionalaim | fdt
>>> +dev/fdt/simplebus.coptionalstandard
>>>   dev/hwpmc/hwpmc_e500.c optionalhwpmc
>>>   dev/hwpmc/hwpmc_mpc7xxx.c  optionalhwpmc
>>>   dev/hwpmc/hwpmc_powerpc.c  optionalhwpmc
>>> @@ -55,7 +55,7 @@ dev/ofw/ofw_if.m  optionalaim
>>>   dev/ofw/ofw_bus_subr.c optionalaim
>>>   dev/ofw/ofw_console.c  optionalaim
>>>   dev/ofw/ofw_disk.c optionalofwd aim
>>> -dev/ofw/ofwbus.c   optionalaim | fdt
>>> +dev/ofw/ofwbus.c   optionalaim
>>
>> ofwbus is used by Book-E too, not just AIM.  And 'aim' is not defined
>> for Book-E platforms.  Maybe it should be 'standard' instead?
>>
>> - Justin
>>
>
> See the comment above this line (which isn't in the diff): ofwbus.c can also
> be brought in by conf/files through the definition of options FDT. This
> block is just a safety valve for (AIM && !FDT) to make sure we always get
> it. We could also mark all of these standard; config is smart enough to
> deduplicate things. Would you prefer that?
> -Nathan
>

Just mark them standard, since they are really standard.

- 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: r330935 - in head/sys: cam cam/ata cam/nvme cam/scsi conf

2018-03-14 Thread Warner Losh
Author: imp
Date: Wed Mar 14 17:53:37 2018
New Revision: 330935
URL: https://svnweb.freebsd.org/changeset/base/330935

Log:
  Create a sysctl kern.cam.{,a,n}da.X.invalidate
  
  kern.cam.{,a,n}da.X.invalidate=1 forces *daX to detach by calling
  cam_periph_invalidate on the underlying periph. This is for testing
  purposes only. Include only with options CAM_TEST_FAILURE and rename
  the former [AN]DA_TEST_FAILURE, and fix nda to compile with it set.
  We're using it at work to harden geom and the buffer cache to be
  resilient in the face of drive failure. Today, it far too often
  results in a panic. While much work was done on SIM initiated removal
  for the USB thumnb drive removal work, little has been done for periph
  initiated removal. This simulates what *daerror() does for some errors
  nicely: we get the same panics with it that we do with failing drives.
  
  Sponsored by: Netflix
  Differential Revision: https://reviews.freebsd.org/D14581

Modified:
  head/sys/cam/ata/ata_da.c
  head/sys/cam/cam_periph.c
  head/sys/cam/cam_periph.h
  head/sys/cam/nvme/nvme_da.c
  head/sys/cam/scsi/scsi_da.c
  head/sys/conf/NOTES
  head/sys/conf/options

Modified: head/sys/cam/ata/ata_da.c
==
--- head/sys/cam/ata/ata_da.c   Wed Mar 14 16:45:04 2018(r330934)
+++ head/sys/cam/ata/ata_da.c   Wed Mar 14 17:53:37 2018(r330935)
@@ -238,7 +238,7 @@ struct ada_softc {
int  write_cache;
int  unmappedio;
int  rotating;
-#ifdef ADA_TEST_FAILURE
+#ifdef CAM_TEST_FAILURE
int  force_read_error;
int  force_write_error;
int  periodic_read_error;
@@ -1475,7 +1475,7 @@ adasysctlinit(void *context, int pending)
"max_seq_zones", CTLFLAG_RD, >max_seq_zones,
"Maximum Number of Open Sequential Write Required Zones");
 
-#ifdef ADA_TEST_FAILURE
+#ifdef CAM_TEST_FAILURE
/*
 * Add a 'door bell' sysctl which allows one to set it from userland
 * and cause something bad to happen.  For the moment, we only allow
@@ -1493,6 +1493,10 @@ adasysctlinit(void *context, int pending)
OID_AUTO, "periodic_read_error", CTLFLAG_RW | CTLFLAG_MPSAFE,
>periodic_read_error, 0,
"Force a read error every N reads (don't set too low).");
+   SYSCTL_ADD_PROC(>sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree),
+   OID_AUTO, "invalidate", CTLTYPE_U64 | CTLFLAG_RW | 
CTLFLAG_MPSAFE,
+   periph, 0, cam_periph_invalidate_sysctl, "I",
+   "Write 1 to invalidate the drive immediately");
 #endif
 
 #ifdef CAM_IO_STATS
@@ -2293,7 +2297,7 @@ adastart(struct cam_periph *periph, union ccb *start_c
data_ptr = bp;
}
 
-#ifdef ADA_TEST_FAILURE
+#ifdef CAM_TEST_FAILURE
int fail = 0;
 
/*

Modified: head/sys/cam/cam_periph.c
==
--- head/sys/cam/cam_periph.c   Wed Mar 14 16:45:04 2018(r330934)
+++ head/sys/cam/cam_periph.c   Wed Mar 14 17:53:37 2018(r330935)
@@ -2066,3 +2066,25 @@ cam_periph_devctl_notify(union ccb *ccb)
free(sbmsg, M_CAMPERIPH);
 }
 
+/*
+ * Sysctl to force an invalidation of the drive right now. Can be
+ * called with CTLFLAG_MPSAFE since we take periph lock.
+ */
+int
+cam_periph_invalidate_sysctl(SYSCTL_HANDLER_ARGS)
+{
+   struct cam_periph *periph;
+   int error, value;
+
+   periph = arg1;
+   value = 0;
+   error = sysctl_handle_int(oidp, , 0, req);
+   if (error != 0 || req->newptr == NULL || value != 1)
+   return (error);
+
+   cam_periph_lock(periph);
+   cam_periph_invalidate(periph);
+   cam_periph_unlock(periph);
+
+   return (0);
+}

Modified: head/sys/cam/cam_periph.h
==
--- head/sys/cam/cam_periph.h   Wed Mar 14 16:45:04 2018(r330934)
+++ head/sys/cam/cam_periph.h   Wed Mar 14 17:53:37 2018(r330935)
@@ -37,6 +37,7 @@
 #include 
 
 #ifdef _KERNEL
+#include 
 #include 
 
 #include 
@@ -198,6 +199,7 @@ voidcam_periph_freeze_after_event(struct 
cam_periph 
  u_int duration_ms);
 intcam_periph_error(union ccb *ccb, cam_flags camflags,
 u_int32_t sense_flags);
+intcam_periph_invalidate_sysctl(SYSCTL_HANDLER_ARGS);
 
 static __inline struct mtx *
 cam_periph_mtx(struct cam_periph *periph)

Modified: head/sys/cam/nvme/nvme_da.c
==
--- head/sys/cam/nvme/nvme_da.c Wed Mar 14 16:45:04 2018(r330934)
+++ head/sys/cam/nvme/nvme_da.c Wed Mar 14 17:53:37 2018(r330935)
@@ -112,6 +112,12 @@ struct nda_softc {
  

Re: svn commit: r330930 - head/sys/conf

2018-03-14 Thread Nathan Whitehorn



On 03/14/18 09:19, Justin Hibbits wrote:

On Wed, Mar 14, 2018 at 11:16 AM, Nathan Whitehorn
 wrote:

Author: nwhitehorn
Date: Wed Mar 14 16:16:25 2018
New Revision: 330930
URL: https://svnweb.freebsd.org/changeset/base/330930

Log:
   The expression (aim | fdt) is always true on PowerPC. The last PowerPC
   platform that can run without a device tree (PS3) still uses the OF_*()
   functions to check if one exists and OF_* is used unconditionally in
   core parts of the system like powerpc/machdep.c. Reflect this reality
   in files.powerpc, for example by changing occurrences of aim | fdt to
   standard.

Modified:
   head/sys/conf/files.powerpc

Modified: head/sys/conf/files.powerpc
==
--- head/sys/conf/files.powerpc Wed Mar 14 14:45:57 2018(r330929)
+++ head/sys/conf/files.powerpc Wed Mar 14 16:16:25 2018(r330930)
@@ -32,7 +32,7 @@ dev/adb/adb_buttons.c optionaladb
  dev/agp/agp_apple.coptionalagp powermac
  dev/fb/fb.coptionalsc
  # ofwbus depends on simplebus.
-dev/fdt/simplebus.coptionalaim | fdt
+dev/fdt/simplebus.coptionalstandard
  dev/hwpmc/hwpmc_e500.c optionalhwpmc
  dev/hwpmc/hwpmc_mpc7xxx.c  optionalhwpmc
  dev/hwpmc/hwpmc_powerpc.c  optionalhwpmc
@@ -55,7 +55,7 @@ dev/ofw/ofw_if.m  optionalaim
  dev/ofw/ofw_bus_subr.c optionalaim
  dev/ofw/ofw_console.c  optionalaim
  dev/ofw/ofw_disk.c optionalofwd aim
-dev/ofw/ofwbus.c   optionalaim | fdt
+dev/ofw/ofwbus.c   optionalaim

ofwbus is used by Book-E too, not just AIM.  And 'aim' is not defined
for Book-E platforms.  Maybe it should be 'standard' instead?

- Justin



See the comment above this line (which isn't in the diff): ofwbus.c can 
also be brought in by conf/files through the definition of options FDT. 
This block is just a safety valve for (AIM && !FDT) to make sure we 
always get it. We could also mark all of these standard; config is smart 
enough to deduplicate things. Would you prefer that?

-Nathan
___
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: r330884 - in head/sys: dev/cxgbe dev/cxgbe/firmware dev/cxgbe/tom modules/cxgbe/tom

2018-03-14 Thread John Baldwin
On Tuesday, March 13, 2018 11:05:51 PM John Baldwin wrote:
> Author: jhb
> Date: Tue Mar 13 23:05:51 2018
> New Revision: 330884
> URL: https://svnweb.freebsd.org/changeset/base/330884
> 
> Log:
>   Support for TLS offload of TOE connections on T6 adapters.
>   
>   The TOE engine in Chelsio T6 adapters supports offloading of TLS
>   encryption and TCP segmentation for offloaded connections.  Sockets
>   using TLS are required to use a set of custom socket options to upload
>   RX and TX keys to the NIC and to enable RX processing.  Currently
>   these socket options are implemented as TCP options in the vendor
>   specific range.  A patched OpenSSL library will be made available in a
>   port / package for use with the TLS TOE support.

Note that making use of this requires a patched SSL library.  There is not
yet a port for one, but I'm working with brnrd@ to make a package of a
patched OpenSSL.

-- 
John Baldwin
___
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: r330932 - in head/sys: cam/nvme dev/nvme

2018-03-14 Thread Warner Losh
On Wed, Mar 14, 2018 at 11:08 AM, Ravi Pokala  wrote:

> Hi Warner,
>
> The TRIM command takes a buffer of range structures, and this change
> consolidates multiple range structures into the buffer for a single TRIM
> command, correct? Whereas the old functionality was to populate the buffer
> with a single range structure?
>
> So if we wanted to trim ranges [P..T], [A..E], [K..O], the old
> functionality would be:
>
> TRIM:[P..T] ; TRIM:[A..E] ; TRIM:[K..O]
>
> The new functionality would be:
>
> TRIM:[P..T], [A..E], [K..O]
>
> Right?


Correct. This helps a lot, at least for the drives I have access to. I'm
working on adaptive features to allow us to know when it will help.

> + /* XXX -- Could collapse adjacent ranges,
> but we don't for now */
> > + /* XXX -- Could limit based on total
> payload size */
>
> And that future enhancement would make it:
>
> TRIM:[A..E], [K..T]
>


> Is that correct?
>

Yes. That's right. This code doesn't do that now. We also need to work on
read biasing and a few other things as well, independent of what we send
down to the driver. That's the scheduling bits. Some of the dynamic stuff
will be only in the dynamic scheduler, but we need to not do trims first. I
think that a strategy of collecting N BIO_DELETEs before we send down the
DSM TRIM to the drive rather than sending them down asap would be useful
(with some reasonable timeout so things don't get stuck for too long).
Collecting TRIMs don't hang anything in the system, except reclaiming
blocks on delete, as far as I can tell...  I accidentally queued 10M trims
and didn't drain them for 8 hours w/o anybody but the graphs for the
machine that report queue length noticing...

Warner


> Thanks,
>
> Ravi (rpokala@)
>
> -Original Message-
> From:  on behalf of Warner Losh
> 
> Date: 2018-03-14, Wednesday at 09:44
> To: , , <
> svn-src-h...@freebsd.org>
> Subject: svn commit: r330932 - in head/sys: cam/nvme dev/nvme
>
> > Author: imp
> > Date: Wed Mar 14 16:44:50 2018
> > New Revision: 330932
> > URL: https://svnweb.freebsd.org/changeset/base/330932
> >
> > Log:
> >   Implement trim collapsing in nda
> >
> >   When multiple trims are in the queue, collapse them as much as
> >   possible. At present, this usually results in only a few trims being
> >   collapsed together, but more work on that will make it possible to do
> >   hundreds (up to some configurable max).
> >
> >   Sponsored by: Netflix
>
>
>
>
___
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: r330932 - in head/sys: cam/nvme dev/nvme

2018-03-14 Thread Ravi Pokala
Hi Warner,

The TRIM command takes a buffer of range structures, and this change 
consolidates multiple range structures into the buffer for a single TRIM 
command, correct? Whereas the old functionality was to populate the buffer with 
a single range structure?

So if we wanted to trim ranges [P..T], [A..E], [K..O], the old functionality 
would be:

TRIM:[P..T] ; TRIM:[A..E] ; TRIM:[K..O]

The new functionality would be:

TRIM:[P..T], [A..E], [K..O]

Right?

> + /* XXX -- Could collapse adjacent ranges, but 
> we don't for now */
> + /* XXX -- Could limit based on total payload 
> size */

And that future enhancement would make it:

TRIM:[A..E], [K..T]

Is that correct?

Thanks,

Ravi (rpokala@)

-Original Message-
From:  on behalf of Warner Losh 

Date: 2018-03-14, Wednesday at 09:44
To: , , 

Subject: svn commit: r330932 - in head/sys: cam/nvme dev/nvme

> Author: imp
> Date: Wed Mar 14 16:44:50 2018
> New Revision: 330932
> URL: https://svnweb.freebsd.org/changeset/base/330932
> 
> Log:
>   Implement trim collapsing in nda
>   
>   When multiple trims are in the queue, collapse them as much as
>   possible. At present, this usually results in only a few trims being
>   collapsed together, but more work on that will make it possible to do
>   hundreds (up to some configurable max).
>   
>   Sponsored by: Netflix



___
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: r330934 - head/sys/modules/cam

2018-03-14 Thread Warner Losh
Author: imp
Date: Wed Mar 14 16:45:04 2018
New Revision: 330934
URL: https://svnweb.freebsd.org/changeset/base/330934

Log:
  This should have been += so clean builds work.
  
  Noticed by: hps@

Modified:
  head/sys/modules/cam/Makefile

Modified: head/sys/modules/cam/Makefile
==
--- head/sys/modules/cam/Makefile   Wed Mar 14 16:44:57 2018
(r330933)
+++ head/sys/modules/cam/Makefile   Wed Mar 14 16:45:04 2018
(r330934)
@@ -8,7 +8,7 @@ KMOD=   cam
 
 # See sys/conf/options for the flags that go into the different opt_*.h files.
 SRCS=  opt_cam.h
-SRCS=  opt_compat.h
+SRCS+= opt_compat.h
 SRCS+= opt_ada.h
 SRCS+= opt_scsi.h
 SRCS+= opt_cd.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: r330932 - in head/sys: cam/nvme dev/nvme

2018-03-14 Thread Warner Losh
Author: imp
Date: Wed Mar 14 16:44:50 2018
New Revision: 330932
URL: https://svnweb.freebsd.org/changeset/base/330932

Log:
  Implement trim collapsing in nda
  
  When multiple trims are in the queue, collapse them as much as
  possible. At present, this usually results in only a few trims being
  collapsed together, but more work on that will make it possible to do
  hundreds (up to some configurable max).
  
  Sponsored by: Netflix

Modified:
  head/sys/cam/nvme/nvme_da.c
  head/sys/dev/nvme/nvme.h

Modified: head/sys/cam/nvme/nvme_da.c
==
--- head/sys/cam/nvme/nvme_da.c Wed Mar 14 16:44:16 2018(r330931)
+++ head/sys/cam/nvme/nvme_da.c Wed Mar 14 16:44:50 2018(r330932)
@@ -93,12 +93,10 @@ typedef enum {
 } nda_ccb_state;
 
 /* Offsets into our private area for storing information */
-#define ccb_state  ppriv_field0
-#define ccb_bp ppriv_ptr1
+#define ccb_state  ccb_h.ppriv_field0
+#define ccb_bp ccb_h.ppriv_ptr1/* For NDA_CCB_BUFFER_IO */
+#define ccb_trim   ccb_h.ppriv_ptr1/* For NDA_CCB_TRIM */
 
-struct trim_request {
-   TAILQ_HEAD(, bio) bps;
-};
 struct nda_softc {
struct   cam_iosched_softc *cam_iosched;
int outstanding_cmds;   /* Number of active 
commands */
@@ -107,12 +105,13 @@ struct nda_softc {
nda_flags   flags;
nda_quirks  quirks;
int unmappedio;
+   quad_t  deletes;
+   quad_t  dsm_req;
uint32_tnsid;   /* Namespace ID for 
this nda device */
struct disk *disk;
struct task sysctl_task;
struct sysctl_ctx_list  sysctl_ctx;
struct sysctl_oid   *sysctl_tree;
-   struct trim_request trim_req;
 #ifdef CAM_IO_STATS
struct sysctl_ctx_list  sysctl_stats_ctx;
struct sysctl_oid   *sysctl_stats_tree;
@@ -122,6 +121,14 @@ struct nda_softc {
 #endif
 };
 
+struct nda_trim_request {
+   union {
+   struct nvme_dsm_range dsm;
+   uint8_t data[NVME_MAX_DSM_TRIM];
+   };
+   TAILQ_HEAD(, bio) bps;
+};
+
 /* Need quirk table */
 
 static disk_strategy_t ndastrategy;
@@ -150,11 +157,14 @@ static void   ndasuspend(void *arg);
 #ifndefNDA_DEFAULT_RETRY
 #defineNDA_DEFAULT_RETRY   4
 #endif
+#ifndef NDA_MAX_TRIM_ENTRIES
+#define NDA_MAX_TRIM_ENTRIES 256   /* Number of DSM trims to use, max 256 
*/
+#endif
 
-
 //static int nda_retry_count = NDA_DEFAULT_RETRY;
 static int nda_send_ordered = NDA_DEFAULT_SEND_ORDERED;
 static int nda_default_timeout = NDA_DEFAULT_TIMEOUT;
+static int nda_max_trim_entries = NDA_MAX_TRIM_ENTRIES;
 
 /*
  * All NVMe media is non-rotational, so all nvme device instances
@@ -361,6 +371,9 @@ ndastrategy(struct bio *bp)
return;
}

+   if (bp->bio_cmd == BIO_DELETE)
+   softc->deletes++;
+
/*
 * Place it in the queue of disk activities for this disk
 */
@@ -401,7 +414,7 @@ ndadump(void *arg, void *virtual, vm_offset_t physical
memset(, 0, sizeof(nvmeio));
if (length > 0) {
xpt_setup_ccb(_h, periph->path, CAM_PRIORITY_NORMAL);
-   nvmeio.ccb_h.ccb_state = NDA_CCB_DUMP;
+   nvmeio.ccb_state = NDA_CCB_DUMP;
nda_nvme_write(softc, , virtual, lba, length, count);
error = cam_periph_runccb((union ccb *), 
cam_periph_error,
0, SF_NO_RECOVERY | SF_NO_RETRY, NULL);
@@ -414,7 +427,7 @@ ndadump(void *arg, void *virtual, vm_offset_t physical
/* Flush */
xpt_setup_ccb(_h, periph->path, CAM_PRIORITY_NORMAL);
 
-   nvmeio.ccb_h.ccb_state = NDA_CCB_DUMP;
+   nvmeio.ccb_state = NDA_CCB_DUMP;
nda_nvme_flush(softc, );
error = cam_periph_runccb((union ccb *), cam_periph_error,
0, SF_NO_RECOVERY | SF_NO_RETRY, NULL);
@@ -610,6 +623,14 @@ ndasysctlinit(void *context, int pending)
OID_AUTO, "unmapped_io", CTLFLAG_RD | CTLFLAG_MPSAFE,
>unmappedio, 0, "Unmapped I/O leaf");
 
+   SYSCTL_ADD_QUAD(>sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree),
+   OID_AUTO, "deletes", CTLFLAG_RD | CTLFLAG_MPSAFE,
+   >deletes, "Number of BIO_DELETE requests");
+
+   SYSCTL_ADD_QUAD(>sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree),
+   OID_AUTO, "dsm_req", CTLFLAG_RD | CTLFLAG_MPSAFE,
+   >dsm_req, "Number of DSM requests sent to SIM");
+
SYSCTL_ADD_INT(>sysctl_ctx,
   SYSCTL_CHILDREN(softc->sysctl_tree),
   OID_AUTO,
@@ -902,24 +923,42 @@ ndastart(struct cam_periph *periph, union ccb *start_c
}
case BIO_DELETE:
{
-  

svn commit: r330931 - head/sys/cam

2018-03-14 Thread Warner Losh
Author: imp
Date: Wed Mar 14 16:44:16 2018
New Revision: 330931
URL: https://svnweb.freebsd.org/changeset/base/330931

Log:
  Allow NULL ccb to cam_iosched_bio_complete
  
  When the ccb is NULL to cam_iosched_bio_complete, just update the
  other statistics, but not the time. If many operations are collapsed
  together, this is needed to keep stats properly for the grouped bp.
  This should fix trim accounting.
  
  Sponsored by: Netflix

Modified:
  head/sys/cam/cam_iosched.c

Modified: head/sys/cam/cam_iosched.c
==
--- head/sys/cam/cam_iosched.c  Wed Mar 14 16:16:25 2018(r330930)
+++ head/sys/cam/cam_iosched.c  Wed Mar 14 16:44:16 2018(r330931)
@@ -1493,7 +1493,7 @@ cam_iosched_bio_complete(struct cam_iosched_softc *isc
printf("Completing command with bio_cmd == %#x\n", 
bp->bio_cmd);
}
 
-   if (!(bp->bio_flags & BIO_ERROR))
+   if (!(bp->bio_flags & BIO_ERROR) && done_ccb != NULL)
cam_iosched_io_metric_update(isc,
cam_iosched_sbintime_t(done_ccb->ccb_h.qos.periph_data),
bp->bio_cmd, bp->bio_bcount);
___
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: r330933 - head/sys/cam

2018-03-14 Thread Warner Losh
Author: imp
Date: Wed Mar 14 16:44:57 2018
New Revision: 330933
URL: https://svnweb.freebsd.org/changeset/base/330933

Log:
  Fix inverted logic that counted all completions as errors, except when
  they were actual errors.
  
  Sponsored by: Netflix

Modified:
  head/sys/cam/cam_iosched.c

Modified: head/sys/cam/cam_iosched.c
==
--- head/sys/cam/cam_iosched.c  Wed Mar 14 16:44:50 2018(r330932)
+++ head/sys/cam/cam_iosched.c  Wed Mar 14 16:44:57 2018(r330933)
@@ -1473,18 +1473,18 @@ cam_iosched_bio_complete(struct cam_iosched_softc *isc
printf("done: %p %#x\n", bp, bp->bio_cmd);
if (bp->bio_cmd == BIO_WRITE) {
retval = cam_iosched_limiter_iodone(>write_stats, bp);
-   if (!(bp->bio_flags & BIO_ERROR))
+   if ((bp->bio_flags & BIO_ERROR) != 0)
isc->write_stats.errs++;
isc->write_stats.out++;
isc->write_stats.pending--;
} else if (bp->bio_cmd == BIO_READ) {
retval = cam_iosched_limiter_iodone(>read_stats, bp);
-   if (!(bp->bio_flags & BIO_ERROR))
+   if ((bp->bio_flags & BIO_ERROR) != 0)
isc->read_stats.errs++;
isc->read_stats.out++;
isc->read_stats.pending--;
} else if (bp->bio_cmd == BIO_DELETE) {
-   if (!(bp->bio_flags & BIO_ERROR))
+   if ((bp->bio_flags & BIO_ERROR) != 0)
isc->trim_stats.errs++;
isc->trim_stats.out++;
isc->trim_stats.pending--;
___
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: r330885 - head/sys/modules/cam

2018-03-14 Thread Warner Losh
On Wed, Mar 14, 2018 at 10:14 AM, Hans Petter Selasky 
wrote:

> On 03/14/18 00:36, Warner Losh wrote:
>
>> Author: imp
>> Date: Tue Mar 13 23:36:15 2018
>> New Revision: 330885
>> URL: https://svnweb.freebsd.org/changeset/base/330885
>>
>> Log:
>>We need opt_compat.h after r330819 and 330820.
>>   Add opt_compat.h to fix the stand-alone build case.
>>   Sponsored by: Netflix.
>>
>> Modified:
>>head/sys/modules/cam/Makefile
>>
>> Modified: head/sys/modules/cam/Makefile
>> 
>> ==
>> --- head/sys/modules/cam/Makefile   Tue Mar 13 23:05:51 2018
>> (r330884)
>> +++ head/sys/modules/cam/Makefile   Tue Mar 13 23:36:15 2018
>> (r330885)
>> @@ -8,6 +8,7 @@ KMOD=   cam
>> # See sys/conf/options for the flags that go into the different
>> opt_*.h files.
>>   SRCS= opt_cam.h
>> +SRCS=  opt_compat.h
>>   SRCS+=opt_ada.h
>>   SRCS+=opt_scsi.h
>>   SRCS+=opt_cd.h
>>
>>
>>
> Hi,
>
> Should this be SRCS+= ?


Yes. I had an unclean build and it worked. Good eye.

Wanrer
___
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: r330930 - head/sys/conf

2018-03-14 Thread Rodney W. Grimes
> Author: nwhitehorn
> Date: Wed Mar 14 16:16:25 2018
> New Revision: 330930
> URL: https://svnweb.freebsd.org/changeset/base/330930
> 
> Log:
>   The expression (aim | fdt) is always true on PowerPC. The last PowerPC
>   platform that can run without a device tree (PS3) still uses the OF_*()
>   functions to check if one exists and OF_* is used unconditionally in
>   core parts of the system like powerpc/machdep.c. Reflect this reality
>   in files.powerpc, for example by changing occurrences of aim | fdt to
>   standard.
> 
> Modified:
>   head/sys/conf/files.powerpc
> 
> Modified: head/sys/conf/files.powerpc
> ==
> --- head/sys/conf/files.powerpc   Wed Mar 14 14:45:57 2018
> (r330929)
> +++ head/sys/conf/files.powerpc   Wed Mar 14 16:16:25 2018
> (r330930)
> @@ -32,7 +32,7 @@ dev/adb/adb_buttons.c   optionaladb
>  dev/agp/agp_apple.c  optionalagp powermac
>  dev/fb/fb.c  optionalsc
>  # ofwbus depends on simplebus.
> -dev/fdt/simplebus.c  optionalaim | fdt
> +dev/fdt/simplebus.c  optionalstandard

optionaly standard?  

>  dev/hwpmc/hwpmc_e500.c   optionalhwpmc
>  dev/hwpmc/hwpmc_mpc7xxx.coptionalhwpmc
>  dev/hwpmc/hwpmc_powerpc.coptionalhwpmc
> @@ -55,7 +55,7 @@ dev/ofw/ofw_if.moptionalaim
>  dev/ofw/ofw_bus_subr.c   optionalaim
>  dev/ofw/ofw_console.coptionalaim
>  dev/ofw/ofw_disk.c   optionalofwd aim
> -dev/ofw/ofwbus.c optionalaim | fdt
> +dev/ofw/ofwbus.c optionalaim
>  dev/ofw/ofwpci.c optionalpci
>  dev/ofw/ofw_standard.c   optionalaim powerpc
>  dev/ofw/ofw_subr.c   optionalaim powerpc
> @@ -74,7 +74,7 @@ dev/syscons/scgfbrndr.c optionalsc
>  dev/syscons/scterm-teken.c   optionalsc
>  dev/syscons/scvtb.c  optionalsc
>  dev/tsec/if_tsec.c   optionaltsec
> -dev/tsec/if_tsec_fdt.c   optionaltsec fdt
> +dev/tsec/if_tsec_fdt.c   optionaltsec 
>  dev/uart/uart_cpu_powerpc.c  optionaluart
>  dev/usb/controller/ehci_fsl.coptionalehci mpc85xx
>  dev/vt/hw/ofwfb/ofwfb.c  optionalvt aim
> @@ -136,12 +136,12 @@ powerpc/mambo/mambo_disk.c  optionalmambo
>  powerpc/mikrotik/platform_rb.c   optionalmikrotik
>  powerpc/mikrotik/rb_led.coptionalmikrotik
>  powerpc/mpc85xx/atpic.c  optionalmpc85xx isa
> -powerpc/mpc85xx/ds1553_bus_fdt.c optionalds1553 fdt
> +powerpc/mpc85xx/ds1553_bus_fdt.c optionalds1553
>  powerpc/mpc85xx/ds1553_core.coptionalds1553
>  powerpc/mpc85xx/fsl_diu.coptionalmpc85xx diu
>  powerpc/mpc85xx/fsl_espi.c   optionalmpc85xx spibus
>  powerpc/mpc85xx/fsl_sata.c   optionalmpc85xx ata
> -powerpc/mpc85xx/i2c.coptionaliicbus fdt
> +powerpc/mpc85xx/i2c.coptionaliicbus
>  powerpc/mpc85xx/isa.coptionalmpc85xx isa
>  powerpc/mpc85xx/lbc.coptionalmpc85xx
>  powerpc/mpc85xx/mpc85xx.coptionalmpc85xx
> @@ -158,7 +158,7 @@ powerpc/ofw/ofw_real.coptionalaim
>  powerpc/ofw/ofw_syscons.coptionalsc aim
>  powerpc/ofw/ofwcall32.S  optionalaim powerpc
>  powerpc/ofw/ofwcall64.S  optionalaim powerpc64
> -powerpc/ofw/openpic_ofw.coptionalaim | fdt
> +powerpc/ofw/openpic_ofw.coptionalstandard

And here too

>  powerpc/ofw/rtas.c   optionalaim
>  powerpc/powermac/ata_kauai.c optionalpowermac ata | powermac atamacio
>  powerpc/powermac/ata_macio.c optionalpowermac ata | powermac atamacio
> 
> 

-- 
Rod Grimes rgri...@freebsd.org
___
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: r330930 - head/sys/conf

2018-03-14 Thread Justin Hibbits
On Wed, Mar 14, 2018 at 11:16 AM, Nathan Whitehorn
 wrote:
> Author: nwhitehorn
> Date: Wed Mar 14 16:16:25 2018
> New Revision: 330930
> URL: https://svnweb.freebsd.org/changeset/base/330930
>
> Log:
>   The expression (aim | fdt) is always true on PowerPC. The last PowerPC
>   platform that can run without a device tree (PS3) still uses the OF_*()
>   functions to check if one exists and OF_* is used unconditionally in
>   core parts of the system like powerpc/machdep.c. Reflect this reality
>   in files.powerpc, for example by changing occurrences of aim | fdt to
>   standard.
>
> Modified:
>   head/sys/conf/files.powerpc
>
> Modified: head/sys/conf/files.powerpc
> ==
> --- head/sys/conf/files.powerpc Wed Mar 14 14:45:57 2018(r330929)
> +++ head/sys/conf/files.powerpc Wed Mar 14 16:16:25 2018(r330930)
> @@ -32,7 +32,7 @@ dev/adb/adb_buttons.c optionaladb
>  dev/agp/agp_apple.coptionalagp powermac
>  dev/fb/fb.coptionalsc
>  # ofwbus depends on simplebus.
> -dev/fdt/simplebus.coptionalaim | fdt
> +dev/fdt/simplebus.coptionalstandard
>  dev/hwpmc/hwpmc_e500.c optionalhwpmc
>  dev/hwpmc/hwpmc_mpc7xxx.c  optionalhwpmc
>  dev/hwpmc/hwpmc_powerpc.c  optionalhwpmc
> @@ -55,7 +55,7 @@ dev/ofw/ofw_if.m  optionalaim
>  dev/ofw/ofw_bus_subr.c optionalaim
>  dev/ofw/ofw_console.c  optionalaim
>  dev/ofw/ofw_disk.c optionalofwd aim
> -dev/ofw/ofwbus.c   optionalaim | fdt
> +dev/ofw/ofwbus.c   optionalaim

ofwbus is used by Book-E too, not just AIM.  And 'aim' is not defined
for Book-E platforms.  Maybe it should be 'standard' instead?

- 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: r330930 - head/sys/conf

2018-03-14 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Wed Mar 14 16:16:25 2018
New Revision: 330930
URL: https://svnweb.freebsd.org/changeset/base/330930

Log:
  The expression (aim | fdt) is always true on PowerPC. The last PowerPC
  platform that can run without a device tree (PS3) still uses the OF_*()
  functions to check if one exists and OF_* is used unconditionally in
  core parts of the system like powerpc/machdep.c. Reflect this reality
  in files.powerpc, for example by changing occurrences of aim | fdt to
  standard.

Modified:
  head/sys/conf/files.powerpc

Modified: head/sys/conf/files.powerpc
==
--- head/sys/conf/files.powerpc Wed Mar 14 14:45:57 2018(r330929)
+++ head/sys/conf/files.powerpc Wed Mar 14 16:16:25 2018(r330930)
@@ -32,7 +32,7 @@ dev/adb/adb_buttons.c optionaladb
 dev/agp/agp_apple.coptionalagp powermac
 dev/fb/fb.coptionalsc
 # ofwbus depends on simplebus.
-dev/fdt/simplebus.coptionalaim | fdt
+dev/fdt/simplebus.coptionalstandard
 dev/hwpmc/hwpmc_e500.c optionalhwpmc
 dev/hwpmc/hwpmc_mpc7xxx.c  optionalhwpmc
 dev/hwpmc/hwpmc_powerpc.c  optionalhwpmc
@@ -55,7 +55,7 @@ dev/ofw/ofw_if.m  optionalaim
 dev/ofw/ofw_bus_subr.c optionalaim
 dev/ofw/ofw_console.c  optionalaim
 dev/ofw/ofw_disk.c optionalofwd aim
-dev/ofw/ofwbus.c   optionalaim | fdt
+dev/ofw/ofwbus.c   optionalaim
 dev/ofw/ofwpci.c   optionalpci
 dev/ofw/ofw_standard.c optionalaim powerpc
 dev/ofw/ofw_subr.c optionalaim powerpc
@@ -74,7 +74,7 @@ dev/syscons/scgfbrndr.c   optionalsc
 dev/syscons/scterm-teken.c optionalsc
 dev/syscons/scvtb.coptionalsc
 dev/tsec/if_tsec.c optionaltsec
-dev/tsec/if_tsec_fdt.c optionaltsec fdt
+dev/tsec/if_tsec_fdt.c optionaltsec 
 dev/uart/uart_cpu_powerpc.coptionaluart
 dev/usb/controller/ehci_fsl.c  optionalehci mpc85xx
 dev/vt/hw/ofwfb/ofwfb.coptionalvt aim
@@ -136,12 +136,12 @@ powerpc/mambo/mambo_disk.coptionalmambo
 powerpc/mikrotik/platform_rb.c optionalmikrotik
 powerpc/mikrotik/rb_led.c  optionalmikrotik
 powerpc/mpc85xx/atpic.coptionalmpc85xx isa
-powerpc/mpc85xx/ds1553_bus_fdt.c   optionalds1553 fdt
+powerpc/mpc85xx/ds1553_bus_fdt.c   optionalds1553
 powerpc/mpc85xx/ds1553_core.c  optionalds1553
 powerpc/mpc85xx/fsl_diu.c  optionalmpc85xx diu
 powerpc/mpc85xx/fsl_espi.c optionalmpc85xx spibus
 powerpc/mpc85xx/fsl_sata.c optionalmpc85xx ata
-powerpc/mpc85xx/i2c.c  optionaliicbus fdt
+powerpc/mpc85xx/i2c.c  optionaliicbus
 powerpc/mpc85xx/isa.c  optionalmpc85xx isa
 powerpc/mpc85xx/lbc.c  optionalmpc85xx
 powerpc/mpc85xx/mpc85xx.c  optionalmpc85xx
@@ -158,7 +158,7 @@ powerpc/ofw/ofw_real.c  optionalaim
 powerpc/ofw/ofw_syscons.c  optionalsc aim
 powerpc/ofw/ofwcall32.Soptionalaim powerpc
 powerpc/ofw/ofwcall64.Soptionalaim powerpc64
-powerpc/ofw/openpic_ofw.c  optionalaim | fdt
+powerpc/ofw/openpic_ofw.c  optionalstandard
 powerpc/ofw/rtas.c optionalaim
 powerpc/powermac/ata_kauai.c   optionalpowermac ata | powermac atamacio
 powerpc/powermac/ata_macio.c   optionalpowermac ata | powermac atamacio
___
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: r330885 - head/sys/modules/cam

2018-03-14 Thread Hans Petter Selasky

On 03/14/18 00:36, Warner Losh wrote:

Author: imp
Date: Tue Mar 13 23:36:15 2018
New Revision: 330885
URL: https://svnweb.freebsd.org/changeset/base/330885

Log:
   We need opt_compat.h after r330819 and 330820.
   
   Add opt_compat.h to fix the stand-alone build case.
   
   Sponsored by: Netflix.


Modified:
   head/sys/modules/cam/Makefile

Modified: head/sys/modules/cam/Makefile
==
--- head/sys/modules/cam/Makefile   Tue Mar 13 23:05:51 2018
(r330884)
+++ head/sys/modules/cam/Makefile   Tue Mar 13 23:36:15 2018
(r330885)
@@ -8,6 +8,7 @@ KMOD=   cam
  
  # See sys/conf/options for the flags that go into the different opt_*.h files.

  SRCS= opt_cam.h
+SRCS=  opt_compat.h
  SRCS+=opt_ada.h
  SRCS+=opt_scsi.h
  SRCS+=opt_cd.h




Hi,

Should this be SRCS+= ?

--HPS
___
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: r330925 - in head/sys: conf powerpc/powernv

2018-03-14 Thread Nathan Whitehorn



On 03/14/18 02:20, Wojciech Macek wrote:

Author: wma
Date: Wed Mar 14 09:20:03 2018
New Revision: 330925
URL: https://svnweb.freebsd.org/changeset/base/330925

Log:
   PowerNV: Fix I2C to compile if FDT is disabled
   
   Submitted by:  Wojciech Macek 

   Obtained from: Semihalf
   Sponsored by:  IBM, QCM Technologies


I don't think this makes any sense, for several reasons:
1. You are gating on #ifdef FDT for things that are using the OF_* API 
and aren't actually FDT-specific, so the #ifdef checks are testing the 
wrong thing.
2. It isn't possible to even build a PowerPC/AIM kernel, like PowerNV, 
without the Open Firmware support code that this uses, so there is no 
circumstance in which this helps anything.
3. The PowerNV platform is non-functional without a device tree 
intrinsically, so, even if you could build a kernel like this somehow, 
it would be impossible for it to work.


Given all of that, why was this necessary? It seems to just add 
pointless #ifdef to code that does not need it.

-Nathan



Modified:
   head/sys/conf/files.powerpc
   head/sys/powerpc/powernv/opal_i2c.c
   head/sys/powerpc/powernv/opal_i2cm.c
   head/sys/powerpc/powernv/powernv_centaur.c
   head/sys/powerpc/powernv/powernv_xscom.c

Modified: head/sys/conf/files.powerpc
==
--- head/sys/conf/files.powerpc Wed Mar 14 08:48:40 2018(r330924)
+++ head/sys/conf/files.powerpc Wed Mar 14 09:20:03 2018(r330925)
@@ -186,8 +186,8 @@ powerpc/powermac/vcoregpio.coptionalpowermac
  powerpc/powernv/opal.coptionalpowernv
  powerpc/powernv/opal_console.coptionalpowernv
  powerpc/powernv/opal_dev.coptionalpowernv
-powerpc/powernv/opal_i2c.c optionaliicbus fdt powernv
-powerpc/powernv/opal_i2cm.coptionaliicbus fdt powernv
+powerpc/powernv/opal_i2c.c optionaliicbus powernv
+powerpc/powernv/opal_i2cm.coptionaliicbus powernv
  powerpc/powernv/opal_pci.coptionalpowernv pci
  powerpc/powernv/opalcall.Soptionalpowernv
  powerpc/powernv/platform_powernv.c optional   powernv

Modified: head/sys/powerpc/powernv/opal_i2c.c
==
--- head/sys/powerpc/powernv/opal_i2c.c Wed Mar 14 08:48:40 2018
(r330924)
+++ head/sys/powerpc/powernv/opal_i2c.c Wed Mar 14 09:20:03 2018
(r330925)
@@ -120,7 +120,9 @@ static int
  opal_i2c_probe(device_t dev)
  {
  
+#ifdef FDT

if (!(ofw_bus_is_compatible(dev, "ibm,opal-i2c")))
+#endif
return (ENXIO);
  
  	device_set_desc(dev, "opal-i2c");

@@ -131,6 +133,7 @@ opal_i2c_probe(device_t dev)
  static int
  opal_i2c_attach(device_t dev)
  {
+#ifdef FDT
struct opal_i2c_softc *sc;
int len;
  
@@ -150,6 +153,9 @@ opal_i2c_attach(device_t dev)

I2C_LOCK_INIT(sc);
  
  	return (bus_generic_attach(dev));

+#else
+   return (ENXIO);
+#endif
  }
  
  static int


Modified: head/sys/powerpc/powernv/opal_i2cm.c
==
--- head/sys/powerpc/powernv/opal_i2cm.cWed Mar 14 08:48:40 2018
(r330924)
+++ head/sys/powerpc/powernv/opal_i2cm.cWed Mar 14 09:20:03 2018
(r330925)
@@ -57,14 +57,17 @@ struct opal_i2cm_softc
  
  static int opal_i2cm_attach(device_t);

  static int opal_i2cm_probe(device_t);
+#ifdef FDT
  static const struct ofw_bus_devinfo *
  opal_i2cm_get_devinfo(device_t, device_t);
+#endif
  
  static device_method_t opal_i2cm_methods[] = {

/* Device interface */
DEVMETHOD(device_probe, opal_i2cm_probe),
DEVMETHOD(device_attach,opal_i2cm_attach),
  
+#ifdef FDT

/* ofw_bus interface */
DEVMETHOD(ofw_bus_get_devinfo,  opal_i2cm_get_devinfo),
DEVMETHOD(ofw_bus_get_compat,   ofw_bus_gen_get_compat),
@@ -72,6 +75,7 @@ static device_method_t opal_i2cm_methods[] = {
DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name),
DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node),
DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type),
+#endif
  
  	DEVMETHOD_END

  };
@@ -82,8 +86,10 @@ static int
  opal_i2cm_probe(device_t dev)
  {
  
+#ifdef FDT

if (!(ofw_bus_is_compatible(dev, "ibm,centaur-i2cm") ||
ofw_bus_is_compatible(dev, "ibm,power8-i2cm")))
+#endif
return (ENXIO);
  
  	device_set_desc(dev, "centaur-i2cm");

@@ -93,6 +99,7 @@ opal_i2cm_probe(device_t dev)
  static int
  opal_i2cm_attach(device_t dev)
  {
+#ifdef FDT
phandle_t child;
device_t cdev;
struct ofw_bus_devinfo *dinfo;
@@ -116,13 +123,18 @@ opal_i2cm_attach(device_t dev)
}
  
  	return (bus_generic_attach(dev));

+#else
+   return (ENXIO);
+#endif
  }
  
+#ifdef FDT

  static const struct 

Re: svn commit: r330925 - in head/sys: conf powerpc/powernv

2018-03-14 Thread Nathan Whitehorn



On 03/14/18 07:21, Ian Lepore wrote:

On Wed, 2018-03-14 at 09:20 +, Wojciech Macek wrote:

Author: wma
Date: Wed Mar 14 09:20:03 2018
New Revision: 330925
URL: https://svnweb.freebsd.org/changeset/base/330925

Log:
   PowerNV: Fix I2C to compile if FDT is disabled
   
   Submitted by:  Wojciech Macek 

   Obtained from: Semihalf
   Sponsored by:  IBM, QCM Technologies


This seems to be a nonsensical commit.  What's the point of compiling
in a driver which is hard-coded to return failure from the probe and
attach routines?  The pre-change code seemed more correct: the driver
can only possibly work if FDT/OFW data is available, so only compile it
in when that option is in effect.

-- Ian



It's even worse than that: the files.powerpc uses of fdt are *also* 
wrong, because it depends on OF, not FDT per se, which is 
unconditionally available on all AIM-type PowerPC kernels, so there is 
no need to test for *anything*.

-Nathan
___
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: r330929 - in head: . release/packages

2018-03-14 Thread Kyle Evans
Author: kevans
Date: Wed Mar 14 14:45:57 2018
New Revision: 330929
URL: https://svnweb.freebsd.org/changeset/base/330929

Log:
  pkgbase: Fix post-install script for kernel packages
  
  kernel.ucl uses a hardcoded boot/kernel for kldxref, which is the incorrect
  directory when we're installing extra kernels that aren't the "default"
  kernel (placed at boot/kernel).
  
  Fix this by instead using a new %KERNELDIR% that we now replace in
  Makefile.inc1 with "kernel" for the default kernel and "kernel.${_kernel}"
  for these extra kernels so that, e.g. /boot/kernel.SHIVA, will get properly
  kldxref'd upon update and avoid outdated linker.hints.
  
  Reviewed by:  gjb
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D14689

Modified:
  head/Makefile.inc1
  head/release/packages/kernel.ucl

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Wed Mar 14 14:32:01 2018(r330928)
+++ head/Makefile.inc1  Wed Mar 14 14:45:57 2018(r330929)
@@ -1698,6 +1698,7 @@ create-kernel-packages-flavor${flavor:C,^""$,${_defaul
pwd_arg=`cd ${SRCDIR}/etc ; ${MAKE} -VPWD_MKDB_ENDIAN` ; \
sed -e "s/%VERSION%/${PKG_VERSION}/" \
-e "s/%PKGNAME%/kernel-${INSTALLKERNEL:tl}${flavor}/" \
+   -e "s/%KERNELDIR%/kernel/" \
-e "s/%COMMENT%/FreeBSD ${INSTALLKERNEL} kernel ${flavor}/" \
-e "s/%DESC%/FreeBSD ${INSTALLKERNEL} kernel ${flavor}/" \
-e "s/%CAP_MKDB_ENDIAN%/$${cap_arg}/g" \
@@ -1733,6 +1734,7 @@ create-kernel-packages-extra-flavor${flavor:C,^""$,${_
pwd_arg=`cd ${SRCDIR}/etc ; ${MAKE} -VPWD_MKDB_ENDIAN` ; \
sed -e "s/%VERSION%/${PKG_VERSION}/" \
-e "s/%PKGNAME%/kernel-${_kernel:tl}${flavor}/" \
+   -e "s/%KERNELDIR%/kernel.${_kernel}/" \
-e "s/%COMMENT%/FreeBSD ${_kernel} kernel ${flavor}/" \
-e "s/%DESC%/FreeBSD ${_kernel} kernel ${flavor}/" \
-e "s/%CAP_MKDB_ENDIAN%/$${cap_arg}/g" \

Modified: head/release/packages/kernel.ucl
==
--- head/release/packages/kernel.uclWed Mar 14 14:32:01 2018
(r330928)
+++ head/release/packages/kernel.uclWed Mar 14 14:45:57 2018
(r330929)
@@ -17,6 +17,6 @@ desc = 

svn commit: r330928 - stable/11/release/doc/share/xml

2018-03-14 Thread Glen Barber
Author: gjb
Date: Wed Mar 14 14:32:01 2018
New Revision: 330928
URL: https://svnweb.freebsd.org/changeset/base/330928

Log:
  Document SA-18:03.speculative_execution.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/11/release/doc/share/xml/security.xml

Modified: stable/11/release/doc/share/xml/security.xml
==
--- stable/11/release/doc/share/xml/security.xmlWed Mar 14 13:20:36 
2018(r330927)
+++ stable/11/release/doc/share/xml/security.xmlWed Mar 14 14:32:01 
2018(r330928)
@@ -75,6 +75,22 @@
07March2018
Multiple vulnerabilities
   
+
+  
+   FreeBSD-SA-18:03.speculative_execution
+   14March2018
+   
+ Speculative Execution Vulnerabilities
+ 
+   This advisory addresses the most significant issues
+ for 11.1 on  CPUs.  We expect to
+ update this advisory to include 10.x for 
+ CPUs.  Future  releases will address this issue on
+  and other CPUs.
+ 
+   
+  
 
   
 
___
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: r330925 - in head/sys: conf powerpc/powernv

2018-03-14 Thread Ian Lepore
On Wed, 2018-03-14 at 09:20 +, Wojciech Macek wrote:
> Author: wma
> Date: Wed Mar 14 09:20:03 2018
> New Revision: 330925
> URL: https://svnweb.freebsd.org/changeset/base/330925
> 
> Log:
>   PowerNV: Fix I2C to compile if FDT is disabled
>   
>   Submitted by:  Wojciech Macek 
>   Obtained from: Semihalf
>   Sponsored by:  IBM, QCM Technologies
> 

This seems to be a nonsensical commit.  What's the point of compiling
in a driver which is hard-coded to return failure from the probe and
attach routines?  The pre-change code seemed more correct: the driver
can only possibly work if FDT/OFW data is available, so only compile it
in when that option is in effect.

-- 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"


Re: svn commit: r330883 - head/stand/userboot/userboot

2018-03-14 Thread Warner Losh
On Mar 14, 2018 6:45 AM, "Andriy Gapon"  wrote:

On 14/03/2018 00:54, Gleb Smirnoff wrote:
> Author: glebius
> Date: Tue Mar 13 22:54:29 2018
> New Revision: 330883
> URL: https://svnweb.freebsd.org/changeset/base/330883
>
> Log:
>   Fix typo that misteriously passes compilation.
>
> Modified:
>   head/stand/userboot/userboot/main.c
>
> Modified: head/stand/userboot/userboot/main.c
> 
==
> --- head/stand/userboot/userboot/main.c   Tue Mar 13 21:42:38 2018
(r330882)
> +++ head/stand/userboot/userboot/main.c   Tue Mar 13 22:54:29 2018
(r330883)
> @@ -159,7 +159,7 @@ extract_currdev(void)
>   //bzero(, sizeof(dev));
>
>  #if defined(USERBOOT_ZFS_SUPPORT)
> - CT_ASSERT(sizeof(struct disk_devdesc) >= sizeof(struct
zfs_devdesc));
> + CTASSERT(sizeof(struct disk_devdesc) >= sizeof(struct zfs_devdesc));
>   if (userboot_zfs_found) {
>   struct zfs_devdesc zdev;

It seems that this was compiled to a call to an external CT_ASSERT function.
Probably not enough warning flags to fail on a function without a prototype?
Also, not sure how it worked at run-time.  Maybe userboot.so is linked and
loaded in such a way that it allows undefined symbols as long as they are
not
used.  So, probably extract_currdev() just didn't get called.

Anyway, thank you for spotting and fixing.


I'll have to see if I can tighten up the warns to prevent this in the
future.

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: r330927 - in head/sys: amd64/linux amd64/linux32 i386/linux

2018-03-14 Thread Ed Maste
Author: emaste
Date: Wed Mar 14 13:20:36 2018
New Revision: 330927
URL: https://svnweb.freebsd.org/changeset/base/330927

Log:
  Remove stray ; at end of linux_vdso_deinstall()

Modified:
  head/sys/amd64/linux/linux_sysvec.c
  head/sys/amd64/linux32/linux32_sysvec.c
  head/sys/i386/linux/linux_sysvec.c

Modified: head/sys/amd64/linux/linux_sysvec.c
==
--- head/sys/amd64/linux/linux_sysvec.c Wed Mar 14 09:57:58 2018
(r330926)
+++ head/sys/amd64/linux/linux_sysvec.c Wed Mar 14 13:20:36 2018
(r330927)
@@ -839,7 +839,7 @@ linux_vdso_deinstall(void *param)
 {
 
__elfN(linux_shared_page_fini)(linux_shared_page_obj);
-};
+}
 SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER_FIRST,
 (sysinit_cfunc_t)linux_vdso_deinstall, NULL);
 

Modified: head/sys/amd64/linux32/linux32_sysvec.c
==
--- head/sys/amd64/linux32/linux32_sysvec.c Wed Mar 14 09:57:58 2018
(r330926)
+++ head/sys/amd64/linux32/linux32_sysvec.c Wed Mar 14 13:20:36 2018
(r330927)
@@ -1036,7 +1036,7 @@ linux_vdso_deinstall(void *param)
 {
 
__elfN(linux_shared_page_fini)(linux_shared_page_obj);
-};
+}
 SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER_FIRST,
 (sysinit_cfunc_t)linux_vdso_deinstall, NULL);
 

Modified: head/sys/i386/linux/linux_sysvec.c
==
--- head/sys/i386/linux/linux_sysvec.c  Wed Mar 14 09:57:58 2018
(r330926)
+++ head/sys/i386/linux/linux_sysvec.c  Wed Mar 14 13:20:36 2018
(r330927)
@@ -1010,7 +1010,7 @@ linux_vdso_deinstall(void *param)
 {
 
__elfN(linux_shared_page_fini)(linux_shared_page_obj);
-};
+}
 SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER_FIRST,
 (sysinit_cfunc_t)linux_vdso_deinstall, 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"


Re: svn commit: r330883 - head/stand/userboot/userboot

2018-03-14 Thread Andriy Gapon
On 14/03/2018 00:54, Gleb Smirnoff wrote:
> Author: glebius
> Date: Tue Mar 13 22:54:29 2018
> New Revision: 330883
> URL: https://svnweb.freebsd.org/changeset/base/330883
> 
> Log:
>   Fix typo that misteriously passes compilation.
> 
> Modified:
>   head/stand/userboot/userboot/main.c
> 
> Modified: head/stand/userboot/userboot/main.c
> ==
> --- head/stand/userboot/userboot/main.c   Tue Mar 13 21:42:38 2018
> (r330882)
> +++ head/stand/userboot/userboot/main.c   Tue Mar 13 22:54:29 2018
> (r330883)
> @@ -159,7 +159,7 @@ extract_currdev(void)
>   //bzero(, sizeof(dev));
>  
>  #if defined(USERBOOT_ZFS_SUPPORT)
> - CT_ASSERT(sizeof(struct disk_devdesc) >= sizeof(struct zfs_devdesc));
> + CTASSERT(sizeof(struct disk_devdesc) >= sizeof(struct zfs_devdesc));
>   if (userboot_zfs_found) {
>   struct zfs_devdesc zdev;

It seems that this was compiled to a call to an external CT_ASSERT function.
Probably not enough warning flags to fail on a function without a prototype?
Also, not sure how it worked at run-time.  Maybe userboot.so is linked and
loaded in such a way that it allows undefined symbols as long as they are not
used.  So, probably extract_currdev() just didn't get called.

Anyway, thank you for spotting and fixing.

-- 
Andriy Gapon
___
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: r330925 - in head/sys: conf powerpc/powernv

2018-03-14 Thread Wojciech Macek
Author: wma
Date: Wed Mar 14 09:20:03 2018
New Revision: 330925
URL: https://svnweb.freebsd.org/changeset/base/330925

Log:
  PowerNV: Fix I2C to compile if FDT is disabled
  
  Submitted by:  Wojciech Macek 
  Obtained from: Semihalf
  Sponsored by:  IBM, QCM Technologies

Modified:
  head/sys/conf/files.powerpc
  head/sys/powerpc/powernv/opal_i2c.c
  head/sys/powerpc/powernv/opal_i2cm.c
  head/sys/powerpc/powernv/powernv_centaur.c
  head/sys/powerpc/powernv/powernv_xscom.c

Modified: head/sys/conf/files.powerpc
==
--- head/sys/conf/files.powerpc Wed Mar 14 08:48:40 2018(r330924)
+++ head/sys/conf/files.powerpc Wed Mar 14 09:20:03 2018(r330925)
@@ -186,8 +186,8 @@ powerpc/powermac/vcoregpio.coptional
powermac 
 powerpc/powernv/opal.c optionalpowernv
 powerpc/powernv/opal_console.c optionalpowernv
 powerpc/powernv/opal_dev.c optionalpowernv
-powerpc/powernv/opal_i2c.c optionaliicbus fdt powernv
-powerpc/powernv/opal_i2cm.coptionaliicbus fdt powernv
+powerpc/powernv/opal_i2c.c optionaliicbus powernv
+powerpc/powernv/opal_i2cm.coptionaliicbus powernv
 powerpc/powernv/opal_pci.c optionalpowernv pci
 powerpc/powernv/opalcall.S optionalpowernv
 powerpc/powernv/platform_powernv.c optionalpowernv

Modified: head/sys/powerpc/powernv/opal_i2c.c
==
--- head/sys/powerpc/powernv/opal_i2c.c Wed Mar 14 08:48:40 2018
(r330924)
+++ head/sys/powerpc/powernv/opal_i2c.c Wed Mar 14 09:20:03 2018
(r330925)
@@ -120,7 +120,9 @@ static int
 opal_i2c_probe(device_t dev)
 {
 
+#ifdef FDT
if (!(ofw_bus_is_compatible(dev, "ibm,opal-i2c")))
+#endif
return (ENXIO);
 
device_set_desc(dev, "opal-i2c");
@@ -131,6 +133,7 @@ opal_i2c_probe(device_t dev)
 static int
 opal_i2c_attach(device_t dev)
 {
+#ifdef FDT
struct opal_i2c_softc *sc;
int len;
 
@@ -150,6 +153,9 @@ opal_i2c_attach(device_t dev)
I2C_LOCK_INIT(sc);
 
return (bus_generic_attach(dev));
+#else
+   return (ENXIO);
+#endif
 }
 
 static int

Modified: head/sys/powerpc/powernv/opal_i2cm.c
==
--- head/sys/powerpc/powernv/opal_i2cm.cWed Mar 14 08:48:40 2018
(r330924)
+++ head/sys/powerpc/powernv/opal_i2cm.cWed Mar 14 09:20:03 2018
(r330925)
@@ -57,14 +57,17 @@ struct opal_i2cm_softc
 
 static int opal_i2cm_attach(device_t);
 static int opal_i2cm_probe(device_t);
+#ifdef FDT
 static const struct ofw_bus_devinfo *
 opal_i2cm_get_devinfo(device_t, device_t);
+#endif
 
 static device_method_t opal_i2cm_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, opal_i2cm_probe),
DEVMETHOD(device_attach,opal_i2cm_attach),
 
+#ifdef FDT
/* ofw_bus interface */
DEVMETHOD(ofw_bus_get_devinfo,  opal_i2cm_get_devinfo),
DEVMETHOD(ofw_bus_get_compat,   ofw_bus_gen_get_compat),
@@ -72,6 +75,7 @@ static device_method_t opal_i2cm_methods[] = {
DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name),
DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node),
DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type),
+#endif
 
DEVMETHOD_END
 };
@@ -82,8 +86,10 @@ static int
 opal_i2cm_probe(device_t dev)
 {
 
+#ifdef FDT
if (!(ofw_bus_is_compatible(dev, "ibm,centaur-i2cm") ||
ofw_bus_is_compatible(dev, "ibm,power8-i2cm")))
+#endif
return (ENXIO);
 
device_set_desc(dev, "centaur-i2cm");
@@ -93,6 +99,7 @@ opal_i2cm_probe(device_t dev)
 static int
 opal_i2cm_attach(device_t dev)
 {
+#ifdef FDT
phandle_t child;
device_t cdev;
struct ofw_bus_devinfo *dinfo;
@@ -116,13 +123,18 @@ opal_i2cm_attach(device_t dev)
}
 
return (bus_generic_attach(dev));
+#else
+   return (ENXIO);
+#endif
 }
 
+#ifdef FDT
 static const struct ofw_bus_devinfo *
 opal_i2cm_get_devinfo(device_t dev, device_t child)
 {
 return (device_get_ivars(child));
 }
+#endif
 
 DEFINE_CLASS_0(opal_i2cm, opal_i2cm_driver, opal_i2cm_methods,
 sizeof(struct opal_i2cm_softc));

Modified: head/sys/powerpc/powernv/powernv_centaur.c
==
--- head/sys/powerpc/powernv/powernv_centaur.c  Wed Mar 14 08:48:40 2018
(r330924)
+++ head/sys/powerpc/powernv/powernv_centaur.c  Wed Mar 14 09:20:03 2018
(r330925)
@@ -57,14 +57,17 @@ struct powernv_centaur_softc
 
 static int powernv_centaur_attach(device_t);
 static int powernv_centaur_probe(device_t);
+#ifdef FDT
 static const struct ofw_bus_devinfo *
 powernv_centaur_get_devinfo(device_t, device_t);
+#endif
 
 

svn commit: r330924 - stable/11/tools/tools/sysbuild

2018-03-14 Thread Eitan Adler
Author: eadler
Date: Wed Mar 14 08:48:40 2018
New Revision: 330924
URL: https://svnweb.freebsd.org/changeset/base/330924

Log:
  MFC r302452:
  
  Add missing PORTS_OPTS to two make commands

Modified:
  stable/11/tools/tools/sysbuild/sysbuild.sh
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/tools/tools/sysbuild/sysbuild.sh
==
--- stable/11/tools/tools/sysbuild/sysbuild.sh  Wed Mar 14 08:45:19 2018
(r330923)
+++ stable/11/tools/tools/sysbuild/sysbuild.sh  Wed Mar 14 08:48:40 2018
(r330924)
@@ -242,7 +242,7 @@ ports_build() (
do
b=`echo $p | tr / _`
t=`echo $p | sed "s,${pd},,"`
-   pn=`cd $p && make package-name`
+   pn=`cd $p && make package-name ${PORTS_OPTS}`
 
if [ "x`basename $p`" == "xpkg" ] ; then
log_it "Very Special: $t ($pn)"
@@ -289,7 +289,7 @@ ports_build() (
else
log_it FAIL build $p
fi
-   make clean
+   make clean ${PORTS_OPTS}
) > _.$b 2>&1 < /dev/null
done
 )
___
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: r330923 - stable/11/sys/dev/bhnd/nvram

2018-03-14 Thread Eitan Adler
Author: eadler
Date: Wed Mar 14 08:45:19 2018
New Revision: 330923
URL: https://svnweb.freebsd.org/changeset/base/330923

Log:
  MFC r302509:
  
  Fix heap overflow in bhnd(4) SPROM parsing.
  
  The bus_region_* APIs accept the number of data items to be read, while
  the code was passing the total number of bytes, resulting in an overflow
  of the SPROM parser's buffer.

Modified:
  stable/11/sys/dev/bhnd/nvram/bhnd_sprom_subr.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/bhnd/nvram/bhnd_sprom_subr.c
==
--- stable/11/sys/dev/bhnd/nvram/bhnd_sprom_subr.c  Wed Mar 14 08:33:03 
2018(r330922)
+++ stable/11/sys/dev/bhnd/nvram/bhnd_sprom_subr.c  Wed Mar 14 08:45:19 
2018(r330923)
@@ -523,7 +523,8 @@ sprom_direct_read(struct bhnd_sprom *sc, size_t offset
p = (uint16_t *)buf;
res_offset = sc->sp_res_off + offset;
 
-   bhnd_bus_read_region_stream_2(sc->sp_res, res_offset, p, nbytes);
+   bhnd_bus_read_region_stream_2(sc->sp_res, res_offset, p,
+   (nbytes / sizeof(uint16_t)));
*crc = bhnd_nvram_crc8(p, nbytes, *crc);
 
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"


svn commit: r330922 - stable/11/share/man/man4

2018-03-14 Thread Eitan Adler
Author: eadler
Date: Wed Mar 14 08:33:03 2018
New Revision: 330922
URL: https://svnweb.freebsd.org/changeset/base/330922

Log:
  MFC r322663:
  
  Correct multicast address used in pfsync(4)
  As stated in src/sys/netinet/in.h L395, address used is 224.0.0.240.
  
  PR:   216885

Modified:
  stable/11/share/man/man4/pfsync.4
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man4/pfsync.4
==
--- stable/11/share/man/man4/pfsync.4   Wed Mar 14 08:27:05 2018
(r330921)
+++ stable/11/share/man/man4/pfsync.4   Wed Mar 14 08:33:03 2018
(r330922)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 20, 2011
+.Dd August 18, 2017
 .Dt PFSYNC 4
 .Os
 .Sh NAME
@@ -90,7 +90,7 @@ interface:
 .Ed
 .Pp
 By default, state change messages are sent out on the synchronisation
-interface using IP multicast packets to the 244.0.0.240 group address.
+interface using IP multicast packets to the 224.0.0.240 group address.
 An alternative destination address for
 .Nm
 packets can be specified using 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: r330921 - stable/11/sys/dev/vt/hw/vga

2018-03-14 Thread Eitan Adler
On 14 March 2018 at 01:27, Eitan Adler  wrote:
> Author: eadler
> Date: Wed Mar 14 08:27:05 2018
> New Revision: 330921
> URL: https://svnweb.freebsd.org/changeset/base/330921
>
> Log:
>   MFC r330834:
>
>   vt_vga: check if VGA is available from ACPI FADT table
>
>   On x86 the IA-PC Boot Flags in the FADT can signal whether VGA is
>   available or not.

Woops. This was a bit early, but I'm only going to revert if its
discovered to cause problems.


-- 
Eitan Adler
Source, Ports, Doc committer
Bugmeister, Ports Security teams
___
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: r330921 - stable/11/sys/dev/vt/hw/vga

2018-03-14 Thread Eitan Adler
Author: eadler
Date: Wed Mar 14 08:27:05 2018
New Revision: 330921
URL: https://svnweb.freebsd.org/changeset/base/330921

Log:
  MFC r330834:
  
  vt_vga: check if VGA is available from ACPI FADT table
  
  On x86 the IA-PC Boot Flags in the FADT can signal whether VGA is
  available or not.

Modified:
  stable/11/sys/dev/vt/hw/vga/vt_vga.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/vt/hw/vga/vt_vga.c
==
--- stable/11/sys/dev/vt/hw/vga/vt_vga.cWed Mar 14 08:15:26 2018
(r330920)
+++ stable/11/sys/dev/vt/hw/vga/vt_vga.cWed Mar 14 08:27:05 2018
(r330921)
@@ -30,6 +30,8 @@
  * SUCH DAMAGE.
  */
 
+#include "opt_acpi.h"
+
 #include 
 __FBSDID("$FreeBSD$");
 
@@ -46,6 +48,10 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+#if ((defined(__amd64__) || defined(__i386__)) && defined(DEV_ACPI))
+#include 
+#endif
+
 struct vga_softc {
bus_space_tag_t  vga_fb_tag;
bus_space_handle_t   vga_fb_handle;
@@ -1196,11 +1202,39 @@ vga_initialize(struct vt_device *vd, int textmode)
return (0);
 }
 
+static bool
+vga_acpi_disabled(void)
+{
+#if ((defined(__amd64__) || defined(__i386__)) && defined(DEV_ACPI))
+   ACPI_TABLE_FADT *fadt;
+   vm_paddr_t physaddr;
+   uint16_t flags;
+
+   physaddr = acpi_find_table(ACPI_SIG_FADT);
+   if (physaddr == 0)
+   return (false);
+
+   fadt = acpi_map_table(physaddr, ACPI_SIG_FADT);
+   if (fadt == NULL) {
+   printf("vt_vga: unable to map FADT ACPI table\n");
+   return (false);
+   }
+
+   flags = fadt->BootFlags;
+   acpi_unmap_table(fadt);
+
+   if (flags & ACPI_FADT_NO_VGA)
+   return (true);
+#endif
+
+   return (false);
+}
+
 static int
 vga_probe(struct vt_device *vd)
 {
 
-   return (CN_INTERNAL);
+   return (vga_acpi_disabled() ? CN_DEAD : CN_INTERNAL);
 }
 
 static int
___
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: r330920 - stable/11/sys/dev/syscons

2018-03-14 Thread Eitan Adler
Author: eadler
Date: Wed Mar 14 08:15:26 2018
New Revision: 330920
URL: https://svnweb.freebsd.org/changeset/base/330920

Log:
  MFC 
r316636,r316642,r316675,r316733,r316737,r316741,r316827,r316830,r316865,r316878:
  
  Fix removal of the keyboard cursor image in text mode, especially
  in the vga renderer.  Removal used stale attributes and didn't try to
  merge with the current attribute for cut marking, so special rendering
  of cut marking was lost in many cases.  The gfb renderer is too broken
  to support special rendering of cut marking at all, so this change is
  supposed to be just a style fix for it.  Remove all traces of the
  saveunder method which was used to implement this bug.
  
  Fix drawing of the cursor image in text mode, only in the vga
  renderer.  This used a stale attribute from the frame buffer instead
  of from the saveunder, but did merge with the current attribute for
  cut marking so it caused less obvious bugs (subtle misrendering for
  the character under the cursor).
  
  The saveunder method may be good in simpler drivers, but in syscons
  the 'under' is already saved in a better way in the vtb.  Just redraw
  it from there, with visible complications for cut marking and
  invisible complications for mouse cursors.  Almost all drawing
  requests are passed a flag 'flip' which currently means to flip to
  reverse video for characters in the cut marking region, but should
  mean that the the characters are in the cut marking regions so should
  be rendered specially, preferably using something better than reverse
  video.  The gfb renderer always ignores this flag.  The vga renderer
  ignored it for removal of the text cursor -- the saveunder gave the
  stale rendering at the time the cursor was drawn.  Mouse cursors need
  even more complicated methods.  They are handled by drawing them last
  and removing them first.  Removing them usually redraws many other
  characters with the correct cut marking (but transiently loses the
  keyboard cursor, which is redrawn soon).  This tended to hide the
  saveunder bug for forward motions of the keyboard cursor.  But slow
  backward motions of the keyboard cursor always lost the cut marking,
  and fast backwards motions lost in for about 4 in every 5 characters,
  depending on races with the scrn_update() timeout handler.  This is
  because the forward motions are usually into the region redrawn for
  the mouse cursor, while backwards motions rarely are.
  
  Text cursor drawing in the vga renderer used also used a
  possibly-stale copy of the character and its attribute.  The vga
  render has the "optimization" of sometimes reading characters from the
  screen instead of from the vtb (this was not so good even in 1990 when
  main memory was only a few times faster than video RAM).  Due to care
  in update orders, the character is never stale, but its attribute
  might be (just the cut marking part, again due to care in order).
  
  gfb doesn't have the scp->scr pointer used for the "optimization", and
  vga only uses this pointer for text mode.  So most cases have to
  refresh from the vtb, and we can be sure that the ordering of vtb
  updates and drawing is as required for this to work.
  
  
  r316642 | bde | 2017-04-08 10:00:39 + (Sat, 08 Apr 2017) | 36 lines
  
  Quick fix for removal of the mouse cursor in vga direct graphics modes
  (that is, in all supported 8, 15, 16 and 24-color modes).  Moving the
  mouse cursor while holding down a button (giving cut marking) left a
  trail of garbage from misremoved mouse cursors (usually colored
  rectangles and not cursor shapes).  Cases with a button not held down
  worked better and may even have worked.
  
  No renderer support for removing (software) mouse cursors is needed
  (and many renderers don't have any), since sc_remove_mouse_image()
  marks for update the region containing the image and usually much
  more.  The mouse cursor can be (partially) over as many as 4 character
  cells, and removing it in only the 1-4 cells occupied by it would be
  best for efficiency and for avoiding flicker.  However,
  sc_remove_mouse_image() can only mark a single linear region and
  usually marks a full row of cells and 1 more to be sure to cover the
  4 cells.  It always does this, so using the special rendering method
  just wastes even more time and gives even more flicker.  The special
  methods will be removed soon.
  
  The general method always works.  vga_pxlmouse_direct() appeared to
  defer to it by returning immediately if !on.  However,
  vga_pxlmouse_direct() actually did foot-shooting using a disguised
  saveunder method.  Normal order near a mouse move is:
(1) remove the mouse cursor in the renderer (optional)
(2) remove the mouse cursor again and refresh the screen over the
mouse cursor and much more from the vtb.  When the mouse has
actually moved and a button is down, many 

svn commit: r330919 - stable/11/sys/dev/syscons

2018-03-14 Thread Eitan Adler
Author: eadler
Date: Wed Mar 14 07:58:11 2018
New Revision: 330919
URL: https://svnweb.freebsd.org/changeset/base/330919

Log:
  MFC r316136:
  
  The switch to kernel terminal context needs to update more than the cursor
  position.  Especially the screen size, and potentially everything except
  the input state and attributes.  Do this by changing the cursor position
  setting method to a general syncing method.
  
  Use proper constructors instead of copying to create kernel terminal
  contexts.  We really want clones and not new instances, but there is
  no method for cloning and there is nothing in the active instance that
  needs to be cloned exactly.
  
  Add proper destructors for kernel terminal contexts.  I doubt that the
  destructor code has every been reached, but if it was then it leaked the
  memory of the clones.
  
  Remove freeing of statically allocated memory for the non-kernel terminal
  context for the same terminal as the kernel.  This is in the nearly
  unreachable code.  This used to not happen because delicate context
  swapping made the user context use the dynamic memory and kernel
  context the static memory.  I didn't restore this swapping since it
  would have been unnatural to have all kernel contexts except 1 dynamic.
  
  The constructor for terminal context has bad layering for reasons
  related to the bug.  It has to return static memory early before
  malloc() works.  Callers also can't allocate memory until after the
  first constructor selects an emulator and tells upper layers the size
  of its context.  After that, the cloning hack required the cloning
  code to allocate the memory, but for all other constructors it would
  be better for the terminal layer to allocate and deallocate the
  memory in all cases.
  
  Zero the memory when allocating terminal contexts dynamically.

Modified:
  stable/11/sys/dev/syscons/scterm-teken.c
  stable/11/sys/dev/syscons/syscons.c
  stable/11/sys/dev/syscons/syscons.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/syscons/scterm-teken.c
==
--- stable/11/sys/dev/syscons/scterm-teken.cWed Mar 14 07:55:29 2018
(r330918)
+++ stable/11/sys/dev/syscons/scterm-teken.cWed Mar 14 07:58:11 2018
(r330919)
@@ -64,7 +64,7 @@ static sc_term_default_attr_t scteken_default_attr;
 static sc_term_clear_t scteken_clear;
 static sc_term_input_t scteken_input;
 static sc_term_fkeystr_t   scteken_fkeystr;
-static sc_term_set_cursor_tscteken_set_cursor;
+static sc_term_sync_t  scteken_sync;
 static voidscteken_nop(void);
 
 typedef struct {
@@ -91,7 +91,7 @@ static sc_term_sw_t sc_term_scteken = {
(sc_term_notify_t *)scteken_nop,
scteken_input,
scteken_fkeystr,
-   scteken_set_cursor,
+   scteken_sync,
 };
 
 SCTERM_MODULE(scteken, sc_term_scteken);
@@ -221,7 +221,7 @@ scteken_clear(scr_stat *scp)
teken_stat *ts = scp->ts;
 
sc_move_cursor(scp, 0, 0);
-   scteken_set_cursor(scp, 0, 0);
+   scteken_sync(scp);
sc_vtb_clear(>vtb, scp->sc->scr_map[0x20],
 scteken_te_to_sc_attr(teken_get_curattr(>ts_teken))
 << 8);
@@ -286,13 +286,16 @@ scteken_fkeystr(scr_stat *scp, int c)
 }
 
 static void
-scteken_set_cursor(scr_stat *scp, int col, int row)
+scteken_sync(scr_stat *scp)
 {
teken_stat *ts = scp->ts;
teken_pos_t tp;
 
-   tp.tp_col = col;
-   tp.tp_row = row;
+   tp.tp_col = scp->xsize;
+   tp.tp_row = scp->ysize;
+   teken_set_winsize_noreset(>ts_teken, );
+   tp.tp_col = scp->xpos;
+   tp.tp_row = scp->ypos;
teken_set_cursor(>ts_teken, );
 }
 

Modified: stable/11/sys/dev/syscons/syscons.c
==
--- stable/11/sys/dev/syscons/syscons.c Wed Mar 14 07:55:29 2018
(r330918)
+++ stable/11/sys/dev/syscons/syscons.c Wed Mar 14 07:58:11 2018
(r330919)
@@ -570,8 +570,9 @@ sc_attach_unit(int unit, int flags)
/* assert(sc_console->ts != NULL); */
oldts = sc_console->ts;
for (i = 0; i <= mp_maxid; i++) {
-   ts = malloc(sc_console->tsw->te_size, M_DEVBUF, M_WAITOK);
-   bcopy(oldts, ts, sc_console->tsw->te_size);
+   ts = malloc(sc_console->tsw->te_size, M_DEVBUF,
+   M_WAITOK | M_ZERO);
+   (*sc_console->tsw->te_init)(sc_console, , SC_TE_COLD_INIT);
sc_console->ts = ts;
(*sc_console->tsw->te_default_attr)(sc_console, sc_kattrtab[i],
SC_KERNEL_CONS_REV_ATTR);
@@ -1708,6 +1709,9 @@ sc_cninit(struct consdev *cp)
 static void
 sc_cnterm(struct consdev *cp)
 {
+void *ts;
+int i;
+
 /* we are not the kernel console any more, release everything */
 
 

svn commit: r330918 - stable/11/sys/dev/syscons

2018-03-14 Thread Eitan Adler
Author: eadler
Date: Wed Mar 14 07:55:29 2018
New Revision: 330918
URL: https://svnweb.freebsd.org/changeset/base/330918

Log:
  MFC r315984:
  
  Restore switching to a separate kernel terminal "input" state and extend
  it to a separate state for each CPU.
  
  Terminal "input" is user or kernel output.  Its state includes the current
  parser state for escape sequences and multi-byte characters, and some
  results of previous parsing (mainly attributes), and in teken the cursor
  position, but not completed output.  This state must be switched for kernel
  output since the kernel can preempt anything, including itself, and this
  must not affect the preempted state more than necessary.  Since vty0 is
  shared, it is necessary to affect the frame buffer and cursor position and
  history, but escape sequences must not be affected and attributes for
  further output must not be affected.
  
  This used to work.  The syscons terminal state contained mainly the parser
  state for escape sequences and attributes, but not the cursor position,
  and was switched.  This was first broken by SMP and/or preemptive kernels.
  Then there should really be a separate state for each thread, and one more
  for ddb, or locking to prevent preemption.  Serialization of printf() helps.
  But it is arcane that full syscons escape sequences mostly work in kernel
  printf(), and I have never seen them used except by me to test this fix.
  They worked perfectly except for the races, since "input" from the kernel
  was not special in any way.
  
  This was broken to use teken.  The general switch was removed, and the
  kernel normal attribute was switched specially.  The kernel reverse
  attribute (config option SC_CONS_REVERSE_ATTR) became unused, and is
  still unusable because teken doesn't support default reverse attributes
  (it used to only be used via the ANSI escape sequence to set reverse
  video).
  
  The only new difficulty for using teken seems to be that the cursor
  position is in the "input" state, so it must be updated in the active
  input state for each half of the switch.  Do this to complete the
  restoration.
  
  The per-CPU state is mainly to make per-CPU coloring work cleanly, at
  a cost of some space.  Each CPU gets its own full set of attribute
  (not just the current attribute) maintained in the usual way.  This
  also reduces races from unserialized printf()s.  However, this gives
  races for serialized printf()s that otherwise have none.  Nothing
  prevents the CPU doing the a printf() changing in the middle of an
  escape sequence.

Modified:
  stable/11/sys/dev/syscons/scterm-teken.c
  stable/11/sys/dev/syscons/syscons.c
  stable/11/sys/dev/syscons/syscons.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/syscons/scterm-teken.c
==
--- stable/11/sys/dev/syscons/scterm-teken.cWed Mar 14 07:51:33 2018
(r330917)
+++ stable/11/sys/dev/syscons/scterm-teken.cWed Mar 14 07:55:29 2018
(r330918)
@@ -164,23 +164,12 @@ scteken_term(scr_stat *scp, void **softc)
 }
 
 static void
-scteken_puts(scr_stat *scp, u_char *buf, int len, int kernel)
+scteken_puts(scr_stat *scp, u_char *buf, int len)
 {
teken_stat *ts = scp->ts;
-   teken_attr_t backup, kattr;
 
scp->sc->write_in_progress++;
-   if (kernel) {
-   /* Use special colors for kernel messages. */
-   backup = *teken_get_curattr(>ts_teken);
-   scteken_sc_to_te_attr(sc_kattr(), );
-   teken_set_curattr(>ts_teken, );
-   teken_input(>ts_teken, buf, len);
-   teken_set_curattr(>ts_teken, );
-   } else {
-   /* Print user messages with regular colors. */
-   teken_input(>ts_teken, buf, len);
-   }
+   teken_input(>ts_teken, buf, len);
scp->sc->write_in_progress--;
 }
 

Modified: stable/11/sys/dev/syscons/syscons.c
==
--- stable/11/sys/dev/syscons/syscons.c Wed Mar 14 07:51:33 2018
(r330917)
+++ stable/11/sys/dev/syscons/syscons.c Wed Mar 14 07:55:29 2018
(r330918)
@@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -99,6 +100,7 @@ static   int sc_console_unit = -1;
 static int sc_saver_keyb_only = 1;
 static  scr_stat   *sc_console;
 static  struct consdev *sc_consptr;
+static void*kernel_console_ts[MAXCPU];
 static scr_statmain_console;
 static struct tty  *main_devs[MAXCONS];
 
@@ -183,7 +185,7 @@ static void scshutdown(void *, int);
 static void scsuspend(void *);
 static void scresume(void *);
 static u_int scgetc(sc_softc_t *sc, u_int flags, struct sc_cnstate *sp);
-static void sc_puts(scr_stat *scp, u_char *buf, int len, int kernel);
+static void sc_puts(scr_stat *scp, 

svn commit: r330917 - stable/11/sys/dev/vt

2018-03-14 Thread Eitan Adler
Author: eadler
Date: Wed Mar 14 07:51:33 2018
New Revision: 330917
URL: https://svnweb.freebsd.org/changeset/base/330917

Log:
  MFC r317174:
  
  Revert r316796.  It is not necessary since r317173.

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

Modified: stable/11/sys/dev/vt/vt_cpulogos.c
==
--- stable/11/sys/dev/vt/vt_cpulogos.c  Wed Mar 14 07:47:26 2018
(r330916)
+++ stable/11/sys/dev/vt/vt_cpulogos.c  Wed Mar 14 07:51:33 2018
(r330917)
@@ -153,7 +153,6 @@ vt_fini_logos(void *dummy __unused)
struct winsize wsz;
term_pos_t size;
unsigned int i;
-   int row;
 
if (!vt_draw_logo_cpus)
return;
@@ -171,7 +170,7 @@ vt_fini_logos(void *dummy __unused)
vt_draw_logo_cpus = 0;
VT_UNLOCK(vd);
 
-   for (i = row = 0; i < VT_MAXWINDOWS; i++) {
+   for (i = 0; i < VT_MAXWINDOWS; i++) {
vw = vd->vd_windows[i];
if (vw == NULL)
continue;
@@ -194,16 +193,11 @@ vt_fini_logos(void *dummy __unused)
vt_compute_drawable_area(vw);
 
if (vd->vd_curwindow == vw) {
-   row = vw->vw_draw_area.tr_begin.tp_row;
vd->vd_flags |= VDF_INVALID;
vt_resume_flush_timer(vd, 0);
}
VT_UNLOCK(vd);
}
-
-   if (row > 0 && vd->vd_driver->vd_drawrect != NULL)
-   vd->vd_driver->vd_drawrect(vd, 0, 0, vd->vd_width, row - 1,
-   1, TC_BLACK);
 }
 
 static void
___
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: r330916 - in stable/11/sys: dev/syscons dev/vt kern teken teken/libteken

2018-03-14 Thread Eitan Adler
Author: eadler
Date: Wed Mar 14 07:47:26 2018
New Revision: 330916
URL: https://svnweb.freebsd.org/changeset/base/330916

Log:
  MFC r315418,r315480,r316019:
  
  Add teken_256to16() to convert xterm-256 256-color codes to xterm 16-color
  codes.  This will be used to fix bright colors.
  
  Improve teken_256to8().  Use a lookup table instead of calculations.  The
  calculations were inaccurate since they used indexes into the xterm-256
  6x6x6 color map instead of actual xterm colors.  Also, change the threshold
  for converting to a primary color: require the primary's component to be
  2 or more higher instead of just higher.  This affects about 1/5 of the
  table entries and gives uniformly distributed colors in the 6x6x6 submap
  except for greys (35 entries each for red, green, blue, cyan, brown and
  magenta, instead of approx. only 15 each for the mixed colors).  Even
  more mixed colors would be better for matching colors, but uniform
  distribution is best for preserving contrast.
  
  For teken_256to16(), bright colors are just the ones with luminosity >=
  60%.  These are actually light colors (more white instead of more
  saturation), while xterm bright colors except for white itself are
  actually saturated with no white, so have luminosity only 50%.
  
  These functions are layering violations.  teken cannot do correct
  conversions since it shouldn't know the color maps of anything except
  xterm.  Translating through xterm-16 colors loses information.  This
  gives bugs like xterm-256 near-brown -> xterm-16 red -> VGA red.
  
  
  r315480 | bde | 2017-03-18 11:13:54 + (Sat, 18 Mar 2017) | 51 lines
  
  Fix bright colors for syscons, and make them work for the first time
  for vt.  Restore syscons' rendering of background (bg) brightness as
  foreground (fg) blinking and vice versa, and add rendering of blinking
  as background brightness to vt.
  
  Bright/saturated is conflated with light/white in the implementation
  and in this description.
  
  Bright colors were broken in all cases, but appeared to work in the
  only case shown by "vidcontrol show".  A boldness hack was applied
  only in 1 layering-violation place (for some syscons sequences) where
  it made some cases seem to work but was undone by clearing bold using
  ANSI sequences, and more seriously was not undone when setting
  ANSI/xterm dark colors so left them bright.  Move this hack to drivers.
  
  The boldness hack is only for fg brightness.  Restore/add a similar hack
  for bg brightness rendered as fg blinking and vice versa.  This works
  even better for vt, since vt changes the default text mode to give the
  more useful bg brightness instead of fg blinking.
  
  The brightness bit in colors was unnecessarily removed by the boldness
  hack.  In other cases, it was lost later by teken_256to8().  Use
  teken_256to16() to not lose it.  teken_256to8() was intended to be
  used for bg colors to allow finer or bg-specific control for the more
  difficult reduction to 8; however, since 16 bg colors actually work
  on VGA except in syscons text mode and the conversion isn't subtle
  enough to significantly in that mode, teken_256to8() is not used now.
  
  There are still bugs, especially in vidcontrol, if bright/blinking
  background colors are set.
  
  Restore XOR logic for bold/bright fg in syscons (don't change OR
  logic for vt).  Remove broken ifdef on FG_UNDERLINE and its wrong
  or missing bit and restore the correct hard-coded bit.  FG_UNDERLINE
  is only for mono mode which is not really supported.
  
  Restore XOR logic for blinking/bright bg in syscons (in vt, add
  OR logic and render as bright bg).  Remove related broken ifdef
  on BG_BLINKING and its missing bit and restore the correct
  hard-coded bit.  The same bit means blinking or bright bg depending
  on the mode, and we want to ignore the difference everywhere.
  
  Simplify conversions of attributes in syscons.  Don't pretend to
  support bold fonts.  Don't support unusual encodings of brightness.
  It is as good as possible to map 16 VGA colors to 16 xterm-16
  colors.  E.g., VGA brown -> xterm-16 Olive will be converted back
  to VGA brown, so we don't need to convert to xterm-256 Brown.  Teken
  cons25 compatibility code already does the same, and duplicates some
  small tables.  This is mostly for the sc -> te direction.  The other
  direction uses teken_256to16() which is too generic.
  
  
  r316019 | bde | 2017-03-27 10:48:28 + (Mon, 27 Mar 2017) | 30 lines
  
  Oops, my fix for bright colors broke bright black some more (in cases
  that used to work via the bold hack).
  
  Fix the table entry for bright black.  Fix spelling of plain black in
  nearby table entries (use the macro for black everywhere everywhere).
  Fix the currently-unused non-bright color table to not have bright
  colors in 

svn commit: r330915 - stable/11/sys/dev/syscons

2018-03-14 Thread Eitan Adler
Author: eadler
Date: Wed Mar 14 07:39:28 2018
New Revision: 330915
URL: https://svnweb.freebsd.org/changeset/base/330915

Log:
  MFC r315003,r315065,r315066:
  
  Rename scteken_revattr() to scteken_sc_to_te_attr().  scteken_revattr()
  looked like it might handle reverse attributes, but it actually handles
  conversion of attributes in the direction indicated by the new name.
  Reverse attributes are just broken.
  
  Rename scteken_attr() to scteken_te_to_sc_attr().  scteken_attr() looked
  like it might give teken attributes, but it actually gives sc attributes.
  
  Change scteken_te_to_sc_attr() to return int instead of unsigned int.
  u_char would be enough, and it promotes to int, and syscons uses int
  or u_short for its attributes everywhere else (u_short holds a shifted
  form and it promotes to int too).
  
  Add a scteken_set_cursor() (sc to teken) method and use it to fix
  some cases of initialization and resetting of the teken cursor position.
  (This bad name is consistent with others, but it is too easy to confuse
  with scteken_cursor() which goes in the opposite direction.)
  
  The following cases were broken:
  - for booting without a syscons console, the teken and sc positions for
ttyv0 were (0, 0), but are supposed to be somewhere in the middle of
the screen (after carefully preserved BIOS and loader messages) (at
least if there is no mode switch that loses the messages).
  - after mode switches, the screen is cleared and the cursor is supposed to
be moved to (0, 0), but it was only moved there for sc.
  
  The following case was hacked to work:
  - for booting with a syscons console, it was arranged that scteken_init()
for the console could see a nonzero cursor position and adjust, although
this broke the sc seeing it in the non-console case above.
  
  Fix the attribute for scteken_clear() (change it back from the user
  user default normal attribute to the current attribute).
  
  This change only fixes a logic error.  scterm_clear() used to be
  used for terminal reset, but teken uses a general fill function for
  that, leaving scterm_clear() only used for initialization and mode
  change, when using the user default attribute is correct.  It is not
  really a terminal function, but needs to sync its changes with the
  terminal layer.  Syncing of the attribute is currently broken for
  terminal reset, but works for initialization and mode change.

Modified:
  stable/11/sys/dev/syscons/scterm-teken.c
  stable/11/sys/dev/syscons/syscons.c
  stable/11/sys/dev/syscons/syscons.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/syscons/scterm-teken.c
==
--- stable/11/sys/dev/syscons/scterm-teken.cWed Mar 14 07:32:48 2018
(r330914)
+++ stable/11/sys/dev/syscons/scterm-teken.cWed Mar 14 07:39:28 2018
(r330915)
@@ -53,8 +53,8 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-static void scteken_revattr(unsigned char, teken_attr_t *);
-static unsigned int scteken_attr(const teken_attr_t *);
+static void scteken_sc_to_te_attr(unsigned char, teken_attr_t *);
+static int scteken_te_to_sc_attr(const teken_attr_t *);
 
 static sc_term_init_t  scteken_init;
 static sc_term_term_t  scteken_term;
@@ -64,6 +64,7 @@ static sc_term_default_attr_t scteken_default_attr;
 static sc_term_clear_t scteken_clear;
 static sc_term_input_t scteken_input;
 static sc_term_fkeystr_t   scteken_fkeystr;
+static sc_term_set_cursor_tscteken_set_cursor;
 static voidscteken_nop(void);
 
 typedef struct {
@@ -90,6 +91,7 @@ static sc_term_sw_t sc_term_scteken = {
(sc_term_notify_t *)scteken_nop,
scteken_input,
scteken_fkeystr,
+   scteken_set_cursor,
 };
 
 SCTERM_MODULE(scteken, sc_term_scteken);
@@ -142,13 +144,6 @@ scteken_init(scr_stat *scp, void **softc, int code)
tp.tp_row = scp->ysize;
tp.tp_col = scp->xsize;
teken_set_winsize(>ts_teken, );
-
-   if (scp->cursor_pos < scp->ysize * scp->xsize) {
-   /* Valid old cursor position. */
-   tp.tp_row = scp->cursor_pos / scp->xsize;
-   tp.tp_col = scp->cursor_pos % scp->xsize;
-   teken_set_cursor(>ts_teken, );
-   }
break;
}
 
@@ -178,7 +173,7 @@ scteken_puts(scr_stat *scp, u_char *buf, int len, int 
if (kernel) {
/* Use special colors for kernel messages. */
backup = *teken_get_curattr(>ts_teken);
-   scteken_revattr(sc_kattr(), );
+   scteken_sc_to_te_attr(sc_kattr(), );
teken_set_curattr(>ts_teken, );
teken_input(>ts_teken, buf, len);
teken_set_curattr(>ts_teken, );
@@ -195,19 +190,19 @@ scteken_ioctl(scr_stat *scp, struct tty *tp, u_long cm
 {
  

svn commit: r330914 - stable/11/sys/dev/syscons

2018-03-14 Thread Eitan Adler
Author: eadler
Date: Wed Mar 14 07:32:48 2018
New Revision: 330914
URL: https://svnweb.freebsd.org/changeset/base/330914

Log:
  MFC r315000:
  
  Start fixing some bugs in attribute handling.
  
  This change just does cleanups missed in r56043 17 years ago.  The
  default attributes were still stored in structs for the purpose of
  changing them and passing around pointers to the defaults, but r56043
  added another layer that made the defaults invariant and only used for
  initialization and reset.  Just use the defaults directly.  This was
  already done for the kernel defaults.  The defaults for reverse
  attributes aren't actually used, but are ignored in layers that no
  longer support them.

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

Modified: stable/11/sys/dev/syscons/syscons.c
==
--- stable/11/sys/dev/syscons/syscons.c Wed Mar 14 07:30:58 2018
(r330913)
+++ stable/11/sys/dev/syscons/syscons.c Wed Mar 14 07:32:48 2018
(r330914)
@@ -93,16 +93,6 @@ __FBSDID("$FreeBSD$");
 /* NULL-safe version of "tty_opened()" */
 #definetty_opened_ns(tp)   ((tp) != NULL && tty_opened(tp))
 
-typedef struct default_attr {
-   int std_color;  /* normal hardware color */
-   int rev_color;  /* reverse hardware color */
-} default_attr;
-
-static default_attr user_default = {
-SC_NORM_ATTR,
-SC_NORM_REV_ATTR,
-};
-
 static u_char  sc_kattrtab[MAXCPU];
 
 static int sc_console_unit = -1;
@@ -3170,9 +3160,7 @@ scinit(int unit, int flags)
 
if (sc_init_emulator(scp, SC_DFLT_TERM))
sc_init_emulator(scp, "*");
-   (*scp->tsw->te_default_attr)(scp,
-user_default.std_color,
-user_default.rev_color);
+   (*scp->tsw->te_default_attr)(scp, SC_NORM_ATTR, SC_NORM_REV_ATTR);
} else {
/* assert(sc_malloc) */
sc->dev = malloc(sizeof(struct tty *)*sc->vtys, M_DEVBUF,
@@ -3589,8 +3577,7 @@ sc_init_emulator(scr_stat *scp, char *name)
 scp->rndr = rndr;
 scp->rndr->init(scp);
 
-/* XXX */
-(*sw->te_default_attr)(scp, user_default.std_color, 
user_default.rev_color);
+(*sw->te_default_attr)(scp, SC_NORM_ATTR, SC_NORM_REV_ATTR);
 sc_clear_screen(scp);
 
 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"


svn commit: r330913 - stable/11/sys/dev/syscons

2018-03-14 Thread Eitan Adler
Author: eadler
Date: Wed Mar 14 07:30:58 2018
New Revision: 330913
URL: https://svnweb.freebsd.org/changeset/base/330913

Log:
  MFC r314641,r314646,r314997,r315390:
  
  Colorize syscons kernel console output according to a table indexed
  by the CPU number.
  
  This was originally for debugging near-deadlock conditions where
  multiple CPUs either deadlock or scramble each other's output trying
  to report the problem, but I found it interesting and sometimes
  useful for ordinary kernel messages.  Ordinary kernel messages
  shouldn't be interleaved, but if they are then the colorization
  makes them readable even if the interleaving is for every character
  (provided the CPU printing each message doesn't change).
  
  The default colors are 8-15 starting at 15 (bright white on black)
  for CPU 0 and repeating every 8 CPUs.  This works best with 8 CPUs.
  Non-bright colors and nonzero background colors need special
  configuration to avoid unreadable and ugly combinations so are not
  configured by default.  The next bright color after 15 is 8 (bright
  black = dark gray) is not very readable but is the only other color
  used with 2 CPUs.  After that the next bright color is 9 (bright
  blue) which is not much brighter than bright black, but is used with
  3+ CPUs.  Other bright colors are brighter.
  
  Colorization is configured by default so that it gets tested.  It can
  only be turned off by configuring SC_KERNEL_CONS_ATTR to anything other
  than FG_WHITE.  After booting, all colors can be changed using the
  syscons.kattr sysctl.  This is a SYSCTL_OPAQUE, and no utility is
  provided to change it (sysctl only displays it).
  
  The default colors work in all VGA modes that I could test.  In 2-color
  graphics modes, all 8 bright colors are displayed as bright white, so
  the colorization has no effect, but anything with a nonzero background
  gives white on white unless the foreground is zero.  I don't have an
  mono or VGA grayscale hardware to test on.  Support for mono mode seems
  to have never worked right in syscons (I think bright white gives white
  underline with either bold or bright), but VGA grayscale should work
  better than 2-color graphics.
  
  Implement ec_putc() (emergency kernel [syscons] console putc()) and use
  it in emergency in sc_cnputc().
  
  Locking fixes in sc_cnputc() previously turned off normal output in
  near-deadlock conditions and added deferred output which might never
  be completed.  Emergency output goes to the frame buffer using
  sufficiently atomic non-blocking writes if the console is in text
  mode (in graphics mode, nothing is done, modulo races setting the
  graphics mode bit).  Screen updates overwrite the emergency output
  if the emergency condition clears enough to reach them.
  
  ec_putc() also works for "early" console output in normal x86 text
  mode as soon as this mode is initialized (if ever).  This uses a
  hard-coded x86 frame buffer address before cninit() and a hopefully
  MI address after cninit().  But non-x86 is more likely to not support
  text mode, when ec_putc() will be null.  ec_putc() has no dependencies
  of syscons before cninit(), and only has them later to track syscons'
  mode changes.  This commit doesn't attach ec_putc() for early use.
  
  To test emergency use, put a breakpoint in central syscons output code
  like sc_puts() and do some user output.  The system used to race or
  deadlock in ddb output soon after entry to ddb.  The locking fixes
  deferred the output until after leaving ddb, so ddb was unusable and
  you had to try typing c[ontinue] blindly until it exited, or better use
  a serial console in parallel.  Now the output goes to a window in the
  middle 2/3 of the screen.  Scrolling is circular and there is no cursor,
  but otherwise ec_putc() provides full dumb terminal functionality and
  very fast output that hides artificates from dumb overwrites.

Modified:
  stable/11/sys/dev/syscons/scterm-teken.c
  stable/11/sys/dev/syscons/syscons.c
  stable/11/sys/dev/syscons/syscons.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/syscons/scterm-teken.c
==
--- stable/11/sys/dev/syscons/scterm-teken.cWed Mar 14 07:16:29 2018
(r330912)
+++ stable/11/sys/dev/syscons/scterm-teken.cWed Mar 14 07:30:58 2018
(r330913)
@@ -178,7 +178,7 @@ scteken_puts(scr_stat *scp, u_char *buf, int len, int 
if (kernel) {
/* Use special colors for kernel messages. */
backup = *teken_get_curattr(>ts_teken);
-   scteken_revattr(SC_KERNEL_CONS_ATTR, );
+   scteken_revattr(sc_kattr(), );
teken_set_curattr(>ts_teken, );
teken_input(>ts_teken, buf, len);
teken_set_curattr(>ts_teken, );

Modified: stable/11/sys/dev/syscons/syscons.c

svn commit: r330912 - stable/11/sys/dev/syscons

2018-03-14 Thread Eitan Adler
Author: eadler
Date: Wed Mar 14 07:16:29 2018
New Revision: 330912
URL: https://svnweb.freebsd.org/changeset/base/330912

Log:
  MFC r305121,r305231:
  
  Add some locking to sc_cngetc().
  
  Keyboard input needs Giant locking, and that is not possible to do
  correctly here.  Use mtx_trylock() and proceed unlocked as before if
  we can't acquire Giant (non-recursively), except in kdb mode don't
  even try to acquire Giant.  Everything here is a hack, but it often
  works.  Even if mtx_trylock() succeeds, this might be a LOR.
  
  Keyboard input also needs screen locking, to handle screen updates
  and switches.  Add this, using the same simplistic screen locking
  as for sc_cnputc().
  
  Giant must be acquired before the screen lock, and the screen lock
  must be dropped when calling the keyboard driver (else it would get a
  harmless LOR if it tries to acquire Giant).  It was intended that sc
  cn open/close hide the locking calls, and they do for i/o functions
  functions except for this complication.
  
  Non-console keyboard input is still only Giant-locked, with screen
  locking in some called functions.  This is correct for the keyboard
  parts only.
  
  When Giant cannot be acquired properly, atkbd and kbdmux tend to race
  and work (they assume that the caller acquired Giant properly and don't
  try to acquire it again or check that it has been acquired, and the
  races rarely matter), while ukbd tends to deadlock or panic (since it
  does the opposite, and has other usb threads to deadlock with).
  
  The keyboard (Giant) locking here does very little, but the screen
  locking completes screen locking for console mode except for not
  detecting or handling deadlock.
  
  The log message for the previous commit didn't mention the most the
  important detail that sc_cngetc() now opens and closes the keyboard
  on every call again.  This was moved from sc_cngetc() to scn_cngrab/
  ungrab() in r228644, but the change wasn't quite complete.  After
  fixes for nesting in kbdd_poll() in ukbd and kbdmux, these opens
  and closes should have no significant effect if done while grabbed.
  They fix unusual cases when cngetc() is called while not grabbed.
  
  This commit is the main fix for screen locking in sc_cnputc():
  detect deadlock or likely-deadlock and handle it by buffering the
  output atomically and printing it later if the deadlock condition
  clears (and sc_cnputc() is called).
  
  The most common deadlock is when the screen lock is held by ourself.
  Then it would be safe to acquire the lock recursively if the console
  driver is calling printf() in a safe context, but we don't know when
  that is.  It is not safe to ignore the lock even in kdb or panic mode.
  But ignore it in panic mode.  The only other known case of deadlock
  is when another thread holds the lock but is running on a stopped CPU.
  Detect that case approximately by using trylock and retrying for 1000
  usec.  On a 4 GHz CPU, 100 usec is almost long enough -- screen switches
  take slightly longer than that.  Not retrying at all is good enough
  except for stress tests, and planned future versions will extend the
  timeout so that the stress tests work better.
  
  To see the behaviour when deadlock is detected, single step through
  sctty_outwakeup() (or sc_puts() to start with deadlock).  Another
  (serial) console is needed to the buffered-only output, but the
  keyboard works in this context to continue or step out of the
  deadlocked region.  The buffer is not large enough to hold all the
  output for this.

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

Modified: stable/11/sys/dev/syscons/syscons.c
==
--- stable/11/sys/dev/syscons/syscons.c Wed Mar 14 07:11:33 2018
(r330911)
+++ stable/11/sys/dev/syscons/syscons.c Wed Mar 14 07:16:29 2018
(r330912)
@@ -1651,20 +1651,68 @@ sc_cnterm(struct consdev *cp)
 
 static void sccnclose(sc_softc_t *sc, struct sc_cnstate *sp);
 static int sc_cngetc_locked(struct sc_cnstate *sp);
+static void sccnkbdlock(sc_softc_t *sc, struct sc_cnstate *sp);
+static void sccnkbdunlock(sc_softc_t *sc, struct sc_cnstate *sp);
 static void sccnopen(sc_softc_t *sc, struct sc_cnstate *sp, int flags);
 static void sccnscrlock(sc_softc_t *sc, struct sc_cnstate *sp);
 static void sccnscrunlock(sc_softc_t *sc, struct sc_cnstate *sp);
 
 static void
+sccnkbdlock(sc_softc_t *sc, struct sc_cnstate *sp)
+{
+/*
+ * Locking method: hope for the best.
+ * The keyboard is supposed to be Giant locked.  We can't handle that
+ * in general.  The kdb_active case here is not safe, and we will
+ * proceed without the lock in all cases.
+ */
+sp->kbd_locked = !kdb_active && mtx_trylock();
+}
+
+static void
+sccnkbdunlock(sc_softc_t *sc, struct sc_cnstate *sp)
+{
+if (sp->kbd_locked)
+   

svn commit: r330911 - stable/11/sys/dev/kbdmux

2018-03-14 Thread Eitan Adler
Author: eadler
Date: Wed Mar 14 07:11:33 2018
New Revision: 330911
URL: https://svnweb.freebsd.org/changeset/base/330911

Log:
  MFC r305060:
  
  Fix keyboard polling "on/off" to support recursion.  vt depends on
  this, and sc will soon depend on it again.
  
  The on/off request is passed without modification to lower layers,
  so the bug was smaller in this layer than in in lower layers (the
  sequence on;on;off left polling off when it should be on, but the
  sequence on;on;off;on;off...  doesn't allow the interrupt handler
  to eat the input after an "off" that should't turn off polled mode,
  provided lower layers don't have the bug, since this layer is virtual.
  
  The bug was small in lower layers too.  Normally everything is Giant
  locked for keyboards, and this locks out the interrupt handler in
  on;on;off;on;off... sequences.  However, PR 211884 says that fixing
  this bug in ukbd in r303765 apparently causes the eating-by-interrupt
  behaviour that the fix is to prevent.

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

Modified: stable/11/sys/dev/kbdmux/kbdmux.c
==
--- stable/11/sys/dev/kbdmux/kbdmux.c   Wed Mar 14 07:08:46 2018
(r330910)
+++ stable/11/sys/dev/kbdmux/kbdmux.c   Wed Mar 14 07:11:33 2018
(r330911)
@@ -158,9 +158,9 @@ struct kbdmux_state
 
int  ks_flags;  /* flags */
 #define COMPOSE(1 << 0)/* compose char flag */ 
-#define POLLING(1 << 1)/* polling */
 #define TASK   (1 << 2)/* interrupt task queued */
 
+   int  ks_polling;/* poll nesting count */
int  ks_mode;   /* K_XLATE, K_RAW, K_CODE */
int  ks_state;  /* state */
int  ks_accents;/* accent key index (> 0) */
@@ -717,7 +717,7 @@ next_code:
/* see if there is something in the keyboard queue */
scancode = kbdmux_kbd_getc(state);
if (scancode == -1) {
-   if (state->ks_flags & POLLING) {
+   if (state->ks_polling != 0) {
kbdmux_kbd_t*k;
 
SLIST_FOREACH(k, >ks_kbds, next) {
@@ -1317,7 +1317,8 @@ kbdmux_clear_state_locked(kbdmux_state_t *state)
 {
KBDMUX_LOCK_ASSERT(state, MA_OWNED);
 
-   state->ks_flags &= ~(COMPOSE|POLLING);
+   state->ks_flags &= ~COMPOSE;
+   state->ks_polling = 0;
state->ks_state &= LOCK_MASK;   /* preserve locking key state */
state->ks_accents = 0;
state->ks_composed_char = 0;
@@ -1377,9 +1378,9 @@ kbdmux_poll(keyboard_t *kbd, int on)
KBDMUX_LOCK(state);
 
if (on)
-   state->ks_flags |= POLLING; 
+   state->ks_polling++;
else
-   state->ks_flags &= ~POLLING;
+   state->ks_polling--;
 
/* set poll on slave keyboards */
SLIST_FOREACH(k, >ks_kbds, next)
___
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: r330910 - stable/11/sys/dev/syscons

2018-03-14 Thread Eitan Adler
Author: eadler
Date: Wed Mar 14 07:08:46 2018
New Revision: 330910
URL: https://svnweb.freebsd.org/changeset/base/330910

Log:
  MFC r305059:
  
  Start adding locking to sc_cngetc().
  
  Restore an splx() lost in r228644.  We aren't nearly ready to remove
  spl's.  They give hints about missing locking.  This lost one was
  misplaced.  Dropping it early for convenience gave race windows for
  accesses to the fkey buffer.  Giant locking accidentally fixed this
  for non-console cases.
  
  Put the spl's around the whole function.  Since there are many returns
  that would need splx() just before them for a direct fix, split the
  function into a wrapper that does the spl's and a "locked" function
  that does the work.
  
  Return earlier when no keyboard is attached to match the ordering in a
  planned version.  This breaks the dubious feature of returning keys
  from the fkey buffer after the keyboard has gone away.  Losing the keys
  wouldn't matter, but we keep them too long now.

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

Modified: stable/11/sys/dev/syscons/syscons.c
==
--- stable/11/sys/dev/syscons/syscons.c Wed Mar 14 07:08:02 2018
(r330909)
+++ stable/11/sys/dev/syscons/syscons.c Wed Mar 14 07:08:46 2018
(r330910)
@@ -1650,6 +1650,7 @@ sc_cnterm(struct consdev *cp)
 }
 
 static void sccnclose(sc_softc_t *sc, struct sc_cnstate *sp);
+static int sc_cngetc_locked(struct sc_cnstate *sp);
 static void sccnopen(sc_softc_t *sc, struct sc_cnstate *sp, int flags);
 static void sccnscrlock(sc_softc_t *sc, struct sc_cnstate *sp);
 static void sccnscrunlock(sc_softc_t *sc, struct sc_cnstate *sp);
@@ -1826,15 +1827,28 @@ sc_cnputc(struct consdev *cd, int c)
 static int
 sc_cngetc(struct consdev *cd)
 {
+int c, s;
+
+/* assert(sc_console != NULL) */
+s = spltty();  /* block sckbdevent and scrn_timer while we poll */
+if (sc_console->sc->kbd == NULL) {
+   splx(s);
+   return -1;
+}
+c = sc_cngetc_locked(NULL);
+splx(s);
+return c;
+}
+
+static int
+sc_cngetc_locked(struct sc_cnstate *sp)
+{
 static struct fkeytab fkey;
 static int fkeycp;
 scr_stat *scp;
 const u_char *p;
-int s = spltty();  /* block sckbdevent and scrn_timer while we poll */
 int c;
 
-/* assert(sc_console != NULL) */
-
 /* 
  * Stop the screen saver and update the screen if necessary.
  * What if we have been running in the screen saver code... XXX
@@ -1843,15 +1857,8 @@ sc_cngetc(struct consdev *cd)
 scp = sc_console->sc->cur_scp; /* XXX */
 sccnupdate(scp);
 
-if (fkeycp < fkey.len) {
-   splx(s);
+if (fkeycp < fkey.len)
return fkey.str[fkeycp++];
-}
-
-if (scp->sc->kbd == NULL) {
-   splx(s);
-   return -1;
-}
 
 c = scgetc(scp->sc, SCGETC_CN | SCGETC_NONBLOCK, 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: r330909 - stable/11/sys/dev/syscons

2018-03-14 Thread Eitan Adler
Author: eadler
Date: Wed Mar 14 07:08:02 2018
New Revision: 330909
URL: https://svnweb.freebsd.org/changeset/base/330909

Log:
  MFC r305010:
  
  Add screen locking calls to sc cn grab and ungrab.  The locking functions
  just use the same mutex locking as sc cn putc so they have the same
  defects.
  
  The locking calls to acquire the lock are actually in sc cn open and close.
  Ungrab has to unlock, although this opens a race window.
  
  Change the direct mutex lock calls in sc cn putc to the new locking
  functions via the open and close functions.  Putc also has to unlock, but
  doesn't keep the screen open like grab.  Screen open and close reduce to
  locking, except screen open for grab also attempts to switch the screen.
  
  Keyboard locking is more difficult and still null, even when keyboard
  input calls screen functions, except some of the functions have locks
  too deep to work right.
  
  This organization gives a single place to fix some of the locking.

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

Modified: stable/11/sys/dev/syscons/syscons.c
==
--- stable/11/sys/dev/syscons/syscons.c Wed Mar 14 04:00:00 2018
(r330908)
+++ stable/11/sys/dev/syscons/syscons.c Wed Mar 14 07:08:02 2018
(r330909)
@@ -1651,8 +1651,22 @@ sc_cnterm(struct consdev *cp)
 
 static void sccnclose(sc_softc_t *sc, struct sc_cnstate *sp);
 static void sccnopen(sc_softc_t *sc, struct sc_cnstate *sp, int flags);
+static void sccnscrlock(sc_softc_t *sc, struct sc_cnstate *sp);
+static void sccnscrunlock(sc_softc_t *sc, struct sc_cnstate *sp);
 
 static void
+sccnscrlock(sc_softc_t *sc, struct sc_cnstate *sp)
+{
+SC_VIDEO_LOCK(sc);
+}
+
+static void
+sccnscrunlock(sc_softc_t *sc, struct sc_cnstate *sp)
+{
+SC_VIDEO_UNLOCK(sc);
+}
+
+static void
 sccnopen(sc_softc_t *sc, struct sc_cnstate *sp, int flags)
 {
 int kbd_mode;
@@ -1682,6 +1696,7 @@ sccnopen(sc_softc_t *sc, struct sc_cnstate *sp, int fl
 over_keyboard: ;
 
 /* The screen is opened iff locking it succeeds. */
+sccnscrlock(sc, sp);
 sp->scr_opened = TRUE;
 
 /* The screen switch is optional. */
@@ -1700,6 +1715,7 @@ static void
 sccnclose(sc_softc_t *sc, struct sc_cnstate *sp)
 {
 sp->scr_opened = FALSE;
+sccnscrunlock(sc, sp);
 
 if (!sp->kbd_opened)
return;
@@ -1733,8 +1749,10 @@ sc_cngrab(struct consdev *cp)
 
 sc = sc_console->sc;
 lev = atomic_fetchadd_int(>grab_level, 1);
-if (lev >= 0 && lev < 2)
+if (lev >= 0 && lev < 2) {
sccnopen(sc, >grab_state[lev], 1 | 2);
+   sccnscrunlock(sc, >grab_state[lev]);
+}
 }
 
 static void
@@ -1745,14 +1763,17 @@ sc_cnungrab(struct consdev *cp)
 
 sc = sc_console->sc;
 lev = atomic_load_acq_int(>grab_level) - 1;
-if (lev >= 0 && lev < 2)
+if (lev >= 0 && lev < 2) {
+   sccnscrlock(sc, >grab_state[lev]);
sccnclose(sc, >grab_state[lev]);
+}
 atomic_add_int(>grab_level, -1);
 }
 
 static void
 sc_cnputc(struct consdev *cd, int c)
 {
+struct sc_cnstate st;
 u_char buf[1];
 scr_stat *scp = sc_console;
 #ifndef SC_NO_HISTORY
@@ -1764,7 +1785,7 @@ sc_cnputc(struct consdev *cd, int c)
 
 /* assert(sc_console != NULL) */
 
-SC_VIDEO_LOCK(scp->sc);
+sccnopen(scp->sc, , 0);
 
 #ifndef SC_NO_HISTORY
 if (scp == scp->sc->cur_scp && scp->status & SLKED) {
@@ -1799,7 +1820,7 @@ sc_cnputc(struct consdev *cd, int c)
 s = spltty();  /* block sckbdevent and scrn_timer */
 sccnupdate(scp);
 splx(s);
-SC_VIDEO_UNLOCK(scp->sc);
+sccnclose(scp->sc, );
 }
 
 static int
___
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: r330884 - in head/sys: dev/cxgbe dev/cxgbe/firmware dev/cxgbe/tom modules/cxgbe/tom

2018-03-14 Thread O. Hartmann
On Wed, 14 Mar 2018 06:25:10 +0100
"O. Hartmann"  wrote:

> On Tue, 13 Mar 2018 23:05:51 + (UTC)
> John Baldwin  wrote:
> 
> > Author: jhb
> > Date: Tue Mar 13 23:05:51 2018
> > New Revision: 330884
> > URL: https://svnweb.freebsd.org/changeset/base/330884
> > 
> > Log:
> >   Support for TLS offload of TOE connections on T6 adapters.
> >   
> >   The TOE engine in Chelsio T6 adapters supports offloading of TLS
> >   encryption and TCP segmentation for offloaded connections.  Sockets
> >   using TLS are required to use a set of custom socket options to upload
> >   RX and TX keys to the NIC and to enable RX processing.  Currently
> >   these socket options are implemented as TCP options in the vendor
> >   specific range.  A patched OpenSSL library will be made available in a
> >   port / package for use with the TLS TOE support.
> >   
> >   TOE sockets can either offload both transmit and reception of TLS
> >   records or just transmit.  TLS offload (both RX and TX) is enabled by
> >   setting the dev.t6nex..tls sysctl to 1 and requires TOE to be
> >   enabled on the relevant interface.  Transmit offload can be used on
> >   any "normal" or TLS TOE socket by using the custom socket option to
> >   program a transmit key.  This permits most TOE sockets to
> >   transparently offload TLS when applications use a patched SSL library
> >   (e.g. using LD_LIBRARY_PATH to request use of a patched OpenSSL
> >   library).  Receive offload can only be used with TOE sockets using the
> >   TLS mode.  The dev.t6nex.0.toe.tls_rx_ports sysctl can be set to a
> >   list of TCP port numbers.  Any connection with either a local or
> >   remote port number in that list will be created as a TLS socket rather
> >   than a plain TOE socket.  Note that although this sysctl accepts an
> >   arbitrary list of port numbers, the sysctl(8) tool is only able to set
> >   sysctl nodes to a single value.  A TLS socket will hang without
> >   receiving data if used by an application that is not using a patched
> >   SSL library.  Thus, the tls_rx_ports node should be used with care.
> >   For a server mostly concerned with offloading TLS transmit, this node
> >   is not needed as plain TOE sockets will fall back to software crypto
> >   when using an unpatched SSL library.
> >   
> >   New per-interface statistics nodes are added giving counts of TLS
> >   packets and payload bytes (payload bytes do not include TLS headers or
> >   authentication tags/MACs) offloaded via the TOE engine, e.g.:
> >   
> >   dev.cc.0.stats.rx_tls_octets: 149
> >   dev.cc.0.stats.rx_tls_records: 13
> >   dev.cc.0.stats.tx_tls_octets: 26501823
> >   dev.cc.0.stats.tx_tls_records: 1620
> >   
> >   TLS transmit work requests are constructed by a new variant of
> >   t4_push_frames() called t4_push_tls_records() in tom/t4_tls.c.
> >   
> >   TLS transmit work requests require a buffer containing IVs.  If the
> >   IVs are too large to fit into the work request, a separate buffer is
> >   allocated when constructing a work request.  This buffer is associated
> >   with the transmit descriptor and freed when the descriptor is ACKed by
> >   the adapter.
> >   
> >   Received TLS frames use two new CPL messages.  The first message is a
> >   CPL_TLS_DATA containing the decryped payload of a single TLS record.
> >   The handler places the mbuf containing the received payload on an
> >   mbufq in the TOE pcb.  The second message is a CPL_RX_TLS_CMP message
> >   which includes a copy of the TLS header and indicates if there were
> >   any errors.  The handler for this message places the TLS header into
> >   the socket buffer followed by the saved mbuf with the payload data.
> >   Both of these handlers are contained in tom/t4_tls.c.
> >   
> >   A few routines were exposed from t4_cpl_io.c for use by t4_tls.c
> >   including send_rx_credits(), a new send_rx_modulate(), and
> >   t4_close_conn().
> >   
> >   TLS keys for both transmit and receive are stored in onboard memory
> >   in the NIC in the "TLS keys" memory region.
> >   
> >   In some cases a TLS socket can hang with pending data available in the
> >   NIC that is not delivered to the host.  As a workaround, TLS sockets
> >   are more aggressive about sending CPL_RX_DATA_ACK messages anytime that
> >   any data is read from a TLS socket.  In addition, a fallback timer will
> >   periodically send CPL_RX_DATA_ACK messages to the NIC for connections
> >   that are still in the handshake phase.  Once the connection has
> >   finished the handshake and programmed RX keys via the socket option,
> >   the timer is stopped.
> >   
> >   A new function select_ulp_mode() is used to determine what sub-mode a
> >   given TOE socket should use (plain TOE, DDP, or TLS).  The existing
> >   set_tcpddp_ulp_mode() function has been renamed to set_ulp_mode() and
> >   handles initialization of TLS-specific state when necessary in
> >   addition to DDP-specific state.
> >